Server-side ad insertion (SSAI) allows content providers to seamlessly integrate ads into their videos, ensuring a smooth and uninterrupted viewing experience. Amazon Web Services (AWS) provides a powerful solution called MediaTailor, which enables server-side ad stitching for live and on-demand video content. This approach offers a superior alternative to client-side ad insertion, as it reduces buffering, ad-blocking issues, and improves overall performance.
Prerequisites for Setting Up MediaTailor
Before integrating MediaTailor with your video workflow, ensure you have the following prerequisites:
- AWS Account: You will need an active AWS account to use AWS MediaTailor.
- AWS Elemental MediaLive: MediaLive is used for video encoding. If you haven"t already set it up, you will need to configure MediaLive to generate HLS or DASH streams.
- Amazon S3 Bucket: Your media content and ad assets should be stored in an S3 bucket, which MediaTailor will reference to serve the video and ads.
- Video Player: You should have an existing video player (like Video.js or JWPlayer) that supports ad playback.
- Ad Decision Server (ADS): MediaTailor needs an ad decision server (ADS) like AWS Elemental MediaPackage, or a third-party solution like FreeWheel, to manage ad requests and responses.
Configuring MediaTailor for Server-Side Ad Insertion
Step 1: Set Up MediaTailor Channel
To integrate MediaTailor, you must first create a MediaTailor channel. The channel will define the video content and ad markers, which tell MediaTailor where ads should be inserted during playback.
Example:
- Log into the AWS Management Console.
- Navigate to the MediaTailor service under the Media Services section.
- Click Create Channel and provide the necessary details, including the input stream type (HLS or DASH), video content URL, and ad markers (SCTE-35 markers).
The SCTE-35 markers are essential as they are inserted into the stream to indicate where ads should be placed.
Step 2: Configure the Ad Decision Server (ADS)
The next step is to set up an ad decision server (ADS). This server provides MediaTailor with ad content based on the user"s session, video content, and location. You can use AWS MediaPackage or a third-party server.
- Create an ADS Integration: In the MediaTailor console, select the Ad Decision Server integration option and configure the ADS URL.
- Define Ad Rules: Set rules that determine when and how ads are delivered. This could include targeting specific ads based on video content, user data, and region.
- Test the ADS Configuration: Ensure that MediaTailor can communicate properly with the ad decision server by performing a test run. MediaTailor will fetch the ad content as per the rules you"ve defined.
Step 3: Implement Ad Breaks with SCTE-35 Markers
SCTE-35 markers define ad break points in the video content. These markers are transmitted as part of the video stream and allow MediaTailor to insert ads at appropriate times.
- Insert SCTE-35 Markers in the Video Stream: If you are using AWS MediaLive for video encoding, you can configure MediaLive to insert SCTE-35 markers during video stream encoding. These markers provide ad cue points within the stream.
- Verify Marker Placement: After the SCTE-35 markers are inserted, verify their placement using a video stream player or logging system to ensure that MediaTailor recognizes them.
Example of SCTE-35 Marker Usage in MediaLive:
- MediaLive provides an easy integration to insert these markers at ad cue points, such as at the start and end of a content break.
Step 4: Integrate MediaTailor with the Video Player
After configuring the channel and the ad decision server, the next step is to integrate MediaTailor with your video player. This allows the player to request and display the ad content during playback.
- Video Player Configuration: Ensure your video player supports VAST/VPAID standards for ad playback and set the Ad Tag URL in your video player to point to the MediaTailor ad decision server.
- Modify Player Code to Load Ads: Use the player's API to request the ad content from MediaTailor and configure the player to receive and render ads during ad breaks defined by the SCTE-35 markers.
Example for Video.js:
var player = videojs('my-video-player');
player.ads(); // Enable the ads plugin
player.on('adstart', function() {
console.log('Ad is starting');
});
player.on('adend', function() {
console.log('Ad has finished');
});
In this example, the videojs-ads plugin is used to enable ad playback when interacting with the MediaTailor service.
Step 5: Monitor and Optimize Ad Delivery
MediaTailor provides real-time monitoring for ad delivery. Ensure that ad insertion works as expected and optimize based on user feedback.
- Monitor Ad Requests and Responses: In the MediaTailor console, view real-time logs and analytics for ad request and response data.
- Track Ad Metrics: Set up CloudWatch metrics to track ad delivery, including impressions, ad start times, and errors.
- Optimize Ad Delivery: Fine-tune ad delivery rules based on metrics like user engagement and ad performance. For example, optimize ad durations or frequency based on user interaction.
Step 6: Testing and Validation
Before going live, testing the full video stream with ads is essential. Ensure that the ad insertion works seamlessly across devices and network conditions.
- Test on Multiple Devices: Make sure the video player and ads are working on various devices, including desktops, mobile phones, and smart TVs.
- Test Network Variability: Test with varying network speeds to ensure smooth playback and ad delivery. Consider using AWS Global Accelerator to enhance network performance.
Best Practices for Using MediaTailor
- Segment Your Content Properly: Ensure your video content is properly segmented to allow for clean ad breaks and smooth ad transitions.
- Integrate with Analytics: Use AWS CloudWatch and MediaTailor"s native logging to track ad performance and troubleshoot issues.
- Ad Frequency Management: Limit ad frequency to avoid user frustration. Use user session data and targeting to personalize the ad experience.
- Performance Testing: Regularly test ad delivery performance to ensure low latency and prevent buffering or playback issues during ad transitions.

