Libopus - Export options broken (rate control, quality)

What is your operating system?

  • Windows 11 Pro

What is your Shotcut version (see Help > About Shotcut)? Is it 32-bit?

  • 22.10.25 (portable zip, 64-bit)

Can you repeat the problem? If so, what are the steps?

  • Steps: Export, Audio, Codec: libopus, Rate Control: Quality-based VBR, Quality: 100% (aq=500)
  • Result: success, but very low bitrate (default), not possible to properly set quality level
  • Settings:
    acodec=libopus
    vbr=on
    compression_level=10
    channels=2
    ar=48000
    f=matroska
    video_off=1
    vn=1

Notes

  • seems to set wrong variable (“compression_level=?”), resulting in no bitrate set (and default is only around 100 kbps)
  • “average bitrate” (“ba=?k”, “vbr=constrained”) seems to work fine (but not ideal, very close to constant bitrate)
  • other “opus” export does not work at all (please remove this confusing and redundant option, or fix if possible)
  • just noticed aac is also borked (so maybe none of the “quality” settings are usable, didn’t search for that)

This is not a bug but rather a codec limitation. The Export > Advanced UI does not have many rules about what combinations of options work together as that would be exceedingly complex and buggy. Rather, it assumes you are advanced and can figure out what combinations do work. As far as I know, Opus does not have a quality-based mode. See opusenc(1)

and ffmpeg -h encoder=libopus

libopus AVOptions:
  -application       <int>        E...A...... Intended application type (from 2048 to 2051) (default audio)
     voip            2048         E...A...... Favor improved speech intelligibility
     audio           2049         E...A...... Favor faithfulness to the input
     lowdelay        2051         E...A...... Restrict to only the lowest delay modes
  -frame_duration    <float>      E...A...... Duration of a frame in milliseconds (from 2.5 to 120) (default 20)
  -packet_loss       <int>        E...A...... Expected packet loss percentage (from 0 to 100) (default 0)
  -fec               <boolean>    E...A...... Enable inband FEC. Expected packet loss must be non-zero (default false)
  -vbr               <int>        E...A...... Variable bit rate mode (from 0 to 2) (default on)
     off             0            E...A...... Use constant bit rate
     on              1            E...A...... Use variable bit rate
     constrained     2            E...A...... Use constrained VBR
  -mapping_family    <int>        E...A...... Channel Mapping Family (from -1 to 255) (default -1)
  -apply_phase_inv   <boolean>    E...A...... Apply intensity stereo phase inversion (default true)

Thanks for checking this out. This makes some sense. I think I’ve been using “advanced ui” so long I forgot I was using it (and that the settings are generic, do not necessarily translate properly). What also threw me off was that I mostly use opusenc (vbr) and qaac (quality, vbr), which produce much more variable bitrate, compared to ffmpeg.

Anyway, I hope a few more users will find your answers useful, should they wonder about these things. I will stick to aac or libopus at a high “average bitrate”, or flac. Not a big deal, since I use Shotcut as a sort of lossless intermediate (to take advantage of the ui and timeline features), before final encoding (with something like StaxRip).