AlgoViz

One lecture, many connection speeds

medium 6 min

A student switches from Wi-Fi to cellular halfway through a lecture.

Video lesson · Chapter 1 of 5

One film must cross a changing connection

0:00 / 4:03

Adaptive video playback

1:27Reel

Parallel video transcoding

1:19Reel

Theory

Read or listen first. About 1 min.

What it is

A codec compresses frames, a segment packages a span of playback time, and a storage chunk identifies bytes for reuse. They can all divide the same file differently. A viewer changing networks needs the next playable span at a sustainable bitrate. A backup system needs to recognize bytes it has stored before.

Change bitrate without changing playback time

Time0–2 s2–4 s4–6 s6–8 sHigh1234Low1234High 1 → high 2 → high 3 → high 4.
Playback follows aligned two-second segments in the high-bitrate rendition. Each column covers the same interval in both encodings.

Why it exists

An adaptive stream offers multiple encodings of one timeline. A playlist describes the alternatives and the URLs to fetch. The player uses buffer health and recent transfer speed to decide what it can download before the current buffer runs out.

View diagram · Adaptive playback
Playlist origin → Rendition picker (variants); Rendition picker → Segment CDN (next segment); Segment CDN → Buffer (media bytes); Buffer → Decoder (play); Buffer → Rendition picker (buffer health)
About two seconds of network time can now supply four seconds of playback.
Full size

Words to know

Rendition
One encoding of the same program at a particular quality or bitrate.
Content-defined chunk
A byte span with boundaries selected from the data to support reuse after edits.

How it works

Step through the idea, or press Play.

Step 1 of 3

Publish renditions. Transcode the same timeline at several bitrates. Align switchable segment boundaries and keyframes. An HLS multivariant playlist advertises streams; each media playlist identifies its playable segments.

Understand it

Start here

Four seconds before a stall

A student has four seconds of a lecture ready to play when Wi-Fi drops. Follow the next segment at two qualities and compare its arrival time with the playback deadline.

Four seconds before a stall
A four-second segment on a slow linkPlayer4 s buffered4 Mbps rendition4 seconds of videoStart with a full four-second buffer

A player can decode the next span at a lower quality.

Structure

Adaptive playback

Adaptive playback

Playlist origin → Rendition picker (variants); Rendition picker → Segment CDN (next segment); Segment CDN → Buffer (media bytes); Buffer → Decoder (play); Buffer → Rendition picker (buffer health)
About two seconds of network time can now supply four seconds of playback.

A stalled rendition

At 4 Mbps a four-second segment carries roughly 2 MB. At 2 Mbps it needs roughly eight seconds to download. A player with four seconds buffered cannot sustain that stream. A lower aligned rendition can avert the stall; independently verify old backup chunks still resolve after editing the intro.

How the player changes bitrate

Four seconds of playback

Rendition bitrateApproximate sizeDownload time on 2 Mbps
4 Mbps2 MB8 seconds
2 Mbps1 MB4 seconds before overhead
1 Mbps0.5 MB2 seconds

Switching at a useful boundary

An arbitrary byte offset can begin with a frame that depends on earlier frames. Encode switchable boundaries with the required decoding context and align their positions across renditions. Then a player finishing one segment can request the next time interval at a lower quality. Publish referenced objects before publishing their playlist and retain them long enough for lagging clients.

What an edit does to a backup

Insert a title card at the start of a stored lecture. Fixed-size chunks after the insertion may now start at different byte positions, reducing reuse even where the content survived. Content-defined boundaries can resynchronize after local changes in an otherwise similar byte stream. Re-encoding the entire lecture may change most bytes, so deduplication gains depend on what the ingest pipeline actually stores.

Switch at aligned boundaries

  • A player can decode the next span at a lower quality.

Switch at any byte offset

  • A frame may depend on decoding context the player lacks.

Can the next segment arrive in time?

4 s×4 Mbps/2 Mbps=8 s4\,\mathrm{s} \times 4\,\mathrm{Mbps} / 2\,\mathrm{Mbps} = 8\,\mathrm{s}
Ignoring overhead, a four-second buffer empties four seconds before this high-quality segment finishes.

Summary

The whole topic in one minute.

Use time-aligned decodable segments for playback and content identity for storage reuse. Check bitrate decisions against the actual time left in the buffer.

Sources