Category Archives: Video

Ripping DVD’s for iPod (and Touch) using MEncoder

It’s pretty simple, really. Just use the right video/audio options and you’re both iPod- and iPod Touch-compatible:

#!/bin/bash

if [[ "$2" == "" ]]; then
	echo "Usage: $0 <inputfile> <outputname>"
	echo "(<outputname> does not need an extension!)"
	exit 1
fi

mencoder $1 -sws 9 -of lavf -lavfopts format=mp4 \
-vf scale=-2:320,dsize=576:320:0,harddup \
-ovc x264 \
-x264encopts bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh:trellis=1:level_idc=30:global_header:threads=2:pass=1:turbo \
-oac faac \
-alang en \
-faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -o $2.tmp.mp4

EXIT_CODE="$?"
if [[ "$?" != "0" ]]; then exit "$EXIT_CODE"; fi

mencoder $1 -sws 9 -of lavf -lavfopts format=mp4 \
-vf scale=-2:320,dsize=576:320:0,harddup \
-ovc x264 \
-x264encopts bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh:subq=6:frameref=6:trellis=1:level_idc=30:global_header:threads=2:pass=2 \
-oac faac \
-alang en \
-faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -o $2.tmp.mp4

EXIT_CODE="$?"
if [[ "$?" != "0" ]]; then exit "$EXIT_CODE"; fi

echo "ATTENTION: Movie is done but iTunes won't recognize it!"
echo "Use NicMP4Box to create an iTunes-compatible movie file!"
# nicmp4box -add $2.tmp.mp4 $2.mp4

I modified this with a 4:3 aspect ratio in mind, but it should scale to 16:4 aspect ratio automatically when given such a DVD. I have yet to test that.

Note the ending lines there. That’s the catch. If you are using Linux, and Linux software to transfer your movies to your iPod, you’re good to go as it is. On the other hand, if you use iTunes, you’ve got a problem. Apparently iTunes refuses to recognize the movies you give it unless “the ‘itunes’ atom is set to the correct value. You can add the atom to the file with nicMP4Box ( http://nic.dnsalias.com/NicMP4Box.zip ) “. Update: Read the comments for information on how to bypass the nicmp4box requirement in Linux.

Thanks to the folks at the MEncoder usage discussions for the answer!