Convert AVI to MP3 with ffmpeg

Extract audio from AVI to MP3 with ffmpeg: VBR and CBR encoding, lossless stream copy when the audio is already MP3, and a batch loop for many files.
October 26, 2026

Convert AVI to MP3 with ffmpeg

There are times when you need to extract only the audio from a video file.
When converting audio from AVI files to MP3, using ffmpeg is the simplest and fastest method.
If ffmpeg is not installed on your system, install it first using your package manager.
Install ffmpeg on Ubuntu or Debian
sh
On macOS, install it with Homebrew (brew install ffmpeg).

Basic Audio Extraction (VBR)

This is the default command to convert to high-quality MP3 using variable bitrate (VBR).
Extract audio with VBR quality
sh
The key options mean the following:
  • -vn: Disables video recording and extracts only the audio.
  • -c:a libmp3lame: Encodes the audio in MP3 format (libmp3lame).
  • -q:a 2: Sets the VBR quality level. Lower values yield higher quality, and setting it to 2 provides excellent quality around 190 kbps.

Fixed Bitrate (CBR) Extraction

If you prefer a constant bitrate (CBR) instead of a variable bitrate, specify the -b:a option.
Extract audio with fixed bitrate (192kbps)
sh

Stream Copy Without Re-encoding

If the audio codec included in the original AVI file is already MP3, copying only the stream with the copy option without re-encoding is much faster and involves zero quality loss. However, if the audio uses a different codec such as AC3 or PCM, this method will fail or produce an unplayable file. First check the audio codec using ffprobe.
Check the audio codec of the AVI file
sh
Use the command below only when the output is mp3.
Extract audio stream directly without re-encoding
sh

Batch Processing Multiple AVI Files

When converting all AVI files in a specific directory to MP3 at once, you can use a simple shell loop. Since *.avi is case-sensitive, uppercase extensions like .AVI need to be run separately with *.AVI. If an MP3 with the same name already exists, ffmpeg will prompt whether to overwrite it; to overwrite without asking, add -y, or to skip, add -n before -i.
Batch convert all AVI files in the directory
sh
Jooojub
System S/W engineer
Explore Tags
Series
    Recent Post
    © 2026. jooojub. All right reserved.