Detailed instructions for use are in the User's Guide.
HTTP Live Streaming Overview
2009-09-09
Apple Inc. © 2009 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, electronic, photocopying, recording, or otherwise, without prior written permission of Apple Inc., with the following exceptions: Any person is hereby authorized to store documentation on a single computer for personal use only and to print copies of documentation for personal use provided that the documentation contains Apple's copyright notice. The Apple logo is a trademark of Apple Inc. Use of the "keyboard" Apple logo (Option-Shift-K) for commercial purposes without the prior written consent of Apple may constitute trademark infringement and unfair competition in violation of federal and state laws. No licenses, express or implied, are granted with respect to any of the technology described in this document. Apple retains all intellectual property rights associated with the technology described in this document. This document is intended to assist application developers to develop applications only for Apple-labeled computers. Every effort has been made to ensure that the information in this document is accurate. Apple is not responsible for typographical errors. Apple Inc. 1 Infinite Loop Cupertino, CA 95014 408-996-1010 Apple, the Apple logo, iPod, Leopard, Mac, QuickTime, Safari, and WebObjects are trademarks of Apple Inc., registered in the United States and other countries. iPhone and Snow Leopard are trademarks of Apple Inc. Intel and Intel Core are registered trademarks of Intel Corportation or its subsidiaries in the United States and other countries. Simultaneously published in the United States and Canada.
Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS DOCUMENT, ITS QUALITY, ACCURACY,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS DOCUMENT IS PROVIDED "AS IS," AND YOU, THE READER, ARE ASSUMING THE ENTIRE RISK AS TO ITS QUALITY AND ACCURACY. IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR INACCURACY IN THIS DOCUMENT, even if advised of the possibility of such damages. THE WARRANTY AND REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, EXPRESS OR IMPLIED. No Apple dealer, agent, or employee is authorized to make any modification, extension, or addition to this warranty. Some states do not allow the exclusion or limitation of implied warranties or liability for incidental or consequential damages, so the above limitation or exclusion may not apply to you. This warranty gives you specific legal rights, and you may also have other rights which vary from state to state.
Contents
Introduction
Introduction 7
Organization of This Document 7 See Also 7
Chapter 1
HTTP Streaming Architecture 9
Overview 9 Server Components 10 Media Encoder 11 Stream Segmenter 11 Media Segment Files 12 Distribution Components 12 Client Component 12
Chapter 2
Using HTTP Live Streaming 13
Session Types 13 Content Protection 13 Caching and Delivery Protocols 14 Stream Alternates 14 Failover Protection 15 Sample Streams 16
Chapter 3
Frequently Asked Questions 17 Document Revision History 21
3
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
CONTENTS
4
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
Figures
Chapter 1
HTTP Streaming Architecture 9
Figure 1-1 A basic configuration 10
Chapter 2
Using HTTP Live Streaming 13
Figure 2-1 Stream alternates 15
5
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
FIGURES
6
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
INTRODUCTION
Introduction
HTTP Live Streaming allows you to send live or prerecorded audio and video to iPhone or other devices, such as desktop computers, using an ordinary Web server. Playback requires iPhone OS 3.0 or later on iPhone or iPod touch; QuickTime X or later is required on the desktop. Support is included for both encryption and authentication. The HTTP Live Streaming specification is an IETF Internet-Draft. If you are interested in streaming live events to iPhone, streaming live events without special server software, or in sending video on demand with encryption and authentication, you should read this document. Note: This document was formerly tltled "iPhone Streaming Media Guide for Web Developers."
Organization of This Document
This document contains three chapters:
"HTTP Streaming Architecture" (page 9)--how the technology works, what formats are supported, what you need on the server, and what clients are available. "Using HTTP Live Streaming" (page 13)--how to set up live broadcast or video on demand sessions, how to implement encryption and authentication, and how to set up alternate bandwidth streams. Links to sample streams are included. "Frequently Asked Questions" (page 17)--common questions about HTTP Live Streaming, and their answers: format details, tips, where to go for support, and so on.
See Also
Safari Web Content Guide--how to design web content for iPhone. HTTP Live Streaming protocol--the IETF Internet-Draft of the HTTP Live Streaming specification.
Organization of This Document
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
7
INTRODUCTION
Introduction
8
See Also
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
CHAPTER 1
HTTP Streaming Architecture
Starting with iPhone OS version 3.0 and QuickTime X, you can send streaming audio and video over HTTP from an ordinary web server for playback on iPhone, iPod touch, or other devices, such as desktop computers. This is called HTTP Live Streaming. Because it uses HTTP, this kind of streaming is automatically supported by nearly all edge servers, media distributors, caching systems, routers, and firewalls. HTTP Live Streaming also provides for media encryption and user authentication over HTTPS, allowing publishers to protect their work. Note: Many existing streaming services require specialized servers to distribute content to end users. These servers require specialized skills to set up and maintain, and in a large-scale deployment this can be costly. HTTP Live Streaming avoids this by using standard HTTP to deliver the media. Additionally, HTTP Live Streaming is designed to work seamlessly in conjunction with media distribution networks for large scale operations.
Overview
Conceptually, HTTP Live Streaming consists of three parts: the server component, the distribution component, and the client software. The server component is responsible for taking input streams of media and encoding them digitally, encapsulating them in a format suitable for delivery, and preparing the encapsulated media for distribution. The distribution component consists of standard web servers. They are responsible for accepting client requests and delivering prepared media and associated resources to the client. For large-scale distribution, edge networks or other content delivery networks can also be used. The client software is responsible for determining the appropriate media to request, downloading those resources, and then reassembling them so that the media can be presented to the user in a continuous stream. iPhone includes built-in client software: the media player, which is automatically launched when Safari encounters an or tag with a URL whose MIME type is one that the media player supports. The media player can also be launched from custom iPhone applications using the media player framework. QuickTime X can also play HTTP Live Streams, enabling playback on the desktop. Developers can use the QuickTime framework to create desktop applications that play HTTP Live Streams. The QuickTime plug-in allows you to embedded streams in websites for playback through a browser without writing any application code. In a typical configuration, a hardware encoder takes audio-video input and turns it into an MPEG-2 Transport Stream, which is then broken into a series of short media files by a software stream segmenter. These files are placed on a web server.
Overview
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
9
CHAPTER 1
HTTP Streaming Architecture
The segmenter also creates and maintains an index file containing a list of the media files. The URL of the index file is published on the web server. Client software reads the index, then requests the listed media files in order and displays them without any pauses or gaps between segments. An example of a simple HTTP streaming configuration is shown in "A basic configuration." Figure 1-1 A basic configuration
Server media encoder stream segmenter Distribution origin web server
Index file
MPEG-2 transport stream
.ts
Audio/Video inputs
HTTP
Client
Input can be live or from a prerecorded source. It is typically encoded into an MPEG-2 Transport Stream by off-the-shelf hardware. The MPEG2 stream is then broken into segments and saved as a series of one or more .ts media files. This is typically accomplished using a software tool such as the Apple stream segmenter. Audio-only streams can be a series of MPEG elementary audio files formatted as either AAC with ADTS headers or MP3. The segmenter also creates an index file. The index file contains a list of media files. The index file also contains metadata. The index file is in .M3U8 format. The URL of the index file is accessed by clients, which then request the indexed files in sequence.
Server Components
The server requires a media encoder, which can be off-the-shelf hardware, and a way to break the encoded media into segments and save them as files, which can be software such as the media stream segmenter provided by Apple (available in beta for download from the Apple Developer Connection member download site at https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20333).
10
Server Components
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
CHAPTER 1
HTTP Streaming Architecture
Media Encoder
The media encoder takes a real-time signal from an audio-video device, encodes the media, and encapsulates it for delivery. Currently, the supported format is MPEG-2 Transport Streams for audio-video, or MPEG elementary streams for audio. The encoder delivers an MPEG-2 Transport Stream over the local network to the stream segmenter. Note: The protocol specification is capable of accommodating other formats, but only MPEG-2 video streams (with H.264 video and AAC audio) or MPEG elementary audio streams (in AAC format with HTDS headers or in MP3 format) are supported at this time.
Important: The video encoder should not change stream settings--such as video dimensions or codec type--in the midst of encoding a stream.
Stream Segmenter
The stream segmenter is a process--typically software--that reads the Transport Stream from the local network and divides it into a series of small media files of equal duration. Even though each segment is in a separate file, video files are made from a continuous stream which can be reconstructed seamlessly. The segmenter also creates an index file containing references to the individual media files. Each time the segmenter completes a new media file, the index file is updated. The index is used to track the availability and location of the media files. The segmenter may also encrypt each media segment and create a key file as part of the process. Media segments are saved as .ts files (MPEG-2 streams) and index files are saved as .M3U8 files, an extension of the .m3u format used for MP3 playlists. Note: Because the index file format is an extension of the .m3u file format, and because the system also supports .mp3 audio media files, the client software may also be compatible with typical MP3 playlists used for streaming Internet radio. Here is a very simple example of an .M3U8 file a segmenter might produce if the entire stream were contained in three unencrypted 10-second media files:
#EXTM3U #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-TARGETDURATION:10 #EXTINF:10, http://media.example.com/segment1.ts #EXTINF:10, http://media.example.com/segment2.ts #EXTINF:10, http://media.example.com/segment3.ts #EXT-X-ENDLIST
The index file may also contain URLs for encryption key files or alternate index files for different bandwidths. For details of the index file format, see the IETF Internet-Draft of the HTTP Live Streaming specification.
Server Components
2009-09-09 | © 2009 Apple Inc. All Rights Reserved.
11
CHAPTER 1
HTTP Streaming Architecture
Media Segment Files
The media segment files are normally produced by the stream segmenter, based on input from the encoder, and consist of a series of .ts files containing segments of an MPEG-2 Transport Stream. For an audio-only broadcast, the segmenter can produce MPEG elementary audio streams containing either AAC audio with ADTS ...