Upload
andrew-fecheyr
View
239
Download
1
Tags:
Embed Size (px)
DESCRIPTION
A Review of Apple's new streaming specification. This is the presentation of this paper: http://issuu.com/andruby/docs/http_live_streaming.
Citation preview
HTTP LIVE STREAMINGA review of Apple’s new streaming specification
andrewsblog.org — [email protected]
STREAMING MEDIA
• On-Demand vs Live
• Popular Solutions:
• RTP/RTSPOpen protocol but has firewall issues
• Adobe Flash Media StreamingProprietary, high client cpu usage on some platforms
HTTP LIVE STREAMING
HTTP LIVE STREAMING
• Originally developed by Apple for its iPhone platform
• The specification is an IETF Internet-Draft
• Pure HTTP delivery
• No firewall issues
• No special server needed (any web server will do)
ARCHITECTURE
• Server component
• Distribution component
• Client software
ARCHITECTURE
A/V input
MPEG 2transport stream
Server
media encoder
stream segmenter
Client
Distribution
.tsIndex
file
HTTP
ARCHITECTURE
A/V input
MPEG 2transport stream
Server
media encoder
stream segmenter
• Media encoder
• Outputs an MPEG-2 Transport Stream
• Stream Segmenter
• Cuts the stream in small files of equal duration
• Creates/updates an .m3u8 index files
ARCHITECTURE
A/V input
MPEG 2transport stream
Server
media encoder
stream segmenter
Client
Distribution
.tsIndex
file
HTTP
ARCHITECTURE
Client
Distribution
.tsIndex
file
HTTP
• Distribution
• Ordinary web server or web caching/proxy system
• Serves index file & stream segments
• Client
• Fetches index file
• Fetches stream segments in sequence
FEATURES
• On-Demand Streaming (VOD) and Live Streaming
• Content Protection
• Encryption: AES-128, key files listed in index file
• Key files served by HTTP or HTTPS, can be protected by own session-based authentication scheme
• Stream alternatives and Failover protection
STREAM ALTERNATIVES
Main Server
.ts
Alt. A Index
file
.ts
Alt. B Index
file
.ts
Alt. C Index
file
Index file
Backup Server
.ts
Backup Index
file
• Different bandwidths for varying network connections or devices
• eg: high quality for Wifimedium quality for 3Glow quality for Edge
• Client switches automatically
• Failover alternative(s) as Backup
.M3U8 INDEX FILE
• Extension of .m3u playlist file (by Nullsoft for Winamp)
• Simple example
#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
.M3U8 INDEX FILE
• Extension of .m3u playlist file (by Nullsoft for Winamp)
• Simple example
#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
end of on-demand video
segment urls
duration of segments in seconds
.M3U8 INDEX FILE
• More complex example
#EXTM3U#EXT-X-KEY:METHOD=AES-128,URI="https:// priv.mycompany.com/key"
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000http://ALPHA.mycompany.com/lo/prog_index.m3u8#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000http://BETA.mycompany.com/lo/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000http://ALPHA.mycompany.com/md/prog_index.m3u8#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000http://BETA.mycompany.com/md/prog_index.m3u8
.M3U8 INDEX FILE
• More complex example
#EXTM3U#EXT-X-KEY:METHOD=AES-128,URI="https:// priv.mycompany.com/key"
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000http://ALPHA.mycompany.com/lo/prog_index.m3u8#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000http://BETA.mycompany.com/lo/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000http://ALPHA.mycompany.com/md/prog_index.m3u8#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000http://BETA.mycompany.com/md/prog_index.m3u8
no X-ENDLIST so it is a Live stream
200kbpsalternatives
failoveralternatives500kbps
alternatives
encryption method and key url
CRITICAL COMPARISON
CRITICAL COMPARISON
• Ease of setup
• Compatibility
• Client & Server Performance
• Features
• Ease of distribution
• Cost
CRITICAL COMPARISON
Tested @ http://streaming_test.andrewsblog.org
EASE OF SETUP
• HTTP Live Streaming
• Apple toolkit (~5 min) easy, fast and complete, but only available for MacOS
• Open Source toolchain (~15 min)
FFMpeg+Ruby+C: for *nix, flexible but experimental
• RTP/RTSP with Darwin Streaming Server (~1.5 hours)
• Install & configure server, conflict with web server if running on port 80
• Required to ‘hint’ media files
COMPATIBILITY
HTTP Live Streaming RTP/RTSP Flash Media
Safari 4.0.4, MacOS 10.6.2
FireFox 3.5.7, MacOS 10.6.2
Chrome 4.0.249, MacOS 10.6.2
FireFox 3.5, Vista SP1
IExplorer 8, Vista SP1
iPhone 3.1.2
✔ ✔ ✔
external player external player ✔
external player external player ✔
✖ external player ✔
✖ external player ✔
✔ ✖ redirected*
* YouTube automatically sends an alternative HTTP Live Stream to iPhone users.
COMPATIBILITY
HTTP Live Streaming RTP/RTSP Flash Media
Safari 4.0.4, MacOS 10.6.2
FireFox 3.5.7, MacOS 10.6.2
Chrome 4.0.249, MacOS 10.6.2
FireFox 3.5, Vista SP1
IExplorer 8, Vista SP1
iPhone 3.1.2
✔ ✔ ✔
external player external player ✔
external player external player ✔
✖ external player ✔
✖ external player ✔
✔ ✖ redirected*
greatokaystill low
* YouTube automatically sends an alternative HTTP Live Stream to iPhone users.
CLIENT PERFORMANCE
• Average CPU Load from 120 samples taken over 40sec
• Ran on a 1.8 Ghz dual core MacBook (MacOS 10.6.2)
CLIENT PERFORMANCE
• Average CPU Load from 120 samples taken over 40sec
• Ran on a 1.8 Ghz dual core MacBook (MacOS 10.6.2)
HTTP Live Streaming
RTP/RTSP
Flash Media
CPU Load EmbeddedCPU Load External
CLIENT PERFORMANCE
• Average CPU Load from 120 samples taken over 40sec
• Ran on a 1.8 Ghz dual core MacBook (MacOS 10.6.2)
HTTP Live Streaming
RTP/RTSP
Flash Media
15,10%16,94%
21,28%21,64%
86,44%78,02%
CPU Load EmbeddedCPU Load External
SERVER PERFORMANCE
• Concurrency is the important metric!
• RTP/RTSP: Darwin Streaming Server
• Tested with StreamingLoadTool
• HTTP Live Streaming: Nginx web server
• Tested with ApacheBench
• Ran on a FreeBSD 7.2 Virtual Private Server with 128MB Ram
SERVER PERFORMANCE
0
10
20
30
40
50
60
0 20 40 60 80 100
Darwin Streaming ServerS
trea
ms
Concurency
Success Errors Failed
SERVER PERFORMANCE
0
10
20
30
40
50
60
0 20 40 60 80 100
Darwin Streaming ServerS
trea
ms
Concurency
Success Errors Failed
CPU bound, max 20~40 users
SERVER PERFORMANCE
0
2.500
5.000
7.500
10.000
12.500
15.000
10 30 50 70 90 110 1300%
25%
50%
75%
100%
Nginx web server
Mea
n re
que
st t
ime
(ms)
Concurrency
Req
uest
s ou
t of
tim
e
Mean Requests > 10s
SERVER PERFORMANCE
0
2.500
5.000
7.500
10.000
12.500
15.000
10 30 50 70 90 110 1300%
25%
50%
75%
100%
Nginx web server
Mea
n re
que
st t
ime
(ms)
Concurrency
Req
uest
s ou
t of
tim
e
Mean Requests > 10s
Network bound, max 80~130 users
EASE OF DISTRIBUTION
• Clear advantage for HTTP Live Streaming <= only HTTP objects !
• Easy to integrate with Content Delivery Networks (CDNs)
• eg: Amazon Cloudfront
• Inexpensive !$1 = 2500minutes of streaming video
EASE OF DISTRIBUTION
• Clear advantage for HTTP Live Streaming <= only HTTP objects !
• Easy to integrate with Content Delivery Networks (CDNs)
• eg: Amazon Cloudfront
• Inexpensive !$1 = 2500minutes of streaming video
COST
• RTP/RTSP = open standards
• Free Open Source Server : Darwin Streaming Server
• HTTP Live Streaming = open specification
• Open Source toolchain and web servers
• Adobe Flash Media Streaming Server
• $995 License - or reverse engineered java implementation
CONCLUSION
HTTP Live Streaming RTP/RTSP Flash Media
Protocol Type
Server Cost
Ease of setup
Compatibility
Client Performance
Server Performance
Variable bitrates
Encryption
Authentication
Built in Failover
Seek delay
Ease of distribution
standard standard proprietary
free free $995
very easy Okay ?
low using plugins very high
great good high cpu on some platforms
great, network bound good, cpu bound ?
Built in some servers only latest version
Built in ? ~ server version
by protecting key files custom module ?
yes no no
~ segments duration < 2 seconds 4-10 seconds
Very easy ? ?
HTTP Live Streaming RTP/RTSP Flash Media
Protocol Type
Server Cost
Ease of setup
Compatibility
Client Performance
Server Performance
Variable bitrates
Encryption
Authentication
Built in Failover
Seek delay
Ease of distribution
standard standard proprietary
free free $995
very easy Okay ?
low using plugins very high
great good high cpu on some platforms
great, network bound good, cpu bound ?
Built in some servers only latest version
Built in ? ~ server version
by protecting key files custom module ?
yes no no
~ segments duration < 2 seconds 4-10 seconds
Very easy ? ?
HTTP Live Streaming RTP/RTSP Flash Media
Protocol Type
Server Cost
Ease of setup
Compatibility
Client Performance
Server Performance
Variable bitrates
Encryption
Authentication
Built in Failover
Seek delay
Ease of distribution
standard standard proprietary
free free $995
very easy Okay ?
low using plugins very high
great good high cpu on some platforms
great, network bound good, cpu bound ?
Built in some servers only latest version
Built in ? ~ server version
by protecting key files custom module ?
yes no no
~ segments duration < 2 seconds 4-10 seconds
Very easy ? ?
highest compatibilitylow latencyembedded devices
Thank you