Skip to content

fix: cap sample_frames output with maxFrames (#80) - #131

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/sample-frames-cap-80
Oct 24, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
fix/sample-frames-cap-80

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Closes #80.

What

sample_frames had no frame limit: fps: 30 on an hour-long recording wrote ~108k PNGs and listed every path in one response.

  • New maxFrames (default 100, max 1000).
  • fps mode: probes the duration first. planFpsSampling (pure, in media.ts) lowers a rate that would exceed the cap so the frames still span the whole video. The result reports requestedFps and a capNote. That seemed more useful than writing the first 100 frames and stopping.
  • Backstop: buildSampleByFpsArgs always passes -frames:v <maxFrames>, so a video whose length can't be probed still stops at the cap (and says so).
  • timestamps mode: more timestamps than maxFrames is rejected with an actionable error.

I left the optional on-disk maxWidth from the issue out: inline images (#79) are already downscaled, and on-disk frames stay full resolution on purpose.

Tests

  • Unit: plan keeps a rate that fits, clamps 30 fps × 3600 s to ≤100 frames, leaves an unknown duration alone; builder emits -frames:v.
  • Integration (real ffmpeg): a clamped plan writes ≤ cap; an unclamped 30 fps request stops at exactly the backstop count.
  • Live capture harness (run locally on Windows, all 9 pass): checks capNote / requestedFps through the real server, and that too many timestamps is an error.

Version 0.11.1, CHANGELOG, README, ROADMAP, mcp-tools.json updated.

🤖 Generated with Claude Code

fps mode probes the duration first and lowers a rate that would exceed
maxFrames (default 100, max 1000) so frames still span the whole video,
reporting requestedFps and a capNote. -frames:v is a backstop when the
duration is unknown. Too many timestamps is rejected with a clear error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TMHSDigital
TMHSDigital merged commit ab6941e into main Oct 24, 2026
8 checks passed
@TMHSDigital
TMHSDigital deleted the fix/sample-frames-cap-80 branch October 24, 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.

Bug: sample_frames fps mode has no frame cap (can write 100k+ PNGs and flood the response)

1 participant