How to Enforce CBR MP3 Bitrate Using FFmpeg

Enforcing a Constant Bitrate (CBR) for MP3 audio streams is crucial for maintaining compatibility with legacy hardware, specific broadcast platforms, and streaming servers (like Icecast) that do not support Variable Bitrate (VBR) audio. This article provides the exact FFmpeg commands and parameter configurations required to encode or stream audio in a strict CBR MP3 format.

The Basic CBR MP3 Command

To force FFmpeg to encode an audio file with a strict constant bitrate, you must use the -b:a (audio bitrate) option and avoid any quality-based scale parameters (such as -q:a or -qscale:a), which automatically trigger VBR.

Here is the standard command to convert an input file to a 192 kbps CBR MP3 file:

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

Parameter Breakdown:

Enforcing CBR for Live Audio Streaming

When streaming live MP3 audio to an external server, maintaining a strict, non-fluctuating bitrate is essential to prevent buffer underruns or connection drops. You can enforce CBR during a live stream by specifying the target constant bitrate alongside the output format:

ffmpeg -i input_source -c:a libmp3lame -b:a 128k -f mp3 icecast://username:password@myserver.com:8000/stream

Verifying the Bitrate

To verify that the resulting output file is indeed using a constant bitrate and not VBR, you can use the ffprobe tool included with FFmpeg:

ffprobe -v error -show_entries format=bit_rate -of default=noprint_wrappers=1 output.mp3

If the output displays the exact bitrate you specified (e.g., 192000 for 192k), the stream has been successfully encoded using CBR.