HTTP Live streaming or HLS, has enhanced the live streaming industry as a high-quality and seamless streaming service. The term “live” here is inclusive of both live broadcasting and on-demand streaming. Though HLS was designed by Apple for use in only Apple products and apps, it is now accessible across a wide range of devices.
The game changing fact about HTTP live streaming is that it uses the HTTP protocol which is supported by any device using the internet, making it all-inclusive and simpler to implement than streaming protocols requiring dedicated specialized servers. HTTP is basically an application layer protocol for transmitting information between devices connected to a network. The HTTP protocol is used by every website and application accessible by users through any ordinary server.
The basic methodology over HTTP is that it runs on either a request or a response to a request, but with HTTP live streaming this isn’t the case. Here, the client and server connection remains open for the streaming duration, and the server pushes the data to the client without requesting every segment of the video data by the client.
Along with this, video quality gets adjusted automatically depending on the networking conditions without hampering video playback. This feature is known as, “adaptive bitrate streaming” which adjusts the quality of the video according to the changing network bandwidth. So, with a slow network, the user’s video player detects this, and adaptive bitrate streaming adjusts the quality of the video to a lower resolution to keep the video playing. And if higher bandwidth is available, then it pushes the video quality to the highest resolution for better quality streaming. This is possible because during the segmentation process, HLS creates duplicate segmented streams at varying quality levels, which enables the video player to switch from one quality level to another smoothly.
To better understand the HTTP live streaming’s advantages, you should know how it works.
How does HTTP Live Streaming Work?
The HLS works in three stages:
- Server: The live stream originates from a server which can be any ordinary server as HLS is created on HTTP. The video data is encoded and reformatted using .H264 or .H265 video compression. This helps interpret the video data on any device.
Then, the video is segmented into small chunks of usually 5-10 seconds (default) duration lengths each. In addition to this, these video segments are arranged in their respective order in an index file. These index files with a .ts extension, also called as .m3u8 playlist, are segmented into an MPEG-2 transport stream.
In a live streaming scenario, .ts files are continuously added and .m3u8 manifest files are updated continuously with the locations of alternate/ duplicate streams and file chunks of varying quality levels (480p, 720p, 1080p).
- Distribution: Your HLS video is then delivered via the HTML5 web communication protocol, which is the most accepted online standard for web content. On the request by the client’s device, the video stream is then deployed usinga video content delivery networks (Video CDNs) to diverse geographical locations without any dependence on servers. The CDNs cache the video streams which helps in leveraging the video quality according to the network conditions and streaming the videos quickly without any lag.
- Receiving: The video is played on the client’s device, which receives the stream through the CDNs. The video player assembles the video in order by referring to the index files, and switches to higher or lower quality as per network bandwidth availability.
Also, HTTP live streaming is done using Transmission Control Protocol (TCP) instead of UDP, as TCP provides higher-reliability than speed of transmission. But, the speed issue is compensated by adaptive bitrate streaming, improved internet connectivity across the world, and in the worst case, a few extra seconds of lag will not impact the user experience as HLS does not need to be “real time”.
Benefits Of HTTP Live Streaming
- All-device support:
Though HLS was designed for use on iOS devices and Safari, it is now supported on every modern web browser – mobiles, desktops, tablets, laptops, set-top box, etc. devices. It is possible due to HTML5 usage, which frees the developers from worrying about device compatibility of viewers.
- Best quality possible:
The adaptive bitrate streaming feature of HTTP live streaming delivers the best quality of the video possible on the available network bandwidth by measuring the internet connection speed. It dynamically provides viewers with the highest possible video quality while reducing buffering and lagging issues.
Due to its supportability on every device via HTML5 protocol and media source extensions, there is no need to switch to a specific device to watch the live streaming content.
- Security and Privacy:
HLS makes video browsing secure both while viewing the content as well as afterwards. It has better privacy and security features as compared to Flash.
Solution to Latency Issue
The latency or lag in loading the HLS content has increased which used to be low when Flash player was in place. But you can reduce HLS latency with some tips:
- Reduce the encoded segment length duration from 10 to 5 or 6 seconds.
- Use lower bitrates as larger .ts files take longer to upload and download. With multi-bitrate streams, ensure that the first bitrate listed in the playlist is lower than the most used bitrate by the viewers.
- Upload the video segments from the encoder to the web server faster.
Also, with larger segments, the overhead is less and longer time is taken to encode, which provides more space for video data, resulting in better quality.
HTTP live streaming has become a powerful protocol for live streaming in the best possible manner ensuring wide reach of viewers. Its adaptive bitrate streaming technology and serving on HTTP protocol, makes it a smart solution addressing the changing network bandwidths of different viewers and reaching far-off geographical distances in seconds. It has changed the game of live broadcasting to a high-quality and seamless user experience.