Manatee

How to convert AVI to MP4 on a Mac

Converting an AVI to MP4 on a Mac means re-encoding the video to H.264, because the codecs inside most AVIs (DivX, Xvid, MJPEG, DV) are ones QuickTime, Photos, and iPhones do not play. One ffmpeg command in Terminal does it, and so does a drag into a converter app; either way the MP4 plays everywhere and the original AVI is left as it was. The only decisions worth making are the quality setting and, for old camcorder footage, whether to deinterlace.

What is usually inside an AVI

AVI is a container from the early 1990s. It predates H.264 and was never updated to carry it cleanly, so the files you meet today are almost always one of these:

  • DivX or Xvid (MPEG-4 Part 2) with MP3 or AC-3 audio: downloads and rips from the 2000s.
  • MJPEG with PCM audio: video clips from older digital still cameras.
  • DV: footage captured from a MiniDV camcorder over FireWire.
  • Uncompressed or lightly compressed video from old capture cards and scientific or industrial equipment, often enormous.

QuickTime Player can open a few of these (MJPEG and DV, sometimes) and not the rest. When it fails, the message is the unhelpful “not compatible”, which is the same thing it says for a damaged file. If you want to be sure the AVI is healthy before converting, open it in an open-source media player; if it plays there, the file is fine and the Mac is simply missing the codec. If it fails everywhere, see how-to-repair-a-damaged-avi-video-on-macos before going further.

Why it has to be a re-encode

MP4 is built around H.264, HEVC, and AAC. None of the codecs above are among them in any way that Apple devices will play, so the video has to be decoded and encoded again. There is no lossless container swap here, unlike MOV to MP4.

The practical upside is that a fresh H.264 encode at a good quality setting from an old DivX file looks exactly like the DivX file did; you are not going to lose anything you can see, and you will get a file that is smaller, seekable, and playable on a phone. The downside is time: on Apple silicon the conversion runs several times faster than real time for standard-definition video, so a ninety-minute file takes a matter of minutes. Intel Macs are slower.

Method one: ffmpeg in Terminal

ffmpeg is the open-source engine behind nearly every converter. It is not part of macOS; a package manager such as Homebrew installs it in one line, or you can download a build from the ffmpeg project site.

  1. Open Terminal.
  2. Type ffmpeg -i and drag the AVI onto the window to fill in its path.
  3. After the path, type the following, then a name for the output ending in .mp4:

-c:v libx264 -crf 20 -preset medium -pix_fmt yuv420p -c:a aac -b:a 160k -movflags +faststart ~/Desktop/output.mp4

  1. Press Return and wait for the progress lines to finish.

What the options do: -c:v libx264 encodes H.264; -crf 20 sets quality (18 is visually lossless, 23 is the default, higher is smaller and softer); -pix_fmt yuv420p ensures a pixel format QuickTime and phones accept; -c:a aac converts MP3, AC-3, or PCM audio to AAC; -movflags +faststart moves the index to the front so the file streams well if uploaded.

If the AVI’s audio is already MP3 and you would rather keep it byte-for-byte, replace -c:a aac -b:a 160k with -c:a copy; MP4 can carry MP3, and Apple players handle it.

Deinterlacing old camcorder footage

DV and many analog captures are interlaced: each frame is two half-frames taken a fraction of a second apart. On a modern progressive screen, motion shows as horizontal comb lines. If you see that when you play the AVI, deinterlace during the conversion by adding a filter before the output name:

-vf yadif

For DV footage that also looks squashed or stretched, the AVI is carrying a non-square pixel aspect ratio that some players ignore. Add -vf "yadif,scale=iw*sar:ih" instead to bake the correct shape into the MP4 (the scale step resizes by the stored aspect ratio so every player shows it correctly).

Interlacing cannot be undone perfectly, so keep the original AVI if it is the only copy of the footage, and deinterlace once, at conversion, rather than on every later edit.

Method two: a drag into Manatee

Manatee bundles its own ffmpeg and does the conversion without Terminal:

  1. Open Manatee and choose Convert.
  2. Choose MP4 as the target.
  3. Drop the AVI into the window or onto the menu bar icon. A folder of AVIs converts as a batch, each with its own progress line in the job list.
  4. The MP4 lands alongside the original. The AVI is never modified.

Manatee chooses the codec and pixel settings so the MP4 opens in QuickTime, imports into Photos, and plays on an iPhone, and it runs entirely on the Mac with nothing uploaded, which is worth knowing when the footage is family video. It is a converter, not an editor: it will not trim, crop, or apply a deinterlace filter on request, so for comb-lined camcorder footage the ffmpeg route above is the one with the control you need. And if the AVI is damaged rather than merely old, Convert will fail; Manatee’s Repair mode is built for that and reports plainly whether the file was fixed, partly recovered, or not fixable.

A note on batches and old archives

People usually meet AVI when digging through an archive: a drive of camcorder captures, a folder of clips from a 2005 camera. Some advice from doing this more than once:

  • Convert the whole set in one go rather than file by file, and let it run overnight if it is large. Both ffmpeg (in a for loop) and Manatee handle batches.
  • Keep the originals until you have spot-checked the MP4s. Play the beginning, middle, and end of a few.
  • Name the MP4s with dates if the AVIs carry them in the filename or in Finder’s Created date; AVI holds almost no metadata, and the conversion will not add any.
  • Expect the MP4s to be much smaller than MJPEG or DV sources (often a tenth the size) and somewhat smaller than DivX sources at the same visual quality.

Once the archive is MP4, Photos will import it, it will sync to an iPhone, and it will play on any TV. That is the point of the exercise. how-to-batch-compress-videos-on-a-mac covers taking the size down further if the archive needs to fit somewhere specific.

Questions

Can I rename .avi to .mp4 and skip all this?

No. AVI and MP4 are structurally different containers, and the codecs inside an AVI are not ones Apple players decode. Renaming changes nothing but the label. QuickTime will refuse the file exactly as before.

The MP4 plays but has no sound.

The AVI’s audio was probably AC-3 copied through unchanged, or a codec ffmpeg could not identify. Redo the conversion with -c:a aac so the audio is re-encoded, or let Manatee handle the conversion, which converts the audio as a matter of course.

The AVI is more than 2 GB and only the first part converts.

Very old AVI writers split at 2 GB and some wrote a second file for the remainder; check the folder for a .avi with a similar name and a suffix. If it is a single file, it may have been written with the extended AVI format, which ffmpeg reads in full; if only the first part converts, the file is likely truncated, and Repair is the next step.

Will the quality be worse after converting?

Not visibly, at a CRF of 18 to 20 or with Manatee’s defaults. What you cannot get back is quality that was never there: a DivX rip from 2004 will look like a DivX rip from 2004, just in a file that finally plays on your phone.