pub struct StreamCopyTrim { /* private fields */ }Expand description
Trim a media file to a time range using stream copy (no re-encode).
Equivalent to StreamCopyTrimmer but accepts Duration for start and
end instead of raw seconds, and returns
EncodeError::MediaOperationFailed when the time range is invalid.
§Example
ⓘ
use ff_encode::StreamCopyTrim;
use std::time::Duration;
StreamCopyTrim::new(
"input.mp4",
Duration::from_secs(2),
Duration::from_secs(7),
"output.mp4",
)
.run()?;Implementations§
Source§impl StreamCopyTrim
impl StreamCopyTrim
Sourcepub fn new(
input: impl Into<PathBuf>,
start: Duration,
end: Duration,
output: impl Into<PathBuf>,
) -> Self
pub fn new( input: impl Into<PathBuf>, start: Duration, end: Duration, output: impl Into<PathBuf>, ) -> Self
Create a new StreamCopyTrim.
start and end are absolute timestamps measured from the start of
the source file. run returns
EncodeError::MediaOperationFailed if start >= end.
Sourcepub fn run(self) -> Result<(), EncodeError>
pub fn run(self) -> Result<(), EncodeError>
Execute the trim operation.
§Errors
EncodeError::MediaOperationFailedifstart >= end.EncodeError::Ffmpegif any FFmpeg API call fails.
Auto Trait Implementations§
impl Freeze for StreamCopyTrim
impl RefUnwindSafe for StreamCopyTrim
impl Send for StreamCopyTrim
impl Sync for StreamCopyTrim
impl Unpin for StreamCopyTrim
impl UnsafeUnpin for StreamCopyTrim
impl UnwindSafe for StreamCopyTrim
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