opus icon indicating copy to clipboard operation
opus copied to clipboard

Add Support for Constant Bitrate (CBR) in Opus Encoder

Open wys1024 opened this issue 6 months ago • 3 comments

Feature: Add support for Constant Bitrate (CBR) control

This PR adds the ability to configure whether the Opus encoder uses constant bitrate (CBR) or variable bitrate (VBR), which was previously unavailable in this Go binding.

Changes

  • Introduced SetCBR(cbr bool) to switch between CBR and VBR.
  • Introduced IsCBR() (bool, error) to query current setting.
  • Added C bridge functions: bridge_encoder_set_vbr and bridge_encoder_get_vbr.

Reason

Exposing this option allows developers to better control encoding behavior in constrained bitrate environments, particularly for VoIP or streaming use-cases.

Notes

This is a non-breaking change and fully backward compatible.

Thanks for your work on this project!

wys1024 avatar Jun 17 '25 07:06 wys1024

@hraban Hi, would you mind taking a look when you get a chance? Thanks!

wys1024 avatar Jun 19 '25 02:06 wys1024

Can I ask why you named it SetCBR instead of SetVBR?

hraban avatar Nov 17 '25 09:11 hraban