Recording HDTV


This project is dead forever. I no longer have the equipment to try and recreate my changes, I accidentally lost the changes I made to the source years ago, and there are other HD-over-firewire capture tools out there. Sorry! The binary is still available, and these instructions may be interesting to someone, but that's all. Everything I have on this project is right here, so there's no point writing to me about this. Sorry.


I've just started this project, so these notes will be updated as I progress towards creating a working HDTV recorder out of an old Macintosh. I'll be using MacOS X for the operating system and FireWire (IEEE 1394) for the transport connection between the HD tuner and computer. A recent article on Slashdot presents other recording methods if you don't have a FireWire enabled tuner.

People wonder why I do this. Recently, TiVo and Dish Network have released a HD PVR product that's much friendlier than this, and some cable companies have them too. Since I can't afford a hardware PVR, and I had an old Mac (really old, one of the first G3's, 1998 style) lying around, I decided to see if I could make something cheap that will record stuff for me in HDTV.

Why a computer?

My reasons behind using a computer are simple: it cost me less. I had an old G3 266 and I wondered if the drive was fast enough to capture an ATSC stream and play it back. All one needs is something capable of interfacing with the ATSC tuner, capturing the MPEG2 transport stream to hard drive, and playing back the captured stream.

Benefits to using a computer:

  1. Recording time only limited by available storage
  2. Random access (like a DVD) to saved HD programs
  3. ATSC stream is captured and stored; never decoded or altered
  4. Can be used for other things, such as an MP3 player
  5. You might have an old computer laying around that needs something to do.
  6. You can edit out the ads if you want to save the stream.

Disadvantages to using a computer:

  1. The FireWire (IEEE1394) method here only works with certain tuners and HDTV sets
  2. Computer is larger, possibly louder, than a D-VHS deck
  3. VirtualDVHS does not have fast-forward/rewind capability
  4. Lacks onscreen menus and features of a TiVo-like PVR.

Of course, you must have a working knowledge of computers and be willing to play with and figure things out if it doesn't go smoothly. As it is distributed, VirtualDVHS doesn't have fast-forward or rewind enabled. However, since the source code is included, I made some simple skip forward and skip back functions that responded to the TV remote.

Obligatory Warning

If you try any of this, you do so at your own risk. I can not be held responsible if anything breaks, crashes, voids warranties, and so forth. Any software or information provided here is on an "as is" basis. There are no warranties, express or implied, for this product. In no event shall I be held liable for any damages arising from the use of this software.

That said, it works fine for me. But these days, you need warnings in case some nut wants to sue because they broke something. On to the fun stuff!

The Software

As of this writing, the software component is prerelease and part of the FireWire SDK for MacOS X. You can find the FireWire SDK at the Apple Developer Connection. Included with the FireWire SDK is an application called "VirtualDVHS" which basically makes the Mac emulate the functions of a D-VHS deck connected to a tuner via FireWire.

The catch is that there are no timer functions in the software; it will respond to commands from a TV or set top box with an AV/C tape controller. Thus far, only Mitsubishi NetCommand sets and the Samsung SIR-T165 set top box support such features. AV/C will allow the tuner to control VirtualDVHS, which includes full function of the remote and recording timers on Mitsubishi sets. (I don't have a SIR-T165 to test.) See the Read Me files included with VirtualDVHS and the FireWire SDK for more information.

If you already have a D-VHS VCR, VirtualDVHS will interface with it as well.

VirtualDVHS and Mitsubishi HDTV

The first version of Virtual DVHS wouldn't work with Mitsubishi tuners; this has been fixed in the latest FireWire SDK if you wish to use the program unaltered.

A fix for the old version can be found at: Apple FireWire list archives.

Storage Space

The key to all of this is hard drive space and recording time. More drive space equals more recording time. A good rule of thumb is one hour of high definition (which streams at about 19 Mb/s) equals just under 9 GB of drive space. Leave about 3 to 4 gigs for the operating system and swap space.

I would recommend that you partition your drive into two volumes: the OS partition (4 gig) and transport stream (rest of drive) partition. Or make a RAID 0 array (using Disk Utility and multiple drives) for the transport stream files. Speed is the key. The stock Western Digital drive Apple shipped with the machine was way too slow, so I had to get a faster drive. I like Seagate drives, so I got an 80 gig Seagate for it.

What's a "transport stream" you ask? Well, you aren't really recording the audio and video like a VCR would. This type of recorder is capturing the MPEG2 data stream, before it gets decoded and displayed, and saving it to disk. When you play it, you're simply sending the saved transport stream back to the tuner, which it decodes and displays like the original broadcast. Since everything stays digital, there is no loss of quality.

The Hardware

All Mitsubishi HDTV sets with integrated tuners (including the Promise Module) include four pin FireWire jacks on the back. These are a dream come true in making the process of getting the HD stream from tuner to computer as simple as connecting a cable between the two. Once connected, and VirtualDVHS is running, the TV will bring up a menu asking you to add the newly connected device.

The old Power Macintosh G3 266 works since there isn't any decoding or encoding going on, it just needs to be fast enough to write the stream to disk in real time. This means you can use pretty much any G3 or better class machine with FireWire.

This is what I ended up testing on:

I tried using a FireWire external hard drive, and while it works fine, the drive I used liked to spin down after a while for power saving purposes. This, however, won't work with HD recording because it needs to be able to start saving the transport stream instantly. In the time it took the drive to spin back up, the recording was a total loss.

One more thing: this combination works for 19Mb/s 8VSB HD from an antenna. Anything with a high bitrate may require hardware that's slightly more robust. That said, CPU usage was only around 23% while capturing the ATSC stream on my Beige G3.

MacOS X 10.3

The G3 266 does not support MacOS X 10.3 out of the box. I decided to install 10.3 because of stabaility issues I was having with 10.2.6 and the FireWire components included with the developer kit. Since 10.3 on this old G3 is unsupported, I had to use XPostFacto to upgrade from 10.2.6 to 10.3.

The good news is that it worked: the system was much more stable than under 10.2.6, and even seemed a little faster than before. Of course, that was before I decided to mess around with the FireWire development tools. Since then, it had trouble getting through a two hours recording block.

The trick to getting 10.3 working on the G3 266, if you had kernel panic after install problems like I had, is to install 10.2.8 first (which is supported) then do an upgrade install of 10.3 using XPostFacto.

Samsung SIR-T165

A discussion on the Samsung SIR-T165: http://www.avsforum.com/avs-vb/showthread.php?s=&threadid=269141

My Alterations

I've made some basic alterations to the VirtualDVHS application. So far, I've completed the following:

  • Skip forward one percent of total stream time (Fast Forward)
  • Skip back one percent of total stream time (Rewind)
  • Stop restarts the stream from the beginning
  • Pause allows stream to resume from current location
  • Enabled Fast Forward and Rewind buttons in the user interface
  • Respond to Fast Forward and Rewind commands from TV remote

I elected to use a simple jump forward or back in time method for fast forward and rewind functions. For each press of the rewind or fast forward buttons (either on the remote control or in VirtualDVHS), the stream will skip one percent. This equates to about 35 seconds in a one hour program. The skip method was chosen because I couldn't think of an elegant way to walk through the digital stream and still display enough information on screen so one can see where they are in the program (i.e. fast forwarding through commercials). However, I may change this in the future when I have more time to play with it.

Things I'd like to do or need to fix:

  • Fast forward or rewind like an analog VCR (stay in wind mode until another button is pushed)
  • Update the pause button in VirtualDVHS to reflect remote commands
  • Delete the currently playing stream
  • Change program streams with remote control (previous and next)

There's one issue I don't think I can solve: the timecode when you do a fast forward or rewind reflects the time *before* the button was pressed. This appears to be just how the TV sends commands; which is: get current time, send command, check for success/fail. It's a minor issue, but not fatal. Other changes will get made to the program as it gets used. My goal is to make it so you can operate VirtualDVHS with the TV's remote control and not have to work with the computer itself when you want to watch something it recorded.

I'm using a Mitsubishi NetCommand 2.0 projection TV to implement the remote control functions; your tuner may vary in what functions it will send to VirtualDVHS. If you're using a different tuner and some of the functions don't work, let me know and I'll see what I can do.

Time Shifting

For those tuners without AV/C controllers another VirtualDVHS user has made some scripts to control VirtualDVHS. You can find the scripts, along with instructions, here:

(Link is dead as of November 2007. Try archive.org)

Editing

You can use a tool like MPEG Streamclip to edit the stream; good for cutting out the ads if you want to archive the program you recorded. It's been a little quirky when I try to use it, but give it a try. Make sure to read all about it first.

Downloads

My altered binary is currently available below. I'll be making diffs of the source files soon. (Yes, the license of VirtualDVHS allows me to distribute a modified version.) Please excuse any of the bad code I may have written; I haven't had much time to work on this. Any additions or optimizations you have are welcome.


This project is dead forever. I no longer have the equipment to try and recreate my changes, I accidentally lost the changes I made to the source years ago, and there are other HD-over-firewire capture tools out there. Sorry! The binary is still available, and these instructions may be interesting to someone, but that's all. Everything I have on this project is right here, so there's no point writing to me about this. Sorry.