pub struct Transcoder { /* private fields */ }Expand description
Main transcoding interface with simple API.
§Example
use oximedia_transcode::Transcoder;
Transcoder::new()
.input("input.mp4")
.output("output.webm")
.video_codec("vp9")
.audio_codec("opus")
.transcode()
.await?;Implementations§
Source§impl Transcoder
impl Transcoder
Sourcepub fn config(&self) -> &TranscodeConfig
pub fn config(&self) -> &TranscodeConfig
Get a reference to the transcoder configuration.
Sourcepub fn video_codec(self, codec: impl Into<String>) -> Self
pub fn video_codec(self, codec: impl Into<String>) -> Self
Sets the video codec.
Sourcepub fn audio_codec(self, codec: impl Into<String>) -> Self
pub fn audio_codec(self, codec: impl Into<String>) -> Self
Sets the audio codec.
Sourcepub fn video_bitrate(self, bitrate: u64) -> Self
pub fn video_bitrate(self, bitrate: u64) -> Self
Sets the target video bitrate.
Sourcepub fn audio_bitrate(self, bitrate: u64) -> Self
pub fn audio_bitrate(self, bitrate: u64) -> Self
Sets the target audio bitrate.
Sourcepub fn resolution(self, width: u32, height: u32) -> Self
pub fn resolution(self, width: u32, height: u32) -> Self
Sets the output resolution.
Sourcepub fn frame_rate(self, num: u32, den: u32) -> Self
pub fn frame_rate(self, num: u32, den: u32) -> Self
Sets the output frame rate.
Sourcepub fn multi_pass(self, mode: MultiPassMode) -> Self
pub fn multi_pass(self, mode: MultiPassMode) -> Self
Sets the multi-pass encoding mode.
Sourcepub fn quality(self, mode: QualityMode) -> Self
pub fn quality(self, mode: QualityMode) -> Self
Sets the quality mode.
Sourcepub fn target_bitrate(self, bitrate: u64) -> Self
pub fn target_bitrate(self, bitrate: u64) -> Self
Sets the target bitrate (convenience method for video bitrate).
Sourcepub fn normalize_audio(self, enable: bool) -> Self
pub fn normalize_audio(self, enable: bool) -> Self
Enables or disables audio normalization.
Sourcepub fn loudness_standard(self, standard: LoudnessStandard) -> Self
pub fn loudness_standard(self, standard: LoudnessStandard) -> Self
Sets the loudness normalization standard.
Sourcepub fn preset(self, preset: PresetConfig) -> Self
pub fn preset(self, preset: PresetConfig) -> Self
Applies a preset configuration.
Sourcepub async fn transcode(self) -> Result<TranscodeOutput>
pub async fn transcode(self) -> Result<TranscodeOutput>
Executes the transcode operation.
§Errors
Returns an error if:
- Input or output path is not set
- Input file is invalid or cannot be opened
- Output configuration is invalid
- Transcoding fails
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transcoder
impl RefUnwindSafe for Transcoder
impl Send for Transcoder
impl Sync for Transcoder
impl Unpin for Transcoder
impl UnsafeUnpin for Transcoder
impl UnwindSafe for Transcoder
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> 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