Deterministic Poster and Keyframe Extraction from Inter-Coded Animated AVIFs
Decoding Dependent P-Frames and Altref References to Standalone PNGs
Thumbnail pipelines, Open Graph card generators, and documentation editors often need one clean still frame—such as frame index 2 at 200 ms rather than an initial fade-in black frame—from an animated AVIF clip. Because AV1 image sequences compress non-sync frames using inter-frame motion vectors and show_existing_frame references against earlier OBUs, you cannot slice a single byte range out of mdat and hand it to a still decoder.
Our Single-Frame Extractor decodes the sequence up to your requested zero-based index inside the Worker, verifies the exact presentation timestamp against the container stts schedule, serializes that surface to a standalone lossless RGBA8 PNG via @jsquash/png/encode, and records its SHA-256 digest for repeatable QA.
- Defaults to zero-based frame index 2 so inter-frame decoding is immediately observable on sample sequences.
- Reports exact presentation timestamp in milliseconds alongside sampled RGB values and PNG SHA-256.
- Disposes all intermediate reference VideoFrames in finally blocks to keep memory flat.