Skip to main content

Play a file as a live SRT stream

Use a looping MP4 as a test channel or scheduled playout input. Follow the shared setup and start the complete configuration below. The file source has realtime_pacing = true; without pacing a file can be processed faster than viewers can consume it. File input loops by default.

The encoder produces 640×360 H.264 and 48 kHz stereo AAC; the srt sink sends it over SRT. Connect one receiver:

bash
ffplay 'srt://127.0.0.1:10000?mode=caller&latency=120000'

Expect a red picture and 440 Hz tone. Let it play beyond the fixture's 60 seconds to verify looping. For caller/listener roles, remote networking and encryption, see the SRT connection guide. Confirm delivery in the sink state and the receiver output. Replacing the SRT sink with a compatible RTMP or Vindral sink turns the same paced input into a test channel for those delivery paths. A playlist scheduler or automatic file-to-camera handover is outside this recipe.

Complete configuration​

Download file-to-live.toml.

toml
# Vindral Bridge Packager example
# Play a file as a live stream and send it over SRT.

version = "3"

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

[[transcoders]]
id = "encode"
source_ids = ["input"]
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"
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 = ["encode"]
wait_for_all_sources = true
protocol_options = { url = "srt://0.0.0.0:10000?mode=listener&latency=120000" }