How To Convert Video For The iPhone
So a few months ago, I finally broke down and purchased the new 3G iPhone to replace my decrepit Verizon mobile, whose most advanced feature was a speaker phone. It was quite the upgrade and a feature I enjoyed immediately was the multimedia capability offered through the built-in iPod, particularly video. Whereas before I spent hours upon hours staring at the seat in front of me on plane flights and bus rides for work, now I could enhance poor posture by tipping my head downward to watch movies.
ffmpegX: Automagically Convert
But how to get my movies onto the iPhone without buying them all over again from the iTunes store? The first tool at my disposal is ffmpegX, a frontend application for the freeware ffmpeg video converter.1,2 The interface can be as simple as dragging your video file onto the window, choosing the iPhone preset and clicking on the “Encode” button.
ffmpegX: Manual Configuration
While that operation works most of the time, there are unfortunately bugs in the system, most likely because an update to ffmpegX hasn’t been released in a year. I found that my files with audio tracks encoded in AC3 were not being converted properly resulting in wonderfully silent video on the iPhone. AC3 is an audio codec for Dolby Digital allowing up to six channels to be multiplexed into the audio stream.3 This hurdle is easy enough to overcome by manually setting the configuration.
Again as before, dragging and dropping the file to be converted onto the interface prepared it for processing. After this, click on the “Video” tab and adjust the video codec to be MPEG4 [.MOV] (ffmpegx)
. The iPhone supports video up to 640×480 resolution so ensure the output video size is set accordingly.4 To avoid performing resolution and aspect ratio calculations yourself, simply cheat by selecting the iPhone preset on the “Summary” tab first so that it will calculate the appropriate video resolution.
Click on the “Audio” tab to adjust the settings for audio encoding. The iPhone supports a variety of audio compression schemes but the two best choices are either AAC (MOV/MP4/3GP)
or .MP3
. Regardless of which codec you select, setting the parameters to 128kbit/s, 48000Hz, Stereo and VBR will result in good sound quality for your portable movie.
With the audio and video selections made, the tool is ready to encode. However, to give the video a little better quality, click on the “Options” tab. There are a number of different options to choose from that affect everything from how the compression scheme treats motion, usage of key frames to the number of passes. Some of these options will result in a file unplayable by the iPhone. Choosing High Quality
and Two-pass encoding
are safe choices that reduces video artifacts and help make a smaller file. Now simply click “Encode” and then upload the finished file to your iPhone.
HandBrake: The Really Easy Way
An even easier tool at your disposal is HandBrake.5 At this time, the most recent version is 0.9.3 which recently added the ability to convert from any video source. Previous versions would only compress direct from DVD. HandBrake is based upon the FFmpeg engine as well. Unfortunately, I have not yet upgraded to OSX 10.5 and can only demonstrate the older version 0.9.1.
The process is ridiculously simple. With the HandBrake application open, insert a DVD. It will prompt you for a source whereupon you select the DVD itself and click “Open”. While HandBrake scans the DVD, simply select the iPhone / iPod Touch
preset from the side menu. No other configurations are necessary. Click the “Start” icon at the top and iPhone compression begins.
Summary
There are a number of resources available for converting video into a format recognizable by the Apple iPhone. While some tools like HandBrake offer a near dummy proof interface, other tools give you significantly more power over the video itself. Having the knowledge to use back-end video tools like FFmpeg can be useful for non-iPhone video compression, conversion, cutting and splicing. Regardless, enjoy the portability the iPhone offers for taking your movie collection with you.
End Notes
1"ffmpegX a DVD, SVCD, VCD, CVD, VOB, DivX, XviD, H.264, PSP, iPod, MP4, MOV, FLV encoder for Mac OSX", ffmpegX homepage, accessed January 2009 from http://www.ffmpegx.com/
2"FFmpeg", FFmpeg homepage, accessed January 2009 from http://ffmpeg.mplayerhq.hu/
3"Dolby Digital", Wikipedia, accessed January 2009 from http://en.wikipedia.org/wiki/Dolby_DigitalDigital
4"iPhone Technical Specifications", Apple, accessed January 2009 from http://www.apple.com/iphone/specs.html
5"HandBrake", HandBrake homepage, accessed January 2009 from http://handbrake.fr/