Adaptive Bitrate Streaming
What you'll learn: How to implement HLS or DASH protocols to dynamically serve video at multiple quality levels based on real-time network conditions and device capabilities.
The Core Problem
When streaming video, users have vastly different internet speeds, device capabilities, and screen sizes. A single quality level won't work—high-quality video stalls on slow connections, while low-quality video wastes fast connections and looks poor on large screens.
How Adaptive Bitrate Streaming Works
ABR solves this by encoding your video into multiple versions (renditions) at different bitrates and resolutions—for example:
- 240p @ 400 kbps
- 480p @ 1 Mbps
- 720p @ 2.5 Mbps
- 1080p @ 5 Mbps
Each rendition is then segmented into small chunks (typically 2-10 seconds). The video player downloads one chunk at a time, measuring network throughput between requests. If bandwidth drops, the player requests the next chunk from a lower-quality rendition. If bandwidth improves, it steps up to a higher quality.
HLS and DASH Protocols
HLS (HTTP Live Streaming) and DASH (Dynamic Adaptive Streaming over HTTP) are the two dominant ABR protocols. Both work similarly:
- A manifest file (
.m3u8for HLS,.mpdfor DASH) lists all available renditions and their chunk locations - The client downloads the manifest first
- The player requests chunks via standard HTTP GET requests
- Chunks are delivered through your CDN like any other static file
Key difference: HLS is Apple-native and simpler; DASH is codec-agnostic and more flexible.
Implementation Pattern
During video processing, your transcoding pipeline generates all renditions simultaneously. Store chunks in object storage, serve the manifest through your CDN, and let the client's player handle quality switching automatically.
Key Takeaway: Adaptive Bitrate Streaming encodes video into multiple quality levels and serves small chunks via HLS or DASH, allowing clients to dynamically switch quality based on real-time bandwidth measurements.