Convert AVI to MP4 — Free Online Tool

Convert AVI files to MP4 by re-encoding the video with H.264 (libx264) and audio with AAC — producing a universally compatible MP4 file ready for web playback, modern devices, and streaming platforms. AVI's legacy container structure is replaced with MP4's optimized format, including the faststart flag for instant browser and mobile playback.

FFmpeg Command

Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg

Free — no uploads, no signups. Your files never leave your browser.

Estimated output:

Conversion Complete!

Download

How It Works

AVI files use an older Microsoft RIFF-based container that typically stores video encoded with codecs like DivX, Xvid, or MJPEG alongside MP3 audio. During this conversion, the video stream is fully re-encoded from whatever codec the AVI contains into H.264 (libx264) — one of the most widely supported video codecs in the world. The audio is transcoded to AAC at 128k bitrate, replacing the common MP3 audio found in most AVI files with AAC, which offers better quality at equivalent bitrates and is natively required by the MP4 container spec for broadest compatibility. The output MP4 also receives the -movflags +faststart flag, which relocates the MP4 metadata index (the 'moov' atom) to the beginning of the file, enabling video playback to begin before the file has fully downloaded — something the AVI format is structurally incapable of.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg program — the open-source multimedia processing engine that powers this conversion both in the browser (via FFmpeg.wasm) and on your local desktop installation.
-i input.avi Specifies the input file — an AVI container whose internal video and audio streams (typically DivX/Xvid/MJPEG video and MP3 audio) will be read, decoded, and re-encoded into the MP4 output.
-c:v libx264 Re-encodes the video stream using the libx264 encoder, producing H.264 video — the most universally compatible video codec for MP4, supported natively by every major browser, mobile OS, smart TV, and streaming platform.
-c:a aac Transcodes the audio stream (commonly MP3 in AVI files) to AAC — the audio codec preferred by the MP4 container spec, offering better sound quality than MP3 at the same bitrate and required for native playback on iOS and many streaming platforms.
-crf 23 Sets the H.264 Constant Rate Factor to 23, the libx264 default, which produces a good balance between visual quality and file size. Lower values (e.g., 18) increase quality and file size; higher values (e.g., 28) reduce both — useful when converting large AVI archives.
-b:a 128k Sets the AAC audio bitrate to 128 kilobits per second, which is sufficient for stereo audio at standard quality. If the source AVI contains high-quality surround or music audio, increasing this to 192k or 256k will better preserve it.
-movflags +faststart Moves the MP4 moov atom (metadata index) to the start of the output file, enabling progressive streaming and instant playback in browsers and mobile apps before the full file downloads — a capability the AVI container format is structurally unable to provide.
output.mp4 The output filename, which tells FFmpeg to write an MP4 container. The .mp4 extension signals the MPEG-4 Part 14 container format, which will wrap the newly encoded H.264 video and AAC audio streams produced from the source AVI.

Common Use Cases

  • Uploading old AVI home videos or camcorder recordings to YouTube, Instagram, or Vimeo, which either reject AVI outright or transcode it with quality loss on their end
  • Making AVI files captured by legacy security cameras or DVR systems playable on iPhones, iPads, and Android devices that don't support the AVI container
  • Preparing AVI footage from older video editing software (like early Windows Movie Maker exports) for use in modern NLEs or sharing via cloud services like Google Drive or Dropbox with inline preview support
  • Converting DivX or Xvid-encoded AVI movies downloaded in the early 2000s into a format compatible with modern smart TVs, Plex media servers, and Chromecast
  • Archiving AVI files from MiniDV tape captures or DVD rips into the more future-proof MP4/H.264 format with smaller file sizes
  • Enabling web embedding of AVI video content — browsers cannot natively play AVI files, but MP4 with H.264 plays directly in every major browser without plugins

Frequently Asked Questions

Because AVI files almost always contain already-compressed video (DivX, Xvid, MJPEG, or similar), re-encoding to H.264 is a lossy-to-lossy transcode — commonly called a 'generation loss' conversion. At the default CRF 23 setting, the quality loss is minimal and imperceptible for most content, but it is not lossless. If your AVI contains uncompressed or lossless video, you can lower the CRF value (closer to 0) to maximize quality retention. For archival purposes, consider using CRF 18 or lower.
AVI files are notorious for storing audio with variable bitrate (VBR) MP3, which can cause desync when remuxed into other containers. This tool re-encodes the audio to AAC, which typically fixes desync issues. If your output still has sync problems, the source AVI may have a corrupted or non-standard audio stream — try adding '-async 1' to the FFmpeg command to force audio resampling to fix sync drift.
The +faststart flag moves the MP4 moov atom (the file's metadata index) from the end of the file to the beginning, allowing video players and browsers to begin playback before the entire file has been downloaded. AVI uses a RIFF container structure where index data is appended at the end of the file, making streaming and progressive playback impossible by design — which is one of the key reasons AVI became obsolete for modern web use.
It depends entirely on what codec was used inside the original AVI. If the AVI contains old DivX or Xvid video encoded at a high bitrate, the H.264 output at CRF 23 will typically be noticeably smaller at equal or better quality, because H.264 is far more efficient. If the AVI contains MJPEG or uncompressed video, the MP4 will be dramatically smaller. In rare cases where the AVI already contained well-optimized H.264 video (some AVI files do), the output may be similar in size.
Yes. On Linux or macOS, you can batch process with a shell loop: 'for f in *.avi; do ffmpeg -i "$f" -c:v libx264 -c:a aac -crf 23 -b:a 128k -movflags +faststart "${f%.avi}.mp4"; done'. On Windows Command Prompt, use: 'for %f in (*.avi) do ffmpeg -i "%f" -c:v libx264 -c:a aac -crf 23 -b:a 128k -movflags +faststart "%~nf.mp4"'. This processes every AVI in the current directory sequentially.
The -crf flag controls quality using a scale from 0 (lossless) to 51 (worst quality). The default of 23 is a balanced midpoint. To prioritize quality over file size, lower the CRF — CRF 18 is often considered visually lossless for H.264. To reduce file size at the cost of some quality, raise the CRF toward 28–30. For audio, change -b:a 128k to a higher value like -b:a 192k or 256k if the source AVI has high-quality audio tracks worth preserving.

Technical Notes

AVI (Audio Video Interleave) uses Microsoft's RIFF container, which was designed in 1992 and lacks native support for features now considered standard: there is no streaming capability, no chapter support, no subtitle tracks, and no standardized way to store metadata like GPS coordinates or creation timestamps. During conversion, any embedded RIFF metadata (title, author fields) may not transfer to MP4's metadata atoms, so you may want to add '-metadata title="Your Title"' to the FFmpeg command to set MP4-native tags. AVI files can technically contain H.264 video, but this is non-standard and causes compatibility issues with many players — the conversion here always outputs clean, spec-compliant H.264 in an MP4 wrapper. One known AVI limitation worth noting: AVI does not support multiple audio tracks in a standard-compliant way, though some AVI files use unofficial hacks to store them. This tool maps the primary audio stream; secondary tracks may be lost. The output MP4 fully supports multiple audio tracks if you re-add them manually via FFmpeg's -map flags.

Related Tools