pub struct TranscodeOptimizer { /* private fields */ }Expand description
Optimizer that adjusts TranscodeConfig fields to meet an
OptimizationGoal.
Implementations§
Source§impl TranscodeOptimizer
impl TranscodeOptimizer
Sourcepub fn new(goal: OptimizationGoal) -> Self
pub fn new(goal: OptimizationGoal) -> Self
Creates a new optimizer for the given goal.
Sourcepub fn with_max_size_mb(self, mb: f64) -> Self
pub fn with_max_size_mb(self, mb: f64) -> Self
Sets the maximum acceptable file size for MinimizeSize goal.
Sourcepub fn with_target_kbps(self, kbps: f64) -> Self
pub fn with_target_kbps(self, kbps: f64) -> Self
Sets the target bitrate for TargetBitrate goal.
Sourcepub fn goal(&self) -> OptimizationGoal
pub fn goal(&self) -> OptimizationGoal
Returns the active optimization goal.
Sourcepub fn optimize_for_goal(&self, config: &TranscodeConfig) -> TranscodeConfig
pub fn optimize_for_goal(&self, config: &TranscodeConfig) -> TranscodeConfig
Returns an optimized TranscodeConfig derived from the input config
that best satisfies the optimizer’s goal.
Sourcepub fn suggest_crf(&self, config: &TranscodeConfig, target_kbps: f64) -> u8
pub fn suggest_crf(&self, config: &TranscodeConfig, target_kbps: f64) -> u8
Suggests a CRF value that would produce output close to target_kbps.
Uses binary-search style iteration over the CRF range [0, 51].
Sourcepub fn estimated_output_size_mb(&self, config: &TranscodeConfig) -> f64
pub fn estimated_output_size_mb(&self, config: &TranscodeConfig) -> f64
Returns the estimated output size in MB for a given config under the current optimization goal.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TranscodeOptimizer
impl RefUnwindSafe for TranscodeOptimizer
impl Send for TranscodeOptimizer
impl Sync for TranscodeOptimizer
impl Unpin for TranscodeOptimizer
impl UnsafeUnpin for TranscodeOptimizer
impl UnwindSafe for TranscodeOptimizer
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> 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