Skip to content

Non-destructive cutting

rereel cut-retakes analyzes a raw narration take (audio or video) and outputs a list of segments to keep. It never writes, splices or re-encodes the input. Playback speed never changes (tempoRatio is always 1.0). Shortening happens only by dropping material and tightening the gaps.

The mode depends on whether a word-timestamp transcript is supplied.

FFmpeg silencedetect=noise=<silence-db>dB:d=<min-silence-sec> finds silent intervals (defaults: -40 dB, 0.45 s). Everything between the silences becomes a kept range, and each silence is reported as a dropped entry with reason: "silence".

The transcript’s words are grouped into utterances. A new utterance starts when the gap to the previous word is at least --min-silence-sec, or when the previous text ends in sentence punctuation (。!?!?.). Segments without words count as single words. In this mode silencedetect is not run: the transcript timings define the kept ranges.

Utterances are then pruned:

  • Fillers. An utterance that normalizes (NFKC, lowercase, punctuation stripped) to exactly a filler token is dropped with reason: "filler". The built-in list is あー えー えーと えっと あのー うーん まあ そのー um uh er erm ah like. Fillers inside a longer utterance are kept.
  • Retakes, with --script. The script (Markdown or plain text, with front matter, headings and HTML comments removed) is split into sentences. Each utterance is matched to its best sentence by bigram Dice similarity, or by a prefix match that catches aborted starts, with a threshold of 0.35. When several utterances match the same sentence, only the last take is kept and earlier ones are dropped with reason: "retake".
  • Retakes, without a script. An utterance is dropped as a retake when the next utterance repeats its first 3–6 normalized characters and is at least as long, or when the two are ≥ 0.65 similar. In other words, the speaker restarted.
  1. Each kept range is padded by padEdgeSec (default 0.05 s) on both sides, clamped to the source, and dropped if it is shorter than 40 ms.
  2. Ranges are laid out back to back with a gap of --keep-gap-sec (default 0.14 s, a natural breath).
  3. With --target-sec, the gap is recomputed so that the total approaches the target: (target − speech) / (segments − 1), clamped between 0.05 s and keepGapSec + 15% of the source duration / (segments − 1). Speech is never stretched or compressed.
  4. Each segment gets micro-fades of fadeSec (default 0.015 s, at most ¼ of the segment) to avoid clicks.
{
"sourcePath": "raw/narration_take1.wav",
"sourceDurationSec": 58.31,
"keptDurationSec": 44.92,
"removedSec": 13.39,
"tempoRatio": 1,
"segments": [
{ "id": "seg_001", "srcStartSec": 1.45, "srcEndSec": 2.85, "durationSec": 1.4,
"timelineStartSec": 0, "timelineEndSec": 1.4, "fadeInSec": 0.015, "fadeOutSec": 0.015,
"text": "会議の最後、懸念の一行が消える。" }
],
"dropped": [
{ "srcStartSec": 0.1, "srcEndSec": 0.9, "reason": "retake", "text": "会議の最後、あ、えっと" }
],
"speechIntervals": [[0, 1.4]]
}
Field Meaning
segments[].srcStartSec / srcEndSec Range in the original file
segments[].timelineStartSec / timelineEndSec Position in the cut timeline
segments[].fadeInSec / fadeOutSec Micro-fade lengths
segments[].text Utterance text (transcript mode only)
dropped[] What was removed and why: silence, filler or retake
speechIntervals Kept segments on the new timeline, ready for mix_plan.speech

The result is printed as one JSON line, and also written pretty-printed when --out <json> is given.

The output uses camelCase. mix_plan.json narration segments use snake_case:

cut-retakes mix_plan.narration[]
id id
(the input file) path
timelineStartSec (+ your offset) start_sec
srcStartSec src_start_sec
durationSec duration_sec
fadeInSec / fadeOutSec fade_in_sec / fade_out_sec
text text
speechIntervals speech (top-level)

The cutting guide includes a script that does this conversion.