Ripping DVDs to play on the AppleTV

Posted by Thoughts and Ramblings on Sunday, August 26, 2007

First, I should start off with the prerequisites for the AppleTV itself.

  • I have hacked my ATV and installed Perian.
  • I also have installed Sapphire to play back the content.
  • And lastly, I have installed the USB kernel extensions to allow use of an external hard drive, but this piece is not a necessity.

The second piece I used is Handbrake to actually rip the DVDs.

Most people try to make the choice between AVI or MP4 file formats. There are problems with both of these approaches.

  • AVI is not designed to handle frames whose decode order doesn’t match the display order, and so in order to stuff advanced video codecs in the container, people use a series of hacks. AVI is also not designed to handle several other advanced features such as chapters. IMHO, it is a format that should be allowed to die.
  • MP4 handles many of the advanced features that AVI lacks, but it is restricted in terms of the codecs allowed within the container. Most notable, it disallows the use of AC3 audio.

So, it would be nice to get all the advanced features of MP4 with AC3 audio. Here is how I did it.

I rip to MKV (Matroska) files. This worked well before the latest release, but shortly before version 0.9, the developers broke chapter support (infinite loop), and haven’t fixed it (even in SVN). Anyway, I use AC3 passthrough, and H.264 video. For the video, I am currently testing Constant Quality of 56% (CRF not CQP, set in the prefs) and advanced H.264 settings:

ref=3: mixed-refs=1: bframes=3: b-pyramid=1: brdo=1: bime=1: weightb=1: subq=6: analyse=all: 8x8dct=1: vbv-maxrate=25000

Note: this is high profile h.264, and Apple’s decoder in Quicktime is incapable of decoding it. Quicktime < 7.2 would often tell you it can’t decode it, the one on the AppleTV would crash, and now Quicktime 7.2 will just freeze. Perian on the other hand, works just fine. So, that is the end of it, right?

Wrong. See, the creators of Matroska in their infinite wisdom discouraged a full sample index of the file. This means that importing the file into Quicktime takes a fair amount of time. So, my final stage is to open the MKV in Quicktime Player and wait for the import to complete. Then, I simply save as a self contained mov file, and then I am done.

It is also interesting to note that the mov file is actually slightly smaller. So, the end result is a mov file, with high quality video and audio and a device that plays it well on the TV. So far, the only disadvantage is the encoding time and the MKV intermediate step.

Now I need to buy more hard drive space to store the data, and put the DVDs in permanent storage.

Legacy Comments:

Radoslav - Sep 20, 2007

Nice site Graham! I’m signing up for the mac listserv next; after I finish this delicious Jack-in-the-Box :P.