Ad insertion monitoring

Ad insertion monitoring

"Nothing except the mint can make money without advertising."

Thomas Babington Macaulay, British historian, essayist, and politician


Commercials, or ads, are an integral part of TV broadcasting. Businesses use them to promote their products and services, and the media make money from them.

Selling the airtime is a major, or sometimes even the only, source of income for TV channels. For example, NBC made 70 million US dollars showing the last episode of "Friends" in 2004: each 30-second ad spot cost two million US dollars. These were record receipts and a record price for an entertainment show. A one-minute ad spot during the 2018 World Cup match broadcasts on Russia's Channel One and Russia-1 cost 7.5 million rubles. But the absolute record is considered to belong to the ad spots during Superbowl, the deciding championship game of the US National Football League (NFL): in 2021, an ad spot during Superbowl cost about 5.5 million US dollars.

As you can see, those are considerable amounts, and they place great responsibility on the ad providers. The technical implementation and the process quality of ad insertion need to be monitored closely.

In this article, we will look at how ad insertion into the transport stream and HLS or MPEG-DASH adaptive broadcasting streams is implemented and understand how ad providers who sell airtime can avoid disputes and court battles with their customers.

SCTE-35 markers are commonly used to allocate airtime for ads in TV broadcasting. A special piece of equipment called a splicer inserts ads into the stream, guided by these markers. The splicer continuously accesses the FTP server requesting the latest insertion schedule and pre-produced ad files. When the schedule gets updated, the splicer checks the list of the stored media files against the ones planned for insertion and downloads any missing files from the FTP server. The SCTE-35 markers in the incoming transport stream denote the start and end positions of an ad insert.

Many problems can arise when streaming ads. The starting point is the initial injection of SCTE-35 markers into the stream. At this point, airtime needs to be allocated precisely for the ads in the stream and the required markers added accordingly. Some packets in the transport stream can be lost, therefore the standard provides for repetition of markers.

The syntax for applying the SCTE-35 markers is called splice_info_section(). It signals one of six possible commands. The Splice_schedule() and Splice_insert() commands are used to provide information about the upcoming ad insertion. There are also a number of auxiliary commands such as: Splice_null(), Bandwidth reservation(), Time_signal(), Private_command(). However, the splice_insert() and time_signal() commands are the functions mainly used for inserting ads.

  • The Splice_null() command does not transmit any data and is used to check for responses from the receiver devices. In addition, a periodic insertion of this command makes it possible to avoid activating TR101290 PID_error triggers.
  • The Bandwidth reservation() command requests additional bandwidth from the compression system to be used for transmitting an elementary PID stream with SCTE-35 messages.
  • The Time_signal() command transmits the precise timestamps that the receiver devices use to synchronize their operation with the sender devices.
  • The Private_command() can be used to transmit other types of data not mentioned in the SCTE-104/35 specifications.


Consider splice_insert(), one of the main commands for a SCTE-35 marker in the transport stream:



The out_of_network_indicator element is worth noting here. A value of 1 marks the beginning of an ad insert and a value of 0 marks the end of it. These elements are also known as cue-out (switching from the main stream to the ad insert) and cue-in (switching back to the main stream). We will explore them in detail later using an example.

Problems can also arise during direct ad insertion itself as there are quite a few nuances to this process that need to be considered.
Here are some examples:

  • The splicer must insert the ad precisely at the time specified in the SCTE-35 marker and not one frame earlier or later
  • The ad insert must not differ from the main stream in its structure (such as codec/bitrate/GOP/volume etc.)
  • The ad insert must start strictly from the I frame, otherwise the first GOP of the insert will be corrupted.

Ad insertion monitoring in IPTV

Given the above nuances, multiplied by the number of different regions where local ads are served, we might ask ourselves: how can we keep track of the process quality?

Let us consider ad insertion using an example of a real stream in the Boro monitoring system.



Ad insertion schedule


You can see three markers in the diagram that announce the insertion of an ad. Then the ad insert itself starts, and stream thumbnails are captured more often. Let us explore in more detail what happens in the stream at those moments.



Boro event log


1) SCTE-35 marker from TS stream (splice_insert command) 2021-07-09 15:52:00 +0700 {"source":"TS","data":{"program":1100,"pid":1015,"pts_adjustment":0,"command_type":"splice_insert","event_id":"1073743534","auto_return":true,"duration":120,"out_of_network_indicator":true,"pts_time":"25:40:54.394","unique_program_id":"1"}}

The first marker, "out_of_network_indicator:true”, indicates that an ad should start ("true" means 1, or cue-out, i.e. switching to the ad insert) at the precisely specified time, "pts_time":"25:40:54.394”.

“auto_return":true indicates that a cue-in (switching back from the ad insert) should happen automatically after 120 seconds ("duration":120”), 

"program":1100 specifies the program, "pid":1015 specifies the PID for entering the markers.

The second and third markers contain exactly the same information and follow at 2-second intervals. This duplication is done in case packet loss occurs in the stream.

2) SCTE-35 ad insert 2021-07-09 15:52:08 +0700 {"action":"start","type":"scte35","params {"program":1100,"pid":1015,"pts_adjustment":0,"command_type":"splice_insert","event_id":"1073743534","auto_return":true,"duration":120,"out_of_network_indicator":true,"pts_time":"25:40:54.394","unique_program_id":"1"}} SCTE-35 marker from TS stream (splice_insert command)2021-07-09 3:52:04 PM +0700

Then the ad insert itself follows immediately, based on the received markers:"action":"start".

3) SCTE-35 ad insert 2021-07-09 3:54:07 PM +0700 {"action":"stop","type":"scte35","params":{"program":1100,"pid":1015,"pts_adjustment":8331695488,"command_type":"splice_insert","event_id":"1073743534","auto_return":true,"duration":120,"out_of_network_indicator":false,"pts_time":"25:40:54.394","unique_program_id":"1"}}

After 120 seconds, the ad insert ends: "out_of_network_indicator":false / "action":"stop".

In the above example, there were no problems during ad insertion. However, if a marker contains errors, the monitoring system performs a CRC integrity check. Any mismatch is reported, and the details are output to the error log for further analysis. In addition, users can generate an error report for submission to the responsible parties.

The following types of errors are possible:

  • Binary data read error in the transport stream or the HLS tag. The incorrect values that caused the error are passed in the parameters
  • CRC32 check error when reading binary data in the transport stream or the HLS tag
  • Mismatch between the tag's binary data and the HLS tag data of the playlist. The details are passed in the parameters as two values in the tag_<data> and binary_<data> format.

Ad insertion monitoring in OTT

ОТТ broadcasting has created new opportunities for ad insertion but also brought new challenges.

On the one hand, ads have become personalized because each device establishes an individual session, making it possible to show the viewer something that they are potentially interested in. In addition, ОТТ broadcasting does not require that the ad insert match the main stream because the device decodes each ОТТ broadcast chunk separately, which simplifies ad splicing.

On the other hand, SCTE-35 markers are not limited to the transport stream—they can also be included in the playlist. This means that the markers can be duplicated, which is not a problem in principle but neither can it be called a correct stream configuration. The playlist markers can also be lost—in this case not because of packet loss, but because of something else, e.g. equipment failing to write the marker to the playlist during an update.

Boro monitors the following events that affect broadcasting.

SCTE-35 Ad Insert: triggered when the probe detects the beginning of an ad insert (based on the information from the received SCTE-35 markers). This state is dropped when the probe detects the end of the ad insert. The Ad Insert event serves as the basis for several other events that signal problems with ad insertion.

Ad Insert Exceeds Specified Duration: triggered when the duration of an ad insert exceeds the specified value. The duration is counted from the moment when the probe detects the beginning of the ad insert based on the "Ad Insert" event. 

Error Recognizing SCTE-35 Markers: triggered when an error occurs in recognizing the ad insertion markers. The error details are returned in the message.

SCTE-35 Ad Insert Missing: triggered when the probe does not detect the beginning of an ad insert (based on the information from the received SCTE-35 markers) within the specified time period. This state is dropped when the probe detects the beginning of the ad insert. The trigger is implemented based on the SCTE-35 "Ad Insert" event.

SCTE-35 Markers Not Found In Playlist: triggered when the probe does not find any insertion markers in the playlist within the specified time period. The trigger is implemented based on the "SCTE-35 Marker From OTT Playlist" event. This event can be useful in a situation when we are certain that an ad insert should start within a certain time interval, but the SCTE-35 markers are missing from the playlist for some reason, and ad insertion does not happen. In this case, the loss of the markers in the playlist needs troubleshooting.




Ad insertion monitoring is not easy for many reasons but can be done using the right tools.

Elecard Boro logs every insertion marker found in the stream or playlist. Coupled with the ability to start recording on receiving a marker and capture stream thumbnails, this makes it possible to analyze the process in detail. A marker can be checked by Boro for integrity and decodability, while the triggers for a missing or overly long ad insert help detect problems in your ad insertion system in a timely manner.


Try Elecard Boro service



Vadim Blinov 

Product Manager of Elecard CodecWorks since 2016. He has 5 years of experience in the video encoding sphere.


November 2, 2021