Lab
  • DRM packaging tutorialsCourse
  • 5 things you need to know about multi-DRMCourse
  • Getting started with Doverunner Anti PiracyCourse
  • Getting started with Doverunner Forensic WatermarkingCourse
  • Getting started with Doverunner Mobile App SecurityCourse
  • Getting started with Doverunner Multi-DRMCourse
  • Getting started with Doverunner Transcoding & PackagingCourse
  • Packaging content with the DRM CLI PackagerLesson · DRM packaging tutorials
한국어

Multi-DRM packaging with AWS Elemental MediaConvert

Shows, with a real job run, how one AWS Elemental MediaConvert job produces DRM-encrypted DASH and HLS with Doverunner Multi-DRM.

Lesson 25 min

DRM: —Status: idle

Transcript
Multi-DRM packaging with AWS Elemental MediaConvert. Encrypt DASH and HLS in one job. If you already package video with AWS Elemental MediaConvert, you can add Doverunner Multi-DRM to the same job. MediaConvert reads your source file from S3. For each output, it asks the Doverunner key server for the encryption keys, using the SPEKE protocol. It then writes encrypted DASH and HLS back to S3. DASH carries PlayReady and Widevine. HLS carries FairPlay. Your players get licenses from Doverunner. You need four things. An AWS account with access to IAM, S3, and MediaConvert. A Doverunner Console account, for your KMS token. A content ID of your choice, which Doverunner calls the CID, and which we'll use as the Resource ID. And a source video in S3. MediaConvert also needs to know which DRM systems to protect for, by their system IDs. PlayReady, Widevine, and FairPlay each have their own. In the Doverunner Console, open Multi DRM, then Settings. Click Retrieve Secret Information, and your KMS token appears here. Treat it like a password. It goes only into the key provider URL in the MediaConvert job, nowhere else. First, MediaConvert needs permission to use your S3 buckets. In IAM, open Roles and click Create role. Choose AWS service, then MediaConvert as the use case. This use case already attaches the S3 and API Gateway permissions the job needs, so there's nothing to pick. Name the role MediaConvert-role, and create it. Now open MediaConvert, go to Jobs, and click Create job. Under Input, paste the S3 URL of your source video. Leave Follow source on. The output keeps the source's native resolution and aspect ratio. Add an output group and choose DASH ISO. Give the group a name, and set the destination to an S3 path in your output bucket. MediaConvert creates two outputs by default: one for video, one for audio. Keep them separate, because Widevine needs the video and audio in separate files. Scroll to DRM encryption and turn it on. This is a Pro feature. For Resource ID, enter your content ID. Keep SPEKE version one. In System ID, enter the PlayReady and Widevine IDs, one per line. In Key provider URL, enter the Doverunner key server address, ending with your KMS token. Leave the certificate ARN blank. Playback device compatibility stays at CENC version one. Add a second output group, this time Apple HLS, with its own destination. Turn on DRM encryption. Set the encryption method to Sample AES, and the key provider type to SPEKE. Enter the same Resource ID and key provider URL, but this time use the FairPlay system ID. Note that this HLS output is protected with FairPlay, not CENC. Under AWS integration, choose Use an existing service role, and select MediaConvert-role. Now click Create. Two errors can stop you here. First, each H.264 video output needs a maximum bitrate. We set five million bits per second. Second, the HLS output needs a name modifier. Fix both, and create the job again. The job moves from Submitted to Progressing, and then to Complete. For this twelve-minute video, transcoding took about five minutes. You may see two warnings about color metadata in the source. They don't stop the job. Open your output bucket in S3. You'll find a dash folder and an HLS folder. In the DASH manifest, content protection entries now list PlayReady and Widevine, with the CENC scheme. In the HLS playlist, the key line shows Sample AES, with the FairPlay key format. To check playback, open the DRM playback tester in the Doverunner Lab Playground. Choose Custom content, and enter the DASH manifest URL of your output. Paste a license token for the same content ID. Then click Load custom content. The video plays with Widevine, and the inspector shows the license request and the key status. To recap: create the role, create the job, turn on DRM encryption in each output group, run it, and verify the output. If you want DASH and HLS from a single output group, use a CMAF group with AES-CBC encryption, which supports the most client environments. For every field and option, see the guide in Doverunner Docs. Learn more about Doverunner Multi-DRM at Doverunner Docs.

What you will build

If you already package video with AWS Elemental MediaConvert, you can add Doverunner Multi-DRM to the same job. MediaConvert reads your source file from S3 and, for each output, asks the Doverunner key server for encryption keys using the SPEKE protocol. It then writes encrypted DASH and HLS back to S3. DASH carries PlayReady and Widevine; HLS carries FairPlay. Your players get licenses from Doverunner. The video above is the output of this exact job.

Before you start

  • AWS account with access to IAM, S3, and MediaConvert
  • Doverunner Console account (console.doverunner.com) for your KMS token
  • A content ID (CID) of your choice. You enter it as the Resource ID in MediaConvert and use the same CID in your license integration
  • A source video in S3
  • MediaConvert DRM encryption is a Pro feature of the MediaConvert job settings
DRM system System ID
PlayReady 9a04f079-9840-4286-ab92-e65be0885f95
Widevine edef8ba9-79d6-4ace-a3c8-27dcd51d21ed
FairPlay 94ce86fb-07ff-4f43-adb8-93d2fa968ca2

1. Get the KMS token

In Doverunner Console, go to Multi DRM > Settings and select Retrieve Secret Information. Your KMS token appears in the KMS Token row. Treat it like a password: it goes only into the key provider URL of the MediaConvert job.

The key provider URL has this form:

https://drm-kms.doverunner.com/v1/cpix/getKey?enc-token=<KMS token>

2. Create the IAM role

MediaConvert needs permission to use your S3 buckets. In the AWS IAM console, go to Roles > Create role, choose AWS service, and select MediaConvert as the use case. This use case already attaches AmazonS3FullAccess and AmazonAPIGatewayInvokeFullAccess, so there is nothing to pick. Name the role MediaConvert-role and create it.

3. Create the job and set the input

In the MediaConvert console, go to Jobs > Create job. Under Input, enter the S3 URL of your source video. Leave Follow source on so the output keeps the source's resolution and aspect ratio.

4. DASH output group (PlayReady + Widevine)

  1. Select Add output group and choose DASH ISO.
  2. Name the group, and set Destination to a path in your output bucket, for example s3://<bucket>/lab-contents/<cid>/dash/stream.
  3. Keep the two default outputs: one H.264 video, one AAC audio. Widevine needs video and audio in separate files.
  4. Turn on DRM encryption and set:
    • Resource ID: your CID
    • SPEKE version: 1.0
    • System ID: the PlayReady and Widevine IDs, one per line (two at most)
    • Key provider URL: the URL from step 1
    • Certificate ARN: leave blank
    • Playback device compatibility: CENC v1

5. HLS output group (FairPlay)

Add a second output group, Apple HLS, with its own destination (for example .../<cid>/hls/master). Turn on DRM encryption, choose Sample AES as the encryption method and SPEKE as the key provider type. Enter the same Resource ID and key provider URL, with the FairPlay system ID.

This HLS output is protected with FairPlay (Sample AES), not CENC. FairPlay playback needs a Safari/Apple client and FairPlay set up on the Doverunner side.

6. Service role and the two common errors

Under AWS integration, choose Use an existing service role and select MediaConvert-role, then select Create. Two validation errors can stop you:

  • maxBitrate is a required property: set Max bitrate on each H.264 output (this lesson uses 5,000,000 bits/s)
  • nameModifier is a required property: set a Name modifier (for example _1080p) on the HLS output

Fix both and create the job again.

7. Run the job

The job moves from Submitted to Progressing to Complete. Transcoding the 12-minute source took about 5 minutes. You may see two warnings about missing color metadata in the source (230001, 230005); they don't stop the job.

8. Verify the output

In your output bucket you find a dash/ and an hls/ folder.

  • DASH (dash/stream.mpd): ContentProtection entries for PlayReady and Widevine, with the cenc scheme
  • HLS (hls/master.m3u8): #EXT-X-KEY:METHOD=SAMPLE-AES with the FairPlay key format com.apple.streamingkeydelivery

9. Play it with a Doverunner license

Open the DRM playback tester (Playground > DRM Tools) in Doverunner Lab. Choose Custom content, enter the DASH manifest URL of your output, paste a license token for the same content ID (generate one in License policy & token tools), and select Load custom content. In Chrome the video plays with Widevine, and the inspector shows the license request and key status.

Next steps

  • For DASH and HLS from a single output group, use a CMAF output group with AES-CBC (CBCS) encryption, which supports the most client environments.
  • For every field and option, see the AWS Elemental MediaConvert guide in Doverunner Docs.