Converting .avi to .mp4 for play on iPod/iPhone using FFMPEG

Recently, I wanted to convert some of my video files to play on my wife’s iPhone. After some quick google searching I found a shell command using ffmpeg that looked like it would get the job done. As stated in the article entering the command quickly told me that there were a number of codecs that were missing and needed to be installed. Unfortunately getting the command to work wasn’t quite as simple as just installing the missing codecs. I ended up having to install ffmpeg from source in order to get things to work. Here’s the steps I needed to take. These worked for my Kubuntu distro, not sure how they would work with other distros.

Download the right codecs:

sudo apt-get install libfaac-dev libfaad-dev

Download ffmpeg from source:

sudo apt-get source ffmpeg

Switch to the directory containing the ffmpeg source code

cd ffmpeg-*

Compile from source:

sudo ./configure –enable nonfree –enable libfaac
sudo make install

Convert the file:

ffmpeg -i input.avi -acodec libfaac -ab 128kb -vcodec mpeg4 -mbd 2 -flags +4mv -trellis 2 -cmp 2 -subcmp 2 -s 320×240 output.mp4

To get the converted files onto the iPhone I just had to transfer them to my wife’s Windows machine, import the files into iTunes and sync.

h/t Tech Exposures

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>