Skip to main content

ClipJoiner

Struct ClipJoiner 

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

Joins two video clips with a cross-dissolve transition.

Each clip is loaded via a movie= source node. The last dissolve_duration seconds of clip A overlap with the first dissolve_duration seconds of clip B, producing an output shorter than simple concatenation by dissolve_duration.

When dissolve_duration is Duration::ZERO the clips are concatenated without a transition (equivalent to [VideoConcatenator::new(vec![clip_a, clip_b]).build()]).

§Errors

Returns FilterError::CompositionFailed when:

  • The clip duration cannot be probed (e.g. file not found).
  • dissolve_duration exceeds the duration of either clip.

§Examples

use ff_filter::ClipJoiner;
use std::time::Duration;

let mut graph = ClipJoiner::new("intro.mp4", "main.mp4", Duration::from_secs(1))
    .build()?;

while let Some(frame) = graph.pull_video()? {
    // encode or display `frame`
}

Implementations§

Source§

impl ClipJoiner

Source

pub fn new( clip_a: impl AsRef<Path>, clip_b: impl AsRef<Path>, dissolve_duration: Duration, ) -> Self

Create a new ClipJoiner.

dissolve_duration is the length of the cross-dissolve overlap. Pass Duration::ZERO for plain concatenation (no transition).

Source

pub fn build(self) -> Result<FilterGraph, FilterError>

Builds a source-only FilterGraph that joins the two clips.

§Errors
  • FilterError::CompositionFailed — clip duration probe failed, or dissolve_duration exceeds a clip’s duration, or an FFmpeg graph-construction call failed.

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.