Skip to main content

Stabilizer

Struct Stabilizer 

Source
pub struct Stabilizer;
Expand description

Two-pass video stabilization using FFmpeg’s vidstabdetect / vidstabtransform filters.

Pass 1: Stabilizer::analyze — motion analysis, produces a .trf file. Pass 2: Stabilizer::transform — correction, consumes the .trf file.

Implementations§

Source§

impl Stabilizer

Source

pub fn analyze( input: &Path, output_trf: &Path, opts: &AnalyzeOptions, ) -> Result<(), FilterError>

Analyze motion in input and write the transform file to output_trf.

Runs a self-contained FFmpeg filter graph: movie → vidstabdetect → buffersink. The resulting .trf file is consumed by Stabilizer::transform in pass 2.

§Errors

Returns FilterError::Ffmpeg if:

  • vidstabdetect is not available in the linked FFmpeg build.
  • The input file is unreadable or does not exist.
  • The filter graph cannot be configured or the .trf file cannot be written.
Source

pub fn transform( input: &Path, trf_path: &Path, output: &Path, opts: &StabilizeOptions, ) -> Result<(), FilterError>

Apply motion transforms from the .trf file produced by Stabilizer::analyze.

Reads input, applies vidstabtransform, and writes the stabilized video to output (re-encoded with the best available H.264 encoder).

§Errors

Returns FilterError::Ffmpeg if:

  • vidstabtransform is not available in the linked FFmpeg build.
  • trf_path does not exist or is unreadable.
  • The input file is unreadable or does not exist.
  • The output file cannot be created or encoded.

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, 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.