pub struct KeyframeEnumerator { /* private fields */ }Expand description
Enumerates the timestamps of all keyframes in a video stream.
Reads only packet headers — no decoding is performed — making this
significantly faster than frame-by-frame decoding. By default the first
video stream is selected; call stream_index to
target a specific stream.
§Examples
ⓘ
use ff_decode::KeyframeEnumerator;
let keyframes = KeyframeEnumerator::new("video.mp4").run()?;
for ts in &keyframes {
println!("Keyframe at {:?}", ts);
}Implementations§
Source§impl KeyframeEnumerator
impl KeyframeEnumerator
Sourcepub fn new(input: impl AsRef<Path>) -> Self
pub fn new(input: impl AsRef<Path>) -> Self
Creates a new enumerator for the given video file.
The first video stream is used by default. Call
stream_index to select a different stream.
Sourcepub fn stream_index(self, idx: usize) -> Self
pub fn stream_index(self, idx: usize) -> Self
Selects a specific stream by zero-based index.
When not set (the default), the first video stream in the file is used.
Sourcepub fn run(self) -> Result<Vec<Duration>, DecodeError>
pub fn run(self) -> Result<Vec<Duration>, DecodeError>
Enumerates keyframe timestamps and returns them in presentation order.
§Errors
DecodeError::AnalysisFailed— input file not found, no video stream exists, the requested stream index is out of range, or an internalFFmpegerror occurs.
Auto Trait Implementations§
impl Freeze for KeyframeEnumerator
impl RefUnwindSafe for KeyframeEnumerator
impl Send for KeyframeEnumerator
impl Sync for KeyframeEnumerator
impl Unpin for KeyframeEnumerator
impl UnsafeUnpin for KeyframeEnumerator
impl UnwindSafe for KeyframeEnumerator
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