Run-length coding is the simple compression technique of replacing a run of identical consecutive symbols with a single (symbol, count) pair. "AAAAA" becomes "(A, 5)". It's the most ancient and least sophisticated of the entropy-coding family, dating to telegraph protocols in the 1960s, but it survives inside modern video codecs because it works perfectly on one specific pattern: long runs of zeros.

The reason this matters: after the DCT transform and quantization stages, most coefficients in a typical block round to zero. A typical 8×8 block of quantized coefficients might have 2 or 3 meaningful values in the top-left corner and 60-plus zeros filling the rest. Storing each zero individually would waste tremendous space. Storing them as "62 zeros" takes a handful of bits. Combined with zig-zag scan ordering (which arranges the 8×8 block into a 1D sequence that puts likely-nonzero values first and the long zero tail last), run-length coding packs the typical block into a strikingly small number of bits.

For a product team, run-length coding is invisible plumbing — there's no knob to tune — but it explains a structural fact about video compression: higher quantization (more aggressive compression) produces longer zero runs, which compress to almost nothing. That's why halving a video's bitrate doesn't usually halve its file size by half the same factor everywhere; the compression isn't linear because the run-length stage gets dramatically more efficient as quantization gets coarser. Modern codecs (AV1, HEVC, VVC) generalise the idea with arithmetic coding that handles arbitrary distributions even more compactly, but the underlying intuition — "long runs of zeros, compressed essentially for free" — is the same.