Skip to content

feat: scene-change sampling and dedupe for sample_frames (#114) - #141

Merged
TMHSDigital merged 1 commit into
mainfrom
feat/scene-sampling-114
Oct 24, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
feat/scene-sampling-114

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Closes #114.

What

  • sample_frames { mode: "scenes" }: returns only frames where the screen changed, plus the opening frame.
    1. A cheap scan on a 320 px copy: scale=320:-2,select='gt(scene\,T)',metadata=print:file=- → (pts_time, scene_score) pairs (parseSceneScan).
    2. pickSceneFrames keeps t=0 plus the strongest changes up to maxFrames, in time order.
    3. Those times are grabbed at full resolution through the existing accurate-seek timestamp path, so inline images (Return frames as MCP image content from screenshot and sample_frames so agents can view them directly #79) and the frame cap (Bug: sample_frames fps mode has no frame cap (can write 100k+ PNGs and flood the response) #80) apply unchanged.
      The result reports frameTimes, sceneChangesFound, and a capNote when changes were dropped.
  • sceneThreshold (default 0.1; screen content changes in small regions, so lower than the usual 0.3-0.4 for film).
  • dedupe: true (fps mode): fps=N,mpdecimate + -fps_mode vfr.
  • Explicit mode enum; omitted, it's inferred from fps / timestamps, so existing calls are unchanged.

I didn't do the "keep top-N by score when over the cap" via showinfo as sketched in the issue. Scoring every frame in a low-res pass and seeking to the winners gives exact timestamps and full-res frames more simply.

Tests

  • Unit: scan args (filtergraph comma escaping, threshold range), parser (CRLF, empty), picker (top-N, time order, cap of 1), dedupe args.
  • Integration (real ffmpeg): a red→blue→testsrc clip finds cuts at ~2 s and ~4 s; dedupe on a static clip writes 1 frame vs ≥7 without.
  • End-to-end through the server: scenes → [0, 2, 4] with 3 inline images; maxFrames: 2 keeps the stronger cut and says so; mode: scenes + fps is rejected; dedupe 12 → 6 frames.
  • Full suite 238 pass.

Version 0.15.0; README, Pages, mcp-tools.json, CHANGELOG updated.

🤖 Generated with Claude Code

mode: "scenes" scans a low-res copy for scene changes, keeps the opening
frame plus the strongest changes up to maxFrames, and grabs those at full
resolution, reporting frameTimes. sceneThreshold tunes sensitivity
(default 0.1 for UI content). dedupe: true adds mpdecimate to fps mode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 24, 2026
@TMHSDigital
TMHSDigital merged commit 026da51 into main Oct 24, 2026
8 checks passed
@TMHSDigital
TMHSDigital deleted the feat/scene-sampling-114 branch October 24, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scene-change sampling mode for sample_frames (only the frames that matter)

1 participant