In SDI, SCTE-104 messages travel as VANC packets with DID 0x41 and SDID 0x07, usually on line 12 or 13. The SDK parses received packets into XML and builds packets from XML on output. For an introduction, see About SCTE-35 and SCTE-104.
Receiving
Enable ANC capture on the input (see Configuring SDI devices):
| Device | Setting | Result |
|---|---|---|
| Blackmagic Design | vanc.capture_anc=true |
SCTE-104 XML and the raw packet in ANC.Line.N. Lines 12 and 13 are always scanned. |
| AJA | capture_vanc=true |
SCTE-104 XML when the line carries only this packet, and ANC.Line.N
|
| Bluefish444 | always on |
SCTE-104 XML when the line carries only this packet, and ANC.Line.N
|
| DELTACAST | always on | Raw packet in ANC.Line.N only |
MFLiveClass live = new MFLiveClass();
live.PropsSet("vanc.capture_anc", "true");
live.DeviceSet(eMFDeviceType.eMFDT_Video, deviceIndex, "");
while (running)
{
live.SourceFrameGet(-1, out MFFrame frame, "");
frame.MFStrGet("SCTE-104", out string message);
if (!string.IsNullOrEmpty(message))
Console.WriteLine(message);
Marshal.ReleaseComObject(frame);
}In MPlatform, set object::vanc.capture_anc on MLive and read the frame in OnFrameSafe.
Received XML
The root element is multiple_operation_message or single_operation_message. Besides the fields of the message, the XML contains the sizes read from the packet (messageSize, num_ops, data_length). A splice request looks like this:
<multiple_operation_message>
<messageSize>30</messageSize>
<protocol_version>0</protocol_version>
<AS_index>0</AS_index>
<message_number>214</message_number>
<DPI_PID_index>0</DPI_PID_index>
<SCTE35_protocol_version>0</SCTE35_protocol_version>
<timestamp>
<time_type>0</time_type>
</timestamp>
<num_ops>1</num_ops>
<ops>
<op>
<opID>257</opID>
<data_length>14</data_length>
<data>
<splice_request_data>
<splice_insert_type>1</splice_insert_type>
<splice_event_id>214</splice_event_id>
<unique_program_id>135</unique_program_id>
<pre_roll_time>4000</pre_roll_time>
<break_duration>300</break_duration>
<avail_num>0</avail_num>
<avails_expected>0</avails_expected>
<auto_return_flag>1</auto_return_flag>
</splice_request_data>
</data>
</op>
</ops>
</multiple_operation_message>All fields are explained in SCTE-104 XML reference: multiple operation messages.
Things to know
-
One message per frame in the XML. If several SCTE-104 packets arrive on one frame,
SCTE-104holds the last one. All packets are inANC.Line.N. -
Messages split over several packets are not supported. Such packets stay in
ANC.Line.Nonly. -
Packets that cannot be parsed are put into
SCTE-104-invalidon Blackmagic inputs, as the packet XML. -
Operations that the parser does not know appear with their
opIDanddata_lengthand an emptydata.
Sending
Blackmagic and AJA renderers build the SCTE-104 packet from XML. Put the message on a frame with the key SCTE-104; it is sent with that frame only. The root element must be SCTE104; its line attribute is the line for the packet (12 if not set):
<SCTE104 line="12">
<multiple_operation_message>
<protocol_version>0</protocol_version>
<AS_index>0</AS_index>
<message_number>1</message_number>
<DPI_PID_index>0</DPI_PID_index>
<SCTE35_protocol_version>0</SCTE35_protocol_version>
<timestamp>
<time_type>0</time_type>
</timestamp>
<ops>
<op>
<opID>257</opID>
<data>
<splice_request_data>
<splice_insert_type>1</splice_insert_type>
<splice_event_id>1001</splice_event_id>
<unique_program_id>1</unique_program_id>
<pre_roll_time>4000</pre_roll_time>
<break_duration>300</break_duration>
<avail_num>0</avail_num>
<avails_expected>0</avails_expected>
<auto_return_flag>1</auto_return_flag>
</splice_request_data>
</data>
</op>
</ops>
</multiple_operation_message>
</SCTE104>This message asks for a 30-second break that starts 4 seconds after the frame, with an automatic return.
MFormats
MFRendererClass renderer = new MFRendererClass();
renderer.DeviceSet(eMFDeviceType.eMFDT_Video, deviceIndex, "");
reader.SourceFrameGet(-1, out MFFrame frame, "");
if (sendCueNow)
frame.MFStrSet("SCTE-104", scte104Xml);
renderer.ReceiverFramePut(frame, -1, "");
Marshal.ReleaseComObject(frame);MPlatform
m_objFile.PropsSet("object::on_frame.sync", "true");
m_objFile.PropsSet("object::on_frame.data", "true");
m_objFile.OnFrameSafe += (string channelId, object pFrame) =>
{
if (sendCueNow)
{
((IMFFrame)pFrame).MFStrSet("SCTE-104", scte104Xml);
sendCueNow = false;
}
Marshal.ReleaseComObject(pFrame);
};The file object is connected to an MRenderer with a Blackmagic or AJA device.
Things to know
- Use
multiple_operation_messagefor cues. Single operation messages are the request/response messages between automation and injector (see single operation messages). - Numbers are decimal; hexadecimal values with the
0xprefix are accepted too. - For an operation that you cannot describe in XML, put its payload as hexadecimal text directly into
<data>, for example<data>0001020304</data>. The SDK adds the opID and the length. - The Blackmagic renderer needs a 10-bit YUV card format and switches to it when needed.
- If the XML cannot be converted (for example, the
SCTE104root is missing), the message is not sent.
Passing SCTE-104 through
The XML received from an input cannot be sent as it is: it has no SCTE104 root, and some operations use other element names on input than on output (see the reference). To pass SCTE-104 from an SDI input to an SDI output unchanged, pass the raw packet instead: capture with ANC enabled and output ANC.Line.N (on by default for Blackmagic, output.anc_packets=true for Bluefish444, always on DELTACAST; a DELTACAST output does not send packets captured by other vendors' inputs, see Configuring SDI devices). The received SCTE-104 string does not cause a second packet.
If you change a received message and send it with your own SCTE-104 XML, remove the original packet from ANC.Line.N, or the output carries both.
Samples
The SDK includes Samples\MFormats\C#\Sample ANC (SCTE-104) Receive and Sample ANC (SCTE-104) Transmit. The Commands folder of the transmit sample has a ready XML file for every supported operation.
Still have questions?
Tell us what didn’t work or what you’d like clarified.