pub struct StreamCopyTrimmer { /* private fields */ }Expand description
Trim a media file to a time range using stream copy (no re-encode).
Uses avformat_seek_file to seek to the start point, then copies packets
until the presentation timestamp exceeds the end point. All streams
(video, audio, subtitles) are copied verbatim from the input.
§Example
ⓘ
use ff_encode::StreamCopyTrimmer;
StreamCopyTrimmer::new("input.mp4", 2.0, 7.0, "output.mp4")
.run()?;Implementations§
Source§impl StreamCopyTrimmer
impl StreamCopyTrimmer
Sourcepub fn new(
input: impl Into<PathBuf>,
start_sec: f64,
end_sec: f64,
output: impl Into<PathBuf>,
) -> Self
pub fn new( input: impl Into<PathBuf>, start_sec: f64, end_sec: f64, output: impl Into<PathBuf>, ) -> Self
Create a new StreamCopyTrimmer.
start_sec and end_sec are absolute timestamps in seconds measured
from the start of the source file. run returns
EncodeError::InvalidConfig if start_sec >= end_sec.
Sourcepub fn run(self) -> Result<(), EncodeError>
pub fn run(self) -> Result<(), EncodeError>
Execute the trim operation.
§Errors
EncodeError::InvalidConfigifstart_sec >= end_sec.EncodeError::Ffmpegif any FFmpeg API call fails.
Auto Trait Implementations§
impl Freeze for StreamCopyTrimmer
impl RefUnwindSafe for StreamCopyTrimmer
impl Send for StreamCopyTrimmer
impl Sync for StreamCopyTrimmer
impl Unpin for StreamCopyTrimmer
impl UnsafeUnpin for StreamCopyTrimmer
impl UnwindSafe for StreamCopyTrimmer
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