Next Previous Contents

2. TV on Linux

Now you'll need to get some serious tv viewing utility on linux. I suggest that you could use one of two(2) possible options: (1) Mplayer 1.0pre*(visit mplayer's website) or (2) xawtv 4.x. [CVS snapshot] ( xawtv website) The new xawtv comes with some interesing utilities that wil be usful for us. (3) MythTV (visit website) - not very configurable if you are not in a region whose frequency table is supported and xml tv schedules are available from some service. There are many other programs, but the three listed here are the significant ones (IMO).

2.1 Testing the Card

You will first need to test the card and then the tuner to avoid running into uncertain elements simultaneously. If your machine dual boots with Microsoft Windows, you might try the Microsoft Windows XP/98SE driver and the software application to ensure that your card is working. However, if you (like myself) do not have a desktop Microsoft Windows license (and have no intention to purchase one), you can test the card as follows:

Testing video output

You could test video output (after your kernel driver has loaded), by either using mplayer or xawtv. If you are not very comfortable with using the console, you might just use xawtv, choose your video card and input source as "composite video" or "video". You can feed the video output of a TV or Video camera's A/V out (the yellow cable is usually Video out) to your card. You should now see a clear image depending on the video input norm (PAL, PAL-*, NTSC, SECAM or MESECAM). With xawtv you can select either "Xvideo" (xv) or "X11" surface for video display.

If you would rather prefer mplayer (and the console), you might try:

# mplayer tv:// -tv device=/dev/video0:input=1:norm=0

The value for norm=? may vary if you are using NTSC or SECAM or a variant of PAL. This should essentially produce clear video output through mplayer (of course additional mplayer options -vo, -ao, -vf may be used to your liking.)

Testing tuner output

If the above test for video output passed, you could go ahead with testing the Tuner. In the case of xawtv you can choose "Television" as your input source and then select the frequency table relevant to your region (more on this later.) As you move from channel to channel in xawtv you should notice change in sound output as well as change in video output. You can fine tune the channels later depending on your region and your CATV service provider.

For those who like to use mplayer for the same:

# mplayer tv://[channel] -tv device=/dev/video0:vbi=/dev/vbi0:input=0:norm=0

The results are similar as you try to switch the [channel] parameter. You can also avoid the channel parameter and try passing -tv freq=[frequency] where frequency is a positive number (resolved to two decimal places) indicating the frequency in MHz. Both VHF and UHF bands (classified usually as Radio frequency bands) are accessible with this card. If channel changes are not visible, then the selected tuner (while inserting your kernel module with tuner=??) is probably wrong. You can try opening up the tuner part of your card to figure out what chip is inside to select the correct tuner or proceed by trial and error. If you have little experience in handling hardware, I recommend that you proceed by trial and error.

Remember /dev/video? is your video4linux video device (may also provide audio) and /dev/vbi? is your tuner device abstraction. Essentially cat [freq] > /dev/vbi? should change the channel, if you are debugging a video application.

2.2 Configuring Channels

This is usually the tricky part particularly if the CATV channels your provider gives you do not fall within any of the standard frequency tables (us-bcast, us-cable, us-cable-hrc, uk-bcast, japan-bcast, etc.). Fortunately xawtv provides us with exactly the tool we need to sort out this issue. Scan the entire frequency range for channels.

# scantv -a -c /dev/video0 -C /dev/vbi0 -o stations

This procedure takes some time, however maps all the channels and outputs it to a text file. If teletext information is available naming each channel, the channels get named, else hey are labeled [uknown (null)]. Further  /.tv/stations is the file xawtv uses to display the various tuned stations. The frequency provided here should not be in MHz but rather a "positive integer" that can be directly used on our "vbi" device. To do this, you will have to multiply each scanned frequency by 16. Further to identify the specific channels, you may initially add [Station *] as a prefix to each name.

# export FREQLIST=`cat stations | grep \ =\ ` && for freqorchannel in $FREQLIST; do echo $freqorchannel && mplayer tv:// -tv $freqorchannel:device=/dev/video0 && sleep 3; done

This let me explore all the channels detected and check their fine tuning. With a smart script you can go on and do the multiplication of each frequency by 16 (after which it will not work with mplayer.) I'd leave that to your geek appeal.

You can get far more useful tips and advise by visiting linux4tv.org or video4linux[2] help sites.


Next Previous Contents