The top level
An AVI file is a RIFF file with form type AVI (with a trailing space). The sample is a 16 × 16 MJPEG clip with two frames at 5 frames per second and an 8 kHz audio track, written by ffmpeg. These are the chunks you will meet.
| Chunk | Holds |
|---|---|
LIST hdrl | The main header and one stream list per stream |
avih | Main AVI header: frame duration, frame count, stream count, width and height |
LIST strl | One per stream |
strh | Stream header: type (vids or auds), codec FourCC, scale, rate and length |
strf | Stream format: BITMAPINFOHEADER for video, WAVEFORMATEX for audio |
JUNK | Padding that readers skip |
LIST movi | The video frames and audio blocks |
idx1 | Index with one entry per chunk in movi |
Chunk names inside movi
Each data chunk ID is a two-digit stream number followed by a two-letter type: dc for a compressed video frame, db for an uncompressed frame, wb for audio and pc for a palette change. 00dc is a frame from stream 0 and 01wb is audio from stream 1. The sample interleaves them: one 00dc, two 01wb, then the same again.
Reading avih
In the hex view, offsets count from the start of the selected chunk, so the first payload byte is at 0x08, after the 4-byte ID and the 4-byte size. In the sample, avih gives 200000 microseconds per frame (5 frames per second), 2 total frames, 2 streams and a 16 × 16 picture. Flags 0x910 combine AVIF_HASINDEX (0x10), AVIF_ISINTERLEAVED (0x100) and AVIF_TRUSTCKTYPE (0x800).
| Hex view | Field |
|---|---|
0x08 | Microseconds per frame |
0x0C | Maximum bytes per second |
0x10 | Padding granularity |
0x14 | Flags |
0x18 | Total frames |
0x1C | Initial frames |
0x20 | Streams |
0x24 | Suggested buffer size |
0x28 | Width |
0x2C | Height |
0x30 | Reserved, 16 bytes |
Finding the codec
In a video strh, the stream type is at 0x08 and the codec FourCC at 0x0C; the sample reads vids then MJPG. The frame rate is the rate at 0x20 divided by the scale at 0x1C: 5 / 1. In the matching strf, the BITMAPINFOHEADER compression field at 0x18 also reads MJPG.
The idx1 index
Each idx1 entry is 16 bytes: chunk ID, flags (0x10 marks a keyframe), offset and size. Offsets usually count from the movi form type, though some writers use offsets from the start of the file. The sample index is 96 bytes, one entry for each of its six data chunks.
Large files and OpenDML
OpenDML (AVI 2.0) extends the format past the limits of a single RIFF chunk. It adds LIST odml with a dmlh header, indx and ix## index chunks, and continues the data in further RIFF AVIX chunks after the first. The viewer parses only the first RIFF chunk and warns when more follow.
Questions
How do I find out which codec an AVI uses?
Select the video stream’s strh and read the FourCC at 0x0C in the ASCII column, for example MJPG, XVID or H264.
Why does my AVI contain JUNK chunks?
They are padding. Writers reserve space or align data with them, and readers skip them.
What happens if an AVI has no idx1 index?
Players that rely on the index may not seek or may refuse the file. Remuxing with ffmpeg -i in.avi -c copy out.avi writes a new index. You can remux the AVI in the FFmpeg Runner without installing anything.
Can I play the AVI here?
No. The viewer shows the container structure only. For a file most players accept, convert the AVI to MP4.
Open the RIFF Viewer with your own file, or download the sample used above.