Widevine is a Hollywood grade DRM technology initially developed by Widevine Technologies and acquired by Google in 2010. For Google it was not only a technology acquisition it was also a strategic play. The acquisition opened new connections into the premium video sector and deepened also the relationship with Hollywood. Beside, that the technology fits perfect into the Google ecosystem and plays well together with Android and YouTube, which will help to expand their overall video business. Widevine is natively supported on broad range of devices and browsers such as Google Chrome Browser, Android, Chromecast, etc.
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.
Lets start with the preparation of required information we need in order to protect your content using Widevine DRM. This values will be provided by your multi DRM licensing server provider such as Irdeto, EZDRM, ExpressPlay, Axinom, etc.
$key = "0123456789abcdef0123456789abcdef"; $kid = "0123456789abcdef0123456789abcdef"; $widevinePssh = "widevine-pssh-key-in-base64";
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
- widevinePssh: This is the value for the Widevine pssh box
We will use this information to create a CENC DRM resource, which will be created for each fMP4 Muxing you want to be encrypted and protected with Widevine DRM. 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.
$fmp4Muxing1080p = createFmp4Muxing($apiClient, $encoding, $videoStream1080p, null, null); $audioFmp4Muxing128 = createFmp4Muxing($apiClient, $encoding, $audioStream128, null, null); $cencDrmEncodingOutput1080p = createEncodingOutput($s3Output, $outputPath . 'video/1080p/dash/drm/'); $cencDrm1080p = createCencDrm($cencDrmKey, $cencDrmKid, array($cencDrmEncodingOutput1080p), $widevinePssh); $videoFmp4Drm1080p = $apiClient->encodings()->muxings($encoding)->fmp4Muxing()->drm($fmp4Muxing1080p)->cencDrm()->create($cencDrm1080p); $audioCencDrmEncodingOutput128 = createEncodingOutput($s3Output, $outputPath . 'audio/128kbps/dash/drm/'); $audioCencDrm128 = createCencDrm($cencDrmKey, $cencDrmKid, array($audioCencDrmEncodingOutput128), null, $playreadyLaUrl); $audioFmp4Drm128 = $apiClient->encodings()->muxings($encoding)->fmp4Muxing()->drm($audioFmp4Muxing128)->cencDrm()->create($audioCencDrm128);