When performing ad insertion in VOD assets, an important consideration is that the assets should be primed, or "conditioned" for smooth insertion of mid-rolls, ensuring harmonious transitions between the content and the ads, devoid of glitches or awkward jumps. Refer to Content Conditioning for an explanation of the principles involved.
This page will explain how to condition VOD assets, using the Bitmovin VOD Encoder, with an advanced configuration that:
- Inserts IDR frames at required positions in the timeline, which we'll call cuepoints
- Ensures that media segments (video and audio) start and end at those IDR frames
- Supports multiple audio streams
- Converts, segments and conditions sidecar subtitles (in WebVTT format)
We will assume that the timing of appropriate cuepoints is coming from an external source, such as a CMS.
This example will be using the broadpeak.io Ad Proxy feature to generate an ad schedule, allowing you to use any VAST-compliant Ad Server. If you Ad Server supports the generation of VMAP, and can ingest cuepoint information, you could use it instead with a simple change.
Finally, because it is not currently possible to use the Bitmovin Dashboard to configure VOD encodings that comply with the requirements for DAI with broadpeak.io, you will need to use the Bitmovin API (through one of the Bitmovin SDKs).
At the time of writing, interoperability between Bitmovin and broadpeak.io for such a DAI service is only possible with H264 video and AAC audio, and supports DASH with fMP4 segments and HLS with TS segments.
The following steps will be required to define the full service:
The Bitmovin encoder is configured to process the VOD asset sources (see below for details). It generates DASH and HLS manifests with segmented media, conditioned for frame-accurate ad insertion.
The workflow needs to wait for a first encoding to complete, as some of the broadpeak.io resources can only be created from existing manifest URLs.
An Ad Server Source is created in broadpeak.io, using the Ad Proxy configured with a tag to a VAST-compliant Ad Server.
For example, if we want to always have a pre-roll and post-roll, and accept cuepoints as argument to the streaming URL for mid-rolls, the appropriate queries could be set to
An Asset Catalog source is created in broadpeak.io to point to the server where the encoding output resides.
We recommend that all your encoding outputs are stored in subfolders of a common folder on the origin. The Asset Catalog would therefore be using the URL to that folder.
A broadpeak.io DAI AVOD service is created, which connects the Asset Catalog to the Ad Server.
Note that the Ad Server, Asset Catalog and Service only need to be created once. They will be valid for all VOD assets encoded and stored under the same root folder on the Origin.
For optimized delivery, a CDN distribution should be used to only route manifest requests from your player to broadpeak.io.
Once the encoding has completed and all broadpeak.io resources are created, you can determine the streaming URL in the following way:
- Determine the service's streaming URL (for example by copying it from the WebApp).
- Replace the FQDN (typically
stream.broadpeak.io) with your CDN's FQDN.
- Add a query parameter to the URL to pass the cuepoint timing, eg.
- First you need a broadpeak.io account, and generate an API key.
- You also need to have an account with Bitmovin. You can sign up for a free trial on their website. Retrieve the API Key from the Dashboard.
- If the ads served by the Ad Server are not pre-transcoded, you need a Transcoding Profile in your broadpeak.io account that matches the encoding ladder that you configure in the Bitmovin encoder. Ask your broadpeak.io representative for help if you don't have a suitable one ready.
- You need a storage solution to act as the Origin, into which Bitmovin will write, and from which broadpeak.io will retrieve manifest files. For example a S3 or GCS bucket.
- Naturally, you also need sources for at least one VOD asset, and information about timing for ad opportunity placement.
In configuring the Bitmovin encoding, observe the following:
- To perform content conditioning across all streams (including subtitles) is incredibly easy. You just need to define a Keyframe for each ad opportunity placement, configuring it with the timing of the placement (provided in seconds), and indicate that segments should be spliced at those timepoints (
segmentCut = true) and associate them to the encoding. They will automatically be taken into account by the encoder and the manifest generator.
Timing and frame rate
The time provided in the configuration should correspond to the output frame that will become an IDR frame (and start of the segment before which the ad insertion will be performed). If you are performing frame rate conversion between source and output, you may need to recalculate any timing given by the content provider.
If the time set on the Keyframe does not exactly corresponds to an output frame, Bitmovin will choose the nearest frame, either before or after that timepoint, whichever is closer.
- If you use broadpeak.io to encode the ads, the Bitmovin video configurations must be defined to ensure that the stipulated H264 profile and level are guaranteed to be found in the output, or you run the risk of having non-matching variants between ads and content. If using PresetConfigurations, you may need to overwrite specific codec configuration settings, as described in this section.
- If you are generating both DASH (with fMP4) and HLS manifests (with TS), or if you are using subtitles, you cannot currently use the Default Manifest functionality. It is therefore necessary to configure Custom Manifests. However since broadpeak.io AVOD solution supports HLS without any specific markup and DASH with a single period, it is easily done.
- The Bitmovin encoder does not currently support the generation of ISOBMFF-wrapped subtitles, which is the recommended way to use subtitles in DASH manifests. However, the Bitmovin Players support segmented "raw" WebVTT on most platforms, which enables the same subtitles to be used for both HLS and DASH delivery.
- If you have subtitles to process and add into your DASH output, ensure that you use encoder version v2.175.0 or above.
A full end-to-end code example is provided (in Python) in the playbooks-bitmovin Github repository. It demonstrates the workflow above, using S3 as an origin, allows multiple audio streams (from different files), and SRT or WebVTT sidecar subtitles as input.
To execute it you will need to have access to an installation of Python 3. Execution details can be found in the README.md file in the repository. The configuration is performed through a YAML file, which contains all necessary instructions.
The scripts will also automatically create the broadpeak.io objects. Note that those only need to be created once. You can thereafter modify the script and enter the identifiers of those objects. This will allow you to easily re-run the script to transcode other VOD assets into the same output server, allowing you to immediately test playback. If you do not, you will likely get errors telling you you cannot create multiple objects with the same URLs.
The script will also calculate the complete streaming URLs, allowing you to test them in a player of your choice.
If you are using broadpeak.io to transcode the ads, note that the first time you start the stream, no ad insertion will have been performed, as the ads need to be transcoded. You will see the ads if you re-run the stream a few minutes later.
Updated about 1 month ago