Skip to main content

Split screen and four-camera multiview

Use shared fixtures and setup, then choose one complete configuration below. Each camera is decoded and scaled to a 320×180 software frame before xstack composes it. Only camera A's audio is selected; the other cameras' audio does not reach the output.

Configurationxstack gridExpected output
split-screen.toml2x1Red left, blue right; 640×180
multiview.toml2x2Red/blue top row, green/yellow bottom; 640×360

Connect the SRT receiver for either configuration. Both outputs are H.264 with the uninterrupted 440 Hz AAC program track. Input order follows the node's source_ids. Equal tile dimensions are established by the preceding transcoders. These examples use grid.

For live feeds, normalize dimensions and frame rates and check source timing. All configured inputs are required. Inspect each decoder, the view compositor, and the output encoder if the sink waits. See compositing for timing and frame format details.

Complete configuration​

Download split-screen.toml.

toml
# Vindral Bridge Packager example
# Two cameras side by side, sent over SRT.

version = "3"

[[sources]]
id = "camera-a"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-a.mp4" }

[[transcoders]]
id = "decode-a"
source_ids = ["camera-a"]
device = "cpu"

[[transcoders.tracks]]
id = "a-video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "a-raw"
codec = "wrapped_avframe"
format = "yuv420p"
size = { width = 320, height = 180 }

[[sources]]
id = "camera-b"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-b.mp4" }

[[transcoders]]
id = "decode-b"
source_ids = ["camera-b"]
device = "cpu"

[[transcoders.tracks]]
id = "b-video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "b-raw"
codec = "wrapped_avframe"
format = "yuv420p"
size = { width = 320, height = 180 }

[[compositors]]
id = "view"

[[compositors.video.sources]]
id = "frame-a"
source_id = "decode-a"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[compositors.video.sources]]
id = "frame-b"
source_id = "decode-b"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[compositors.video.nodes]]
id = "layout"
type = "xstack"
source_ids = ["frame-a", "frame-b"]
grid = "2x1"

[[compositors.passthrough.sources]]
id = "program-audio"
source_id = "camera-a"
track_selector = { type = "track-kind", kind = "audio", is_required = true }

[[transcoders]]
id = "output"
source_ids = ["view"]
device = "cpu"

[[transcoders.tracks]]
id = "video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "video-output"
codec = "h264"
encoder_name = "libx264"
bit_rate = 1_000_000
gop_size_ms = 1000
max_b_frames = 0
format = "yuv420p"
size = { width = 640, height = 180 }

[[transcoders.tracks]]
id = "audio"
type = "audio"
passthrough = true
track_selector = { type = "track-kind", kind = "audio", is_required = true }

[[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" }

Download multiview.toml.

toml
# Vindral Bridge Packager example
# Four cameras in a two-by-two multiview, sent over SRT.

version = "3"

[[sources]]
id = "camera-a"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-a.mp4" }

[[transcoders]]
id = "decode-a"
source_ids = ["camera-a"]
device = "cpu"

[[transcoders.tracks]]
id = "a-video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "a-raw"
codec = "wrapped_avframe"
format = "yuv420p"
size = { width = 320, height = 180 }

[[sources]]
id = "camera-b"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-b.mp4" }

[[transcoders]]
id = "decode-b"
source_ids = ["camera-b"]
device = "cpu"

[[transcoders.tracks]]
id = "b-video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "b-raw"
codec = "wrapped_avframe"
format = "yuv420p"
size = { width = 320, height = 180 }

[[sources]]
id = "camera-c"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-c.mp4" }

[[transcoders]]
id = "decode-c"
source_ids = ["camera-c"]
device = "cpu"

[[transcoders.tracks]]
id = "c-video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "c-raw"
codec = "wrapped_avframe"
format = "yuv420p"
size = { width = 320, height = 180 }

[[sources]]
id = "camera-d"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/camera-d.mp4" }

[[transcoders]]
id = "decode-d"
source_ids = ["camera-d"]
device = "cpu"

[[transcoders.tracks]]
id = "d-video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "d-raw"
codec = "wrapped_avframe"
format = "yuv420p"
size = { width = 320, height = 180 }

[[compositors]]
id = "view"

[[compositors.video.sources]]
id = "frame-a"
source_id = "decode-a"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[compositors.video.sources]]
id = "frame-b"
source_id = "decode-b"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[compositors.video.sources]]
id = "frame-c"
source_id = "decode-c"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[compositors.video.sources]]
id = "frame-d"
source_id = "decode-d"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[compositors.video.nodes]]
id = "layout"
type = "xstack"
source_ids = ["frame-a", "frame-b", "frame-c", "frame-d"]
grid = "2x2"

[[compositors.passthrough.sources]]
id = "program-audio"
source_id = "camera-a"
track_selector = { type = "track-kind", kind = "audio", is_required = true }

[[transcoders]]
id = "output"
source_ids = ["view"]
device = "cpu"

[[transcoders.tracks]]
id = "video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }

[[transcoders.tracks.renditions]]
id = "video-output"
codec = "h264"
encoder_name = "libx264"
bit_rate = 1_000_000
gop_size_ms = 1000
max_b_frames = 0
format = "yuv420p"
size = { width = 640, height = 360 }

[[transcoders.tracks]]
id = "audio"
type = "audio"
passthrough = true
track_selector = { type = "track-kind", kind = "audio", is_required = true }

[[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" }