Note, that this recipe is not updated long time and could be outdated!
Got it.

TV under Linux HowTo

Running TV card under Linux is tricky, though it is possible.

The main difference between Linux and other operating systems is that Linux kernel includes all device drivers, so in most cases it is not necessary to download additional device drivers from somewhere else. (Rarely you can download  binary video or  wireless card drivers, if shipped with Linux distribution is not good enough.)
Linux drivers for TV cards are developed in video4linux (v4l) framework. This framework includes sets of TV card drivers, main categories of them are Bttv and Saa.

Usually TV cards have EPROM memory where info about card is written. If so, Linux kernel can recognize card automatically and load drivers for it.

If TV card is cheap, and doesn't have EPROM, or vendor was lasy to write, it (it also happens) then you have to pass parameters to kernel modules (analogs for Windows DLLs), to say what the card is.

As probability that your card will not work from the first time, check this before pit card in computer:

  • Video capture/recording chip number. Usually this is the biggest chip on the card.
  • TV/Radio tuner chip number. Usually it is the second largest chip on card. It can be inside metallic box, you should remove cover in this case.
  • Card name. It is additional information only, as drivers are written for chips, not cards. Usually is written on box, and in big letters on card itself), check also revision numbers, dates, etc. It can help, if your card is well known one.

Checking loaded modules

So, your card is installed in computer case, you have started computer and logged into Linux.
Open command line window and type command:

dmesg

which will show Linux kernel messages. You should see following things:

  1. Video chip is recognized (check for words TV)
  2. Tuner chip is recognized (check for tuner)
  3. Audio device is initialized for Video capture (check for sound)

    ...
    [[  223.007040]] saa7133[[0]]: found at 0000:01:06.0, rev: 209, irq: 20, latency: 32, mmio: 0xe9000000
    [[  223.007047]] saa7133[[0]]: subsystem: 1461:f01d, board: Avermedia AVerTV GO 007 FM [[card=57,insmod option]]
    [[  223.007056]] saa7133[[0]]: board init: gpio is 40000
    [[  223.007904]] input: saa7134 IR (Avermedia AVerTV GO as /class/input/input6
    [[  223.143595]] saa7133[[0]]: i2c eeprom 00: 61 14 1d f0 54 20 1c 00 43 43 a9 1c 55 d2 b2 92
    [[  223.143605]] saa7133[[0]]: i2c eeprom 10: ff ff ff ff ff 20 ff ff ff ff ff ff ff ff ff ff
    ...
    [[  223.247443]] tuner 2-004b: chip found @ 0x96 (saa7133[[0]])
    [[  223.295372]] tuner 2-004b: setting tuner address to 60
    [[  223.335313]] tuner 2-004b: type set to tda8290+75a
    [[  224.701341]] tuner 2-004b: setting tuner address to 60
    [[  224.741252]] tuner 2-004b: type set to tda8290+75a
    [[  226.069696]] saa7133[[0]]: registered device video0 [[v4l2]]
    [[  226.070090]] saa7133[[0]]: registered device vbi0
    [[  226.070444]] saa7133[[0]]: registered device radio0
    [[  226.145360]] saa7134 OSS driver for DMA sound loaded
    [[  226.145842]] saa7133[[0]]: registered device dsp1
    [[  226.146197]] saa7133[[0]]: registered device mixer2
    ...

    It could happen, that you have no such records at all, or message is  like this:

    [[17179588.096000]] saa7134: Congratulations! Your TV card vendor saved a few
    [[17179588.096000]] saa7134: cents for a eeprom, thus your pci board has no
    [[17179588.096000]] saa7134: subsystem ID and I can't identify it automatically
    [[17179588.096000]] saa7134:
    [[17179588.096000]] saa7134: I feel better now. Ok, here are the good news:
    [[17179588.096000]] saa7134: You can use the card= insmod option to specify
    [[17179588.096000]] saa7134: which board do you have. The list:
    ...

    Then you have to pass right parameters to kernel modules.

Manual Configuration

At first, install some handy utilities:

apt-get install alsa-oss alsa-utils sox libsox-fmt-all

Then disable automatic loading of kernel modules, as they anyway loads in wrong state. Open /etc/modprobe.d/blacklist and add lines for wrongly loaded modules, e.g.:

blacklist saa7134
blacklist saa7134_alsa

Go to following sites and find what card and tuner numbers should be passed to module:

Depending on your card chipset, you need to pass different parameters. I tested it with 2 cards:

WayJet TV Capture
Video SAA7130HL
Tuner: TDA9801T
IMG1319.JPG

modules should be loaded with following parameters:

modprobe saa7134 card=59 tuner=43 oss=1
modprobe saa7134_alsa
)))

and for:
AverMedia AverTV Hybrid Super 007
Video: SAA7121E
Tuner: TDA10046A
IMG1355.JPG

necessary modules should be loaded in following way:

modprobe saa7134 card=57 tuner=54 oss=1
modprobe saa7134-oss
(modprobe saa7134-dvb)

When module parameters are guessed, include custom module invocation on boot time. Open /etc/modules file and add necessary modules wit they parameters at the end. E.g.:

saa7134 card=57 tuner=54 oss=1
saa7134-oss

Watching

  1. If ATI video card is used, open /etc/X11/xorg.conf file and add lines:

    Section "Device"
            Identifier      "ATI Technologies Inc RV350 AS [[Radeon 9550]]"
            Driver          "fglrx"
            Busid           "PCI:2:0:0"
            Option          "VideoOverlay" "on"
            Option          "OpenGLOverley" "off"
    EndSection
  2. run tvtime scanner in command line:

    tvtime-scanner
  3. when some progams are detected, can watch them by invocation of:

    tvtime

other usable programs could be:*

  • kdetv
  • xawtv

redirecting sound

if tv card doesn't have external line output, and/or it is not manageable from  mixer, you need to redirect sound. for more info see:

sound could be redirected using sox "the swiss army knife of sound processing programs":

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

you can invoke tvtime with following script:

#!/bin/sh
(sleep 5; amixer -q -c 0 sset pcm 80%,80%  unmute; exec sox -q -c 2 -s -w -r 32000 -t ossdsp /dev/dsp1 -t ossdsp -w -r 32000 /dev/dsp) &
tvtime --mixer=/dev/mixer:pcm
kill `ps | awk '/sox/ && !/awk/ {print $1}'`
amixer -q -c 0 sset pcm 80%,80%  unmute

debugging commands

dmesg
lsmod, insmod, rmmod
lspci
xvinfo
alsa-oss

  
Tags Linux Multivide Video
Created by Valdis Vītoliņš on 2013-09-08 13:59
Last modified by Valdis Vītoliņš on 2013-09-08 13:59
 
Xwiki Powered
Creative Commons Attribution 3.0 Unported License