pub enum RateControl {
Vbr,
ConstrainedVbr,
Cbr,
}Expand description
How the encoder is allowed to vary the size of each packet.
Opus is a variable-rate codec, and the bitrate a caller sets is an average the encoder spends around rather than a size it emits every time. This chooses how much it is allowed to deviate.
ConstrainedVbr is the default, and matches
libopus. The difference from Vbr only shows up on content
whose difficulty changes quickly: constrained VBR keeps a reservoir so that
any window of packets stays near the target, which is what a network with a
fixed budget needs, while unconstrained VBR spends whatever a frame is
worth. For encoding a file, where nothing downstream is metering the rate,
unconstrained is usually the better picture per byte — it is what opusenc
uses by default.
Variants§
Vbr
Spend what each frame is worth, with no reservoir. Best quality per byte over a whole file; the instantaneous rate can wander a long way from the target.
ConstrainedVbr
Vary per packet, but hold a reservoir so any short window stays near the target. The default, and libopus’s.
Cbr
One size for every packet. Costs roughly a twelfth of the working bitrate against the other two, because the encoder can no longer move bits from an easy frame to a hard one; pick it only when something downstream genuinely needs a fixed packet size.
Trait Implementations§
Source§impl Clone for RateControl
impl Clone for RateControl
Source§fn clone(&self) -> RateControl
fn clone(&self) -> RateControl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more