Ad marks¶
Overview¶
An ad mark tells downstream equipment where an ad break starts and ends in the stream. Mcaster accepts marks at the input, carries them through the stream together with video and audio, and hands them to every output in the format that output understands. Whatever the stream goes through on the way — alignment, the transcoder, a switch to another source — the splice point at the output points at the same frame as at the input.
Marks come from the inputs:
- MPEG-TS — SCTE-35 sections on a PID with
stream_type 0x86, see Multicast and MPTS ingest; - SDI — SCTE-104 messages in VANC, see SDI ingest;
- HLS — media playlist tags
EXT-X-DATERANGEwith theSCTE35-OUT,SCTE35-IN,SCTE35-CMDattributes, andEXT-X-CUE-OUT/EXT-X-CUE-INtags.
And go out:
- to MPEG-TS — as SCTE-35 sections on their own PID;
- to SDI — as SCTE-104 messages in the VANC of the output frame;
- to HLS — as
EXT-X-DATERANGEandEXT-X-CUE-OUT/EXT-X-CUE-OUT-CONT/EXT-X-CUE-INtags; - to DASH — as
EventStreamevents in the manifest period; - to the archive — together with the segments, so an archive playlist carries the same marks the live one did.
Ad break¶
A source rarely sends a single mark per break. Announcements come first — "going to ads in 8 seconds", often repeated several times — then, sometimes, an immediate out mark, and minutes later a return mark. Mcaster assembles the marks of one event (splice_event_id) into one ad break and keeps it in mind while the break is on.
If the source sent only an announcement and no splice of its own at the moment of going out, Mcaster places the splice itself — on the frame the announced point has reached. That splice stays inside Mcaster: no extra mark leaves it in any format, and every output carries exactly the marks the source sent. If the announcement declares a return after the break duration (auto_return), Mcaster places the return the same way.
At every splice the HLS and DASH segment closes on the first key frame at or after the splice point, without waiting for its usual duration. The ad therefore starts with a new segment, and a player or a server-side ad insertion system can replace the segments of the break whole.
Forecast check. The splice point from an announcement is a forecast. Mcaster compares it with where the segment actually closed and shows the difference. The boundary falls on a key frame, so when there is no key frame at the splice point, the difference reaches up to one GOP.
Source switch. When the stream switches to a backup source, the splices that were only expected are dropped: the announcements of the old source have nothing to do with the new one. A break that has already started goes on until the return.
HLS¶
A break goes out as one EXT-X-DATERANGE range: while the break is on, with its start and SCTE35-OUT; after the return the same range gets its end, duration and SCTE35-IN. Alongside, the playlist carries EXT-X-CUE-OUT on the first segment of the break, EXT-X-CUE-OUT-CONT on the following ones and EXT-X-CUE-IN on the first segment after the break: some players and ad insertion systems read ranges, others read these tags.
At an HLS input, marks are taken from the same tags. Tags that were already in the playlist at the moment of connection count as the past and do not become marks. If the source segments carry an SCTE-35 PID of their own, the playlist tags are not used: the mark time inside the segment is more precise.
The Ads tab¶
What happens to the stream's marks is shown on the stream page, Ads tab. It refreshes by itself every two seconds.
The Now block shows:
- whether the stream is in an ad break or in program;
- the break in progress: event number, when it started, declared duration and time left;
- pending splices — announcements whose point has not come yet;
- the last forecast check: where the splice was expected, where the segment closed and how far apart they were.

The Mark history table lists the stream's marks, newest on top: time, where the record comes from — input (a source mark) or manager (a splice placed by Mcaster, or a source switch), the kind of mark, event number, splice point, declared duration and SCTE-35 segmentation types.

The history lives in the memory of the streamer running the stream and starts over when it restarts. If the stream is not running right now, the tab says so. The marks themselves are not lost: they are recorded in the archive together with the segments.
Counters¶
Accepted and lost marks at the input and output are counted by Prometheus counters: stream_input_ad_marks_total, stream_input_errors_ad_marks_dropped_total, stream_out_ad_marks_total, stream_out_errors_ad_marks_lost_total. A lost mark counts toward the overall input error count, see Input errors.