Skip to content

fix: sample_frames (timestamps) returns only frames that exist (#35)#45

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/35-sample-frames-past-end
Jun 16, 2026
Merged

fix: sample_frames (timestamps) returns only frames that exist (#35)#45
TMHSDigital merged 1 commit into
mainfrom
fix/35-sample-frames-past-end

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Summary

Fixes #35. In timestamps mode, sample_frames returned 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. The frames list then contained paths that do not exist on disk.

Changes

  • After each per-timestamp ffmpeg run, the frame is reported only if the file actually exists (existsSync). Out-of-range timestamps are collected under skippedTimestamps with a note.
  • Any stale file at the target path (a reused outputDir) is removed before the run, so existence afterward reflects only what this invocation wrote - no false positives.
  • Mirrors the fps-mode fix in Bug: sample_frames (fps mode) can include pre-existing PNGs from a reused outputDir #20 (return only frames that exist).

Verification

npm run build, npm run typecheck, npm test all 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

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>
@TMHSDigital TMHSDigital force-pushed the fix/35-sample-frames-past-end branch from e0f9a25 to 8b429da Compare June 16, 2026 23:19
@TMHSDigital TMHSDigital merged commit bb1bd6b into main Jun 16, 2026
@TMHSDigital TMHSDigital deleted the fix/35-sample-frames-past-end branch June 16, 2026 23:19
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.

Bug: sample_frames (timestamps) returns paths for frames past the end of the video

1 participant