libspeex Speex audio encoder
Usage Guide This explains the values that need to be set prior to initialization in order to control various encoding parameters.
Channels Speex only supports mono or stereo, so avctx->channels must be set to 1 or 2.
Sample Rate / Encoding Mode Speex has 3 modes, each of which uses a specific sample rate. narrowband : 8 kHz wideband : 16 kHz ultra-wideband : 32 kHz avctx->sample_rate must be set to one of these 3 values. This will be used to set the encoding mode.
Rate Control VBR mode is turned on by setting CODEC_FLAG_QSCALE in avctx->flags. avctx->global_quality is used to set the encoding quality. For CBR mode, avctx->bit_rate can be used to set the constant bitrate. Alternatively, the 'cbr_quality' option can be set from 0 to 10 to set a constant bitrate based on quality. For ABR mode, set avctx->bit_rate and set the 'abr' option to 1. Approx. Bitrate Range: narrowband : 2400 - 25600 bps wideband : 4000 - 43200 bps ultra-wideband : 4400 - 45200 bps
Complexity Encoding complexity is controlled by setting avctx->compression_level. The valid range is 0 to 10. A higher setting gives generally better quality at the expense of encoding speed. This does not affect the bit rate.
Frames-per-Packet The encoder defaults to using 1 frame-per-packet. However, it is sometimes desirable to use multiple frames-per-packet to reduce the amount of container overhead. This can be done by setting the 'frames_per_packet' option to a value 1 to 8.
Optional features Speex encoder supports several optional features, which can be useful for some conditions.
Voice Activity Detection When enabled, voice activity detection detects whether the audio being encoded is speech or silence/background noise. VAD is always implicitly activated when encoding in VBR, so the option is only useful in non-VBR operation. In this case, Speex detects non-speech periods and encodes them with just enough bits to reproduce the background noise.
Discontinuous Transmission (DTX) DTX is an addition to VAD/VBR operation, that allows to stop transmitting completely when the background noise is stationary. In file-based operation only 5 bits are used for such frames.
Definition in file libspeexenc.c.