tencent cloud

Feedback

Server-Side Ad Insertion

Last updated: 2024-01-06 13:59:16

    AD insertion

    With the advancement of streaming media technology and applications on internet, it is apparent that ad-supported streaming media delivery has become a major monetization strategy. By using Tencent Cloud's Stream Service, you can implement dynamic ad insertion based on SCTE-35 ad markers and SSAI. The complete general process of SSAI is as follows:
    
    
    
    1. The publisher pushes the live stream to StreamLive for transcoding, packaging, and inserting SCTE-35 ad markers, and then transmits it to StreamPackage. If there are no subsequent processes, step 1) has already completed all server-side steps in CSAI.
    2. The player requests the manifest (m3u8/mpd), and StreamPackage fetches the origin manifest while parsing the manifest and checking the SCTE-35 ad markers.
    3. StreamPackage send the request to the Ad Decision Server, parses the VAST/VMAP response, and obtains the ad video address.
    4. StreamPackage downloads the ad video, transcodes and stores it.
    5. StreamPackage updates the transcoded ad segment url in the manifest by inserting and replacing, and then distribute it.
    6. After the ad is played on the client-side, StreamPackage reports to the ad Tracking service for tracking the event.
    If you use this AD insertion feature. AD insertion fee will be incurred.

    Step One: Enabling AD Configuration

    Click the channel name or Info on the right to go to the channel details page. In the endponts tab, you can enable Ad Configuration for the endpoints:
    
    
    
    Click AD Configuration to enter the configuration page which includes:
    Ad decision server:The URL for the ad decision server (ADS).
    Configuration aliases:Configuration aliases are used for dynamic variable replacement.
    Personalization details:Optional settings for ad break personalization.
    Advanced settings:Advanced settings allow you to fine-tune properties related to your content delivery network (CDN) prefix, DASH.

    Step Two: Configuring URL for the ADS

    
    
    The ad decision server (ADS) is the origin server that’s providing content to StreamPackage. It determines which ads StreamPackage will insert in ad breaks in the manifest. The URL for the ad decision server (ADS) is an address starting with http:// or https://. Maximum 25,000 characters.

    Step Three: Configuring aliases

    Player parameters and aliases used for dynamic variable replacement. Click Add player parameter, Edit, Delete on the right to maintain player parameters. Parameter name can contain up to 32 letters, digits, underscores(_), and hythens(-).
    
    
    
    Enter alias key name and alias value in the parameter. You'll use the alias key as a player parameter variable during dynamic variable replacement. StreamPackage will replace the alias key with the mapped alias value.

    An example:

    1. URL for the ADS
    https://my.ads.com/path?ad_type=[player_params.ad_type]&region=[player_params.region]
    2. Aliases for dynamic variable replacement
    "ConfigurationAliases": {
    "player_params.ad_type": {
    "customized": "abc",
    "default": "default"
    },
    "player_params.region": {
    "india": "ap-mumbai",
    "japan": "ap-tokyo"
    },
    }
    3. Add key-value in the request to StreamPackage
    <master>.m3u8?ad_type=customized&region=india
    4. StreamPackage will pass the parameters to ADS
    https://my.ads.com/path?ad_type=abc&region=ap-mumbai

    Step Four: Setting default slate ad

    The slate ad is a default ad that’s used if an ad break isn’t filled by an ad replacement. It lets you define what happens when an ad break isn’t completely filled by the ads dictated by the ad decision server (ADS). This way, if an ad is unavailable or too short, or if network conditions prevent the ad decision server from responding to StreamPackage, you know exactly what will be played instead. If an ad slate isn’t specified, then the default is to show the underlying content stream. The URL for the slate ad is an address starting with http:// or https://. Maximum 25,000 characters.
    
    
    
    The personalization threshold sets the maximum duration (in seconds) of underfilled ad time allowed in an ad break. If the duration of underfilled ad time exceeds the personalization threshold, then personalization of the ad break is abandoned and the underlying content is shown.

    Step Five: Advanced settings

    
    
    
    Ad marker passthrough:Enable or disable ad marker passthrough.
    DASH mpd location:Enable or disable DASH support for sticky HTTP redirect behavior in players that don't support sticky.
    SCTE-35 ad message type:Specify how ad markers are packaged in the output.

    Step Six: Generating playback URL with inserted ad

    After completing the configurations above, add txType=ssai to the Endpoint Url to generate the corresponding playback Url with inserted ad. For example:
    Original Endpoint Url:
    http://xxx.mediapackage.srclivepull.myqcloud.com/v1/<channel_id>/<stream_id>/ssai_test.m3u8
    Corresponding Url with inserted ad:
    http://xxx.mediapackage.srclivepull.myqcloud.com/v1/<channel_id>/<stream_id>/ssai_test.m3u8?txType=ssai

    Step Seven: Origin manifest and personalized manifest after replacement

    The following examples provide a comparison between the origin manifest and the personalized manifest after replacement.

    Origin manifest

    Here is an example of the HLS master manifest obtained by StreamPackage from the original stream:
    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-INDEPENDENT-SEGMENTS
    #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=500000,RESOLUTION=640x360
    tx_ssai_temp1.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=2000000,RESOLUTION=960x540
    tx_ssai_temp2.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=3000000,RESOLUTION=1280x720
    tx_ssai_temp3.m3u8
    Here is an example of the HLS media manifest obtained by StreamPackage from the original stream, which includes inserted SCTE-35 markers:
    #EXTM3U
    #EXT-X-VERSION:5
    #EXT-X-MEDIA-SEQUENCE:3835222
    #EXT-X-TARGETDURATION:6
    #EXTINF:6.000, no desc seq 3835223
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907362016.ts?&3835223
    #EXTINF:2.333, no desc seq 3835224
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907368016.ts?&3835224
    #EXT-OATCLS-SCTE35:/AAgAAHwulfuAAAADwUAAACcAPCAAA27oAAAAAAAAPKrLtw=
    #EXT-X-CUE-OUT:10
    #EXTINF:3.667, no desc seq 3835225
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907370349.ts?&3835225
    #EXT-X-CUE-OUT-CONT:ElapsedTime=3.667,Duration=10,SCTE35=/AAgAAHwulfuAAAADwUAAACcAPCAAA27oAAAAAAAAPKrLtw=
    #EXTINF:6.000, no desc seq 3835226
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907374016.ts?&3835226
    #EXT-X-CUE-OUT-CONT:ElapsedTime=9.667,Duration=10,SCTE35=/AAgAAHwulfuAAAADwUAAACcAPCAAA27oAAAAAAAAPKrLtw=
    #EXTINF:0.333, no desc seq 3835227
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907380016.ts?&3835227
    #EXT-X-CUE-IN
    #EXTINF:5.667, no desc seq 3835228
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907380349.ts?&3835228
    #EXTINF:6.000, no desc seq 3835229
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907386016.ts?&3835229
    #EXTINF:6.000, no desc seq 3835230
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907392016.ts?&3835230

    Personalized manifest

    Here is an example of the personalized HLS master manifest generated by StreamPackage:
    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-INDEPENDENT-SEGMENTS
    #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=500000,RESOLUTION=640x360
    tx_ssai_temp1.m3u8?txSessionID=fd320a4d99ba7df952f5a214ed901935&txType=manifest
    #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=2000000,RESOLUTION=960x540
    tx_ssai_temp2.m3u8?txSessionID=fd320a4d99ba7df952f5a214ed901935&txType=manifest
    #EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=3000000,RESOLUTION=1280x720
    tx_ssai_temp3.m3u8?txSessionID=fd320a4d99ba7df952f5a214ed901935&txType=manifest
    Here is an example of the personalized HLS media manifest generated by StreamPackage:
    #EXTM3U
    #EXT-X-VERSION:5
    #EXT-X-MEDIA-SEQUENCE:3835222
    #EXT-X-TARGETDURATION:6
    #EXTINF:6.000, no desc seq 3835223
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907362016.ts?&3835223
    #EXTINF:2.333, no desc seq 3835224
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907368016.ts?&3835224
    #EXT-X-DISCONTINUITY
    #EXTINF:2.000,
    segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835224
    #EXTINF:2.000,
    segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835225
    #EXTINF:2.000,
    segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835226
    #EXTINF:2.000,
    segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835227
    #EXTINF:2.000,
    segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835228
    #EXT-X-DISCONTINUITY
    #EXTINF:5.667, no desc seq 3835228
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907380349.ts?&3835228
    #EXTINF:6.000, no desc seq 3835229
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907386016.ts?&3835229
    #EXTINF:6.000, no desc seq 3835230
    64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907392016.ts?&3835230
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support