Why are my MP3 files the same size, even when I change the bitrate with ffmpeg?
I converted an audio stream into 3 different settings using essentially the same format. They ended up being exactly the same size. Why is this?
ffmpeg -i "Likoonl-Q1-All.mp4" -c:v copy -c:a libmp3lame -q:a 1 -b:a 192k "Q1-All-192k.mp4"
ffmpeg -i "Likoonl-Q1-All.mp4" -c:v copy -c:a libmp3lame -q:a 1 -b:a 160k "Q1-All-160k.mp4"
ffmpeg -i "Likoonl-Q1-All.mp4" -c:v copy -c:a libmp3lame -q:a 1 -b:a 128k "Q1-All-128k.mp4"
Solution 1:
Because you're setting -q:a
which is LAME's VBR setting. When you use -q:a
, the CBR setting (-b:a
) will have no effect.
If you look into the MP3 encoding guide from the FFmpeg wiki you'll find the possible values for -q:a
with their corresponding average bitrate.
For completeness' sake, here's the relevant part of libmp3lame.c
– qscale
is the long name of q
:
/* rate control */
if (avctx->flags & CODEC_FLAG_QSCALE) { // VBR
lame_set_VBR(s->gfp, vbr_default);
lame_set_VBR_quality(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
} else {
if (avctx->bit_rate) {
if (s->abr) { // ABR
lame_set_VBR(s->gfp, vbr_abr);
lame_set_VBR_mean_bitrate_kbps(s->gfp, avctx->bit_rate / 1000);
} else // CBR
lame_set_brate(s->gfp, avctx->bit_rate / 1000);
}
}