Converting video for iPhone/iPod

Converting video for the iPhone (3G) or iPod (Classic) using mencoder:

Basic batch file:

set VBITRATE=500
set ABITRATE=128

set INFILE=inputfile.avi

mencoder -mc 0.2 "%INFILE%" -of lavf -lavfopts format=mp4 -sws 2 -vf scale=320:-2,harddup -ovc x264 -x264encopts bitrate=%VBITRATE%:vbv_maxrate=1500:vbv_bufsize=2000:me=umh:level_idc=30:global_header:threads=auto:subq=6:frameref=6:nocabac:trellis=2 -oac faac -faacopts mpeg=4:object=2:br=%ABITRATE%:raw -channels 2 -srate 48000 -o "%INFILE%.m4v"

mp4box -ipod "%INFILE%.m4v"


This would create a file called "inputfile.avi.m4v". The two extensions is not the best thing in the world, but it gets the job done.

You'll want to edit the VBITRATE and ABITRATE variables for your content. If you're watching on the iPhone screen, it's tiny so it doesn't need to be really high quality. I find that a VBITRATE of 350 is plenty for something like "The Daily Show".