WaveSpeedAI

How to Convert Audio to MP3, AAC, FLAC, WAV with FFmpeg (2026 Guide)

Step-by-step guide to converting audio files between MP3, AAC, FLAC, WAV, and OGG using FFmpeg commands. Plus a free one-click alternative with WaveSpeed Desktop.

By WaveSpeedAI8 min read
How to Convert Audio to MP3, AAC, FLAC, WAV with FFmpeg (2026 Guide)

Whether you need to convert a WAV recording to MP3 for sharing, extract FLAC from a CD rip, or transcode audio for a mobile app—FFmpeg can handle it from the command line. This guide covers common audio conversions with copy-paste commands.

If command-line tools aren’t your thing, we’ll show you a free desktop option at the end.

Prerequisites: Install FFmpeg

macOS​ (Homebrew):

brew install ffmpeg

​Ubuntu/Debian:

sudo apt update && sudo apt install ffmpeg

Windows: Download from ffmpeg.org, extract the build you choose, and add its bin folder to your system PATH.

Verify:

ffmpeg -version
ffprobe -version

Basic Audio Conversions

Before picking a command, separate the codec from the ​file format​. AAC is an audio codec; .m4a is a common container for it. Changing a filename extension alone does not convert the audio.

Desired fileAudio codec in these examplesCommand optionWhat to expect
.mp3MP3-c:a libmp3lameLossy; widely compatible
.m4aAAC-c:a aacLossy; useful when an app requests AAC
.flacFLAC-c:a flacLossless, but cannot restore detail lost in an MP3
.wav16-bit PCM-c:a pcm_s16leUncompressed audio; usually a larger file
.oggVorbis-c:a libvorbisLossy; check device support

These are the combinations used below, not every combination FFmpeg supports. Check the codec documentation and format documentation if your target app requires something else. Sources checked November 4, 2026.

WAV to MP3

ffmpeg -i input.wav -c:a libmp3lame -b:a 320k output.mp3
  • -c:a libmp3lame — MP3 encoder
  • -b:a 320k — a 320 kbps bitrate target; the output is still lossy

MP3 to WAV

ffmpeg -i input.mp3 -c:a pcm_s16le output.wav
  • -c:a pcm_s16le — uncompressed 16-bit PCM. The larger WAV file does not recover detail removed by MP3 compression.

FLAC to MP3

ffmpeg -i input.flac -c:a libmp3lame -b:a 320k output.mp3

MP3 to FLAC

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

Note: FFmpeg decodes the MP3 and encodes the result as FLAC. That prevents further loss from this conversion, but it cannot restore audio information already discarded by the MP3.

WAV to AAC

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

MP3 to AAC

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

This converts between two lossy codecs. If you still have the original WAV or FLAC, use that as the source instead.

WAV to OGG (Vorbis)

ffmpeg -i input.wav -c:a libvorbis -q:a 6 output.ogg
  • -q:a 6 — Vorbis VBR quality setting. FFmpeg documents a range of ​−1 to 10​, with higher values requesting higher quality.

OGG to MP3

ffmpeg -i input.ogg -c:a libmp3lame -b:a 256k output.mp3

Advanced Options

Control MP3 Quality with VBR

Variable bitrate lets the encoder allocate bits according to the audio rather than using one fixed bitrate target:

ffmpeg -i input.wav -c:a libmp3lame -q:a 0 output.mp3
-q:a valueApproximate average bitrateQuality setting
0~245 kbpsHighest in this table
2~190 kbpsHigh
4~165 kbpsModerate
6~130 kbpsLower
9~65 kbpsLowest in this table

The bitrates are ​estimates​, not guaranteed outputs; they vary with the source. Use -b:a 320k when you need a fixed bitrate target, or -q:a when you want MP3 VBR. Do not combine the two settings and assume both targets will apply.

Change Sample Rate

Convert to 44.1 kHz when your destination requires it:

ffmpeg -i input.wav -ar 44100 -c:a libmp3lame -b:a 320k output.mp3

Convert to 48 kHz when your video workflow requires it:

ffmpeg -i input.wav -ar 48000 -c:a aac -b:a 256k output.m4a

-ar resamples the audio. Raising the number does not add detail that was missing from the source.

Change Channels (Stereo to Mono)

ffmpeg -i input.mp3 -ac 1 -c:a libmp3lame output_mono.mp3
  • -ac 1 — mono
  • -ac 2 — stereo

Extract Audio from Video

ffmpeg -i video.mp4 -vn -c:a libmp3lame -b:a 320k audio.mp3
  • -vn — discard video

Extract without re-encoding ​if the selected audio stream is already AAC​:

ffmpeg -i video.mp4 -vn -c:a copy audio.m4a

Check the source codec with ffprobe before using copy; the codec must be accepted by the output container.

Trim Audio

Extract a 30-second clip starting at 1:00:

ffmpeg -i input.mp3 -ss 00:01:00 -t 00:00:30 -c copy clip.mp3

Stream copying avoids re-encoding, but the cut may not land exactly where you expect with compressed audio. Re-encode if you need a precise edit.

Adjust Volume

Multiply the audio signal by 1.5:

ffmpeg -i input.mp3 -af "volume=1.5" output.mp3

That is a signal-level change, not a promise that listeners will perceive it as “50% louder.”

Apply FFmpeg’s loudnorm filter:

ffmpeg -i input.mp3 -af loudnorm output.mp3

For a delivery target with strict loudness requirements, check the measured output rather than assuming a single pass meets the target exactly.

Batch Conversion

Convert All WAV Files to MP3

Linux/macOS​​ (Bash):

for f in *.wav; do
  [ -f "$f" ] || continue
  ffmpeg -n -i "$f" -c:a libmp3lame -b:a 320k "${f%.wav}.mp3"
done

On macOS, run bash first if your Terminal is using zsh. -n prevents FFmpeg from overwriting an existing output.

​Windows (PowerShell):

Get-ChildItem -File -Filter *.wav | ForEach-Object {
  $out = Join-Path $_.DirectoryName ($_.BaseName + ".mp3")
  & ffmpeg -n -i $_.FullName -c:a libmp3lame -b:a 320k $out
}

Using FullName and Join-Path keeps input and output paths together, including filenames with spaces.

Convert All FLAC Files to AAC

Linux/macOS​​ (Bash):

for f in *.flac; do
  [ -f "$f" ] || continue
  ffmpeg -n -i "$f" -c:a aac -b:a 256k "${f%.flac}.m4a"
done

Common Errors and Fixes

“Encoder libmp3lame not found”

Check whether your build includes it:

ffmpeg -hide_banner -encoders

Look for libmp3lame in the output. If it is absent, install an FFmpeg build that includes that encoder. Reinstalling the same build without checking its enabled encoders may leave the error unchanged.

“Invalid sample rate”

Check the requested rate and the encoder’s supported settings. If your destination accepts 44.1 kHz, try:

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

Output​ file is silent or distorted

Inspect the input and output audio streams:

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

If no audio stream appears, inspect the input file before changing bitrate settings. If copying a stream fails with a container/codec compatibility error—for example, trying to put FLAC into a target that expects AAC—encode with the appropriate -c:a option instead of -c:a copy. See the ffprobe documentation for the stream fields shown here. Source checked November 4, 2026.

Skip the Terminal: Use WaveSpeed Desktop Instead

Tired of memorizing codec names, bitrate flags, and sample rate options? You’re not alone.

WaveSpeed Desktop includes an ​Audio Converter​:

  • Choose an audio file
  • Choose the output format (MP3, AAC, FLAC, WAV, or OGG)
  • Convert and download the result

You do not need to set up FFmpeg commands for this workflow. The available controls may differ from the command-line examples above, so check the exported file if bitrate or sample rate matters to your project.

Download WaveSpeed Desktop for free:

FAQ

What’s the best audio format for general use?

Use MP3 when broad compatibility matters, AAC when your destination requests it, and FLAC or an appropriate WAV format when you need to retain a lossless source. The right bitrate depends on the material and delivery requirements.

Does converting MP3 to FLAC improve quality?

No. You can’t recover information lost during MP3 compression. The FLAC will usually be larger without sounding better.

What bitrate should I use for MP3?

The commands above use 320 ​kbps for a high-bitrate MP3 and 256 kbps for smaller files. For an archive you may need to edit or re-encode later, keep the original lossless file instead.

Can FFmpeg convert multiple files at once?

​Yes​. You can specify multiple input/output pairs in a command, but a shell loop is easier for a folder of files. Use the Bash or PowerShell examples above.


Previous posts:

Share