[object Object] Icon

Learn how to create, start, manage and modify Encodings

[object Object] Icon

Learn how to create, start, manage and modify Players

[object Object] Icon

Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Tue Mar 01 2022

Integrating Bitmovin Encoder with PallyCon Multi-DRM

OverviewLink Icon

This tutorial walks through integrating Bitmovin CENC Encoding with PallyCon CPIX DRM in TWO simple steps.

For a full working sample refer to the Appendix

3 Minute Video Guide of Bitmovin CENC + Pallycon CPIX IntegrationLink Icon

Pre-requisitesLink Icon

  1. CONTENT-ID ; your script can generate this id to uniquely identify each content
  2. KMS version ; this tutorial uses PallyCon KMS version 2 as it supports multi-key encryption
  3. PallyCon KMS URL ; most of the time it looks like this https://kms.pallycon.com/v2/cpix/pallycon/getKey/
  4. KMS token ; to uniquely identify and protect your request to the PallyCon KMS

Screenshot from the PALLYCON portal PallyCon-Portal

Applicable Use casesLink Icon

  1. Single Key for all renditions

  2. Multi-key i.e different keys for different renditions

In this tutorial we'll run through use case #2 i.e Multi-Key

1. Get DRM information from PallyConLink Icon


We'll be discussing multi-key integration i.e 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


  1. Get the values from the pre-requisites section and update them respectively
1CONTENT_ID = "my-unique_content_id"
2PALLYCON_KMS_URL = "https://kms.pallycon.com/v2/cpix/pallycon/getKey/"
5# Request headers
6headers = {'content-type': 'application/xml'}
  1. Request DRM keys from PallyCon. in this case it's been configured for the Fairplay, Widevine and Playready for 1 SD key and 1 AUDIO key.
1 a. `<cpix:ContentKey>` - 1 for each key.
2 a.1 In our use case there'd be two such elements
3 b. `cpix:DRMSystem` - the different DRM systems i.e Widevine/Playready/Fairplay we are requesting for each key in #1.
4 b.1 In our usecase there'd be 6 elements (3 for the 1st key and 3 for the 2nd.)
5 c. `cpix:ContentKeyUsageRule` - the intended track type (SD/HD/AUDIO) for each key
6 c.1 In our usecase there'd be 2 such elements are we are requesting 1 key for `SD` and another for `AUDIO`
  1. Parse the PallyCon DRM response into the Pallycon_Drm_Config helper class

2. Apply PallyCon DRM using Bitmovin CENC APILink Icon

  1. After getting the PallyCon drm configs we first split the DRM config by tracks i.e SD/AUDIO
1 def get_drm_config_by_track(pallycon_drm_configs: typing.Dict, track: str) -> typing.Dict:
2 return dict(filter(lambda elem: (elem[1]).get_track() == track,pallycon_drm_configs.items()))
4 pallycon_drm_configs = _get_pallycon_drm_config()
5 audio_drm_configs = get_drm_config_by_track(pallycon_drm_configs, "AUDIO")
6 sd_drm_configs = get_drm_config_by_track(pallycon_drm_configs, "SD")
  1. Lastly we apply the Pallycon_Drm_Config and create the DRM Muxing by using the method _create_drm_config @ cenc_drm_content_protection.py


FAQLink Icon

Question: Exception in _get_pallycon_drm_config @ cenc_drm_content_protection.py

Answer: This could be due to an

  1. expired PallyCon DRM token OR
  2. invalid request body

Kindly check with your PallyCon contact for more details.

AppendixLink Icon

WORKING Source code

  1. Clone the Bitmovin GitHub repository
  2. use this updated cenc_drm_content_protection.py file w/ the PallyCon integation in place of the GitHub sample

Additional reads

  1. the underpinnings of the SPEKE integration OR
  2. the CENC integration option

please visit the reference By PallyCon.

Give us feedback