iPod Touch Movies?

I got myself one of those “retina display” (960×640) 5th gen iPod Touch for the New Year. First impressions are that it’s rather well integrated, responsive, and has a number of fun applications. It’s even usable as an X/SSH thin client with a 10$ App.

With Permissions of Emily Carroll

But then you try to see how far you can push the use of the device with Linux (my primary operating system) and find that the support is dismal. The support is already not that impressive with Apple‘s iTunes running on Mac OS X. iTunes is really slow even when running native (i.e., without virtualization) and also does some very stupid things such as preventing you from copying a PDF you downloaded from the web back on the computer even though it has no DRMs—a behavior defective by design. Another limitation is in the iPod itself: the video formats supported are very limited.

I have a couple of matroska-based H.264 movies I wanted to transfer on the iPod. Even if the audio is AAC and the video baseline H.264, it is the container itself that causes problems. So you need to re-wrap it in MPEG-4 transport file, a .mp4. If you have FFmpeg installed on your box, trans-boxing the file is easy as cake:

#!/bin/bash

#depends on ffmpeg

input="$1"
output=$(basename "$input")
output=${output%%.*}

ffmpeg -i "$input" \
    -vcodec copy \
    -acodec copy \
    "$output".mp4

This script only copies both video and audio streams from a Matroska transport to a MPEG-4 transport. The file will play well on iPod (provided the H.264 profile is not too high).

The problem is that FFmpeg doesn’t know about subtitles—it can otherwise produce MPEG-4 files just fine. If your movie didn’t have any or if you didn’t care, you’re done. You can copy your new MPEG-4 file to your iPod.

Now, if you do have subtitles, the procedure gets complicated. The MEncoder command line suite knows about subtitles, but isn’t very smart about MPEG-4 transport (it fact, it doesn’t know how to create MPEG-4 files), so we’ll have to combine both FFMpeg and MEncoder to produce a MPEG-4 / AVC file with subtitles burned in. Burning in the subtitles seems like a bad idea but given that the iPod doesn’t seems to support subtitles anyway, it’s a possible solution.

First, we must extract the subtitle track information. Using mkvtoolnix (also in Ubuntu’s main repositories) we can write:

# extract subs
subtrack=$( mkvinfo -s "$input" \
            | grep -m 1 -i subtitles \
            | cut -d: -f 1 \
            | cut -d\  -f 2  )

which will yield the first subtitle track. We then proceed to its extraction:

mkvextract tracks "$input" $subtrack:"$output".srt

The command

mencoder \
    "$input" \
    -sub "$output".srt \
    -oac faac \
    -ovc x264 \
    -x264encopts profile=baseline:threads=auto:keyint=30:bitrate=$bitrate \
    -o "$output".avi \

will create a H.264 video with faac audio, but in a AVI transport file (to activate faac support in MEncoder, read this tutorial). Would have MEncoder been able to produce directly MPEG-4 files, we’d be done. Alas, we have to repackage the file as shown above (or using AVIDemux, as we will discuss in a moment) before sending it to the iPod.

Even with gstreamer and its newly added pipeline element ffmux_ipod, you can’t easily deal with subtitles. (On the otherhand, changing transport format seems to be working just fine.)

So, basically, unless your original file is already in iPod-friendly MPEG-4, you’re in for quite a ride. If any of my readers have suggestions on how to stream-line this process, he should let me know. For now, I think that either you have to install lots of third-party stuff that is not in the repositories and you still have to do a lot of configuration just to get something “simple” as AAC working. There must be a better way, but after two days of googling and talking to people on #ffmpeg and #mplayer on Freenode, chances are that there’s no real easy solutions besides commercial software (and then again, we’d have to try them to see if they do work as advertised).

*
* *

There a number of tools, like AVIDemux that will help you with some of the files. AVIDemux doesn’t seems very good at dealing with H.264 with B-Frames (which are found in profiles above baseline and helps to get more compression) and doesn’t know about subtitles, but otherwise it works properly and without that much of fuss either. But the fact is, the basic support for iPod (and similar devices) is not anywhere close to mature on Linux—it is still somewhat crude with the official Apple software!

*
* *

Of course, not being able to download any type of video to your iPod is a minor inconvenience. You don’t want to watch movies for any extended length of time on this tiny screen, despite its astonishing image quality.

There are plenty of Apps in the Apps store (some free, most at 1$, and most of the rest at less than 10$ … just like in the good ol’ times of shareware, except without much of the sharing) and some are really smart. I found iSSH quite useful as supporting both terminal emulation and X11. It’s not going to make my iPod a workstation, but I can keep an eye on my Linux machines.

Game-wise, I really like both Angry Birds and Cut the Rope. I also was recommanded the canadian game Trainyard, another puzzle-solving game (I played a few days and now I’m doing the last bonus puzzles!). These games ask for the player’s intelligence, have a playful rendering—the spiders in Cut the Rope are just too cute!—and are very addictive.

Angry Birds Peace Treaty … kind of.

*
* *

The Questing Beast appears with permission of Emily Carroll, of which I like the art very much. You can see more on her blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: