link 20 Mb/slink 4 Mb/slink 0.5 Mb/s360p0.8 Mb/s480p1.5 Mb/s720p3 Mb/s1080p6 Mb/s360p1080p720p · LIVE
Tiles: 6-second segments, coloured by rung (coral 360p, orange 480p, yellow 720p, purple 1080p)Staircase: the quality ladder; the blue puck marks the rung being fetchedIndigo lane: the network; it narrows when the link slowsBlue tray: the buffer; the head (played next) is on the rightThe origin cuts a video into 6-second segments at four qualities and lists them in a manifest (an HLS playlist, RFC 8216, or a DASH MPD). A CDN edge caches the segments near viewers. The player keeps a buffer of video ahead of the screen and, after every segment, measures throughput and picks the highest rung that fits 80% of it. When the link drops from 20 to 4 Mb/s it steps down from 1080p to 720p instead of stalling; below the lowest rung the buffer empties and playback stalls. Live players stay at least 18 s behind the newest segment. 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).

Getting ready

  1. The video is cut into short files called segments, here 6 seconds each. Every segment is encoded several times, from 360p at 0.8 Mb/s up to 1080p at 6 Mb/s. That set of qualities is the quality ladder.

Adaptive bitrate

Stalls and live

The arithmetic

;; step 1/10 · cut-segments · prepare
;; at the origin
segment length   6 s   (Apple's HLS guide recommends 6 s)
one segment = bitrate × 6 s, at every rung (illustrative ladder):
  360p   640x360    0.8 Mb/s   4.8 Mb = 0.6 MB per segment
  480p   854x480    1.5 Mb/s   9 Mb = 1.13 MB per segment
  720p   1280x720     3 Mb/s   18 Mb = 2.25 MB per segment
  1080p  1920x1080    6 Mb/s   36 Mb = 4.5 MB per segment
segments line up in time, so the player can switch rung at any boundary

Each tile in the buffer is one segment; its colour is its rung on the ladder. Measured throughput here is segment size ÷ download time; real players smooth it over several segments and also watch the buffer level.