Most folks buy their TV's at places like Sears or Best Buy, and there's a lot to be said for plunking your credit card down and driving home with a functional television set. But that's not my style. I've been using a Commodore 64 color monitor hooked up to a VCR since the late 80's and it's worked great. On the other hand, VCR's are going the way of the dodo and a 13" television with weak mono sound isn't much fun so I should probably upgrade.
Given my fondness for doing things the hard way I've decided to hack together a computer-powered television set using parts that I've mostly already got lying around the house.
Bill of materials:
- HP A2094A monitor - a 20" RGB monitor from an old HP X terminal. Picture tube is a Sony Trinitron.
- Intel 815-based motherboard with a 900MHz PIII.
- AverTV tuner card. The only component I've had to buy so far, $20 at Compusa.
- Sound card (not sure which one yet but the 815 motherboard has built-in sound)
As a proof of concept I think I'll try to get my office computer to work with the TV card. The only problem is that my office computer is a diskless workstation so I've been using pre-built kernels from the LTSP project at http://www.ltsp.org/
, and their kernels don't have all of the drivers that I need.
Change of plan: I found a project called MythTV http://www.mythtv.org/
which can run in client-server mode. This will allow me to run the tuner in a server in the basement and the display on a workstation in the den.
I wanted to put the tuner card in my 1U VA Linux server but for some reason the card wasn't seen by the operating system. Maybe the little right-angle riser card was broken? In any case it worked just fine in my Intel 815 mobo which will allow me to get it working but then I'll have to move it to my other server, I guess. That's the price you pay for a 1U form factor.
was somewhat challenging. It has lots of dependencies but they're spelled out on the website. This is one of those times where Debian is a good and bad thing. Good because it's so easy to find and install software, bad because many people expect files to be where Red Hat puts them and Debian often puts them somewhere else.
On the other hand, why build when you can apt-get? http://dijkstra.csh.rit.edu:8088/~mdz/debian/dists/unstable/mythtv/
Here's a command-line recorder: http://www.stack.nl/~brama/vcr/
Here's a site that has a version of mythtv integrated on a knoppix cdrom: http://mysettopbox.tv/knoppmyth.html
Here's a software PVR aimed for European users (but with some nice design features) http://etv.sourceforge.net/
- interesting project with clients and servers for streaming video.
- linux mini-distros for media PC's (i.e. linux-driven tv).
- slashdot article about a pc case that looks like a hi-fi component.
- Spent a couple of hours fooling around with the setup. Was able to get the capture part working just fine (had to compile i2c as a module, also v4l stuff which is very old in the kernel). I can run xawtv and capture snapshots and they look fine. Display is FUBAR - I've installed X and DRI and it seems to run OK, but it splashes pixels all over the display. Looks almost as if you took the red, green and blue parts of the pixels and put them side by side instead of combining them into a single pixel. Guess I'll need some help.
In the mean time I figured out that the cable no longer provides basic signals (it did when we moved in) so I have to use a powered antenna to play around, which works poorly since I've got all of the gear in the basement. Comcast wants $45/mo for basic cable which seems amazingly expensive to me. I would get a $20 discount on the cable modem but I don't care since my company pays that.
- I've switched over to RCN and signed up for cable tv and made a little more progress. The display problem above must be an X Windows configuration problem because I can run
on the server but display it on my diskless workstation and the picture is fine (although not the most crisp since it's going over the network). It's pretty cool to see that X can stream TV over the network.
- Got sound and video working on the server. No real problems - I used the debian kernel, alsa, and bttv packages.
- Moved the tuner card to "phoenix", my Compaq DL380 server. Now I can use the PIII desktop as a client and (hopefully) run it diskless. I was using the on-board sound on the desktop so I had to use a SoundBlaster
Live! card that I had lying around in the server.
- Turns out sound was more complicated than I thought. Mythtv always records and then plays the recording back; that's how it can do things like pause and rewind "live" tv. So you need to set up the sound card so it is recording the Line input but it must be muted. The biggest hassle was figuring out what the different features of the SoundBlaster
Live card were and how they worked.
dump of the card with a working config:
All of the pictures had strange jagged lines when things moved. It turns out there's an option to "de-interlace" the video on the client side. It crashes on the PII machine but works fine on the PIII.
XVideo and Xinerama don't play nice so it looks as if I can't watch TV on my dual-head machine. That's sort of OK since it doesn't have quite enough CPU either.
- the wierdest problem so far. Cable channels 2 and channel 14 (WGBH-2 and WGBX-44) didn't have the right audio - they had the BBC instead. I was seriously stumped until I noticed that channel 6 (WFXT-25) was in Spanish. Googling for "Mythtv SAP" did the trick. Turns out there's some really random bttv module option that fixed it:
options bttv audiomux=0x56664e
In debian you add this to
, in other flavors of GNU/Linux I think it's
for more info.
- It turns out that video files are big. Who knew? I managed to wedge this server last night by filling it up with The Simpsons videos. Probably a good idea to put the recordings on a partition other than /.
Installed Myth Weather which is quite cool but I doubt that I'll use it.
- Adding DVD support to Mythtv was pretty close to trivial. At some time between a year ago and now, someone packaged mplayer and ogle for Debian, so they're both an apt-get away. During the installation process you'll be prompted with the name of a script that will find and install CSS so you can watch encrypted DVD's. The Mythttv module is called MythDVD. Playing is trivially easy but I haven't quite figured out how to rip yet. That's OK, I don't have enough disk space anyway.
I had to add a link from
and make sure that your user is in the
group, but other than that it just works
- I bought an infrared receiver from ebay for $10, my second ebay purchase. It plugs into the serial port and has a little box with a red window in front. I spent about an hour trying to get it to work before realizing that the serial port on the machine I was using was disabled by the BIOS. Duh!
- caveat emptor. turns out that the infrared receiver (a Silitek SM-1000) only works with the remote that's supposed to come with it, despite the seller's claim that it works with any remote. I picked up a set with the receiver and remote for $30.
To play DVD's standalone you can
mplayer dvd:// -vo xv
part is important, without that it skips a lot.
The infrared setup is pretty hokey; there's one daemon to read the device, then another program (
) to translate from the remote control events to keystrokes. With my remote, the problem is that the joystick in the center is much
too sensitive which makes it very hard to move one channel at a time.
- in order to not fill up my / partition (which is small) I symlinked
to directories under
. I couldn't find any other way to tell mythtv where to put the files. UPDATE
(where mythtv records shows) is now a mount point on the IDE disk. For now it's a 30GB drive but one of these days I'll swap it for something bigger.
- I haven't been fiddling much, but I've been watching a lot. Things seem to work well, and MythTV is getting better all the time. Now I wonder if I want to get a better encoder card, I hear that they're worth it because they produce higher-quality output.
- while I was monkeying around inside the machine (to add an IDE controller) I rearranged the order of the cards to see if it would make a difference in the picture quality. The DL380 has horizontal PCI slots and I put the tuner in the topmost slot so that its electronic side was facing the top of the case, and its back was facing the other cards. It makes a noticable difference! Most channels aren't affected but channels 2 and 6 were very noisy and, while still somewhat noisy, are improved.
- I'd like to be able to record shows and archive them onto cd or dvd. http://www.forevermore.net/mythtv/
has a tool that transcodes mythtv's file format into formats that can be burned onto disk. Need to try it out.
- I tried running
(see above) and it seemed to work OK, but it takes a long time to run. An hour-long show takes 6 hours to transcode to SVCD-quality mpeg, and ends up as an 850mb file. Transcoding to VCD takes the same time but results in a 644MB file so it looks as if it will fit on a CD. Then
turns it into something that
can write onto the disk. Hardly user-friendly.
$ nuvexport (runs interactively)
$ vcdimager practice1-vcd.mpg
$ cdrdao write --device 0,0,0 videocd.cue
Our standalone DVD player doesn't seem to like the CD-R media, but it plays in mplayer just fine.
Here's a hint on how to get
to use the mythtv commercial cutlist when you export: http://www.gossamer-threads.com/archive/MythTV_C2/Users_F11/Nuvexport_and_cutlist_P101885/
- the vcd's I made of the Dedham episodes of the Practice worked fine on Linux using MPlayer but on Windows the sound's pitch was shifted way up. I think that's because I was recording at 32kHz and the nuvexport tool didn't transcode to 44.1kHz. Evidently MPlayer can deal with this but whatever crappy windows software came with the warthog couldn't. I first noticed this when I got this message from
++ WARN: audio stream #0 has sampling frequency 32000 Hz (should be 44100 Hz)
I'm not sure what the real fix is, but changing my mythtv recording profiles to record at 44.1kHz seems to work fine so I'll use that frequency from now on.
- things were humming along fine until one day I noticed that I wasn't getting any TV listing data. Turns out the web site that
was screen-scraping from (http://labs.zap2it.com/
) changed their format, but also added a web services interface to get the TV data. So I decided that rather than wait for packages I'd pull the source from CVS and build it. Not a bad process overall. I had been running the same version for a while and this version appears to be more stable than what I had.
- I upgraded the server from Linux 2.4 to 2.6 and found that I had the same problems with sound that I had before (see 2003-09-19
). It seems that the magic kernel parameter has changed for 2.6, see http://mythtv.org/pipermail/mythtv-users/2003-November/020414.html
options bttv audiomux=0xff44e
2.6 is overall a big improvement over 2.4, live TV "skips" less (almost never now) than it used to.
- Upgraded to 0.17. Problems with the backend getting killed by the Linux kernel out of memory killer. Seems to use a lot of memory when it's recording (or when I'm watching TV):
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29777 mythtv 16 0 239m 39m 89m S 0.0 1.0 0:00.14 mythbackend
...and even when it's not recording:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29984 mythtv 15 0 150m 14m 24m S 0.0 0.4 0:00.87 mythbackend
- Upgrading to Linux 2.6.10 (from 2.6.6) seems to fix the out of memory killer. The backend has been running fine for a day now and has successfully recorded a couple of shows.
- this looks like it has a lot of potentially useful features - http://gizmod.sourceforge.net/
- noticed that despite making the binaries setuid root, they weren't using real-time priority. Guess I'll run them sudo for the time being.
- things have been humming along fine lately, but tonight everything was broken. Mythtv couldn't connect to the database, although the mysql command-line client could. Turns out that I needed to install a package called
that must have been uninstalled at some point. Since Debian released Sarge it has been less stable than usual on the unstable branch. Can't complain too much, though, it's still pretty stable considering how bleeding-edge the packages are. In trying to figure out what went wrong I ended up upgrading the the bleeding-edge mythtv, too. I hope it works OK.
- The laptop that we watch TV on had gone funky - the display works fine but the backlight would switch off after a couple of seconds, which makes it hard to watch. Luckily, my Dad came through with an LCD panel (and a 2nd-hand computer) for my birthday so now I've got the laptop working with the external panel. It's not as easy to do as I thought it would be. The issue is that the Radeon chip in the laptop treats the panel and the external VGA adapter as two independent displays, so you need to do a little X.org configuration hacking to get the primary display on the external panel. The key (for me) was explicitly specifying a wide range for the VGA connector's clocks so that X would allow it to run at 1280x1024. After that, X looked beautiful but mythtv and xine didn't work. Turns out that the "Xv" interface that X uses to display video only works on one display or the other, and it works on the internal panel by default. So you need to use the
) to switch Xv to use the external display, e.g.
xvattr -a XV_SWITCHCRT -v 1
. I made a file called
so that xvattr gets run when X starts.
- moved the tuner card and 200GB disk from phoenix to sandcastle, and am in the process of getting everything working again. I didn't take good enough notes last time so I'm having to re-figure-out more than I'd like. So far it's been pretty easy - I needed to enable recording on the line input using
amixer sset Line,0 mute cap
- sandcastle was a disappointment - I couldn't get it to run reliably. So I moved the 200G drive back to noisy old phoenix and bought a PVR-500 card on ebay. Setting it up was non-trivial, but here's what seemed to work, based on instructions on http://ivtvdriver.org/index.php/Howto:Debian
- upgrade debian to 2.6.15, which didn't work off the bat. I had to make an initrd that didn't use lvm. I used the
yaird tool, e.g.
$ mkinitrd.yaird -o /tmp/initrd 2.6.15-1-686-smp. This boots OK.
- Now that I'm on 2.6.15 the
module-assistant prepare command works.
$ sudo module-assistant auto-install ivtv0.4
pvr_188.8.131.5235.zip from the link on http://ivtvdriver.org/index.php/Firmware, unzip and copy the files to the hotplug directory. I only had to copy the files in "step 1", to the hotplug directory.
$ modprobe ivtv
- Because the pvr-500 records the sound itself there's no soundcard configuration, which is nice.
- watching live TV works fine, but recording shows doesn't seem to work. I'll try to fix this by deleting both cards in mythtv-setup and then re-adding the pvr-500. Seems to work now; it's cool to see it recording two shows at the same time and using almost 0 CPU.
- had to make some changes to warthog's configuration due to the new X windows in Debian. First off, it appears as if the external display is display 0 now, so I don't need to run
- been having problems for a few days with the backend going out to lunch. It's running, and you can use the front end, but it doesn't think that it has any shows to record. Looks like this problem: http://www.gossamer-threads.com/lists/mythtv/users/195340
- everything's been humming along great for quite some time. The 0.19 branch + PVR-500 is really stable. Now if only there were something worth watching...
- phoenix, my fancy Compaq server, started having disk controller problems so I shut it down and moved to an old Athlon machine that I was using as a diskless workstation. It's not very powerful but it uses all commodity parts, so it should be easier than the Compaq with its tweaky proprietary hardware. Anyway, there's been progress in packaging the stuff that Debian needs since 2006-02-05
when I set up sandcastle (e.g. http://packages.debian.org/testing/x11/ivtv-source
). Here's the scoop:
- make sure that the contrib repository is enabled in apt-get
sudo aptitude install module-assistant
sudo apt-get source ivtv-source; apt-get build-dep ivtv-source - this creates an
(cd ivtv-0.8.1/ && dpkg-buildpackage -rsudo -b) - this creates two
.deb packages, ivtv-source_0.8.1-2_all.deb and ivtv-utils_0.8.1-2_i386.deb
sudo dpkg -i ivtv-source_0.8.1-2_all.deb - this package has a tarball of the driver source code and some metadata
sudo module-assistant prepare; sudo module-assistant update - this tells module-assistant to scan its available packages
sudo module-assistant build ivtv - builds the driver .deb package
sudo dpkg -i /usr/src/ivtv-modules-2.6.18-3-486_0.8.1-2+2.6.18-7_i386.deb - install the driver package
- the first time I installed the driver by hand (
modprobe ivtv) it failed, and trashed the network card driver, but then I rebooted and it loaded automatically and looked OK.
No joy. backend locks up tight, but behaves differently based on log level or whether you're using strace. Maybe http://www.gossamer-threads.com/lists/mythtv/users/241684
has something to do with it.
Nope, turns out there was an
in the mythtv directory that must have been leftover from phoenix. Deleted the file and everything was OK.
- a co-worker pointed out that zap2it is discontinuing their TV listing service. Bummer. It will be interesting to see if an alternative pops up. http://slashdot.org/article.pl?sid=07/06/20/1920224
- I signed up with http://www.schedulesdirect.org/
when they first started and the service works great! They even retroactively lowered
- I've been having a problem similar to this one for a while now - it's peculiar and difficult to pinpoint. Sometimes it happens and sometimes it doesn't.
to slow down the time before the keys start repeating (e.g.
xset r rate 2000 8
) seems to work around the problem. Strange.
- RCN switched over to all-digital last week so I cancelled my cable subscription and it looks as if we'll be TV-free for a while until I can figure out an over-the-air solution. Who knows? We might even benefit from a break in the endless assault of mindless programming.
- Upgraded to Debian Lenny. On the server side things look good - the Debian kernel now has the ivtv drivers built in so I no longer have to do all that
junk that I used to. On the client things also look good, but Xv switched the default display so even though most stuff was displayed on the external monitor, video was displayed on the laptop's panel (which doesn't have a backlight - see above). The answer was to hack the
script I made back in 2005:
xvattr -a XV_CRTC -v 1
- haven't been running mythtv for a while now. The combination of netflix and over-the-air broadcast tv is ok, although commercials are a pain. http://elisa.fluendo.com/
- Elisa is another media center project. Looks as if it doesn't do TV yet, but it looks pretty slick.