pub struct BitrateModelEstimator { /* private fields */ }Expand description
Estimates a reasonable bitrate target for a given resolution and frame rate.
The model is intentionally simple and suitable for presets/defaults — it uses empirically derived pixel-rate coefficients similar to those used by streaming platforms for H.264/AV1 recommendations.
Implementations§
Source§impl BitrateModelEstimator
impl BitrateModelEstimator
Sourcepub fn with_coefficient(bpp_coefficient: f64) -> Self
pub fn with_coefficient(bpp_coefficient: f64) -> Self
Create an estimator with a custom BPP coefficient.
Sourcepub fn estimate_for_resolution(&self, width: u32, height: u32, fps: f64) -> u32
pub fn estimate_for_resolution(&self, width: u32, height: u32, fps: f64) -> u32
Estimate the target bitrate in kbps for the given width × height and fps.
Formula: width * height * fps * bpp_coefficient / 1000
Sourcepub fn estimate_for_preset(&self, preset: &str) -> Option<u32>
pub fn estimate_for_preset(&self, preset: &str) -> Option<u32>
Estimate for a named preset (720p30, 1080p30, 4K30, etc.).
Trait Implementations§
Source§impl Clone for BitrateModelEstimator
impl Clone for BitrateModelEstimator
Source§fn clone(&self) -> BitrateModelEstimator
fn clone(&self) -> BitrateModelEstimator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BitrateModelEstimator
impl Debug for BitrateModelEstimator
Auto Trait Implementations§
impl Freeze for BitrateModelEstimator
impl RefUnwindSafe for BitrateModelEstimator
impl Send for BitrateModelEstimator
impl Sync for BitrateModelEstimator
impl Unpin for BitrateModelEstimator
impl UnsafeUnpin for BitrateModelEstimator
impl UnwindSafe for BitrateModelEstimator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more