Integrating Bitmovin Encoder with DoveRunner Multi-DRM
Overview
This tutorial walks through integrating Bitmovin CENC Encoding with DoveRunner CPIX DRM in TWO simple steps.
For a full working sample refer to the Appendix.
3 Minute Video Guide of Bitmovin CENC + DoveRunner CPIX Integration
Pre-requisites
CONTENT_ID
; your script can generate this id to uniquely identify each content.DOVERUNNER_KMS_TOKEN
; to uniquely identify and protect your request to the DoveRunner KMS. For more information on how to generate the KMS token, take a look at DoveRunner's CPIX API Guide.
Regarding DoveRunner's KMS
This tutorial uses DoveRunner's KMS version 2 as it supports Multi-Key encryption.
Applicable Use cases
- Single Key for all renditions.
- Multi-Key i.e. different keys for different renditions.
In this tutorial we will assume use case #2 (Multi-Key).
1. Get DRM information from DoveRunner
Overview
We'll be discussing Multi-Key integration (1 key for SD and 1 key for AUDIO). Implementation of the below logic can be found in the method _get_pallycon_drm_config @ cenc_drm_content_protection.py.
Steps
- Get the values from the pre-requisites section and update them respectively.
CONTENT_ID = "CONTENT_ID"
PALLYCON_KMS_URL = "https://drm-kms.doverunner.com/v2/cpix/doverunner/getKey/"
PALLYCON_ENC_TOKEN = "DOVERUNNER_KMS_TOKEN"
# Request headers
headers = {'content-type': 'application/xml'}
- Request DRM keys from DoveRunner. in this case it's been configured for the Fairplay, Widevine and Playready for 1 SD key and 1 AUDIO key.
a. `<cpix:ContentKey>` - 1 for each key.
a.1 In our use case there'd be two such elements
b. `cpix:DRMSystem` - the different DRM systems i.e Widevine/Playready/Fairplay we are requesting for each key in #1.
b.1 In our usecase there'd be 6 elements (3 for the 1st key and 3 for the 2nd.)
c. `cpix:ContentKeyUsageRule` - the intended track type (SD/HD/AUDIO) for each key
c.1 In our usecase there'd be 2 such elements are we are requesting 1 key for `SD` and another for `AUDIO`
- Parse the DoveRunner DRM response into the Pallycon_Drm_Config helper class.
2. Apply DoveRunner DRM using Bitmovin CENC API
- After getting the DoveRunner DRM configs we first split the DRM config by tracks (SD, AUDIO).
def get_drm_config_by_track(pallycon_drm_configs: typing.Dict, track: str) -> typing.Dict:
return dict(filter(lambda elem: (elem[1]).get_track() == track,pallycon_drm_configs.items()))
pallycon_drm_configs = _get_pallycon_drm_config()
audio_drm_configs = get_drm_config_by_track(pallycon_drm_configs, "AUDIO")
sd_drm_configs = get_drm_config_by_track(pallycon_drm_configs, "SD")
- Lastly we apply the
Pallycon_Drm_Config
and create the DRM Muxing by using the method _create_drm_config @ cenc_drm_content_protection.py.
FAQ
Question: Exception in _get_pallycon_drm_config @ cenc_drm_content_protection.py
Answer: This could be due to one of the following:
- Expired DoveRunner DRM token; or—
- Invalid request body.
Check with DoveRunner Support for more details.
Appendix
Working Source code
- Clone the Bitmovin GitHub repository.
- use this updated cenc_drm_content_protection_v1.2 file with the DoveRunner integration in place of the GitHub sample.
Additional reads
Review DoveRunner's Bitmovin Encoder Integration Guide to learn more about:
- The underpinnings of the SPEKE integration; or—
- The CENC integration option.
Updated 1 day ago