HLS Streaming Protocol — Pros and Cons of Choosing it

Kavirajan ST
Jul 14, 2019 · 4 min read

In earlier days playing videos through online was tremendously challenging. If a video has to be played in different screen sizes with different internet speed, it was not an easy task as the internet speed would be entirely different in both rural and urban areas. Earlier if the video source is HD, the same video will be played as the output. And because of the source file size, the video was not possible to be played on low bandwidth i.e 2G network.

In 2009, Apple came up with a solution called HTTP Live Streaming or HLS protocol.

Role of HLS protocol:

In order to optimize the media source, this protocol encodes as segments (.ts) of media files from servers to devices by rendering the content in different bitrate versions and splits into multiple chunks.

Adaptive Bitrate Streaming

Therefore based on a wide range of user’s bandwidth environment (2G, 3G, 4G, LTE, WIFI Low, WIFI High) the video can be played with respective HLS bitrate versions 240p, 360p, 480p, 720p and 1080p which also allows the user to switch from one bitrate version to another.

HLS Architecture:

HLs uses a standard web server for distributing audio and video content. And It requires a specific software (FFmpeg, avconv etc) to fit into the proper format transmission in real time.

The architecture consists of the following 3 parts:

HTTP Live Streaming Architecture

1. Server:

The server component encapsulates the input video flow in a proper format for the delivery. The video is then segmented it into different files for distribution. During the process of intake, the video is encoded and segmented in order to generate video fragments and index file.

  • Encoder: Organizes the video files in H.264 format and audio in AAC, MP3, AC-3 or EC-3. Then outputs it in an MPEG-2 transport stream.
  • Segmenter: The stream segmenter divides the MPEG-2 TS file into a series of short media files of equal length saved as .ts files. It also creates and maintains an index file which contains references of the fragmented files, saved as .m3u8. HLS recommended segment .ts size is 10 seconds. To have better encoding efficiency and flexibility for stream adaption to bandwidth changes, HLS chunk sizes can be customized around 2 to 4 seconds.

2. Distributor:

The distributor component consists of standard web server. It accepts client requests and delivers all the resources (.m3u8 playlist file and .ts segment files) required for streaming.

3. Client:

The client software requests and downloads all the resources and then resembling them so that the media can be presented to the user in a continuous stream. The client software downloads first the index file through a URL and then the several media files available. The playback software assembles the sequence for allowing continued display to the user.

Advantages of HLS streaming:

Below I’ve mentioned some of the major advantages in terms of video streaming quality:

  • The broadcasters can easily deliver audio or video streams using the adaptive bitrate process supported by HLS. As a result of this, every viewer can experience the best quality stream based on the internet connection.
  • The viewers can switch to any bitrate version at any time.
  • The HLS streaming protocol is widely supported by all client software like iPhones, iPads, and the iPod Touch, Google Chrome, Safari, Microsoft Edge, iOS, Android, Linux, Microsoft, and MacOS platforms.
  • As most of the clients supports MPEG DASH, but clients like Apple Safari and iOS devices does not support it. In that way, HLS would always be a better choice.

Disadvantages of HLS streaming:

Even though we have so many advantages, here are a few cons why one would not use HLS streaming:

  • HLS can be overpowered in terms of quality. But when it comes to latency, it is not built for delivering video quickly. In real-time HLS results in minimum of 20 seconds of latency.
  • The HTTP live streaming requires at least 3 segments to remain in queue before it allows the video playback.
  • HTTP live streaming is limited by its key frame interval, buffer requirements and packet size, pushing your stream back a delay between 20 to 60 seconds. Therefore, such scenario results as a major drawback in live streaming events.
  • HLS only supports playing streams. Unlike WebRTC that has a spec for publishing from a browser, HLS is a subscriber-only protocol.


As there are various advantages for choosing HLS streaming, there are quite a few cons where one has to give it a thought especially when going for live streaming. So choosing HLS protocol mainly depends upon your purpose of video content that you are going to stream. If you consider only the video quality then going for HLS streaming is a great choice. But when you go for interaction based live streaming purpose without latency issue, then just have to go for some other protocol.

AV Transcode

Informative articles about audio and video transcoding.

Kavirajan ST

Written by

Infrastructure Specialist, FOSS Enthusiast. Working knowledge in AWS, GCP, Openstack, Ffmpeg, Docker, Kubernetes, Jenkins, Git, Ansible, Terraform, Prometheus.

AV Transcode

Informative articles about audio and video transcoding.

More From Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade