Everything You Need to Know About HTTP Live Streaming (HLS)

September 27, 2022
Everything You Need to Know About HTTP Live Streaming HLS - CDNetworks

Contents

Try CDNetworks For Free

Most of our products have a 14 day free trial. No credit card needed.

Share This Post

The way video content is delivered online has changed rapidly in the last few decades. While Adobe’s Flash used to be a household name in the 90s and 2000s, it has almost disappeared with the rise of online video streaming. New video streaming protocols like HLS are enabling faster, more reliable and safer video content delivery today.

What Is HLS?

HTTP live streaming or HLS is a streaming protocol used for delivering media content to consumers over the internet. It is a popular streaming protocol and widely used for streaming video content, both live and on-demand.

How Does HLS Work?

The process by which HLS delivers content involves a few steps.

Live Stream Diagram

First, an encoder takes the raw input (audio or video) and produces a compressed stream, which is used for transmission and storage of media.

Then, a streaming server breaks this stream into a series of small media files to be placed on a web server. This streaming server also creates and maintains an index file with the list of the media files, which is described as the M3U8 playlist. The URL of M3U8 playlist is published on the web server.

When the end user wants to get the stream over HLS, the player reads the M3U8 index and requests the listed media files in the right order and displays them as one coherent file.

Adaptive Bitrate Streaming

Adapting bitrate streaming (ABR) is a feature of HLS that makes it stand out among streaming protocols. This is a feature that allows the video quality to adapt according to the network conditions, even during the middle of the stream. So even if the end users’ network connectivity fluctuates, the video will still keep playing – at a lower quality if the connection slows down and at the maximum quality when the connectivity is back up to high.

The Pros of HLS

HLS offers a number of advantages that make it a favorable streaming protocol such as its:

    • Compatibility: HLS supports consumption of streamed content on a wide variety of devices – smartphones, tablets and laptops.
    • Smooth Playback: The ABR feature makes HLS immensely useful for video streaming, especially during broadcasts which cannot be interrupted, even at the cost of quality.
    • Cost Effectiveness: Since HLS is based on HTTP and can be delivered over content delivery networks without the need for extension on any device, it is also cost effective.
    • Security: HLS is also a more secure protocol compared to solutions like Flash.
  • Scalability: HLS can scale the streaming to support millions of viewers around the world simultaneously and without compromising on the quality.

Cons of HLS

Despite the benefits, HLS is not perfect and definitely not a one-size solution for all streaming needs. Here are two common cons of HLS streaming.

  • High Latency: Compared to some other streaming protocols, HLS has a higher latency. This means that there is a lag of up to 30 seconds or more that viewers experience when they consume HLS streamed content.
  • Slow Internet Speed: Due to the relatively higher latency, HLS streaming may not be ideal for use cases where rapid live streaming is needed, such as in video gaming or sports broadcasting.

Read More:

When Is It Best to Use HLS Streaming?

HLS may not be the best streaming protocol to use all the time. However, there are some specific cases and considerations for which it can be the best choice.

Best for Mobile Devices

HLS streaming is ideal when your consumers use their mobile devices and tablets to view the streamed content. With a high proportion of web traffic today originating from mobile phones, your streaming solution will have to work with these devices. HLS therefore is almost essential for mobile streaming.

Best for HTML5 Video Player

Since the HTML5 video player has almost become the default standard for playing video content on websites, apps and mobile devices, the streaming protocol should be compatible with this technology. HLS, unlike some other protocols, is supported by HTML5 and you can use it to deliver content to the video player.

HLS vs Other Streaming Protocols

There have been other protocols in use before HLS that still survive today and even get preference in some scenarios. Here is a comparison of the common ones to HLS.

  • HLS Versus RTMP

Real-Time Messaging Protocol or (RTMP), also known as Flash used to be a common streaming protocol. But is losing out today due to the fact that modern browsers are phasing out support for Flash. It still is used by many broadcasters though, since it is a standard protocol for capturing video streams from a camera or encoder.

  • HLS Versus MSS

MSS, which stands for Microsoft Smooth Streaming, is another protocol that uses ABR for live streaming. But it loses out to HLS because of its limited adoption as it is a proprietary technology to Microsoft devices. It finds its biggest adoption in the Xbox One game console.

  • HLS Versus MPEG-DASH

MPEG-DASH stands for Moving Picture Experts Group-Dynamic Adaptive Streaming Over HTTP and is the first HTTP-based international-streaming protocol. Its unique value lies in its ability to play video almost universally and supports formats including H.264, H.265, VP8/9 and AV1.

Read More:

What Is Low-Latency HLS and How Does It Reduce the Latency

HLS has so far been a protocol that priorities quality and reliability over latency. But Apple is innovating on this challenge and introducing Low-Latency HLS. This lowers video latencies when streamed over public networks, to what can be expected in standard television broadcasts.

CDNetworks also offers its Live Streaming solution supporting this Low-Latency HLS, with the same goal of reducing latencies while maintaining reliability.

CDNetworks’ Tuning over HLS 

Besides Low-Latency HLS, a well tuned HLS is also an option to a lower-latency live streaming. As an early adopter of HLS,  CDNetworks is specialized in HLS fine-tuning. Below we provide several ways to reduce the latency when streaming over HLS.

Set Number of Chunks for the First HLS playlist

Normally, the streaming servers has to store enough chunks before the playback when using HLS. This depends on the player. The playback usually begins after the player gets the first HLS manifest with 3 chunks in it. Some players however, support a number of chunks less than 3. In such circumstances, you can adjust this number to decide how many chunks are received and packaged in the first manifest before the playback begins to reduce the latency.

Reduce the Keyframe Interval

Keyframe Interval, also well known as GOP(group of pictures), is a key factor that impacts the chunk size. As HLS chunks will be created on keyframe boundaries, the larger the GOP you set, the bigger chunks you have, which might determine how much latency you will have with your live broadcast. We recommend setting the GOP at 2~3 seconds when pushing a stream via encoders like OBS and Wirecast.

Set Minimum Number of Chunks Stored

CDNetworks’ live broadcast solutions will store several chunks for a better streaming performance. We recommend at least 3 chunks being stored before delivered. Of course, the number can be set at a smaller value to get a lower latency. But the fewer chunks stored, the more likely you will see the playback lagging.

Conclusion

The video streaming landscape has seen a flurry of activity in the last few years. Aided by the rise of new streaming protocols and wider internet penetration, more businesses have embraced the opportunity provided by video streaming.

HLS is one of the most widely supported protocols today for streaming video. If your business is based on delivering high quality video streaming to end users without any significant interruptions, HLS is one protocol that you should definitely consider.

More To Explore