Skip to content

feat: add cut_idle to remove dead air (#122) - #152

Merged
TMHSDigital merged 1 commit into
mainfrom
feat/cut-idle-122
Oct 24, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
feat/cut-idle-122

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Closes #122.

What

New tool cut_idle {input, minIdleSec=2, keepSec=0.4, useAudio, dryRun}:

  1. One scan: freezedetect=n=-60dB:d=MIN (+ silencedetect=n=-40dB:d=MIN when audio counts) → frozen / silent intervals from stderr. A stretch still open at EOF is closed at the duration.
  2. Idle = frozen ∩ silent (intersect), or just frozen with useAudio: false, so narration over a still screen isn't cut.
  3. Each idle stretch ≥ minIdleSec shrinks by keepSec at both edges (cutsFor).
  4. One pass: select='not(between…+…)',setpts=N/FRAME_RATE/TB and aselect…,asetpts=N/SR/TB, via runEditJob.
    dryRun returns cuts, removedSec, and the new duration without writing anything. At most 200 cuts (otherwise it asks for a larger minIdleSec).

Verified (end to end through the server)

  • 8 s clip with a frozen, silent gap at 2-6 s → dry run cuts 2.4-5.6; the real cut gives video 4.77 s / audio 4.81 s (about one frame apart).
  • Same freeze but with a tone playing → no cuts by default; useAudio: false → cuts 2.4-5.6.

Tests

  • Unit (idle.test.ts): marker pairing against real ffmpeg output (incl. a stretch open to EOF), interval intersection, pad and min-length rules, scan args with and without audio, select/aselect expressions.
  • Integration: a real frozen, silent stretch is found where expected and removed, with duration correct.
  • Full suite 310.

Version 0.26.0; README (36 tools), Pages, mcp-tools.json, CHANGELOG.

🤖 Generated with Claude Code

Scans for frozen video and, when there is audio, silence; cuts stretches
that are both, keeping a short pad at each edge, in one select/aselect
pass. dryRun reports the cuts first, and speech over a still screen is
kept unless useAudio is false.

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 5934f6e into main Oct 24, 2026
8 checks passed
@TMHSDigital
TMHSDigital deleted the feat/cut-idle-122 branch October 24, 2026 22:16
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.

Dead-air removal: cut idle and silent stretches from recordings (cut_idle)

1 participant