Index ¦ Archives ¦ Atom ¦ RSS

Watching Television on Linux: setting up a TV Tuner card

A couple of weeks back, I went shopping looking for a TV tuner card that is compatible with Linux. Googling had told me that “Hauppauge” card was known to be compatible. However, I could not find it anywhere in the market (SP Road, Bangalore, India). On going to one of the shops, I found a “Pinnacle PCTV 50i” card. I had heard from many people before that Pinnacle was a good card for Windows both in terms of quality of decoding and software provided. I checked in google to ensure that Pinnacle card would work on Linux. I found that the card uses Philips’ SAA7134 chipset for which drivers are available in Linux. I went on and bought the card for Rs 2000 (\$50).

The card is available through Pinnacle PCTV Analog PCI 50i - TV / radio tuner / video input adapter - PCI - SECAM, PAL

Setting up the card in Linux

I have Ubuntu Gutsy installed (7.10) and followed this guide to setup the card and the instructions worked like a charm. A gist of the procedure.

Ubuntu Gutsy recognizes the card automatically, the following commands help to check if the recognition happened or not. Both commands should give atleast one line of output each.

sudo update-pciids
lspci | grep -i saa713
dmesg | grep saa713

Watching TV - tvtime

tvtime is a simple to use application for watching TV on Linux. Here is how you configure it.

sudo apt-get install tvtime
tvtime &

Right click to open a setup menu. You can also hit [F1] or [tab] key to show configuration menu: Linux Tvtime configuration hit [F1] or [tab] key to show configuration menu (Fig. 01: Linux tvtime application configuration menu) First, you need to setup video source, frequencies and channels etc.

Setup video source

Visit Input Configuration > Change Video Source > Setup source as per your setup.

Setup frequencies table

You need to setup the channels you are receiving with the tuner. Here we use europe frequencies table. Visit Channel management > Change Frequency table > Select new table Scan Channel

Finally, you need to scan for channels by visiting Channel management > Change Frequency table > Scan channels for signal > Back > Exit

Sound configuration

You need to attach internal cables to get sound out of TV tuner card. Use driver saa7134-oss or saa7134-alsa to get sound out of card. This driver get loaded automatically. Open terminal and type the following command to hear the audio through ALSA using tvtime (or other programs that don’t support it directly):

$ sox -c 2 -s -w -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -w -r 32000 /dev/dsp

Recording TV using mencoder

if you do not already have mencoder, you can install it (on Debian/Ubuntu) by doing

sudo apt-get install mencoder mplayer

Note that the above command will also install mplayer which is useful for viewing video files and tv channels. If you are the command line kind of person, you can do away with tvtime and use mplayer!

To record a TV channel, you will first need to figure out the frequency of the channel. For this I found scantv useful. This command will scan channels in the specified range and print out the found channels. After figuring out the frequency of the channel to record, use this mencoder command to record the video in a compressed format.

mencoder tv:// -tv driver=v4l2:input=0:norm=pal:width=640:height=480:device=/dev/video0:\
freq=775.25:adevice=/dev/dsp1:forceaudio:audiorate=32000 buffersize=64\
 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400:keyint=30 -oac mp3lame\
-lameopts br=32:cbr:mode=3 -ffourcc divx -o "test.avi"

To use mplayer to view TV directly (without using tvtime),do this.

mplayer tv:// -tv driver=v4l2:input=0:norm=pal:width=640:height=480:device=/dev/video0:

I’ve been using this card without a glitch and recommend for HTPC attempts on Linux.

© Prashanth Ellina. Built using Pelican. Theme by Giulio Fidente on github.