Find millimeter on Facebook

Related Articles

 

Encoding for the Apple iPad, Part 1

Apr 20, 2010 12:00 PM, By Jan Ozer


      Subscribe in NewsGator Online   Subscribe in Bloglines  

Table 1. Producing podcasts for iPad viewing.

Table 1. Producing podcasts for iPad viewing.

Other encoding parameters

That's the resolution; what about the rest of the encoding parameters? Well, since Apple iTunes encoded the 960x540 file specifically for the iPad, that's the best indicator of what Apple thinks are the ideal iPad encoding parameters, so let's start there. Note that I collect all encoding options in Table 1, so don't feel that you need to take notes along the way.

I should also say that all encoding tools present these parameters in a slightly different way, and some present some parameters and not others. If you're familiar with your encoding tool, you should be able to figure things out.

Figure 3. The file iTunes rendered when I clicked Advanced > Create iPad or Apple TV version.

Figure 3. The file iTunes rendered when I clicked Advanced > Create iPad or Apple TV version.

To identify the parameters used by Apple, I analyzed the iTunes-created file in MediaInfo, a free video-analysis utility, and show the money screen in Figure 3. First up is the Profile and Level, which should be the Main Profile at no higher than Level 3.1. The Advanced Video Codec is another name for the prescribed H.264; no problem there.

The next option is format settings, context-adaptive binary arithmetic coding (CABAC). It's no surprise that iTunes didn't enable CABAC entropy encoding, since it's not an option on any Apple encoding tool, but I use CABAC encoding for all my H.264 encodes that aren't bound for the iPod (which uses the Baseline profile that doesn't offer CABAC entropy encoding). During the course of my testing, I loaded CABAC encoded test files on the iPad, and they loaded and played with no problem.

In theory, CABAC delivers about 15 percent higher quality than the alternative, context-adaptive variable-length coding (CAVLC), but at these high data rates, you probably wouldn't notice the difference. If you're a conformist, go with CABAC off (or choose the CAVLC option); if you're seeking the very best quality at the selected file size, enable CABAC.

MediaInfo also shows that iTunes encoded with variable-bit-rate (VBR) encoding rather than constant-bit-rate (CBR), which makes sense for a file transferred via cable rather than via wireless. If you're encoding for iTunes or your own use, use VBR.

Next up is the video data rate of 3,627kbps, which is almost certainly higher than you need. At 960x540, I would start at 2,500kbps, which should produce very high-quality video, and only increase the data rate if quality is sub-par. Since 1024x576, which is about 14 percent larger than 960x540, I would start at 2.8Mbps.

I'll note for the record that iTunes didn't change the frame rate of my test file to 24fps; it left it at 29.97fps. For this type of encode, I would always use the native frame rate of the video.

Figure 4. A frame-rate graph from Inlet Technologies Semaphore.

Figure 4. A frame-rate graph from Inlet Technologies Semaphore.

The frame-rate graph from Inlet Technologies Semaphore shown in Figure 4 illustrates the VBR encoding discussed above. It shows lower data rates during the start of this test clip, which begins with 30 seconds of low-motion talking head footage, then higher data rates for the higher-motion content that follows. The graph also reveals that key frames, which are those red vertical lines beneath the time scale, are spaced about one every 3 seconds (or every 90 frames in this 29.97fps video). The irregular keyframes are those inserted at scene changes, a technique that improves overall quality. To enable this in your encoding tool, make sure that the "Insert keyframe at scene change" option, or "Natural" keyframe option, is checked or otherwise enabled.

Paging through the file in Semaphore revealed that Apple inserts one B frame between P and I frames, so set your B frame interval to 1, with two reference frames, a parameter revealed in both MediaInfo and Semaphore.

  Related Links

Encoding for the Apple iPad, Part 2
Last time out, I detailed how to produce videos transferred to the Apple iPad via cable, whether directly in your office or uploaded via iTunes. This time, I'll discuss how to encode files for delivering via Wi-Fi or 3G...

For audio, iTunes produced stereo audio using the Advanced Audio Codec (AAC) Low Complexity (LC) profile, with a data rate of 128kbps and a sampling rate of 44.1kHz. Most encoding tools don't let you choose between VBR and CBR for audio, but if they do, note that iTunes used CBR.

If you chose the 640x360 option, I would start at around 1.4Mbps, which should produce pristine quality. Use the Baseline profile if you want the file to run on other devices like the iPhone and iPod Touch, which takes CABAC and B-frames out of the picture because they're not supported under the Baseline profile. Otherwise, follow the recommendations in the table.

The third column shows the collective stats from the 720p files that I downloaded from iTunes for your reference. Note that I couldn't load any of the files into Semaphore, probably because they were encoded with the Apple digital-rights-management technology. Note also that MediaInfo reported that all the TV shows were produced using the High Profile, but I'm guessing that this relates to the DRM as well.

As a final thought, after producing your files, test, test, and then test again. It's a new platform for all of us, and we're bound to collectively make some mistakes.

That's it for this episode; I'll be back in a couple of weeks to discuss producing for Wi-Fi and 3G delivery.

Share this article




Continue the discussion on “Crosstalk” the Millimeter Forum.


© 2014 NewBay Media, LLC.

Browse Back Issues
Back to Top