Archive for October, 2011

Quick And Dirty DVR

Wednesday, October 26th, 2011


I recently dug out an old USB 1.1 Digital TV Tuner – a Hauppauge WinTV Nova-T USB, which I think I bought in about 2003 and eventually gave up on due to poor reliability under Windows, the crappy TV signal quality in Coventry and the success of excellent torrent sites like UKNova. Well, I’ve moved house now, and with an increased TV signal strength also came the bad news that I appear to be on a limited bandwidth ADSL line. I envisaged a single evening of plugging in the tuner, installing MythTV under Ubuntu and having a neat DVR to use.

Sadly, this was not to be the case.

Getting the tuner recognised under linux wasn’t too hard. The required firmware was already present in Ubuntu’s repositories but I couldn’t get the thing to scan. MythTV couldn’t open or ID the card and “scan” resulted in nothing. I even tested with the intended packaged drivers under Windows and got about as far.

Eventually, I found “w_scan” which does the kind of full-frequency scan your TV would do and was able to produce a channels.conf file in the format that tzap uses. Success! On the tzap page of the MythTV wiki it shows how you can use tzap to tune the device and “cat” to just dump the MPEG stream to file. Excellent – time for a quick and dirty script!

I then knocked up a “record” script, which takes easy-to-read commands like “record Eastenders on BBC ONE for 30”, tunes the card and dumps the MPEG stream to a sensible location. Combine that with some cron and I’ve got a hacky little DVR. XBMC can do the front end stuff.

I now have to get used to the idea of knowing I want to watch something before it airs, like we used to do in the 90s.

Here’s my TV shows crontab as an example:

# Record soaps off the TV
29  19  * * 2,4 /home/iain/bin/record Eastenders $(date +\%F_\%A) on BBC ONE for 32
59  19  * * 1,5 /home/iain/bin/record Eastenders $(date +\%F_\%A) on BBC ONE for 32
30  18  * * 1-5 /home/iain/bin/record Hollyoaks $(date +\%F_\%A) on Channel 4 for 27

# Watchable stuff
59  20  * * 5 /home/iain/bin/record Have I Got News For You $(date +\%F) on BBC ONE for 32
59  21  * * 5 /home/iain/bin/record QI $(date +\%F) on BBC TWO for 32
0   18  * * 1-5 /home/iain/bin/record The Simpsons $(date +\%F) on Channel 4 for 30

Or for one-offs (as root, unless you change permissions on the device):

echo "record some tv on bbc one for 25" | at 16:00

(or as commandlinefu.com would probably prefer it:)

at 16:00 <<< 'record some tv on bbc one for 25'

Let me know in the comments if you end up using it.