Hari's Corner
Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and theniPod video encoding guide for Linux users
Filed under:
Tutorials and HOWTOs by
Hari
Posted on Wed, May 23, 2007 at 17:54 IST (last updated: Wed, Oct 1, 2008 @ 22:15 IST)
several times as a result of which I've had to remove and recreate the music database from scratch and getting your videos to the exact format required by the video player is a real pain in the rear. All in all, I must say that I regret purchasing an iPod and would have bought any other player in the market if only I had known whether those would work under Linux or not. This is probably the last Apple product I ever purchase. It's truly a shoddy, hyped overpriced product.
Having said that, I've struggled with guides on the internet telling me how to encode videos for the iPod and most of them have not worked for me. After a lot of tweaking around I wrote a simple script using ffmpeg to get the precise format recognized by the iPod. If you have DVDs, you need to rip them first. I suggest acidrip, as it's quite a simple GUI to mencoder. However, the videos produced by mencoder will *not* work with the iPod. I have tried with several options, but it won't work at all.
So here's how I encode DVDs to iPod format in Linux.
- Rip the DVD chapter by chapter, using acidrip. It's the most convenient way of doing it. I generally scale the video to the iPod size (320x240) at this stage since ripping becomes less time consuming. Other parameters don't matter much since you won't be using this format anyway. I also set the audio to MP3 using LAME (you need liblame for this) and bit rate to 64. You can set other parameters if you wish.
- Convert the resulting mpeg file(s) one by one to mp4 (with h264 codec) using the script (see below).
- Take a long coffee break

- Use a tool like gtkpod to transfer the mp4 file to your iPod. Hopefully it should play properly now.
ipodenc.sh) and make it executable using the command chmod +x ipodenc.sh.
The script's usage is (from the command line):#!/bin/bash #Encode iPod Video input_file=$1 output_file=$2 ffmpeg -i "${input_file}" -vcodec h264 -b 150k -bufsize 244 -maxrate 768k -s 320x240 -bf 0 -level 13 -f mp4 -acodec aac -ar 48000 -ab 64 "${output_file}"
./ipodenc.sh inputfile.mpg outputfile.m4v
You can alter some of those ffmpeg settings if you want to. I deliberately kept the bit rate low because the encoder will always choose higher bit rates. But you need the -bf 0 and the -level 13 parameters if you want the video to play (with the h264 format). I found this obscure bit of information on a mailing list archive. Earlier, when I encoded with h264 without those flags, it refused to play on the iPod.
This is more like a reminder to myself, but I hope you find this useful anyway.
Comments closed
The blog owner has closed further commenting on this entry.
4 comment(s)
Comment by Dominic (visitor) on Wed, May 23, 2007 @ 19:11 IST #
Comment by hari (blog owner) on Wed, May 23, 2007 @ 19:32 IST #
Comment by RT Cunningham (visitor) on Wed, May 23, 2007 @ 21:53 IST #
Comment by hari (blog owner) on Thu, May 24, 2007 @ 11:16 IST #