HTTP Live Streaming (HLS) is an adaptive bitrate live streaming video protocol that enables high quality streaming of video content. DAI for Ad Manager supports HLS version 3. This integration guide details the requirements and recommendations for using HLS.
See which features are supported for live and video on demandFeature | Live linear | Video on demand (VOD) |
---|---|---|
EXTINF |
||
EXT-X-DATERANGE > SCTE35-IN |
— | |
EXT-X-DATERANGE > SCTE35-OUT |
— | |
EXT-X-DISCONTINUITY |
||
EXT-X-DISCONTINUITY-SEQUENCE |
— | |
EXT-X-ENDLIST |
* | |
EXT-X-I-FRAME-STREAM-INF |
||
EXT-X-I-FRAMES-ONLY |
||
EXT-X-INDEPENDENT-SEGMENTS |
||
EXT-X-KEY |
||
EXT-X-MEDIA (Rendition Groups) |
||
EXT-X-MEDIA-SEQUENCE |
— | |
EXT-X-PLAYLIST-TYPE |
||
EXT-X-PROGRAM-DATE-TIME |
||
EXT-X-STREAM-INF > AUDIO |
||
EXT-X-STREAM-INF > AVERAGE-BANDWIDTH |
||
EXT-X-STREAM-INF > BANDWIDTH |
||
EXT-X-STREAM-INF > CLOSED CAPTIONS |
||
EXT-X-STREAM-INF > CODECS |
||
EXT-X-STREAM-INF > FRAMERATE |
||
EXT-X-STREAM-INF > RESOLUTION |
||
EXT-X-STREAM-INF > SUBTITLES |
||
EXT-X-STREAM-INF > VIDEO |
||
EXT-X-TARGETDURATION |
||
EXT-X-VERSION |
* Supported in live streams for EVENT type playlists only.
Jump to a specific section
- Playlists and rendition groups
- Codecs and resolution
- Segment duration and Timestamp alignment
- Discontinuity
- Media encryption
Playlists and rendition groups
Deliver playlists using GZIP content-encoding (recommended). Variants in master playlists and segments can use either absolute URLs or relative URLs.
All ad assets are transcoded to include I-FRAME playlists, including slates. Ad Manager DAI does not generate I-FRAME playlists from the content or generate new Rendition Groups based on combinations of video/audio.
- For live linear: If required, I-FRAME playlists must be generated and conditioned by the encoder/packager. Rendition Groups are delivered as they're generated from the Live encoder.
- For video on demand (VOD): If required, I-FRAME playlists must be supplied in the master manifest at ingest. Ad Manager will only raise an error if the provided I-FRAME playlist file cannot be accessed or parsed. Rendition Groups are delivered as they are provided in the master manifest.
Codecs and resolution
HLS master playlists for live streams and video on demand (VOD) assets must include the optional CODECS
and RESOLUTION
attributes. These attributes are used to find suitable ads that match these encoding settings. If these values are not provided, ads are matched based on bandwidth alone and may result in a mismatch of resolution and codecs between ad and content. This can lead to poor user experience and playback issues across different devices.
The CODECS
attribute must contain both the audio and the video codecs. Your encoder may add or remove variants to your master playlist URL at any time.
Audio codecs
DAI supports the AAC audio codec. DAI also supports the AC-3 and E-AC-3 codecs.
CODECS
and RESOLUTION
combination.You should ensure that your encoder is configured to maintain consistent URLs for each variant URL to prevent playback problems for your users.
Example
A master playlist with CODECS and RESOLUTION
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=694272,CODECS="avc1.77.41,mp4a.40.2",RESOLUTION=768x432
chunklist_b694272.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=202752,CODECS="avc1.66.31,mp4a.40.2",RESOLUTION=480x270
Chunklist_b202752.m3u8
Segment duration
HLS media playlists must have media segment durations declared as decimal-floating-point numbers. The duration should have floating point accuracy to help determine the precise time when an ad break will start and end. The less accurate the duration values, the less accurately the system is able to determine when ad breaks occur in the resulting stream.
Example
A media playlist with #EXTINF
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:26
#EXTINF:9.901,
http://media.example.com/wifi/segment26.ts
#EXTINF:9.901,
http://media.example.com/wifi/segment27.ts
#EXTINF:9.501,
http://media.example.com/wifi/segment28.ts
Timestamp alignment
The Presentation Timestamp (PTS) across segments in variant media playlists must align. P-frame and B-frame refers other frames to decode a frame. The H.264 codec also references frames that are not adjacent for better compression. Since these frames depend on other frames for decoding and presentation, Decode Timestamp (DTS) gives sequence by which frames are decoded and PTS gives sequence by which frames are presented. Aligning PTS is important when you adapt to different bitrate while playback of an asset. Ad insertion uses PTS to find the ad insertion position.
Discontinuity
Any EXT-X-DISCONTINUITY
in the media playlist must have EXT-X-DISCONTINUITY-SEQUENCE
. The EXT‑X‑DISCONTINUITY‑SEQUENCE
tag allows synchronization between different renditions of the same variant stream or different variant streams.
Media encryption
If you want to encrypt the media content, it must be encrypted with:
- AES-128 (encrypts the entire segment)
- SAMPLE-AES (encrypts individual media, like audio or video)
- SAMPLE-AES-CTR.
Ad Manager DAI supports DRM technology for HLS streams using FairPlay and other DRMs with CMAF/fragmented MP4.
Example
A media playlist with #EXT-X-KEY
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:26
#EXT-X-KEY:METHOD=AES-128,URI="https://media.example.com/asset/key1.php?id=<signature>",IV=<initialization vector>
#EXTINF:9.901,
http://media.example.com/wifi/segment26.ts
#EXTINF:9.901,
http://media.example.com/wifi/segment27.ts
#EXT-X-KEY:METHOD=AES-128,URI="https://media.example.com/asset/key2.php?id=<signature>"
#EXTINF:9.501,
http://media.example.com/wifi/segment28.ts