Convert AVI to MP4 with FFmpeg macOS Hardware Acceleration

Converting AVI files to MP4 on macOS can be done quickly and efficiently by leveraging Apple’s hardware acceleration. This guide provides the exact FFmpeg commands needed to utilize the VideoToolbox framework, which offloads the encoding process to your Mac’s GPU, significantly speeding up conversion times and reducing CPU usage.

The Hardware-Accelerated Command

To convert an AVI video to MP4 using H.264 hardware acceleration on macOS, run the following command in your Terminal:

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

Command Breakdown:


Alternative: HEVC (H.265) Hardware Acceleration

If you want a highly compressed, modern format and your Mac supports HEVC encoding, you can use the hevc_videotoolbox encoder instead. This is ideal for reducing file sizes while maintaining high visual quality.

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

Adjusting Video Quality and Bitrate

Because VideoToolbox operates differently from standard software encoders, traditional quality flags like -crf will not work. To control the file size and quality, you should manually specify the video bitrate using the -b:v flag.

For a high-quality 1080p video, a bitrate of 5 Mbps (5000k) is usually recommended:

ffmpeg -i input.avi -c:v h264_videotoolbox -b:v 5000k -c:a aac output.mp4

Adjust the 5000k (5 Mbps) higher for better quality (e.g., 8000k for 4K) or lower to save disk space.