Audio Format Conversion — WAV, MP3, AAC, and FLAC

Converting audio file formats is one of the most fundamental uses of FFmpeg. Depending on the situation, you may need WAV for importing into an editor, AAC or MP3 for distribution, or FLAC for archival purposes. This article systematically explains the major audio formats and the FFmpeg commands for converting between them.

Tested with: ffmpeg 6.1.1 / Ubuntu 24.04


1. Overview of Major Audio Formats

FormatTypeCharacteristics
WAVUncompressed / LosslessHighest quality, large file size. Suitable for editing
FLACLossless compressedSame quality as WAV, smaller file size
MP3Lossy compressedHigh compatibility, small file size
AACLossy compressedMore efficient than MP3, widely used in MP4/M4A

Lossy formats (MP3, AAC) cannot restore the original audio quality once converted. Lossless formats (WAV, FLAC), on the other hand, do not degrade in quality through repeated encode/decode cycles.


2. Convert WAV to MP3

ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3

To convert with a fixed bitrate, use -b:a:

ffmpeg -i input.wav -c:a libmp3lame -b:a 192k output.mp3

3. Convert WAV to AAC

ffmpeg -i input.wav -c:a aac -b:a 192k output.aac

To output as an M4A container (iTunes / Apple compatible), use the .m4a extension:

ffmpeg -i input.wav -c:a aac -b:a 192k output.m4a

4. Convert MP3 to FLAC (Lossy to Lossless — Important Note)

ffmpeg -i input.mp3 -c:a flac output.flac

This command is valid, but converting from MP3 (lossy) to FLAC (lossless) does not restore audio quality. FLAC simply stores the source data faithfully; it cannot recover information already lost through MP3 compression. Despite the larger FLAC file size, the actual audio quality remains that of the original MP3.

Lossless conversion is only meaningful when going from “lossless to lossless” (e.g., WAV to FLAC). Converting MP3 or AAC to FLAC for archival purposes is generally not recommended.


5. Convert FLAC to AAC

ffmpeg -i input.flac -c:a aac -b:a 256k output.aac

Converting from lossless to lossy is technically fine. This is a common workflow for compressing high-quality source audio for distribution or sharing.


6. Convert MP3 to WAV

ffmpeg -i input.mp3 -c:a pcm_s16le output.wav

pcm_s16le is 16-bit little-endian PCM, the standard WAV format. It is suitable for importing into editing software or using directly in a DAW. As noted above, audio quality lost through MP3 compression cannot be recovered.


7. Difference Between -b:a (CBR/ABR) and -q:a (VBR)

-b:a: Bitrate Specification

ffmpeg -i input.wav -c:a libmp3lame -b:a 128k output.mp3

According to the official documentation, -b:a is the option to “set bitrate in bits/s”. For the AAC encoder, setting -b:a automatically enables CBR (constant bitrate) mode. Use this when you need to calculate and control the output file size in advance.

-q:a: VBR Quality Specification

ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3

-q:a sets the quality for VBR (variable bitrate) mode. Since the bitrate varies dynamically based on content complexity, it can result in more efficient file sizes for the same perceived quality. For libmp3lame, the valid range is 0–9, where 0 is the highest quality.

Which to use: Use -b:a when you need strict control over output size, and -q:a when quality is the priority.


8. Sample Rate Conversion: -ar

Use -ar when you need to change the sample rate.

ffmpeg -i input.wav -ar 44100 -c:a libmp3lame -q:a 2 output.mp3

Common sample rates:

RateUse Case
44100CD quality, general music
48000Video, broadcast standard
22050Low quality, mobile
16000Speech recognition, VoIP

The official documentation states “For output streams it is set by default to the frequency of the corresponding input stream”, so you can omit this option if no change is needed.


9. Checking Format Before Conversion

It is good practice to check the audio information of the input file before running conversion commands.

ffprobe -v error -select_streams a -show_entries stream=codec_name,sample_rate,bit_rate,channels -of default=noprint_wrappers=1 input.mp3

Quick Reference: Conversion Patterns

SourceTargetExample Command (key options)
WAVMP3-c:a libmp3lame -q:a 2
WAVAAC-c:a aac -b:a 192k
WAVFLAC-c:a flac
FLACAAC-c:a aac -b:a 256k
MP3WAV-c:a pcm_s16le
AACMP3-c:a libmp3lame -q:a 2


Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner)
Primary sources: ffmpeg.org/ffmpeg.html / ffmpeg.org/ffmpeg-codecs.html / ffmpeg.org/ffmpeg-filters.html