Senior/Staff System Design Interviews: Adaptive Bitrates in Video Streaming


Whether a senior/staff system design interview ends up meriting an offer often depends on how well one understands high-bandwidth system design problems, such as video streaming. The digital era has ushered in a massive surge in online video consumption. As viewers demand higher quality content, the need to deliver seamless video experiences becomes paramount. Enter Adaptive Bitrate (ABR) Streaming, an optimization for streaming based on a user’s network conditions and device capabilities. In this blog post, we’ll delve into the encoding process, storage considerations, and the trade-offs that make ABR a vital consideration in designing streaming systems like Netflix or Youtube.

The Problem

Internet speeds can vary significantly based on the user’s location, internet service provider, and time of day. Users in urban areas with robust internet infrastructure might enjoy high-speed connections, while those in rural or remote regions may experience slower, less stable connections. Moreover, network congestion during peak hours can further impact the streaming quality, leading to buffering and interruptions. Furthermore, each country will have its own pros and cons when it comes to computational resources – a major consideration when building a global platform!

One of the most frustrating experiences for viewers is encountering interruptions or long buffering times during video playback. Inconsistent connectivity can disrupt the seamless delivery of video content, causing frustration and dissatisfaction among users. For content providers, this can result in decreased user engagement and retention.

As video resolution and content quality continue to improve, viewers have come to expect high-definition and even 4K content. However, delivering such high-quality videos can be challenging, especially to users with limited bandwidth or slower internet connections. For both users and content providers, efficient bandwidth utilization is of paramount importance. Users on limited data plans seek to maximize their data usage, while content providers must control their server costs and content delivery expenses.

Adaptive Bitrates (Client-side)

Adaptive Bitrate Streaming is a technique that dynamically adjusts the video quality during playback, tailored to each viewer’s internet connection. To achieve this, the client application continuously monitors real-time bandwidth and assesses the viewer’s device capabilities, allowing it to make adaptive decisions on the optimal bitrate and resolution for uninterrupted playback.

You can think of what’s going on here as similar to a “measure-my-download-speed” website. Another way of estimating this metric is to measure the round-trip time (RTT) taken in sending a packet from the client, to the server, and back to the client.

So these measurements happen on the client’s side; what is going on the server’s?

The Encoding Process

On the server-side, videos are encoded at multiple quality levels, typically ranging from low to high bitrates and resolutions. Each video is then divided into small segments, usually a few seconds long. This segmentation facilitates seamless switching between quality levels during playback. Perhaps there are low-quality, medium-quality, and high-quality segments, with each of the three being encoded with different levels of quality, all stored on the server.

Depending on your bandwidth at a certain moment in time (remember: determined on the client-side), a client can send a request for the right chunk (depends on which of the three types of segments is most appropriate, and where you currently are in the video).

Common media stores for these chunks include Amazon S3, Google Cloud Storage, or Azure Blob Storage. These scalable and reliable cloud-based solutions offer efficient data storage and retrieval capabilities. Often, we’ll have a separate database that provides metadata for any given video or chunk (timestamp, corresponding video clip length, encoding quality, etc.), and then also include a field linking to the actual location of the chunk in distributed storage.

Trade-offs and Technical Considerations

Bandwidth Efficiency vs. Latency: Adaptive Bitrate Streaming optimizes bandwidth consumption by adjusting the video quality. However, frequent bitrate switches may introduce slight latency, impacting real-time video delivery. Striking the right balance between bandwidth efficiency and latency reduction is critical for a seamless viewing experience.

Complexity in Video Encoding and Storage: Encoding videos at multiple quality levels and managing adaptive streaming segments can be complex and resource-intensive. Video transcoding services like Bitmovin and Wowza help simplify the encoding process, while cloud-based media stores efficiently handle storage and retrieval of adaptive video segments.

Adaptive Decision-Making Algorithms: The algorithms that determine when and how to switch between quality levels need to be carefully designed. The focus should be on optimizing user experience while minimizing buffering and disruptions during playback.

Preparing for interviews? Just interested in learning?

Get system design articles written by Staff+ engineers delivered straight to your inbox!