My personal Blog, about my hobbies and work

MP4 for the iPod-touch

March 25th, 2008 Posted in Computers

A quick post about making videos for the iPod-touch.
Just recently I bought one of these little machines and quite frankly they are great! Of course I wanted to upload some of the
video content I already had and it took some figuring out to get it to work (especially because I wanted to get it to work using linux and ffmpeg). To prevent some of you the same trouble here my findings.

First: The format you need for the iPod is mp4 (h264) with aac audio.

Second: have a look at this excellent post from Robert Swain: here

Third: be carefull with the frame rate. The iPod does not like “23.96542-like” frame rates. So if you have a file with a frame rate like that, specify it like 23.96 or something.

Last: here the ffmpeg command line params I use (based on Robert’s post)
I use two pass encoding

ffmpeg -threads 2 -i "$file" -vcodec libx264 -b $VBITRATE -deinterlace -r $fps\
-an -flags +loop -cmp +chroma -partitions 0 -me epzs -subq 1 -trellis 0\
-refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40\
-i_qfactor 0.71 -bt $VBITRATE -maxrate 768k -bufsize 2M\
-rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10\
-qmax 51 -qdiff 4 -level 30 -passlogfile "$file".log -pass 1 "$file".tmp.mp4

ffmpeg -threads 2 -i "$file" -vcodec libx264 -b $VBITRATE -deinterlace -r $fps\
-ab 112kb -acodec libfaac -ar 44100 -ac 2\
-flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh\
-subq 5 -trellis 1 -refs 1\
-coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71\
-bt $VBITRATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)'
-qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30\
-passlogfile "$file".log -pass 2 "$file".tmp.mp4

Where:
file=”inputfilename”
VBITRATE=”600″ # video bitrate
fps=”25″ # video framerate

Make sure you have a recent version of ffmpeg installed with support for h264 and libfaac

You must be logged in to post a comment.