EZDRM

USP supports the EZDRM API for PlayReady and Widevine.

FairPlay DRM

Using EZDRM's web service, the bash script below retrieves the FairPlay DRM values from the web service and then adds it to the mp4split command to create a server manifest.

The U and P values should be replaced with your credentials (username and password).

#!/bin/bash

resp=`curl -X POST -v 'http://fps.ezdrm.com/api/keys?U=USERNAME&P=PASSWORD' -d ''`

cek16=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//KeyHEX").text'`
laurl=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//KeyUri").text'`

mp4split -o playready.ism \
  --hls.key=:${cek16:0:32} \
  --hls.key_iv=:${cek16:32:32} \
  --hls.license_server_url=${laurl} \
  --hls.playout=sample_aes_streamingkeydelivery
  test.mp4

Please note how the KeyHEX value is split into content key (the first 16 bytes) and key_iv (the second 16 bytes): the key_iv is not listed in the playlist but it is a value shared between encryption and playout. The player will receive it as part of the key request.

PlayReady (PIFF)

Using EZDRM's web service, the bash script below retrieves the PlayReady specific data from the web service and then adds it to the mp4split command to create a server manifest.

Please note this for HSS/PIFF, not DASH/CENC - see below for multi DRM CENC.

The U and P values should be replaced with your credentials (username and password).

#!/bin/bash

resp=`curl -s 'http://wvm.ezdrm.com/ws/LicenseInfo.asmx/GenerateKeys?U=USERNAME&P=PASSWORD&C=""'`

cek16=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//PlayReady/KeyHEX").text'`
kid=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//PlayReady/KeyIDGUID").text'`
laurl=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//PlayReady/LAURL").text'`

# Service returns as GUID so convert to UUID
kid16=`python -c "exec(\"import uuid,base64; print base64.b16encode(uuid.UUID(base64.b16encode(uuid.UUID('$kid').bytes_le)).bytes);\")";`

mp4split -o playready.ism \
  --iss.key=${kid16}:${cek16} \
  --iss.license_server_url=${laurl} \
  test.mp4

Widevine (CENC)

Using EZDRM's web service, the bash script below retrieves the Widevine specific data from the web service and then adds it to the mp4split command to create a server manifest.

The U and P values should be replaced with your credentials (username and password).

#!/bin/bash

resp=`curl -s 'http://wvm.ezdrm.com/ws/LicenseInfo.asmx/GenerateKeys?U=USERNAME&P=PASSWORD&C=""'`

cek=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/KeyHEX").text'`
kid=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/KeyIDHEX").text'`
pssh=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/PSSH").text'`
laurl=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/ServerURL").text'`

mp4split -o widevine.ism \
  --widevine.key=${kid}:${cek} \
  --widevine.license_server_url=${laurl} \
  --widevine.drm_specific_data=${pssh} \
  test.mp4

PlayReady (CENC)

Using EZDRM's web service, the bash script below retrieves the Widevine specific data from the web service and then adds it to the mp4split command to create a server manifest.

The U and P values should be replaced with your credentials (username and password).

#!/bin/bash

resp=`curl -s 'http://wvm.ezdrm.com/ws/LicenseInfo.asmx/GenerateKeys?U=USERNAME&P=PASSWORD&C=""'`

cek=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//PlayReady/KeyHEX").text'`
kid=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/KeyIDHEX").text'`
laurl=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//PlayReady/LAURL").text'`

mp4split -o playready.ism \
  --iss.key=${kid}:${cek} \
  --iss.license_server_url=${laurl} \
  test.mp4

CENC multiDRM

The combination of PlayReady and Widevine as CENC multiDRM is supported as well, in this setup a single key id and content key combination is valid for both PlayReady and Widevine: Common Encryption.

The U and P values should be replaced with your credentials (username and password).

To use this you would need to combine the CENC options as described above, e.g.

#!/bin/bash

resp=`curl -s 'http://wvm.ezdrm.com/ws/LicenseInfo.asmx/GenerateKeys?U=USERNAME&P=PASSWORD&C=""'`

cek=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/KeyHEX").text'`
kid=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/KeyIDHEX").text'`
laurl=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//PlayReady/LAURL").text'`
pssh=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/PSSH").text'`
serverurl=`echo $resp | python -c 'import sys, xml.etree.cElementTree as et; tree = et.parse(sys.stdin); print tree.find(".//WideVine/ServerURL").text'`

mp4split -o playready.ism \
  --iss.key=${kid}:${cek} \
  --iss.license_server_url=${laurl} \
  --widevine.key=${kid}:${cek} \
  --widevine.drm_specific_data=${pssh} \
  --widevine.license_server_url=${serverurl} \
  test.mp4