Skip to content

Conversation

@wys1024
Copy link

@wys1024 wys1024 commented Jun 17, 2025

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
Copy link
Author

wys1024 commented Jun 19, 2025

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

@hraban
Copy link
Owner

hraban commented Nov 17, 2025

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

@iflamed
Copy link

iflamed commented Dec 1, 2025

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

I need this too. In some hardware cases, Need the fixed Bitrate to encode PCM audio. Without OGG header, don't know the length of opus frame for each PCM frame.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants