Ad insertion supports the HTTP Live Streaming (HLS) protocol. Learn about the protocol basics and playlist requirements.
HLS
HLS is a streaming protocol for delivering audio and video content over HTTP or HTTPS. It divides content into small segments and creates playlist files in M3U8 format. The client requests the M3U8 playlist files to retrieve and play segments.
M3U8 playlist files have two types:
-
Media playlist: contains URLs to the segments.
-
Master playlist: contains URLs to multiple media playlists, each representing a different variant of the stream. These variants can differ in bitrate, codec and resolution.
Sample master playlist
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=100000,CODECS="mp4a.40.2,avc1.64001e",RESOLUTION=640x302
video/player-ld.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=200000,CODECS="mp4a.40.2,avc1.64001f",RESOLUTION=848x402
video/player-sd.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=300000,CODECS="mp4a.40.2,avc1.640020",RESOLUTION=1280x606
video/player-hd.m3u8
Sample media playlist
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-TARGETDURATION:17
#EXTINF:15.500,
1723518810_120.ts
#EXT-X-DISCONTINUITY
#EXTINF:16.666,
1723518884_121.ts
#EXTINF:2.533,
1723518886_122.ts
#EXT-X-ENDLIST
To use ad insertion, HLS playlists must meet the following requirements:
-
The playlists must be accessible on the Internet.
-
The source must be live or video-on-demand (VOD).
-
The playlists must have an
EXT-X-VERSIONof3or higher. -
The source must have both master and media playlists. The following container formats are supported for segments: Transport Stream (TS) and Common Media Application Format (CMAF).
-
The
#EXT-X-STREAM-INFtag in the master playlist must have theRESOLUTION,BANDWIDTH, andCODECattributes. -
For live content, media playlists must contain ad markers to delineate ad avails. This is optional for VOD content, which can use VMAP timeoffsets instead.
Ad markers
Sample media playlist with ad markers:
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-PLAYLIST-TYPE:EVENT
#EXT-X-TARGETDURATION:14
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-DISCONTINUITY
#EXT-OATCLS-SCTE35:{BASE64} (optional)
#EXT-X-CUE-OUT:60.00
...
#EXT-X-CUE-OUT-CONT:ElapsedTime=5.0,Duration=10.0,SCTE35={BASE64} (optional)
...
#EXT-X-CUE-IN
#EXTINF:16.666,
1723518884_121.ts
#EXTINF:2.533,
1723518886_122.ts
#EXT-X-ENDLIST
In this example, #EXT-OATCLS-SCTE35, #EXT-X-CUE-OUT, #EXT-X-CUE-IN, and #EXT-X-CUE-OUT-CONT are ad markers.
Segments between #EXT-X-CUE-OUT and #EXT-X-CUE-IN represent ad content.
ADS requirements
To integrate your ad decision server (ADS) with MediaWeaver, the ADS must conform to VAST and VMAP specifications and other industry standards from the Interactive Advertising Bureau (IAB).
-
MediaWeaver supports VAST responses from ADS. Only VAST MP4 linear ads are allowed. A VAST response can contain multiple ad creatives. For each creative, MediaWeaver selects the
MediaUrlwith the highest resolution. -
MediaWeaver supports VMAP responses from ADS. The URL in
AdTagURImust reference a VAST response.
References
For IAB standards, see IAB Tech Lab.
For more information about VAST, see Digital Video Ad Serving Template (VAST).
For more information about VMAP, see Video Multiple Ad Playlist (VMAP).