Saturday, November 21, 2009  
Google
Web pcquest.com

CIOL Network sites

Search by Issue | Sitemap | Advanced Search

• For most updated version of DQ TOP 20 issue, visit dqindia.com • Ad : Play and Plug ERP by IBM


 
    Enterprise Solutions
    Hands On
    ITstrategy

    Developer

    Tech Forum

    SMB Forum

    Trends

    Shootout

    Reviews
    Editorials
    Linux and Open Source
    Technology
    Extraedge

    IT Careers

    Vertical Focus

Subscribe to Print magazine.


now!


Newsletter

 

Home > Linux > Linux Hands On > Watch TV with Linux


Watch TV with Linux

We dealt extensively with PCQ Linux 7.1 on your desktop last month, from installing, using office applications, and connecting to the Net to troubleshooting and updating.

Shanker Balan

Saturday, September 15, 2001

This month, we cover the multimedia work—watching TV and creating 3D animations, graphics, and music—you can do on your Linux desktop. You’ll find the required software for all this on our August 2001 CD

To set up a TV tuner in Linux, we need a TV tuner board based on the BrookTree (BT) chipsets. The popular PixelView brand of TV tuner boards, which is based on the BT878 chipset, is widely available in India. It is well supported in Linux using the bttv drivers shipped with kernel 2.4 and this is what we’ll base this setup on. Though we’ll refer to the PixelView board, this setup will also be applicable for other TV boards based on other BrookTree chipsets.

To get started, we need:

  • PixelView PlayTV pro (Bt878 chipset) based TV Tuner/video grabber board (driver updates and other information for this are available at www.prolink.com.tw). Your local computer dealer should have one.
  • XawTV, a very popular TV tuner client program for Linux. You’ll find the current release on our July 2001 CD, and can also download it from www.struse1007.de/linux/xawtv/index.html,the xawtv homepage.

Assuming that you’ve physically installed the card properly, let’s get started.

Identifing the video grabber chipset and tuner module

Refer to the accompanying hardware manual and find out the video grabber chipset and the tuner module used on the board. It is very important that you get the above two bits of information 
right.

If in doubt, use the command ‘lspci’ to list out the installed PCI devices.

~# lspci # Output snipped for brevity
[...]
01:0d.0 Multimedia video controller: Brooktree Corporation Bt878 (rev 11)
01:0d.1 Multimedia controller: Brooktree Corporation Bt878 (rev 11)
[...]

This output shows that the PixelView PlayTV board is based on the Bt878 chipset. Please note that ‘lspci’ doesn’t provide any information on the onboard tuner module. If the manual fails to mention the tuner module used, you will have to physically inspect the board. The tuner module is easily identifiable, as it has the RF input protruding in the rear. Most often, it will be Philips based.

Configuring the kernel

All documenation regarding BTTV kernel drivers can be found in Documentation/video4linux /bttv/ under the Linux kernel source directory (/usr/ src/linux). You must have the kernel sources installed to read the document. This is not ‘point-and-click ware’. We recommend that you read the documentation provided with the kernel sources on BTTV carefully.

Now refer to the file “CARDLIST” (/usr/src/linux/Documentation/video4linux/bttv/CARDLIST) in the BTTV documentation directory and check the card type and tuner module type. Note down the “card=N” and “type=N” value for the grabber and tuner module respectively.

The PixelView PlayTV Pro has the following settings:

bttv.o -> card=37 (PixelView PlayTV pro)
tuner.o -> type=5 (Philips PAL)

If your chipset is not listed, see the resource at the end. 
Edit /etc/modules.conf and add the following lines at the bottom:

# i2c
alias char-major-89 i2c-dev
options i2c-core i2c_debug=1
options i2c-algo-bit bit_test=1
# bttv
alias char-major-81 videodev
alias char-major-81-0 bttv
options bttv card=37 pll=1 radio=0
options tuner type=5 debug=1
pal=b

You might have to play around with the “pll” option to get the PLL (Phase Locked Loop) setting right. A PLL value of “1” was needed to get my board working correctly. Valid PLL values are:

0: don’t use PLL 
1: 28 MHz crystal installed 
2: 35 MHz crystal installed

For a full list of options, see the file “Insmod-options” in the BTTV driver documentation directory.

Loading the BTTV modules

After making changes to /etc/modules.conf run “depmod -a” and then insert the modules.

~# modprobe bttv

“dmesg” should dump something like this.

~# dmesg
Linux video capture interface:
...bttv0: i2c attach [Philips PAL]...]

Pay close attention to the chipset and tuner type as mentioned in the output.

bttv0: model: BT878(PixelView PlayTV pro) [insmod option]...
bttv0: i2c attach [Philips PAL]

If the output doesn’t match to what you expect, please re-check the “card” and “tuner” type values which you have passed to bttv.o and tuner.o respectively.

If you need to make changes to any of the bttv-related module options like PLL, CARDTYPE and TUNER, first unload the currently loaded modules:

~# rmmod tuner # Removes the tuner module
~# rmmod bttv # Removes the bttv driver

Then, make the necessary changes in /etc/modules.conf and reload the modules.
~# modprobe bttv

Run ‘dmesg’ and check the output. This is a typical setup for getting the drivers in place.

XawTV

Keyboard shortcuts for XawTV
V Video (Capture) on/off
Audio on/off
Fullscreen on/off
Grab picture (full size, ppm)
Grab picture (full size, JPEG)
Ctrl+G  Grab picture (window size, ppm)
Ctrl+J  Grab picture (window size, JPEG)
Popup Options window
Popup Channels window
Popup Channel Editor
Popup AVI Recording window
Channel Hopper (zapping, tune in every station a few seconds)
Ctrl+Z  Fast Channel Hopping (grab the images for the Channel
up/down  Tune up/down one channel
left/right Fine tuning
pgup/pgdown  Station up/down
space  Next station (same as pgup)
backspace  Previously tuned station
Ctrl+up  Scan for next station
ESC,Q  Quit
+/-  Volume up/down (keypad)
Enter  Mute (keypad)

XawTV is an X11 TV application and one of the best around. If you use the RPM provided on our July 2001 CD:

~# mount /mnt/cdrom
~# cd mnt/cdrom/linux/desktop/ video/xawtv/
~# rpm -ivh xawtv-*.rpm

Start X Window and from a terminal window, type “xawtv” to launch the TV application. When you launch Xawtv for the first time, it will crib about not finding the “.xawtv” config file in your home 
directory.

Just create a .xawtv in your home directory with the following contents:

[global]
freqtab = pal-europe
[defaults]
source = television
norm = pal

Use the cursor keys to flip channels and “f” to toggle fullscreen on and off. The right mouse button will pop up a list of options and control functions.

See ‘man xawtv’ for available configuration options, a few keyboard shortcuts and mouse functions.

Video capture using external inputs

Most boards come with composite and S-Video inputs to which you can hook up an external video source like a motion camera or a DVD player and capture input. Once you have it hooked up, just change the XawTV input source option from “Television” to “Composite” (or “S-Video” depending on the input source you use). To toggle capturing on or off, hit the “v” key. Xawtv stores it in the AVI format.

To capture your favorite television show, just switch to the correct channel, hit the “V” key and let it run. Of course, ensure that you have plenty of free hard disk space. You can always convert the saved AVI file into saner compression formats like MPEG1, MPEG2 or DivX using tools like avi2dvix.

Tips, tricks and troubleshooting

  1. To add video support to the X-Server, enable the “Xvideo” extension in XFree86 4.0x. Add the line
    “Load “V4L”” in /etc/X11/XF86Config-4
    Section “Module”
    [...]
    Load “V4L”
    EndSection
    See www.strusel007.de/linux/xawtv/xfree4.html for more tips and tricks with XFree4
  2. I have experienced system lockups with hardware accelerated 3D enabled (DRI). If you are facing such lockups, edit /etc/X11/XF86Config-4 and comment the “Load “DRI”” option. Apparently, there are some issues with DRI and certain 3D accelerator boards.
    Section “Module”
    [..]
    #Load “DRI”
    EndSection
  3. The bttv driver can do IRQ sharing. So make sure that the grabber board is not sharing IRQ with another device. Changing the PCI slot and disabling unused devices like ACP usually helps sorting out IRQ issues. YMMV
  4. See /usr/share/doc/xawtv-{version}/Trouble-Shooting for help on troubleshooting. The actual path may vary depending on whether you have installed from RPMs or source tarball. This document has loads of information and can be your starting point for troubleshooting reference.
  5. The BTTV driver page has a nice FAQ.
    http://www.strusel007.de/linux/bttv/faq.html
  6. If you have a noisy screen try changing the PLL settings.

In my experience, setting up and using a TV tuner board on Linux has been much more straightforward than on other OSs. Except for the 3D acceleration part, there have been no stability issues whatsoever. No more GPFs while watching your favorite TV show.

Shanker Balan is a technology research consultant with Exocore Consulting  www.exocore.com





Page(s)   1   

End of the article

PC Problems? Get a solution in 24 hours. Ask Tech Expert

Related CIOL links   External links  

--None--

 

none



Read Previous Linux Hands On...

   




Untitled Document



ZTE:Leading CDMA Technology


Extraordinary Networks:Freedom of Choice





Previous Stories

Remote Logins

Backups and Disaster Recovery

Unix Through Windows

Message boards

Discuss this and many other IT topics at the
CIOL message board



   
 

 
 

Magazine Subscription | RQS | Contact Us | Team PCQuest | Advertising - Print | jobs@cybermedia