FFmpeg iphone recipes
My Version
This is the ffmpeg command I use with the copy of ffmpeg I built locally on my mac via MacPorts. Check that your ffmpeg is OK by running
ffmpeg
from the command prompt, it will spit out some information about the various options it was compiled with, should look more or less like this:
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --prefix=/opt/local --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-avfilter --enable-avfilter-lavf --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64
Then use a command like the one below:
ffmpeg -i INPUT.MOV -acodec libfaac -ab 128k -s 640x480 -vcodec libx264 -vpre hq -vpre ipod640 -b 1500k -aspect 4:3 -threads 0 -f ipod output.m4v
Info taken from this site.
Stolen from Azureus
Azureus now has iPhone encoding built in. I was a little curious how it managed the encoding, I had hoped they wrote a Java based video encoder capable of converting anything into iPhone suitable mp4s thereby creating a cross-platform solution that didn’t require compilation, but alas they, like everybody else used the power of open source via ffmpeg.
A little playing with the ps command and I was able to rescue the ffmpeg incantation they use to convert to iPhone. Since they helpfully include a pre-compliled ffmpeg binary with all the necessary libs this is actually almost as good since as many know trying to compile ffmpeg for each platform can be quite a difficult and trying experience.
Anyhow, here’s the code:
/Users/YourUser/Library/Application Support/Vuze/plugins/vuzexcode/ffmpeg -y -threads 2 -i file.avi -f mp4 -s 480x272 -r 23.976 -vcodec libx264 -bf 0 -coder 0 -refs 4 -g 50 -maxrate 8000kbps -bufsize 8000kbit -crf 20 -me_method umh -ar 32000 -ac 1 -ab 128 -acodec libfaac outfile.mp4
No comments yet.