About eight years ago, everybody was talking about the
convergence of technology. Computers had just gained the status
of "Multimedia" machines. One could watch full motion,
high-resolution videos in tiny 320x200 windows played off a
massive 650mb cdrom disc and listen to exciting FM quality music
from tinny 8 bit cards. And then someone realized that every
device on earth could be integrated into the computer. One can
now find integrated 3d video cards, audio cards, mpeg decoders,
internal modems, web cams, pluggable microwave (huh?), and most
importantly, TV Tuner Cards.
TV Tuner cards have existed for quite some time. Today one can
pickup a TV tuner card for less than $50 or even find it
integrated in the 3D/2D video card. Before you throw your TV set
off the terrace, it would be worth contemplating the fact that
most TV Tuner cards can hardly match the quality of any decent TV
set. Unlike TV sets, which run on an analog system and do not
rely on image precision, computer CRTs have to display images
with a lot more detail. In most cases due to the low resolution
of broadcasts, the computer CRT cannot display a sharp image.
Computer CRTs display colors, relatively less sharply and
vibrantly compared to TV sets.
A TV Tuner card has three important components. The tuner chip is
used to "listen" to a specific broadcast frequency. Most cards
have major problems tuning weak signals, especially when an
antenna is the input source. A video decoder chip processes the
incoming signal and processes the broadcast format
(PAL/NTSC/SECAM) and pushes it to an overlay area of the main
video card. The overlay area is a part of the video memory which
is directly written onto by the TV tuner to display the TV
channel. Finally a sound decoder chip, processes the audio
signals and can additionally decode Stereo/Dolby signals before
feeding it to the speakers.
If you do however have the money, a TV card is a cool gadget to
have on your computer. Besides catching up on news or sports
while using some software, you can also receive
S-Video/Composite/RF signals and perform video/frame capture.
Getting your TV card running under Linux is not very difficult.
However there is a lack of easily available documentation on the
Internet. The standard bttv driver provided with most kernels has
limited support for tuner cards.
This document will focus on getting your TV tuner card working
with the latest version of bttv under Linux. Our test machine was
a Celeron 300 overclocked to 450MHz, 64MB RAM, Redhat 6.1 running
Kernel 2.2.12-20 and Provideo PV951 card installed. The article
is applicable to all distributions of Linux.
Package Installation
You will need to be in superuser mode to do most of the setting
up. The first thing you need to do is grab some important
packages that you will use your TV tuner card. Unless you are
running a 2.4.x kernel, chances are that you need to download the
new i2c stack. Download the i2c package in root directory.
URL: http://www2.lm-sensors.nu/~lm78
File:http://www2.lm-sensors.nu/~lm78/archive/i2c-2.5.4.tar.gz
Install the package,
# cd /root
# tar xzpvf i2c-2.5.4.tar.gz
# cd i2c-2.5.4
# make ; make install
In case the install copied the header files into
/usr/local/include/linux, copy them into the linux kernel
directory. This is necessary as bttv looks for the i2c header
files for compilation.
# cp /usr/local/include/linux/*.h /usr/src/linux/include/linux
You need to make sure that your kernel supports video4linux.
Check for availability of videodev.o in the
/lib/modules/linux/misc directory. If it is not present, go into
kernel configuration
# cd /usr/src/linux
# make menuconfig
and compile support for video4linux as a module. It is located
under Character Devices->"Video For Linux"
# make modules
# make modules_install
to complete the installation of the module.
Next up is the installation of bttv. Download the latest version
from the following address and move it into /root
URL: http://www.strusel007.de/linux/bttv/
File: http://www.strusel007.de/linux/bttv/bttv-0.7.49.tar.gz
To install the package,
# cd /root
# tar xzpvf bttv-0.7.49.tar.gz
# cd bttv-0.7.49
Now, you may need to edit the makefile before you can
successfully compile. Open Makefile and update the kernel
variable to reflect your kernel directory, for example:
kernel=$(shell basename /usr/src/linux)
Go into the driver directory,
# cd driver
Open Makefile and change KERNEL_DIR to
KERNEL_DIR := /usr/src/linux
and also, CURRENT
CURRENT := 2.2.1-20
(this directory is used to place the modules that are compiled.
It should be your present kernel version)
# cd ..
Compile and install the package,
# make ; make install
All that is left to complete the initial setup stage is to
download a TV viewer like xawtv or kwintv.
kwintv URL: http://www.mathematik.uni-kl.de/~wenk/kwintv/download.html
File: ftp://www.mathematik.uni-kl.de/pub/Sources/misc/programs/kwintv-0.8.5.tar.gz
xawtv URL: http://www.strusel007.de/linux/xawtv/
File: http://www.strusel007.de/linux/xawtv/xawtv_3.24.tar.gz
For starters, let's install xawtv:
# tar xzpvf xawtv_3.24.tar.gz
# cd xawtv-3.24
# make ; make install
Module Mayhem
Next up is the loading of the i2c modules,
# modprobe i2c-core i2c_debug=1
# modprobe i2c-algo-bit bit_test=1
Now you need to load the video modules,
# modprobe videodev
Open a new terminal window and monitor your /var/log/messages
file,
# tail -f /var/log/messages
Go back to your terminal window. You could let bttv auto detect
your TV tuner card,
# modprobe bttv
or you can look at the CARDLIST file in the bttv package
directory and locate your card number. The test machine had a
Provideo PV951 which is listed as card no. 42 in the CARDLIST in
bttv's directory. Once you have located the card,
# modprobe bttv card=xx radio=n
where xx=card no and n=0 for no radio, 1 for radio support
In our case as it is a PV951 without radio support,
# modprobe bttv card=42 radio=0
Now look at your /var/log/messages file in the other window. If
detection went well, you should see your card name printed out by
bttv and an initialization messages. Here is the output from our
log,
kernel: bttv0: Bt878 (rev 2) at 01:0a.0, irq: 12, latency: 32,
memory: 0xdc000000
kernel: bttv0: model: BT878(ProVideo PV951) [insmod option]
kernel: PCI: Enabling bus mastering for device 01:50
kernel: i2c-algo-bit.o: Adapter: bt848 #0 scl: 1 sda: 1 --
testing...
kernel: i2c-algo-bit.o:1 scl: 1 sda: 0
kernel: i2c-algo-bit.o:2 scl: 1 sda: 1
kernel: i2c-algo-bit.o:3 scl: 0 sda: 1
kernel: i2c-algo-bit.o:4 scl: 1 sda: 1
kernel: i2c-algo-bit.o: bt848 #0 passed test.
kernel: tuner: chip found @ 0x60
kernel: bttv0: i2c attach [(unset)]
kernel: i2c-core.o: client [(unset)] registered to adapter [bt848
#0](pos. 0).
kernel: i2c-core.o: adapter bt848 #0 registered as adapter 0.
kernel: tuner: type set to 1 (Philips PAL_I)
kernel: bttv0: i2c: checking for TDA9875 @ 0xb0... not found
kernel: bttv0: i2c: checking for TDA7432 @ 0x8a... not found
You can now proceed to use your TV tuner by loading up XawTV.
In case you are not hearing any audio, you need to load the
tvaudio module
# modprobe tvaudio
This was required for our ProVideo PV951 card.
XawTV is a powerful utility for TV display and capture. One of
the features that it lacks is the ability to quickly scan and set
channels. Alternatively, you can use kwinTV, one of the more
popular software that has this feature.
Once you are happy with the settings you can move the settings
into /etc/conf.modules by adding the following
alias char-major-89 i2c-dev
options i2c-core i2c_debug=1
options i2c-algo-bit bit_test=1
alias char-major-81 videodev
alias char-major-81-0 bttv
options bttv card=42
options tuner debug=1
alias char-major-81-1 tvaudio
Happy TV watching in Linux!