Streaming video: buffering and adaptive bitrate
Why does a video get blurry for a moment instead of freezing when your connection slows down? Follow one film from the server that cuts it into 6-second segments, through a CDN edge, into your player's buffer. Watch the player measure the network, climb and step down the quality ladder, and see what happens when the buffer runs empty.
5 quick questions
Pick an answer to see why. Your score saves with your progress.
01A segment is 6 seconds of 720p video at 3 Mb/s. How big is it, and how long does it take to download at 4 Mb/s?
Size = bitrate × duration = 3 Mb/s × 6 s = 18 megabits. Time = size ÷ link speed = 18 ÷ 4 = 4.5 s, which is less than the 6 s it plays for, so the buffer grows.
02The player measures 20 Mb/s and spends 80% of it. Which rung does it pick from 360p (0.8), 480p (1.5), 720p (3) and 1080p (6 Mb/s)?
80% of 20 Mb/s is 16 Mb/s. Every rung fits, so the player picks the highest one, 1080p at 6 Mb/s.
03Your link drops from 20 Mb/s to 4 Mb/s mid-film. What does a good adaptive player do?
A 1080p segment would take 9 s per 6 s of video and drain the buffer. Stepping down to 720p (4.5 s per segment) keeps the buffer growing, so the picture softens instead of freezing.
04When does rebuffering (a stall) happen?
Playback can only show video that has already arrived. If even the lowest rung downloads slower than real time, the buffer drains to 0 and the picture freezes until more arrives.
05Why is a live HLS stream at least about 18 s behind real time with 6-second segments?
RFC 8216 says a client should not start less than three target durations from the end of the playlist: 3 × 6 s = 18 s, plus encoding time. Low-latency HLS and DASH use partial segments to get down to a few seconds.
Glossary
- Segment
- A short file holding a few seconds of video (here 6 s). Players fetch video one segment at a time over HTTP.
- Bitrate
- How many bits per second a video uses. Higher bitrate means more detail and bigger segments.
- Quality ladder
- The set of qualities a video is encoded at, from low bitrate (360p) to high (1080p). Each quality is a rung.
- Manifest
- A small text file listing the rungs and where their segments are: an HLS playlist (.m3u8) or a DASH MPD.
- Buffer
- Video the player has already downloaded but not yet shown. It lets playback continue while the network wobbles.
- Throughput
- The download speed the player actually sees: bits received divided by the time they took.
- Adaptive bitrate (ABR)
- Choosing each next segment's quality from the measured throughput and the buffer level.
- CDN
- Content delivery network: cache servers near viewers that keep copies of popular files, such as video segments.
Notes and sources
- The ladder, link speeds, the 80% safety margin and the 30 s buffer goal are illustrative; segment sizes, download times and buffer levels follow from them.
- video.example.com is a reserved example name (RFC 2606); 203.0.113.50 and 198.51.100.20 are documentation addresses (RFC 5737); 192.168.1.20 is a private home address (RFC 1918).
- Measured throughput here is segment size ÷ download time; real players smooth it over several segments and also watch the buffer level.
- Each tile in the buffer is one segment; its colour is its rung on the ladder.
- MPEG-DASH (ISO/IEC 23009-1) works the same way: the MPD lists Representations, the player fetches segments over HTTP and adapts.
Quiz Unlocks after the last step.