H.264 compresses 300 frames into a fifth of the size of a single PNG frame

H.264 Is Magic

H.264 compresses 300 frames into a fifth of the size of a single PNG frame

A technical walkthrough of H.264, the codec behind internet video, Blu-ray, phones, and drones. It starts with the raw bandwidth problem: 1080p at 60 Hz needs about 370 MB per second, filling a 50GB Blu-ray in two minutes. Then it explains the tricks — lossy quantization in the frequency domain, chroma subsampling, and motion compensation with I-, P-, and B-frames — that let a 300-frame video weigh less than one PNG screenshot.

The H.264 video, 300 frames long is 175KB. A single frame of that video in PNG is 1015KB.
  1. tgtweak

    Had the pleasure of working with Jason Garrett-Glaser (better known as DarkShikari) circa 2011 on a patch for x264 to better utilize more cores (slice-threaded lookahead). At the time he was working with Sony to optimize their PlayStation game streaming service, and this had the potential to lower encoding latency (critical to game streaming) even on same-core systems by spreading the frame over more cores to do more parallel work, and doing more intelligent scheduling and convergence after that tile-based work was reconverged into a frame. At the time we were using servers with 48 physical cores to do transcoding, a bit of a rarity in a single NUMA space back then and there were no instances to test this on so I flamegraph traced a few encodes at very high thread parallel counts and send back the instrumented profiles (from a custom compiled version) showing the core work being done and he used that to optimize the motion estimation code which worked on the first shot to perfectly level out cpu usage and increase encoding speed across ~24 cores (was previously topping out around 8 and running one core hot iirc). I got a look into how exotic and complex this project was, particularly in terms how low level and advanced things like motion estimation, quantizing and perceptual compression were... it was and still is sort of magic how many smart techniques are baked into something that we barely pay attention to. They were, even at that time, working on x265.

    His blog, Diary […]

  2. Dwedit

    One uncommonly used feature of H.264 is support for lossless video. It's a bit hard to use due to tooling (not easy to discover and select the feature), and is sometimes incompatible with web browsers, but you can get actual lossless video using a mainstream video codec. You can verify that it really is lossless, and doesn't have any conversion step where it's quantized to 8-bit YUV.

    "x264vfw" is one tool which supports this format, even inside of an AVI file. So older software that uses Video For Windows can create those files.

  3. pwython

    Ten years later, 2026 magic: AV1

    https://engineering.fb.com/2026/06/22/video-engineering/adop...

    And soon AV2

    https://av2.aomedia.org/

  4. ummonk

    I wish the video presented had been one with, say, 5x higher bitrate, as it would have sufficed to make the point without presenting a video with very glaring compression artifacts.

  5. HelloUsername

    Previous discussions:

    4.nov.2016 https://news.ycombinator.com/item?id=12871403 219 comments

    17.mar.2022 https://news.ycombinator.com/item?id=30710574 219 comments

    24.may.2019 https://news.ycombinator.com/item?id=19997813 180 comments

    14.jun.2024 https://news.ycombinator.com/item?id=40681306 205 comments

  6. Hasz

    I really like the idea that compression is intelligence, there are so many tricks an interesting ideas related to it. A bunch of them are described in the article, but you can imagine a long tail of many more inscrutable tricks chained together to get really incredible shrinkage in data.

    Hutter prize (I think mentioned in a 3b1b video somewhere else in this thread) is a great example. Given this was written before advent of LLM, I would love to see someone throw openAI/Anthropic levels of compute at a similar problem to see what the swarm can produce.

    https://arxiv.org/html/2404.09937v1

  7. MadameMinty

    Worth pointing out that PNG is also just awful and should probably die like BMP died. WebP was already available at the time this article was written:

    PNG: 1039993 bytes - baseline

    optimized*: 541539

    WebP: 398974 - lossless mode, of course.

    JPEG XL: 310778 - lossless, quick, and easy.

    *after monumental compute effort; still probably some room for improvement but the effort is ridiculous.

  8. ksec

    H.264 High Profile is close to Patent Free. [1] I often wonder how much more efficiency could we get if we were to increase block size outside of spec.

    [1] https://meta.wikimedia.org/wiki/Have_the_patents_for_H.264_M...

More from this day

2026-10-29