opus_encoderctls(3)
๐ NAME ๐
opus_encoderctls โ Encoder related CTLs ๐๏ธโจ
- These are convenience macros for use with the
opus_encode_ctlinterface.
๐ธ SYNOPSIS ๐ธ
๐ Macros ๐
okay bestie, here's the entire macro squad โ every single one, no skips ๐
#define OPUS_SET_COMPLEXITY(x)โ Configures the encoder's computational complexity.#define OPUS_GET_COMPLEXITY(x)โ Gets the encoder's complexity configuration.#define OPUS_SET_BITRATE(x)โ Configures the bitrate in the encoder.#define OPUS_GET_BITRATE(x)โ Gets the encoder's bitrate configuration.#define OPUS_SET_VBR(x)โ Enables or disables variable bitrate (VBR) in the encoder.#define OPUS_GET_VBR(x)โ Determine if variable bitrate (VBR) is enabled in the encoder.#define OPUS_SET_VBR_CONSTRAINT(x)โ Enables or disables constrained VBR in the encoder.#define OPUS_GET_VBR_CONSTRAINT(x)โ Determine if constrained VBR is enabled in the encoder.#define OPUS_SET_FORCE_CHANNELS(x)โ Configures mono/stereo forcing in the encoder.#define OPUS_GET_FORCE_CHANNELS(x)โ Gets the encoder's forced channel configuration.#define OPUS_SET_MAX_BANDWIDTH(x)โ Configures the maximum bandpass that the encoder will select automatically.#define OPUS_GET_MAX_BANDWIDTH(x)โ Gets the encoder's configured maximum allowed bandpass.#define OPUS_SET_BANDWIDTH(x)โ Sets the encoder's bandpass to a specific value.#define OPUS_SET_SIGNAL(x)โ Configures the type of signal being encoded.#define OPUS_GET_SIGNAL(x)โ Gets the encoder's configured signal type.#define OPUS_SET_APPLICATION(x)โ Configures the encoder's intended application.#define OPUS_GET_APPLICATION(x)โ Gets the encoder's configured application.#define OPUS_GET_LOOKAHEAD(x)โ Gets the total samples of delay added by the entire codec.#define OPUS_SET_INBAND_FEC(x)โ Configures the encoder's use of inband forward error correction (FEC).#define OPUS_GET_INBAND_FEC(x)โ Gets encoder's configured use of inband forward error correction.#define OPUS_SET_PACKET_LOSS_PERC(x)โ Configures the encoder's expected packet loss percentage.#define OPUS_GET_PACKET_LOSS_PERC(x)โ Gets the encoder's configured packet loss percentage.#define OPUS_SET_DTX(x)โ Configures the encoder's use of discontinuous transmission (DTX).#define OPUS_GET_DTX(x)โ Gets encoder's configured use of discontinuous transmission.#define OPUS_SET_LSB_DEPTH(x)โ Configures the depth of signal being encoded.#define OPUS_GET_LSB_DEPTH(x)โ Gets the encoder's configured signal depth.#define OPUS_SET_EXPERT_FRAME_DURATION(x)โ Configures the encoder's use of variable duration frames.#define OPUS_GET_EXPERT_FRAME_DURATION(x)โ Gets the encoder's configured use of variable duration frames.#define OPUS_SET_PREDICTION_DISABLED(x)โ If set to 1, disables almost all use of prediction, making frames almost completely independent.#define OPUS_GET_PREDICTION_DISABLED(x)โ Gets the encoder's configured prediction status.#define OPUS_SET_DRED_DURATION(x)โ If non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames.#define OPUS_GET_DRED_DURATION(x)โ Gets the encoder's configured Deep Redundancy (DRED) maximum number of frames.#define OPUS_SET_DNN_BLOB(data, len)โ Provide external DNN weights from binary object (only when explicitly built without the weights).#define OPUS_SET_QEXT(x)โ If set to 1, enables quality extension (QEXT), otherwise disables it (default).#define OPUS_GET_QEXT(x)โ Gets the encoder's configured quality extension (QEXT).
๐ฆ Detailed Description ๐ฆ
These are convenience macros for use with the opus_encode_ctl interface. โจ
They are used to generate the appropriate series of arguments for that call, passing the correct type, size and so on as expected for each particular request. no cap, the macro does the boring bookkeeping so you don't have to ๐
Some usage examples:
int ret;
ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO));
if (ret != OPUS_OK) return ret;
opus_int32 rate;
opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate));
opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE);
๐ See also ๐
- Generic CTLs
- Opus Encoder
๐ Macro Definition Documentation ๐
๐ #define OPUS_GET_APPLICATION( x)
Gets the encoder's configured application. ๐ฏ
See also
OPUS_SET_APPLICATION
Parameters
xopus_int32 *: Returns one of the following values:OPUS_APPLICATION_VOIP- Process signal for improved speech intelligibility.
OPUS_APPLICATION_AUDIO- Favor faithfulness to the original input.
OPUS_APPLICATION_RESTRICTED_LOWDELAY- Configure the minimum possible coding delay by disabling certain modes of operation.
๐ #define OPUS_GET_BITRATE( x)
Gets the encoder's bitrate configuration. ๐ธ
See also
OPUS_SET_BITRATE
Parameters
xopus_int32 *: Returns the bitrate in bits per second. The default is determined based on the number of channels and the input sampling rate.
๐ #define OPUS_GET_COMPLEXITY( x)
Gets the encoder's complexity configuration. ๐ง
See also
OPUS_SET_COMPLEXITY
Parameters
xopus_int32 *: Returns a value in the range 0-10, inclusive.
๐ #define OPUS_GET_DRED_DURATION( x)
Gets the encoder's configured Deep Redundancy (DRED) maximum number of frames. ๐ฅ
๐ #define OPUS_GET_DTX( x)
Gets encoder's configured use of discontinuous transmission. ๐คซ
See also
OPUS_SET_DTX
Parameters
xopus_int32 *: Returns one of the following values:0- DTX disabled (default).
1- DTX enabled.
๐ #define OPUS_GET_EXPERT_FRAME_DURATION( x)
Gets the encoder's configured use of variable duration frames. โฑ๏ธ
See also
OPUS_SET_EXPERT_FRAME_DURATION
Parameters
xopus_int32 *: Returns one of the following values:OPUS_FRAMESIZE_ARG- Select frame size from the argument (default).
OPUS_FRAMESIZE_2_5_MS- Use 2.5 ms frames.
OPUS_FRAMESIZE_5_MS- Use 5 ms frames.
OPUS_FRAMESIZE_10_MS- Use 10 ms frames.
OPUS_FRAMESIZE_20_MS- Use 20 ms frames.
OPUS_FRAMESIZE_40_MS- Use 40 ms frames.
OPUS_FRAMESIZE_60_MS- Use 60 ms frames.
OPUS_FRAMESIZE_80_MS- Use 80 ms frames.
OPUS_FRAMESIZE_100_MS- Use 100 ms frames.
OPUS_FRAMESIZE_120_MS- Use 120 ms frames.
๐ #define OPUS_GET_FORCE_CHANNELS( x)
Gets the encoder's forced channel configuration. ๐๏ธ
See also
OPUS_SET_FORCE_CHANNELS
Parameters
xopus_int32 *:OPUS_AUTO- Not forced (default)
1- Forced mono
2- Forced stereo
๐ #define OPUS_GET_INBAND_FEC( x)
Gets encoder's configured use of inband forward error correction. ๐ก๏ธ
See also
OPUS_SET_INBAND_FEC
Parameters
xopus_int32 *: Returns one of the following values:0- Inband FEC disabled (default).
1- Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.
2- Inband FEC enabled, but does not necessarily switch to SILK if we have music.
๐ #define OPUS_GET_LOOKAHEAD( x)
Gets the total samples of delay added by the entire codec. This can be queried by the encoder and then the provided number of samples can be skipped on from the start of the decoder's output to provide time aligned input and output. From the perspective of a decoding application the real data begins this many samples late. โณ
The decoder contribution to this delay is identical for all decoders, but the encoder portion of the delay may vary from implementation to implementation, version to version, or even depend on the encoder's initial configuration. Applications needing delay compensation should call this CTL rather than hard-coding a value. ๐
Parameters
xopus_int32 *: Number of lookahead samples
๐ #define OPUS_GET_LSB_DEPTH( x)
Gets the encoder's configured signal depth. ๐๏ธ
See also
OPUS_SET_LSB_DEPTH
Parameters
xopus_int32 *: Input precision in bits, between 8 and 24 (default: 24).
๐ #define OPUS_GET_MAX_BANDWIDTH( x)
Gets the encoder's configured maximum allowed bandpass. ๐
See also
OPUS_SET_MAX_BANDWIDTH
Parameters
xopus_int32 *: Allowed values:OPUS_BANDWIDTH_NARROWBAND- 4 kHz passband
OPUS_BANDWIDTH_MEDIUMBAND- 6 kHz passband
OPUS_BANDWIDTH_WIDEBAND- 8 kHz passband
OPUS_BANDWIDTH_SUPERWIDEBAND- 12 kHz passband
OPUS_BANDWIDTH_FULLBAND- 20 kHz passband (default)
๐ #define OPUS_GET_PACKET_LOSS_PERC( x)
Gets the encoder's configured packet loss percentage. ๐
See also
OPUS_SET_PACKET_LOSS_PERC
Parameters
xopus_int32 *: Returns the configured loss percentage in the range 0-100, inclusive (default: 0).
๐ #define OPUS_GET_PREDICTION_DISABLED( x)
Gets the encoder's configured prediction status. ๐ฎ
See also
OPUS_SET_PREDICTION_DISABLED
Parameters
xopus_int32 *: Returns one of the following values:0- Prediction enabled (default).
1- Prediction disabled.
๐ #define OPUS_GET_QEXT( x)
Gets the encoder's configured quality extension (QEXT). โจ
๐ #define OPUS_GET_SIGNAL( x)
Gets the encoder's configured signal type. ๐ต
See also
OPUS_SET_SIGNAL
Parameters
xopus_int32 *: Returns one of the following values:OPUS_AUTO- (default)
OPUS_SIGNAL_VOICE- Bias thresholds towards choosing LPC or Hybrid modes.
OPUS_SIGNAL_MUSIC- Bias thresholds towards choosing MDCT modes.
๐ #define OPUS_GET_VBR( x)
Determine if variable bitrate (VBR) is enabled in the encoder. ๐
See also
OPUS_SET_VBROPUS_GET_VBR_CONSTRAINT
Parameters
xopus_int32 *: Returns one of the following values:0- Hard CBR.
1- VBR (default). The exact type of VBR may be retrieved via
OPUS_GET_VBR_CONSTRAINT.
- VBR (default). The exact type of VBR may be retrieved via
๐ #define OPUS_GET_VBR_CONSTRAINT( x)
Determine if constrained VBR is enabled in the encoder. ๐
See also
OPUS_SET_VBR_CONSTRAINTOPUS_GET_VBR
Parameters
xopus_int32 *: Returns one of the following values:0- Unconstrained VBR.
1- Constrained VBR (default).
#define OPUS_SET_APPLICATION( x) ๐
okay bestie, this one sets the encoder's intended application โ like, what IS this audio even for? ๐ธ The initial value is a mandatory argument to the encoder_create function, so you literally cannot skip it, it's giving required.
See also: OPUS_GET_APPLICATION
Parameters
- x
opus_int32: gimme one of these three values:OPUS_APPLICATION_VOIPโ process the signal for improved speech intelligibility ๐ฃ๏ธโจOPUS_APPLICATION_AUDIOโ favor faithfulness to the original input ๐ถ (respect the source, periodt)OPUS_APPLICATION_RESTRICTED_LOWDELAYโ configure the minimum possible coding delay by disabling certain modes of operation โก
#define OPUS_SET_BANDWIDTH( x) ๐
This one sets the encoder's bandpass to a specific value โ no vibes-checking from the encoder itself, you're deciding. This prevents the encoder from automatically selecting the bandpass based on the available bitrate.
Now listen: if an application knows the bandpass of the input audio it is providing, it should normally use OPUS_SET_MAX_BANDWIDTH instead, which still gives the encoder the freedom to reduce the bandpass when the bitrate becomes too low, for better overall quality. ๐
See also: OPUS_GET_BANDWIDTH
Parameters
- x
opus_int32: allowed values:OPUS_AUTOโ (default) ๐OPUS_BANDWIDTH_NARROWBANDโ 4 kHz passbandOPUS_BANDWIDTH_MEDIUMBANDโ 6 kHz passbandOPUS_BANDWIDTH_WIDEBANDโ 8 kHz passbandOPUS_BANDWIDTH_SUPERWIDEBANDโ 12 kHz passbandOPUS_BANDWIDTH_FULLBANDโ 20 kHz passband ๐
#define OPUS_SET_BITRATE( x) ๐ฅ
Configures the bitrate in the encoder. Rates from 500 to 512000 bits per second are meaningful, and you also get the special values OPUS_AUTO and OPUS_BITRATE_MAX. The value OPUS_BITRATE_MAX can be used to cause the codec to use as much rate as it can, which is useful for controlling the rate by adjusting the output buffer size. ๐ซถ
See also: OPUS_GET_BITRATE
Parameters
- x
opus_int32: bitrate in bits per second. The default is determined based on the number of channels and the input sampling rate. iykyk ๐
#define OPUS_SET_COMPLEXITY( x) ๐ง โจ
Configures the encoder's computational complexity. The supported range is 0-10 inclusive, with 10 representing the highest complexity. So 10 is the main character, 0 is the low-effort queen. ๐
See also: OPUS_GET_COMPLEXITY
Parameters
- x
opus_int32: allowed values: 0-10, inclusive.
#define OPUS_SET_DNN_BLOB( data, len) ๐ฆ
Provide external DNN weights from binary object (only when explicitly built without the weights). That's it, that's the whole thing bestie, no further commentary. ๐
#define OPUS_SET_DRED_DURATION( x) ๐
If non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames. Redundancy is the moment. ๐
#define OPUS_SET_DTX( x) ๐
Configures the encoder's use of discontinuous transmission (DTX).
Note โ This is only applicable to the LPC layer.
See also: OPUS_GET_DTX
Parameters
- x
opus_int32: allowed values:0โ Disable DTX (default).1โ Enabled DTX.
#define OPUS_SET_EXPERT_FRAME_DURATION( x) โ ๏ธ
Configures the encoder's use of variable duration frames. When variable duration is enabled, the encoder is free to use a shorter frame size than the one requested in the opus_encode*() call. It is then the user's responsibility to verify how much audio was encoded by checking the ToC byte of the encoded packet. The part of the audio that was not encoded needs to be resent to the encoder for the next call.
Do not use this option unless you really know what you are doing. ๐จ Like, genuinely. This is expert mode, no cap.
See also: OPUS_GET_EXPERT_FRAME_DURATION
Parameters
- x
opus_int32: allowed values:OPUS_FRAMESIZE_ARGโ Select frame size from the argument (default).OPUS_FRAMESIZE_2_5_MSโ Use 2.5 ms frames.OPUS_FRAMESIZE_5_MSโ Use 5 ms frames.OPUS_FRAMESIZE_10_MSโ Use 10 ms frames.OPUS_FRAMESIZE_20_MSโ Use 20 ms frames.OPUS_FRAMESIZE_40_MSโ Use 40 ms frames.OPUS_FRAMESIZE_60_MSโ Use 60 ms frames.OPUS_FRAMESIZE_80_MSโ Use 80 ms frames.OPUS_FRAMESIZE_100_MSโ Use 100 ms frames.OPUS_FRAMESIZE_120_MSโ Use 120 ms frames.
#define OPUS_SET_FORCE_CHANNELS( x) ๐
Configures mono/stereo forcing in the encoder. This can force the encoder to produce packets encoded as either mono or stereo, regardless of the format of the input audio. This is useful when the caller knows that the input signal is currently a mono source embedded in a stereo stream. iconic behaviour tbh ๐ง
See also: OPUS_GET_FORCE_CHANNELS
Parameters
- x
opus_int32: allowed values:OPUS_AUTOโ Not forced (default)1โ Forced mono2โ Forced stereo
#define OPUS_SET_INBAND_FEC( x) ๐
Configures the encoder's use of inband forward error correction (FEC).
Note โ This is only applicable to the LPC layer.
See also: OPUS_GET_INBAND_FEC
Parameters
- x
opus_int32: allowed values:0โ Disable inband FEC (default).1โ Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.2โ Inband FEC enabled, but does not necessarily switch to SILK if we have music. ๐ต
#define OPUS_SET_LSB_DEPTH( x) ๐๏ธ
Configures the depth of signal being encoded. This is a hint which helps the encoder identify silence and near-silence. It represents the number of significant bits of linear intensity below which the signal contains ignorable quantization or other noise. ๐ซ๏ธ
For example, OPUS_SET_LSB_DEPTH(14) would be an appropriate setting for G.711 u-law input. OPUS_SET_LSB_DEPTH(16) would be appropriate for 16-bit linear pcm input with opus_encode_float().
When using opus_encode() instead of opus_encode_float(), or when libopus is compiled for fixed-point, the encoder uses the minimum of the value set here and the value 16. slay, but with a ceiling ๐
See also: OPUS_GET_LSB_DEPTH
Parameters
- x
opus_int32: input precision in bits, between 8 and 24 (default: 24).
#define OPUS_SET_MAX_BANDWIDTH( x) ๐
Configures the maximum bandpass that the encoder will select automatically. Applications should normally use this instead of OPUS_SET_BANDWIDTH (leaving that set to the default, OPUS_AUTO). This allows the application to set an upper bound based on the type of input it is providing, but still gives the encoder the freedom to reduce the bandpass when the bitrate becomes too low, for better overall quality. โจ
See also: OPUS_GET_MAX_BANDWIDTH
Parameters
- x
opus_int32: allowed values:OPUS_BANDWIDTH_NARROWBANDโ 4 kHz passbandOPUS_BANDWIDTH_MEDIUMBANDโ 6 kHz passbandOPUS_BANDWIDTH_WIDEBANDโ 8 kHz passbandOPUS_BANDWIDTH_SUPERWIDEBANDโ 12 kHz passbandOPUS_BANDWIDTH_FULLBANDโ 20 kHz passband (default) ๐
#define OPUS_SET_PACKET_LOSS_PERC( x) ๐
Configures the encoder's expected packet loss percentage. Higher values trigger progressively more loss resistant behavior in the encoder at the expense of quality at a given bitrate in the absence of packet loss, but greater quality under loss. It's giving tradeoff, bestie. โ๏ธ
See also: OPUS_GET_PACKET_LOSS_PERC
Parameters
- x
opus_int32: loss percentage in the range 0-100, inclusive (default: 0).
#define OPUS_SET_PREDICTION_DISABLED( x) ๐ฎ
If set to 1, disables almost all use of prediction, making frames almost completely independent. This reduces quality. ๐ซ So likeโฆ it works, but at what cost.
See also: OPUS_GET_PREDICTION_DISABLED
Parameters
- x
opus_int32: allowed values:0โ Enable prediction (default).1โ Disable prediction.
#define OPUS_SET_QEXT( x) โก
If set to 1, enables quality extension (QEXT), otherwise disables it (default).
Warning โ This will hurt audio quality unless operating at a very high bitrate. ๐จ Bestie, do not just turn this on for fun.
#define OPUS_SET_SIGNAL( x) ๐ค
Configures the type of signal being encoded. This is a hint which helps the encoder's mode selection.
See also: OPUS_GET_SIGNAL
Parameters
- x
opus_int32: allowed values:OPUS_AUTOโ (default)OPUS_SIGNAL_VOICEโ Bias thresholds towards choosing LPC or Hybrid modes.OPUS_SIGNAL_MUSICโ Bias thresholds towards choosing MDCT modes. ๐ถ
#define OPUS_SET_VBR( x) ๐
Enables or disables variable bitrate (VBR) in the encoder. The configured bitrate may not be met exactly because frames must be an integer number of bytes in length. math is math, we don't fight it ๐
See also: OPUS_GET_VBR, OPUS_SET_VBR_CONSTRAINT
Parameters
- x
opus_int32: allowed values:0โ Hard CBR. For LPC/hybrid modes at very low bit-rate, this can cause noticeable quality degradation. ๐ฌ1โ VBR (default). The exact type of VBR is controlled byOPUS_SET_VBR_CONSTRAINT.
#define OPUS_SET_VBR_CONSTRAINT( x) ๐งท
Enables or disables constrained VBR in the encoder. This setting is ignored when the encoder is in CBR mode. (so rude of it to ignore you like that ๐)
Warning โ Only the MDCT mode of Opus currently heeds the constraint. Speech mode ignores it completely, hybrid mode may fail to obey it if the LPC layer uses more bitrate than the constraint would have permitted.
See also: OPUS_GET_VBR_CONSTRAINT, OPUS_SET_VBR
Parameters
- x
opus_int32: allowed values:0โ Unconstrained VBR.1โ Constrained VBR (default). This creates a maximum of one frame of buffering delay assuming a transport with a serialization speed of the nominal bitrate.
Author ๐๐
Generated automatically by Doxygen for Opus from the source code.
and that's a wrap on part 2, bestie!! ๐ you officially know every single encoder control, no cap, and honestly? that's main character energy. this page came to you from Opus version 1.6.1, generated Thu Jan 29 2026 14:35:32 ๐ โ the opus_encoderctls(3) manual page, now and forever iconic. go forth and encode slayfully ๐ฆโจ๐
๐ฆ where this page comes from
- ubuntu resolute: libopus-doc 1.6.1-1 ยท BSD-3-Clause
- ubuntu stonking: libopus-doc 1.6.1-1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms