Raj's adventures with Linux, MacOSX, the HD revolution, and any other toys he might pick up along the way.

Thursday, July 26, 2007

Backing Up files from your DVR (and why its not pirating if you do)

Since yesterday's post, I've gotten some readers who seem to think that copying content off of your DVR is illegal, and somehow piracy and/or copyright violation. The FCC, in late 2003, ruled that all cable customers with HD set top boxes should have functioning Firewire ports on them (see paragraph 24 on page 12, and paragraph 36 on page 17). They say this is so that "Digital VCRs" will interoperate properly with HD set top boxes. That's right, the FCC, a government agency, ruled that we were allowed to connect digital VCRs to our Hi-Def cable boxes. Clearly they're tricking us into thinking that it is legal, so they can bust down our doors! Engadget has written about this, so I'll spare you even more details.

What is DVB?Digital broadcasts over cable, called DVB-C, come down the pipes as an MPEG2 Transport Stream. This is a stream of packets not unlike those sent over IP networks. Each packet is part of the video stream, the audio stream, or a part of some other meta-data stream (sub-titles, program info, etc). These packets are interleaved in time, and the receiving end identifies each one by a PID number, and demultiplexes the data using these PID numbers. The receiver then decodes the streams into signals your TV understands, and sends them on their merry way via HDMI, component, or whatever you use.

Capturing DVBSo we want to capture the transport stream. The essential idea is to capture a raw transport stream over Firewire as it plays by making your computer emulate a D-VHS recorder. This is not unlike a PCAP dump for you networking folks, essentially a packet trace, a log of all the packets that are coming fromt he cable company. I stress again that this constitutes fair use and is explicitly allowable BY THE FCC according to the link above. Wikibooks has a good collection of resources, so read on there if you want to do this. In short, this overcomes drive size limits on your DVR. I have a Motorola box from Comcast, and it has a 160GB drive. I DVR things onto the box, then play them back while recording them onto a 500GB external USB drive using my MacBook. Then, delete off my DVR box as necessary, and lo and behold, I effectively have 760GB hard drive for my DVR. These transport streams aren't playable by many players, but I know VLC can demux and play them. Connect my Macbook to the TV via DVI/HDMI, and there we go.

Re-Multiplexing/TranscodingOne last note, sometimes VLC will choke on the TS files. In this case, I suggest ProjectX, a free/open-source MPEG tool. I'll do a tutorial about using the latest version in the future. Or, you can use VLC's transcoding options to go from TS to PS, which is what you want. I was hoping my new PS3 would play these files correctly, but my last post was about my tribulations with making that work. More on this later. Any way, happy DVRing!