Sunday, March 29, 2009

Convert Videos for your iPhone

Despite the fact that I have been dead for 84 years, like many of you I have an iPhone. Frequently I run into the same issue: I want to put the latest movie I’ve legally downloaded onto my iPhone, yet I am unable to. Here are the steps you, my loyal readers, need to follow in order to watch free movies on your iPhone.

First off, I’m not going to tell you how to find free movies. uTorrent and The Pirate Bay can help with that. For this how-to, I am mainly interested in 2 things.

Item #1) How to convert a video file to work on your iPhone / iPod Touch
Item #2) How to convert a DVD to work on your iPhone / iPod Touch

The iPhone and iPod Touch are luckily very friendly about the video files they will support. Both standard MP4 files, as well as those encoded with h.264 are supported. If you’re looking for quick encoding times, MP4 is hard to beat, as it is possible to encode much faster than real time on even a Pentium 4. H.264 requires a little bit more power, but yields quite a bit higher video quality for the same size of file. Choosing a video codec is practically like reading a Choose Your Own Adventure book. Most of the tools I’ll discuss below will have a built in preset for iPhone and the iPod Touch. In the event that they don’t, you should always use the following settings:

MP4/h.264 video codecs
16:9 aspect ratio
720 kbps bit rate
Make sure your file is in an MP4 container. The process
for doing this is different on each program. Check the help file.

There are a few ways one can go about converting video files. For Windows, I recommend using Super (http://www.erightsoft.com/SUPER.html) . It is a freeware front end for a variety of open source encoding tools such as FFMPEG, Meconder, and a number of libraries that each of those use. It has a built in profile just for use with iPhone, and I have used it to great success so far.

To convert a video file to iPhone or iPod Touch on Mac OS X, there are a few different options. If you have Quicktime Pro (the program Serial Box might have a little to add about getting a copy of Quicktime Pro for free). If you select Export, then select the appropriate setting for iPhone, you’re in good shape. imTOO offers a video encoder for Mac as well. If you prefer a free method of doing your encoding, check out FFMPEG (http://ffmpeg.org/). It is a free, open source video encoder/decoder, but it is command line only. One would be advised to find a GUI front end for it, thought such GUIs are somewhat lacking on the Mac. I’ve also included some command line switches that one can execute from terminal.app.

For Linux, there are a huge variety of tools with varying degrees of functionality. The same advice applies for converting video files on the Mac as does on Linux: it would probably be good idea to find a front end for FFMPEG (http://ffmpeg.org/). If all else fails, one can install FFMPEG and use it from the command line. I’ve included some good command line options below for those that would rather copy and paste:

ffmpeg -i inputfile.avi -r 25 -vcodec libxvid -s 480x270 -aspect 16:9 -maxrate 768k -b 512k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 44100 -ab 96k -ac 2 -pass 1 -passlogfile pass1.log outputfile.mp4

followed by

ffmpeg -i inputfile.avi -r 25 -vcodec libxvid -s 480x320 -aspect 16:9 -maxrate 768k -b 512k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 44100 -ab 96k -ac 2 -pass 2 -passlogfile pass1.log outputfile.mp4

where inputfile.avi is the name of the video you are converting. Either be sure to launch this from the folder in which your video is contained, or include a full path to the video you’re planning on converting. This process provides a video file that been encoded at 480x320 resolution (plenty for iPhone), done in 2 passes (takes a little more time but the video file looks a lot better) done with the Xvid codec, a standard derivative of the MP4 video codec.

Luckily for converting DVDs, one tool has come to rule them all for Windows, Linux, and Mac OS X: HandBrake. HandBrake integrates FFMPEG and some other tools into a neat package that is easy for the end user who doesn’t want a lot of control, but offers a wide variety of advanced options for power users. If you are dealing with a commercial DVD as opposed to one that was copied, you’ll have to circumvent copy protection in order to create a video file. On OS X, Handbrake will take care of this for you. On Linux, look for a tool called decss2. In Ubuntu/Debian it may be installed through the Synaptic package manager, or it can be installed with Yum on RPM based distributions. Make sure that you find out the right package name for your distro, as it likely isn’t just called decss2.

On Windows, in order to read copy protected DVD movies, the best tool available is AnyDVD. Once again, uTorrent/The Pirate Bay can lend a helping hand. AnyDVD simply takes any DVD movie with copy protection and makes it appear as if there isn’t any. Run this in conjunction with HandBrake to be able to rip movies.

Until next time.

0 comments:

Post a Comment