Live pre-roll Ad Insertion with Bitmovin

How to implement a DAI service to monetize an HLS live stream encoded by the Bitmovin Live Encoder with pre-roll advertisement

Format

At the time of writing, interoperability between Bitmovin and broadpeak.io for such a DAI service is only possible with H264 video, AAC audio and Transport Stream (.ts) segments.

High-level Workflow

  1. Create resources in broadpeak.io that will be required for the DAI service, in particular an Ad Server source for a VAST-compliant Ad Server.
  2. Configure a live encoding with Bitmovin (see below for details) and start it.
  3. When the Live encoder is ready to ingest content (which in general requires waiting for about 70 to 120 seconds), push a live contribution feed to it.
  4. Wait a few more seconds until the encoding has started and the M3U8 manifest file has been written to the Origin.
  5. At that point, Create a Live source using the manifest URL on the Origin.
  6. Create a DAI service with the Ad Pre-Roll feature that connects that Live source and the Ad Server.
  7. For optimized delivery, use a CDN distribution to only route manifest requests from your player to broadpeak.io.

Pre-Requisites

  • 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 S3 or GCS.
  • Naturally, you also need a way to push a live contribution feed to Bitmovin via RTMP, SRT or Zixi. Popular options for testing purposes are FFmpeg or OBS (Open Broadcaster System).

Bitmovin Configuration

Unfortunately, it is not currently possible to use the Bitmovin Dashboard to create a live encoding that complies with the requirements for DAI with broadpeak.io. The only avenue is therefore to use the Bitmovin API (which is recommended to operate with one of the Bitmovin SDKs).

In configuring the Bitmovin encoding, observe the following:

  • 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.
  • You can use the Default Manifest functionality to ease the creation of the HLS manifest. The default options will provide an output compatible with the broadpeak.io input requirements.

Code Sample

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, RTMP for the contribution feed (optionally generated by FFmpeg), and a dummy Ad Server.

To execute it you will need to have access to an installation of Python 3 and FFmpeg. Execution details are in the README.md file in the repository.