Posts Tagged ‘AppleTV’

iPhone and iPod Touch compatible video encoding, server side.

Sunday, October 12th, 2008

Some days ago, I published a tutorial with some bash scripts to automate the whole process of encoding MP4 files with H264 video and HE-AAC audio which are playable by flash players and the like.

Since I’m working on a really big project which involves a “youtube like” behavior, i though it would be cool to also create iPhone / iPod compatible streams (I’m amazed at the fact that 3% of the people coming to this site is using iPod’s or iPhone’s)… so, I did some modifications to the original script for it to generate the compatible streams.

Now, how am i dealing with this… well… let me explain you:

The iPhone specification states:

Video formats supported: H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats

This means that the high profile streams that I am generating with the MKMP4 script won’t play, simple as that. So i have 2 possible approachs:

  1. I could just use a single low profile stream for the iPhone and iPod, and since the stream is H264 and low complexity AAC audio, it will just play fine on the flash players too.
  2. I could have 2 different files, one for the flash players (making use of b-frames, entropy coding, and a high profile stream, which substantially improves the final video quality).

I decided to use the option 2, mostly because i want to give desktop users as much quality as possible, and i want to use the HE-AAC encoder to save some extra bandwidth that i can instead use for the video stream, so I am using 2 different files, one for desktop users, and a different one for iPhone or iPod users.

(more…)