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
한국어

Packaging content with the DRM CLI Packager

Shows how to package CMAF content for Widevine, PlayReady, and FairPlay with the DoveRunner DRM CLI Packager.

Lesson 15 min

DRM: —Status: idle

Where this lesson fits

Protecting content with DoveRunner Multi-DRM takes three steps:

  1. Package your content (this lesson)
  2. Implement server-side license integration
  3. Implement client-side license integration

Packaging encrypts your video and writes the manifest that players request at playback. The rest of this course picks it up from there: the next lesson issues a license token for the content you package here, and the one after plays it.

Before you start

You need two things from DoveRunner, and a test MP4.

1. The DRM CLI Packager. On the DoveRunner docs site, go to Getting Started > Packager and Sample Downloads and select Download. That takes you to the packager's GitHub repository (doverunner/drm-cli-packager).

2. Your KMS token. The packager uses it to authenticate its requests to DoveRunner. In DoveRunner Console, open Content Security > Multi DRM > Settings and select Retrieve Secret Information to reveal it. Treat it like a password and never paste it into shared scripts or screenshots.

3. A test MP4 (H.264 video).

The packager has a few environment requirements:

  • 64-bit Windows, Linux (Ubuntu, CentOS), or macOS (Intel and Apple Silicon, run through Docker)
  • On Linux, gcc and g++ 9.0 or later
  • Free disk space of at least twice the size of your content
  • Alphanumeric characters only in input and output file names

1. Know the five parts of a packaging command

./doverunner-drm-packager --enc_token YOUR-KMS-TOKEN-VALUE --content_id demo --dash -i Test.mp4 -o ./demo
Part What it is
./doverunner-drm-packager The packager binary
--enc_token Your KMS token, from Console > Content Security > Multi DRM > Settings
--content_id Any unique ID (max 200 bytes). You will reuse it during client integration, so use the ID your CMS already has for this video, or note it down
--dash The packaging type
-i The input MP4 (or M4A) file
-o The output directory

Packaging types

Pick at least one type:

Option Result
--dash MPEG-DASH CENC with Widevine and PlayReady (Huawei WisePlay with --wiseplay_drm)
--hls HLS-AES with FairPlay Streaming
--cmaf One CMAF output for Widevine, PlayReady, and FairPlay. Can't be combined with other types
--ncg NCG DRM file for download or progressive download
--hls_ncg HLS with a SAMPLE-AES clear key protected by NCG DRM

This lesson packages with --dash, which is enough to test playback in Chrome, Firefox, and Edge. To cover Safari with FairPlay too, use --cmaf instead, or run --dash --hls together. Pass several input files to -i to package an adaptive stream with multiple resolutions.

2. Run the packager

Run the command. The packager encrypts each track and writes the manifest. When it finishes, you see:

Packaging completed successfully.

and a result code of 0 (<RESULT>0</RESULT>). Any other value is an error code. For example, 1201 means the input file isn't at the path you gave, and 2002 means the server returned an error. The packager prints more detail beside the code.

If you have an older tutorial or script that calls PallyConPackager or DoveRunnerPackager, the current executable is doverunner-drm-packager.

3. See what the packager produced

demo/
└── dash/
    ├── stream.mpd     ← the manifest your player requests
    ├── video/         ← segmented video
    └── audio/         ← segmented audio

stream.mpd is the file your player loads at playback, so its URL is the playback URL. You will paste it into the player in the last lesson.

4. Verify in DoveRunner Console

To confirm the packaging was registered, open Content Security > Multi DRM > Usage / Management and go to the DRM Packaging page. Your content ID appears in the list. It's the same value you passed to --content_id.

5. Upload and play

Upload the output folder to S3 or any web server reachable over HTTPS. Browsers require HTTPS for protected media, so a plain HTTP server won't work. At playback:

  1. The client player streams the files from your CDN.
  2. The player requests a license from the DoveRunner License Server.
  3. Once the license arrives, the player decrypts the stream and plays it.

You'll set up steps 2 and 3 over the next two lessons.

What's next

In the next lesson, generate a license token for the content ID you just used. For other packaging methods, see the DRM CLI Packager guide.