|
IntroductionHTTP Live Streaming allows you to send live or prerecorded audio and video to iPhone, iPad, and other devices including desktop computers, using an ordinary Web server. Playback requires iPhone OS 3.0 or later on devices running iPhone OS; QuickTime X or later is required on the desktop. See the HTTP Live Streaming Overview for more information. This Technote offers the recommended encoding settings to use when creating HTTP Live Streaming media for iPhone and iPad apps, and for Safari on iPhone OS. It also provides tips for creating variant playlists, highlights some special considerations for deploying your media content to a web server and discusses how to validate your media streams. IMPORTANT: This document is updated frequently. Please bookmark this page, and refer back to it for the most current recommendations before starting your next project. Recommended Encoding Settings for HTTP Live Streaming MediaFigure 1 contains recommended encoding settings to use when creating HTTP Live Streaming media. IMPORTANT: These are recommended settings, not required settings. For example, if you are targeting movies that have very fast motion (such as sporting events), or if you have concerns about bandwidth, you may need to perform additional compression on your video to get the desired results. In this the case, use these settings as a starting point, and recompress until you are satisfied with the results. These settings apply to both live and prerecorded (video on demand, or VOD) encoding. The provided settings are grouped according to whether the content is intended to be streamed over the Cellular or Wi-Fi network, whether the content is for iPhone/iPod Touch or iPad, and whether the content is 4:3 or 16:9 aspect ratio. The following audio and video formats are supported:
Note: iPhone 3G supports H.264 Baseline Profile Level 3.1. If your app runs on older iPhones, however, you should use H.264 Baseline Profile 3.0 for compatibility. Figure 1: Recommended Encoding Settings for HTTP Live Streaming Media. How to create content with the recommended settings using QuickTimeTo learn how to export files with these settings using QuickTime, see Technical Note TN2218, 'Compressing QuickTime Movies for the Web' Requirements for AppsIf you are using HTTP Live Streaming in iPhone and iPad applications sold on the App Store there are some requirements you must conform to. See the HTTP Live Streaming Overview for the details. Media SegmentationHTTP Live Streaming requires that a media stream or file be segmented into a series of small media files of equal duration. This is usually accomplished using a tool that will segment the individual files and create a playlist. This architecture allows for a live stream that has already been segmented to be quickly converted to a VOD stream just by updating the playlist. There are two command-line tools available to you from Apple for segmentation of HTTP Live Streaming media. The tools are:
IMPORTANT: Both tools are frequently updated. If you are an iPhone Developer Program member or a Mac or ADC Select or Premier member, you can download the latest versions from the Apple Developer Connection website. To download, go to http://connect.apple.com, click on the 'Downloads' link, click on 'QuickTime', scroll down to the 'HTTP Live Streaming Tools', download and install the 'HTTP Live Streaming Tools'. Media Stream Segmenter ToolYou can use the Media Stream Segmenter ( The This tool receives an MPEG-2 transport stream over a UDP network connection or from The
This strips the audio elementary stream (AAC/ADTS or MP3) and writes it into the media file. You could, for example, run the Here's an example showing how to use the
The In this example, the index file will contain 3 items. Media files will be removed after an expiry period. The media and index files will be stored in Media File Segmenter ToolThe media file segmenter ( Note: The The The Note: Previous versions of the tool required you specify the
Variant PlaylistsA streaming multimedia presentation is specified by a Playlist file, which is a list of media file resources, each of which refers to a segment of a single contiguous stream. A server may offer multiple Playlist files to provide different encodings of the same presentation when HTTP Live Streaming. If it does, it should provide a Variant Playlist file (also known as a Stream Alternate) that lists each variant stream to allow clients to switch between encodings dynamically if the available bandwidth changes. See the HTTP Live Streaming Overview and the HTTP Live Streaming Protocol Specification for additional information about Variant Playlists. Variant Playlist Creator ToolThe Variant Playlist Creator ( The Important considerations when creating Variant PlaylistsHere are some important points to consider when creating your own Variant Playlists:
Media DeploymentHTML5 video elementWe recommend you use the HTML5 The source code example in Listing 1 demonstrates how to use the Listing 1: HTML5 video element example. <video src="http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"> This browser does not support HTML5 video. </video> See also Technical Note TN2262, 'Preparing Your Web Content for iPad' which describes platform-specific considerations for web content in Safari on iPhone OS devices, with specific information for iPad. Web Server ConfigurationThe distribution system for HTTP Live Streaming media is a web server or a web caching system that delivers the media files and index files to the client over HTTP (see the HTTP Live Streaming Overviewfor more information). No custom server modules are required to deliver the content, and typically very little configuration is needed on the web server. Recommended configuration is typically limited to specifying MIME-type associations for Table 1 : MIME-type associations for
Servers that are constrained for compatibility can serve files ending in Tuning time-to-live (TTL) values for Media Stream ValidationMedia Stream Validator ToolThe Media Stream Validator ( This tool simulates an HTTP Live Streaming session and verifies that the index file and media segments conform to the HTTP Live Streaming specification. It performs several checks to ensure reliable streaming. If any errors or problems are found, a detailed diagnostic report is displayed. IMPORTANT: You should always run the Here's example output from the Listing 2: Example validator tool output. Validating http://devimages.apple.com/iphone/samples/bipbop/gear3/prog_index.m3u8 against iPhone OS 3.1.0 Average segment duration: 8.77 seconds Average segment bitrate: 510.05 kbit/s Average segment structural overhead: 96.37 kbit/s (18.89 %) Video codec: avc1 Video resolution: 480x360 pixels Video frame rate: 29.97 fps Average video bitrate: 407.76 kbit/s H.264 profile: Baseline H.264 level: 2.1 Audio codec: aac Audio sample rate: 22050 Hz Average audio bitrate: 5.93 kbit/s Note: The For variant playlists, it is important that the bitrates specified in the playlist are very close to the actual measured rates. If not, a warning will be issued by the Listing 3: Example Variant Playlist showing the BANDWIDTH attribute. #EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000 http://example.com/low.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2560000 http://example.com/mid.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000 http://example.com/hi.m3u8 See the HTTP Live Streaming Protocol Specification for more information about the References |
Tech Note : http://developer.apple.com/library/ios/#technotes/tn2010/tn2224.html