Mix program audio and commentary
Keep the program picture and combine its audio with a separate commentary feed. Prepare the fixtures and start the recipe using the download below. Expect red 640×360 H.264 video and one stereo AAC track containing both the 440 Hz program and 660 Hz commentary tones. Connect the SRT receiver to hear the mix.
The mix compositor selects audio from each source, then sum mixes them in
source_ids order with weights [0.7, 0.3]. The first input supplies the master
timing. normalize = false applies the weights as written instead of dividing by their
sum. To change the balance while the stream runs, send new weights to the sum node, for
example {"weights":[1.0,0.0]} to drop the commentary; see
Compositor filter commands. Leave headroom and
check real program peaks for clipping; the example tones are deliberately quiet.
The compositor's passthrough section carries the original program video alongside
the mixed audio with compositor timing.
Both inputs are required. Align sample rates and channels and check synchronization
when replacing files with live sources. Static amix weights are configuration values.
For API-controlled levels, use live audio levels.
Complete configuration
# Vindral Bridge Packager example
# Mix program audio with a commentary track and send the result over SRT.
version = "3"
[[sources]]
id = "program"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-a.mp4" }
[[sources]]
id = "commentary"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/commentary.m4a" }
[[compositors]]
id = "mix"
[[compositors.audio.sources]]
id = "program-audio"
source_id = "program"
track_selector = { type = "track-kind", kind = "audio", is_required = true }
[[compositors.audio.sources]]
id = "commentary-audio"
source_id = "commentary"
track_selector = { type = "track-kind", kind = "audio", is_required = true }
[[compositors.audio.nodes]]
id = "sum"
type = "amix"
source_ids = ["program-audio", "commentary-audio"]
weights = [0.7, 0.3]
normalize = false
[[compositors.passthrough.sources]]
id = "program-video"
source_id = "program"
track_selector = { type = "track-kind", kind = "video", is_required = true }
[[transcoders]]
id = "output"
source_ids = ["mix"]
device = "cpu"
[[transcoders.tracks]]
id = "video"
type = "video"
passthrough = true
track_selector = { type = "track-kind", kind = "video", is_required = true }
[[transcoders.tracks]]
id = "audio"
type = "audio"
track_selector = { type = "track-kind", kind = "audio", is_required = true }
[[transcoders.tracks.renditions]]
id = "audio-output"
codec = "aac"
sample_rate = 48_000
channels = 2
bit_rate = 128_000
[[sinks]]
id = "srt"
sink_type = "srt"
source_ids = ["output"]
wait_for_all_sources = true
protocol_options = { url = "srt://0.0.0.0:10000?mode=listener&latency=120000" }