pub struct BitrateEstimator { /* private fields */ }Expand description
Estimates output bitrate (bits per second) from encode parameters.
The model is a simplified empirical formula:
bitrate ≈ base_bpp * pixels_per_frame * frame_rate * quality_factor
where quality_factor decreases as QP/CRF increases.
§Example
use oximedia_transcode::bitrate_estimator::BitrateEstimator;
let est = BitrateEstimator::new();
let bps = est.estimate_from_crf(23, 1920, 1080, 30.0);
assert!(bps > 0);Implementations§
Source§impl BitrateEstimator
impl BitrateEstimator
Sourcepub fn with_params(base_bpp: f64, decay: f64) -> Self
pub fn with_params(base_bpp: f64, decay: f64) -> Self
Creates a BitrateEstimator with custom parameters.
base_bpp– bits per pixel at QP = 0.decay– exponential decay constant; higher = steeper quality/bitrate curve.
Sourcepub fn estimate_from_crf(
&self,
crf: u8,
width: u32,
height: u32,
frame_rate: f64,
) -> u64
pub fn estimate_from_crf( &self, crf: u8, width: u32, height: u32, frame_rate: f64, ) -> u64
Estimates output bitrate in bits/s from a CRF value (0–51 for H.264/H.265).
crf– Constant Rate Factor (0 = lossless, 51 = worst).width– Frame width in pixels.height– Frame height in pixels.frame_rate– Frames per second.
Sourcepub fn estimate_from_qp(
&self,
qp: f64,
width: u32,
height: u32,
frame_rate: f64,
) -> u64
pub fn estimate_from_qp( &self, qp: f64, width: u32, height: u32, frame_rate: f64, ) -> u64
Estimates output bitrate in bits/s from a floating-point QP value.
qp– Quantization parameter.width– Frame width in pixels.height– Frame height in pixels.frame_rate– Frames per second.
Sourcepub fn estimate_from_vmaf(
&self,
vmaf: f64,
width: u32,
height: u32,
frame_rate: f64,
) -> u64
pub fn estimate_from_vmaf( &self, vmaf: f64, width: u32, height: u32, frame_rate: f64, ) -> u64
Estimates bitrate from a target VMAF score (0–100).
Linearly maps VMAF → effective QP, then delegates to estimate_from_qp.
VMAF 100 ≈ QP 0 (lossless), VMAF 0 ≈ QP 51 (worst).
Trait Implementations§
Source§impl Clone for BitrateEstimator
impl Clone for BitrateEstimator
Source§fn clone(&self) -> BitrateEstimator
fn clone(&self) -> BitrateEstimator
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 BitrateEstimator
impl Debug for BitrateEstimator
Auto Trait Implementations§
impl Freeze for BitrateEstimator
impl RefUnwindSafe for BitrateEstimator
impl Send for BitrateEstimator
impl Sync for BitrateEstimator
impl Unpin for BitrateEstimator
impl UnsafeUnpin for BitrateEstimator
impl UnwindSafe for BitrateEstimator
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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