How to Set Target Audio Bitrate in FFmpeg

This article provides a straightforward guide on how to set a target average bitrate for audio streams using FFmpeg. You will learn the exact command-line arguments needed to control audio quality, see practical examples for popular formats like AAC and MP3, and understand how the bitrate flag behaves across different audio codecs.

To set the target average bitrate for an audio stream in FFmpeg, you use the -b:a option (which is an alias for -ab). This option tells the encoder the desired average bitrate for the output audio stream.

Basic Command Syntax

The basic syntax for setting the audio bitrate is:

ffmpeg -i input.mp4 -c:a <codec> -b:a <bitrate> output.mp4

Example 1: Setting AAC Audio Bitrate (MP4/M4A)

AAC is the standard audio codec for MP4 containers. To set the target audio bitrate to 192 kbps while copying the video stream without re-encoding, use the following command:

ffmpeg -i input.mp4 -c:v copy -c:a aac -b:a 192k output.mp4

Example 2: Setting MP3 Audio Bitrate

To convert an audio file to MP3 with a target average bitrate of 320 kbps using the LAME encoder, run:

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

Example 3: Setting Bitrate for Specific Streams

If your input file has multiple audio streams, you can target a specific stream by index. For example, to set the bitrate of the first audio stream to 128 kbps and the second audio stream to 256 kbps, use:

ffmpeg -i input.mkv -b:a:0 128k -b:a:1 256k output.mkv

Average Bitrate (ABR) vs. Constant Bitrate (CBR)

Using the -b:a flag generally tells the encoder to target an Average Bitrate (ABR).