LHG/W3C EME Clearkey Mechanism With OP-TEE

To Realize the W3C EME Clearkey mechanism, we need to install some tools to generate the contents in server side.

  • ffmpeg
    • The ffmpeg is for transcoding and transrating media data.
    $ sudo apt install ffmpeg
  • GPAC
    • The GPAC is for media data encryption and generate the DASH description file(mpd).
    $ sudo apt install gpac


The server side contents

We use bigBuckBunny.mp4 as an example and assume encrypt the track 1 data.

  1. generate the clearkey_drm.xml file.
    • $ java -jar clearkey/cryptgen/clearkey.jar 1:20212223-2425-2627-2829-2A2B2C2D2E2F=15161718191A1B1C1D1E1F2021222324 -out clearkey_drm.xml
  2. generate the encrypt media

    $ MP4Box -crypt clearkey_drm.xml BigBuckBunny.mp4 -out BigBuckBunny_enc.mp4

  3. generate Dynamic Adaptive Streaming over HTTP (DASH) for the encrypt media, then we will have the BigBuckBunny_enc.mpd and BigBuckBunny_enc_track1_dashinit.mp4 files.

    $ MP4Box -dash 1000 -profile onDemand -out BigBuckBunny_enc.mpd BigBuckBunny_enc.mp4#video

  4. put the BigBuckBunny_enc.mpd and BigBuckBunny_enc_track1_dashinit.mp4 into the wed server folder for ex.

    • /var/www/ or
    • /home/someone/public_html/

Web Server Configuration(Apache)

Add the following items into web server(apache) configuration file.

Header set Access-Control-Allow-Origin "*"

Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"

Header set Access-Control-Max-Age "1000"

Header set Access-Control-Expose-Headers: "Server,range,Content-Length,Content-Range"

Header set Access-Control-Allow-Headers "range,x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

The Client side player(Exoplayer)

  1. Modify the Android clearkey plugin to use [optee-clearkey-cdmi|https://github.com/showliu/optee-clearkey-cdmi.git] instead of openssl library.

  2. add the encrypted content link into the Exoplayer play list. for ex.
    • }
  3. chmod the /dev/tee* to 777

LHG/W3CEMEClearkeyMechanismWithOPTEE (last modified 2018-01-19 08:43:01)