Real Time Chat

What is Streaming? How does HTTP Live Streaming Work?

Google+ Pinterest LinkedIn Tumblr

Table of Content

  1. Real-time Streaming
  2. Is streaming and downloading the same?
  3. How does streaming work?
  4. Which transport layer protocol is used while streaming?
  5. What is HTTP streaming?
  6. Working of HTTP streaming
  7. Advantages and disadvantages of HTTP streaming 
  8. HTTP streaming Latency & solution 
  9. Conclusion


Real-time Streaming 

Streaming is the technology that transmits audio, video, or any kind of data in a continuous flow using a wired or wireless internet connection.  Streaming can be defined as media content that includes live or recorded audio/video data that is delivered on the devices like TV, computer, tablets, home assistant, or smartphones which can be played via the internet on a real-time basis. 

The “Streaming” word has gained huge popularity for a decade whether it is gaming, knowledge sharing sessions, corporate meetings, or listening to your favorite podcast. The rise of streaming has grown tremendously from the last two years when things started moving online due to the COVID-19 pandemic. The popularity will keep on growing with rising technologies.

Is Streaming and Downloading the same?

No, Streaming is watching everything in real-time which is quite effective than downloading. Downloading a video file is required to be saved on your computer device and you can’t watch it unless the file is completely downloaded. Streaming instead makes the video available directly on your web browser without having to download it which definitely saves your time and helps you get the content in real-time. 

In general, let’s take an example of a lake and river where water is the common element.  Here we can assume water as a video file and lake as a device where water is stored and it is water is never changed, while  River(stream) is where there is the continuous flow of water.

How does streaming work?

Streaming is nothing but sending data over the internet in a continuous flow. So, just like other pieces of information sent over the internet, the streaming data i.e. audio, or video files are broken down into small chunks of data and sent over the internet. These data packets are later interpreted by the web browser to audio and video.

Which transport layer protocol is used while streaming?

The Protocols usage depends on the use cases that one opts for streaming, few are comfortable with UDP while few opt for TCP. These UDP and TCP are transport layer protocols responsible for sending data packets across the network. 

TCP is considered a secure way of communication as compared to UDP because it creates a dedicated connection before sending out the data, and makes sure that data arrives in a sequential manner. UDP is unlike TCP, they just make sure the data packets are sent across the network spontaneously without taking care of packet drops.

So, TCP can be considered as one of the reliable protocols to send data packets across networks as compared to UDP. In a simple way, TCP can be considered as a courier service that takes your sign while delivering your package UDP can be a courier service that delivers the package at your doorstep without taking your signature. 

For streaming, those who want a reliable connection and don’t want their data packets to be dropped can use TCP. while UDP can be used for those who need speed and don’t care much about small packet drops.

What is HTTP live streaming?

HTTP live streaming (HLS) is widely used for video streaming Protocol, though it is called HTTP live streaming, it can act as both on-demand and live streaming. HLS breaks the large video files into smaller downloadable HTTP files so that the client browser can download files then playback the video.

Since HTTP is supported by all the devices that are connected to the internet which makes the usage simpler and less complex to get video streaming on any device.

On the other hand, it also supports “adaptive bitrate video delivery”  which means it can increase and decrease the video quality depending on the network which doesn’t interrupt the playback.

Fact: HTTPS live streaming was developed by Apple for use on Apple products which is now widely used across the worldwide network.

Working of HLS

Server: An HLS stream originates from a server where (in on-demand streaming) the media file is stored, or where (in live streaming) the stream is created. Because HLS is based on HTTP, any ordinary web server can originate the stream.

Two main processes take place on the server:

  1. Encoding: The video data is reformatted so that any device can recognize and interpret the data. HLS must use H.264 or H.265 encoding.
  2. Segmenting: The video is divided up into segments a few seconds in length. The length of the segments can vary, although the default length is 6 seconds (until 2016 it was 10 seconds).
    • In addition to dividing the video into segments, HLS creates an index file of the video segments to record the order they belong in.
    • HLS will also create several duplicate sets of segments at different quality levels: 480p, 720p, 1080p, and so on.

Distribution: The encoded video segments are pushed out to client devices over the internet when client devices request the stream. Typically, a content delivery network (CDN) will help distribute the stream to geographically diverse areas. A CDN will also cache the stream to serve it to clients even more quickly.

Client device: The client device is the device that receives the stream and plays the video – for instance, a user’s smartphone or laptop. The client device uses the index file as a reference for assembling the video in order, and it switches from higher quality to lower quality picture (and vice versa) as needed.

Advantages of HLS 

  • All device delivery: As discussed earlier since every internet-connected device supports HTTP,  HLS can be used to stream video almost everywhere. 
  • Cost-efficient:  HLS formats are operated at a lower cost. the format is supported by devices via HTML5 and media extensions. 
  • Excellent quality: Since the technology uses adaptive bitrate video delivery it makes sure that the high-level video is delivered with respect to the network without interrupting the playback. 
  • Security & privacy:  The final benefit of HLS that we’ll highlight here is security. Compared to Flash, HLS simply provides a more secure browser for your viewers—both when they’re watching your content, as well as afterward.

Disadvantages 

  • Latency: Latency refers to the elapsed time between when an event occurs in the real world, and when viewers can see it. Essentially, it’s the time that it takes for a video to be recorded by a camera, processed by an HLS encoder, transmitted across the internet, distributed to “edge” servers, and decoded for viewing.

Note that latency doesn’t account for slowdowns due to internet speed and bottlenecks; these are largely separate issues.
HLS was designed to maximize quality, not to minimize absolute latency. Its keyframe interval, packet size, and playback buffer requirement simply aren’t suitable for super-rapid live streaming. Therefore, it usually adds a delay of 20-60 seconds to your stream. These live streaming software platforms offer integrated low latency solutions, and those are the ones to consider.

This usually is only a problem for a small subset of live streamers—notably, video gamers and sports fans. In these situations, speed is important. However, most users can easily ignore the small latency of hosting an HLS stream as it will have no impact on viewer satisfaction or experience. For almost all viewers, a high-quality video that is watchable anytime, on any device, is more important than latency.

Conclusion

In this blog, we learned what is streaming and how transport layer protocols are used to stream real-time audio and video to the devices. Later we tried to understand what HTTP live streaming is and what are the Pros and cons of using HLS- let us know in the comments if you have any thoughts or questions about both.

Author