January 3, 2007

Pull in HDTV with Linux and the HD-5500

Author: Paul Virijevich

I've spent the past few years using an ATI TV Wonder analog video capture card running under Linux. Although this card has served me well, times and technology have been a'changin'. That's why I recently purchased a pcHDTVHD-5500 to see if HDTV was all it was hyped up to be. I can report that HDTV under Linux is not only possible, it's downright fantastic.

The HD-5500 is a low-profile PCI 2.2-compliant card that supports multiple inputs for getting the signal to the card. A standard coaxial antenna input is complimented by component and S-Video. My antenna uses the coaxial connection so there were no problems there. There is also an audio cable to connect to your sound card. The thing that surprised me the most about the card is the inclusion of an IR receiver. The surprise faded quickly -- the instructions state that it's not yet supported.

The only problem hardware-wise is the weak connection for the coaxial input connector. It pulls right off the card easily. After playing with it for a couple of minutes, I could not figure out how it's meant to stay on. Fortunately this is not really a problem once the card is installed.

I installed the card in a dual-processor machine with two 1.2GHz AMD Duron processors. This may seem a little underpowered for HDTV when a 2GHz or better processor is suggested for playing back HD content. My ace in the hole is an Nvidia GeForce 440MX graphics card that supports accelerated playback of HD content.

Linux support for the HD-5500 could not be better. The card is manufactured with the sole purpose of being used with Linux. There are no Windows or Mac OS X drivers available. The drivers are included in kernels 2.6.18 and later. Drivers for earlier kernels are provided by pcHDTV. Because I was using a 2.6.16 kernel, I found myself relying on the company's driver.

As with most hardware and Linux these days, installation was painless. After downloading the latest driver from pcHDTV's site, a quick make; make install did the trick.

The HD-5500 comes with a few different software tools to get you started. I suggest skipping the versions on the included CD and downloading the latest ones from pcHDTV's site. The following tools are provided in the dtv-atsc-tools package:

  • dtvsignal - Measures the signal strength of digital channels
  • dtvscan - Scans the entire Over the Air (OTA) frequency table and reports signal strength for each channel it finds
  • getatsc - Grabs an HDTV stream. Good for dumping streams to disk.

In addition, pcHDTV provides a custom version of xine called xine-hd for viewing HD channels. Here is a quick overview of how each tool works.

HDTV signals are directional. Reception is highly dependent on distance from the transmitter and the type of antenna used. You need at least 60% signal strength to get good reception. That's where dtvsignal and dtvscan come in. They are great for letting you know what channels have enough signal strength to be worth your time. Running dtvscan without any arguments is a quick way to get an idea of what you will be able to receive. Then you can use dtvsignal to home in on what antenna position works best for each channel. Just pass the utility a channel that dtvscan finds as an argument. For example:

dtvsignal 15

This brings up a signal strength bar that changes dynamically as you move the antenna.

After popping in the card, installing the drivers, and using the methods I just described, I located a total of five HD streams with 10 separate channels in less than an hour. Not all of those streams were HD channels. Broadcasters transmit multiple channels on the same HD stream. These streams contain HD channels along with standard definition (SD) ones. It's worth pointing out that I am in the middle of nowhere when it comes to OTA TV reception. SD channels that I barely got with the TV Wonder card come in crystal clear when pulled from the HD stream. I even get channels that had always been too far away to receive with analog reception. The fact that I am able to pull in HD streams from stations 50 miles away speaks volumes about the superiority of broadcasting in HD. Even more impressive is the fact that this is possible with a small indoor antenna. In major markets, you can to expect to get up to 30 channels.

The getatsc tool is a great way to make sure the card is working. It's also a simple command-line way of recording programs. For example, this command records the HD stream on channel 15:

getatsc -dvb 0 15 > recording.ts

Once you've started recording, you can point your favorite Linux multimedia player at the file and start playing right away.

The only problem with getatsc is that it does not let you select sub-channels of an HD stream to record. When you play back the file, you may or may not get the channel you want. Supposedly there is a way to select a sub-channel with pcHDTV's patched version of xine, but it never worked for me.

The application pcHDTV expects you to use for viewing HD content is xine-hd. I grabbed the latest version from the company's site and had no problems with the installation. Keeping it up and running while playing back HD content was another thing.

The only extra step you need before tuning in HD channels is to create a playlist of channels with dtvscan, like this:

dtvscan -fx -o ~/.xine/channels.atsc

Once that file is in place, xine will cycle through those channels using the up and down buttons in the xine-hd skin.

This all works as advertised, and I was soon watching HD channels through xine. Watching an HD stream without accelerated playback pegged one processor and left the other one at about 30% usage. The video played back smoothly but the audio was a little choppy. Changing channels took a little longer than I liked, but I have seen almost as bad with some cable and satellite receivers.

Next it was time to find out what kind of boost the accelerated playback from the video card would give. This time I started up xine with:

xine -V xvmc

The first thing I noticed was that the audio was now coming in perfectly clearly. CPU usage dropped dramatically. One CPU sits at about 30% usage while playing back full-screen HD content, and the other is around 10%. That is quite an improvement from a video card you can purchase online for about $30.

Unfortunately, this version of xine is not without its problems. For starters, audio sometimes drops out when you're changing channels. It seems to happen most often to channels in the middle of the lineup. The problem starts after you've cycled through the first few channels; it is not related to specific channels. If I move the order of channels around in channels.atsc, the problem remains. This problem is sporadic and happens only with xine. The instructions from pcHDTV suggest pausing the playback and then restarting it to fix this problem. This did not work for me.

The other problem with this port of xine is its general stability. It would sometimes crash for no discernible reason. Sometimes it played for an hour or more without crashing. Other times it only took five minutes. After using it a couple days, it became apparent that this version of the software just doesn't cut it at this time.

This brings us to my experience with MythTV and the HD-5500. Things went much better here. I stuck with my existing MythTV setup. All I did was delete the TV Wonder as an input source and add the HD-5500. The card is supported by MythTV and is available from a list of DVB cards in the setup program. MythTV has its own scanner to search for available HD streams.

Just as with xine-hd, I have MythTV using accelerated playback with the Nvidia card. Playback of SD channels is terrific. But unlike with xine-hd, HD playback in MythTV doesn't quite cut it with the processor power I'm throwing at it. Video plays back smoothly, but choppy audio rears its ugly head once again. This occurs even when I play back previously recorded HD content. The same file plays back perfectly with xine-hd. At this point, I plan on picking up a couple Athlon MP 1900+ processors on eBay with which to upgrade my video server. That should take care of any processor-related issues. I am even toying with the idea of building a separate HD MythTV PVR. The ability to turn a nearly six-year-old computer into an HD PVR is a testament to Linux and its SMP capabilities.

Before this experience, I was skeptical of the need to phase out analog broadcast signals in favor of HD. Now I have to say I am firmly on the HD bandwagon.