Skip to main content

Module avi

Module avi 

Source
Expand description

Minimal AVI (RIFF) demuxer.

Scope: read the video stream out of a one-video-track AVI file, map the stream’s handler / fourcc to one of the codec labels the transcoder knows how to decode, and emit per-frame samples in the order the file lays them down (presentation order — AVI does not have B-frame reordering at the container layer, stream samples are already display-order). Secondary audio tracks are dropped with a warning; the caller already handles that shape for MP4/MKV.

OpenDML 1.0 super-indexes (Squad-38, 2026-04-17): files >1 GiB use multiple LIST movi chunks (one per ~1 GiB RIFF segment) plus an indx superindex chunk per stream that points at per-LIST ix## standard indexes. Detection happens at construction: presence of an indx chunk inside the video stream’s LIST strl triggers the OpenDML path, which precomputes a sample chunk-offset list from the indxix## chain and next_video_sample() consumes that. When indx is absent we fall back to the legacy single-movi cursor walk. dmlh.dwTotalFrames from the LIST odml (sibling of strl LISTs in hdrl) supersedes avih.dwTotalFrames for OpenDML files because avih is a 32-bit field and gets truncated for clips longer than 2^32 / fps frames.

What’s intentionally not supported:

  • Audio passthrough. AVI audio is usually MP3 or AC-3 anyway, not AAC — outside the passthrough scope.
  • Variable-bitrate index reconstruction. We trust the sample order in the movi LIST itself; idx1 is only used as a fallback when movi is missing (which real-world files don’t exhibit).

Structs§

AviStreamingDemuxer
Streaming AVI demuxer. Owns the input bytes and walks the movi LIST(s) one chunk at a time. Two backends: