Skip to content

Add Frame Seeking to VapourSynth and FFMS2 Decoders - #13

Merged
shssoichiro merged 14 commits into
rust-av:mainfrom
BoatsMcGee:vs-seek-frame
Apr 26, 2026
Merged

Add Frame Seeking to VapourSynth and FFMS2 Decoders#13
shssoichiro merged 14 commits into
rust-av:mainfrom
BoatsMcGee:vs-seek-frame

Conversation

@BoatsMcGee

Copy link
Copy Markdown
Contributor

Adds a way to skip frames by setting the frames_read value in the Decoder. Allows decoding a subset of the video without having to decode the frames prior to the requested frames. Particularly useful for Scene Detection, where implementing pause/resume would nullify the gain from reduced computation because all frames had to be decoded (see example below).

Also enables seeking in the FFMS2 decoder by setting the seek mode from 0 (linear) to 1 (normal). I don't know why this wasn't implemented in the first place or maybe it was overlooked.

Example

// Frame 14000 was already detected in a previous session. Consider it "read" in this new session.
decoder.seek_to_frame(14000)?;
// av-scenechange will decode from frame 140001 instead of 0, eliminating redundant/unnecessary decoding
detect_scene_changes::<u8>(decoder, options, None, None)?;

Comment thread src/lib.rs Outdated
@shssoichiro
shssoichiro merged commit 38a9fe2 into rust-av:main Apr 26, 2026
4 checks passed
@BoatsMcGee
BoatsMcGee deleted the vs-seek-frame branch April 26, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants