Skip to content

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.

Terminal window
npx @mathrunet/rereel cut-retakes --input raw/narration_take1.wav --out work/cuts.json

This 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)”
  1. Produce a word-timestamp transcript. --asr-json expects 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, text and words[].word, start, end are read. words is 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)
  2. 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.json

    With --script, the last take of each script sentence wins. Without it, an utterance is dropped when the next one restarts it. --target-sec stretches or tightens the gaps between segments (never the speech) toward the target length.

  3. Review what was dropped:

    Terminal window
    jq -c '.dropped[] | {reason, srcStartSec, srcEndSec, text}' work/cuts.json
    jq '{sourceDurationSec, keptDurationSec, removedSec, n: (.segments | length)}' work/cuts.json
  4. Write the segments into mix_plan.json. path is 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.json

    Merge in your bgm, sfx and audio settings, 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
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.