What is inside an AVI

AVI (Audio Video Interleave) is a container format Microsoft created in 1992. Its main problem today is fragmentation: the same .avi file can hold dozens of different video and audio codec combinations, many of which modern hardware and software no longer support.

The codecs you most often find in AVI files, by era:

A container is not a codecDiagram: an MKV holding H.264 video and FLAC audio becomes an MP4 by copying the streams; re-encoding happens only when the target container will not take the codec.THE CONTAINER IS THE BOXTHE CODECS ARE WHAT IS INSIDEMKVMP4H.264 videoH.264 videoFLAC audioAAC audiocopy streamsChanging container leaves the codecs alone: the streams are copied across.Re-encoding is only needed when the target container will not take that codec,such as FLAC inside an MP4, or when the video codec is DivX, Xvid or MPEG-2.
With AVI the content is the problem: DivX or Xvid inside an MP4 force a re-encode.
EraVideoAudioCompatibility today
1992–2000
Digitised VHS, VCD
MPEG-1, Indeo, Cinepak MP3, PCM Limited
2000–2008
DivX, P2P downloads
DivX, Xvid, MPEG-4 ASP MP3, AC-3 Partial
2008–2015
Screen recordings
H.264 (x264), MJPEG MP3, AAC, PCM Good
DV cameras (MiniDV) DV / HDV Stereo PCM Good (with codecs)
IP / security cameras H.264, MJPEG G.711, PCM Varies

The key point: AVI is the envelope, not the contents. Swapping the envelope for MP4 changes neither the video nor the audio quality — provided the codecs are compatible with MP4.

Remux vs re-encode: when to use which

There are two ways to convert an AVI to MP4, and picking the right one is the difference between zero quality loss and visible degradation:

  • Remux: only the container changes. Video and audio are copied bit for bit, without being decoded or recompressed. It is far quicker than a re-encode and lossless. It only works if the AVI's codecs are compatible with MP4.
  • Re-encode: the video is decoded frame by frame and recompressed with a new codec, usually H.264 or H.265. Each generation adds further quality loss. Use it only when a remux is not possible.
Rule of thumb: if your AVI has H.264 video — a modern AVI, or a screen recording from around 2008 onwards — remux it. If it has DivX, Xvid or any older MPEG-4 ASP, you can technically remux too, but many modern players will not play those codecs inside an MP4 either. In that case a re-encode to H.264 is more compatible, at the cost of some loss.

When an AVI → MP4 remux just works

Remuxing AVI to MP4 is possible when the codecs are compatible with the MP4 standard (ISO 14496):

  • H.264 video — fully compatible with MP4.
  • H.265 (HEVC) video — compatible with MP4.
  • MPEG-4 ASP video (DivX, Xvid) — technically compatible, but poorly supported in modern players.
  • MP3 audio — compatible with MP4, though not ideal.
  • AAC audio — compatible with MP4.
  • PCM audio — compatible in the M4A/MP4 variant, but the file can get large.

When you need a re-encode (and how to minimise the loss)

A re-encode is necessary when the AVI carries codecs the MP4 container will not accept, or that modern players do not understand:

  • DV / HDV — MiniDV camera video will not fit into MP4 without a re-encode.
  • Indeo, Cinepak, RLE — very old codecs that nothing modern decodes. They need a re-encode.
  • MJPEG — it technically fits in MP4, but the result can be enormous and poorly supported. Re-encoding to H.264 is more practical.
  • AC-3 audio in AVI — AC-3 is not standardised in the MP4 container. The audio has to be converted, to AAC or FLAC.

If you do need a re-encode, use a low CRF to keep the loss down. -crf 18 with libx264 is practically indistinguishable from the original for most material:

ffmpeg -i input.avi -c:v libx264 -crf 18 -preset slow -c:a flac output.mp4

Converting AVI to MP4 without installing anything

VidToFLAC accepts AVI files and exports to MP4 or MKV. When the AVI has H.264 or another compatible codec, the video is copied without recompression. The audio is converted to FLAC automatically. If the AVI carries a video codec MP4 cannot hold, VidToFLAC re-encodes it to H.264 to guarantee compatibility.

Nothing to install · private and local

Convert your AVI to MP4 free, right in the browser

Drop in the AVI, pick MP4 as the output and press Convert. Everything runs on your device with FFmpeg.wasm — no file is uploaded anywhere.

Convert AVI to MP4 free
1
Open VidToFLAC in your browser

It works in Chrome, Firefox, Edge and Safari. No account, no installation.

2
Drop in the AVI (or several at once)

VidToFLAC detects the video codec automatically and decides whether it can remux or needs to re-encode.

3
Choose the output format

Pick "MP4 + FLAC" for the broadest compatibility with players and editors. If the destination is DaVinci Resolve on Linux, "MKV + FLAC" works just as well.

4
Download the result

For AVI files with H.264 the process takes a matter of seconds. For older codecs that need a re-encode it takes longer, depending on length and resolution.

AVI in DaVinci Resolve: the audio problem

If you import an AVI straight into DaVinci Resolve on Linux, it will most likely fail, and not always because of the audio. In our Studio 21 test on Ubuntu, an AVI with Xvid video and MP3 audio never reached the Media Pool, while the same MP3 audio inside an MP4 imported fine. What does fail on Linux is AC-3, the other common AVI audio codec: there is no licence to decode it.

AVI audioDaVinci Resolve Windows/macOSDaVinci Resolve Linux (free)
MP3YesYes, per users (not tested here)
AC-3 (Dolby)Partial on WindowsNo
PCM / WAVYesYes
FLACYesYes

The fix: convert the AVI with VidToFLAC before importing it. The MP3 or AC-3 audio becomes FLAC, which DaVinci Resolve handles perfectly well on Linux, and the file becomes an MKV, which does import. The video is copied without re-encoding when the codec allows it.

Editing on Windows or macOS? On those systems DaVinci Resolve usually imports AVI with MP3 without trouble. But many old video codecs — DivX, Xvid, Indeo — do not work well in DaVinci Resolve on Windows, macOS or Linux either. If the imported clip stutters or shows artefacts, convert it with VidToFLAC first.

Converting AVI to MP4 with FFmpeg in the terminal

First, find out which codecs the AVI contains:

ffprobe -v quiet -show_streams -select_streams v:0 input.avi | grep codec_name
ffprobe -v quiet -show_streams -select_streams a:0 input.avi | grep codec_name

If the video is H.264 — a direct remux: lossless, with no re-encoding:

ffmpeg -i input.avi -c:v copy -c:a flac output.mp4

If the video is DivX, Xvid or MPEG-4 ASP — re-encode to H.264 for the broadest compatibility:

ffmpeg -i input.avi -c:v libx264 -crf 18 -preset slow -c:a flac output.mp4

If the video is DV (MiniDV camera) — re-encode while keeping the original aspect ratio:

ffmpeg -i input.avi -c:v libx264 -crf 18 -vf "scale=720:576" -c:a flac output.mp4

To process a whole folder of AVI files:

for f in *.avi; do
  ffmpeg -i "$f" -c:v copy -c:a flac "${f%.avi}.mp4" 2>/dev/null || \
  ffmpeg -i "$f" -c:v libx264 -crf 18 -c:a flac "${f%.avi}.mp4"
done

The loop tries the direct remux first; if that fails because the video is not MP4-compatible, it falls back to the re-encode.

If you are heading into DaVinci Resolve after converting the AVI, see also the guide to every audio error in DaVinci Resolve and the guide to installing DaVinci Resolve on Linux.

Frequently asked questions

Do you lose quality converting AVI to MP4?

It depends on the method. With a remux — changing only the container — nothing is lost. With a re-encode, which recompresses the video, there is loss. For AVI files with H.264 video a remux is possible and lossless. For DivX or Xvid, a re-encode may be needed for modern players to cope.

Why won't my AVI files open in players or in DaVinci Resolve?

AVI is an old format and many modern players no longer support its most obsolete codecs — DivX, Xvid, Indeo. In DaVinci Resolve on Linux, many AVI files will not even import, and AC-3 audio cannot be decoded because the licence is missing. Converting the AVI to MKV or MP4 with FLAC audio solves both problems.

Does VidToFLAC convert AVI to MP4?

Yes. VidToFLAC accepts AVI as input and exports to MP4 or MKV. The video is copied without recompression when the codec allows it, and the audio becomes FLAC. If the AVI holds a video codec MP4 cannot take, VidToFLAC re-encodes it to H.264 automatically.

How long does converting an AVI to MP4 take?

If the AVI has H.264 and can be remuxed, conversion takes a matter of seconds. If it needs a re-encode, the time depends on resolution, length and how powerful your machine is, ranging from minutes to hours for very long high-resolution material.

Can I edit AVI directly in DaVinci Resolve?

Sometimes, but with limitations. DaVinci Resolve can import some AVI files, but not every codec is supported, and on Linux AC-3 audio does not work. The recommended practice is to convert the AVI to MKV with FLAC audio using VidToFLAC first — editing in DaVinci Resolve afterwards is smoother and holds no surprises.