OK I need to start with – This article has had a few revisions since it was first published. I have had several useful conversations with people on Twitter & via email on the accuracy of this article and have made several adjustments in order to get it right. This article is definitely written with a Mac user in mind and I apologise to our PC/Linux friends for this, I just don’t have enough experience on those platforms but feel free to write your own article or email me and I will include other work flows into this article.
I don’t normally like to blog about technical stuff but on this occasion I felt I needed to record some of my findings, where I could get at them quickly and easily in the future. It might be useful to you also?! I recently bought an iPad and wanted to encode some of my own videos to the platform. Dragging a stack of material from iTunes onto my iPad, I realised I got several warnings from iTunes about video files it couldn’t upload to the iPad because they could not be played by the device! Frustrated I had a look at the files that wouldn’t play and surprisingly some had the same file sizes, frame size and encoding type as files that could be played on the iPad?! So I started to investigate further. This is what I found.
The iPad reports to support video formats up to 720P which in layman’s terms means 1280 x 720 pixels in dimension using a frame rate that is Progressive. However I wasn’t able to successfully get video encoded to this size to play properly on the iPad. The actual frame size of the iPad is 1024 x 768 and while 720P content is supported, the iPad has to down scale the video to 1024×576 to present it to the screen. So what’s going on? Frustrated, I used iTunes to convert a video to an AppleTV profile, which I then openned in QuickTime and “got info on” (press Command I). I discovered that iTunes uses a default setting of 960 x 540 pixels and not 1280 x 720! Now I was even more confused?! Jumping on the net, I found a large number of similarly confused people discussing the right size and data rate for best quality video on the iPad. However a link to an Apple Tech Note is very useful and can be found here. Basically it’s more concerned with streaming video to the iPad, iPod & iPhone and not playing back of files from disc as I am. However I used this as a guide to Encode my video using Mpeg Streamclip by Squared 5. You could use other Encoders such as Apples Compressor and simply translate my settings here.
Below is a Video of my family having some fun at a Go Kart track.
The video is action packed and shot with a Canon 5DMKII and a Go Pro HD Hero in 16×9 aspect ratio. Because the Go Pro has some fairly significant rolling shutter issues, I thought this video might be quite challenging for any encoder to get right and might reveal nasty jagged edges and other encoding artefacts in an obvious way. So firstly, I exported my 1920 x 1080 25FPS video from Final Cut Pro as a Vimeo friendly 1280 x 720 H.264 movie. I tried that in iTunes and it failed to upload to the iPad. So I then took this same video and threw it into Mpreg Streamclip and played with the settings as follows. All were encode using the H.264 format with the audio set to AAC 256kbps.
1) Firstly below is the version created by iTunes that works no problems on the iPad. If you click on this file it will probably download it to your computer as it is a .m4v file. It’s video size is 960 x 540 and used the H.264 encoder with a bit rate of around 5 MBS. The total file size is 56.5MB
2) In Mpeg Streamclip I simply wanted to recreate the same settings so I could create a Preset for it, and that was totally successful. However reading the Apple Tech note indicated that this size may not be the ultimate setting for the video if a lower files size was needed. What’s probably more important then frame size is the data rate considerations. So I began to encode the same video, using many different data rate amounts. Below is a video encoded at 960 x 540 with a cap at 4MB/sec
3) This video below is encoded to 1024 x 576 which is the resolution that the iPad uses to display your video on it’s screen. My thinking here is if the iPad doesn’t need to “on the fly down scale your video” then surely this would play better and look nicer. It plays well and looks great but the file size remained quite large at a hefty 73MB. Admittedly the data rate is capped quite high as well being set at about 6MB/sec but I was trying to get very good quality video. At 5MB/sec this video is about 56.7MB and still looks fantastic.
4) From the Apple Tech notes again, I learned that the iPad has very good upscaling abilities. So I tried to encode the same video at 640 x 360, again using the H.264 encoder, stereo AAC Audio compression set at 256kbps. Here I tried with a capped data rate of around 4MB/sec. This video uploaded to the iPad no Problem and plays very nicely. In fact, I was quite surprised that although the video is much smaller in size the iPad rendered it to the screen in a perfectly acceptable manner. If you look closely you may be able to spot some aliasing and compression artefacts but overall it looked great. The file is 47.9MB!
5) Dropping the data rate even more but keeping the same size settings (640 x 360, again using the H.264 encoder, stereo AAC Audio compression set at 256kbps) again I was surprised that it looked great on the iPad. The data rate on this video is set to cap at around 2MB/sec and has a file size of 25.7MB! Yes if you compare this video with the version set at 4MB/sec, there is some degradation but it’s not horrendous. Certainly if you need to keep file sizes down, I think this setting is quite acceptable.
I should quickly say that viewing these samples on a Computer Monitor will lead you to different opinions on acceptability. For my purposes I was more interested in comparing these settings on the iPad and I highly recommend that you do the same. Because the iPad does some magic during the upscaling, the final out come of how your video looks is different to that of a computer display. So for my recommendations on compression settings, I would suggest you need to keep in mind what devices need to see your video. For best possible display quality on both a Computer and the iPad then these are my suggested settings (although this is way higher then the iPad really needs):
The above compression settings will not play on most other devices. Lowering the data rate, like the example below, might be better for longer video programs and will allow other devices to play this video:
However, for iPhone’s and iPod’s as well as other manufacturers devices, the following profile might be better, while still playing on the iPad. So my ultimate suggestion for compression settings that works on a range of devices including iPad, iPod, iPhone and as a small file for download to a Computer, try this:
Importantly the video needs to be set to a data rate no greater then 1500kbps or 1.5MB/sec to be safe. Apple supports H.264 data rates of up to 2.5MB/sec and this probably explains why my iPhone was able to play a file at 640×360 2MB/sec no problem while on the iPod, a file of 640×360 4MB/Sec played perfectly also!? The important part about iPod and iPhone is keep them with a size of 640 x 360 for 16×9 content and 640 x 480 for a 4×3 aspect and a reasonably low data rate of around 1500kbps if you are using the Baseline encoding profile. Using a different encoding profile like MP4 or H.264 the iPod and iPhone support a data rate of up to 2.5MB/sec.
Hope this helps. Please don’t hesitate to comment if you feel I have made an error. Cheers!