iPhone and iPod movie convert using ffmpeg or mencoder
New iPod/iPhone/iPod Touch series supports h264 encoding.
But I still have no luck on using new x264 presets comming with ffmpeg…
Here is what I do now with ffmpeg:
Commandlines
iPhone, iPod Touch 3
:
#!/bin/sh ffmpeg -i "$1" -acodec libfaac -ab 192k -ar 48000 -vcodec libx264 -b 768k -s 480x320 -aspect 3:2 -r 26 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method dia -subq 1 -trellis 0 -refs 1 -bf 16 -b_strategy 1 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 500k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -threads 0 -f mp4 -y $1.mp4
This one is very long since I have to hand-write all the x264 settings. But IT WORKS! Add ”-an -pass 1” and then ”-pass 2” to run the script twice to get a 2-pass result.
And here is the mencoder version:
#!/bin/sh mencoder "$1" -o $1.mp4 -vf scale=480:320,harddup -of lavf -lavfopts format=ipod -alang en -sws 2 -oac faac -faacopts br=128:mpeg=4:object=2:raw -srate 44100 -ovc x264 -x264encopts bitrate=800:nocabac:level_idc=30:bframes=0:global_header:threads=2:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh
I have an old-school iPod Radio 40G. Had no luck on mencoder but my ffmpeg settings works fine. Using xvid codec:
ffmpeg -i "$1" -f mp4 -vcodec libxvid -maxrate 720k -b 400k -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec libfaac -ac 2 -ar 48000 -ab 192k -s 320x240 -aspect 4:3 $1.mp4
This is the mencoder commad that failed me. I did a lot of googling and still hoping someone could shed a light on this…
mencoder "$1" -vf scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=720000 -srate 44100 -af resample=44100:0:0 -oac faac -o "$1.mp4"
