http live streaming update - huihoo
TRANSCRIPT
![Page 1: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/1.jpg)
These are confidential sessions—please refrain from streaming, blogging, or taking pictures
Session 408
HTTP Live Streaming Update
Roger PantosCore Media Engineer
1
![Page 2: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/2.jpg)
Outline
• Brief introduction to HTTP Live Streaming• New features • Best practices
2
![Page 3: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/3.jpg)
HTTP Live Streaming Overview
3
![Page 4: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/4.jpg)
How HTTP Live Streaming WorksIn 20 seconds!
• Break a media presentation up into segments (e.g. 10s each)• Put a URL for each media segment into a Playlist file• Put everything on an HTTP server
• Client downloads the playlist file • Download and play each media segment• Reload the playlist to discover new segments
4
![Page 5: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/5.jpg)
Playlist
Segment10 seconds
Segment10 seconds
Segment10 seconds
Segment10 seconds
Segments and Playlists
5
![Page 6: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/6.jpg)
#EXTM3U#EXT-X-VERSION:3#EXT-X-TARGETDURATION:10#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:9.7,http://example.com/movie1/fileSequenceA.ts#EXTINF:9.2,http://example.com/movie1/fileSequenceB.ts#EXTINF:8.6,http://example.com/movie1/fileSequenceC.ts#EXTINF:9.7,http://example.com/movie1/fileSequenceD.ts
#EXT-X-ENDLIST
Video on Demand Playlist
#EXTM3U#EXT-X-VERSION:3#EXT-X-TARGETDURATION:10#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:9.7,http://example.com/movie1/fileSequenceA.ts#EXTINF:9.2,http://example.com/movie1/fileSequenceB.ts#EXTINF:8.6,http://example.com/movie1/fileSequenceC.ts#EXTINF:9.7,http://example.com/movie1/fileSequenceD.ts
#EXT-X-ENDLIST
6
![Page 7: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/7.jpg)
Some Refinements
• Server can offer several Playlists at different bit rates ■ Client will dynamically switch to adapt to network speed
7
![Page 8: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/8.jpg)
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=150000http://example.com/low/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=640000http://example.com/high/index.m3u8
Variant Playlist
BANDWIDTH=150000low
BANDWIDTH=640000high
8
![Page 9: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/9.jpg)
Some Refinements
• Server can offer several Playlists at different bit rates ■ Client will dynamically switch to adapt to network speed
• A Playlist can contain discontinuities■ Ad breaks, program boundaries■ #EXT-X-DISCONTINUITY
9
![Page 10: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/10.jpg)
Some Refinements
• Server can offer several Playlists at different bit rates ■ Client will dynamically switch to adapt to network speed
• A Playlist can contain discontinuities■ Program boundaries, ad breaks■ #EXT-X-DISCONTINUITY
• Media can be encrypted■ Keys are specified in the Playlist■ #EXT-X-KEY:METHOD=AES-128,URI=”https://example.com/key.php”
10
![Page 11: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/11.jpg)
Playback Control
• iOS■ HTML5 <video> element■ MediaPlayer: MPMoviePlayerController■ AVFoundation: AVPlayerItem
• OS X■ HTML5 <video> element ■ AVFoundation: AVPlayerItem
11
![Page 12: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/12.jpg)
New Features
12
![Page 13: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/13.jpg)
Alternative Audio
• Different audio can often accompany the same video■ Other languages■ Director’s Commentary■ Home/Away game broadcasts
13
![Page 14: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/14.jpg)
Alternative Audio
• Different audio can often accompany the same video■ Translations into other languages■ Director’s Commentary■ Home/Away game broadcasts
• Challenges:■ Downloading one stream with multiple audio tracks is inefficient■ Duplicating video for each alternative audio is expensive
14
![Page 15: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/15.jpg)
64Kbps 150Kbps 240Kbps 440Kbps 640Kbps 840Kbps 1240Kbps
28.8 MBph 67.5 MBph 108 MBph 198 MBph 288 MBph 378 MBph 558 MBph
Baseline StorageVideo + 1 audio at recommended bit rates
EnglishEnglish English English English English English
Video
Video
Video
Video
Video
Video
Total: 1.626 GB per Hour
15
![Page 16: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/16.jpg)
1 Language: 1.626 GB per Hour4 Languages: 6.504 GB per Hour
Duplicating Video1 copy of video with 4 audio translations
English Spanish
Chinese French
English Spanish
Chinese French
English Spanish
Chinese French
English Spanish
Chinese French
English Spanish
Chinese French
English Spanish
Chinese French
English Spanish
Chinese French
16
![Page 17: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/17.jpg)
Alternative Audio in iOS 5.0
• Audio can be packaged separately from video■ allows multiple renditions of audio content■ minimal storage overhead
• Can change audio while playing
17
![Page 18: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/18.jpg)
1 Language: 1.626 GB per Hour4 Languages: 6.504 GB per Hour
Duplicating Video1 copy of video with 4 audio translations
English Spanish
Chinese French
English EnglishEnglishEnglishEnglishEnglish Spanish SpanishSpanishSpanishSpanishSpanish
Chinese ChineseChineseChineseChineseChinese French FrenchFrenchFrenchFrenchFrench
18
![Page 19: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/19.jpg)
64Kbps 86Kbps 176Kbps 376Kbps 576Kbps 776Kbps 1176Kbps64Kbps 64Kbps 64Kbps
Alternative Audio in iOS 5.0Audio packaged separately
1 Language: 1.378 GB per Hour4 Languages: 1.462 GB per Hour
Alternate audio allows us to reuse video and audio streams
19
![Page 20: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/20.jpg)
Specifying Alternative Audio
• Audio options are described in Variant Playlist:#EXT-X-MEDIA:TYPE=AUDIO, GROUP-ID="aac", NAME="English", URI="english.m3u8", DEFAULT=YES
#EXT-X-MEDIA:TYPE=AUDIO, GROUP-ID="aac", NAME="Espanol", URI="spanish.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=190000,AUDIO="aac"
lo/prog_index.m3u8
#EXT-X-MEDIA:
#EXT-X-MEDIA:
GROUP-ID="aac"
GROUP-ID="aac"
AUDIO="aac"
20
![Page 21: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/21.jpg)
Specifying Alternative Audio
• Audio options are described in Variant Playlist:#EXT-X-MEDIA:TYPE=AUDIO, GROUP-ID="aac", NAME="English", URI="english.m3u8", DEFAULT=YES
#EXT-X-MEDIA:TYPE=AUDIO, GROUP-ID="aac", NAME="Espanol", URI="spanish.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=190000,AUDIO="aac"
lo/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=600000,AUDIO="aac"
hi/prog_index.m3u8
GROUP-ID="aac"
GROUP-ID="aac"
AUDIO="aac"
AUDIO="aac"
21
![Page 22: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/22.jpg)
Media Selection API
• Discover and select media options for playbackAVAsset *myAsset = getMyAsset();NSArray *options = [myAsset availableMediaCharacteristicsWithMediaSelectionOptions];
selectionGroup = [myAsset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicAudible];
option = [[selectionGroup options] objectAtIndex:0];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset: myAsset];
[playerItem selectMediaOption:option inMediaSelectionGroup:selectionGroup];
• Can switch dynamically
option = [[selectionGroup options] objectAtIndex:0];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset: myAsset];
[playerItem selectMediaOption:option inMediaSelectionGroup:selectionGroup];
AVAsset *myAsset = getMyAsset();NSArray *options = [myAsset availableMediaCharacteristicsWithMediaSelectionOptions];
selectionGroup = [myAsset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicAudible];
22
![Page 23: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/23.jpg)
Demo
Bill MayCore Media Engineer
23
![Page 24: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/24.jpg)
Byte-range Support
• Segment can be specified as a byte range of a URL■ Allows segments to be consolidated into larger files
■ Improves cache associativity for CDN and proxy servers■ Fewer files to manage
24
![Page 25: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/25.jpg)
Playlist
Segment10 seconds
Segment10 seconds
Segment10 seconds
Segment10 seconds
Byte-range Segments
Segment10 seconds
media.ts
25
![Page 26: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/26.jpg)
Byte-range Support
• Segment can be specified as a byte range of a URL■ Allows segments to be grouped into larger files
■ Improves cache associativity for CDN and proxy servers■ Fewer files to manage
26
![Page 27: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/27.jpg)
Byte-range Support
• Segment can be specified as a byte range of a URL■ Allows segments to be grouped into larger files
■ Improves cache associativity for CDN and proxy servers■ Fewer files to manage
• Media files should be static
27
![Page 28: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/28.jpg)
Byte-range Support
• Segment can be specified as a byte range of a URL■ Allows segments to be grouped into larger files
■ Improves cache associativity for CDN and proxy servers■ Fewer files to manage
• Media files should be static
• New tag: #EXT-X-BYTERANGE: length[@offset]
28
![Page 29: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/29.jpg)
Byte-range Sample Playlist
#EXTM3U #EXTM3U
#EXTINF:10, #EXTINF:10,!
segment0.ts #EXT-X-BYTERANGE:75232@0!
#EXTINF:10, media.ts
segment1.ts #EXTINF:10,!
#EXTINF:10, #EXT-X-BYTERANGE:82112@752321!
segment2.ts media.ts
#EXTINF:10,!
#EXT-X-BYTERANGE:69864@1573449!
media.ts
75232@0
82112@752321
69864@1573449
29
![Page 30: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/30.jpg)
Fast Forward and Reverse Playback
• Goal■ Rapid forward and reverse playback (16x, 64x, -32x...)■ For live content, too
30
![Page 31: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/31.jpg)
Fast Forward and Reverse Playback
• Goal■ Rapid forward and reverse playback (16x, 64x, -32x...)■ For live content, too
• Problem■ Media segments cannot be downloaded quickly enough
31
![Page 32: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/32.jpg)
Fast Forward and Reverse Playback
• Goal■ Rapid forward and reverse playback (16x, 64x, -32x...)■ For live content, too
• Problem■ Media segments cannot be downloaded quickly enough
• Solution■ I-Frame-only playback
32
![Page 33: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/33.jpg)
I-Frame-only Playback
B B B B PB B B B B B B B B B B B B BI I IP P P P PII I
33
![Page 34: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/34.jpg)
I-Frame Playlist
#EXTM3U#EXT-X-I-FRAMES-ONLY...#EXTINF:4.12,#EXT-X-BYTERANGE:[email protected]#EXTINF:3.56,#EXT-X-BYTERANGE:[email protected]#EXTINF:3.82,#EXT-X-BYTERANGE:[email protected]
#EXTINF:4.12,#EXT-X-BYTERANGE:[email protected]
segment1.ts segment2.ts
B B B B PB B B B B B B B B B B B B BI I IP P P P P
#EXT-X-I-FRAMES-ONLY
34
![Page 35: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/35.jpg)
Provide Multiple I-Frame Playlists
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1250000
BTBW0.8Mb/low.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3120000
BTBW2Mb/high.m3u8
35
![Page 36: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/36.jpg)
Provide Multiple I-Frame Playlists
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1250000
BTBW0.8Mb/low.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3120000
BTBW2Mb/high.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=380000
BTBW0.8Mb/iframes.m3u8
#EXT-X-I-FRAME-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=657000
BTBW2Mb/iframes.m3u8
• More flexibility for good frame rate + high quality
36
![Page 37: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/37.jpg)
Fast Forward and Reverse APIs
AVPlayerItem *myPlayerItem = GetMyPlayerItem();
AVPlayer *myPlayer = [AVPlayer playerWithPlayerItem: myPlayerItem];
if ( myPlayerItem.canPlayFastForward )
myPlayer.rate = 32.0;
if ( myPlayerItem.canPlayFastReverse )
myPlayer.rate = -20.0;
37
![Page 38: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/38.jpg)
Demo
Bill MayCore Media Engineer
38
![Page 39: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/39.jpg)
Closed Captions
• Accessibility text embedded in video stream■ CEA-608■ ATSC CC (A/53, Part 4)
• Can be displayed in iOS 4.2 and onward
39
![Page 40: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/40.jpg)
Runtime Playback Statistics
• Access Log■ Currently recorded for each period spent playing a variant
■ Start date / time■ Duration downloaded, watched■ URL■ Server IP address (and # of changes)■ Bandwidth information■ Stall count■ Dropped frame count■ Playback GUID
• Error Log
40
![Page 41: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/41.jpg)
Statistics API
• AVFoundationAVPlayerItemAccessLog *accessLog = [myAVPlayerItem accessLog];
AVPlayerItemErrorLog *errors = [myAVPlayerItem errorLog];
NSData *bytes = [accessLog extendedLogData];
• MPMoviePlayerControllerMPMovieAccessLog *accessLog = [myMoviePlayerController accessLog];
MPMovieErrorLog *errors = [myMoviePlayerController errorLog];
NSData *bytes = [accessLog extendedLogData];
41
![Page 42: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/42.jpg)
Statistics—Formatted Log File
• Uses W3C Extended Log File Format#Version: 1.0
#Software: AppleCoreMedia/1.0.0.9A220 (iPad; U; CPU OS 5_0 like Mac OS X;)
#Date: 2011/05/27 12:59:58.058
#Fields: date time uri s-ip c-duration-watched ...
2011/05/27 12:39:47.047 http://example.com/1500.m3u8 10.0.0.27 16.5 ...
2011/05/27 12:40:04.004 http://example.com/2000.m3u8 10.0.0.27 30.3 ...
2011/05/27 12:40:34.034 http://example.com/650.m3u8 10.0.0.27 27.0 ...
42
![Page 43: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/43.jpg)
Best Practices
43
![Page 44: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/44.jpg)
Delivery of Encrypted Media
• Distribute encrypted media files over regular HTTP
44
![Page 45: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/45.jpg)
Delivery of Encrypted Media
• Distribute encrypted media files over regular HTTP• Keys are loaded from URLs in the Playlist files
45
![Page 46: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/46.jpg)
Delivery of Encrypted Media
• Distribute encrypted media files over regular HTTP• Keys are loaded from URLs in the Playlist files• Deliver keys over the network using HTTPS
■ Establish and require HTTPS session cookie, or■ Put keys inside a protected HTTP Realm
■ Client must cache credentials before playback
46
![Page 47: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/47.jpg)
Delivery of Encrypted Media
• Distribute encrypted media files over regular HTTP• Keys are loaded from URLs in the Playlist files• Deliver keys over the network using HTTPS
■ Establish and require HTTPS session cookie, or■ Put keys inside a protected HTTP Realm
■ Client must cache credentials before playback
• Provide the keys directly using Application-defined URLs
47
![Page 48: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/48.jpg)
Application-Defined URLs
• Define your own URL scheme■ “abcd://foobar”
48
![Page 49: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/49.jpg)
Application-Defined URLs
• Define your own URL scheme■ “abcd://foobar”
• Implement NSURLProtocol■ [NSURLProtocol registerClass:]■ Called with URL—returns resource data or HTTP redirect■ Not accessible from other Applications
• More secure and efficient than a localhost HTTP server
49
![Page 50: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/50.jpg)
Application-Defined URLs
• Define your own URL scheme■ “abcd://foobar”
• Implement NSURLProtocol■ [NSURLProtocol registerClass:]■ Called with URL—returns resource data or HTTP redirect■ Not accessible from other Applications
• More secure and efficient than a localhost HTTP server• Can be used for Keys and Playlists
■ Not media files
50
![Page 51: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/51.jpg)
AirPlay of Encrypted Video Streams
• New in iOS 5.0
• Should just work if your app follows best practices
• Apps built for iOS 5.0 are opted in to AirPlay by default■ Opt out if you need to
51
![Page 52: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/52.jpg)
Chaining Players Does Not Work Well
• Sometimes used to present pre-roll and mid-roll ads• Each Player requires separate buffering stage • Players compete for bandwidth, unpredictably• Will not retain optimal bit rate• Difficult to implement seek • Very difficult to implement FF/RW
52
![Page 53: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/53.jpg)
Use Single Playlist for Program + Ads
• Put ads directly into main Playlist■ DISCONTINUITY tags between ads and program content■ Use floating-point EXTINF durations
-[AVPlayer addBoundaryTimeObserverForTimes:usingBlock:]
• Compose Playlists on server or from within App■ Application-defined URLs (NSURLProtocol)
53
![Page 54: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/54.jpg)
Serve Playlists with gzip Encoding
• Automatic, on demand• ~10x compression for long m3u8 files
• For apache:<IfModule deflate_module>
AddOutputFilterByType DEFLATE application/vnd.apple.mpegurl
Header append Vary Accept-Encoding env=!dont-vary
</IfModule>
54
![Page 55: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/55.jpg)
Accurate Content Description
• CODECS attribute #EXT-X-STREAM-INF:BANDWIDTH=190000,CODECS="avc1.42e00a,mp4a.40.2"
■ Can differentiate audio-only streams from audio/videoCODECS
55
![Page 56: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/56.jpg)
Accurate Content Description
• CODECS attribute #EXT-X-STREAM-INF:BANDWIDTH=190000,CODECS="avc1.42e00a,mp4a.40.2"
■ Can differentiate audio-only streams from audio/video
• RESOLUTION attribute #EXT-X-STREAM-INF:BANDWIDTH=560000,RESOLUTION=640x480RESOLUTION
56
![Page 57: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/57.jpg)
Accurate Content Description
• CODECS attribute #EXT-X-STREAM-INF:BANDWIDTH=190000,CODECS="avc1.42e00a,mp4a.40.2"
■ Can differentiate audio-only streams from audio/video
• RESOLUTION attribute #EXT-X-STREAM-INF:BANDWIDTH=560000,RESOLUTION=640x480
• Floating-point EXTINF durations#EXTINF:9.57,
57
![Page 58: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/58.jpg)
Accurate Content Description
• CODECS attribute #EXT-X-STREAM-INF:BANDWIDTH=190000,CODECS="avc1.42e00a,mp4a.40.2"
■ Can differentiate audio-only streams from audio/video
• RESOLUTION attribute #EXT-X-STREAM-INF:BANDWIDTH=560000,RESOLUTION=640x480
• Floating-point EXTINF durations#EXTINF:9.57,
• Pay attention to the mediastreamvalidator
58
![Page 59: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/59.jpg)
TLS Version 1.2
• iOS 5.0 connects with TLS 1.2■ Formerly known as SSL, used for HTTPS■ Previous iOS releases used TLS 1.0■ Many new cipher suites are presented in ClientHello
59
![Page 60: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/60.jpg)
TLS Version 1.2
• iOS 5.0 connects with TLS 1.2■ Formerly known as SSL, used for HTTPS■ Previous iOS releases used TLS 1.0■ Many new cipher suites are presented in ClientHello
• Testing with some apps has revealed incompatibilities
60
![Page 61: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/61.jpg)
TLS Version 1.2
• iOS 5.0 connects with TLS 1.2■ Formerly known as SSL, used for HTTPS■ Previous iOS releases used TLS 1.0■ Many new cipher suites are presented in ClientHello
• Testing with some apps has revealed incompatibilities
• Test your apps
61
![Page 62: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/62.jpg)
Selecting TARGETDURATION
• Controls Playlist reload interval• Indicates maximum segment duration
■ Impacts maximum IDR interval
• Does not affect startup (buffering) time
62
![Page 63: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/63.jpg)
Content Production
• Do not restart encoding on segment boundaries■ Format, track count, CC, GOP structure, etc. must be continuous■ Unless starting a DISCONTINUITY
63
![Page 64: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/64.jpg)
Content Production
• Do not restart encoding on segment boundaries■ Format, track count, CC, GOP structure, etc. must be continuous■ Unless starting a DISCONTINUITY
• Start each TS segment with PAT/PMT■ Each segment requires only one PAT/PMT
64
![Page 65: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/65.jpg)
Content Production
• Do not restart encoding on segment boundaries■ Format, track count, CC, GOP structure, etc. must be continuous■ Unless starting a DISCONTINUITY
• Start each TS segment with PAT/PMT■ Each segment requires only one PAT/PMT
• Other formats have coarser sample time scales (e.g. 1ms)■ Timestamp accuracy has been lost due to rounding■ Must restore this accuracy when transcoding to MPEG2 90,000
65
![Page 66: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/66.jpg)
To Summarize…
• HTTP Live Streaming continues to evolve• Stay current• Bring your questions to the Graphics and Media lab• Give us your feedback
66
![Page 67: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/67.jpg)
AirPlay and External Displays in iOS apps PresidioTuesday 3:15PM
Working with Media in AV Foundation Pacific HeightsWednesday 2:00PM
Introducing AV Foundation Capture For Lion Pacific Heights Wednesday 3:15PM
Capturing from the Camera using AV Foundation on iOS 5 Pacific HeightsWednesday 4:30PM
Related Sessions
Exploring AV Foundation PresidioTuesday 2:00PM
67
![Page 68: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/68.jpg)
AV Foundation Lab Graphics, Media & Games Lab CWednesday 9:00AM
QT Kit Lab Graphics, Media & Games Lab AWednesday 9:00AM
AV Foundation Lab Graphics, Media & Games Lab BThursday 9:00AM
HTTP Live Streaming Lab Graphics, Media & Games Lab DWednesday 9:00AM
Labs
QuickTime Lab Graphics, Media & Games Lab DThursday 9:00AM
AirPlay Lab Graphics, Media & Games Lab BWednesday 9:00AM
DAL Lab Graphics, Media & Games Lab CThursday 9:00AM
68
![Page 69: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/69.jpg)
More Information
DocumentationHTTP Live Streaming Resources http://developer.apple.com/resources/http-streaming/
Timed metadatahttp://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/HTTP_Live_Streaming_Metadata_Spec/
Apple Developer Forumshttp://devforums.apple.com
Eryk VershenMedia Technologies [email protected]
69
![Page 70: HTTP Live Streaming Update - Huihoo](https://reader031.vdocuments.net/reader031/viewer/2022020704/61fb613c2e268c58cd5d7aa1/html5/thumbnails/70.jpg)
70