TV Tuner

This is a stub for using TV Tuners with Gentoo Linux.

See also Gentoo Linux VDR Guide

(Need entries for for kernel config of analog and digital tuner drivers.)

(Need entries for your preferred method of viewing and recording. I use the console and figured some would be interested how I do this. ;-)

Console or Terminal Method
To get a list of channels from your digital TV USB or PCI tuning device, the dvbscan application from the package is needed.

For the US over-the-air digital TV:

Channel Naming Problems of DVBSCAN
The channel naming scheme for over-the-air digital TV is likely not well thought out in your area. The first field of this file is the lettered name field, of which, you may likely see duplicate identical names and no channel numbers. The remainder of the fields relate to the frequency.

For my area, the channel number reported by dvbscan on stdout is correct, but the channel lettered identification contains identical duplicates or is not well named. I have already emailed the linux-media mailing list on Sep 29 2011 to include a switch for writing the channel number to the file instead of the channel letter identification.

For the meantime, I've found a method of creating duplicate frequency entries, and then replacing the channel letter name field with the channel's number. More duplicated entries can be created to eleviate the need for typing ".1" for the first channel.

Console or Terminal Method
There's a multitude of media players, of which, mplayer seems to be the most popular and lightest on resources.

MPlayer will use the first field of each line within the channels.conf file for playback. If you have duplicate entries like I do and haven't renamed them as I've done so above, you'll need to specify the entire line from the channels.conf to play the second, third, fourth, ... duplicated entries:

Console or Terminal Method
There's several methods for grabbing EPG TV Guide data and printing to stdout.

Method 1: dvbstreamer
Q. How do I update the EPG data ... (Untested)

Method 2: atsc_epg
After much searching, I found atsc_epg (media-tv/linuxtv-dvb-apps)!

(According to LinuxTV.org, their linuxtv-dvb-apps package is now considered legacy code. No recent snapshot has been made of their dvb-apps GIT repository since.

Also, LinuxTV has a wealth of information on it's linuxtv-dvb-apps package.

Usage example. Take an entry from the $HOME/.mplayer/channels.conf (from dvbscan) and strip the first field. (ie. "KUAC-DTO:189028615:8VSB:49:52:3")

This will print a very nicely formated schedule to stdout!

Now automating this process to use $HOME/.mplayer/channels.conf (dvbscan) data is a bit of a trick, especially if channels are updated. However, notice the atsc_epg command only needs a frequency and atsc_epg will tell you the channel number(s) the frequency will resolve to on stdout as well. (ie. This one PBS frequency will broadcast all four PBS channel's EPG data along with printing each of the four channel numbers to stdout.)

Issues with Only One Tuner
The catch is, you need to have this run in the background while you are not recording as it will use the only tuner on your card for getting the broadcasted EPG data. When a recording starts, the recording script needs to check for this dvbstreamer and kill it before the recording starts, else the recording will fail to initiate as the only tuner is being used. The data being retrieved is simple ASCII text and can be likely easily parsed by even a script. I just haven't had the time to write such a script or console program, and the EPG data broadcasted here is not consistent with more accurate web based options such as TitanTV.

Console or Terminal Method
You can schedule to records a channel by creating a script to record (mencoder) a certain number of minutes (or hours) using vixie-cron (ie. crontab -e).

I just created a script for each channel. The problem with this is, transmitter technicians keep moving around the channel frequencies and naming. So it's wise to use my suggestion about creating aliases within the channels.conf file. (From here, a more elaborate single file script can be created instead of using and maintaining many record*.sh files.)

Setup a crontab entry, as user, root or within /etc/cron, but I prefer a user cron entry.

# Record Doctor Who #  Sundays @ 23:00 #0 23 * * 0 $HOME/bin/record-ch9.1-60m.sh 0 23 * * Sun $HOME/bin/record-ch9.1-60m.sh   #   Thursdays @ 20:00 #0 20 * * 4 $HOME/bin/record-ch9.1-60m.sh 0 20 * * Thu $HOME/bin/record-ch9.1-60m.sh

Save and exit your console editor of choice. No need to restart cron as changes take effect immediately. (Read 'man 5 crontab' for an explanation of crontab field names.)

I'm currently in the process of writing a script to use azap & cat (with getopts for channel/minutes) instead of the above mencoder method. Recently found mencoder is remuxing an already broadcasted MPEG2 stream even though I'm specifying 'copy', causing A/V sync issues.