Filed under: Video, Features, How-tos, Tips and tricks, TUAW Tips, iPhone
Save space on your iPhone by re-encoding movies and TV shows
If you encode your own video for watching on various devices and you're looking to save every last MB on your iPhone, it could be worth your time to re-encode at least some of your larger files with more conservative settings. While I, for example, have been copying the iTunes Store's settings and encoding my DVD movies at full dimensions and about 1500 Kbps to really let H.264 shine, the truth is you don't need anywhere near that much data to watch quality video on an iPhone's display. By re-encoding your videos and perhaps keeping them in a special iPhone playlist for synching, you can bring even more of your favorite videos with you in a fraction of the space. Unfortunately, you can't re-encode videos you've purchased from the iTunes Store because of the DRM. This how-to primarily applies to video you download from the web or encode yourself from DVD movies and other sources.To keep things simple, I'll use Blade Runner as our encoding guinea pig (which runs a length of 1:56) and Handbrake for all the encoding. Following are a few sample screenshots of how far you can compress a movie, along with the settings you can use in apps like Handbrake and TUAW favorite VisualHub to try this out for yourself.
These are encoded at 100, 200 and 350 Kbps and 480 pixels wide (the width of the iPhone display in landscape layout) from the top down:

Obviously, the 350 Kbps shot has a bit more detail than the other two in this particular scene, but the 100 Kbps movie on a whole is very watchable. Now here's the kicker - the difference in file size is incredible: This movie encoded at 1500 Kbps and full resolution weighs in around 1.5GB, but using these newer settings knocks the file down to around 190 MB (for the 100 Kbps file), 300 and 400 MB, respectively. That means you could easily fit anywhere from three or four movies (at the highest quality 350 Kbps setting) to as many as six movies (at the lowest 100 Kbps setting) in the same space as the original high-quality version. That's a huge difference, and a lot more entertainment in your pocket for those long commutes and plane flights.
If you want the full list of iPhone-optimizing settings to use for encoding your videos, here's a list that I used for this test case:
- width to 480 and maintain aspect ratio
- anamorphic off
- de-interlace on (interlacing is for devices like traditional TVs; you don't need it for your computer display or devices like iPod or iPhone)
- x264 (otherwise known as h.264, the high-quality codec/video format used for iTunes Store videos)
- 2-pass encoding on (while this takes more time, it maximizes the quality of your final video file by basically giving Handbrake or your video compressor of choice two chances to get all the tricky compression math just right. This isn't necessary, but it will help you squeeze as much quality as possible into a smaller file.)

Get a WordPress.com Blog
![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 2)
Joo said 5:48PM on 8-11-2007
I sent this tip in to TUAW about 2-3 days after the iPhone was launched.
Reply
icruise said 5:55PM on 8-11-2007
I encoded a huge number of DVDs of movies and TV shows when the original iPod with video came out, so they're all 320 x 240 (or less if they're widescreen) and I used a bit rate of 250kbps and relatively low audio settings as well. That means that my half-hour TV shows take up around 60MB and a two-hour movie takes about 250-300MB. So that's less than a quarter of what something from iTunes might take up. My versions aren't nearly as good for watching full screen on a monitor or TV, but for the iPod or iPhone they look quite good. I think being able to fit 4x as much content on the device more than makes up for any minor differences in quality.
Reply
David G said 7:35PM on 8-11-2007
*I* sent this tip in to TUAW about 2-3 *seconds* after the iPhone was launched, sooo....
Reply
MacBookOwner said 6:26PM on 8-11-2007
Thanks for the settings-Handbrake and VH are great apps, but the settings are pretty confusing for novices (beyond the presets). I've been ripping to the 640x iPod settings, as an uneasy balance between AppleTV and iPhone compatibiliy...but I'm thinking now I should just get a huge external drive and rip twice-once at DVD quality (for AppleTV) and once for iPhone (for portability)
Reply
Brian said 6:53PM on 8-11-2007
This is a real sore point I have with the iTunes/iPhone/Apple TV ecosphere. I remember implicitly hearing Steve Jobs at Macworld talk about H.264 and how "you can have one file for everything from a big screen to a cell phone."
I guess that's true, but you know it's really not. Even Apple in iMovies asks you to specifically code for one of them when you export.
This gets tiring for people who want to get all their collection in a format. Dot it all for the iPod, do it all again for the AppleTV, do it all again for whatever is next.
Usually I really love the secrecy and hidden roadmap for Apple products. But this once, I'd love for Apple to say, "If you'd like to be safe with your files for a long time...do them like this."
Just my thoughts.
Reply
James said 7:43PM on 8-11-2007
Nice article. However, while your advice for deinterlacing is sound (in most cases: leave it off) your logic is completely backwards. This explanation is not quite correct either, but close enough:
The deinterlacing has to do more with the source (the video file), not so much where you end up watching it. The short story is that many video files meant for TV (DVD's, DV cam footage) would be encoded interlaced such that each frame (in a "fps" sense really contained two sub-frames, each contained half the lines of resolution for the frame (alternating lines). Since this is how standard CRT tvs worked, it made sense. However, LCD/Plasma/Progressive displays did away with this method of displaying images since they don't have refresh rates. The problem there is that when some sort of "fast" motion was going on the two corresponding interlaced sub-frames would not "combine" perfectly, making a sort of jagged shimmery effect as the non-matching horizontal lines of resolution become apparent. It becomes more confusing because most DVD player and DVD software is designed to handle the interlaced content properly (basically by faking the way an interlaced display works) so you don't really notice such things when watching on a DVD directly. However, computer video products don't do this and instead try to be as accurate as possible by combining both "sub frames" into a single frame. This creates the jagged look.
Most video files and DVDs are encoded "progressive" (aka non-interlaced) now, but occasionally you'll come across one that is stored in the interlaced style. These files are apparent because you'll get the weird horizontal bar effect during rapid motion if you watch them on any progressive display. For such files, the deinterlace option in your video encoder will largely fix the problem, but you'll usually sacrifice overall image quality (since the deinterlacer is interpolating between two not-quite-the-same images to come up with a single non-interlaced image) and you'll have somewhat more "jerky" motion (since the deinterlacer is essentially removing a sub-frame of information).
The best way to find out if you may need to deinterlace or not is to click on the Picture Settings button in Handbrake and click "next" to cycle through some sample frames (especially any involving fast motion). If you see any that have the horizontal bar effect, you have an interlaced source which you may want to deinterlace. If they all look solid you have a progressive source and you don't need to deinterlace (it won't do anything).
Reply
James said 7:48PM on 8-11-2007
EDIT: I just realize your advice is to leave deinterlacing on: you probably shouldn't do that. *Most* DVDs and other video sources are not stored in an interlaced fashion, so you do NOT want to leave deinterlacing on. I'm not sure if the program still combines frames if you try to deinterlace a progressive source. So at best deinterlacing won't hurt your progressive files but at worst you are decreasing the video file quality and introducing motion artifacts unnecessarily. Secondly, sometimes the result of the deinterlacing looks worse than the interlacing artifacts themselves.
As a rule: Do not turn deinterlacing on unless you need to! (see my post above)
Reply
David Chartier said 8:55PM on 8-11-2007
FWIW, I just updated the screenshot used in this post and added some Kbps numbers and file sizes to help convey what's going on here.
#6/7: I kicked around whether to address this concept, but in my testing between both interlaced and non-interlaced DVDs, simply leaving the deinterlace option on all the time didn't seem to have any kind of notable affect on file size, nor did it seem to affect image or motion quality. I don't know if this means Handbrake is doing something smart on the backend or if I might be right and the option really has no negative effect, but I ultimately didn't feel the need to wander down this road for the typical user for whom I was writing this.
Reply
Steve said 9:32PM on 8-11-2007
Just a tad confused here...
Downloaded the lastest version of Handbrake
Adjusted settings according to article.
First movie i ripped is "300"
Handbrake spits out a .mp4 file. Plays back great in Quicktime.
I "add to library" in iTunes (oops, it's got to make another copy to put in the library?)
Attempt to sync with iPhone and get the error that this video can't be played on the iPhone.
Tried changing the extension to .m4v and still no go.
Do I now need to use Quicktime Pro "Movie to iPhone" export to get this recognizable to the iPhone?
I'm sure most would appreciate more thorough instructions thru completion of syncing up to iPhone.
Thanks!
Reply
Steve said 10:34PM on 8-11-2007
Just a tad confused here...
Downloaded the lastest version of Handbrake
Adjusted settings according to article.
First movie i ripped is "300"
Handbrake spits out a .mp4 file. Plays back great in Quicktime.
I "add to library" in iTunes (oops, it's got to make another copy to put in the library?)
Attempt to sync with iPhone and get the error that this video can't be played on the iPhone.
Tried changing the extension to .m4v and still no go.
Do I now need to use Quicktime Pro "Movie to iPhone" export to get this recognizable to the iPhone?
I'm sure most would appreciate more thorough instructions thru completion of syncing up to iPhone.
Thanks!
Reply
johnh said 10:48PM on 8-11-2007
#9 Steve - iTunes has the ability to convert video between AppleTV and iPod/iPhone (at least iTunes for Mac does). Just select the video in iTunes and look under the Advanced menu for "Convert Selection for iPod" if it's encoded for AppletTV and you want to move it to iPhone. It will create a version optimized for iPhone/iPod (usually takes a while depending on file size).
Good Luck.
Reply
Galley said 12:43PM on 8-12-2007
If only portable devices supported 720P playback.
Reply
David Chartier said 11:57AM on 8-12-2007
#10: Steve, there are two things I can think of that might prevent your iPhone from being able to accept the file you created:
1) Did you specify H264 encoding for the file format, or is it left on the ffmpeg/xvid setting? Be sure to specify H264.
2) Did you readjust the dimensions of your movie at all? From what I remember, the iPhone (and iPod) will accept video that is up to 640 pixels wide, otherwise it simply won't play. That's one of the tips of this article: while the iPhone can play videos that are larger than its display, you really don't need all that data, so it's best to specify 480 pixels wide (and maintain aspect ratio so the dimensions don't get out of wack) if you want to optimize both viewing quality and file size for the iPhone.
Reply
Harbinger said 12:26PM on 8-12-2007
Handbrake, select the iPod preset, click on 2-Pass in the main window, save this as a preset.
This file will look great on the iPhone, will look good on an HD-TV played directly from a mini, or will look awesome played on an Xbox 360 streaming the file from the Mac using Connect 360. I don't understand wasting space keeping a second version of video media, sure you save space in the short term on the iPhone, with files you'll just throw away in a year, but if you're watching THAT much video you're probably near a wi-fi source where you could access all your media by serving it up via the web. Portability is the key here, Jobs addressed this briefly, you don't have to wait for the Apple solution to do this now.
Reply
pd_THOR said 12:44PM on 8-12-2007
Okay, so Handbrake for encoding video from a DVD. I've downloaded it, but have not used it as I have no DVDs I wish to rip just yet.
But what program is recommended for the Windows XP user who just wants to convert his already-existing video files into an iPhone-optimal-format?
A program I was using for my Palm T|X (Pocket DVD Wizard) does a passable job when I select "iPod" settings (the "iPhone" setting, while actually being higher-quality, automatically distorts the video into the iPhone aspect ratio--foul!), but it's not great and there are no settings to tweak. Rather a binary selection: use it as is, or don't at all.
Reply
Chris said 12:59PM on 8-12-2007
"x264 (otherwise known as h.264"
No - x264 is a free software library. h.264 is a codec.
Reply
MacBookOwner said 2:04PM on 8-12-2007
David,
I have used both the h.264 setting and the standard mp4/ffmpeg settings on HandBrake, (and converted without the h.264 setting in Visual Hub, and both load fine onto the iPhone. I think, as you noted, the real limiting factor is that HandBrake, for example, will default to the DVD resolution (over 640), which the iPhone can't read.
I'm still not convinced about the h.264 setting for the iPhone; I realize its the latest and greatest, but the encoding takes 4 to 6 TIMES the time it takes without (i.e. 30 minutes vs. 3 hours on a C2Duo)that setting. I'd be interested to know what the real benefit is for such a small screen.
Reply
Tom said 8:26PM on 8-12-2007
I've been using QT Pro's Export to iPhone option on my existing movie collection. This seems to work OK, other than the obvious second-file annoyance, but while watching these movies on the iPhone after a while the video and audio get out of sync. Anyone else experience this and/or have a solution?
Reply
JeffDM said 2:15PM on 8-13-2007
James, most theatrical movies on DVD are encoded progressive scan, but many other types of DVDs are not.
A lot of TV shows are simply encoded as 480i because that's what was recorded in the original production, or if it was edited in 480i video. TV shows that were filmed and edited in film, or recorded for HDTV in mind, are very likely to be coded as progressive.
Reply
BellBoy said 3:11PM on 8-13-2007
@ #12:
I have personally ripped files at 720 px wide (in my vain attempt to rip ONCE, play many) using Handbrake and they've played wonderfully on my iPhone.
Reply