PageH.264 InternalsStage03 · EncodeRev2026.11Date2026-11-04

H.264 Under the Hood

H.264 has been decoded by more devices than any other video codec, so its quirks are worth understanding even where a newer standard takes the top rung. This sheet walks the encode path from a fixed grid of macroblocks to a packed bitstream.

The fixed grid

H.264 divides a frame into macroblocks of sixteen by sixteen samples. Each macroblock predicts from a neighbour inside the same frame or from a previously reconstructed frame, then encodes only the residual. The fixed size is the codec's main limit and its main gift: it is simple to parallelise and easy to decode in silicon, but it cannot adapt its partition to the content as flexibly as later designs.

I B B P B B P B I closed group, display order left to right
Figure 1. A closed picture group. Reference frames anchor the run; predicted frames refine it.

Prediction and the residual

Intra prediction copies a pattern from already coded neighbours, which handles flat skies and walls well. Inter prediction searches a window for a matching block and codes the motion along with a small residual. A good match shrinks the residual, and a small residual survives heavy quantisation without visible artefacts. The encoder therefore spends much of its time on the match search, and that search is where quality and time trade against each other.

Transform, quantisation, entropy

The residual goes through an integer transform that concentrates energy into few coefficients. Quantisation then discards low-value precision, guided by the rate factor. The last stage codes the symbols without loss, using a context-adaptive scheme that adapts to local statistics. Because quantisation sits in the middle, a change in the rate factor moves both size and distortion at once.

Table 1. The path of one macroblock.
StepEffect
predictCuts the residual from a neighbour
transformPacks energy into few values
quantiseTrades detail for size
entropyPacks the values into bits

Where it still pays

At low resolution and low rungs, H.264 delivers a distortion that newer codecs beat only slightly, while demanding far less encode time. That balance keeps it at the base of most ladders. Its decoder base is also unmatched, so a stream that must run everywhere usually ends up here.

Setting it up

Anchors for the 1080p tier are on the 1080p settings sheet. The rate factor itself is explained on the constant quality page.

Comparing H.264 to later codecs

On an easy clip, H.264 reaches a score close to HEVC and AV1 while demanding far less encode time, which keeps it at the base of most ladders. On a hard, high-resolution clip the later codecs pull ahead, and H.264 gives up size at the same score. The desk matches the codec to the rung, so the cheap path stays where it pays.

Timing a run

Time a run only after the first frame has arrived, and record the host class beside the figure. A weak host and a strong host can differ by a wide gap on the same setting, so a timing without its host class is a number without a home.

Cookies: this site sets no cookies, stores nothing on your device, and keeps no profiles. Cookie notice