TvTunerCards

A TV Tuner Card (as the name suggests) allows you to pick up broadcast television signals on your computer.

Under MicrosoftWindows, drivers are normally specific to a manufacturer’s board, while under Linux the driver is normally specific to the chip used on the board. (This is true for just about all PCI/AGP/ISA cards and drivers.)

Hardware Setup

BT878 / BT848

The most popular cards are boards based on the BrookTree Technologies BT878 or BT848 chip, and drivers are in the standard LinuxKernel
(2.4.x and possibly earlier). The difference is one chip also does
sound, while for the other chip the board requires a separate audio
chip.

In the 2.6 kernel, you need:

  • the snd_bt87x.ko driver for the Audio (CONFIG_SND_BT87X: in Device Drivers -> Sound -> ALSA -> PCI Devices -> bt87x Audio Capture)

    • If you use the obsolete OSS system instead of ALSA, you want
      CONFIG_SOUND_BT878 (in Device Drivers -> Sound -> OSS – bt878
      audio DMA, and Tv card (bt848) mixer support)
  • I²C Support (Device Drivers -> I²C Support -> I²C Support and I²C bit-banging interfaces)
  • the bttv.ko driver, under Video4Linux
    (CONFIG_VIDEO_BT848: Device Drivers -> Multimedia devices ->
    Video For Linux -> BT848 Video For Linux) (you HAVE to activate I2C
    support in order that BT848 appears in the menu)

For a 2.4 Linux kernel, these are:

  • I²C Support (Character Devices -> I²C Support -> I²C Support and I²C bit-banging interfaces).
  • Video for Linux (Multimedia devices -> Video For Linux -> proc filesystem and BT848 for linux).
  • Audio support (Sound -> BT878 audio DMA and TV Card (bt878) mixer support).

These drivers will almost certainly come with the standard kernel in any recent Linux distribution.

BT829

This chip is a BrookTree chip, and is not supported by the bttv driver.

Hauppage WinTV-PVR350

See the IvTv page for kernel support notes, and IvTvNotes for module/ PAL? support and other hints.

Leadtek TV2000 XP Deluxe

This card will be automaticly detected by FedoraCore 2. All that remains is for you to install a viewing application.

Note this card uses a loop-back cable for audio that goes from the
card to the line input on your sound card. This cable is needed for
sound.

If you are not hearing any sound check that the line input has not
been re-asigned for a multi speaker sound output. Also check the input
level.

Philips SAA713x

A newer chip is made by Philips. The Lifeview Fly Video 2000 and 3000 boards sold at DSE in New Zealand are based on the saa7130 chip (which uses the same driver as the saa7134 chip).

Note that this card also has a RadioTuner in it – see that page for setup hints.

Support is in the mainstream 2.6 kernel. If you use a 2.4 series
kernel you will need to download drivers and a few small kernel patches
from http://bytesex.org/saa7134/. You will need to be using kernel 2.4.20 or later to apply these patches – the kernel patches use V4L (Video4Linux) version 2, while the 2.4 series kernels use version 1).

You still need to configure I2C support in the kernel as for BT8×8
above, as well as making a module for saa7134 ("Device Drivers ->
Multimedia devices -> Video For Linux -> Philips SAA7134
support"). If you can "modprobe saa7134" then your kernel already has
this module. IN 2.6.16, extra sound support has been split off into
additional modules, saa7134-alsa and (apparently) saa7134-oss. You
don’t need these to just watch TV. See the sound section below.

Here a some gotchas I noticed (for the New Zealand version of this board, at least):

  1. I needed to add "oss=1" as a option for the saa7134 module to get
    any sound. I guess it was defaulting to alsa, but this option wasn’t
    mentioned anywhere – I found it accidentally when doing modinfo(8).
  2. The default tuner type for the card was wrong. In New Zealand we
    use PAL BG (or compatible), and it was defaulting to some other tuner
    type which meant I could pick up UHF but not VHF channels. (See the
    notes below about tuner type).

Here is the relevant snippet from my /etc/modules.conf (for 2.4 kernels, or /etc/modprobe.d/tv for 2.6 kernels):

 # for /video0 and vbi0 devices...
alias char-major-81-0 saa7134
# card=3 => flyvideo2000
# tuner=5 for PAL_BG
# oss=1
options saa7134 card=3 tuner=5

If you find you get video but no sound the following command may be
useful as some tv applications don’t unmute this card properly (ie
mythtv).

assuming your V4L device is /dev/video0

/usr/bin/v4lctl -c /dev/video0 volume mute off

saa713x Card types

There may be a better way to determine the correct card type, but
the following are found in the kernel sources in
/usr/src/linux-2.6.10/drivers/media/video/saa7134/saa7134-cards.c:

0  "UNKNOWN/GENERIC"
1 "Proteus Pro [philips reference design]"
2 "LifeView FlyVIDEO3000"
3 "LifeView FlyVIDEO2000"
4 "LifeView FlyTV Platinum"
5 "EMPRESS"
6 "Tevion MD 9717"
7 "KNC One TV-Station RDS / Typhoon TV Tuner RDS"
8 "KNC One TV-Station DVR"
9 "Medion 5044"
10 "Medion 7134"
11 "Typhoon TV+Radio 90031"
12 "ELSA EX-VISION 300TV"
13 "ELSA EX-VISION 500TV"
14 "10MOONS PCI TV CAPTURE CARD"
15 "BMK MPEX No Tuner"
16 "Compro VideoMate TV"
17 "Compro VideoMate TV Gold+"
18 "Matrox CronosPlus"
19 "AverMedia M156 / Medion 2819"
20 "BMK MPEX Tuner"
21 "Manli MuchTV M-TV002"
22 "Manli MuchTV M-TV001"
23 "Nagase Sangyo TransGear 3000TV"
24 "AVACS SmartTV"
25 "AVerMedia DVD EZMaker"
26 "AverMedia 305"
27 "Items MuchTV Plus / IT-005"
28 "Terratec Cinergy 200 TV"
29 "Compro VideoMate TV PVR/FM"
30 "Empire PCI TV-Radio LE"
31 "Avermedia AVerTV Studio 307"
32 "AVerMedia Cardbus TV/Radio"
33 "Terratec Cinergy 400 mobile"

saa713x notes for LinuxKernel2.6

Overlay

As mentioned above, the saal7134 driver is part of 2.6. However,
xawtv didn’t work, and didn’t even try to access the /dev/video device!
However, reading the documentation suggested using the "Xvideo"
extension. See the Xv page.
Using Xvideo also means that xawtv won’t send those annoying refresh
commands that make your desktop flicker every time the window is
resized, or another window obscures or reveals part of the xawtv window.

Mandrake 10.0

The DSE PCI TV/FM tuner card works on Mandrake 10.0 Official (using
2.6 kernel). This card has Flyvideo3000 and chipset saa7134. In file
/etc/modprobe.preload, add this line

saa7134

and from Mandrake install discs, install xawtv (and the dependencies it asks for).

Infrared Remote

The saa7134 module in kernel 2.6 includes support for the infra-red
remote. The driver acts as another keyboard – if it is working, you
should look in the file /proc/bus/input/devices and see if there is a
section similar to:

 I: Bus=0001 Vendor=1131 Product=0000 Version=0001
N: Name="saa7134 IR (LifeView FlyVIDEO20"
P: Phys=pci-0000:00:0a.0/ir0
H: Handlers=kbd event2
B: EV=100003
B: KEY=c0304 100000 0 0 0 0 1 10000 2 1e0001 7bb80 0 0

Use the "xev" program to see if X can see remote button presses. If you use the "Multimedia Keys" settings in GNOME (and presumably something similar in KDE),
you can assign arbitrary keys (including those buttons on the remote)
to various desktop functions such as volume/mute control. (Use of
xev(1) shows that not all the buttons on the remote are supported –
while most generate events, the buttons labelled "CATV", "Video",
"Audio", "Full Screen", and channel up and down don’t appear to be
visible for some reason).

This however isn’t sufficient to program "change channel" functions
and so forth. For this, you need to use "lirc" userland daemons with
the generic "event interface" (CONFIG_INPUT_EVDEV support needed in the
kernel) for this IR support. Merely having the "evdev" module loaded
and the "liblircclient0" package installed on Debian meant that the
numbers on the remote are seen just like the numbers on the keypad.

In kernel 2.6.8 and later, debug messages are turned off by default,
and enabled with the "ir_debug" module parameter. In earlier kernels,
if you don’t want the driver to print debugging messages to syslog
every time you press a button, edit the file
/usr/src/linux/drivers/media/video/saa7134/saa7134-input.c

and comment out or remove the two lines

printk("%s: build_key gpio=0x%x mask=0x%x data=%dn",

dev->name, gpio, ir->mask_keycode, data);

and re-compile the module or your kernel. (This worked for kernel 2.6.4 at least.)

Sound

Saa7134 boards always seem to come with a small loop-back cable to
connect with the "line in" of your sound card. This is the simplest way
to get sound, and is presumably what Windows does, but it is not
actually necessary with recent kernels.

External loopback sound

If you use the loop-back cable, all you need to do is adjust the

volume for "line in" in your favourite sound mixer/volume control.
The TV card spits out audio whenever the tuner is used — your video
application doesn’t need to know about it.

DMA sound access

If you want to use your line in for something else, or want to
process the sound and video together, you can access the sound chip on
the tuner card directly. With 2.6.16, you can go something like:

$ sudo modprobe saa7134-alsa

$ mplayer tv:// -tv driver=v4l2:input=0:width=384:height=288:adevice=hw.1,0:
audiorate=32000:forceaudio:volume=100:alsa:immediatemode=0

for DMA access. The audiorate=32000 is vital; saa7134 only does 32k sound. forceaudio and immediatemode=0 tell mplayer not to be lazy — by default it will assume you are using the loop-back. The numbers in adevice=hw.1,0 depend on your actual hardware. You can also leave out the alsa and use adevice=/dev/dsp1 — oss emulation ought to take care of it.

The source for this kind of thing is of course the v4l wiki.

Tuner type

Some cards have an EEPROM? on them which means that your OperatingSystem
can automatically figure out what type of tuner chip it is using. Some
cards — especially the cheaper ones — save a few cents per card by not
putting this on, and hard-code the tuner-type into the driver. This
works on windows if they give you a CDROM with binary drivers on it,
but doesn’t work so well if you use drivers that come from anywhere
else.

If Linux can not automatically determine what type of tuner the card is using, you will need to manually set it using the tuner={n} module option, such as

options saa7134 card=3 tuner=5

in an /etc/modprobe.d/* file (for kernel 2.6 and later).

From /usr/src/linux-2.6.10/include/media/tuner.h:

#define TUNER_TEMIC_PAL     0        /* 4002 FH5 (3X 7756, 9483) */
#define TUNER_PHILIPS_PAL_I 1
#define TUNER_PHILIPS_NTSC 2
#define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */
#define TUNER_ABSENT 4
#define TUNER_PHILIPS_PAL 5
#define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */
#define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */
#define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */
#define TUNER_ALPS_TSBH1_NTSC 9
#define TUNER_ALPS_TSBE1_PAL 10
#define TUNER_ALPS_TSBB5_PAL_I 11
#define TUNER_ALPS_TSBE5_PAL 12
#define TUNER_ALPS_TSBC5_PAL 13
#define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */
#define TUNER_ALPS_TSHC6_NTSC 15
#define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */
#define TUNER_PHILIPS_NTSC_M 17
#define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */
#define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/
#define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711)*/
#define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732)*/
#define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104)*/
#define TUNER_PHILIPS_PAL_DK 23
#define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */
#define TUNER_LG_PAL_I_FM 25
#define TUNER_LG_PAL_I 26
#define TUNER_LG_NTSC_FM 27
#define TUNER_LG_PAL_FM 28
#define TUNER_LG_PAL 29
#define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/
#define TUNER_SHARP_2U5JF5540_NTSC 31
#define TUNER_Samsung_PAL_TCPM9091PD27 32
#define TUNER_MT2032 33
#define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865)*/
#define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/
#define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/
#define TUNER_LG_PAL_NEW_TAPC 37
#define TUNER_PHILIPS_FM1216ME_MK3 38
#define TUNER_LG_NTSC_NEW_TAPC 39
#define TUNER_HITACHI_NTSC 40
#define TUNER_PHILIPS_PAL_MK 41
#define TUNER_PHILIPS_ATSC 42
#define TUNER_PHILIPS_FM1236_MK3 43
#define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */
/* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */
#define TUNER_MICROTUNE_4049FM5 45
#define TUNER_LG_NTSC_TAPE 47
#define TUNER_TNF_8831BGFF 48
#define TUNER_MICROTUNE_4042FI5 49 /* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */
#define TUNER_TCL_2002N 50
#define TUNER_PHILIPS_FM1256_IH3 51

Applications

Xawtv

See the XawTv page.

Tvtime

Probably the Linux tv-viewing app with the most user-friendly GUI frontend. See the TvTime page for more details.

MythTV

Used for recording programs. See the MythTv page.

Mplayer

You need to specify the channel on the command line. For example, try
mplayer tv://10 -tv driver=v4l2

(VHF channel 10 is the frequency that broadcasts TV3 in Hamilton).

Mplayer can apparently also be used to encode and stream the video
and audio across a network. If you figure out how to do this, please
update this page. (See Mencoder)

Mencoder

Mencoder is part of mplayer, in this example, it will encode
straight from the tv device on the channel that has been previously
selected by a tv program (see above).

mencoder tv:// -tv driver=v4l2 -ovc xvid -oac mp3lame -xvidencopts pass=1 -o .avi

Man mencoder for more information. Also for codec listings, replace xvid or mp3lame with "help"

Radio

See the RadioTuner page.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s