• Jaskaranvir Singh

Decoding HLS (HTTP Live Streaming) Standard!

Introduction to HLS

Live streaming is now easier than the way it used to be a decade back. With the advent of technology, the protocols and standards of live streaming have changed a lot. Today we have various protocols and standards for live streaming running at the back end. There are live streaming protocols like: -

  • Real-Time Messaging Protocol (RTMP)

  • Real-Time Streaming Protocol (RTSP)

  • Dynamic Adaptive Streaming over HTTP (MPEG-DASH)

  • Microsoft Smooth Streaming (MSS)

  • HTTP Dynamic Streaming (HDS)

  • HTTP Live Streaming (HLS)

In general, the protocols are technical tasks that substantiate the transfer of data from one program to another. And the streaming protocol is a standardized process of sharing/transferring data (maybe a video or audio) to different devices over the internet. The HLS protocol was launched by Apple Inc in 2009. Since then, it has become the most widely used streaming protocol. Most of the devices and applications like smart TVs, desktop browsers for android or iOS support HLS. One of the reasons for its widespread popularity is its easy reach to the audience. Moreover, it’s the safest protocol nowadays for scaling a live stream to bigger audiences. The major advantages of HLS are its effectiveness, robustness, and is a compatible and adaptive protocol. It provides the best video quality and viewer experience irrespective of the connection, software, or device. There are different set of protocols used for different purposes. Data Transfer essentially happens through network communication protocols (USB, FTP, HTTP, HLS etc.) and this communication is managed by network management protocols (such as SNMP) and the communication is secured by network security protocols (such as TLS, SSL etc.)


What is HLS?

When HLS was released, it was only present in Apple devices. It transfers the audio or video over HTTP from an ordinary web server for playback on the iOS-based device which includes all Apple devices. But now it’s supported by all other devices as well like an android device. Irrespective of the device one can easily deliver the video and audio to the audience. It’s a powerful adaptive bitrate protocol. It has the ability to transform to changing scenarios depending on the speed present on both wired and wireless connections. And HTTP is an application layer dealing with the transfer of information between connected devices. The data sent over HTTP is particularly based on requests and responses and nearly all HTTP messages are either a request or a response to a request. During the streaming, the request-response pattern is not followed. The link between the user and server remains stable and open for the duration of the streaming. The server keeps pushing the video information to its user/client so that the user need not request every time for every segment of data transfer.

HLS video streaming protocol features are as follows :

  • Captions

  • Timed metadata

  • Alternate audio and video

  • Fast forward and rewind

  • Adding ads

  • Protection against data

Adaptive Bitrate Streaming in HLS

HLS offers advantages like the Adaptive bitrate streaming protocol. This feature deals with the self-adjusting capability of the video quality while streaming when network condition changes. This keeps the video running smoothly irrespective of the network change caused by bad network connections. Moreover, it enhances the quality of the video as high as the network can support in such cases. If the network slows down, the user's video player detects this, and adaptive bitrate streaming lowers the quality of the stream so that the video does not stop playing. With the increase in the network bandwidth availability, adaptive bitstream enhances the quality of the stream. Adaptive bitrate streaming is possible because HLS creates several duplicate segmented streams at different quality levels during the segmentation process. The user's video player can switch from one of those streams to another one during video playback. The quality of the video is adjustable at any network speed. This permits the clients for various presentations of a single broadcast and smooth switching. making multiple renditions of a single stream substantiates in preventing buffering or any other distortions.


The above table presents various bitrates (kbit/s) with different resolutions and frameworks (keeping the aspect ratio the same)


How Does HLS Work?



The HLS’s functioning is similar to all adaptive streaming technologies. The multiple files are created for distribution resulting in adaptively changing streams to optimize the user’s playback experience. Due to HTTP-based technology, no server is needed for streaming, as all the logics for streaming are available on the player.

The source is encoded into various files at specific data rates and then they are segregated into short chunks of 5-10 seconds duration. Further, these chunks are loaded to an HTTP server with .M3U8 text-based file extension which later directs the player to substantiate more files for encoded streams. The monitoring will be done by the player for changing bandwidth scenarios. If these situations dictate an altar in the stream, the player’s duty will be to check the original manifest file for the location of streams, and then it will stream the manifest file for the URL for the upcoming chunk of content. In general, stream switching is smoother for the viewer.


Major Reasons to Adopt HLS

HLS is now a widely used video streaming protocol. It offers better video delivering features to a greater audience worldwide with the best quality irrespective of the internet speed. The following are the reasons for its popularity :

  • Different CDN (Content Delivery Networks) providers are diverting their investments in protocols like HLS and MPEG-DASH due to their popularity resulting in phasing out of RTMP as they are becoming too expensive to deploy.

  • It lets users make content for various client internet speeds and playback scenarios (4G, 3G, LTE, WIFI, Cellular).

  • HLS offers encryption and authentication for videos on demand.

  • It decreases the CDN costs by delivering only the optimal bitrate to the user network and neglecting the “partial play and complete download” scenario inherent with HTTP progressive streaming.

  • The reach of HLS is more in terms of audience as it optimizes the delivery of the content to different devices.

  • HLS protocol is a key part in the working of the Digital Rights Management (DRM) technology.

The HLS is designed for reliable and dynamic adaptable network conditions which optimize video playback at available network speeds. The popularity and adoption of HLS are on the rise resulting in RTMP decline. Nearly 50% of broadcasters are using the HLS protocol nowadays. The broadcasters are repackaging their RTMP streams into the HLS protocol once they reach the streaming servers because it will ensure smooth streaming across all range of devices without requiring users to download plug-ins.


Disadvantages of HLS

HLS has some demerits associated with it. The major limitation is the latency. As HLS gives priority to the quality of experience over low latency, therefore the content which is presented live is not actually live because due to latency the video content may be viewed at the audience’s end with 20 to 25 second delay. Therefore, HLS is not recommended for online conferencing or any other real-time applications. These will require protocols like Web Real-Time Communications instead.


Conclusion

From a broadcaster’s perspective, reaching the audience and adapting & implementing various video formats is the most important thing. HLS is the most suitable option for this as it converts the codes of the streamed contents into various formats which helps in scalability for all the user devices. The present default playback method on web browsers is HTML5 with which HLS is compatible and this as a result is attracting all broadcasters. Moreover, HLS supports synchronized playback of various streams, embedded closed captions, advertising standards, and many more.

References