What is HTTP Live Streaming (HLS)? Pros & Cons of HLS

The working of HLS is fairly simple. A master playlist (aka master manifest) – which contains information about resolutions, renditions, languages, codec, etc. – is sent to the player.
November 14, 2022
-
Minutes Read

HTTP Live Streaming was born during a tumultuous time. The launch of the iPhone in 2007 set the scene for the smartphone wars. And, with it, came a tectonic shift in content consumption.

Mobile phones were already popular. Users were no longer tethered to their desktops; they could access the internet on the go! It was inevitable that smartphones would further accelerate this trend. So, content providers now had to deliver videos keeping up with this newfound mobility.

But there was a challenge – a sizable one at that! Adobe's Flash Player was the reigning champion of video delivery in those days. However, flash wasn’t well-optimized for mobile devices. For one, it was a battery hog, which was a major concern for users who wanted to watch videos on the go. Flash also wasn’t fine-tuned for touchscreens and certain mobile operating systems didn't have its support whatsoever.

Apple was quick to realize that a new standard was needed, one that could ensure RTMP-like streams on mobile devices, take advantage of the HTML5 specification, and be more efficient with bandwidth usage. So, in 2009, it proposed HTTP Live Streaming (HLS). The streaming protocol has since become the de facto standard for delivering video on all platforms and browsers.

In this article, we will take a closer look at what is HLS, how an HLS stream works, and when you should use it for your projects.

HTTP Live Streaming (HLS)

HTTP Live Streaming is an adaptive bitrate communication protocol created by Apple to deliver video and audio content over the internet. It uses one of the three key web standards – Hypertext Transfer Protocol (HTTP) – to transfer data between servers and clients.

HLS is designed for reliability and scalability on top of cross-device, cross-platform performance. These aspects make it ideal for a range of streaming applications including large-scale live events and video-on-demand (VOD).

When compared to other adaptive bitrate techniques such as MPEG-DASH, HLS is different in that it uses multiple streams with varying bitrates for a given resolution. DASH, conversely, uses a single stream for a bitrate on a certain resolution. So, while DASH provides better performance under fixed network conditions, in the real world, HLS has an edge!

HLS' ability to switch between different streams based on the network connection extends a superior streaming performance. This provides an unparalleled user experience in real-world conditions, as the internet speed always tends to vary, especially on cellular networks. Being an HTTP-based protocol, HLS is easily implemented across devices, making it an attractive option for content providers and platforms alike.

How does HTTP Live Streaming Work?

The working of HLS is fairly simple. A master playlist (also called a master manifest) – which contains information about resolutions, bitrate combinations (renditions), languages, codec, metadata, etc. – is sent to the player. Each of these renditions has a separate playlist (also called a child manifest) that lists out their names, sequence, and respective URLs (URIs).

The player then downloads these playlists and starts playback. While the video is playing, the client switches between renditions based on the network conditions of the device. All of this heavy lifting is done in the background and ensures uninterrupted playback.

The image above represents a multivariant HLS playlist. It begins with the #EXTM3U tag, which is compulsory and represents an extended M3U file. The #EXT-X-STREAM-INF informs the player that the next URL (URI) is another playlist file, i.e. the child manifest.

The #EXT-X-STREAM-INF tag contains several parameters, including BANDWIDTH (upper bound bitrate in bits per second) and CODECS (RFC-6381-based format identifiers for audio and video separated by comma). The CODECS parameter is optional but highly recommended. It informs which encoder is used for audio and video streams. The same holds for RESOLUTION (display size in pixels), FRAME-RATE (maximum frame rate), and AVERAGE-BANDWIDTH (average bitrate). For HDCP protection, you can also use the HDCP-LEVEL parameter. All you have to do is use TYPE-0 (for HD resolution) and TYPE-1 (for resolutions greater than HD).

Here’s another example of a more advanced multivariant playlist.

In this example, we can see a playlist with two groups of additional audio renditions (represented by GROUP-IDs of audio-lo and audio-hi). Every media element (in this case, audio files for different languages) should be represented by the tag EXT-X-MEDIA and its TYPE (AUDIO, VIDEO, SUBTITLES, or CLOSED-CAPTIONS.)

Also, every media selection group should have its elements encoded with the same characteristics. For example, they should have the same codec, maximum bandwidth, etc.

What is the Architecture of HLS?

HTTP Live Streaming has a three-tiered architecture – Origin Server, Distribution Server (edge), and Client.

1. Origin Server

The origin server receives an AV input and converts it into a compressed file ready to be distributed. Typically, it comprises a media encoder and a stream segmenter. The media encoder encodes the media file into compatible formats. The stream segmenter then splits the encoded media into small segments and creates an index file. The index file contains the metadata of the media segments.

2. Distribution Server (Edge)

The distribution server, or a CDN, is responsible for delivering the content to the clients. It comprises an HTTP server and a media server. The HTTP server stores the index file and the media segments. A media server streams the media files to the clients.

3. Client

The client is responsible for requesting and receiving the content from the distribution server. It comprises an HTTP client or a media player. The HTTP client requests the index file from the HTTP server. The media player then uses the index file to request the media segments from the media server and plays them.

Features

HTTP Live Streaming comes with a plethora of features that make it the go-to choice for content providers. Let’s have a look at some of its key features:

1. Live, on-demand, and event video streaming

One of the best things about HLS is that it supports live, on-demand, and event- playlists. This means that you can use the same protocol to live stream an event as well as an existing video file stored on your server. However, since HLS prioritizes video quality over latency, the end-to-end usage of the streaming protocol can lead to a delay of up to 45 seconds in streams. This challenge is typically resolved by using a different protocol (such as RTMP) for ingestion. It’s a part of the LL-HLS extension and brings the latency down to approx. 2 seconds.

2. Cross-platform compatibility

Another great deal about HLS is that it’s compatible with all major browsers and platforms. This includes Safari, Edge, Chrome, Firefox, Android, iOS, tvOS, Playstation 4, Xbox One, and more. So, whether you want to deliver content to users on desktop, mobile devices, or smart TVs, HLS is what you need! 

3. Adaptive bitrate streaming

HTTP Live Streaming also supports multiple bitrates. This means that you can encode your videos into different bitrates for different devices and internet speeds. The client will then automatically switch between these renditions based on network conditions to ensure a seamless video delivery. This results in a better user experience with no sign of buffering or low-quality video streams.

4. Encryption and authentication

HTTP Live Streaming also supports encryption and authentication. This means that you can encrypt your video streams to protect them from unauthorized access. You can also authenticate users before they are able to access your content. This is especially useful if you want to deliver content behind a paywall or restrict access to certain countries or regions.

5. Support for multiple languages

Another great thing about HLS is that it supports multiple languages. This means that you can create variant playlists for different languages and the client will automatically switch between them based on user preference settings. So, whether you want to deliver content in English, Spanish, French, or any other language, HLS has got you covered!

6. Closed captioning

Closed captioning is a feature that allows people who are deaf or hard of hearing to follow along with audio content. HLS supports closed captioning by allowing you to embed captions into your video streams. These captions are then displayed on the screen along with the video for easy accessibility.

7. Subtitles

Subtitles are similar to closed captions but are typically used for foreign-language films or TV shows where viewers may not be familiar with the spoken dialogue. Similar to closed captioning, HLS allows you to embed subtitles into your video streams so that they can be displayed on the screen along with the video itself.

8. Audio descriptions

Audio descriptions are a type of audio track that describes what is happening on the screen for people who are blind or have low vision. HLS supports audio description tracks, called Descriptive Video Service (DVS), by allowing you to embed them into your video streams. Your DVS must be marked with the attribute CHARACTERISTICS="public.accessibility.describes-video".

Pros of Using the HLS Protocol

Now that we’ve looked at what is HLS and how it works, let’s take a look at some of its key advantages:

1. All-Device Delivery

As mentioned earlier, one of the best things about HLS is that it’s compatible with all major browsers and platforms. This means that you can use the same protocol to stream content to users on desktops, mobile devices, smart TVs, and more. So, whether you want to deliver content to users on iPhone or Android devices, HLS is your go-to streaming protocol!

2. Excellent Quality

When streaming digital content, quality is of the essence. Today, users are spoiled for choice. If they don’t like what they see on your site, they can easily move on to the next one. This is where HLS really shines. The streaming protocol uses adaptive bitrate streaming to automatically adjust video quality based on network conditions. This ensures that users always have a great viewing experience, regardless of their internet speed or connection quality!

3. Cost-Efficient

When it comes to streaming digital content, the cost is always a major concern. HTTP Live Streaming is an extremely cost-effective solution as it doesn’t require any additional hardware. All you need is a standard web server and you’re good to go!

4. Privacy and Security

Another great thing about HLS is that it supports encryption and authentication. This means that you can encrypt your video streams to protect them from unauthorized access. Using HLS, you can also create standard DRM solutions such as Microsoft PlayReady, Google Widevine, and Apple FairPlay. This also makes HLS an ideal choice for content that needs to be delivered behind a paywall or restricted to certain countries/regions.

Cons of Using the HTTP Live Streaming Protocol

While HTTP Live Streaming comes with a lot of advantages, it also has some drawbacks that you should be aware of before using it for your own projects. Let’s take a look at some of its key disadvantages:

1. Latency

One of the biggest challenges with HLS is latency – the time it takes for video data to travel from the server to the client. This can be problematic if you’re trying to stream live events where every second counts! There are various solutions available that can help reduce this latency (more on this later), but it’s something you should keep in mind if you’re planning on using HLS for your project.

2. Internet Speed

Another drawback of HLS is that it requires a minimum internet speed of 400 kbps for low-quality videos and up to 8 Mbps for HD quality. This can be a major issue in areas with poor internet coverage or for users with limited data plans.

Solutions to the Latency Problem

There are various solutions available that can help reduce latency when using HLS. Some of them include:

1. Reducing the Segment Size

While Apple recommends a length of 6 seconds, lowering the segment size (target duration) can help decrease latency significantly. It’s because the client waits for a published segment from the server. The server cannot publish it before the predetermined target duration. So, before a player can even download a segment, it is already delayed by the 'target duration' seconds. On top of it, multiple segments are kept as a buffer to ensure seamless delivery even in patchy networks. This includes every segment’s encoding, packaging, playlist listing, and downloading, which adds to the latency by a factor of 4 to 7 times your segment size.

2. Announcing Segments Beforehand

You can try announcing segments before they are actually available. This is done by setting the #EXT-X-PRELOAD-HINT tag to indicate the most likely location of the next stream.

3. Using a different ingest protocol

Using a different ingest protocol transfers the server-side encoding to a faster encoder, which introduces superior efficiency. You can also use Low Latency HLS (LL-HLS). LL-HLS is a part of the HLS protocol, but with a few workarounds. It has a latency of (around 2-5 seconds).

When to Use the HLS Protocol?

HTTP Live Streaming is an extremely versatile streaming protocol. It can be used for a wide range of applications including live events, on-demand content, and more. Here are some situations where you should use HLS:

1. If you want to delight your viewers

HLS was developed with the goal of providing an uninterrupted and great viewing experience to users. So, if you want to ensure that your viewers have the best possible experience when watching your content, HLS is the way to go!

2. If you’re streaming live events

HTTP Live Streaming is the perfect choice for streaming live events such as sports, concerts, conferences, etc. The protocol is designed for reliability and scalability so that you can stream large-scale live events without any hiccups! The only thing that you need to work around is latency, which has a couple of quick fixes.

3. If you want to reach a global audience

One of the best things about HLS is that it’s compatible with all major browsers and platforms. This means that you can use the same protocol to deliver content to users on different devices and across different geographical regions. So, if you want to reach a global audience with your content, HLS should be your go-to streaming protocol!

4. If you need a simple implementation

Another great thing about HLS is that it’s extremely easy to implement. All you need is a standard web server and you can start streaming content right away!

When Not to Use the HLS Protocol?

While HTTP Live Streaming comes with a lot of advantages, there are also some situations where you should avoid using it. Here are some situations where you shouldn’t use the HLS protocol:

1. If latency is a major concern for you

As mentioned earlier, one of the biggest challenges with HLS is latency – the time it takes for video data to travel from the server to the client. This can be problematic if you’re trying to stream live events like web conferencing or sports! There are various solutions available that can help reduce this latency, but it’s something you should keep in mind if you’re planning on using HLS for your project.

2. If you have limited bandwidth

Another drawback of HLS is that it requires a minimum internet speed of 400 kbps for low-quality videos. Anything less can cause challenges not only in streaming but also keeping the lip sync intact. So, if you’re looking to deliver content to users in these situations, HLS may not be the best choice for you!

To Wrap It Up...

HTTP Live Streaming is an extremely versatile streaming protocol. It comes with a lot of advantages including all-device delivery, excellent quality, cost-efficiency, privacy and security, support for multiple languages, closed captioning, subtitles, and audio descriptions.

While it has some drawbacks such as latency and internet speed requirements, there are various solutions available that can help address these challenges. So, if you’re looking for a streaming protocol that is compatible with all major browsers and platforms, delivers great quality, and is easy to implement, HLS should be your go-to choice!

Table of Contents
Share this post

Build your video empire

Your outstanding video channel in one place: Video CMS, Community, Marketing & Analytics.
Free training & 24-hour support
99.99% uptime the last 12 months
Serious about security & privacy
Video Distribution Platform & Monetization
Contact Us

FEATURES

RESOURCES

🇮🇹 Made with love & passion in Italy.
🌎 Enjoyed everywhere
© 2022 Teyuto. Via Ippolito Pindemonte, 63 - 50124 FIRENZE - P.IVA: 06781570483
Terms and conditions - Privacy Policy - Cookie Policy