> ## Content Index
> Fetch the complete content index at: https://ffmpeguru.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Convert AVI to MP4 with H.264 and AAC (the broadly compatible combo)
- URL: https://ffmpeguru.com/convert-avi-to-mp4-with-h-264-and-aac-the-broadly-compatible-combo/
- Published: 2026-10-14T09:00:00.000Z
- Updated: 2026-10-14T09:00:00.000Z
- Author: FFmpeguru
- Tags: ffmpeg

![](https://picsum.photos/seed/ffblog3/1200/630)

AVI is still common in legacy workflows, surveillance footage, and some scientific capture pipelines. Converting to MP4 with H.264 video and AAC audio gives you a file that plays everywhere, from phones to browsers to TVs, at reasonable size.

## The command

```
ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4
```

## What it does

FFmpeg decodes whatever AVI holds (often MJPEG, MPEG-4, or DV), re-encodes the video with the x264 implementation of H.264, re-encodes audio to AAC, and muxes both into the MP4 container. Defaults are sensible: H.264 lands at CRF 23 with a medium preset, AAC at 128 kbps stereo, and the MP4's `mov_text` faststart flag is on, so the file is web-streaming ready.

## When to use it

Whenever the destination is a modern player or browser, and you do not need to preserve the original codec. H.264/AAC inside MP4 is the de-facto universal combo and is the right default unless you have a reason to use HEVC, AV1, or VP9.

## Video and audio requirements

The source can be any AVI variant FFmpeg can decode, including DV, MJPEG, MPEG-4 Part 2, and uncompressed. The output assumes a 4:2:0 chroma subsampling and 8-bit depth, which is the H.264 baseline. For 10-bit or 4:4:4 sources, add `-pix_fmt yuv420p10le` or use HEVC instead.

## Things to avoid

- Leaving the default CRF 23 if you care about file size. CRF 28 is visually transparent for most content and halves the bitrate; CRF 18 is overkill for delivery.
- Converting to MP4 if the source is already H.264/AAC. Use remux (`-c copy`) instead, it is lossless and takes seconds.
- Ignoring interlaced sources. AVI from old cameras is often interlaced; add `-vf yadif` to deinterlace or the output will have comb artifacts on progressive displays.
- Forgetting the `-movflags +faststart` if you removed the default. Without it the MP4 is web-unfriendly.