Skip to content

Audio compilation

Rendering video in chunks with Remotion audio enabled would leave an audio seam at every chunk boundary. With audioMode: "mix_plan", rereel renders the chunks --muted and builds the whole soundtrack in one FFmpeg filter graph from mix_plan.json, so there are no chunk-boundary clicks. The soundtrack is then muxed onto the concatenated video with -c:v copy -c:a aac -b:a 192k -ar 48000 -shortest.

audioMode Video chunks Audio
mix_plan (default) --muted compiled from mix_plan.json, or derived from props if that file is missing
remotion with audio Remotion’s own audio, kept through concat
none --muted none

If mix_plan.json is missing, build derives a plan from common props fields: audio_path (with clip.* offsets), audio.bgm_path, audio.voice_path, audio.tracks[], hook.narration_path, scenes[].narration_path and dialogue[].voice_path. If none of these exist, the output has no audio.

mix_plan.json
{
"duration_sec": 45,
"audio": { "narration_lufs": -16, "bgm_lufs_under_narration": -24 },
"narration": [
{ "id": "seg_001", "path": "media/take1_8c1d02aa.wav", "start_sec": 0.0,
"src_start_sec": 1.45, "duration_sec": 1.45, "fade_in_sec": 0.015, "fade_out_sec": 0.015,
"text": "Still re-rendering the whole video?" }
],
"bgm": [{ "path": "media/lofi_0d4e1f20.mp3", "start_sec": 0, "end_sec": null, "loop": true }],
"sfx": [{ "path": "media/whoosh_77ab9e01.wav", "at_sec": 3.0, "gain_db": -3 }],
"brand": [{ "path": "media/endcard_51c0aa9e.wav", "role": "end_card", "start_sec": 42 }],
"speech": [[0.0, 1.45], [1.6, 4.2]],
"fade_out_sec": 1.0
}

duration_sec must be positive. If it is omitted, build fills it in from the video duration. All paths are resolved relative to the reel directory.

Each segment reads duration_sec seconds from src_start_sec in the source file and places it at start_sec on the timeline, with optional micro-fades. Several segments can point to the same raw take, so cutting is pure arithmetic and the WAV is never rewritten. This is the format cut-retakes produces. If duration_sec is omitted, the segment runs to the end of the timeline.

Each file is measured once with ebur128 and gained to narration_lufs, plus the segment’s gain_db.

BGM cues are normalized to bgm_lufs_in_gaps. They loop by default (loop: true) and run until end_sec, or to the end of the timeline if end_sec is null. Consecutive cues overlap by crossfade_sec and fade in and out over the same duration unless fade_in_sec/fade_out_sec are set.

During speech, the whole BGM bus is ducked by bgm_lufs_under_narration − bgm_lufs_in_gaps dB (−6 dB with the defaults), with linear ramps of duck_ramp_sec on each side. Speech intervals come from:

  1. mix_plan.speech ([[start, end], ...]), if present
  2. otherwise the narration segments’ [start_sec, start_sec + duration_sec]

Intervals closer together than max(0.8 s, 2 × duck_ramp_sec) are merged, so the music does not pump between sentences.

SFX are peak-normalized to sfx_peak_dbfs from the measured true peak, not loudness-normalized. gain_db can only lower the level (positive values are clamped to 0).

brand[] entries (e.g. role: "opening" or "end_card") are normalized to brand_parts_lufs. An end_card gets end_card_delay_sec of delay (which also skips that much of the source) and an end_card_fade_in_sec fade-in, unless delay_sec/fade_in_sec are set.

In a composite merge, chapters[] entries (dir, start_sec, src_start_sec, src_end_sec) pull each child reel’s build/stems/{narration,bgm,sfx}.wav onto the final timeline. Child BGM crossfades over crossfade_sec.

The four stem buses (narration, bgm, sfx, brand) are summed, trimmed to duration_sec, given an optional final fade_out_sec, and run through alimiter at true_peak_dbtp. Then:

  • final scope (remotion_single, composite_merge): 2-pass EBU R128 loudnorm. Pass 1 measures the integrated loudness, true peak, LRA and threshold. Pass 2 applies linear=true normalization to master_lufs (or narration_lufs when master_lufs is null) with TP = true_peak_dbtp.
  • chapter scope (remotion_chapter): no loudnorm, and the BGM keeps a crossfade_sec tail for the parent merge.

Any key in mix_plan.audio overrides these (DEFAULT_AUDIO_SETTINGS):

Key Default
narration_lufs -16.0
bgm_lufs_under_narration -22.0
bgm_lufs_in_gaps -16.0
sfx_peak_dbfs -12.0
brand_parts_lufs -16.0
crossfade_sec 0.5
master_lufs null (→ narration_lufs)
true_peak_dbtp -1.5
duck_ramp_sec 0.3
end_card_delay_sec 0.6
end_card_fade_in_sec 3.0
build/
├── stems/
│ ├── narration.wav bgm.wav sfx.wav brand.wav # 48 kHz PCM s16, one per bus
│ ├── premix.wav # before loudnorm
│ ├── filter_complex.txt # the exact filter graph
│ └── mix.json # scope, duration, speech_intervals, sha256 of stems and mix
├── mix.wav # mastered mix
└── output.mp4

The filter graph is passed as a file. FFmpeg 7.1 introduced -/filter_complex <file> and deprecated -filter_complex_script, which later releases removed. On first use, rereel reads ffmpeg -h full once and uses -/filter_complex, unless the help text lists only the legacy filter_complex_script option (FFmpeg < 7.1), in which case it falls back to -filter_complex_script.