Accessible tv tuners from the cli?

pigiron at gmx.com pigiron at gmx.com
Thu Oct 27 00:34:21 EDT 2011


On Wed, 26 Oct 2011 17:19:59 -0600 "Littlefield, Tyler" <tyler at tysdomain.com>
wrote:

> Hello all:
> I was curious if any of you have tried using a TV tuner from the cli? 
> How accessible or otherwise was it? I'm building a computer hopefully 
> soon, and would like to throw in a tuner, but I don't know how it'd work 
> with speakup or if there's an accessible program to interface with them.
> 

While I'm sighted, I run everything for my TV tuner from the command line
except for post editing any recorded shows. But there's even some simple CLI
video editors. I've never used them, so I can't speak to those.

Getting everything set up correctly is definitely a head scratcher though. So
set aside gobs of time and get your zen in shape in order to keep your blood
pressure in check.

It all starts with getting a TV tuner that Linux likes. I strongly suggest that
you buy one that the Video4Linux, otherwise known as "V4L", Linux kernel
subsystem supports. A good place to start is this web site:

http://www.linuxtv.org/wiki/index.php/Hardware_Device_Information

Like most Linux documentation, it's only slightly out of date; chuckle.

While you may find drivers and applications for non-V4L supported tuners on the
internet, you'll probably find that they are old, or not maintained, or both.
All the current action is on the V4L code, and it's been that way for awhile
now.

You did not say which country you live in, nor which types of signals you'll be
trying to watch or capture. That will make big a difference for some of the
following information, along with which TV tuner you buy.

One of the first puzzlers you'll encounter is all the strange new buzz words.
One is the anagram "DVB". I means Digital Video Broadcast, which differentiates
it from the old analog broadcasts and tuners. Then you'll hit things like the
words "DVB-C", "DVB-S", and "DVB-T". It took me awhile to figure out that the
letter "C" means cable. The letter "S" means satellite. And the letter "T" means
terrestrial; which is the over the air signal. You'll sometimes see that
shortened to the anagram "OTA". Confused yet?

After you've slogged through all that, and figured out which tuner to buy, you
install it and verify that Linux likes it by checking the output of the dmesg
command. You should also now have files and directories located under
the /dev/dvb directory.

If you get this far, you next need to create what's called a "channels" file.
This is simply a strangely formatted text file that contains all the TV channels
that the tuner finds in your local area. It's analogous to scanning the
available channels on one of those new fangled digital televisions.

There are multiple command line programs that will create the "channels" file.
Which one you use partially depends on what type of signal you want to capture;
such as cable, satellite, or terrestrial; along with which country you live in.
Drill down from this web page for more info:

http://www.linuxtv.org/wiki/index.php/Frequency_scan

After you've successfully scanned the TV channels for your area and created the
"channels" file, you'll find that you probably need copy that sucker into
multiple directories. The mplayer program expects to find it in one place,
while the xine player expects it in another, and so on. But once you get in
place, you can now tell the player which TV channel to play by using it's name.
For example, if you want to play a station called "WCBS" using the mplayer
application you could enter the following:

mplayer tv://WCBS

But, how do you know what station name to use??? The answer is to look inside
that strangely formatted "channels" text file you created. Each line is a
different channel, and the first field is the TV station name. Each field
within a line is separated by the colon character. It's safe to edit the
channel file and change those TV station names to something you like. But, do
not change any other field on a line.

Note that mplayer normally spews a ton of output to the terminal, you may
want to try the "-really-quiet" parameter to keep the output from speakup to
a minimum, or turn it off.

If you wish to capture a show, just one simple way to do it from the command
line is to bring up a terminal and use one of the "zap" programs provided in
the "dvb-apps" package to tune your tuner to the particular TV channel. Which
"zap" program you use depends on the type of TV signal. See the following for
more info:

http://www.linuxtv.org/wiki/index.php/Zap

Next, open another terminal and simply redirect the output of your tuner device
to a file. For example, something like the following might work if you only
have one TV tuner installed:

cat /dev/dvb/adapter0/dvr0 > testvideo.mpg

While that documentation states that the "zap" programs can also be used to
record a program, the "azap" program that I use doesn't support it.

If you attempt to capture the new ATSC over the air digital HDTV channels now
found in the USA, expect to eat up gigabytes of drive space. You'll find that
the sucker is in the MPEG Transport Stream format, and unless you live next
door to the transmitter, it will also contain errors. While mplayer and VLC
among others, will play the file, if you want to convert it into a DVD format,
you'll need to fix all those errors. I'll leave those numerous painful hints
for some other time.

I found a really obscure command line program from a bloke in Australia that
will set up a timed recording, but I had to modify the hell out his C language
program. For one thing, he has the channels hard coded; ouch! But here's a link
if you're looking for even further frustrations:

http://www.togaware.com/linux/survivor/TV_Recording.html

You simply tell it which channel to record, the output file name, what time to
start recording, and when to stop. Kind of like a DVR.

I could go on forever, but I've bored you enough. Hope this helps, and good
luck.

peace,
bob



More information about the Speakup mailing list