Pass SCTE-35 markers through
Receive MPEG-TS over SRT with an SCTE-35 track, re-encode the video and audio, and send MPEG-TS over SRT with the SCTE-35 track passed through. Downstream systems such as ad insertion then see the same cues as in the input.
How the markers are kept
The transcoder's third track has type = "data". A data track is never decoded: the
Packager forwards each SCTE-35 section as it arrives and keeps each cue's splice time in
step with the stream's timestamps on the output. The selector picks the track by codec,
scte_35, so other data tracks in the input, such as KLV, are left out. To pick one of
several SCTE-35 tracks, use a track-id selector with its PID; see
Track selection.
Keyframes at splice points follow the input. With
gop_alignment = "match_incoming" on the video track, the output has a keyframe wherever
the input has one. If the upstream encoder puts a keyframe at each splice point, so does
the output. The rendition's gop_size_ms is ignored with this setting, so it sets none. See GOP alignment.
MPEG-TS outputs, such as the srt sink here, carry the SCTE-35 track. Check that your
destination accepts SCTE-35 in MPEG-TS.
Run it
Save the download as config.toml and select your release image as in
Usage:
docker run --rm --name packager-scte35 \
-p 127.0.0.1:4040:4040 -p 9000:9000/udp -p 10000:10000/udp \
-v "$(pwd)/config.toml:/etc/packager/config.toml:ro" \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" start
The source listens on UDP 9000 for the encoder, and the sink listens on UDP 10000 for the receiver. Both connect as caller. To confirm that the output carries the markers, list its streams:
ffprobe -v error -show_entries stream=index,codec_name \
'srt://127.0.0.1:10000?mode=caller&latency=120000'
The list includes a scte_35 stream next to h264 and aac.
Complete configuration
Download scte35-passthrough.toml.
# Vindral Bridge Packager example
# Re-encode an SRT feed and pass its SCTE-35 markers through to the SRT output.
version = "3"
# Receive MPEG-TS with an SCTE-35 track. The encoder calls this listener.
[[sources]]
id = "contribution"
source_type = "srt"
protocol_options = { url = "srt://0.0.0.0:9000?mode=listener&latency=120000" }
[[transcoders]]
id = "encode"
source_ids = ["contribution"]
device = "cpu"
# Put a keyframe wherever the input has one, so a splice point that the
# upstream encoder marked with a keyframe keeps it in the output.
[[transcoders.tracks]]
id = "video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }
processing = { gop_alignment = "match_incoming" }
[[transcoders.tracks.renditions]]
id = "1080p"
codec = "h264"
encoder_name = "libx264"
bit_rate = 6_000_000
max_b_frames = 0
format = "yuv420p"
size = { width = 1920, height = 1080 }
[[transcoders.tracks]]
id = "audio"
type = "audio"
track_selector = { type = "track-kind", kind = "audio", is_required = true }
[[transcoders.tracks.renditions]]
id = "aac"
codec = "aac"
sample_rate = 48_000
channels = 2
bit_rate = 128_000
# A data track is passed through unchanged. The selector picks the SCTE-35
# track by codec, so other data tracks in the input are left out.
[[transcoders.tracks]]
id = "scte35"
type = "data"
track_selector = { type = "track-kind", kind = "data", codec = "scte_35" }
# Send MPEG-TS with the SCTE-35 track to the receiver, which calls this listener.
[[sinks]]
id = "srt"
sink_type = "srt"
source_ids = ["encode"]
protocol_options = { url = "srt://0.0.0.0:10000?mode=listener&latency=120000" }