AWS for M&E Blog

Support for HLS Interstitials in AWS Elemental MediaTailor

Amazon Web Services (AWS) is pleased to announce support for HLS Interstitials for video-on-demand (VOD) workflows in AWS Elemental MediaTailor. The implementation of support for interstitials introduces server-guided ad insertion (SGAI) in MediaTailor, which complements existing server-side ad insertion (SSAI) support. HLS Interstitials offer a versatile and efficient solution for managing and integrating advertising content within HLS streams. By adopting SGAI, customers can benefit from improved video start times (VST), optimized ad render rates, seamless ad insertion, and reduced manifest delivery latencies. To understand more about the benefits of HLS Interstitials and SGAI, read this AWS for M&E blog post detailing how you can increase monetization while lowering total cost of ownership (TCO) with server-guided ad insertion.

Understanding HLS Interstitials

In 2021, Apple introduced HLS (HTTP Live Streaming) Interstitials, aimed at streamlining the management of advertisements and other ancillary content within HLS streams. HLS Interstitials offer a straightforward method to schedule ads seamlessly into content streams. Interstitials themselves are self-contained media assets, which eliminates the need for complex manipulation of manifests and simplifies the ad scheduling process by referencing the respective ad playlist from the primary content. HLS Interstitials empower content providers to reduce VST, optimize ad inventory, and enhance ad delivery during playback by employing late binding and using a distinct player instance for interstitials play out.

The following figures visualize the differences between SSAI stitched ads vs SGAI interstitials.

Image demonstrating client playback workflow for SSAI stitched ads.

Image demonstrating client playback workflow for SGAI Interstitials

 

HLS Interstitials in AWS MediaTailor

The following figure shows the process when VOD HLS Interstitials are used in MediaTailor. It’s important to note that there is no interaction with the ad decision server (ADS) until the client encounters an HLS Interstitial EXT-X-DATERANGE tag and requests the ASSET-LIST URI from MediaTailor. This facilitates some of the benefits that are outlined in the next section.

Image demonstrating player interaction with AWS MediaTailor when HLS Interstitials are enabled.

Why AWS MediaTailor for HLS Interstitials

  • Seamless Viewing Experience – AWS Elemental MediaTailor offers the capability to dynamically condition ad assets to match the ABR ladder of content streams. This allows content providers to enhance the viewing experience by providing a seamless transition between ads and content streams.
  • Improved Cacheability of Variant Manifests – AWS Elemental MediaTailor employs the #EXT-X-DEFINE tag, which allows for variable substitutions, resulting in a common manifest that is highly cacheable and can be used to serve multiple MediaTailor sessions.
  • Reduce Video Start Time for VOD Sessions – Significantly shorten the time-to-first-frame (TTFF) for viewers. MediaTailor will only make requests to the ADS for ads when the client play head nears the EXT-X-DATERANGE tag and requests the ASSET-LIST from MediaTailor. In turn, this can facilitate reduced load on the ADS and improved render rates if viewers drop from the stream prior to the end of the play-out.
  • Flexibility and Session State – Currently, device support for HLS Interstitials is not widespread and some devices may never be fully compatible, so MediaTailor supports a hybrid ad insertion mode that allows customers to designate SSAI or SGAI, on a per session basis.
  • Observability – AWS MediaTailor integrates with AWS CloudWatch by offering a suite of CloudWatch Metrics and CloudWatch logs, enabling effective monitoring of MediaTailor resources.
  • Scalability and Reliability – AWS Elemental MediaTailor has been proven to support millions of concurrent viewer sessions, providing a robust and reliable service to support ad insertion for high viewership events.
  • Flexible ADS Transactions – AWS Elemental MediaTailor will perform scheduling of interstitials based on supported SCTE markers, as well as parsing of SCTE35 parameters to provide signaling for the ADS.

Get started with HLS Interstitials in MediaTailor

AWS Elemental MediaTailor playback configurations must be configured to allow SGAI sessions before players can initialize HLS Interstitials-enabled sessions. Prior to enabling SGAI on your MediaTailor playback configurations, make sure that your clients support the playback of HLS Interstitials. The following methods demonstrate how to enable SGAI-mode on a MediaTailor playback configuration.

API

Use the new field "InsertionMode": "PLAYER_SELECT" in the PutPlaybackConfiguration API to enable the ability for players to initialize MediaTailor sessions with either GUIDED (SGAI – HLS Interstitials) or STITCHED (SSAI) mode. The default for InsertionMode is STITCHED_ONLY, which does not allow players to initialize MediaTailor sessions with HLS Interstitials. To understand more about the PutPlaybackConfiguration request syntax, see the public docs here.

Console

Customers may also use the AWS Console to enable HLS Interstitials on a MediaTailor playback configuration. A new field called “Ad Insertion Mode” now exists with the following values:

  • “Stitched only” – This is the default selection. This value only enables SSAI mode on the playback configuration.
  • “Player select” – Select this option to allow HLS Interstitials sessions on the playback configuration.

Image demonstrating how to enable SGAI mode on a MediaTailor playback configuration from the AWS Console.

 

Session state

Once a MediaTailor playback configuration is enabled with SGAI, the HLS Interstitials feature can be enabled during session initialization on a per-session basis. The process to enable the feature differs from creating sessions using the HLS/DASH playback prefix (implicit session initialization), versus the session initialization prefix (explicit session initialization).

How to enable HLS Interstitials for the session using HLS playback prefixes

From the player, initialize a new MediaTailor playback session using the following query string:

GET <mediatailorURL>/v1/master/<hashed-account-id>/<origin-id>/<asset-id>?aws.insertionMode=GUIDED

How to enable HLS Interstitials for the session using the session initialization prefix

On the player, construct a JSON message body for the session initialization request to MediaTailor:

  • Inside an adsParams object, provide any parameters that MediaTailor should pass to the ADS. These parameters correspond to [player_params.param] settings in the ADS template URL of the MediaTailor configuration.
  • To enable HLS Interstitials, add the insertionMode key at the top level of the session initialization body and set the value to GUIDED, as seen in the following example. The default InsertionMode value is STITCHED.
  • To understand more about client-side session initialization, see the public docs here.
POST <mediatailorURL>/v1/session/<hashed-account-id>/<origin-id>/asset-id.m3u8

{
    "adsParams": {
        "deviceType": "ipad"
    },
    "insertionMode": "GUIDED"
}
HLS manifests

Multi-variant manifest

For SGAI-enabled sessions, MediaTailor includes the unique, encoded player session data as a #EXT-X-DEFINE: value in the multi-variant manifest, which will dynamically replace the #EXT-X-DEFINE:IMPORT variable in the variant playlists, when requesting the ASSET-LISTs.

Example origin multi-variant manifest

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-STREAM-INF:BANDWIDTH=9628004,AVERAGE-BANDWIDTH=2303102,CODECS="avc1.4d401f,ec-3,mp4a.40.2",RESOLUTION=960x540,FRAME-RATE=23.976
index-540_2397.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=26035278,AVERAGE-BANDWIDTH=8542867,CODECS="avc1.640028,ec-3,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=23.976
index-1080_2397.m3u8

Example personalized multi-variant manifest:

https://sample.mediatailor.aws.a2z.com/v1/master/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config/test-asset/index-1920.m3u8?aws.sessionId=5b247f54-0c61-4769-98f4-73159221e31a
#EXTM3U
#EXT-X-VERSION:8
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-DEFINE:NAME="awsSessionData",VALUE="[UNIQUE_SESSSION_DATA]"
#EXT-X-STREAM-INF:CODECS="avc1.4d401f,ec-3,mp4a.40.2",AVERAGE-BANDWIDTH=2303102,RESOLUTION=960x540,FRAME-RATE=23.976,BANDWIDTH=9628004
../../../../../../i-media/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config/…/0.m3u8
#EXT-X-STREAM-INF:CODECS="avc1.640028,ec-3,mp4a.40.2",AVERAGE-BANDWIDTH=8542867,RESOLUTION=1920x1080,FRAME-RATE=23.976,BANDWIDTH=26035278
../../../../../../i-media/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config/…/1.m3u8

Variant manifest

For SGAI-enabled sessions, there are no changes required to how ad breaks are signaled in the template manifest. MediaTailor will insert EXT-X-DATERANGE tags at the ad break markers. For VOD workflows, MediaTailor also includes a PROGRAM-DATE-TIME (PDT) tag on the first media sequence segment in the manifest. The interstitials have EXT-X-DATERANGE START-DATE values relative to this PDT, based on the ad break position in the timeline.

Example origin variant manifest using CUE-OUT in a VOD workflow:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.006,
1920_540_2397_00001.ts
.
.
.
#EXTINF:5.964,
1920_540_2397_00010.ts
#EXT-X-CUE-OUT:0
#EXT-X-CUE-IN
#EXTINF:0.042,
1920_540_2397_00011.ts
.
.
.
#EXT-X-ENDLIST

Example MediaTailor output variant manifest using CUE-OUT in a VOD workflow:

To maximize the efficiency of using HLS Interstitials, MediaTailor combines the use of interstitials signaling with the #EXT-X-DEFINE tag, a feature introduced by Apple HLS to support variable substitution. This gives MediaTailor the ability to deliver the same child playlist to all sessions that are HLS Interstitials-enabled. The EXT-X-DEFINE variable in the multi-variant playlists directs each MediaTailor session client to fetch personalized ad asset lists. Using this variable, MediaTailor is capable of generating common variant manifests and manifest URIs across various MediaTailor sessions. As a result, these variant manifests are highly cacheable and smaller in size, when compared to fully stitched manifests, which allows for lower manifest request latency when delivered by a content delivery network (CDN). Beyond that, MediaTailor makes use of the X-RESUME-OFFSET tag, which players can leverage to ensure frame-accurate transitions between ads and content.

#EXTM3U
#EXT-X-VERSION:8
#EXT-X-DEFINE:IMPORT="awsSessionData"
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-DISCONTINUITY-SEQUENCE:0
#EXT-X-DATERANGE:ID="mt_generated",CLASS="com.apple.hls.interstitial",START-DATE="2021-05-12T12:00:00Z",DURATION=30.0,PLANNED-DURATION=30.0,X-ASSET-LIST="https://interstitials.sample.mediatailor.aws.a2z.com/v1/interstitials/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config?aws.availData=[ORIGIN AVAIL INFORMATION]&aws.sessionData={$awsSessionData}",X-RESUME-OFFSET=0.0
#EXT-X-PROGRAM-DATE-TIME:2021-05-12T12:00:00Z
#EXTINF:6.006,
https://sample-asset.cloudfront.net/test-content/1920_540_2397_00001.ts
.
.
.
#EXTINF:5.964,
https://sample-asset.cloudfront.net/test-content/1920_540_2397_00010.ts
#EXT-X-DATERANGE:ID="1",CLASS="com.apple.hls.interstitial",START-DATE="2021-05-12T12:01:00.018Z",PLANNED-DURATION=0.0,X-ASSET-LIST="https://interstitials.sample.mediatailor.aws.a2z.com/v1/interstitials/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config?aws.availData=[ORIGIN AVAIL INFORMATION]&aws.sessionData={$awsSessionData}",X-RESUME-OFFSET=0.0
#EXTINF:0.042,
https://sample-asset.cloudfront.net/test-content/1920_540_2397_00011.ts
.
.
.
#EXT-X-ENDLIST

ASSET-LIST

The ASSET-LIST attribute carries the URI to a JSON file that contains a list of ad asset URIs and their duration for a particular ad break. The ASSET-LIST response contains client tracking information, including beacon URIs and beacon timing for each ad. Upon the ASSET-LIST request from the client, MediaTailor will request ads from the ad decision server to fill the break and personalize the ASSET-LIST response. If the ad decision server responds with a VAST XML, MediaTailor will fill that particular break with all of the ads in the VAST response. If the ADS responds with a VMAP XML containing ads for all of the breaks in the template manifest, MediaTailor will pre-schedule all of the ads for each break specified in the VMAP response.

Example ASSET-LIST call to MediaTailor

The following example is a template of how the asset-list URI is constructed:

https://interstitials.sample.mediatailor.aws.a2z.com/v1/interstitials/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config?aws.availData={availData}&aws.sessionData={sessionData}

The availData parameter includes information about the particular ad break based on timing and SCTE-35 data in the origin manifest. It is unique to a particular break but shared among all player sessions. The sessionData parameter includes information about the individual player sessions. The sessionData query parameter should be dynamically replaced with the sessionData value that exists in the session’s multi-variant playlist. For example:

https://interstitials.sample.mediatailor.aws.a2z.com/v1/interstitials/5d22c610440c419b9290f9233dc99fe61adb77ab/vod-config?aws.availData=[ORIGIN AVAIL INFORMATION]

Example ASSET-LIST JSON response

{
    "ASSETS": [
        {
            "DURATION": 14,
            "URI": "https://segments.sample.mediatailor.aws.a2z.com/tm/5d22c610440c419b9290f9233dc99fe61adb77ab/m7ynylvamrfbddhuxea6o7lmppyhxhx3/asset.m3u8"
        },
        {
            "DURATION": 14,
            "URI": "https://segments.sample.mediatailor.aws.a2z.com/tm/5d22c610440c419b9290f9233dc99fe61adb77ab/shde6hmqrvcrxm6ktfmzprv3xicxyzk3/asset.m3u8"
        }
    ],
    "TRACKING": {
        "avails": [
            {
                "adBreakTrackingEvents": [],
                "adMarkerDuration": null,
                "ads": [
                    {
                        "adId": "4649886",
                        "adParameters": "",
                        "adProgramDateTime": null,
                        "adSystem": "FreeWheel",
                        "adTitle": "Untitled Placement",
                        "adVerifications": [],
                        "companionAds": [],
                        "creativeId": "creative1",
                        "creativeSequence": "",
                        "duration": "PT14.982S",
                        "durationInSeconds": 14.982,
                        "extensions": [],
                        "mediaFiles": {
                            "mediaFilesList": [],
                            "mezzanine": ""
                        },
                        "skipOffset": null,
                        "startTime": "PT0S",
                        "startTimeInSeconds": 0,
                        "trackingEvents": [
                            {
                                "beaconUrls": [
                                    "https://ads.a2z.com/tracking"
                                ],
                                "duration": "PT14.982S",
                                "durationInSeconds": 14.982,
                                "eventId": "4649886",
                                "eventProgramDateTime": null,
                                "eventType": "impression",
                                "startTime": "PT0S",
                                "startTimeInSeconds": 0
                            },
                            {
                                "beaconUrls": [
                                    "https://ads.a2z.com/tracking"
                                ],
                                "duration": "PT14.982S",
                                "durationInSeconds": 14.982,
                                "eventId": "4649886",
                                "eventProgramDateTime": null,
                                "eventType": "error",
                                "startTime": "PT0S",
                                "startTimeInSeconds": 0
                            }
                        ],
                        "vastAdId": "ad1"
                    },
                    {
                        "adId": "4649893",
                        "adParameters": "",
                        "adProgramDateTime": null,
                        "adSystem": "FreeWheel",
                        "adTitle": "Untitled Placement",
                        "adVerifications": [],
                        "companionAds": [],
                        "creativeId": "creative2",
                        "creativeSequence": "",
                        "duration": "PT14.982S",
                        "durationInSeconds": 14.982,
                        "extensions": [],
                        "mediaFiles": {
                            "mediaFilesList": [],
                            "mezzanine": ""
                        },
                        "skipOffset": null,
                        "startTime": "PT14.982S",
                        "startTimeInSeconds": 14.982,
                        "trackingEvents": [
                            {
                                "beaconUrls": [
                                    "https://ads.a2z.com/tracking"
                                ],
                                "duration": "PT14.982S",
                                "durationInSeconds": 14.982,
                                "eventId": "4649893",
                                "eventProgramDateTime": null,
                                "eventType": "impression",
                                "startTime": "PT14.982S",
                                "startTimeInSeconds": 14.982
                            },
                            {
                                "beaconUrls": [
                                    "https://ads.a2z.com/tracking"
                                ],
                                "duration": "PT14.982S",
                                "durationInSeconds": 14.982,
                                "eventId": "4649893",
                                "eventProgramDateTime": null,
                                "eventType": "error",
                                "startTime": "PT14.982S",
                                "startTimeInSeconds": 14.982
                            }
                        ],
                        "vastAdId": "ad2"
                    }
                ],
                "availId": "4649886",
                "availProgramDateTime": null,
                "duration": "PT29.964S",
                "durationInSeconds": 29.964,
                "meta": null,
                "nonLinearAdsList": [],
                "startTime": "PT0S",
                "startTimeInSeconds": 0
            }
        ],
        "cacheControl": "max-age=5",
        "dashAvailabilityStartTime": null,
        "hlsAnchorMediaSequenceNumber": null,
        "nextToken": null,
        "nonLinearAvails": null,
        "xAmzSource": "Midas"
    }
}

Conclusion

The support for HLS Interstitials in AWS Elemental MediaTailor is a response to the evolving needs of the streaming media industry, providing you with more tools to enhance content delivery and monetization strategies. Customers can leverage the AWS Elemental MediaTailor support for HLS Interstitials to provide an improved viewer experience. Video players can take advantage of HLS Interstitials to provide seamless ad transitions with frame accuracy, lower video startup times, and improved render rates. With identical manifests for all end-user sessions, CDN providers have the ability to cache and deliver manifests at the edge to achieve lower latencies. ADS requests also benefit from lower latencies, as players only request ads when reaching an HLS Interstitials tag.

Now available

HLS Interstitials for VOD workflows is supported in all the regions where AWS Elemental MediaTailor is available. Check the full region list for future updates. With pay-as-you-go pricing, you only pay for the number of interstitials scheduled by MediaTailor. To learn more, see the MediaTailor pricing page in the AWS documentation.

John Vasconcelos

John Vasconcelos

John Vasconcelos is a Senior Specialized Technical Account Manager supporting AWS Elemental Media Services. John has over 15 years of experience working in the video industry, and content delivery networks at major ISPs.

Kevin Nguyen

Kevin Nguyen

Kevin Nguyen is an Enterprise Account Engineer supporting AWS Elemental customer media workflows from contribution encoding through origination and content delivery.