diff mbox series

[FFmpeg-devel] doc/encoders: ffaacenc does not output CBR

Message ID 20200511133445.95631-1-guillaume.kh.alt@gmail.com
State New
Headers show
Series [FFmpeg-devel] doc/encoders: ffaacenc does not output CBR | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Guillaume Khayat May 11, 2020, 1:34 p.m. UTC
The documentation and wiki imply the native AAC encoder can output CBR and VBR files :
>b
>Set bit rate in bits/s. Setting this automatically activates constant bit rate (CBR) mode. If this option is unspecified it is set to 128kbps.
>
>q
>Set quality for variable bit rate (VBR) mode. This option is valid only using the ffmpeg command-line tool. For library interface users, use global_quality.

Sources:
- https://ffmpeg.org/ffmpeg-all.html#Options-7
- https://trac.ffmpeg.org/wiki/Encode/AAC#NativeFFmpegAACEncoder

But testing the CBR mode gives out unexpected results
1. `ffmpeg -f lavfi -i sine=d=10 -c:a aac -b:a 128k out.m4a`
	=> outputs a variable bit rate file, with an average bitrate of 85kbps file, and a max bitrate of 128kbps
2. `ffmpeg -i someMusicMp3File -c:a aac -b:a 128k out.m4a`
	=> outputs a variable bit rate file, with an average bitrate of 122kbps file, and a max bitrate of 128kbps

I think the advertised "CBR" mode is instead a “constrained VBR” mode, where the provided bitrate is used as a target and/or a maximum allowed bitrate.

Signed-off-by: Guillaume Khayat <guillaume.kh.alt@gmail.com>
---
 doc/encoders.texi | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Lynne May 11, 2020, 1:51 p.m. UTC | #1
May 11, 2020, 14:34 by guillaume.kh.alt@gmail.com:

> The documentation and wiki imply the native AAC encoder can output CBR and VBR files :
> >b
> >Set bit rate in bits/s. Setting this automatically activates constant bit rate (CBR) mode. If this option is unspecified it is set to 128kbps.
>
>>
>>
> >q
> >Set quality for variable bit rate (VBR) mode. This option is valid only using the ffmpeg command-line tool. For library interface users, use global_quality.
>

The twoloop coder (not the default) does CBR. The fast coder for now tries to approximate it.
So the documentation is correct. If you do need more accurate CBR just use the twoloop coder for now.
I'm working on the encoder now and that should improve its CBR constraints with the fast coder.
diff mbox series

Patch

diff --git a/doc/encoders.texi b/doc/encoders.texi
index aa3a6eeb66..44ff5e469b 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -30,17 +30,19 @@  follows.
 
 Advanced Audio Coding (AAC) encoder.
 
-This encoder is the default AAC encoder, natively implemented into FFmpeg.
+This encoder is the default AAC encoder, natively implemented into FFmpeg. It
+supports a constrained variable bit rate mode and a true variable bit (VBR)
+rate mode.
 
 @subsection Options
 
 @table @option
 @item b
-Set bit rate in bits/s. Setting this automatically activates constant bit rate
-(CBR) mode. If this option is unspecified it is set to 128kbps.
+Set maxmimum bit rate in bits/s. Setting this automatically activates constrained
+variable bit rate mode. If this option is unspecified it is set to 128kbps.
 
 @item q
-Set quality for variable bit rate (VBR) mode. This option is valid only using
+Set quality for true variable bit rate (VBR) mode. This option is valid only using
 the @command{ffmpeg} command-line tool. For library interface users, use
 @option{global_quality}.