The basics
What is an AVI file?
AVI is the video format Microsoft introduced in 1992 with Video for Windows. For more than a decade it was the default for video on PCs: captures from camcorders and TV cards, webcam and early digital camera clips, CD-ROM video, and the DivX and Xvid films that circulated online in the 2000s. You'll still find it in archives, on old hard drives, from security cameras and in some scientific and industrial equipment.
Like MP4 and MKV, AVI is a container: it stores one or more streams, usually one video and one audio, and leaves the compression to a codec. AVI's own structure is very simple, which made it easy to support and lets it carry almost any codec, but it lacks things modern formats take for granted: timestamps on each frame, B-frame support, subtitles, chapters and a standard way to stream it.
Anatomy
What's inside an AVI file
An AVI file is a RIFF file, like a WAV: a tree of chunks, each with a 4-letter ID, a 4-byte size and its data. A LIST chunk holds other chunks. All numbers are little-endian. Here is the chunk tree of sample-xvid-mp3.avi, our 10-second sample, as read from the file. Offsets and sizes are in bytes.
offset chunk size content
0 RIFF 'AVI ' 1,007,432 the whole file
52 49 46 46 48 5F 0F 00 41 56 49 20
12 LIST 'hdrl' 8,906 the headers
24 avih 56 33,333 µs per frame, 301 frames,
2 streams, 640×360
88 LIST 'strl' 4,320 stream 0: video
100 strh 56 type "vids", handler "XVID"
164 strf 40 640×360, compression "XVID"
212 JUNK 4,120 space for an OpenDML index
4,340 vprp 68 video properties (OpenDML)
4,416 LIST 'strl' 4,234 stream 1: audio
4,428 strh 56 type "auds"
4,492 strf 30 format 0x0055 (MP3), 2 ch, 48 kHz
4,530 JUNK 4,120 space for an OpenDML index
8,658 JUNK 260 space for the OpenDML header
8,926 LIST 'INFO' 190 INAM, IART, ICMT, ISFT tags
9,124 JUNK 1,016 padding
10,148 LIST 'movi' 985,772 the media
10,160 01wb 384 stream 1, audio: MP3
10,552 00dc 13,530 stream 0, video: a keyframe
… 719 chunks in all: 301 × 00dc, 418 × 01wb
995,928 idx1 11,504 index: 719 entries of 16 bytes- 1
52 49 46 46 · 48 5F 0F 00 · 41 56 49 20The RIFF header
RIFF, then the size of the rest of the file (0x000F5F48= 1,007,432 bytes, read backwards because it's little-endian), then the form typeAVIwith a trailing space. WAV and WebP files start withRIFFtoo; the form type is what tells them apart. - 2
LIST 'hdrl' / avihThe main header
How long each frame lasts (33,333 microseconds, so 30 fps), the number of frames and streams, and the picture size. AVI has a single fixed frame rate: there are no timestamps on individual frames.
- 3
LIST 'strl' / strhA stream header
One
strllist per stream. The stream header gives its type (vidsfor video,audsfor audio) and a FourCC naming the codec:XVIDhere. A player looks this code up to find a decoder, which is why a missing codec was the classic AVI error. - 4
strfThe stream format
For video, a Windows
BITMAPINFOHEADERwith the size and compression code; for audio, aWAVEFORMATEXwith a format tag, here0x0055for MP3 (0x0001would be PCM), the channels and the sample rate. - 5
JUNK, vprpRoom for OpenDML
JUNKchunks are filler that readers skip. FFmpeg leaves these ones empty so it can write OpenDML indexes into them if the file grows past about 1 GB;vprpis OpenDML's video properties chunk, with the aspect ratio. - 6
LIST 'INFO'Metadata
Title (
INAM), artist (IART), comment (ICMT) and software (ISFT), the same INFO tags WAV files use. - 7
LIST 'movi' / 00dc, 01wbThe interleaved media
The audio and video data, in small chunks that alternate so a player reading from start to end always has both: that's the "interleave" in the name. The ID gives the stream number and the kind of data:
00dcis a compressed video frame from stream 0,01wbis audio from stream 1 (dbwould be an uncompressed frame). - 8
idx1The index
At the very end: one 16-byte entry per chunk, giving its ID, a keyframe flag, its position and its size. Players use it to seek. If a recording stops before the index is written, the file still plays from the start, but seeking fails until a player rebuilds the index.
Limits
The 1 GB and 2 GB limits, and OpenDML (AVI 2.0)
Every RIFF chunk stores its size as a 32-bit number, so in theory one RIFF file can reach 4 GB. In practice the original AVI format stopped well short of that. Video for Windows files were first limited to 1 GB, later to 2 GB, and FAT16, the usual Windows file system of the time, couldn't store a file over 2 GB anyway. For video capture, where an hour of DV is about 13 GB, that wasn't enough.
The fix was the OpenDML extension, written in 1995–96 by the OpenDML committee working with the capture-card maker Matrox, and supported by Microsoft. It's often called AVI 2.0:
- After the first
RIFF 'AVI 'chunk, the file continues with furtherRIFF 'AVIX'chunks, each with its ownmovilist, so the file can grow as large as the file system allows. - A two-level index (
indxchunks pointing to smaller indexes spread through the file) replaces the singleidx1at the end, which also makes seeking in big files faster. - A
dmlhheader records the true total number of frames.
To stay readable by old software, writers keep the first RIFF chunk small and still give it an idx1. Old players then show only the first part of a big OpenDML file, often around the first gigabyte, which is the usual explanation when a long AVI "stops early" in one program and plays in full in another.
Codecs
What's inside: codecs and FourCC codes
The strh and strf chunks name the video codec with a four-character code (FourCC) and the audio codec with a numeric format tag. Knowing the common ones tells you what era a file is from and what will play it.
| Code | Codec | Where it comes from |
|---|---|---|
XVID, DIVX, DX50, FMP4 | MPEG-4 Part 2 (Xvid, DivX) | Films and TV shared online in the 2000s, DVD rips |
MJPG | Motion JPEG: every frame a JPEG | Webcams, early digital cameras, security cameras |
dvsd | DV | Camcorders captured over FireWire |
cvid, IV32, IV50 | Cinepak, Intel Indeo | CD-ROM games and encyclopaedias of the 1990s |
H264, X264 | H.264 | Later screen recorders and cameras. Works, but MP4 or MKV is a better home for it |
HFYU, UYVY, uncompressed | Huffyuv (lossless), raw video | Capture and editing intermediates |
0x0001, 0x0055, 0x2000 | PCM, MP3, AC-3 audio | PCM for captures, MP3 for shared films, AC-3 for DVD rips |
Why codecs with B-frames are awkward in AVI
AVI stores frames in the order they're shown, at a fixed rate. Codecs with B-frames have to store frames out of order, so DivX and Xvid used a trick called packed bitstream, putting two frames in one chunk and an empty placeholder in the next. Many players cope, but it causes stutter and sync problems in others. Our samples avoid B-frames for this reason.
On the web
Why browsers won't play AVI files
No current browser plays AVI in a <video> element. Open an .avi link and the browser downloads it instead. There are two reasons:
- The container. Browsers support MP4, WebM and, increasingly, Matroska. AVI was never added: it can't be streamed efficiently (the index is at the end and frames have no timestamps) and it offers nothing those formats don't.
- The codecs. Most AVI files hold codecs browsers don't decode at all, such as MPEG-4 Part 2, Motion JPEG, DV or Indeo. Even moving the streams into MP4 wouldn't make those play.
To show an AVI on a web page, convert it: ffmpeg -i in.avi -c:v libx264 -crf 20 -c:a aac -movflags +faststart out.mp4. If the AVI already holds H.264, you can keep the video as it is with -c:v copy and only convert the audio.
Related formats
AVI vs MP4, MKV and MOV
| AVI | MP4 | MKV | |
|---|---|---|---|
| Introduced | 1992 | 2003 (MPEG-4 Part 14) | 2002 |
| Frame timestamps | No: fixed frame rate | Yes | Yes |
| B-frames | Only with workarounds | Yes | Yes |
| Subtitles, chapters | No standard way | Limited | Yes, many tracks |
| Streaming over the web | No | Yes | Partly |
| Plays in browsers | No | Yes, everywhere | Chrome, Edge, Firefox |
| Good for today | Reading old files | Sharing and the web | Archiving, films with several tracks |
Troubleshooting
Why won't my AVI play? Common problems and fixes
| Symptom | Usual cause | Fix |
|---|---|---|
| "Codec not found", or sound with no picture | No decoder for the video FourCC on this computer. | Play it in VLC or mpv, which include decoders for almost every AVI codec. Don't install random "codec packs". |
| Plays, but you can't skip ahead | The idx1 index is missing or damaged, usually because recording or copying stopped early. | VLC offers to rebuild the index when it opens such a file. ffmpeg -i in.avi -c copy out.avi writes a new one. |
| Audio drifts out of sync | Variable-bit-rate MP3 audio, or packed-bitstream video, which some players handle badly. | Convert to MP4 with FFmpeg, re-encoding the audio to AAC (-c:a aac). |
| A long recording stops early | An OpenDML (AVI 2.0) file opened in a program that only reads the first RIFF chunk, or an old 2 GB limit. | Use VLC, mpv or FFmpeg, which read OpenDML. |
| Won't open on a Mac | QuickTime Player can't open most AVI files. | Use VLC or IINA, or convert to MP4. |
How to
How to open, edit and convert an AVI file
- Windows: the Media Player app plays AVI files with common codecs such as Xvid, Motion JPEG and DV. For anything else, VLC.
- macOS: VLC or IINA. QuickTime Player and iMovie don't open most AVIs.
- Linux: VLC or mpv.
- Phones: VLC for Android and iOS plays AVI files; the built-in players usually don't.
- Convert to MP4: HandBrake (free, with presets) or
ffmpeg -i in.avi -c:v libx264 -crf 20 -c:a aac out.mp4. - Inspect it:
ffprobe in.avilists the FourCC, frame rate and audio format; MediaInfo shows the same in a window.
Archiving old AVIs
Keep the original file when you convert: re-encoding loses a little quality each time. For long-term preservation, archives often move old video into lossless FFV1 in Matroska; our MKV page has a sample.
Security
Is an AVI file safe?
- Fake codec downloads. A website or a file that says you need to install a special codec to watch a video is a classic way to spread malware. Real players don't ask for that; VLC plays nearly every AVI as it is.
- Disguised programs.
film.avi.exeis a program. Windows hides known extensions by default, so turn on file name extensions in File Explorer. - Old decoders. An AVI can't run code, but a crafted file can exploit bugs in decoders, and AVI often means old, unmaintained codecs installed years ago. Uninstall codec packs you don't need and keep your player updated.
Free downloads
Sample AVI files to download
Free sample AVI files for testing players, converters, upload forms and media pipelines. All are made from FFmpeg test patterns and generated tones, with the format written on screen. Each was checked with ffprobe and fully decoded without errors. Browsers can't play AVI, so these download rather than preview.
Browsers can't show this kind of file in a page. Download it to open it in the app it belongs to.
What's inside sample-xvid-mp3.avi
A 10-second, 640×360 AVI at 30 fps in the classic 2000s combination: Xvid (MPEG-4 Part 2) video and MP3 stereo audio. Open it in VLC or mpv to see the parts below.
The label
The bottom band names the resolution, frame rate and codecs, so you can see at a glance if a converter changed something.
Timecode and frame counter
Burned into the top of each frame. Skipped or repeated frames show up as jumps in the counter.
The flash and the beep
A white square flashes in the top right for 3 frames on every whole second, in step with a 1 kHz beep. AVI files are prone to drift, so check they stay together to the end.
Stereo test tones
440 Hz on the left channel and 660 Hz on the right, so swapped or mixed-down channels are easy to hear.
FourCC and format tag
The video is tagged
XVIDand the audio0x0055(MP3), the two codes a player needs to find decoders.No B-frames
Encoded without B-frames, so there's no packed bitstream and it plays smoothly in every AVI player.
Metadata and index
Title, artist and a comment naming this page in the
INFOlist, and a completeidx1index at the end, so seeking works.
All sample AVI files
Xvid + MP3
sample-xvid-mp3.avi · 983.8 KB (1,007,440 bytes)
10 seconds at 640×360, 30 fps. MPEG-4 Part 2 video tagged
XVID, MP3 stereo at 128 kbps, with anidx1index.- Testing that a player or converter handles classic AVI files
- Checking how a site deals with video it can't preview
Motion JPEG + PCM
sample-mjpeg-pcm.avi · 436.0 KB (446,418 bytes)
2 seconds at 320×240, 15 fps, Motion JPEG (
MJPG) with uncompressed 16-bit PCM stereo audio at 22,050 Hz, like clips from webcams and older digital cameras.- Testing import from camera-style AVI files
- Extracting individual frames as JPEGs
H.264 + MP3
sample-h264-mp3.avi · 213.7 KB (218,854 bytes)
4 seconds at 640×360, H.264 Main profile without B-frames (FourCC
H264) and MP3 audio: a modern codec in the old container.- Testing a remux to MP4 without re-encoding the video
- Checking FourCC-based codec detection
1 MB AVI file
sample-1mb.avi · 1 MB (1,048,576 bytes)
8 seconds at 640×360, Xvid + MP3, padded with a
JUNKchunk to exactly 1,048,576 bytes (1 MiB). Players skip the padding.- Upload and size-limit tests
- Checking that parsers skip unknown chunks
Ways to test with them
- Upload handling: browsers can't preview AVI, so
sample-xvid-mp3.avishows what your site does with video it can't play: a download, a placeholder or an error. - Conversion: run each sample through your converter; the frame counter, the flash and the beep should all survive into the MP4.
- Remux vs re-encode:
ffmpeg -i sample-h264-mp3.avi -c:v copy -c:a aac out.mp4should keep the video untouched; the Xvid and Motion JPEG files need re-encoding. - Size limits:
sample-1mb.aviis exactly 1 MiB, so you can test a limit at the boundary.
Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.
Put it online
Have an AVI file? Give it a link.
Drop an AVI on 99helpers and it gets its own address to send instead of a large attachment. Browsers don't play AVI, so visitors download it; to have it play in the browser, convert it to MP4 first.
Questions
AVI files, frequently asked
What does AVI stand for?
Audio Video Interleave. "Interleave" refers to how the file alternates small chunks of audio and video so both can be read together.
How do I play an AVI file?
Use VLC or mpv, which play almost every AVI on Windows, macOS, Linux and phones. The Windows Media Player app plays the common ones. Web browsers don't play AVI.
How do I convert AVI to MP4?
Use HandBrake, or ffmpeg -i in.avi -c:v libx264 -crf 20 -c:a aac out.mp4. If the AVI already holds H.264, -c:v copy keeps the video without re-encoding.
Is AVI better quality than MP4?
Neither container has a quality of its own; it depends on the codec inside. Older AVIs often use older codecs that need larger files for the same quality, and an uncompressed AVI is huge but lossless.
Why can't I play an AVI in Chrome?
No current browser supports the AVI container, and most AVI files also use codecs browsers can't decode. Convert it to MP4 to play it in a browser.
What is the maximum size of an AVI file?
Original AVI files were limited to 1 GB, later 2 GB in practice. The OpenDML extension (AVI 2.0) chains several RIFF chunks together, so the size is limited only by the file system.
Is AVI still used?
Rarely for new video. It survives in old archives, some security and industrial cameras, and scientific instruments. MP4 and MKV have replaced it for nearly everything else.
Can an AVI file contain a virus?
It can't run code by itself, but a crafted file could exploit a decoder bug. The bigger risk is being told to install a "codec" to play it, which is a common malware trick.
Related formats
Other file types explained
Keep going
Related
Sources
- Library of Congress: AVI (Audio Video Interleaved) File Format
- Library of Congress: AVI with OpenDML extensions
- Microsoft: AVI RIFF File Reference
- FFmpeg formats documentation
Last reviewed 27 October 2026.