Approaches to a Linux PVR
I have been looking into how to set up a Linux personal video recorder, or PVR. I don't have one working yet, but I have learned a few things. Here are notes on the two approaches that look best for a Linux PVR.
My goal is to have the option of full-quality capture. Thus, I am not interested in any solution based on USB; no USB solution can capture full-size frames at full speed. USB 1.1 simply doesn't have the bandwidth for real-time video capture, even with compression. USB 2.0 does have the required bandwidth, but I haven't seen any USB 2.0 TV capture devices. Also, I am not interested in any solution that cannot capture stereo sound.
However, the capture does not necessarily have to be highly compressed. A two-step capture process would be perfectly adequate. It could, for example, capture in some easy, low-compression format and then automatically (in the middle of the night) re-encode the video to something more space-efficient for long-term storage.
Ideally, the video will be in an open format at all times. Although some devices permit video capture in MPEG-2 in real time, the patent issues encumbering MPEG-2 make me reluctant to use it in a Linux PVR.
The standard format for a DVD is MPEG-2, though. In order to make a standard DVD, some sort of legal MPEG-2 encoder is required. A hardware device that handles the MPEG-2 encoding would be a convenient way to get a legal MPEG-2 encoder on a Linux system.
The Ogg Theora Project holds great promise as an open video format, and it's currently in a pre-alpha development stage. It is based on VP3, but all the patents on VP3 have been signed away, so Theora can be fully open and free. Naturally, Theora uses Vorbis for the soundtrack.
If disk space isn't an issue, you could leave the video in the same format in which the PVR software originally saved it.
The simplest way to build a Linux PVR probably would be to get MythTV working. MythTV looks nice in the screenshots, it appears to have some very nice features and the folks who use it rave about it.
The major obstacle is to find a TV capture card that will work with MythTV. Which card is best? The MythTV web page simply says that you can use "any TV card supported by Video for Linux". I studied various web pages and figured out that what I want is a card based on the Brooktree 878 chip. The 878 supports audio capture, in stereo, using the btaudio kernel driver.
Older TV cards usually require that you connect an audio-out jack on the TV card to an audio-in jack on your sound card. The major problem with this connection is the clock on the audio card may be subtly out of sync with the clock on the TV card. Thus, the video capture stream and the audio capture stream may drift out of sync. Even a tiny difference, adding up over an hour-long TV show, may result in sound and video being annoyingly incongruous. Obtaining the audio and video streams from the same 878 chip should avoid this problem.
I also wanted to know if it is possible to set up a PVR that has multiple TV cards. I am not sure how much CPU time it takes to capture video, but I suspect that two TV cards would be workable on an Athlon XP or a Pentium 4 system. Obviously, it would be easier to plug in two TV cards than to plug in two TV cards and route audio cables into one or two sound cards. If you plan to capture and play back on different computers, however, with an 878-based TV card your capture computer won't even require a sound card.
Okay, we want a TV capture card based on an 878 chip--which card is that? If we want a solution simply works, we probably want an older TV card. The ATI TV Wonder looks viable, and I plan to try one soon. The ATI TV Wonder VE, on the other hand, is not a good choice. Although it does use an 878 chip, direct audio capture is enabled on the VE card; you must connect an audio-out jack with your sound card. And it doesn't support stereo sound.)
I bought a Pinnacle PCTV Pro card, on sale at CompUSA, because I had determined it had a Conexant 878 chip. I figured this would be compatible with the Brooktree 878 chip, and it should work easily. This turned out not to be the case, however; the card is too new to be recognized by the version of the bttv driver module bundled with the 2.4.20 kernel. I upgraded my bttv driver module to the latest version, and the Pinnacle card was detected correctly, but it did not actually work. I plan to set the module for maximum verbose logging, collect the logs and ship them to the bttv driver folks. Hopefully, in the near future the PCTV Pro card might work and be a good choice. Meanwhile, I am ordering an ATI TV Wonder to try. I'm hoping it will work with the bttv module bundled with the 2.4.20 kernel.
MythTV captures in NuppelVideo format, an open standard that has good free software support. Tools are available to transcode it, and MPlayer has support for directly playing NuppelVideo files.
The other approach I consider promising is to use an external video capture device that connects with 1394 (FireWire) and captures in DV format. One such device is the Canopus ADVC-100.
Because the video capture and compression is done all at once inside the external box, a relatively low-powered computer is adequate for video capture. DV video is compressed at about a 5:1 ratio, and the format is open so there are free tools available to transcode it. Audio/video sync should be flawless.
An external DV capture device does not, however, include a TV tuner. It would be necessary therefore to connect some sort of tuner device to the DV capture box. An inexpensive VCR would work perfectly, but some means of changing channels would be required. The LIRC project does have support for IR transmitters, but you probably would have to build the transmitter yourself. The other option would be to find a cable TV or satellite tuner box that has a serial port input that can change channels.
This last option probably means you would use command-line video capture, because the various PVR programs currently assume you are using a TV capture card to change channels. It probably would not require a great deal of work to modify MythTV to allow it to use an IR transmitter to change channels. If I were to attempt this capture solution, I would look into that possibility.
One other option would be simply to buy a Tivo. I did not formerly consider this an acceptable option, because Tivo locks away your recorded programs behind a layer of encryption. But free software is now available that can extract program listings and video streams from the locked-down Tivo formats. Thus, one could buy a Tivo, hack it so it is on your home network and then extract video streams. I am not personally interested in this approach, but I include it for completeness.
Steve Hastings first used UNIX on actual paper teletypes. He enjoys bicycling, music, petting his cat and making his Linux computers do new things.