Skip to content

Ad Insertion Markers

The dynamic ad insertion (DAI) technique is used for adding commercials into linear live streams, such as TV broadcasts. A regional TV provider can, by using DAI, embed "local" advertising into a broadcast.

The dynamic ad insertion method uses ad insertion markers to prepare a stream for ad insertion. Markers are stream's metadata that signals about the ad insertion event. This event means that you can embed a commercial of a certain duration in a certain place in a video stream. This place (a cue splice point) in a stream allows smooth switching to another stream (such as a commercial) and back to the main video.

Ad insertion markers are created according to various standards, the most popular standard is SCTE-35. Technically, they are tags in a client manifest, that is why markers must be added for each video transmission protocol (adaptive sreaming). Flussonic can do that.

Flussonic works with markers in the SCTE-35, SCTE-104, and AWS formats and recognizes the metadata about the splice_insert events.

The following marker formats are read from streams of different types:

  • HLS — markers in formats: SCTE-35, AWS (learn more in AWS Documentation), or simple cue-in and cue-out markers.
  • MPEG-TS — markers in formats: SCTE-35.
  • Video from Decklink capture cards — SCTE-104 markers.

Use case: You need to read the SCTE-35 markers in a transport stream and convert them to a format suitable for broadcasting via HLS. Flussonic can detect markers in the ingested stream, convert them to a specified format, and automatically add them to a client manifest.

Converting ad insertion markers with Flussonic

Flussonic can convert and pass ad insertion markers that come with an input stream into another format for usage in the output stream.

Markers from MPEG-TS input streams

  • from MPEG-TS SCTE-35 — to MPEG-TS SCTE-35
  • from MPEG-TS SCTE-35 — to HLS AWS
  • from MPEG-TS SCTE-35 — to HLS SCTE-35

For incoming MPEG-TS streams, which come with markers in SCTE-35, you can specify that Flussonic should convert markers to AWS or SCTE-35 when a stream is accessed over HLS. Then, when the stream is accessed via HLS, it will contain markers in the specified format (AWS or SCTE-35).

For output to MPEG-TS, markers do not need to be converted to SCTE-35, they are transmitted automatically if they are received from the input MPEG-TS stream.

Markers from HLS input streams

  • from HLS cue markers, SCTE-35, or AWS — to HLS AWS or HLS SCTE-35
  • from HLS cue markers, SCTE-35, or AWS — to MPEG-TS SCTE-35

For incoming HLS streams, their markers can be converted to SCTE-35 or AWS for output streams accessed via HLS. For accessing this stream via MPEG-TS, markers can be converted to SCTE-35.

  • from VBI SCTE-104 — to MPEG-TS SCTE-35 or HLS SCTE-35

Flussonic reads SCTE-104 markers in the VBI format from Decklink capture cards. The reading takes place by default. To turn off the reading, use the STREAMER_VANC_OFF=true environmental variable.

Markers are passed automatically as SCTE-35 to MPEG-TS and HLS output streams, no conversion settings needed.

To stop reading VBI SCTE-104 markers, add the variable:

  1. Edit Flussonic service unit file (/lib/systemd/system/flussonic.service) — you can use the systemd's override mechanism.

    systemctl edit flussonic

    This command opens a text editor (nano by default). 2. Add these lines:

    [Service] Environment=STREAMER_VANC_OFF=true Press Ctrl-X, then Y to save and exit. 3. Restart Flussonic:

    service flussonic restart

Setting up conversion of ad insertion markers

To set up ad markers convertion:

  • Enable the reading of ad insertion markers from the input stream
  • Specify which format of the markers you want to have in the output stream.

This can be done by editing the input stream settings.

Reading markers in the input stream

To turn on processing of markers, add one of the options to the streams's URL:

  • scte35=true (for MPEG-TS input) — turns on the processing of SСTE-35 markers in an MPEG-TS input stream.

  • ad=true (for HLS input) — turns on the processing of ad markers in an HLS input stream (simple cue markers and AWS markers are supported).

To read SCTE-104 markers from SDI streams, edit the STREAMER_VANC_OFF=on environmental variable.

Example

url tshttp://FLUSSONIC-IP/STREAM_NAME scte35=true;

Flussonic will read SСTE-35 markers from the input MPEG-TS stream.

Conversion of markers

The next step is to specify the format of markers for output HLS streams.

Notes.

SСTE-35 markers will be passed to output MPEG-TS automatically if you enable them in input MPEG-TS (scte35=true).

Ad insertion markers in SCTE-104 from SDI streams will be passed to output MPEG-TS and HLS automatically if you have enabled the reading of markers in the STREAMER_VANC_OFF environmental variable.

To convert markers, add the directive hls_scte35 into the input stream settings.

Syntax:

hls_scte35 aws|scte35|false;

where:

  • aws — ad markers in the AWS format for HLS output
  • scte35 — ad markers in the SСTE-35 format for HLS output
  • false — do not include markers into the output stream.

Example

hls_scte35 scte35;

Flussonic will add markers in the SСTE-35 format to the output HLS stream.

The directive hls_scte35 is used only for HLS output.

Two-part example

In this example we: 1. Get SСTE-35 markers from MPEG-TS 2. Convert them to HLS AWS markers for use in output HLS streams.

Getting MPEG-TS SСTE-35 markers (scte35=true), preparing markers in AWS for this stream for playing via HLS (hls_scte35 aws):


stream STREAM_NAME {
    url tshttp://STREAMER:80/INPUTSTREAM/mpegts scte35=true;
    hls_scte35 aws;
}

Now when you access this stream via HLS, it will contain ad markers in the AWS format.

Let's access the resulting local stream via HLS, read markers in it and specify the possibility to get these markers in the SCTE-35 format when playing this stream via HLS:


stream STREAM_NAME_HLS {
    url hls://localhost/STREAM_NAME/mono.m3u8 ad=true;
    hls_scte35 scte35;
}

Checking that a stream has SCTE-35 markers

If you want to make sure the output stream contains SСTE-35 markers, check the Flussonic log. Flussonic throws the event 'scte35', it belongs to the standard log level. The logs in /var/log/flussonic/flussonic.log will show 'mpegts_scte35' messages.

To subscribe for the event 'scte35', add these lines to the configuration:


notify events {
  sink log://log/example.log;
  only event=scte35;
}

An alternative way is looking for markers in the HLS manifest but this is less convenient and you'll need to wait for markers to appear in real time.