Skip to content

Injecting SCTE-35 with a Plan โ€‹

Updated

When it comes to inserting SCTE-35 markers, the encoder is usually the first thing that comes to mind. However, for testing or demos, touching the encoder is cumbersome. StreamLive has a reserved event resource called Plan, and using the SCTE35_SPLICE_INSERT type there lets you push markers straight in without an encoder.

Request Example โ€‹

Suppose you insert one 60 seconds ad break into a live channel that is currently running.

bash
cat > /tmp/plan.json <<'EOF'
{"EventName":"justinkim_ad_break_001",
 "TimingSettings":{"StartType":"IMMEDIATE"},
 "EventSettings":{"EventType":"SCTE35_SPLICE_INSERT",
                  "SpliceEventID":909001,
                  "SpliceDuration":"5400000"}}
EOF

tccli mdl CreateStreamLivePlan --region ap-seoul \
  --ChannelId 6941****5240 \
  --Plan "$(cat /tmp/plan.json)"

The moment the Plan is created, the marker enters the channel. If you look at the media playlist about 10 seconds later, here is the output example.

text
#EXT-X-CUE-OUT-CONT:ElapsedTime=8.2,Duration=60,SCTE35=/AAgAAGuKZt0AAAADwUADd7KAPCAAFJlwAAAAAAAANYfkZ8=
#EXT-X-PROGRAM-DATE-TIME:2026-09-14T06:29:22.361Z
#EXTINF:4.000, seq 40778661

After 60 seconds, #EXT-X-CUE-IN is displayed and the ad break ends.

Calculating SpliceDuration โ€‹

The unit of SpliceDuration is 90kHz ticks. Thinking in seconds is confusing.

text
tick = seconds ร— 90000
Ad BreakTick Value
15 seconds1350000
30 seconds2700000
60 seconds5400000
90 seconds8100000

Pass this value in string format.

TimingSettings โ€‹

StartTypeBehavior
IMMEDIATEExecutes immediately when the Plan is created
ABSOLUTEExecutes at the time specified in Time

IMMEDIATE fires as soon as it is created. It is confusing at first that this is not a "turn it on later" concept. If you need scheduling, use ABSOLUTE together with Time.

json
{
  "StartType": "ABSOLUTE",
  "Time": "2026-09-15T12:00:00Z"
}

Attaching a Segmentation Descriptor โ€‹

The default splice_insert alone is often sufficient, but if the ad system requires a segmentation type, specify SCTE35SegmentationDescriptor as well.

json
{
  "EventName": "justinkim_ad_break_002",
  "TimingSettings": {
    "StartType": "IMMEDIATE"
  },
  "EventSettings": {
    "EventType": "SCTE35_SPLICE_INSERT",
    "SpliceEventID": 909002,
    "SpliceDuration": "5400000",
    "SCTE35SegmentationDescriptor": [
      {
        "EventID": 909002,
        "EventCancelIndicator": 0,
        "Duration": 5400000,
        "UPIDType": 0,
        "UPID": "justinkim-ad-break-002",
        "TypeID": 52,
        "Num": 0,
        "Expected": 0,
        "SubSegmentNum": 0,
        "SubSegmentsExpected": 0
      }
    ]
  }
}

The TypeID value is the SCTE-35 segmentation_type_id.

TypeIDMeaning
48Provider Advertisement Start
49Distributor Advertisement Start
52Provider Placement Opportunity Start
53Distributor Placement Opportunity Start
54Break Start

The value put in AdTriggers and this TypeID must match each other. Choose while also looking at the AdTriggers values table.

EventType Types โ€‹

EventTypePurpose
SCTE35_SPLICE_INSERTEntering an ad break (the main subject of this document)
SCTE35_RETURN_TO_NETWORKEnding an ad break
SCTE35_TIME_SIGNALTime signal
TIMED_METADATAID3 metadata insertion
ID3_SEGMENT_TAGGINGPer-segment tagging
INPUT_SWITCHInput switching
TIMED_RECORDSegment recording

With SCTE35_SPLICE_INSERT alone, both entry and exit are handled together. When SpliceDuration ends, CUE-IN is issued automatically.

Managing Plans โ€‹

The Plan API provides create / query / delete.

bash
# List
tccli mdl DescribeStreamLivePlans --region ap-seoul --ChannelId 6941****5240

# Delete
tccli mdl DeleteStreamLivePlan --region ap-seoul \
  --ChannelId 6941****5240 --EventName justinkim_ad_break_001

A IMMEDIATE Plan executes immediately after creation. Clean up the execution history when testing is finished.

How to Verify โ€‹

The fastest way to check whether the marker was actually sent is to look at the media playlist.

bash
curl -s "https://<endpoint>/<rendition>.m3u8" | grep -E "CUE-OUT|CUE-IN"

After the marker executes, check #EXT-X-CUE-OUT-CONT; after the specified segment ends, check #EXT-X-CUE-IN. Query at intervals shorter than the playlist retention period.

Notes โ€‹

SpliceDuration is in units of 90kHz ticks. Specify 60 seconds with 60 ร— 90000 = 5400000.

Apply Plans to StreamLive channels in the RUNNING state.

SpliceEventID is a 32-bit unique value. It is safer to change the ID each time you repeat a test.

Next Steps โ€‹

Built with VitePress ยท Deployed on Tencent EdgeOne Pages