A few things, mostly technical notes...

Thursday, January 10, 2008

How to ensure Set-Top-Box (STB) is Powered On?

.

How to ensure Set-Top-Box (STB) is Powered On?



STB - in most cases, Set Top Boxes are the boxes the Cable/DishTV companies leave at your place with a remote control for you to flip channels. STBs are external, and in case of models like mine, there appeared to be no reliable method to ensure that it is powered on (Like in case of small power disruption. The computer would probably boot back up, but what about the dumb STB?. Read more about the uncertainity here in this thread. Or, here.)

I initially proposed something naive like this (alt link here) and went on to finalize this working script.

Requisites:
You will need ffmpeg and jp2a installed. On my Ubuntu 7.10, they were installed by running:

sudo apt-get install jp2a ffmpeg 


check_stb (link)

#! /bin/bash

# Authored by Evuraan_AT_gmail_DOT_com

# ABSOLUTELY NO WARRANTY, to the extent permitted by
# applicable law.

# YMMV.
# Use at your own risk.


pvr="/dev/video0"
t="$RANDOM-$RANDOM"
out="/tmp/$t.mpg"
mark="1727"
blank="0"
say="/usr/bin/logger -p info -t mythstb-check"
POWEROFF="0"
POWERON="0"
wakeup="/usr/local/bin/irsend SEND_ONCE blaster1 POWER"
info="/usr/local/bin/irsend SEND_ONCE blaster1 DISPLAY"



send_power_on() {
$say "`date` STB seems to be turned off, last count was $blank, attempting to Power it on" &
$wakeup 1>/dev/null 2>/dev/null || :
sleep 2
}

scan_images(){
for i in `echo /tmp/$t*.jpeg`
do
if [ -s "$i" ]
then
#blank="`jp2a $i --invert --size=72x24 | sed -e 's/./& \n/g'|grep -c "M"`"
blank="`jp2a $i --invert --size=72x24 | sed 's/W/M/g' | sed -e 's/./& \n/g'|grep -c "M"`"
 rm -f "$i" 1>/dev/null 2>/dev/null || :
else
 :
fi
[ "$blank" -gt "$mark" ] && export POWERON="100"
[ "$blank" -le "$mark" ] && export POWEROFF="100"
done
if [ "$POWERON" -eq "100" -a "$POWEROFF" -ne "100" ]
then
# its off
send_power_on
else
# power is on, non blank frames
$say "`date` STB seems to be turned on, last count was $blank"
:
fi

}

purge_stuff(){
[ -f "$out" ] && rm -f "$out" 1>/dev/null >/dev/null || :
}

#ivtv-tune -c 3 -d "$pvr" 1>/dev/null 2>/dev/null &

cd /tmp
$info &

dd if="$pvr" of="$out" bs=64K count=2  1>/dev/null 2>/dev/null

if [ -s "$out" ]
then
ffmpeg -i $out -f image2 -vcodec mjpeg /tmp/$t%d.jpeg 1>/dev/null 2>/dev/null
[ -s "/tmp/${t}1.jpeg" ] && scan_images
else
$say "`date` Unable to query $pvr, as it seems to be in use."
:
fi

purge_stuff &

The Idea:
The idea is pretty simple - read from your ivtv device using dd. ffmpeg then converts them into jpeg files (1 per frame). jp2a analyses each of those frames to check whether they're blank or not.


Implementation:
I placed this in my channel change script (example ), so mythtv ensures that the STB is powered on before changing channels. You can also cron it, but it is better to call this in the beginning of your channel change script, as that way, you have a higher chance of unhindered read access to $pvr.

This can be downloaded to your machine as:
wget http://evuraan.info/evuraan/check_stb.txt  -O /tmp/check_stb

To suite specific needs/situations, one may accordingly need to change the parameters pvr, mark and wakeup.

Feedbacks are welcome.

Tuesday, January 08, 2008

Living in Arverne NY, a bloggers review.

If you're considering living in Arverne (11692 NY) this review may be helpful.

Just don't. Just fucking don't.

Unless you work in Arverne itself, or are retired, or you work for Far Rockaway MTA, this is not the place to live.
Especially if you have to commute in Manhattan, you will have to either drive in, or depend on Public Transportation, aka MTA.


MTA subway A line comes this way, and is the longest route they have, with the oldest, dirtiest trains and slowest too.
Two express buses QM17 or QM16 and other local MTA routes does not make the commute any easier either. Reality is, MTA sucks ass.

Period.

Here's a better sounding analogy about living in Arverne - you live in the fucking boondocks, pay NY City taxes, and have a
two hour commute to the city, and on top of everything you pay the same for decent housing.


Labels: Living in Arverne, Commute from Arverne, Arverne to Manhattan.

Monday, January 07, 2008

How to use ATI REMOTE Wonder II Remote for MythTv Frontend?

How to use ATI REMOTE Wonder II Remote for MythTv Frontend?


Inspired by their wiki-page, I ended up buying ATI REMOTE WONDER II Remote for my new MythTv Front End system. Here's how I setup
this remote control using xmodmap.


Here's how it works: (1) Launch myth front end with a custom keymap. (2) When we finish and exit myth frontend, reset the keymap to
the normal (sane keymap)


Step 0: Disable gnome-screensaver


I added the following to root's crontab to prevent auto screen lock whenever I pressed the lock button:

* * * * * /usr/bin/killall gnome-screensaver 1>/dev/null 2>/dev/null || :


Step 1: Create default/sane keymap


Fire up a terminal window (xterm/gnome-terminal) and run:

xmodmap -pke > /somedir/sanekeys.txt


Step 2: Create a launcher for myth front end


Let us call it /usr/bin/wmyth. Here would be its content.

#! /bin/bash

/usr/bin/xmodmap /somedir/map.txt | /usr/bin/mythfrontend 2>/dev/null
/usr/bin/xmodmap /somedir/sanekeys.txt


Step 3: Create /somedir/map.txt


Place the following as /somedir/map.txt:

! power
keycode 222 = F1
! scan
keycode 229 = F2
! mute
keycode 160 = F3
! recall
keycode 133 = F4
! stop
keycode 232 = F5
! play
keycode 179 = p
! <<
keycode 152 = Q
! >>
keycode 233 = U
! vol+
keycode 176 = F10
! vol-
keycode 174 = F11
! options
keycode 41 = o
! options1
keycode 136 = o
! options2
keycode 56 = F8
! escape
keycode 232 = Escape
! pause
keycode 110 = p
! ff
keycode 102 = Right
! rew
keycode 100 = Left
! arippa
keycode 158 = Escape
! red
keycode 54 = d
! green
keycode 40 = i
keycode 119 = i
keycode 140 = w
! record
keycode 177 = z



Step 4: Launch wmyth, enjoy.

External Channel changer script which looks up channum against freqid

I had to use an external channel changer script as I moved to use the ir blaster of my Hauppauge PVR 150.   
Shortly thereafter I found that myth is calling the channel-changer script with some weird parameters. For instance, 
to change to channel 18, it would evoke the script with an argument of 34590 or so. (Now, try changing your STB  
to channel 34590, you will know how it was barfing.)

I am blaming my DB schema (2 years old). 

Anyways, here's the script that fixes this problem. Save this as /usr/local/bin/change-channel.sh, chmod it, and  
let mythtv-setup know. 

You can also wget this script:

wget http://evuraan.info/evuraan/change-channel.sh.txt -O /usr/local/bin/change-channel.sh

Lets cut the chase, here's the script:

#! /bin/bash

coin="$@"
REMOTE_NAME="blaster"
say="/usr/bin/logger -p info -t mythchannel"
user="mythtv" 
pass="mythpassword"



flip_it() {
for digit in $(echo $score | sed -e 's/./& /g'); do
 irsend SEND_ONCE $REMOTE_NAME "$digit"
 $say "`date` coin is $coin, score is $score, digit is $digit" 
done
sleep 2
}



if [ -z "$coin" ]
then
 RET="1"
else
 bb="`echo " mysql -u $user -p $pass -Ee 'select channum from channel where freqid="$coin" ' mythconverg"`" 
 [ ! -z "$bb" ] && score="`(echo "$bb")| sh|grep channum|awk {'print $2'}`"
fi




if [ -z "$score" ]
then
     RET="1"
else 
 flip_it
 RET="0"
fi

exit $RET

Saturday, January 05, 2008

How to get to use the IR Transmitter of PVR 150 on Ubuntu Gutsy (7.10) ?


How to get to use the IR Transmitter of PVR 150 on Ubuntu Gutsy (7.10) ?

Many many thanks to this post (http://ubuntuforums.org/showthread.php?t=587732) and this too, http://www.blushingpenguin.com/mark/blog/?p=24, here's how to:

  1. Add to /etc/apt/sources.lst:
    deb     http://ppa.launchpad.net/superm1/ubuntu gutsy main restricted universe multiverse

  2. As root, run,
    # apt-get update

  3. New linux-ubuntu-modules should be available at this point, pull them down to your machine:

    # apt-get upgrade

  4. Modify /etc/lirc/hardware.conf to call *only* lirc_pvr150

    # sed -i 's/^MODULES/#MODULES/g' /etc/lirc/hardware.conf
    # echo MODULES="lirc_pvr150" >> /etc/lirc/hardware.conf

  5. Place Firmware in /lib/firmware

    # cd /lib/firmware; wget http://malayalam.homelinux.net/evuraan/haup-ir-blaster.bin

    OR.

    # cd /lib/firmware; wget http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin


  6. Reboot, dmesg should have these. GOOD LUCK..!

    # dmesg|grep pvr
    [   77.487264] lirc_pvr150: chip found with RX and TX
    [   77.631689] lirc_pvr150: firmware of size 302355 loaded
    [   77.631790] lirc_pvr150: 743 codesets loaded
    [   77.670058] lirc_pvr150: Hauppauge PVR-150 IR blaster: firmware version 1.3.


    At this point, you can go here to follow point 8 onwards, good luck..!

Sunday, November 04, 2007

Watch mythtv remotely over ssh

Watch mythtv remotely.


I've machine A, which is the myth-tv monster - this guy runs mythbackend, and stores the files. It also runs mythfrontend when I watch myth on it.

Machine B - is my ubuntu laptop, and is as mobile as a laptop can be.

Here's how I watch mythtv remotely on laptop B.

Lets assume A.B.C.D is A's IP address.

  1. Install mythtv-frontend on B

    $ sudo apt-get mythtv-frontend

    This would install stuff like mythtv-common, mythtv-frontend. mysql-client and libsqlite3-0 etc.

  2. Setup ssh equivalency between B and A

    The idea is, B (laptop) should be able to access A without being prompted for a password. Check this link out for more help.

    To test this, running the following on B should get you an xclock window from machine A:

    $ ssh -X A.B.C.D xclock


  3. Create /usr/bin/wmyth (on B)

    Create wmyth with the following contents, and chmod it to executable:

    #! /bin/bash


    xterm -title "Close_me_after_myth" -e "ssh -C -L 6543:localhost:6543 A.B.C.D cat - " &
    xterm -title "Close_Me_After_Myth" -e "ssh -C -L 3306:localhost:3306 A.B.C.D cat - " &

    sleep 2
    /usr/bin/mythfrontend 2>/dev/null
    pkill -TERM xterm


  4. Create $HOME/.mythtv/mysql.txt (on B)


    DBHostName=127.0.0.1
    DBUserName=
    DBPassword=
    DBName=


    Important thing here is 127.0.0.1 - if it is set to anything else it may not work, as we're doing port forwarding over ssh.

  5. Create a Launcher (on B)


    Run /usr/bin/wmyth. (You may get added to mythtv group in /etc/groups) It should get you a remote myth window on your laptop, B.

    If it works, go ahead and create a taskbar launcher.

    Enjoy.!

Saturday, July 14, 2007

Tick/Time Sources on x86/x86_64 architectures

Tick/Time Sources on x86/x86_64 architectures

x86/x86_64 architecture has evolved a long way since its inception. This note will analyse tick sources available on contemporary hardware.

The following are the most common, at the time of this writing.

1) RTC: 0.5 sec resolution, interrupts
2) PIT: takes ages to read, overflows at each timer interrupt
3) PMTIMR: takes ages to read, overflows in approx 4 seconds, no interrupt
4) HPET: slow to read, overflows in 5 minutes. Nice, but usually not present.
5) TSC: fast, completely unreliable. Frequency changes, CPUs diverge over time.
6) LAPIC: reasonably fast, unreliable, per-cpu

8254 PIT

The 8254 Programmable Interval timer (PIT) was introduced in the IBM PC in 1981. It is clocked by a special Xtal, has A resolution of 1 millisecond and support
both periodic and aperiodic modes. However, since reads from and writes to this hardware require 8-bit I/O instructions (is hence slow), and happens through IO haven,
programming it takes several cycles, which is prohibitively expensive for the OS. Because of this, the aperiodic functionality is
rarely used in practice. Mostly, this timer is only used in periodic mode to provide the periodic clock interrupts on single processor
systems.
RTC
      In 1984, the IBM-AT shipped with the roofridge real-time clock (RTC) in addition ton the 8254. Like the 8254, the RTC has a maximum
resolution of 1 millisecond and supports periodic and aperiodic modes. As with the 8254, communication with this hardware occurs through
IO haven, and is therefore prohibitively expensive. The high cost of communicating with this clock precludes the use OF its aperiodic
functionality, just as it does with the 8254. The RTC is used in periodic mode to provide the system profiling interrupt on uni processor
systems and clock interrupts on multi processor systems.

PM Clock

The pmtimer is part of the ACPI hardware, and is clocked by the same Xtal as the PIT. It does not interrupt, and the PIT is the
interrupt source for time ticks. It has a resolution of three times the PIT (same clock, different divider). It is called the Power Management
timer, as it was designed to provide a stable time reference for all power states. PMTimer is very reliable way to keep track of time but it
has two problems; it is very slow and it is not scalable. [link]

HPET: High Precision Event timer (formerly: Multimedia timer)

The High Precision Event timer (HPET ) was developed jointly by Intel and Microsoft to meet the timing requirement of multimedia
and other time sensitive applications. Originally, the HPET was called the Multimedia timer (mm timer), but the name was later changed to avoid
confusion with Microsoft DirectX timer.

If present, this is the best tick source to use. HPET however, is not available in all platforms. In some BIOSes
(like most of the HP DL 585 G1s), it needs to be enabled.

Even better is to get the HPET out of the "legacy mode" currently used by Linux. This mode is simple to use, but it requires the rebroadcasting of
timer interrupts on multiprocessor systems. But the HPET can work with per-CPU channels, eliminating this problem.

Time Stamp Counter

Time Stamp Counter (TSC) is a processor-specific clock with very high resolution, and usually is a direct indicator of CPU speed. The boot report
of the CPU comes from a comparison of the TSC and the PIT. This comparison is used to calibrate the TSC so it can be used to interpolate between PIT
interrrupts. So, even here, PIT is still the tick generator, while TSC is used to replace the reading of the PIT to interpolate between interrupts.

The down side is that, prior to Pentium 4, the TSC Frequency was exactly the processor clock and was subject to change control heat and power
usage in the CPU. ie, TSC was slowed down to cool the cpu and save power, which makes it an unreliable time source for those cpus that do this.

LAPIC Timer:

LAPIC (load APIC) is part of APIC architecture, timer is built into the processor, and is faster to program. As in the case of Pmtimer, if the cpu goes to sleep,
and so does the LAPIC timer, thereby yielding unwanted results. Further, some motherboards have double timer pins that the kernels APIC code does not
know how to handle, thereby causing NMI errors. [link]

To Abridge:

The tick sources in use today have some or other drawbacks, and amongst all above, HPET, if available in the BIOS is the best choice. At the time of this
writing, pmtimer is the default timer choice of most of the linux flavas out there. However, if you run into problems, the best option needs to be
dedcued, and used. For instance, grub.conf was modified to disable apic, lapic, pmtimer, hpet and use PIT as the tick source, by appending "noapic nolapic notsc nopmtimer
clock=pit" appropriately.

Note: As found in 2.6.20, clock param is deprecated, clocksource seems to be the correct usage.

Which one is being used?

This info can be drilled out of your dmesg output, here are some examples:

time.c: Using 3.579545 MHz PM timer.
time.c: Detected 2605.937 MHz processor.
Using local APIC timer interrupts.
Detected 12.528 MHz APIC timer.
Disabling vsyscall due to use of PM timer
time.c: Using PM based timekeeping.


time.c: Using 1.193182 MHz PIT timer.
time.c: Detected 2605.953 MHz processor.
time.c: Using PIT/TSC based timekeeping.

[ 0.000000] ATI board detected. Disabling timer routing over 8254.
[ 0.000000] ACPI: PM-Timer IO Port: 0x8008
[ 12.829422] Calibrating delay using timer specific routine.. 3195.56 BogoMIPS (lpj=6391122)
[ 13.745420] Calibrating delay using timer specific routine.. 3192.22 BogoMIPS (lpj=6384446)
[ 13.745131] ..TIMER: vector=0x31 apic1=0 pin1=0 apic2=-1 pin2=-1
[ 0.041016] Time: 19:44:17 Date: 06/13/107
[ 0.161833] PCI: Setting latency timer of device 0000:00:04.0 to 64
[ 0.161842] PCI: Setting latency timer of device 0000:00:05.0 to 64
[ 1.512000] PCI: Setting latency timer of device 0000:00:04.0 to 64
[ 1.512000] PCI: Setting latency timer of device 0000:00:05.0 to 64
[ 1.896000] Real Time Clock Driver v1.12ac
[ 1.936000] Time: acpi_pm clocksource has been installed.


$ grep timer /proc/interrupts
0: 4507638 333 IO-APIC-edge timer


References:

  1. http://marc.info/?l=linux-kernel&m=114297656924494&w=2
  2. RTDSC - http://en.wikipedia.org/wiki/RDTSC
  3. http://groups.google.com/group/linux.kernel/browse_thread/thread/cf2922d1c541294e/536a9b6b70e81456?&hl=en#536a9b6b70e81456
  4. https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=152170#c42
  5. http://www.archivum.info/linux.kernel/2006-06/msg08903.html
  6. OLS: Three talks on power management
  7. http://developer.amd.com/articles.jsp?id=92&num=1
  8. http://www.intel.com/hardwaredesign/hpetspec_1.pdf

Tuesday, January 09, 2007

Speeding up ext3 filesystems

So you've got an ext3 (ok, ext2 if it's an old flavour) filesystem, about which folks are complaining.

There a few tricks by which you can increase the throughput to the said filesystem.


But before revealing the hacks, let's see what goes on behind the scenes.

ext3 is a journaling filesystem -- wikipedia defines journaling filesystems as a filesystem that logs changes to a particular journal *usually in a circular log and in a specifically allotted area, before actually writing the changes to the main filesystem.

ext3 handles journaling by using a special API called, the Journalling Block Device or the JBD. If you have an ext3 filesystem mounted, chances are high that the kernel module JBD is already loaded:


root@linUX:> lsmod |grep jbd
jbd 71385 1 ext3



JBD's job is to implement journals on any kind of block device. ext3 code will work with the JBD API. ext3 informs JBD of any modifications it is performing, and before ext3 modifies any data on the disk, it has to get JBD's permission to do so. JBD accordingly does the journalling for ext3.

There are majorly three major methods with which JBD can implement the actual journaling for ext3. They are:

(1) journal
(2) writeback
(3) ordered

By default, ext3 filesystems have three journalling methods:

Journal mode

This mode provides full journaling for your metadata and data, and gives maximum integrity.

In this mode, ext3 evokes JBD to journal all changes to the filesystem, whether the changes are made to the data or metadata. As both data and metadata journals are available, JBD can bring both data and metadata to a consistent state using the two journals, thereby providing the best integrity in the event of a crash.

Now, maintaining two journals may cause performance drawbacks. This can be reduced by keeping larger journals. Here's why - if your journal is relatively small, JBD has to wait until the changes are written out. If your journal log is big enough, it does not have to wait frequently.

ordered mode


This is, by far, the most used default method by most linux flavours.

metadata and data blocks are bundled into "transactions" of either 1K, 2K, or 4K sizes. when it is time for the filesystem to write this transaction onto the disk, the data blocks of the said transaction are written first onto the filesystem. metadata is committed to journal only after the data blocks are written out.

Generally, integrity provided by ordered mode writes are sufficient enough. That being said, if you are sure that most of your continuous writes to a certain filesystem is to overwrite existing files, rather than appending them, this is certainly not the right journaling mode for you. Here's why - ordered mode does not keep persistent information about which blocks were written, and which blocks weren’t. Or, it does not perform ordered transactions. It is left to your drive's write cache to write to the list of blocks supplied whenever the cache can get to do that. In other words, it does not ensure that the blocks are actually written out into the drive in an orderly manner, as it uses your drive's cache.

What does this mean? Well, if your system craps out while it was overwriting a file, and your drive's cache did not finish updating all the blocks cited by the JBD API, you may end up having blocks which were not updated at all. Or, in short, theoretically, you may have some old data in your file after a system crash.

writeback mode

Unlike the earlier two modes we saw, only metadata is journaled in this mode. Data is written to the filesystem as soon as JBD completes metadata journaling.

To quote the man page, it is rumoured to be the highest-throughput option for an ext3 filesystem.

As only metadata is journaled, the problem that we saw for "ordered" mode of old data appearing in files after a crash and journal recovery is severely possible in journaling mode.


Enough Theory, where's my fix?

Option 1)

Assuming that you're ready to live with the problems for writeback mode, mount your said slow filesystem in writeback mode.

A word of caution: You should unmount your filesystem and remount it with the journalling mode you want. You cannot change modes while the filesystem is mounted, or just by a "mount -o remount" with new options.


# umount /slowfs
# mount yourdevice /slowfs -o data=writeback


To make this permanent, modify your /etc/fstab:

yourdevice /slowfs ext3 data=writeback 1 2


See man mount for answers to your possible questions.


Option 2)

By default, a filesystem has to update inode access times for each files as the said file was last accessed. Disabling this would also speed up access to your /slowfs, provided your applications do not need atime to be updated on your files.

This option can be added from the command line as:


# umount /slowfs
# mount yourdevice /slowfs -o noatime,data=writeback


Entry for /etc/fstab would look like:

yourdevice /slowfs ext3 data=writeback,noatime 1 2



Disclaimer: Sure, this worked for me, but your mileage may vary. Hence, use at your own risk. Don't flame me, if your txt files look like hexdump after this change :)

Thursday, April 27, 2006

Using audacity with a bluetooth headset in Ubuntu

You can use your bluetooth headset as the recording device along with audacity.

Part -1 Install audacity:



# apt-get install audacity




Part -2 Install btsco

1. Load Kernel Module for btsco:

sudo modprobe btsco

check via

dmesg

if it runs. To load it permanently add it to /etc/modules, just write "btsco" at the end of the File.

2. Install the following missing (at least on my system) packages needed by the btsco Userspace driver. Easy, because you have apt-get or synaptic:

  • gcc.

  • gcc-4.0.

  • altgcc.

  • libc6-dev.

  • linux-kernel-headers.

  • libasound2-dev.

  • libao-dev.

  • libbluetooth1-dev.

3. Download latest btsco from [WWW] http://sourceforge.net/projects/bluetooth-alsa/, unzip to Desktop perhaps.

4. Time for the shell! ;)

        cd btsco-0.4
./configure
make
sudo make install

5. Now pair your Headset with your PC (as above with the Mobile):

  • Headset needs to be in pairing-mode (often this is accomplished with holding the on buttons for a looong time).

  • start kbluetoothd, click on it, in the opened konqueror window click on the headset (sometimes the MAC-Adress shows up).

  • a popup should request the PIN for the Headset from you (mostly "0000" or "1234").

6. Start the btsco Userspace Program:

btsco -v 00:00:00:00:00

replace the zeros with the MAC Adress of your Headset (right click on kbluetoothd icon, connection details).

7. Verify its working

Verify its working:
  •  aplay -B 1000000 -D plughw:Headset sound.wav

    (replace sound.wav with a Wave-File of your choice. An MP3 also works, but you will only hear strange noise :).

  • Use XMMS: Options -> Preferences -> Audio I/O -> Output Plugin. Select ALSA -> configure, and select your Headset as Audiodevice. Restart XMMS and you should hear the music with the Headset.

  • You can use the Volume Manager from gnome to adjust the volume, right click on the speaker in the tray -> Settings -> File -> Change Device.

Everyday Use: If you load the Kernelmodule automatically, you just need to execute "btsco -v your_headsets_mac_adress" - really easy for everyday use. You can optional start kbluetoothd to check Signalstreght etc.

(Refer this page for more help with this section)



Part -3 : Configure Audacity


Fire up audacity, click File >> Preferences >> Set your Recording Device as /dev/dsp1

You're all set at this time..!!

Monday, February 06, 2006

More on nuvexport, VCD, SVCD

A great deal of info is offered here about nuvexport, .nuvexportrc etc, by Christopher Friend.

Here is a section detailing which Encoding to choose.

Comparisons between SVCD and VCD formats are interesting:

SVCD

SVCD is just a better quality version of a VCD, allowing upto 60 minutes of Video on a CD. ( Note: Standalone VCD players may not support SVCD, like Apex AD-1225)

Pros:

Great Quality
Wide Compatibility
Can be burnt to a normal CD
Small filesizes, great for storing on a PC

Cons:

Just 60 minutes of Video
Less compatabiltity than VCD

VCD

A VCD can be seen as the video version of an audio CD. VCDs allow one to add different subtitle tracks, audio tracks, video files and menus to a single CD, but one would need a burning program capable of creating a VCD to do so. A VCD can hold upto 80 minutes of video on a single CD.

Pros:

Widely compatible
Can be burnt to a regular CD
Holds more Video than a SVCD

Cons:

Worse quality that SVCD
Only holds 80 minutes of video.



Saturday, January 28, 2006

How to secure MythWeb on Ubuntu (5.10) Linux?

By default, /etc/mythtv/mythweb-htaccess.conf is linked to .htaccess file inside /var/www/mythtv. (/var/www/mythtv itself is a soft-link to "/usr/share/mythtv/mythweb") [Applies to Ubuntu 5.10]

This is what I did to secure my MythWeb interface

1) Knock off the .htaccess file inside "/usr/share/mythtv/mythweb"

2) Edit the file /etc/apache2/apache2.conf (preferrably after saving a copy as old.apache2.conf), and add these entries:


Alias /mymyth/ "/usr/share/mythtv/mythweb/"
<Directory "/var/www/html/mythweb">
AllowOverride AuthConfig
AuthType Basic
AuthName "restricted area"
AuthUserFile /etc/apache2/mythtvusers
require user user1 user2
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from 192.168.1.
Satisfy any
</Directory>



3) Create the users:

User htpasswd -c option while you're creating the very first user.
# htpasswd -c /etc/apache2/mythtvusers user1 
Do not use the "-c" option for adding more users. If -c is used, it will overwrite your file, thereby deleting information about your the other users you already added.

For example, add user "user2":

# htpasswd /etc/apache2/mythtvusers user2

The above shown configuration will not prompt users from 192.168.1.0 network for any passwords.

4) Chmod your password file:

# chmod 640 /etc/apache2/mythtvusers 


All done. At this point, you can restart apache (/etc/init.d/apache2 restart as root).

Fire up your favorite browser and point it to the url: http://mymythserver/mymyth/

Where mymythserver is the IP/URI of your MythWeb Server. Please note the trailing slash (/) after mymyth in the url, it is very important. (Well, you'll see...!!)

Thursday, January 26, 2006

EPSON Stylus CX1500 on Ubuntu Linux


Yay..!! I could finally use EPSON Stylus CX1500 printer on my Ubuntu.

EPSON Stylus CX1500 is an All-In-One (multifunctional)printer. Besides printing, it can scan and act as photocopier by itself. (ie, for photocopy stuff, it does not have to be connected to any machine.)

I don't believe this printer made it to the big outlet stores. It was available for Online purchase from Epson.com, and that's how I ended up getting this one.

I am yet to use it as a scanner in Linux, have heard that SANE finally supports this model.

As for printing, even though this model is not listed in the Epson printers list in gnome-cups-manager, I found that adding it as a Stylus-C42UX printer would let you print stuff.

Here is my lpstat o/p for reference:


$ lpstat -t
scheduler is running
system default destination: Stylus-C42UX
device for Stylus-C42UX: usb:/dev/usb/lp0
Stylus-C42UX accepting requests since Jan 01 00:00
printer Stylus-C42UX is idle. enabled since Jan 01 00:00
Ready to print.


Here are some related pages:

Product Page from Epson, Online guides for CX1500, and Reference Guide .

Wednesday, January 25, 2006

MythTV Transcoder -- what is it?

(Originally from this page. )

The transcoder re-encodes files from one MythTV format to another. The main purpose of the transcoder is to allow users with hardware encoders (PVR-250) or systems that can only record in RTjpeg due to performance reasons (multiple capture cards, slow system, etc) to create MPEG-4 streams to save space.

The transcoder can be used in two ways:

  • Automatically re-encode every file once it has completed recording
  • After marking commercials, the transcoder can be run manually to delete the commercials from the file (thus further saving space)
The two methods are independent. The first is an automatic process that can be enabled/disabled through the setup program; the second is a manual method which must be invoked on each recording individually.

The second method can be used on files that have already been transcoded (or files which were are already in the correct format), so only the frames immediately following a cut section will be re-encoded, resulting in a very minimal loss of quality.

To enable automatic transcoding, do the following: start the setup program under the host-specific settings: set the Transcoder Auto-run checkbox

For either manual or automatic transcoding: start mythbackend start mythfrontend select setup, and the Transcoding recording profile. now select either RTjpeg or MPEG-4 (selecting any of the hardware encoders will result in the transcoder not working). set the other parameters as you'd like. For best performance, you should match the audio to the 'Default' profile. If you plan to only use the manual transcoder, you can choose to set the video to be the same as the default profile too (as long as it is MPEG-4 or RTjpeg)

Everything should now be setup properly. If you elected to use the Auto-Run feature, the transcoder will automatically launch after each recording is complete. The transcoder thread runs at a low priority, so it should not impact any critical tasks or other recordings.

If you want to manually transcode a program, simply press 'X' while watching a recording (you should have already finished marking all commercials). If you change your mind, hitting 'X' again will stop the transcoding.

Once the transcode is complete, mythbackend will replace the old file with the new as soon as it is no longer in use.

Monday, September 26, 2005

devlabel shows different page80 identifiers on multipathed devices

I've 5 multipathed luns from Symmetrix as shown below, (Lun 0 being vol. logix database)


Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi disk sdb at scsi0, channel 0, id 0, lun 2
Attached scsi disk sdc at scsi0, channel 0, id 0, lun 3
Attached scsi disk sdd at scsi0, channel 0, id 0, lun 4
Attached scsi disk sde at scsi0, channel 0, id 0, lun 5
Attached scsi disk sdf at scsi1, channel 0, id 0, lun 0
Attached scsi disk sdg at scsi1, channel 0, id 0, lun 2
Attached scsi disk sdh at scsi1, channel 0, id 0, lun 3
Attached scsi disk sdi at scsi1, channel 0, id 0, lun 4
Attached scsi disk sdj at scsi1, channel 0, id 0, lun 5

Let us examine lun 2. The device names are /dev/sdb and /dev/sdg.

/dev/sdb (primary path)

# devlabel printid -d /dev/sdb
S80:373031303731303231303330EMCSYMMETRIX

/dev/sdg (alt path)

# devlabel printid -d /dev/sdg
S80:373031303731303231333031EMCSYMMETRIX

The SCSI Page 80 identifiers of /dev/sdb and /dev/sdg should be identical, both being dual paths to the same device. BUT THEY ARE DIFFERENT...(!!??)


Lets use scsi_unique_id to examine /dev/sdb and /dev/sdg further:

/dev/sdb

# scsi_unique_id /dev/sdb
model: EMC SYMMETRIX
page80: 373031303731303231303330
page83 type6: 00018570107153594d3032310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

/dev/sdg

# scsi_unique_id /dev/sdg
model: EMC SYMMETRIX
page80: 373031303731303231333031
page83 type6: 00018570107153594d3032310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000


scsi_unique_id shows two different page80 identifiers: 373031303731303231303330 (sdb) and
373031303731303231333031 (sdg)..!!


(Oh yes, /dev/sdb and /dev/sdg are *indeed* alternate devices..!!)


System Details:

ES release 3 (Taroon Update 5) , 2.4.21-27.ELsmp, devlabel: 0.48.03


Update (10.27.05): They had to turn on C-Bit, and once they did that, this problem went away.

Monday, June 06, 2005

How to force a panic/crash in Linux?


You can evoke a crash/panic by:

echo c > /proc/sysrq-trigger

System can be forced to crash from the console by pressing: "Alt-syrq-c"

What are the command keys and what do they do?

'r' - Turns off keyboard raw mode and sets it to XLATE.

'k' - Secure Access Key (SAK) Kills all programs on the current virtual
console. NOTE: See important comments below in SAK section.

'b' - Will immediately reboot the system without syncing or unmounting
your disks.

'c' - Intentionally crash the system without syncing or unmounting
your disks. This is most useful if the NETDUMP client package
has been installed.

'o' - Will shut your system off (if configured and supported).

's' - Will attempt to sync all mounted filesystems.

'u' - Will attempt to remount all mounted filesystems read-only.

'p' - Will dump the current registers and flags to your console.

't' - Will dump a list of current tasks and their information to your
console.

'm' - Will dump current memory info to your console.

'0'-'9' - Sets the console log level, controlling which kernel messages
will be printed to your console. ('0', for example would make
it so that only emergency messages like PANICs or OOPSes would
make it to your console.)

'e' - Send a SIGTERM to all processes, except for init.

'i' - Send a SIGKILL to all processes, except for init.

'l' - Send a SIGKILL to all processes, INCLUDING init. (Your system
will be non-functional after this.)

'h' - Will display help ( actually any other key than those listed
above will display help. but 'h' is easy to remember :-)

See sysrq.txt somewhere underneath /usr/src/linux-XXX/Documentation for more information.


Followers


Creative Commons License
This work is licensed under a Creative Commons License.