EZDRM - Playready
1Use EZDRM CPIX API to create your content encryption keys
Get response from the following url:
https://cpix.ezdrm.com/KeyGenerator/cpix.aspx?k=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&u=username&p=password&c=resourcename&m=1
URL params described below:
Parameter | Description |
---|---|
k= | Key ID value (client generated) in GUID format |
u= | EZDRM account username or email |
p= | EZDRM account password |
c= | Content Resource ID (such as a stream name or media asset name) |
m=0 or not provided | Default (returns all available keys) |
m=1 | Widevine and Playready |
m=2 | Fairplay |
2Get your content encryption keys from EZDRM XML response
EZDRM XML response example shown below:
<cpix:CPIX xmlns:cpix="urn:dashif:org:cpix" xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc" id="bunny">
<cpix:ContentKeyList>
<cpix:ContentKey kid="297f600f-1234-1234-b060-2ac13cc42585">
<cpix:Data>
<pskc:Secret>
<pskc:PlainValue>jgE7ws6lbo4GBatA0vEoKQ==</pskc:PlainValue>
</pskc:Secret>
</cpix:Data>
</cpix:ContentKey>
</cpix:ContentKeyList>
<cpix:DRMSystemList>
<cpix:DRMSystem kid="297f600f-1234-1234-b060-2ac13cc42585" systemId="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
<cpix:PSSH>AAAAdnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAFYIARIQKX9gD08XTA+wYCrBPMQlhRoIbW92aWRvbmUiMnsia2lkIjoiS1g5Z0QwOFhUQSt3WUNyQlBNUWxoUT09IiwidHJhY2tzIjpbIlNEIl19KgJTRA==</cpix:PSSH>
<cpix:ContentProtectionData/>
</cpix:DRMSystem>
<cpix:DRMSystem kid="297f600f-1234-1234-b060-2ac13cc42585" systemId="9a04f079-9840-4286-ab92-e65be0885f95">
<cpix:PSSH>AAADBnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAubmAgAAAQABANwCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlA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ndBRmNBTlFCckFHRUFSUUE5QUR3QUx3QkRBRWdBUlFCREFFc0FVd0JWQUUwQVBnQThBQzhBUkFCQkFGUUFRUUErQUR3QUx3QlhBRklBVFFCSUFFVUFRUUJFQUVVQVVnQStBQT09PC9tc3ByOnBybz4=</cpix:ContentProtectionData>
</cpix:DRMSystem>
</cpix:DRMSystemList>
</cpix:CPIX>
You need to provide four params to Qencode API in order to enable Playready DRM encryption:
-
key_id: this is the value you provided for "k" param in the URL described on step 1 above. You also can get it from "kid" attribute of cpix:ContentKey or cpix:DRMSystem tags in EZDRM XML response.
Warning: -
key: you need to get pskc:PlainValue xml tag content, decode it from base64 format and convert to hex. Here's a line in python you can use for that:
>>> 'jgE7ws6lbo4GBatA0vEoKQ=='.decode('base64').encode('hex')
'8e013bc2cea56e8e0605ab40d2f12829'
So in our example hex key value will be 8e013bc2cea56e8e0605ab40d2f12829.
- pssh:
- For Playready use cpix:PSSH xml tag content from cpix:DRMSystem tag with systemId="9a04f079-9840-4286-ab92-e65be0885f95".
- la_url:
- Should be like this: https://playready.ezdrm.com/cency/preauth.aspx?pX=XXXXXX where XXXXXX is the last 6 digits of your PlayReady Profile ID in EZDRM account
3Add a 'cenc_drm' object to your Qencode API request JSON
In our example it will be as follows:
"cenc_drm": {
"key_id" : "297f600f12341234b0602ac13cc42585",
"key" : "8e013bc2cea56e8e0605ab40d2f12829",
"pssh" : "AAADBnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAubmAgAAAQABANwCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBEADIAQgAvAEsAUgBkAFAARAAwAHkAdwBZAEMAcgBCAFAATQBRAGwAaABRAD0APQA8AC8ASwBJAEQAPgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZQB6AGQAcgBtAC4AYwBvAG0ALwBjAGUAbgBjAHkALwBwAHIAZQBhAHUAdABoAC4AYQBzAHAAeAA/AHAAWAA9AEEAMQBGAEQANABEADwALwBMAEEAXwBVAFIATAA+ADwARABTAF8ASQBEAD4AVgBsAFIANwBJAGQAcwBJAEoARQB1AFIAZAAwADYATABhAHEAcwAyAGoAdwA9AD0APAAvAEQAUwBfAEkARAA+ADwAQwBIAEUAQwBLAFMAVQBNAD4AeABMAEEAeABpAHAAVwA1AGsAYQBFAD0APAAvAEMASABFAEMASwBTAFUATQA+ADwALwBEAEEAVABBAD4APAAvAFcAUgBNAEgARQBBAEQARQBSAD4A"
}
You need to add 'cenc_drm' object as a direct child of the format object. Here's the full example:
{
"query": {
"source": "https://yourserver.com/video.mp4"
"format": [
{
"output": "advanced_dash",
"destination": {
...
},
"stream": [
{
"video_codec": "libx264",
"height": 720,
"width": 1280,
"audio_bitrate": 128,
"keyframe": 25,
"bitrate": 3100
}
],
"cenc_drm": {
"key_id" : "297f600f12341234b0602ac13cc42585",
"key" : "8e013bc2cea56e8e0605ab40d2f12829",
"pssh" : "AAADBnBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAAubmAgAAAQABANwCPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBEADIAQgAvAEsAUgBkAFAARAAwAHkAdwBZAEMAcgBCAFAATQBRAGwAaABRAD0APQA8AC8ASwBJAEQAPgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAbABhAHkAcgBlAGEAZAB5AC4AZQB6AGQAcgBtAC4AYwBvAG0ALwBjAGUAbgBjAHkALwBwAHIAZQBhAHUAdABoAC4AYQBzAHAAeAA/AHAAWAA9AEEAMQBGAEQANABEADwALwBMAEEAXwBVAFIATAA+ADwARABTAF8ASQBEAD4AVgBsAFIANwBJAGQAcwBJAEoARQB1AFIAZAAwADYATABhAHEAcwAyAGoAdwA9AD0APAAvAEQAUwBfAEkARAA+ADwAQwBIAEUAQwBLAFMAVQBNAD4AeABMAEEAeABpAHAAVwA1AGsAYQBFAD0APAAvAEMASABFAEMASwBTAFUATQA+ADwALwBEAEEAVABBAD4APAAvAFcAUgBNAEgARQBBAEQARQBSAD4A"
}
}
]
}
}