pub struct TranscodeEstimator;Expand description
Analytical estimator for transcoding resource and quality metrics.
All methods are pure functions — they perform no I/O and no actual encoding. Results are approximations useful for pre-flight planning (UI display, job scheduling, storage budgeting) rather than precise measurements.
Implementations§
Source§impl TranscodeEstimator
impl TranscodeEstimator
Sourcepub fn estimate_size_bytes(
duration_secs: f64,
video_bitrate_kbps: Option<u32>,
audio_bitrate_kbps: Option<u32>,
) -> u64
pub fn estimate_size_bytes( duration_secs: f64, video_bitrate_kbps: Option<u32>, audio_bitrate_kbps: Option<u32>, ) -> u64
Estimates the output file size in bytes.
Uses the combined bitrate of video and audio streams to compute the expected byte count for a given duration.
§Arguments
duration_secs— Content duration in seconds.video_bitrate_kbps— Video bitrate in kilobits per second (orNonefor audio-only output).audio_bitrate_kbps— Audio bitrate in kilobits per second (orNonefor video-only output).
Sourcepub fn estimate_speed_factor(
codec: &str,
preset: &str,
resolution_pixels: u64,
) -> f32
pub fn estimate_speed_factor( codec: &str, preset: &str, resolution_pixels: u64, ) -> f32
Estimates the encoding speed factor relative to real-time.
A factor of 1.0 means encoding takes as long as the source duration.
A factor of 0.5 means encoding takes half the source duration (2× faster
than real-time), while 4.0 means encoding takes four times longer than
the source (0.25× real-time).
§Arguments
codec— Codec name (e.g."av1","vp9","h264","flac","opus").preset— Encoder preset string (e.g."slow","fast","ultrafast").resolution_pixels— Total pixel count (width × height; use0for audio-only streams).
Sourcepub fn estimate_vmaf(bitrate_kbps: u32, resolution_pixels: u64) -> f32
pub fn estimate_vmaf(bitrate_kbps: u32, resolution_pixels: u64) -> f32
Estimates perceptual video quality as an approximate VMAF score (0–100).
The estimate is derived from the bits-per-pixel metric and a logarithmic saturation curve that reflects empirically observed VMAF behaviour. It is not a substitute for actual VMAF measurement.
§Arguments
bitrate_kbps— Video bitrate in kilobits per second.resolution_pixels— Total pixel count (width × height).
§Returns
An estimated VMAF score in the range [0.0, 100.0].
Trait Implementations§
Source§impl Clone for TranscodeEstimator
impl Clone for TranscodeEstimator
Source§fn clone(&self) -> TranscodeEstimator
fn clone(&self) -> TranscodeEstimator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TranscodeEstimator
impl RefUnwindSafe for TranscodeEstimator
impl Send for TranscodeEstimator
impl Sync for TranscodeEstimator
impl Unpin for TranscodeEstimator
impl UnsafeUnpin for TranscodeEstimator
impl UnwindSafe for TranscodeEstimator
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
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>
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>
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