DEV Community

Ahmed Ossama
Ahmed Ossama

Posted on

Adaptive bitrate streaming

Introduction

In this post I will try to explain how video streaming happen, for example when you watch a YouTube video or any online streaming, we will know the protocols behind this and focusing on the Adaptive bitrate over HTTP.
ALERT! The article is a little bit academic so it's ok if you miss some concepts, Happy reading ')

What was before?

Just having a single stream sent out, if you are lucky you will stream it, otherwise you will suffer from repetitive pauses or to watch with the lowest quality.
Another approach is to download the whole video in the main memory in order to guarantee watching, but what if you don’t have enough memory, however it's data consuming since most of us don't watch a whole video, most people nowadays watch only 20% of the video as the content growth is very high.
So we conclude that we have more than one type of video streaming.

Types of http video streaming

The Internet uses HTTP streaming over TCP most commonly for video streaming services.
(Youtube, Netflix, etc).

Regular HTTP Streaming: It completely downloads the video to the client server.
Progressive download: Progressive downloading of the video at a fixed quality.
Adaptive streaming over HTTP: Combination of Adaptive video quality control and progressive Downloading.

Adaptive streaming

Image description
Adaptive bitrate streaming is a technique used in streaming multimedia over computer networks. While in the past most video or audio streaming technologies utilized streaming protocols such as RTP with RTSP, today's adaptive streaming technologies are almost exclusively based on HTTP and designed to work efficiently over large distributed HTTP networks such as the Internet. It works by detecting a user's bandwidth and CPU capacity in real time and adjusting the quality of the media stream accordingly. It requires the use of an encoder which can encode a single source media (video or audio) at multiple bit rates. The player client switches between streaming the different encodings depending on available resources. "The result: very little buffering, fast start time and a good experience for both high-end and low-end connections."

More specifically, adaptive bitrate streaming is a method of video streaming over HTTP where the source content is encoded at multiple bit rates. Each of the different bit rate streams are segmented into small multi-second parts. The segment size can vary depending on the particular implementation, but they are typically between two and ten seconds. First, the client downloads a manifest file that describes the available stream segments and their respective bit rates. During stream start-up, the client usually requests the segments from the lowest bit rate stream. If the client finds that the network throughput is greater than the bit rate of the downloaded segment, then it will request a higher bit rate segment. Later, if the client finds that the network throughput has deteriorated, it will request a lower bit rate segment.

Transcoding: Converting from one or more codecs, bitrates, or resolutions to others.

Image description

The bitrate changes with time as the resources change in order to adapt with it.

So, what about the client side or actually how the player handles all of this..

Player Switching algorithm depends on:

Network throughput
Screen size (Playing with larger bitrates in a small screens will not make sense)
Rendering speed(fps) in games for example.
Buffer size
Previous ABR switches

Popular Implementations

MPEG-DASH
Adobe HTTP Dynamic Streaming
Apple HTTP Live Streaming
Microsoft Smooth Streaming
QuavStreams Adaptive Streaming over HTTP
Uplynk
Self learning clients

Youtube MPEG dash

MPEG-DASH is the only adaptive bit-rate HTTP-based streaming solution that is an international standard.

Image description

Here simulating youtube mpeg dash operations where changes occur in user resources may lead to an adaptive change from a higher bitrate to a lower one whether in the video or the audio but it’s most likely in the video since it leads to a bigger change than the audio.

Trick mode : is when we seek back (rewind) the video it will reset and go back to the default resolution.

Relation between the bitrate and resolution

Image description
Bitrate is the amount of data encoded for a unit of time, and for streaming is usually referenced in megabits per second (Mbps) for video, and in kilobits per second (kbps) for audio. From a streaming perspective, a higher video bitrate means a higher quality video that requires more bandwidth. So why doesn’t everyone just upload at the highest bitrate possible? Well, not every viewer can download at the highest bitrate possible.

Some Cons

HTTP based adaptive bitrate technologies are more operationally complex than conventional streaming technologies. Here are few thoughts that outline some of those complexities:

File Size: In HTTP based adaptive bit rate streaming, content is segmented into smaller blocks or objects. Most CDNs (Content Delivery Networks) struggle with large VOD files, especially while handling block sizes in storage. Decreasing block sizes may result in inefficient storage, affecting performance and causing a poor viewing experience.

Network Overload: HTTP based adaptive bit rate video streams cause more network traffic than MMS or RTSP streams. This is because HTTP based adaptive bit rate video streaming technology is very aggressive and fills up pipes whenever it can whereas regular streaming mechanisms have certain caps and limits.

Questionable Quality of Service: While viewers expect a quality viewing experience, there’s no guarantee to the quality of service delivered to viewers as QoE technologies sometimes do not meet up to the requirements. A quality video viewing experience is one where there is no buffer lag, but here there is no guarantee of delivering a true HD video.

The “Thundering Herd'' Problem: The thundering herd problem occurs because caching servers are primarily designed to cache web sites. When the request for an object is initiated, the cache tries to pull the video from the file’s origin and share it with the requester. When multiple requests are initiated simultaneously, the video server is bombarded with requests and this puts a strain on system resources. This is exactly what HTTP adaptive bitrate streaming does and can be inefficient in this way.

Top comments (0)