INCLUDE_DATA
( to ) ? be : ! be;
sidebar left sidebar right

Watching Television on Linux: setting up a TV Tuner card (23,235 views)

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).

Pinnacle PCTV 50i

The card is available through Amazon.com.
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

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:\
freq=775.25:adevice=/dev/dsp1:forceaudio:audiorate=32000


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

subscribe to feed

Tags: , , , , , , ,

"Watching Television on Linux: setting up a TV Tuner card" was published on March 23rd, 2008 and is listed in gutsy gibbon, linux, video.

Comments on "Watching Television on Linux: setting up a TV Tuner card": 31 Comments

  1. bg wrote,

    nvidia provides good tv tuner cards. they are all in one ,so i guess it will work for Linux

  2. prashanthellina wrote,

    Hi there! NVIDIA does have TV tuner cards but googling doesn’t paint a good picture for linux compatibility.

  3. Ik wrote,

    Hi,

    Have anybody tested the same with TATA Sky ?

  4. prashanthellina wrote,

    Whether the card works on not is totally independent from the cable operator. If it works for Doordarshan, it should work for Tata Sky too.

  5. she wrote,

    Nice hint

    does anyone have more info with mencoder?
    Especially with scanning _only_ with mplayer/mencoder?

    tvtime and xawtv are slowly dying :(

  6. prashanthellina wrote,

    I do not know if mplayer/mencoder can scan channels. I used scantv (http://linux.die.net/man/1/scantv).

  7. Krishna wrote,

    Hey Prashanth,

    It has worked for me. Thank you very much for the post.

    One query, have you tried Myth TV?

    cheers,
    Krishna

  8. prashanthellina wrote,

    Krisha, that’s great. I’ve been intending to but did not get around to doing it.

  9. Valente wrote,

    tvtime display fine video and sound
    same with motv

    but I can’t make either mencoder nor mplayer to get the SOUND, they only get video OK, but no SOUND

    they don get nothing from /dev/dsp

    Here is my list of hardware
    lspci
    00:1b.0 Audio device: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller (rev 03)
    02:04.0 Multimedia controller: Philips Semiconductors SAA7133/SAA7135 Video Broadcast Decoder (rev 10)

    asoundconf list
    Names of available sound cards:
    Intel
    SAA7134

    cat /proc/asound/cards
    0 [Intel ]: HDA-Intel – HDA Intel
    HDA Intel at 0xcfe38000 irq 16
    1 [SAA7134 ]: SAA7134 – SAA7134
    saa7133[0] at 0xcfffe800 irq 16

    lsmod | grep -i snd
    snd_hda_intel 344728 3
    snd_pcm_oss 42144 0
    snd_mixer_oss 17920 1 snd_pcm_oss
    snd_pcm 78596 3 saa7134_alsa,snd_hda_intel,snd_pcm_oss
    snd_page_alloc 11400 2 snd_hda_intel,snd_pcm
    snd_hwdep 10500 1 snd_hda_intel
    snd_seq_dummy 4868 0
    snd_seq_oss 35584 0
    snd_seq_midi 9376 0
    snd_rawmidi 25760 1 snd_seq_midi
    snd_seq_midi_event 8320 2 snd_seq_oss,snd_seq_midi
    snd_seq 54224 6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
    snd_timer 24836 2 snd_pcm,snd_seq
    snd_seq_device 9612 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
    snd 56996 18 saa7134_alsa,snd_hda_intel,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_hwdep,snd_seq_dummy,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
    soundcore 8800 1 snd

    and doing this:
    cat /dev/urandom > /dev/dsp

    I get noise on speakers (as it should be)

    Please advise me what to do

    Best Regards

  10. Shahi wrote,

    Your blog is good but can you tell me how will scan tv channels using mplayer………????????
    There is one option i.e -tvscan autostart in mplayer but it read all frquencies which have not signals……..

  11. krishna wrote,

    Hi Prashant,

    I could successfully install Myth TV with the same card. I have Ubuntu Hardy Heron OS. And it works great. I am not able to configure the remote at the moment, though.
    Thanks for suggesting the card.

    Cheers,
    Krishna

  12. DriverFinder wrote,

    I can too confirm that MythTV works with this driver and my Pinnacle PCTV 50i ! Thanks for this guide really great help!

  13. seb wrote,

    Great post! Thanks for your hint about using sox!!!
    Up till now I was using TVtime with sound redirection via ‘arecord -D hw:1,0 | aplay’ resulting in the sound lagging behind.
    ’sox -c 2 -s -r 32000 -t oss /dev/dsp1 -t oss -r 32000 /dev/dsp’ does the job! No sound lag! Thanks a million!

    Running Fedora 10 with
    Haupppauge WinTV HVR 900 USB

    Greetings, Seb.

  14. seiyachan wrote,

    I am able to get audio working in mplayer using the following command line:

    mplayer tv:// -tv driver=v4l2:input=0:norm=pal:width=640:height=480:device=/dev/video0:\
    freq=775.25:alsa:adevice=hw.1,0:amode=1:audiorate=32000:forceaudio:volume=100

  15. seiyachan wrote,

    the exact command i run is as follow, it works for my laptop:

    mplayer tv://$channel -tv driver=v4l2:device=/dev/video0:chanlist=australia:channel=10:channels=2-ABC,7-Seven,9-Nine,10-Ten,28-SBS:alsa:adevice=hw.1,0:amode=1:audiorate=32000:forceaudio:volume=100:immediatemode=0:norm=PAL:tdevice=/dev/vbi0:tformat=1:tpage=801

  16. RAJNISH MISHRA wrote,

    hi……….
    i have zenit tv tuner card but how can start in linux…………..i dont know………………..how can start……..rplyyyyyyyyyyyyy

    rajnish mishra

  17. Boby wrote,

    How is the colors in tvtime ?

    i have installed it in ubuntu, but tvtime shows all channels with most of its colors lost. Mmany channels are displayed in black and white, some display with less color. Do you know how to fix it ?

    Bobys last blog post..Pctv

  18. Annie wrote,

    When i run sox, i get error

    me@my-desktop:~$ sox -c 2 -s -w -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -w -r 32000 /dev/dsp
    sox: invalid option — w
    sox: SoX v14.2.0

    Failed: invalid option

    Usage summary: [gopts] [[fopts] infile]… [fopts] outfile [effect [effopts]]…

    SPECIAL FILENAMES (infile, outfile):
    - Pipe/redirect input/output (stdin/stdout); use with -t
    -d, –default-device Use the default audio device (where available)
    -n, –null Use the `null’ file handler; e.g. with synth effect
    -p, –sox-pipe Alias for `-t sox -’

    SPECIAL FILENAMES (infile only):
    “|program [options] …” Pipe input from external program (where supported)
    http://server/file Use the given URL as input file (where supported)

    GLOBAL OPTIONS (gopts) (can be specified at any point before the first effect):
    –buffer BYTES Set the size of all processing buffers (default 8192)
    –combine concatenate Concatenate multiple input files (default for sox, rec)
    –combine sequence Sequence multiple input files (default for play)
    –effects-file FILENAME File containing effects and options
    -h, –help Display version number and usage information
    –help-effect NAME Show usage of effect NAME, or NAME=all for all
    –help-format NAME Show info on format NAME, or NAME=all for all
    –input-buffer BYTES Override the input buffer size (default: as –buffer)
    –interactive Prompt to overwrite output file
    -m, –combine mix Mix multiple input files (instead of concatenating)
    -M, –combine merge Merge multiple input files (instead of concatenating)
    –plot gnuplot|octave Generate script to plot response of filter effect
    -q, –no-show-progress Run in quiet mode; opposite of -S
    –replay-gain track|album|off Default: off (sox, rec), track (play)
    -R Use default random numbers (same on each run of SoX)
    -S, –show-progress Display progress while processing audio data
    –version Display version number of SoX and exit
    -V[LEVEL] Increment or set verbosity level (default 2); levels:
    1: failure messages
    2: warnings
    3: details of processing
    4-6: increasing levels of debug messages
    FORMAT OPTIONS (fopts):
    Input file format options need only be supplied for files that are headerless.
    Output files will have the same format as the input file where possible and not
    overriden by any of various means including providing output format options.

    -v|–volume FACTOR Input file volume adjustment factor (real number)
    -t|–type FILETYPE File type of audio
    -s/-u/-f/-U/-A/-i/-a/-g Encoding type=signed-integer/unsigned-integer/floating-
    point/mu-law/a-law/ima-adpcm/ms-adpcm/gsm-full-rate
    -e|–encoding ENCODING Set encoding (ENCODING in above list)
    -b|–bits BITS Encoded sample size in bits
    -1/-2/-3/-4/-8 Encoded sample size in bytes
    -N|–reverse-nibbles Encoded nibble-order
    -X|–reverse-bits Encoded bit-order
    –endian little|big|swap Encoded byte-order; swap means opposite to default
    -L/-B/-x Short options for the above
    -c|–channels CHANNELS Number of channels of audio data; e.g. 2 = stereo
    -r|–rate RATE Sample rate of audio
    -C|–compression FACTOR Compression factor for output format
    –add-comment TEXT Append output file comment
    –comment TEXT Specify comment text for the output file
    –comment-file FILENAME File containing comment text for the output file

    AUDIO FILE FORMATS: 8svx aif aifc aiff aiffc al amb au avr caf cdda cdr cvs cvsd dat dvms f4 f8 fap flac fssd gsm hcom htk ima ircam la lpc lpc10 lu mat mat4 mat5 maud nist ogg paf prc pvf raw s1 s2 s3 s4 sb sd2 sds sf sl smp snd sndfile sndr sndt sou sox sph sw txw u1 u2 u3 u4 ub ul uw vms voc vorbis vox w64 wav wavpcm wv wve xa xi
    PLAYLIST FORMATS: m3u pls
    AUDIO DEVICE DRIVERS: alsa

    EFFECTS: allpass band bandpass bandreject bass bend chorus compand contrast dcshift deemph delay dither earwax echo echos equalizer fade filter flanger gain highpass ladspa loudness lowpass mcompand mixer noiseprof noisered norm oops pad phaser pitch rate remix repeat reverb reverse riaa silence spectrogram speed splice stat stretch swap synth tempo treble tremolo trim vol

    EFFECT OPTIONS (effopts): effect dependent; see –help-effect
    me@my-desktop:~$

    Annies last blog post..THIS SCRIPT IS NO LONGER SERVING DATA. UPDATE YOUR PLUGIN

  19. Luis wrote,

    Hi Annie
    Try replacing
    sox -c 2 -s -w -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -w -r 32000 /dev/dsp

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

    Hope it helps.

  20. Annie wrote,

    I done that, got following error

    me@me-desktop:~$ sox -c 2 -s -2 -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -2 -r 32000 /dev/dsp
    sox formats: no handler for given file type `ossdsp’
    me@me-desktop:~$

  21. Luis wrote,

    Hi Annie, install libsox-fmt-oss

    sudo apt-get install libsox-fmt-oss

  22. Annie wrote,

    Thanks Luis for the reply, i installed libsox-fmt-oss

    Now i get following error

    me@me-desktop:~$ sox -c 2 -s -2 -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -2 -r 32000 /dev/dsp
    sox formats: can’t open input file `/dev/dsp1′: No such file or directory
    me@me-desktop:~$

    Any idea how to fix the error ?

  23. Luis wrote,

    Hi Annie, maybe you are missing the saa7134_alsa module, try this:

    sudo modprobe saa7134_alsa

  24. Annie wrote,

    Hi Luis, “sudo modprobe saa7134_alsa” do not five any output.

  25. Annie wrote,

    Here is what i get

    me@me-desktop:~$ sudo modprobe saa7134_alsa
    [sudo] password for me:
    me@me-desktop:~$ sox -c 2 -s -2 -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -2 -r 32000 /dev/dsp
    sox formats: can’t open input file `/dev/dsp1′: No such file or directory
    me@me-desktop:~$

  26. Luis wrote,

    Have you checked if the module is loaded?

    lsmod | grep saa7134

  27. Annie wrote,

    The module is not loaded.

    me@me-desktop:~$ sudo -s
    [sudo] password for me:
    root@me-desktop:~# lsmod | grep saa7134
    root@me-desktop:~# insmod saa7134
    insmod: can’t read ’saa7134′: No such file or directory
    root@me-desktop:~#

    How do i load it ?

  28. Luis wrote,

    Try modprobe

    sudo modprobe saa7134
    sudo modprobe saa7134_alsa

  29. Annie wrote,

    Thanks Luis, now i got the modules loaded, still /dev/dsp1 missing

    me@me-desktop:~$ sudo modprobe saa7134
    [sudo] password for me:
    me@me-desktop:~$ sudo modprobe saa7134_alsa
    me@me-desktop:~$ lsmod | grep saa7134
    saa7134_alsa 20000 0
    saa7134 152020 1 saa7134_alsa
    snd_pcm 82948 3 saa7134_alsa,snd_hda_intel,snd_pcm_oss
    videodev 41600 3 saa7134,tuner,bttv
    ir_common 52228 2 saa7134,bttv
    compat_ioctl32 9344 2 saa7134,bttv
    v4l2_common 20992 3 saa7134,tuner,bttv
    videobuf_dma_sg 20484 3 saa7134_alsa,saa7134,bttv
    videobuf_core 26500 3 saa7134,bttv,videobuf_dma_sg
    snd 62628 16 saa7134_alsa,snd_hda_intel,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
    tveeprom 20100 2 saa7134,bttv
    me@me-desktop:~$ sox -c 2 -s -2 -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -2 -r 32000 /dev/dsp
    sox formats: can’t open input file `/dev/dsp1′: No such file or directory
    me@me-desktop:~$ sudo -s
    root@me-desktop:~# sox -c 2 -s -2 -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -2 -r 32000 /dev/dsp
    sox formats: can’t open input file `/dev/dsp1′: No such file or directory
    root@me-desktop:~# ls -l /dev/|grep dsp
    crw-rw—-+ 1 root audio 14, 3 2009-07-31 18:33 dsp
    root@me-desktop:~#

  30. hendri wrote,

    thanks guys! finaly, my sound work on Gadmei UTV 330+. this blog is guide me to understand about install hardware on linux properly…

  31. isidora wrote,

    I have instaled tvtime, and it works for my tv card just fine. the only problem i have is with sound :( it doest produce any sound. did i do something wrong? is there any adjustment i need to do to make it work?
    please help. thank you in advance :)

530446 views

Prashanth Ellina is powered by WordPress

No Complaints Shifter Series Theme by Buzzdroid.com
Computers blogarama - the blog directory Blog Flux Directory Blog Directory & Search engine Computer Blogs - Blog Catalog Blog Directory Computers blogs Bloggeries Blog Directory blog directory Computers Blog Blog Search, Blog Directory p Listed in LS Blogs the Blog Directory and Blog Search Engine Blog Review Blog search - categorized blog directory Link With Us - Web Directory Find Blogs in the Blog
Directory Blog Directory