Changes between Initial Version and Version 1 of Smooth-Streaming-Technical-Notes

06/15/09 14:42:40 (13 years ago)



  • Smooth-Streaming-Technical-Notes

    v1 v1  
     1= Smooth Streaming Technical Notes =
     3[wiki:Smooth-Streaming-H264 back][[PageOutline]]
     7== Smooth Streaming H264 Content ==
     9== How to smooth stream a single bit rate H264 MP4 file? ==
     11We start with the simplest case by not having to encode anything again, we just use our existing encoded H264 videos and want to play them back using Smooth Streaming in the Open Video Player. This way you will get the goodness of Smooth Streaming: fast start, fast seeking and bandwidth throttling. As we only have one bit rate encoded video you will obviously not yet get dynamic bit rate switching.
     13=== Generating the manifest file ===
     15The manifest file holds all the information about the video file, its duration, the streams, the codec info, and a list of all the available chunks.
     17Let's start with an example manifest file for one H264 encoded video file:
     21<?xml version="1.0" encoding="utf-8"?>
     22<SmoothStreamingMedia MajorVersion="1" MinorVersion="0" Duration="1391998333">
     23  <StreamIndex Type="video" Subtype="H264" Chunks="47" Url="Fragments(video={start time})">
     24    <QualityLevel Bitrate="1450000" FourCC="H264" Width="640" Height="480" CodecPrivateData="0142400DFFE1000A6742001E96560501E88001000468CA8E20" />
     25    <c n="0" d="30000000" />
     26    <c n="1" d="30000000" />
     27    <c n="2" d="30000000" />
     28    <c n="3" d="30000000" />
     29    <c n="4" d="30000000" />
     30    <c n="5" d="30000000" />
     31    <c n="6" d="30000000" />
     32    <c n="7" d="30000000" />
     33    <c n="." d="30000000" />
     34    <c n="44" d="30000000" />
     35    <c n="45" d="30000000" />
     36    <c n="46" d="11666666" />
     37  </StreamIndex>
     41The time scale that Smooth Streaming uses is 10 * 1000 * 1000 ticks per seconds. So the given duration (1391998333) is 139.1998333 seconds, or about 2:19. The Subtype and FourCC are 'WVC1' for 'VC-1' encoded video and 'H264' for 'AVC' (H264) encoded video.
     43The Url in the !StreamIndex is concatenated with the Play URL (minus the manifest file) to create the HTTP requests for the individual fragments.
     45The !CodecPrivateData is a direct copy from the 'avc1' atom in the track's Sample Description. Just convert it from binary to printable hex.
     47A list of chunks follow each with a length of 3 seconds (except for the last chunk).
     49=== Determining the start and duration of a chunk ===
     51The chunks themselves are always self-contained and must not reference any frames from previous chunks. Therefore they must always start with a keyframe/IDR-frame and be encoded with a Closed GOP setting. A Closed GOP setting means that frames from the current GOP cannot reference I frames (full frames) from the previous GOP.
     53The sync samples table of the MP4 movie is used to calculate the start and durations of a chunk.
     55=== Generating a fragmented MP4 movie (moof) ===
     57Smooth Streaming uses the Fragmented MP4 file format for its chunks. Although the chunks are decodeable by themselves when you feed them (nearly) directly into a codec, they do not have the required 'moov' atom. Pretty much all video players won't be able to play these chunks by themselves.
     59=== Generating the chunks on the fly ===
     61Now here comes the tricky part which took me a long time to figure out. The data that Smooth Streaming expects is in Annex B (start codes 0x000001) format. Luckily this is an easy conversion, so we can do that on-the-fly.
     63Another thing to remember is that all the chunks need to start with a SPS (Sequence Parameter Set) and PPS (Picture Parameter Set) unit. These are duplicated from the !CodecPrivateData field.
     65The trac run atom holds the duration and size for each sample/frame. Again we convert the duration to 100 nano-second units.
     67== References ==
     69  - [ Smooth Streaming Architecture].
     70  - [ Silverlight 3 Beta - What's New for Media]
     71  - [ Smooth Streaming and *.ismv fragmented MPEG-4]
     75== Next ==
     77  - [wiki:Smooth-Streaming-Encoding Encoding Smooth Streaming videos].
     78  - [wiki:Smooth-Streaming-Playing Playing Smooth Streaming videos].
     79  - [wiki:Mod-Smooth-Streaming-Apache-Version1 Smooth Streaming module for Apache].
     80  - [wiki:Mod-Smooth-Streaming-IIS5-Version1 Smooth Streaming module for IIS].
     81  - [wiki:Mod-Smooth-Streaming-Lighttpd-Version1 Smooth Streaming module for Lighttpd].
     82  - [wiki:Mod-Smooth-Streaming-Nginx-Version1 Smooth Streaming module for Nginx].
     83  - [wiki:Smooth-Streaming-H264 Smooth Streaming Technical Note].
     85== Feedback ==
     87If you have any questions, thoughts or ideas on Smooth Streaming you can leave a message on our [topic:41 forum] or write us a [ private mail].