[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

How to create MPEG-CENC ClearKey content

OverviewLink Icon

This tutorial is based on this full example, which is using our Bitmovin PHP API client, however we do offer API clients in other languages as well. If you haven't created any encodings with our API clients yet, we recommend you to read the getting started guide called "Create an Encoding with our API" at first, before you continue.

1$fmp4Muxing1080p = createFmp4Muxing($apiClient, $encoding, $videoStream1080p, null, null);
2$audioFmp4Muxing128 = createFmp4Muxing($apiClient, $encoding, $audioStream128, null, null);
3$cencDrmEncodingOutput1080p = createEncodingOutput($s3Output, $outputPath . 'video/1080p/dash/drm/');

Encoding configurationLink Icon

The parameters of the configuration have the following meaning:

  • key: This is the common content encryption key
  • kid: This is the common unique identifier for your content key in hex format

We will use this information to create a CENC DRM resource, which will be created for each fMP4 Muxing you want to be encrypted using MPEG CENC ClearKey Encryption. Further we have to provide a output location, where those encrypted segments should be stored at. Therefore, we don't provide the output location with the fMP4 Muxing, but with the CENC DRM resource.

1$fmp4Muxing1080p = createFmp4Muxing($apiClient, $encoding, $videoStream1080p, null, null);
2$audioFmp4Muxing128 = createFmp4Muxing($apiClient, $encoding, $audioStream128, null, null);
3$cencDrmEncodingOutput1080p = createEncodingOutput($s3Output, $outputPath . 'video/1080p/dash/drm/');
4
5$cencDrm1080p = createCencDrm($cencDrmKey, $cencDrmKid, array($cencDrmEncodingOutput1080p));
6
7$videoFmp4Drm1080p = $apiClient->encodings()->muxings($encoding)->fmp4Muxing()->drm($fmp4Muxing1080p)->cencDrm()->create($cencDrm1080p);
8$audioCencDrmEncodingOutput128 = createEncodingOutput($s3Output, $outputPath . 'audio/128kbps/dash/drm/');
9$audioCencDrm128 = createCencDrm($cencDrmKey, $cencDrmKid, array($audioCencDrmEncodingOutput128));
10$audioFmp4Drm128 = $apiClient->encodings()->muxings($encoding)->fmp4Muxing()->drm($audioFmp4Muxing128)->cencDrm()->create($audioCencDrm128);

Hint: If you would provide a output location for the muxing as well, our API would store unencrypted segments to the given output location as well.


How to play MPEG-CENC ClearKey content?Link Icon

Now, that you are able to create this content, you most likely want to play it as well :) Therefore, please see our tutorial, how you can play MPEG-CENC ClearKey encrypted content with our Bitmovin Player

Give us feedback