recitation #13 HLS HTTP Live Streaming Winter Semester 2013, Dept. of Computer Science, Technion 1
2 What is Streaming? Streaming media is multimedia that is constantly received by and presented to the end-user while being delivered by a provider. A client application can begin playing the data (such as a movie) before the entire file has been transmitted. Examples : On line Media such as : YouTube, QuickTime. Internet radio. IPTV. VOD Video On Demand.
3 Streaming TCP or UDP? UDP Media stream is send as a series of small packets. There is no mechanism within the protocol to guarantee delivery. It is up to the receiving application to detect loss or corruption and recover data using error correction techniques. Problems when using NAT. Many firewalls block UDP communication. No option to control the streaming. There are additional protocols to support this like RTSP. Clients of media servers issue VCR-like commands, such as play and pause. Good for streaming live events : Multicast is supported. (when source bandwidth is limited). Real Time - Much faster to create UDP packets then TCP. No need to buffer lost segments in the client.
4 Streaming TCP or UDP? cont TCP Guarantee correct delivery of each bit in the media stream. However, they accomplish this with a system of timeouts and retries, which makes them more complex to implement. Clients use buffers to handle timeouts and retries of packets. Firewall supported can be easily configure or be carried by a known TCP protocol. Good for stored streaming : VOD. Reliability and Quality are required. Clients can control the streaming. Prefetching data into the client buffer for continues play.
HLS HTTP Live Streaming 5 HTTP Live Streaming (HLS) - an HTTP based media streaming communications protocol implemented by Apple as part of their QuickTime X and idevices software systems. It works by breaking the overall stream into a sequence of small HTTP-based file downloads, each download loading one short chunk of an overall potentially unbounded transport stream. HLS is widely supported in streaming servers from vendors: Adobe, Microsoft, RealNetworks, and Wowsza. The popularity of Mobile devices led to increased support on the client side, most notably from Google in Android 3.0.
6 HLS Main Idea The Media is broken into small segments. The client get a Playlist file containing the segments locations. The client requests the segments by HTTP requests. no streaming server is required. audio/video chunks should leverage HTTP caching servers. HTTP content should pass through most firewalls. Can be secured by HTTPS protocol. Can be load balanced across multiple servers. The client plays each media segment in the Playlist. The Playlist file should be reloaded periodically. Why?
HLS - Example 7 HLS uses multiple encoded files with index files directing the player to different streams and chunks of audio/video data within those streams.
HLS Live Example 8 Main Index - http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_ index.m3u8 Alternate Index - http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/0640_vod. m3u8 Segment file - http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/0640/0640 0.ts
9 The Manifest File An M3U Playlist is a text file that consists of individual lines. HLS uses an extension of the Playlist file, called M3U8. The file consists of individual lines. Each line is a URI, blank, or starts with the character '#. Lines that start with the character '#' are either comments or tags. Tags begin with #EXT. All other lines that begin with '#' are comments and will be ignored. Certain extended M3U tags have values which are Attribute Lists. An Attribute List is comma-separated. An attribute/value format : AttributeName=AttributeValue.
10 The Manifest File - Tags #EXTM3U used to distinguished from a basic M3U. #EXTINF :<duration>,<title> - specifies the duration of a media segment. It applies only to the media segment that follows it. #EXT-X-TARGETDURATION:<s> - where s is an integer indicating the target duration in seconds. #EXT-X-MEDIA-SEQUENCE:<number> - Each media segment in a Playlist has a unique integer sequence number. #EXT-X-KEY:<attribute-list> specifies how to decrypt media segments. Supported Encryption methods : AES-128 and SAMPLE-AES.
11 The Manifest File Tags cont #EXT-X-PROGRAM-DATE-TIME associates the first sample of a media segment with an absolute date and/or time.. #EXT-X-ALLOW-CACHE- indicates whether the client MAY or MUST NOT cache downloaded media segments for later replay. #EXT-X-ENDLIST - indicates that no more media segments will be added to the Playlist file. It MAY occur anywhere in the Playlist file; it MUST NOT occur more than once. #EXT-X-STREAM-INF:<attribute-list>- identifies a media URI as a Playlist file containing a multimedia presentation and provides information about that presentation.
The Manifest File Examples 12 Case 1 : Simple Playlist file #EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:5220 #EXTINF:5219.2, http://media.example.com/entire.ts #EXT-X-ENDLIST
The Manifest File Examples 13 Case 2 : Sliding Window Playlist #EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:8 #EXT-X-MEDIA-SEQUENCE:2680 #EXTINF:7.975, https://priv.example.com/filesequence2680.ts #EXTINF:7.941, https://priv.example.com/filesequence2681.ts #EXTINF:7.975, https://priv.example.com/filesequence2682.ts
The Manifest File Examples 14 Case 3 : Playlist file with encrypted media segments #EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:7794 #EXT-X-TARGETDURATION:15 #EXT-X-KEY:METHOD=AES 128, URI="https://priv.example.com/key.php?r=52" #EXTINF:2.833, http://media.example.com/filesequence52-a.ts #EXTINF:15.0, http://media.example.com/filesequence52-b.ts #EXTINF:13.333, http://media.example.com/filesequence52-c.ts #EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" #EXTINF:15.0, http://media.example.com/filesequence53-a.ts
The Manifest File Examples 15 Case 4 : Variant Playlist file #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 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=65000,CODECS="mp4a.40.5" http://example.com/audio-only.m3u8
16 Example The LiveVOD company wants to support streaming of live events to thousands of users. Requirements: The users can replay the event or pause. Bandwidth is limited at the source of the stream. Some users are behind corporate firewall or NAT.
17 Pull Example - solution By designing an architecture to facilitate TCP traffic Upload the event stream to a selected number of Distribution Component. Distribution Component acts as a Streaming server before the clients. Each one can serve a number of clients using HLS protocol. Note : this solution create a small latency compare to UDP multicast solution. HTTP Streaming Traffic HTTP Streaming Traffic Pull HTTP Request Streaming server Distribution Component HTTP Streaming client
18 Conclusion HLS uses only standard HTTP transactions. This provides many benefits over other streaming technologies. Easy to support both in server and client. Currently, the protocol is documented as an Internet-Draft, and yet to become an IETF standardization. However, many venders already extended support for this protocol.