pub unsafe extern "C" fn opus_encoder_create(
Fs: opus_int32,
channels: c_int,
application: c_int,
error: *mut c_int,
) -> *mut OpusEncoderExpand description
Allocates and initializes an encoder state.
There are three coding modes:
OPUS_APPLICATION_VOIP gives best quality at a given bitrate for voice
signals. It enhances the input signal by high-pass filtering and
emphasizing formants and harmonics. Optionally it includes in-band
forward error correction to protect against packet loss. Use this
mode for typical VoIP applications. Because of the enhancement,
even at high bitrates the output may sound different from the input.
OPUS_APPLICATION_AUDIO gives best quality at a given bitrate for most
non-voice signals like music. Use this mode for music and mixed
(music/voice) content, broadcast, and applications requiring less
than 15 ms of coding delay.
OPUS_APPLICATION_RESTRICTED_LOWDELAY configures low-delay mode that
disables the speech-optimized mode in exchange for slightly reduced delay.
This mode can only be set on an newly initialized or freshly reset encoder
because it changes the codec delay.
This is useful when the caller knows that the speech-optimized modes will not be needed (use with caution).
ยงArguments
Fs[in] - opus_int32: Sampling rate of input signal (Hz) This must be one of 8000, 12000, 16000, 24000, or 48000.channels[in] - int: Number of channels (1 or 2) in input signalapplication[in] - int: Coding mode (one of [OPUS_APPLICATION_VOIP,] [OPUS_APPLICATION_AUDIO,] or [OPUS_APPLICATION_RESTRICTED_LOWDELAY)]error[out] - int*: [opus_errorcodes]
Note Regardless of the sampling rate and number channels selected, the Opus encoder can switch to a lower audio bandwidth or number of channels if the bitrate selected is too low. This also means that it is safe to always use 48 kHz stereo input and let the encoder optimize the encoding.