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 of 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 — SCTE-35 markers.
  • Video from Decklink capture cards — SCTE-104 markers.

It can be summed up in a table below:

Stream protocol Ad insertion marker
MPEG-TS SCTE-35
HLS SCTE-35, AWS
SDI SCTE-104

Usage example: 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's requested manifest.

Converting ad insertion markers with Flussonic

Flussonic can convert ad insertion markers that come with an input stream into another format and pass them to 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
  • from MPEG-TS SCTE-35 — to SDI SCTE-104 (available from version 21.04 of Flussonic)

For incoming MPEG-TS streams with SCTE-35 markers you can enable Flussonic to convert markers to AWS or SCTE-35 when a stream is accessed over HLS and to SCTE-104 in case stream is sent via SDI. Then, when the stream is accessed via HLS or SDI, it will contain markers in the specified format (AWS, SCTE-35 or SCTE-104).

For MPEG-TS output, markers do not need to be converted to SCTE-35. They are transmitted automatically if 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 respectively
  • from HLS cue markers, SCTE-35, or AWS — to MPEG-TS SCTE-35

Depending on the ad marker standards of incoming HLS streams (SCTE-35 or AWS), markers can further be converted to SCTE-35 or AWS for output streams accessed via HLS. Accessing the 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:

  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).
  1. Add the variable by typing these lines:
    [Service]
    Environment=STREAMER_VANC_OFF=true
Press `Ctrl-X`, then `Y` to save and exit.
  1. Restart Flussonic:
    service flussonic restart

Setting up conversion of ad insertion markers

To set up ad markers convertion:

  • Enable reading of ad insertion markers from the input stream
  • Specify the desired format of the markers for the output stream.

This can be done by editing the input stream settings.

Reading markers from the input stream

To enable markers processing add one of the options to the streams's URL:

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

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

To read or stop reading SCTE-104 markers from SDI streams add or delete the STREAMER_VANC_OFF environmental variable.

Example

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

That way 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 this option for the input MPEG-TS stream (scte35=true).

SCTE-104 ad insertion markers from SDI streams will be passed to output MPEG-TS and HLS automatically. To read or stop reading SCTE-104 markers from SDI streams, add or delete the STREAMER_VANC_OFF=true environmental variable.

To enable markers conversion add hls_scte35 to the input stream settings.

Syntax:

hls_scte35 aws|scte35|false;

where:

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

Example

hls_scte35 scte35;

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

hls_scte35 is used specifically for HLS output.

Two-part example

In this example we will: 1. Read SСTE-35 markers from MPEG-TS 2. Convert them to HLS AWS markers to use in the output HLS stream.

Reading MPEG-TS SСTE-35 markers (scte35=true), transform them into AWS format for playing the stream 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 AWS ad markers.

Let's access the resulting stream via HLS locally, read the markers from it and specify the option to convert it to 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 raises the 'scte35' event that belongs to the standard log level. The logs in /var/log/flussonic/flussonic.log will show 'mpegts_scte35' messages.

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


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

An alternative way of detecting the cue markers in the HLS stream is to look at this HLS manifest. It is less convenient and you will also need to wait for them to appear in real time playback.

Note

MPTS SCTE-35 to SDI SCTE-104 conversion is available from version 21.04 of Flussonic. Update your version of Flussonic to use this feature.