Encoding Movies for the iPod Video using Linux

If you want to encode video that you have on DVD for your iPod Video, a nice utility called HandBrake will do it for you. It works pretty well on Mac OS X, but my laptop’s a little slow in the I/O department, and I prefer to use my Linux desktop for encoding.

Caveat: it’s illegal to rip commercial, encrypted DVDs to your computer. Non-encrypted DVDs for which you have copyright permission, for example your home videos, are legal to rip. Don’t say I didn’t warn you.

Now that that’s out of the way, here’s a little script I wrote to rip DVDs using HandBrake for linux:


#!/bin/bash
# Filename is dvd2ipod
# $1 - output filename
# $2 - title number
handbrake -f mp4 -i /dev/dvdrw \
-o $1 -t $2 -e ffmpeg -E faac -w 320

It assumes that you’ve installed HandBrake, and renamed HBTest to ‘handbrake’ and put it somewhere in your path. It also assumes that your DVD drive is /dev/dvdrw. This outputs video in a format that iTunes will let you import, and subsequently play on your iPod Video. I didn’t set anything for audio tracks, subtitles, etc. It uses the defaults. You can easily modify this script for that. The important things are the dimensions ( -w 320 ) and the codecs ( -e ffmpeg, -f mp4, -E faac ). The first argument is the output filename you want, and the second is the title number that you want from the DVD. Say you have a DVD from your wedding with two titles — the wedding, and the reception. If the wedding is title 1, and the reception is title 2, to rip the reception, you’d do this:


dvd2ipod OurWeddingReception.mp4 2

Wait a bit, ignore the error messages as long as it keeps encoding, and enjoy showing your friends/family/coworkers your reception (or whatever)!

ADDENDUM 2007-02-07: You can now use larger movie sizes, up to 640×480, so you may want to change that if you plan on playing to an external display device. Otherwise, stick with what’s written above, as the 5G video ipod only has a QVGA screen.