Linux tip, Fedora tip / howto: using a video iPod

 
back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

using a video iPod

These initially were instructions for a 5th generation 30GB video iPod and Fedora Core 4. The later ffmpeg commands also apply to a 2nd generation iPod Touch and Fedora 8. See below for compiling gtkpod with MP4 support and automatic mounting.

Converting AVI files to iPod MP4

Install ffmpeg:
yum install ffmpeg
and use:
ffmpeg -vcodec xvid -b 1000 -qmax 10 -bufsize 8192 -g 300 -acodec aac -ab 128 -ac 2 -i <AVI inputfile> -s 624x352 -aspect 16:9 <MP4 output file>

Note: apparently with the newer version of ffmpeg (0.5) you need to specify kb after the bitrates and buffer sizes: ffmpeg -vcodec xvid -b 1000kb -qmax 10 -bufsize 8192kb -g 300 -acodec aac -ab 128kb -ac 2 -i <AVI inputfile> -s 624x352 -aspect 16:9 <MP4 output file>

Note that ffmpeg needs to have been compiled with AAC support (yum install faac-devel, ./configure --enable-libfaac).

For ffmpeg version 0.4.9 I got this to work (this input file had mp3 audio):
ffmpeg -vcodec mpeg4 -acodec mp3 -i my_input_file.avi -maxrate 1000k -b 700kb -bufsize 8192kb -qmin 3 -qmax 5 -s 624x352 -aspect 16:9 -acodec libfaac -ab 128kb my_output_file.mp4
(this also made the annoying "mpeg4 rc buffer underflow" errors disappear)

A commandline that worked for my iPod Touch:
ffmpeg -y -i my_input_file.avi -b 768000 -s 480x320 -vcodec libxvid -ab 128000 -acodec libfaac -ac 2 -f mp4 my_output_file.mp4

Compiling gtkpod with MP4 support

This is a bit of a hassle, but in the end it gets you a gtkpod that can transfer video files (the ones you create with the above ffmpeg command) to your iPod :-)

Run all steps as root.

  • install the ffmpeg development packages (this will install quite a few related packages):
    yum install ffmpeg-devel
  • download the mpeg4ip source (the version I got was 1.5.0.1)
  • decompress (tar zxvf etc.), and configure using (!):
    ./bootstrap
    install with make, make install
  • download libgpod and gtkpod. If you are using Fedora Core 4 like me, get libgpod version 0.5.2 and gtkpod version 0.99.8 (i.e. not the latest versions). If you are on a more recent Fedora version, it's probably best to try the latest versions first
  • decompress, compile, and install libgpod
  • decompress gtkpod
  • you may have to do:
    setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig first (if you're using bash, it's
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig)
  • the file src/display_spl.c gave me compilation errors, I "fixed" these by using the same file from the 0.99.10 version (!)
  • the compilation errors in src/file.c and src/file_itunesdb.c are fixed by replacing every occurrence of unk208 with mediatype
  • make, make install...

Automatic mounting

Run all steps as root.

Follow the instructions of this tip on automatically mounting a USB key, but note these iPod specific things:

  • your iPod has to have been "Windows formatted" (FAT32 filesystem). If it isn't, you can reformat it (this clears all data on it) to FAT32 (you can do this with a Windows version of the iTunes software, and using the Restore option)
  • the /etc/fstab entry will start with /dev/ipod2 (you want to access the second partition on the iPod). For example, if you created the mount point /mnt/ipod:
    /dev/ipod2 /mnt/ipod vfat noauto,user,noatime,rw,uid=500 0 0
  • as the udevinfo command, you can use:
    udevinfo -a -p /sys/block/sde | grep serial
    (assuming your iPod got the sde device name). The serial number you want probably starts with 000A27
  • create a file /etc/udev/rules.d/ipod.rules, with: KERNEL=="sd[a-z][0-9]", SYSFS{manufacturer}=="Apple", SYSFS{serial}=="000A27..........", NAME="%k", SYMLINK="ipod%n"
    (fill in your serial number, obviously)
  • if you don't already have it, do create the file mount.dev as described in the USB key tip

Now, after you connect your iPod, the command ls /mnt/ipod should show something like this:
bootex.log Calendars Contacts iPod_Control Notes Photos
If you get nothing, check for errors in (as root):
tail /var/log/messages


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.