Skip to main content

Mux audio from one RTMP feed with video from another

This example combines audio from one RTMP feed with video from another and sends the result to Vindral Live.

Replace YOUR_INPUT_HOST, YOUR_AUDIO_STREAM_KEY and YOUR_VIDEO_STREAM_KEY with the two RTMP inputs. Set YOUR_VINDRAL_PUBLISH_URL to the complete publish/lookup URL supplied for your Vindral channel.

Download mux-two-feeds.toml.

toml
# Vindral Bridge Packager example
# Combine the audio of one RTMP feed with the video of another and send them to Vindral Live.

version = "3"

[[sources]]
id = "feed-1"
source_type = "flv"

[sources.protocol_options.url]
type = "string"
value = "rtmp://YOUR_INPUT_HOST/live/YOUR_AUDIO_STREAM_KEY"

[[sources]]
id = "feed-2"
source_type = "flv"

[sources.protocol_options.url]
type = "string"
value = "rtmp://YOUR_INPUT_HOST/live/YOUR_VIDEO_STREAM_KEY"

# Take the audio from feed 1.
[[transcoders]]
id = "feed-1-encode"
source_ids = ["feed-1"]

[[transcoders.tracks]]
type = "audio"
id = "audio"
passthrough = true

[transcoders.tracks.track_selector]
type = "track-kind"
kind = "audio"
is_required = true

[[transcoders.tracks.renditions]]
id = "opus"
bit_rate = 128_000
codec = "opus"
sample_rate = 48_000

# Take the video from feed 2.
[[transcoders]]
id = "feed-2-encode"
source_ids = ["feed-2"]

[[transcoders.tracks]]
type = "video"
id = "video"
passthrough = true

[transcoders.tracks.track_selector]
type = "track-kind"
kind = "video"
is_required = true

[[transcoders.tracks.renditions]]
id = "jpeg"
codec = "mjpeg"
gop_size_ms = 5000
bit_rate = 1280
frame_skipping = "frame_every_5_seconds"

[[sinks]]
id = "vindral"
sink_type = "vindral_ws"
source_ids = ["feed-2-encode", "feed-1-encode"]
wait_for_all_sources = true

[sinks.protocol_options.url]
type = "string"
value = "YOUR_VINDRAL_PUBLISH_URL"