The iPod is an awesome little media player that a lot of people use to play music, but many others also use it to play videos. Unfortunately, though, it is fairly fussy about which video formats it accepts. Here’s how to convert videos to allow them to be played on an iPod (and presumably iPad and iPhone, but I don’t have either of those to test with).
The Tools
The program I’m going to use is called FFmpeg, it’s fairly popular, is often found in the standard repositories on many Linux distributions and can also be used on Windows and Mac OSX.
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video.
FFmpeg website (http://ffmpeg.org/)
To download FFmpeg, either download it from http://ffmpeg.org/download.html if you’re on Windows, checkout the code from git://source.ffmpeg.org/ffmpeg.git if you want to build it yourself, or install from your repository if you’re on Linux and your distribution has it in the repo. On Fedora use su -c "yum install ffmpeg" on Ubuntu use sudo apt-get install ffmpeg
Convert a Single Video
Converting a single video is pretty simple, open up a terminal and browse to the directory where the video is and run the following command.
ffmpeg -i input.avi -acodec aac -vcodec mpeg4 -s 320x180 -strict experimental output.mp4 |
After waiting a while, your video should be done.
Converting Multiple Videos
Converting one video is easy enough, but chances are you have more than one video to convert. You could, if you want, just run the command, wait, run it again for the next file, etc.
But, that’s the boring approach. Instead, I wrote a script to automatically iterate through all videos in the directory (.avi in my case, but it can be changed very easily) and convert them one after another.
Here’s the script:
#! /bin/bash echo "Starting script..." for f in `ls | grep .avi`; do echo "Converting $f" ffmpeg -i $f -acodec aac -vcodec mpeg4 -s 320x180 -strict experimental output/${f:0:${#f}-3}mp4 done echo "Finished" |
Simply save that entire script in a file called convert.sh in the same directory as the videos and change the permissions to allow it to be executed by running chmod a+x convert.sh.
Then, when you’re ready to run the script just type ./convert.sh in the same directory, and wait until they’re all done.
That’s it, have fun converting all your videos!

6 comments
Skip to comment form ↓
Dragnucs
May 26, 2012 at 11:28 am (UTC 0) Link to this comment
Is the -strict option obligatory?
Joe
May 26, 2012 at 11:57 pm (UTC 0) Link to this comment
When using the
aacaudio codec, it is yes, because “encoder ‘aac’ is experimental and might produce bad results.”If you omit the option, FFmpeg will give you a little message saying this, with the following suggestion: Add ‘-strict experimental’ if you want to use it.
Gigi
May 27, 2012 at 11:12 pm (UTC 0) Link to this comment
With the latest generation ipod/iphones with their high resolution “retina” display, use -s 640×360 as the video ouput size for better resolution (assuming the source is equal if not larger).
There are (optional) presets for ipod video conversion that come with ffmpeg. Look under /usr/share/ffmpeg/ and if found, you can add -vpre=
Joe
May 28, 2012 at 10:17 am (UTC 0) Link to this comment
Thanks for the tip!
Allen Halsey
May 30, 2012 at 10:49 pm (UTC 0) Link to this comment
Thanks for the tip.
Suggestion for your script: use filename expansion put double quotes around the variable expansion:
for f in *.avi; do echo "Converting $f" ffmpeg -i "$f" -acodec aac -vcodec mpeg4 -s 320x180 -strict experimental "output/${f:0:${#f}-3}mp4" doneSee: Bash Pitfalls #1: for i in $(ls *.mp3)
Joe
May 31, 2012 at 11:07 am (UTC 0) Link to this comment
Thanks, I’ll give that a read.
Admittedly I’m not very experienced using bash, I just throw together whatever seems to work!