SCTE-35 and SCTE-104 are signals that mark points in a program, mostly the start and end of commercial breaks. Downstream systems use them to insert local ads, to switch programs, or to mark chapters for streaming and catch-up. The two standards carry the same information at different stages of the delivery chain:
| SCTE-104 | SCTE-35 | |
|---|---|---|
| Where | Baseband: SDI (VANC packet DID 0x41, SDID 0x07, usually line 12 or 13) and MXF (ST 436 track) | Compressed: MPEG transport streams (a separate PID), and from there HLS/DASH manifests |
| Who creates it | Playout automation | The encoder, from SCTE-104; or a splicer |
| Form | Messages with one or more operations, such as splice_request_data
|
Splice info sections with a command, such as splice_insert or time_signal, and descriptors |
A typical chain: the automation system puts SCTE-104 into the SDI signal, the encoder reads it and sends the matching SCTE-35 in the transport stream, and the ad inserter at the other end acts on the SCTE-35 cue.
What the SDK does
| Task | SCTE-104 | SCTE-35 |
|---|---|---|
| Read | From SDI inputs (Blackmagic, AJA, Bluefish444) and MXF files, as XML in the SCTE-104 frame string |
From transport streams (files and network), as XML in SCTE-35 and raw bytes in SCTE-35.PKT
|
| Events (MPlatform) |
SCTE-104 event of MFile |
SCTE-35 event of MFile and MPlaylist |
| Write | To SDI outputs (Blackmagic, AJA) from XML; as a raw ANC packet to any SDI output that sends ANC.Line.N and to MXF |
To MPEG-TS outputs (files, UDP, SRT, RTP, HLS) with embed_scte35
|
| Pass-through | SDI to SDI as raw ANC packets | TS to TS through the frames |
Details are in:
- SCTE-35 in transport streams
- SCTE-104 on SDI: receiving and sending
- SCTE-104 in MXF files
- SCTE-104 XML reference: multiple operation messages and single operation messages
SCTE data requires a license with the Closed Captions option.
Converting SCTE-104 to SCTE-35
The SDK does not convert between the two automatically: a SCTE-104 string on a frame is not written to a transport stream, and SCTE-35 is not sent to SDI. If your application is the encoder in the chain, read the SCTE-104 message and put the matching SCTE-35 XML on the frame that goes to the writer. The SCTE-104 standard defines the mapping; the most common fields are:
splice_request_data (opID 0x0101) → splice_insert
| SCTE-104 field | SCTE-35 XML | Note |
|---|---|---|
splice_insert_type 1 (start normal) |
outOfNetworkIndicator="1" |
Break starts after the pre-roll |
splice_insert_type 2 (start immediate) |
outOfNetworkIndicator="1" spliceImmediateFlag="1" |
Break starts now |
splice_insert_type 3 (end normal) |
outOfNetworkIndicator="0" |
Return to the network |
splice_insert_type 4 (end immediate) |
outOfNetworkIndicator="0" spliceImmediateFlag="1" |
|
splice_insert_type 5 (cancel) |
spliceEventCancelIndicator="1" |
Cancels the event with this ID |
splice_event_id |
spliceEventId |
|
unique_program_id |
uniqueProgramId |
|
pre_roll_time (milliseconds) |
SpliceTime ptsTime |
Splice time = PTS of the frame + pre-roll × 90 |
break_duration (tenths of a second) |
BreakDuration duration |
× 9000 (90 kHz ticks). Omit the element when 0 |
auto_return_flag |
BreakDuration autoReturn |
|
avail_num, avails_expected
|
availNum, availsExpected
|
time_signal_request_data (0x0104) and insert_segmentation_descriptor_request_data (0x010B) → time_signal with a segmentation descriptor
| SCTE-104 field | SCTE-35 XML |
|---|---|
pre-roll_time (milliseconds) |
TimeSignal/SpliceTime ptsTime |
segmentation_event_id |
segmentationEventId |
segmentation_event_cancel_indicator |
segmentationEventCancelIndicator |
duration (seconds) |
segmentationDuration (× 90000) |
segmentation_upid_type, segmentation_upid
|
SegmentationUpid segmentationUpidType and its text |
segmentation_type_id, segment_num, segments_expected
|
segmentationTypeId, segmentNum, segmentsExpected
|
Example
The following MFormats code reads a splice request from a captured SDI frame and puts an SCTE-35 splice insert on the same frame before it goes to a transport stream writer with embed_scte35='true'. It ignores the pre-roll: when SpliceTime has no ptsTime, the writer uses the PTS of the frame, so the splice point is this frame.
using System.Linq;
using System.Xml.Linq;
static string SpliceRequestToScte35(string scte104Xml)
{
XElement root = XElement.Parse(scte104Xml);
XElement request = root.Descendants("splice_request_data").FirstOrDefault();
if (request == null)
return null;
int Value(string name) => int.Parse(request.Element(name).Value);
int type = Value("splice_insert_type");
var insert = new XElement("SpliceInsert",
new XAttribute("spliceEventId", Value("splice_event_id")),
new XAttribute("spliceEventCancelIndicator", type == 5 ? 1 : 0),
new XAttribute("outOfNetworkIndicator", type == 1 || type == 2 ? 1 : 0),
new XAttribute("spliceImmediateFlag", type == 2 || type == 4 ? 1 : 0),
new XAttribute("uniqueProgramId", Value("unique_program_id")),
new XAttribute("availNum", Value("avail_num")),
new XAttribute("availsExpected", Value("avails_expected")));
// A program splice needs <Program>; the splice time is omitted for immediate splices.
// A SpliceTime without ptsTime gets the PTS of the frame from the writer.
bool immediate = type == 2 || type == 4;
insert.Add(immediate ? new XElement("Program") : new XElement("Program", new XElement("SpliceTime")));
int duration = Value("break_duration");
if (duration > 0)
insert.Add(new XElement("BreakDuration",
new XAttribute("autoReturn", Value("auto_return_flag")),
new XAttribute("duration", (long)duration * 9000)));
var section = new XElement("SpliceInfoSection",
new XAttribute("protocolVersion", 0),
new XAttribute("ptsAdjustment", 0),
new XAttribute("tier", 4095),
insert);
return section.ToString(SaveOptions.DisableFormatting);
}
// In the frame loop
live.SourceFrameGet(-1, out MFFrame frame, "");
frame.MFStrGet("SCTE-104", out string scte104);
if (!string.IsNullOrEmpty(scte104))
{
string scte35 = SpliceRequestToScte35(scte104);
if (scte35 != null)
frame.MFStrSet("SCTE-35", scte35);
}
writer.ReceiverFramePut(frame, -1, "");
Marshal.ReleaseComObject(frame);The splice point of this example is the frame that carried the SCTE-104 message. To splice at the end of the pre-roll instead, keep the cue and put it on the frame that arrives pre_roll_time milliseconds later. Downstream equipment then receives the cue without advance notice, so check that it accepts such cues.
Still have questions?
Tell us what didn’t work or what you’d like clarified.