title |
author |
theme |
classoption |
HTTP Live Streaming (HLS) |
|
|
|
|
Who
- Who am I?
- Embedded Systems background
- Prefer C, Haskell and Rust
- Organize and speak at Rust and Haskell meet-ups in Bangalore
- Work?
- Software Engineer @ asymptotic
- Open source consulting firm based out of Bangalore and Toronto
- Work on low level systems software centred around multimedia
- GStreamer, PipeWire, PulseAudio
- Language Polyglots
Open source contributions
Agenda
- Whirlwind tour of GStreamer
- What's HTTP Live Streaming (HLS)
- HLS implementation
GStreamer
- Multiplatform Pipeline based multimedia framework
- Bindings for various languages
- Allows building complex media processing workflows
- Some applications
- PiTiVi (Video Editor)
- amaroK, Banshee, Clementine (audio players)
- Empathy (VOIP and video conferencing)
- GstLAL (gravitational wave data analysis)
- Rygel (DLNA streaming server and renderer)
- Totem (movie player for the GNOME desktop)
Simple pipeline
gst-launch-1.0 videotestsrc ! autovideosink
gst-launch-1.0 audiotestsrc ! autoaudiosink
Media pipeline1
{width=80%}
HLS
- HTTP-based adaptive bit-rate streaming communications protocol
- Developed by Apple and released in 2009
- Standardised in RFC 8216
- HTTP traffic, unlike UDP-based protocols such as RTP
- Content can be offered from conventional HTTP servers
- Delivered over widely available HTTP-based content delivery networks
Motivation
- Video on demand content
- HLS is better than just serving media directly over HTTP
- Can describe metadata
- Variants using a bit rate ladder
- Alternate media renditions
- Live content
- Reuse the same mechanism
- Trading off lower cost distribution via CDN at the cost of latency over real time
Playlist2
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXTINF:9.009,
http://media.example.com/first.ts
#EXTINF:9.009,
http://media.example.com/second.ts
#EXTINF:3.003,
http://media.example.com/third.ts
#EXT-X-ENDLIST
Master playlist3
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1000000
http://example.com/low.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2560000,AVERAGE-BANDWIDTH=2000000
http://example.com/mid.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=7680000,AVERAGE-BANDWIDTH=6000000
http://example.com/hi.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5"
http://example.com/audio-only.m3u8
Master playlist4
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="English", \
DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="en", \
URI="main/english-audio.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="Deutsch", \
DEFAULT=NO,AUTOSELECT=YES,LANGUAGE="de", \
URI="main/german-audio.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="...",AUDIO="aac"
low/video-only.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2560000,CODECS="...",AUDIO="aac"
mid/video-only.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=7680000,CODECS="...",AUDIO="aac"
hi/video-only.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=65000,CODECS="mp4a.40.5",AUDIO="aac"
main/english-audio.m3u8
Implementation
Demo
Using
- videojs
python3 -m http.server
- Sample GStreamer Rust Code5
References
Questions