CBR Audio ... does it work?

Been trying to export audio at 256kbs CBR, but it always exports it to VBR … I checked with mediainfo.
Its mp4 /h264.
Another thing is that if I selected 256 CBR Audio and then save as a custom export setting, then it does not save the CBR Audio setting (switches it back to VBR).
Something I am doing wrong ?

This topic is discussed here : Preset audio bit rate control setting

But what was the resolution ? It says solved, but it doesn’t seem to be solved.
FFMPEG AAC encoder does offer a CBR setting and its VBR function is approximated according to a 1-5 scale.
Which do not seem to be visible in the shotcut panel.

For Odysee.com videos the recommended settings are CBR … "-c:a aac -b:a 160k ", and it makes a big difference if you make videos with ambient tracks that need to have a constant quality or they fade in and out according to the VBR tuning.

Further tests :

  • 1 channel mono … renders at a lower bitrate … even if 256 CBR is selected, I get about 155 kbs (mode=Variable) on this project.
  • 2 channels stereo renders 230 kbs (mode-Variable) (with 256 cbr selected).
  • using quality based vbr at 95% I get 380kbs (mode = Constant) !!!

… audio bit rate “mode” is listed in mediainfo btw

It has its own mind.

How?

When I use that with ffmpeg, mediainfo reports

Bit rate mode : Variable
Bit rate : 158 kb/s
Maximum bit rate : 160 kb/s

That is exactly the same thing I get in Shotcut when using average or constant bitrate modes with aac. Shotcut’s export UI is not only about H.264+AAC MP4. It needs to try to support every codec and format that FFmpeg supports while keeping the code simple. In Shotcut, the average and constant bitrate options for the aac codec do the same thing.

Where? How? Shotcut UI does not directly expose codec-specific options. ffmpeg -h encoder=aac does not show an option for this. Shotcut uses the equivalent of the ffmpeg generic quality option q:a.

I do not reproduce that in version 23.06. The saving and restoring of the audio rate control field is the thing that was fixed in this version. It does make a FFmpeg codec do something it cannot do.

Thanks for your help.

VBR function is approximated according to a 1-5 scale
This is listed on this page as follows:

Variable Bit Rate (VBR) mode

Target a quality, rather than a specific bit rate. 1 is lowest quality and 5 is highest quality.

Set the VBR level with the -vbr flag.

VBR modes gives roughly the following bit rates per channel (​details):

VBR kbps/channel AOTs
1 20-32 LC,HE,HEv2
2 32-40 LC,HE,HEv2
3 48-56 LC,HE,HEv2
4 64-72 LC
5 96-112 LC

CBR Rendering as Variable
Just tested this, it works. Using this ffmpeg utility…
mediainfo reports
Bit rate mode : Constant
Bit rate : 160 kb/s
Channel(s) : 2 channels

Command Is:

-loop 1 -framerate 2 -i “{0}” -i “{1}” -c:v libx264 -preset faster -tune stillimage -crf 18 -c:a aac -b:a 160k -shortest -pix_fmt yuv420p “{2}.mp4”

where
0/1/2 are audio input / stillimage input / output … this is for a single stillimage with audio.

ffmpeg I heard once interprets the order of terms … something like if the terms are near an audio or video file - either input or output - then it associates it to them.

Default Mono Stereo for Slide deck
I believe that the slidedeck_h264 export preset defaults to mono. I used this as a base for my custom settings.
Mono causes low bit rates to be produced.
Making it stereo increased the bitrate to what is expected and improved audio quality until I stopped complaining.
For that project

  • 1 channel mono … renders at a lower bitrate … even if 256 CBR is selected, I get about 155 kbs (mode=Variable) on this project.
  • 2 channels stereo renders 230 kbs (mode-Variable) (with 256 cbr selected).

good luck

That is for the libfdk_aac codec, which we do not include for license reasons.

Command Is: … c:a aac -b:a 160k

This is what Shotcut effectively does when you choose ABR or CBR. What mediainfo reports depends on versions of both ffmpeg and mediainfo itself. As you can see my mediainfo 23.04 output for ffmpeg 6.0 gives a different result above.

See the Native FFmpeg AAC Encoder of the same page for its options. That is what Shotcut is doing. Interestingly after giving “Constant bit rate” options it also states “Native FFmpeg AAC Encoder does not do CBR audio encoding.” I take that to mean it only offers a bitrate target, and what you get from mediainfo depends on things that probably takes a lot of analysis of versions and source code.

ffmpeg I heard once interprets the order of terms

Yes, its order is important, but Shotcut is not a ffmpeg command line frontend except in the special cases of Properties > Convert and Reverse. Otherwise, it uses the APIs of the FFmpeg libraries. Personally, I do not think it matters whether the AAC bitrate is CBR or ABR, and true CBR is rarely desirable.

This topic was automatically closed after 90 days. New replies are no longer allowed.