Wednesday, April 11, 2012

HTTP pseudo streaming vs. HTTP adaptive streaming

HTTP pseudo streaming

Both MP4 and FLV videos can be played back with a mechanism called HTTP pseudo streaming. This mechanism allows your viewers to seek (aka "trick play") to not-yet downloaded parts of a video by referencing timescale in the file header. YouTube is an example site that offers this functionality.

HTTP pseudo streaming combines the advantages of straight HTTP "progressive download" (it passes any firewall, viewers on bad connections can simply wait for the download) with the ability to seek to non-downloaded parts. The drawbacks compared to RTSP/RTMP are its reduced security (HTTP is easier to sniff than RTMP) and long loading times when seeking in large videos (durations over 15 minutes).

HTTP adaptive streaming

HTTP pseudo streaming should not be confused with HTTP adaptive streaming. Pioneered by Apple for iOS, it uses master index files (.m3u8) and the segmented mpeg-4 files (.ts). Apple recommended 10-second segments at 30fps (300 frames each), per Apple Technical Note TN2224.
https://developer.apple.com/library/ios/#technotes/tn2010/tn2224.html 
With HTTP adaptive streaming, 5 different bitrates will output 30 segment (.ts) files per minute of video, so a 10-minute video will be 300 files. Because of this, you will probably want to encode each video to a separate destination directory to keep your server organized.