Cut silence and retakes
cut-retakes turns a raw take into non-destructive narration segments. How it works is covered in Non-destructive cutting. This page is the practical recipe.
Silence only (no transcript)
Section titled “Silence only (no transcript)”npx @mathrunet/rereel cut-retakes --input raw/narration_take1.wav --out work/cuts.jsonThis uses FFmpeg silencedetect. Tune it with --silence-db (default -40; raise toward -30 for noisy rooms) and --min-silence-sec (default 0.45).
Silence, fillers and retakes (with Whisper)
Section titled “Silence, fillers and retakes (with Whisper)”-
Produce a word-timestamp transcript.
--asr-jsonexpects Whisper’s JSON shape:raw/narration_take1.json {"text": "…","language": "en","segments": [{ "start": 0.10, "end": 0.90, "text": " Still re-ren-","words": [ { "word": " Still", "start": 0.10, "end": 0.32, "probability": 0.98 },{ "word": " re-ren-", "start": 0.35, "end": 0.90 } ] },{ "start": 1.50, "end": 2.80, "text": " Still re-rendering the whole video?","words": [ … ] }]}Only
segments[].start,end,textandwords[].word,start,endare read.wordsis optional; without it, each segment counts as a single word, which works but is coarser. Words are joined as-is, so keep Whisper’s leading spaces.Terminal window whisper raw/narration_take1.wav --model medium --word_timestamps True \--output_format json --output_dir raw# → raw/narration_take1.json (already in the expected shape)import jsonfrom faster_whisper import WhisperModelmodel = WhisperModel("medium")segments, info = model.transcribe("raw/narration_take1.wav", word_timestamps=True)out = {"language": info.language, "segments": [{"start": s.start, "end": s.end, "text": s.text,"words": [{"word": w.word, "start": w.start, "end": w.end,"probability": w.probability} for w in s.words]}for s in segments]}json.dump(out, open("raw/narration_take1.json", "w"), ensure_ascii=False)The transcription API with
response_format=verbose_jsonandtimestamp_granularities[]=wordreturns a top-levelwordsarray. Wrap it in one segment:Terminal window jq '{language, segments: [{start: 0, end: .duration, text: .text,words: [.words[] | {word: (" " + .word), start, end}]}]}' \api_response.json > raw/narration_take1.jsonAPI words carry no punctuation, so utterances are split by pauses only.
-
Run cut-retakes, optionally guided by the script you read from:
Terminal window npx @mathrunet/rereel cut-retakes \--input raw/narration_take1.wav \--asr-json raw/narration_take1.json \--script script.md \--target-sec 45 \--out work/cuts.jsonWith
--script, the last take of each script sentence wins. Without it, an utterance is dropped when the next one restarts it.--target-secstretches or tightens the gaps between segments (never the speech) toward the target length. -
Review what was dropped:
Terminal window jq -c '.dropped[] | {reason, srcStartSec, srcEndSec, text}' work/cuts.jsonjq '{sourceDurationSec, keptDurationSec, removedSec, n: (.segments | length)}' work/cuts.json -
Write the segments into
mix_plan.json.pathis resolved relative to the mix plan’s directory when you freeze:Terminal window jq --arg path ../raw/narration_take1.wav '{duration_sec: .keptDurationSec,narration: [.segments[] | {id, path: $path,start_sec: .timelineStartSec, src_start_sec: .srcStartSec, duration_sec: .durationSec,fade_in_sec: .fadeInSec, fade_out_sec: .fadeOutSec} + (if .text then {text} else {} end)],speech: .speechIntervals}' work/cuts.json > work/mix_plan.jsonMerge in your
bgm,sfxandaudiosettings, then freeze (or re-freeze) so the raw take is locked:Terminal window npx @mathrunet/rereel freeze reels/ep01 --props work/props.json --mix-plan work/mix_plan.json \--template-source local --template-path ../../remotion
Tuning flags
Section titled “Tuning flags”| Flag | Default | Effect |
|---|---|---|
--silence-db |
-40 |
silencedetect noise floor (waveform mode) |
--min-silence-sec |
0.45 |
minimum silence to cut, and the pause that splits utterances in transcript mode |
--keep-gap-sec |
0.14 |
gap between kept segments |
--target-sec |
— | fit gaps toward this total length |
--pad-edge-sec |
0.05 |
padding around each kept range (not listed in --help) |
--fade-sec |
0.015 |
micro-fade at each boundary (not listed in --help) |
The input can be audio or video, and it is positional too: rereel cut-retakes raw/take1.wav works. Fine-tune individual segments afterwards with patch trim-segment.