.AVI Audio Video Interleave
.avi

Audio Video Interleave

Convert AVI files to MP4, WebM, or MKV directly in your browser — no upload, no server. FileDex uses FFmpeg WASM to transcode legacy AVI containers locally, converting DivX, Xvid, and MJPEG video to modern H.264/H.265 codecs.

Learn more ↓
Container structure
RIFF AVI header
hdrl stream info
movi interleaved A/V
ContainerRIFFMicrosoftLegacy1992
By FileDex

Your files never leave your device

Common questions

How do I convert AVI to MP4 without losing quality?

AVI typically contains DivX or Xvid codecs that MP4 does not support, so transcoding is required. Use H.264 CRF 18-20 for visually transparent output. The conversion is technically lossy but with CRF 18, differences are imperceptible to the human eye.

Why is my AVI file so large compared to MP4?

AVI files often use older codecs (DivX, MJPEG, uncompressed PCM audio) with less efficient compression than H.264+AAC. Converting to MP4 with H.264 CRF 20 typically reduces file size by 40-70% with no visible quality difference.

Can I play AVI files in my web browser?

No. Modern browsers (Chrome, Firefox, Safari, Edge) do not support AVI in the HTML5 video element. Convert to MP4 or WebM for browser playback. VLC and desktop media players still handle AVI natively.

Is it possible to convert AVI to MKV without re-encoding?

Yes. MKV accepts every codec found in AVI files. Stream copy (ffmpeg -i input.avi -c copy output.mkv) transfers all tracks without re-encoding, preserving the original quality bit-for-bit while adding MKV container features like chapter support.

Why does my AVI file show 'codec not found' errors?

AVI identifies codecs by FourCC codes (e.g., DIVX, XVID, IV50). If your system lacks the matching codec, playback fails. VLC includes all common AVI codecs. Alternatively, convert to H.264 MP4 for universal playback without codec dependencies.

What makes .AVI special

Interleaved audio and video data sit side by side in alternating chunks — that is the core design principle behind AVI (Audio Video Interleave), Microsoft's multimedia container introduced with Video for Windows in 1992. Built on top of the RIFF (Resource Interchange File Format) structure, AVI organizes media into numbered streams stored as interleaved chunks within a single movi LIST, making sequential playback straightforward for hardware that reads data linearly from disk.

Continue reading — full technical deep dive

RIFF chunk architecture

Every AVI file begins with a 12-byte RIFF header: four bytes spelling RIFF, a 32-bit little-endian size field, and the form type AVI . Inside, two primary LIST chunks define the file. The hdrl LIST holds the main AVI header (avih) plus one stream header (strh) and stream format (strf) pair per track. The movi LIST holds the actual interleaved data chunks, each tagged with a four-character code like 00dc (first video stream, compressed) or 01wb (second stream, audio waveform).

The RIFF size field is a 32-bit unsigned integer. This caps a single RIFF structure at 4 GB. For larger files, the OpenDML extension (odml) chains multiple RIFF segments together, but support varies across players and editors.

The idx1 fragility problem

AVI's standard index is a single idx1 chunk written at the very end of the file. It contains one 16-byte entry per data chunk: a chunk ID, flags, byte offset, and size. Players use this index to seek to arbitrary frames. Here is the critical weakness: AVI's fixed-size index (idx1) at the file end means a 2-hour recording that crashes at 1:59 loses the entire index — unlike MKV, which writes cluster-level indexes throughout the file. Recovery tools like DivFix++ can rebuild the index by scanning chunk headers, but the process is slow and sometimes misidentifies chunk boundaries.

OpenDML addresses this with a indx super-index that points to smaller standard indexes distributed through the file, but many recording applications still write only idx1.

Codec compatibility

AVI is codec-agnostic. Common pairings include:

Era Video Codec Audio Codec Typical Use
1990s Cinepak, Indeo 3/5 PCM, ADPCM CD-ROM titles
2000s DivX, Xvid (MPEG-4 ASP) MP3, AC-3 File sharing
2010s+ Motion JPEG PCM Security cameras, industrial capture

Modern H.264 or H.265 streams can technically be placed in AVI, but doing so strips B-frame reordering metadata and variable frame rate signaling. Use MP4 or MKV for those codecs.

Performance characteristics

AVI's interleaved layout performs well for sequential reads. A 1080p DV-AVI stream at 25 Mbit/s plays smoothly from spinning hard drives because audio and video chunks alternate at predictable intervals — no large seeks required. Random access is fast when a valid index exists: a single lookup gives the byte offset of any frame.

File overhead is minimal. The headers and index for a 1-hour file with one video and one audio stream add roughly 10–20 MB, under 0.1% of total size for high-bitrate content.

When to use AVI

AVI remains the right choice for Motion JPEG workflows in industrial imaging, security DVRs, and legacy NLE pipelines that expect RIFF-based input. It is also the only container some older hardware encoders output. For everything else — streaming, web delivery, multi-subtitle packaging, variable frame rate content — MP4 or MKV are better choices. AVI cannot carry chapter markers, font attachments, or multiple subtitle tracks without nonstandard hacks.

FileDex converts AVI to MP4, MKV, or WebM directly in the browser, preserving video quality while moving your content into a modern container.

.AVI compared to alternatives

.AVI compared to alternative formats
Formats Criteria Winner
.AVI vs .MP4
Streaming support
MP4 supports progressive download, DASH, and HLS. AVI requires full file download before playback — it has no native streaming capability.
MP4 wins
.AVI vs .MP4
Maximum file size
AVI 1.0 is limited to 2 GB per RIFF segment. MP4 uses 64-bit atom sizes with no practical limit. OpenDML AVI 2.0 extends to 256 GB but with poor software support.
MP4 wins
.AVI vs .MKV
Subtitle support
MKV supports SRT, ASS/SSA, PGS, and VobSub subtitles with full styling. AVI has no standardized subtitle track support.
MKV wins
.AVI vs .MKV
Codec compatibility
Both accept legacy codecs, but MKV also supports modern codecs (H.265, AV1, Opus, FLAC) plus chapters, attachments, and ordered chapters.
MKV wins

Technical reference

MIME Type
video/x-msvideo
Magic Bytes
52 49 46 46 xx xx xx xx 41 56 49 20 RIFF header followed by AVI signature at bytes 8-11.
Developer
Microsoft
Year Introduced
1992
Open Standard
No
0000000052494646XXXXXXXX41564920 RIFF....AVI

RIFF header followed by AVI signature at bytes 8-11.

Binary Structure

AVI files use Microsoft's RIFF (Resource Interchange File Format) container, a chunk-based binary structure. Every chunk has a 4-byte FourCC type, a 4-byte little-endian size, and payload data. The file begins with a 12-byte RIFF header: 'RIFF' FourCC, file size, and 'AVI ' form type. Inside, the 'hdrl' list chunk contains the main AVI header (avih) with frame count, dimensions, and timing, followed by 'strl' list chunks for each stream (video, audio). Each stream header (strh) declares the FourCC codec identifier and data rate, while the stream format (strf) provides codec-specific parameters (e.g., BITMAPINFOHEADER for video). The 'movi' list chunk holds interleaved audio and video data chunks (identified by stream index: '00dc' for video, '01wb' for audio). An optional 'idx1' index chunk at the end maps frame offsets for seeking. OpenDML AVI 2.0 adds an 'indx' super-index to break the 2 GB RIFF size limit by chaining multiple RIFF-AVIX segments.

OffsetLengthFieldExampleDescription
0x00 4 bytes RIFF FourCC 52 49 46 46 (RIFF) RIFF container identifier. All AVI files start with this signature.
0x04 4 bytes File Size little-endian uint32 Total file size minus 8 bytes (RIFF header). Limited to ~2 GB in AVI 1.0.
0x08 4 bytes AVI Form Type 41 56 49 20 (AVI ) Identifies this RIFF file as AVI. The trailing space (0x20) is part of the FourCC.
0x0C 4 bytes hdrl List FourCC 4C 49 53 54 (LIST) Start of the header list containing AVI headers and stream definitions.
variable 56 bytes avih (Main AVI Header) 61 76 69 68 (avih) Contains microseconds-per-frame, max bytes per second, total frames, stream count, and video dimensions.
1992Microsoft introduces AVI as part of Video for Windows 1.01996OpenDML AVI 2.0 specification extends the 2 GB file size limit via RIFF-AVIX segments1999DivX codec popularizes AVI for internet video distribution2003Xvid open-source MPEG-4 ASP codec becomes the standard AVI codec for file sharing2008H.264/MP4 adoption accelerates; AVI usage begins declining as web video shifts to streaming2012Major browsers drop AVI playback support in HTML5 video; format becomes legacy-only
Convert AVI to H.264 MP4 for universal playback ffmpeg
ffmpeg -i input.avi -c:v libx264 -crf 20 -c:a aac -b:a 128k -movflags +faststart output.mp4

Transcodes DivX/Xvid video to H.264 and audio to AAC. -crf 20 provides high visual quality. -movflags +faststart enables HTTP progressive download. This is the standard AVI modernization command.

Remux AVI to MKV (zero quality loss) ffmpeg
ffmpeg -i input.avi -c copy output.mkv

-c copy performs stream copy of all tracks into the MKV container without re-encoding. The original DivX/Xvid bitstream is preserved bit-for-bit while gaining MKV container features.

Repair AVI with broken index ffmpeg
ffmpeg -i input.avi -c copy -fflags +genpts output.avi

-fflags +genpts regenerates presentation timestamps. Combined with -c copy, this rebuilds the idx1 index chunk without re-encoding, restoring seeking capability in files with corrupt or missing indexes.

Inspect AVI stream information ffprobe
ffprobe -v error -show_entries stream=index,codec_name,codec_type,width,height,r_frame_rate,bit_rate -of csv=p=0 input.avi

Lists each stream's codec, type, resolution, frame rate, and bitrate. Useful for determining whether stream copy to MKV is possible or full transcode is needed for MP4 conversion.

AVI MP4 transcode lossy AVI codecs (DivX, Xvid, MJPEG) are not supported inside MP4 containers. Transcoding to H.264+AAC in MP4 enables playback on all modern browsers, mobile devices, and social platforms that reject AVI uploads entirely.
AVI MKV remux lossless MKV accepts every codec AVI supports without transcoding. Stream copy preserves the original DivX/Xvid/MJPEG bitstream while gaining chapter support, multiple subtitle tracks, and modern container features absent from AVI.
AVI WEBM transcode lossy WebM requires VP8/VP9/AV1 codecs not found in AVI files. Full transcode is required but produces files optimized for HTML5 browser playback with better compression than the original DivX/Xvid source.
AVI MOV transcode lossy MOV (QuickTime) does not support DivX or Xvid FourCC codes natively. Transcoding to H.264+AAC inside MOV provides compatibility with Apple editing workflows in Final Cut Pro and iMovie.
AVI MP3 export variable Extracting the audio track from an AVI file for standalone playback. If the AVI contains MP3 audio, stream copy avoids re-encoding. PCM or AC-3 audio requires transcoding to MP3.
MEDIUM

Attack Vectors

  • Malformed RIFF chunk with oversized length field triggers buffer overflow in parsers that allocate memory based on declared chunk size without bounds checking
  • Embedded DivX/Xvid codec FourCC pointing to a malicious codec DLL — Windows searches the system PATH for the named codec, enabling DLL hijacking
  • Crafted idx1 index with invalid offsets causes out-of-bounds read when player seeks to a specific timestamp
  • OpenDML extended AVI with circular RIFF-AVIX segment references causes infinite parser loop and denial-of-service

Mitigation: FileDex processes AVI files entirely in-browser via FFmpeg WASM inside a Web Worker sandbox. No file data leaves the device. The WASM runtime uses its own codec implementations (no system DLL loading), eliminating DLL hijack vectors. Browser memory limits prevent allocation-based overflow exploits.

Cross-platform player with native AVI and legacy codec support
FFmpeg tool
CLI tool for AVI demuxing, transcoding, and index repair
VirtualDub tool
Legacy AVI editor for frame-accurate cutting and filtering
AviSynth library
Frameserver script environment for AVI processing pipelines
HandBrake tool
Open-source transcoder for converting AVI to MP4 or MKV