TranscodeBuilder

Struct TranscodeBuilder 

Source
pub struct TranscodeBuilder { /* private fields */ }
Expand description

Builder-style API for spinning up simple ffmpeg jobs.

Implementations§

Source§

impl TranscodeBuilder

Source

pub fn new() -> Self

Create a new builder with sensible defaults (overwrite enabled).

Source

pub fn with_binaries(self, binaries: &FfmpegBinaryPaths) -> Self

Use pre-discovered binaries instead of searching PATH every call.

Source

pub fn with_locator(self, locator: &FfmpegLocator) -> Self

Pin the builder to a specific locator.

Source

pub fn input<P: AsRef<Path>>(self, path: P) -> Self

Input media path.

Source

pub fn output<P: AsRef<Path>>(self, path: P) -> Self

Output media path.

Source

pub fn video_codec(self, codec: impl Into<String>) -> Self

Desired video codec (e.g. libx264).

Source

pub fn audio_codec(self, codec: impl Into<String>) -> Self

Desired audio codec (e.g. aac).

Source

pub fn video_bitrate(self, kbps: u32) -> Self

Target video bitrate in kbps.

Source

pub fn audio_bitrate(self, kbps: u32) -> Self

Target audio bitrate in kbps.

Source

pub fn frame_rate(self, fps: f64) -> Self

Target frame rate.

Source

pub fn preset(self, preset: impl Into<String>) -> Self

Apply a named preset (maps to -preset).

Source

pub fn size(self, width: u32, height: u32) -> Self

Convenience helper to scale output.

Source

pub fn add_video_filter(self, filter: VideoFilter) -> Self

Add a video filter to the processing chain.

Source

pub fn add_audio_filter(self, filter: AudioFilter) -> Self

Add an audio filter to the processing chain.

Source

pub fn add_filter(self, filter: VideoFilter) -> Self

👎Deprecated since 0.2.0: use add_video_filter() instead

Backward compatibility: alias for add_video_filter.

Source

pub fn extra_arg(self, arg: impl Into<OsString>) -> Self

Pass a raw argument for advanced cases.

Source

pub fn overwrite(self, enabled: bool) -> Self

Control whether ffmpeg should overwrite the output file.

Source

pub fn input_path(&self) -> Option<&Path>

Accessor for the configured input path.

Source

pub fn output_path(&self) -> Option<&Path>

Accessor for the configured output path.

Source

pub fn video_codec_ref(&self) -> Option<&str>

Accessor for the configured video codec.

Source

pub fn audio_codec_ref(&self) -> Option<&str>

Accessor for the configured audio codec.

Source

pub fn video_bitrate_value(&self) -> Option<u32>

Accessor for the configured video bitrate.

Source

pub fn audio_bitrate_value(&self) -> Option<u32>

Accessor for the configured audio bitrate.

Source

pub fn frame_rate_value(&self) -> Option<f64>

Accessor for the configured frame rate.

Source

pub fn preset_value(&self) -> Option<&str>

Accessor for the configured preset.

Source

pub fn overwrite_enabled(&self) -> bool

Returns whether overwriting outputs is enabled.

Source

pub fn video_filters(&self) -> &[VideoFilter]

Accessor for the configured video filter chain.

Source

pub fn audio_filters(&self) -> &[AudioFilter]

Accessor for the configured audio filter chain.

Source

pub fn run(self) -> Result<()>

Execute ffmpeg with the configured arguments.

Trait Implementations§

Source§

impl Debug for TranscodeBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TranscodeBuilder

Source§

fn default() -> TranscodeBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.