Hits: 82,222
Home >> Hardware >> WinTV Tuner

Linux WinTV TV Tuner Support

March, 2003

Install List

WinTV Stereo

wintv stereo board

After having a lot of success with my previous TV Tuner, I decided to upgrade to a higher quality board that included more features like a FM tuner. The board I picked was a Hauppauge WinTV Radio. I picked the WinTV Stereo Model with the following features:


  • VHF/UHF TV Stereo Tuner (720x480 Max Res)
  • FM Stereo Radio Tuner
  • DBX-Stereo Sound
  • IR Remote Control
  • S-Video IN
  • Composit IN
  • Audio IN
  • Audio OUT

BTTV

For almost all TV boards there is a great module included with the 2.4.x+ tree called BTTV (http://bytesex.org/bttv/). This supports a ton of chipset and has lots of nice tweakable features. Since it is included in the main kernel branch life is even better. Most distrubtions include it as a loadable module that you can just modprobe or insmod.

After installing the board and loading the modules, you should see something like this in your kernel logs.

[kernel] bttv: driver version 0.9.4 loaded
[kernel] bttv: using 8 buffers with 2080k (520 pages) each for capture
[kernel] bttv0: detected: Hauppauge WinTV [card=10], PCI subsystem ID is 0070:13eb
[kernel] bttv0: using: BT878(Hauppauge (bt878)) [card=10,autodetected]
[kernel] bttv0: Hauppauge/Voodoo msp34xx: reset line init [5]
[kernel] tuner: chip found @ 0xc2
[kernel] tuner(bttv): type forced to 2 (Philips NTSC (FI1236,FM1236 and compatibles)) [insmod]
[kernel] bttv0: Hauppauge eeprom: model=44371, tuner=Philips FM1236 (2), radio=yes
[kernel] tuner: type already set (2)
[kernel] msp34xx: init: chip=MSP3435G-B6 +nicam +simple +radio
[kernel] tvaudio: TV audio decoder + audio/video mux driver
[kernel] bttv0: registered device video0
[kernel] bttv0: registered device vbi0
[kernel] bttv0: registered device radio0

tvtime

Tvtime is a high quality TV viewer with many post-processing effects to give the best picture form your card. Along with having a lots of high quality de-interlacing modes, it also has a great full screen mode.

Tvtime also supports auto-scan, naming, and enable/disabling channels. Once you have your channels setup, you can very quickly surf through them with using the mouse scroll wheel. Or any other key you want to use via-remapping it in the configuration file. Take a look at a few screenshots from tvtime version 0.9.9-pre17 below.

NOTE: These images were changed to JPEG to save bandwidth and reduce download time. So there may be JPEG artifacts from the compression, they are not from tvtime.

tvtime ss tvtime ss tvtime ss tvtime ss

gqradio

gqradio ss

GQRadio is a great FM tuner application for the WinTV card. I tested using version 0.99 and had no problems with it. It is very strait forward, easy to use, and has a nice range of features. It's skinnable and even has a RGB Tint so you can tweak sinks to match your fancy.


Digital VCR

If you're like me, you hate having to watch commericals. It's also sometimes hard to always be around when the shows you want to see are on. The answer is a simple bash script and streamer which is part of the xawtv package. Streamer allows you to record from your TV card to many different formats. I use a cron job and a simple bash script to record shows and watch them later using xine to skip commericals. One nice note, by default xine skips 60 seconds (usually two commericals) so it's almost perfect for watching pre-recorded shows.

#!/bin/bash 
# ================= record-tv.sh  ==========================
# = copyright 2003 by Greg Watson >gwatson@linuxlogin.com< =
# = GPL2 License                                           =
# = usage record-tv.sh prefix-filename record-time channel =
# = Example:  ./record-tv.sh enterprise 61:00 20           =
# ==========================================================
# Version 0.8
# Last Mod: Wed Jan  7 12:48:15 MST 2004

# Output directory
OUTPUT=$HOME/NFSHOME/vcr
# Streamer location
STREAMER=/usr/bin/streamer
# Alsa Mixer
AMIXER=/usr/bin/amixer
# v4lctl path
V4LCTL=/usr/bin/v4lctl
# Capture Volume to ensure sound is recorded (80%)
CAPTURE_VOLUME=100

# Tvtime settings file for color/brightness/contrast values
TVTIME=$HOME/.tvtime/tvtime.xml

# End of Config
###############

# check if I'm running TV, if so just exit
if [ `ps -C tvtime | grep -c tvtime` -gt 0 ]; then
	echo "TVtime is running, aborting recording."
	exit
fi

# If the filename prefix wasn't given, set it to 'recording'
if [ -z $1 ]; then
	PREFIX="recording"
else
	PREFIX=$1
fi

# if time is blank, record for 30 minutes
if [ -z $2 ]; then
	TIME="30:00"
else
	TIME=$2
fi

if [ ! -z $3 ]; then
	$V4LCTL setchannel $3
fi

# Check for vcr dir
if [ ! -x $OUTPUT ]; then
	mkdir $OUTPUT
fi
	
DATE=`date +%m-%d-%Y-%H:%M`

# Set the AC97 volume to 0 (so we don't hear the sounds)
# Get mixer values first
PLAY_VOL=`$AMIXER cget name='Analog Mix Playback Volume' | grep : | sed 's/^.*=\([^,]*\).*$/\1/'`
CAP_VOL=`$AMIXER cget name='Analog Mix Capture Volume' | grep : | sed 's/^.*=\([^,]*\).*$/\1/'`
# Fix for my card since sometimes it wants to record PCM, which I DON'T Want 
$AMIXER -q cset name='PCM Capture Volume' 0

$AMIXER -q cset name='Analog Mix Playback Volume' 0
# We want to ensure that volume is set (just in case it wasn't before)
$AMIXER -q cset name='Analog Mix Capture Volume' $CAPTURE_VOLUME

# if tvtime.xml is set, then grab settings out of it
if [ -f $TVTIME ]; then
	CONTRAST=`cat ${TVTIME} | grep DefaultContrast | sed 's/^.*value="\([^"]*\).*$/\1/'`
	BRIGHTNESS=`cat ${TVTIME} | grep DefaultBrightness | sed 's/^.*value="\([^"]*\).*$/\1/'`
	COLOR=`cat ${TVTIME} | grep DefaultColour | sed 's/^.*value="\([^"]*\).*$/\1/'`
	HUE=`cat ${TVTIME} | grep DefaultHue | sed 's/^.*value="\([^"]*\).*$/\1/'`

	$V4LCTL bright ${BRIGHTNESS}% color ${COLOR}% contrast ${CONTRAST}% hue ${HUE}%
fi

$STREAMER -p 4 -q -t ${TIME} -r 24 -q -o ${OUTPUT}/${PREFIX}-${DATE}-${TIME}.avi -j 90 -f mjpeg -F mono16

# Sometimes streamer doesn't always re-mute audio, mute it again just to be sure
$V4LCTL volume mute on

# Restore volumes
$AMIXER -q cset name='Analog Mix Playback Volume' $PLAY_VOL
$AMIXER -q cset name='Analog Mix Capture Volume' $CAP_VOL
Download Here

Then to use it, add a cronjob like this:

# Record Enterprise Wed 1859-2001 
# (start 1min early and go 1min long just to be sure)
59 18 * * Wed $HOME/vcr/record-tv.sh enterprise 62:00 20

You will more then likely want to change the quality. This is just a very low quality recording but I generally don't mind as I'm watching broadcast signal anyway. This also only uses 5-10% CPU so it's not using up system resources! To improve the quality, just edit the $STREAMER line to the format you want. Supported formats can be found using streamer --help.