AVI (Audio Video Interleave) — Legacy Format Complete Guide
What Is AVI?
AVI (Audio Video Interleave) is a multimedia container format introduced by Microsoft in November 1992 as part of the Video for Windows technology. AVI became the dominant Windows video format throughout the 1990s and early 2000s, defining how video was stored, edited, and shared in the pre-streaming era. Despite its age, AVI remains relevant because millions of existing video files use the format and virtually all video software can read it.
The name "Audio Video Interleave" describes the format's storage approach: audio and video data are interleaved throughout the file rather than separated into distinct sections, enabling simultaneous playback from sequential reads — critical in the CD-ROM era when seeking was expensive.
RIFF Structure
AVI is based on RIFF (Resource Interchange File Format), a chunked binary format developed by Microsoft and IBM in 1991. RIFF organises data into chunks:
RIFF chunk
├─ AVI (identifies as AVI file)
│ ├─ LIST hdrl — Header list
│ │ ├─ avih — AVI main header (frame rate, frame count, dimensions)
│ │ ├─ LIST strl — Stream list (one per track)
│ │ │ ├─ strh — Stream header (type, codec FourCC, frame rate)
│ │ │ ├─ strf — Stream format (BITMAPINFOHEADER for video; WAVEFORMATEX for audio)
│ │ │ └─ strd — Stream data (codec-specific initialization data)
│ │ └─ ... (additional strl for each stream)
│ ├─ LIST movi — Movie data (interleaved video/audio chunks)
│ │ ├─ 00dc — Video frame (stream 0, compressed video)
│ │ ├─ 01wb — Audio chunk (stream 1, wave audio)
│ │ ├─ 00dc — Next video frame
│ │ └─ ... (interleaved throughout file)
│ └─ idx1 — Legacy index (byte offsets into movi list)
The idx1 chunk at the end of legacy AVI files is a critical limitation: because the index is at the file end, a damaged or incomplete file (download interrupted) cannot be seeked or repaired without it.
OpenDML / AVI 2.0 Extension
The original AVI format has a critical limitation: the RIFF header uses 32-bit size fields, capping file size at 4 GB (2³² bytes). For early 1990s content this was irrelevant; for modern HD video at 30 Mbps, 4 GB is only ~18 minutes.
OpenDML (Open Digital Media Library) extended AVI with 64-bit addressing in 1996:
- Multiple RIFF chunks chained together via the
AVIXextension type indx(super index) chunks at the stream list level pointing to per-chunk indices- Practical size limit becomes the filesystem limit (FAT32 = still 4 GB per file; NTFS = 16 EB)
OpenDML AVI can hold arbitrarily large content on modern filesystems. Most modern AVI files are OpenDML-compliant.
FourCC Video Codec Identification
AVI identifies codecs using FourCC (Four Character Code) — a 4-byte identifier in the stream header:
| FourCC | Codec | Notes |
|---|---|---|
XVID |
Xvid MPEG-4 | Most common historical AVI codec |
DIVX |
DivX MPEG-4 | Early streaming codec (DVD rips) |
H264 / AVC1 |
H.264 | Less common in AVI; usually MP4/MKV |
MJPG |
Motion JPEG | Webcam and industrial camera output |
DIV3 |
DivX 3 | Very early DivX; highly compatible |
MP42 |
Microsoft MPEG-4 v2 | Legacy Windows codec |
WMV1/2/3 |
Windows Media Video | Rare in AVI; usually WMV container |
HFYU |
HuffYUV | Lossless intraframe video |
ULRG |
Ut Video | Modern lossless codec for AVI |
RGBA |
Uncompressed RGBA | Maximum quality; maximum size |
Audio in AVI
Audio is identified by a WAVEFORMATEX format tag (wFormatTag):
| Tag | Codec | Notes |
|---|---|---|
0x0001 |
PCM | Uncompressed; maximum quality |
0x0055 |
MP3 | Constant bitrate MP3 (CBR only in AVI) |
0x0161 |
WMA v2 | Windows Media Audio |
0x2000 |
AC-3 | Dolby Digital 5.1 |
0x00FF |
AAC | Rare in AVI |
0xFFFE |
WAVE_FORMAT_EXTENSIBLE | Multi-channel PCM extension |
AVI MP3 limitation: AVI's MP3 support is limited to CBR (Constant Bitrate); Variable Bitrate MP3 (VBR) causes audio desynchronisation in AVI. This is a fundamental format limitation causing many "audio out of sync" complaints with MP3-in-AVI files.
AVI Limitations
Two-Stream Only (Legacy Limitation)
Traditional RIFF AVI supports exactly two streams: one video, one audio. Modern AVI (OpenDML) supports multiple streams, but most software and devices only recognise the first two. No subtitle tracks, no chapter support, no multiple audio languages.
4 GB Size Limit (Base Format)
Original AVI without OpenDML extension is limited to 4 GB. Transcoding long HD video to original-AVI format truncates the output.
Audio Desynchronisation
AVI stores audio in fixed-size chunks interleaved with video frames. If the audio codec uses variable frame sizes (VBR MP3, most modern codecs), the decoder must estimate timing from chunk positions rather than explicit timestamps — leading to cumulative drift in long files. Modern containers (MP4, MKV) use explicit timestamps for every audio packet, eliminating this problem.
No Streaming Optimisation
AVI lacks fast-start capability. The index is at the file end, requiring full download before playback can start. Unlike MP4's moov atom or MKV's SeekHead, there is no standardised way to move seeking metadata to the beginning of an AVI file.
No HDR or Wide Color Gamut Metadata
AVI's codec description structures have no fields for HDR10, HLG, or wide colour gamut information. Modern video workflows require containers that carry colour space metadata; AVI cannot.
Why AVI Is Still Encountered
Despite being superseded by MP4 and MKV, AVI files are still commonly found because:
- Historical archival — millions of rips from DVD era (2000–2010) are in DivX/Xvid AVI
- Webcam and industrial cameras — many use Motion JPEG AVI as native output
- Legacy screen recording software — Camtasia and Fraps historically used AVI
- Windows legacy compatibility — AVI plays in Windows Media Player without codecs for specific formats
- Scientific instrumentation — microscopes, spectrometers, and other devices output Motion JPEG AVI as a simple, universally readable format
Converting AVI Files
AVI → MP4 (Most Common)
The standard modernisation path. H.264 or H.265 MP4 offers:
- Equivalent or better quality at 50–70 % smaller file size
- Universal device compatibility
- Streaming and web playback
- Proper timestamp-based audio sync
When the AVI source uses Xvid/DivX (MPEG-4 SP), re-encoding to H.264 provides significant quality improvement at smaller sizes.
AVI → MKV
For archival with additional tracks (subtitles, multiple audio), MKV is preferred over MP4. AVI video can often be remuxed into MKV without re-encoding if the codec is supported.
Preserving AVI Archives
For archives where the original encoding is valuable (e.g., historical preservation), consider remuxing to MKV with the original video codec rather than re-encoding, preserving bit-for-bit identical video data in a more capable container.
Related conversions
Common video conversions that pair well with this guide: