Live Streaming Protocols

Live Streaming Protocols

Variable bitrate streaming in a nutshell

HLS and MPEG-DASH

These are the most commonly used Live Streaming protocols. Where HLS -> HTTP Live Stream which is a standard made by Apple in 2008 with the launch of iPhone 3g. It is a protocol accepted by all all apple devices and browsers along with android devices but chromium based browsers.

I had a lot of fun experimenting with these protocols even though I was not able to completely implement MPEG-DASH but that's probably because both lack of technical skills and lack of good documentation

Heres what I know

HTTP Live Streaming supports video on just about every device. Although it was originally created for use on Safari and iOS devices, HLS is now supported on almost every modern web browser—mobile, desktop, tablet, etc.

HLS uses a method called Adaptive Bitrate Streaming. This method measures the internet speed available to each viewer of a given video. Then, the video quality they are being served is adjusted dynamically

Video delivered using HLS, if configured properly, will dynamically provide you with the best possible video quality while minimizing buffering and lagging. This approach leads to a superior user experience.

HLS was designed to maximize quality, not to minimize absolute latency. Its keyframe interval, packet size, and playback buffer requirement simply aren’t suitable for super-rapid live streaming. Therefore, it usually adds a delay of 20-60 seconds to your stream. These live streaming software platforms offer integrated low latency solutions, and those are the ones to consider.

Breakdown of HLS works

  1. Capturing devices (cameras, microphones, etc.) capture the content.
  2. The content is sent from the capturing device to a live video encoder.
  3. The encoder transmits the content to the video hosting platform via RTMP.
  4. The video hosting platform uses HLS ingest to transmit the content to an HTML5 video player.

Technical Overview of HLS Streaming

With that background in mind, how does HLS streaming technology work?

First, the HLS protocol chops up MP4 video content into short (10-second) chunks with the .ts file extension (MPEG2 Transport Stream). Next, an HTTP server stores those streams, and HTTP delivers these short clips to viewers on their devices.

HLS will play video encoded with the H.264 or HEVC/H.265 codecs.

The HTTP server also creates an M3U8 playlist file (e.g. manifest file) that serves as an index for the video chunks. That way, even if you choose to broadcast live using only a single quality option, the file will still exist.

Now, let’s consider how playback quality works with HLS video streaming. With this protocol, a given user’s video player software (like an HTML5 video player) detects deteriorating or improving network conditions.

If either occurs, the player software first reads the main index playlist and determines which quality video is ideal. Then the software reads the quality-specific index file to determine which chunk of video corresponds to the point at which the viewer is watching.

This is what an .m3u8 playlist will look like

#EXTM3U
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:4
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.0,
http://example.com/movie1/fileSequenceA.ts
#EXTINF:10.0,
http://example.com/movie1/fileSequenceB.ts
#EXTINF:10.0,
http://example.com/movie1/fileSequenceC.ts
#EXTINF:9.0,
http://example.com/movie1/fileSequenceD.ts
#EXT-X-ENDLIST

These are the tags used in the Video on Demand playlist example:

EXTM3U: Indicates that the playlist is an extended M3U file. This type of file is distinguished from a basic M3U file by changing the tag on the first line to EXTM3U. All HLS playlists must start with this tag.

EXT-X-PLAYLIST-TYPE: Provides mutability information that applies to the entire playlist file. This tag may contain a value of either EVENT or VOD. If the tag is present and has a value of EVENT, the server must not change or delete any part of the playlist file (although it may append lines to it). If the tag is present and has a value of VOD, the playlist file must not change.

EXT-X-TARGETDURATION: Specifies the maximum media-file duration.

EXT-X-VERSION: Indicates the compatibility version of the playlist file. The playlist media and its server must comply with all provisions of the most recent version of the IETF Internet-Draft of the HTTP Live Streaming specification that defines that protocol version.

EXT-X-MEDIA-SEQUENCE: Indicates the sequence number of the first URL that appears in a playlist file. Each media file URL in a playlist has a unique integer sequence number. The sequence number of a URL is higher by 1 than the sequence number of the URL that preceded it. The media sequence numbers have no relation to the names of the files.

EXTINF: A record marker that describes the media file identified by the URL that follows it. Each media file URL must be preceded by an EXTINF tag. This tag contains a duration attribute that's an integer or floating-point number in decimal positional notation that specifies the duration of the media segment in seconds. This value must be less than or equal to the target duration.

source: Apple

Read More:

My attempt in making a Live Streaming Server

github.com/iresharma/Variable-bitrate-Live-..

MGNIX Config: nginx.com/blog/video-streaming-for-remote-l..

Did you find this article valuable?

Support Watch Iresh Struggle by becoming a sponsor. Any amount is appreciated!