Log in
TechniqueBy HypernaturalVersion 1, updated

Cut best takes by speech islands

hn/python-cut-best-takes-by-speech-islands

Cut one recording full of retakes (a webcam or talking-head file) into a tight rough cut of its best takes: split it into utterances from the sound, transcribe each on its own, pick the last complete take of every line, then build the cut in one ffmpeg graph with each piece trimmed to its speech, pauses over 0.14 s squeezed to about 0.11 s, 6 and 10 ms fades and every edge on the frame grid, plus a timeline of what was kept. Free and local. For takes split across files or paired screen and webcam recordings, cut from the transcript with python-cut-phrases-from-takes instead.

SKILL.md

Give it one recording and a cut list of the pieces to keep, in the order they play; get the rough cut, its filter graph and a timeline. The pieces come from the sound: the recording is split into utterances, each is transcribed on its own, and you pick the takes from those transcripts. For many takes in several files, or a screen recording paired with a webcam, the text paper edit in python-cut-phrases-from-takes is the route; guide-cut-best-takes weighs the two.

Inputs

  • The source movie, probed (ffprobe-inspect-media): its fps, and the audio stream's start (screen and webcam recordings often start their sound 0.1–0.25 s in).
  • Its 16 kHz mono WAV (whisper-cli-transcribe-with-word-times, Run it), the clock every time below is on. The script adds the audio start back for you.
  • speech_map.py from python-find-speech-pauses, in the job's scripts/.

Run it

  1. Utterances: exec python scripts/speech_map.py runs work/source.wav --gap 0.45 --out-dir work/runs.
  2. Transcribe each run on its own with large-v3-turbo (whisper-cli-transcribe-with-word-times; start them all with exec(wait: false)). A short file's transcript is exact about which words were said; word times from the whole file drift up to 1 s, so never cut on them.
  3. Pick the takes into work/cut.json (references/islands_cut.md has the format):
    • per line, the last complete take, usually the cleanest and fastest;
    • drop false starts, filler "OK"s, coughs, and runs that read only "Thank you." or "Yes." (whisper's words for breath and room);
    • a take that restarts mid-sentence, or ends just before a word you don't want: cut at an energy dip inside the run (speech_map.py map around it with --db -30) and mark that edge tight_start or tight_end.
  4. Check every cut inside a run by transcribing that window on its own, ±0.5 s around the joint. A clipped last word is the usual note: a short tail can be the end of the word, not the start of the next one.
  5. Build: write references/islands_cut.md's script into the job's scripts/ as islands_cut.py, as is, and run exec python scripts/islands_cut.py --src source/take.mov --wav work/source.wav --cut work/cut.json --fps 30 --out work/rough_cut.mp4.
  6. Verify: transcribe the cut and read it against the lines; list the longest pauses left (speech_map.py pauses work/rough_cut.wav --min-gap 0.25). Then the person reviews it (guide-cut-best-takes, Process).

What the build does

  • Each piece starts 0.05 s before its first speech and ends 0.09 s after its last; a tight_ edge stays exactly where you put it.
  • Inside a piece, every pause over 0.14 s keeps 0.06 s after the speech before it and 0.05 s before the speech after it, about 0.11 s in all.
  • Every span is cut on the frame grid, picture and sound on the same frame times (ffmpeg-frame-exact-trim, The frame grid), with a 6 ms fade in and a 10 ms fade out on the sound, all joined in one -/filter_complex graph.

What you get

rough_cut.mp4 (H.264, AAC), rough_cut.graph.txt, and rough_cut.timeline.json: every kept span with its piece, note, WAV times, source frames and its start and end in the cut, for re-cueing captions and graphics after a re-cut.

Tips and traps

  • A 70 s webcam read with retakes became 23 runs; 3 pieces from them cut to 640 frames in 12 spans, picture and sound both 21.333 s, and its transcript read the kept lines word for word.
  • A run that flows into an unwanted word ("…thinking, but") has no pause to find at the adaptive threshold; map --db -30 found the dip and a tight_end there removed the "but", which the transcript of the cut then punctuated as a sentence end.
  • Pauses at the joins between pieces come out about 0.14 s (tail plus pre-roll); lists of "longest pauses" on the cut are mostly joins and the quiet ends of words.
  • The graph is one line per span; hundreds of spans are fine in one graph.

Check it

  • Frame count of the cut against its audio length: ffprobe both; they match to the frame.
  • A transcript of the cut (whisper-cli-transcribe-with-word-times, Check it) against the lines picked.

FAQs

Cut one recording full of retakes (a webcam or talking-head file) into a tight rough cut of its best takes: split it into utterances from the sound, transcribe each on its own, pick the last complete take of every line, then build the cut in one ffmpeg graph with each piece trimmed to its speech, pauses over 0.14 s squeezed to about 0.11 s, 6 and 10 ms fades and every edge on the frame grid, plus a timeline of what was kept. Free and local. For takes split across files or paired screen and webcam recordings, cut from the transcript with python-cut-phrases-from-takes instead.

Install Hypernatural Desktop, a free Mac app, and connect it to Claude Code, Codex or Claude Desktop. Then describe the video you want and your agent finds the skill itself, or paste this page's link (https://hypernatural.ai/skill/hn/python-cut-best-takes-by-speech-islands) and it installs hn/python-cut-best-takes-by-speech-islands and follows it.

Nothing. The skill is free and runs with tools on your own Mac, like python, ffmpeg, ffprobe and whisper-cli.

Yes. Ask your agent to adjust it for your job, or to save its own version. You can publish your version under your own handle so anyone can install it.

Go make something cool.

Install the app, open your agent, describe the video. That's the whole onboarding.

Sticker HypernaturalSticker BannerSticker TVBoy