fix: sample_frames (timestamps) returns only frames that exist (#35)#45
Merged
Conversation
A timestamp past the end of the video makes ffmpeg exit 0 without writing a file, but the tool still reported that nonexistent path. It now checks the file exists before reporting it and lists any out-of-range timestamps under skippedTimestamps with a note. A stale file at the target path (reused outputDir) is cleared first so existence reflects only this run. Mirrors the fps-mode fix in #20. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
e0f9a25 to
8b429da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #35. In timestamps mode,
sample_framesreturned a path for every requested timestamp even when the timestamp was past the end of the video, where ffmpeg writes no file and exits 0. Theframeslist then contained paths that do not exist on disk.Changes
existsSync). Out-of-range timestamps are collected underskippedTimestampswith anote.outputDir) is removed before the run, so existence afterward reflects only what this invocation wrote - no false positives.Verification
npm run build,npm run typecheck,npm testall pass (136 passed, 6 skipped). The tool spawns ffmpeg, so it has no pure unit test, consistent with the rest of the suite.🤖 Generated with Claude Code