pub struct AudioTranscodeConfig {
pub input_codec: String,
pub output_codec: String,
pub bitrate_kbps: u32,
pub sample_rate: u32,
pub channels: u8,
pub normalize: bool,
pub target_lufs: f64,
}Expand description
Configuration for an audio transcode operation.
Fields§
§input_codec: StringName of the input audio codec (e.g., "aac", "flac").
output_codec: StringName of the output audio codec (e.g., "opus", "aac").
bitrate_kbps: u32Target bitrate in kilobits per second. Ignored for lossless codecs.
sample_rate: u32Output sample rate in Hz (e.g., 48000).
channels: u8Number of output channels (1 = mono, 2 = stereo, 6 = 5.1, etc.).
normalize: boolWhether to apply loudness normalisation.
target_lufs: f64Target loudness in LUFS for normalisation (e.g., -23.0 for EBU R128).
Implementations§
Source§impl AudioTranscodeConfig
impl AudioTranscodeConfig
Sourcepub fn new(
input_codec: impl Into<String>,
output_codec: impl Into<String>,
bitrate_kbps: u32,
sample_rate: u32,
channels: u8,
) -> Self
pub fn new( input_codec: impl Into<String>, output_codec: impl Into<String>, bitrate_kbps: u32, sample_rate: u32, channels: u8, ) -> Self
Creates a new config with the given codecs and basic parameters.
Sourcepub fn aac_stereo_256k() -> Self
pub fn aac_stereo_256k() -> Self
Returns a config for AAC stereo at 256 kbps / 48 kHz.
Sourcepub fn opus_stereo_128k() -> Self
pub fn opus_stereo_128k() -> Self
Returns a config for Opus stereo at 128 kbps / 48 kHz.
Sourcepub fn flac_lossless() -> Self
pub fn flac_lossless() -> Self
Returns a config for FLAC lossless stereo at 48 kHz.
Sourcepub fn with_normalization(self, target_lufs: f64) -> Self
pub fn with_normalization(self, target_lufs: f64) -> Self
Enables loudness normalisation with the given LUFS target.
Sourcepub fn is_lossless_output(&self) -> bool
pub fn is_lossless_output(&self) -> bool
Returns true if the output codec is lossless.
Trait Implementations§
Source§impl Clone for AudioTranscodeConfig
impl Clone for AudioTranscodeConfig
Source§fn clone(&self) -> AudioTranscodeConfig
fn clone(&self) -> AudioTranscodeConfig
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 AudioTranscodeConfig
impl RefUnwindSafe for AudioTranscodeConfig
impl Send for AudioTranscodeConfig
impl Sync for AudioTranscodeConfig
impl Unpin for AudioTranscodeConfig
impl UnsafeUnpin for AudioTranscodeConfig
impl UnwindSafe for AudioTranscodeConfig
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