HTTP LIVE STREAMING A review of Apple’s new streaming specification
andrewsblog.org — andrew@fecheyr.be
STREAMING MEDIA • On-Demand • Popular
vs Live
Solutions:
• RTP/RTSP
Open protocol but has firewall issues • Adobe
Flash Media Streaming Proprietary, high client cpu usage on some platforms
HTTP LIVE STREAMING
HTTP LIVE STREAMING • Originally • The • Pure
developed by Apple for its iPhone platform
specification is an IETF Internet-Draft HTTP delivery
• No
firewall issues
• No
special server needed (any web server will do)
ARCHITECTURE • Server
component
• Distribution • Client
component
software
ARCHITECTURE Server media encoder
Distribution stream segmenter
MPEG 2 transport stream
A/V input
Index file
.ts
HTTP
Client
ARCHITECTURE Server media encoder
• Media stream segmenter
MPEG 2 transport stream
A/V input
•
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 Server media encoder
Distribution stream segmenter
MPEG 2 transport stream
A/V input
Index file
.ts
HTTP
Client
ARCHITECTURE • Distribution •
Ordinary web server or web caching/proxy system
•
Serves index file & stream segments
Distribution
Index file
.ts
HTTP
• Client Client
•
Fetches index file
•
Fetches stream segments in sequence
FEATURES • On-Demand • Content
Streaming (VOD) and Live Streaming
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 Alt. A Index file
Index file
• Different .ts
Alt. B Index file
.ts
Alt. C Index file
.ts
•
eg: high quality for Wifi medium quality for 3G low quality for Edge
•
Client switches automatically
• Failover
Backup Server Backup Index file
bandwidths for varying network connections or devices
.ts
alternative(s) as Backup
.M3U8 INDEX FILE • Extension • Simple
of .m3u playlist file (by Nullsoft for Winamp)
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 • Simple
of .m3u playlist file (by Nullsoft for Winamp)
example duration of segments #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
in seconds
segment urls
.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=200000 http://ALPHA.mycompany.com/lo/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000 http://BETA.mycompany.com/lo/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000 http://ALPHA.mycompany.com/md/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000 http://BETA.mycompany.com/md/prog_index.m3u8
.M3U8 INDEX FILE • More
complex example
encryption method and key url
#EXTM3U #EXT-X-KEY:METHOD=AES-128,URI="https:// priv.mycompany.com/key"
200kbps alternatives 500kbps alternatives
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000 http://ALPHA.mycompany.com/lo/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000 http://BETA.mycompany.com/lo/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000 http://ALPHA.mycompany.com/md/prog_index.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=500000 http://BETA.mycompany.com/md/prog_index.m3u8
no X-ENDLIST so it is a Live stream
failover alternatives
CRITICAL COMPARISON
CRITICAL COMPARISON • Ease
of setup
• Compatibility • Client
& Server Performance
• Features • Ease • Cost
of distribution
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
external player
external player
✔
Chrome 4.0.249, MacOS 10.6.2
external player
external player
✔
FireFox 3.5,Vista SP1
✖
external player
✔
IExplorer 8,Vista SP1
✖
external player
✔
iPhone 3.1.2
✔
✖
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
external player
external player
✔
Chrome 4.0.249, MacOS 10.6.2
external player
external player
✔
FireFox 3.5,Vista SP1
✖
external player
✔
IExplorer 8,Vista SP1
✖
external player
✔
iPhone 3.1.2
✔
✖
redirected*
still low
okay
great
* YouTube automatically sends an alternative HTTP Live Stream to iPhone users.
CLIENT PERFORMANCE • Average • Ran
CPU Load from 120 samples taken over 40sec
on a 1.8 Ghz dual core MacBook (MacOS 10.6.2)
CLIENT PERFORMANCE • Average • Ran
CPU Load from 120 samples taken over 40sec
on a 1.8 Ghz dual core MacBook (MacOS 10.6.2)
HTTP Live Streaming
RTP/RTSP
Flash Media
CPU Load Embedded CPU Load External
CLIENT PERFORMANCE • Average • Ran
CPU Load from 120 samples taken over 40sec
on a 1.8 Ghz dual core MacBook (MacOS 10.6.2)
HTTP Live Streaming
RTP/RTSP
Flash Media
16,94% 15,10%
CPU Load Embedded CPU Load External
21,64% 21,28% 78,02% 86,44%
SERVER PERFORMANCE • Concurrency
is the important metric!
• RTP/RTSP: Darwin • Tested • HTTP
with StreamingLoadTool
Live Streaming: Nginx web server
• Tested • Ran
Streaming Server
with ApacheBench
on a FreeBSD 7.2 Virtual Private Server with 128MB Ram
SERVER PERFORMANCE Darwin Streaming Server 60
Success
Errors
Failed
50
Streams
40 30 20 10 0
0
20
40
60
Concurency
80
100
SERVER PERFORMANCE Darwin Streaming Server 60
Success
Errors
Failed
50
Streams
40 30 20 10 0
0
20
40
60
80
Concurency
CPU bound, max 20~40 users
100
SERVER PERFORMANCE Nginx web server 15.000
100%
Mean
Requests > 10s 75%
10.000 7.500
50%
5.000 25% 2.500 0
10
30
50
70
90
Concurrency
110
130
0%
Requests out of time
Mean request time (ms)
12.500
SERVER PERFORMANCE Nginx web server 15.000
100%
Mean
Requests > 10s 75%
10.000 7.500
50%
5.000 25% 2.500 0
10
30
50
70
90
110
130
Concurrency
Network bound, max 80~130 users
0%
Requests out of time
Mean request time (ms)
12.500
EASE OF DISTRIBUTION • Clear • Easy
advantage for HTTP Live Streaming <= only HTTP objects !
to integrate with Content Delivery Networks (CDNs)
• eg: Amazon • Inexpensive
Cloudfront
! $1 = 2500minutes of streaming video
EASE OF DISTRIBUTION • Clear • Easy
advantage for HTTP Live Streaming <= only HTTP objects !
to integrate with Content Delivery Networks (CDNs)
• eg: Amazon • Inexpensive
Cloudfront
! $1 = 2500minutes of streaming video
COST • RTP/RTSP • Free • HTTP
= open standards
Open Source Server: Darwin Streaming Server Live Streaming = open specification
• Open • Adobe • $995
Source toolchain and web servers
Flash Media Streaming Server License - or reverse engineered java implementation
CONCLUSION
HTTP Live Streaming
RTP/RTSP
Flash Media
Protocol Type
standard
standard
proprietary
Server Cost
free
free
$995
Ease of setup
very easy
Okay
?
Compatibility
low
using plugins
very high
Client Performance
great
good
high cpu on some platforms
Server Performance
great, network bound
good, cpu bound
?
Variable bitrates
Built in
some servers
only latest version
Encryption
Built in
?
~ server version
Authentication
by protecting key files
custom module
?
Built in Failover
yes
no
no
Seek delay
~ segments duration
< 2 seconds
4-10 seconds
Ease of distribution
Very easy
?
?
HTTP Live Streaming
RTP/RTSP
Flash Media
Protocol Type
standard
standard
proprietary
Server Cost
free
free
$995
Ease of setup
very easy
Okay
?
Compatibility
low
using plugins
very high
Client Performance
great
good
high cpu on some platforms
Server Performance
great, network bound
good, cpu bound
?
Variable bitrates
Built in
some servers
only latest version
Encryption
Built in
?
~ server version
Authentication
by protecting key files
custom module
?
Built in Failover
yes
no
no
Seek delay
~ segments duration
< 2 seconds
4-10 seconds
Ease of distribution
Very easy
?
?
HTTP Live Streaming
RTP/RTSP
Flash Media
Protocol Type
standard
standard
proprietary
Server Cost
free
free
$995
Ease of setup
very easy
Okay
?
Compatibility
low
using plugins
very high
Client Performance
great
good
high cpu on some platforms
Server Performance
great, network bound
good, cpu bound
?
Variable bitrates
Built in
some servers
only latest version
Encryption
Built in
?
~ server version
Authentication
by protecting key files
custom module
?
Built in Failover
yes
no
no
Seek delay
~ segments duration
< 2 seconds
4-10 seconds
Ease of distribution
Very easy
?
?
embedded devices
low latency
highest compatibility
Thank you