Skip to content

DoveRunner DRM CLI Packager Guide

This document describes the basic concepts and how to use the command line interface (CLI) based content packaging tool used for the DoveRunner multi-DRM cloud service.

There are five types of content packaging:

  1. DASH: A method of applying PlayReady, Widevine Modular, or Huawei WisePlay DRM by packaging streaming contents with MPEG-DASH CENC standard.
  2. HLS: A method of applying FPS (FairPlay Streaming) DRM by packaging HLS-AES streaming contents.
  3. CMAF: Applying PlayReady, Widevine, and FairPlay DRM by packaging contents with CMAF(Common Media Application Format) type.
  4. NCG: Content encryption by DoveRunner’s proprietary NCG (Netsync Content Guard) DRM for downloading or progressive download scenario.
  5. HLS-NCG: HLS content packaging with SAMPLE-AES clear key protected by NCG DRM.

This guide is based on the 4.1.0 version of CLI packager. You can download the latest CLI packager from the Github repository.

This is a tutorial video about explaining the DoveRunner DRM CLI Packager and how to use it in Windows OS.

Integration architecture and supported environments

Section titled “Integration architecture and supported environments”

Packaging Flow

DoveRunner DRM CLI Packager works in conjunction with DoveRunner Multi DRM Cloud Server. DoveRunner cloud server manages the content key information for each service site, and when a client requests DRM license information, it finds the key (CEK) information associated with the CID and issues a license.

  • Supported OS: Support 64 bit Windows, Linux (Ubuntu, CentOS), macOS (Intel, Apple Silicon)
  • For Linux environment, gcc and g ++ library version 9.0 or later must be installed.
  • macOS environment is supported by running Ubuntu builds using Docker.
  • Available disk space should be at least twice the size of the contents for packaging.
  • Only alphanumeric characters are allowed for input / output filenames.

DoveRunner DRM CLI Packager is based on Google’s Shaka Packager. Please refer to Github page for details, documentation and source code of Shaka Packager.

In Linux environments, specific versions of libraries may be required depending on the OS distribution and version.

For Ubuntu 18.04 and earlier, because it requires a higher version of the glibc library, install gcc/g++ version 9 as below:

Terminal window
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt update
$ sudo apt install gcc-9 g++-9
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 --slave /usr/bin/g++ g++ /usr/bin/g++-9

For Ubuntu version 22.04 or later, because only OpenSSL version 3.x is installed by default, install version 1.1.x as below:

Terminal window
$ sudo apt-get update
$ sudo apt-get install -y gcc make perl wget
$ wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
$ sudo tar -zxvf openssl-1.1.1o.tar.gz
$ cd openssl-1.1.1o
$ ./config && make
$ export LD_LIBRARY_PATH=<installed_directory_path>:$LD_LIBRARY_PATH

Install the c-ares library with version 1.16.0 or later as below:

Terminal window
$ sudo yum c -y "Development Tools"
$ wget https://c-ares.haxx.se/download/c-ares-1.16.1.tar.gz
$ sudo tar -zxvf c-ares-1.16.1.tar.gz
$ cd c-ares-1.16.1
$ ./configure && make
$ sudo make install
$ sudo ldconfig
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

DRM CLI Packager v3.9.0 or later supports macOS environment in the following ways.

  1. Create Dockerfile: Create Dockerfile with the following script.
FROM ubuntu:20.04
RUN apt update
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y git
RUN git clone https://github.com/inka-pallycon/pallycon-drm-cli-packager.git
RUN chmod 755 /pallycon-drm-cli-packager/bin/Ubuntu/aarch64/PallyConPackager
ENTRYPOINT ["/pallycon-drm-cli-packager/bin/Ubuntu/aarch64/PallyConPackager"]
  1. Build Ubuntu Image: Build an Ubuntu image using the Dockerfile you created.
Terminal window
docker build -t <user-name>/ubuntu-packager .
  1. Run packager command: Run the packager with the following example command in the Ubuntu container.
Terminal window
docker run \
-v /Users/my/workspace/contents:/contents \
-v /Users/my/workspace/packaging-output:/packaging-output \
-it \
--rm \
<user-name>/ubuntu-packager \
-o /packaging-output -i /contents/sintel/Sintel.2010.480P.mp4 --disable_encryption --dash

You can use additional Shaka Packager commands in the command format below.

./PallyConPackager --enc_token value --content_id value -i value -o value (--dash || --hls || --cmaf || --ncg || --hls_ncg)
NameTypeRequiredDescription
--enc_tokenstringY (for CPIX communication)KMS token value used for CPIX API communication with DoveRunner KMS. You can check it on the Multi DRM > DRM Settings screen of the DoveRunner console.
--site_idstringY (for the old proprietary communication)DoveRunner service site ID (4 bytes) used for the old type proprietary communication. You can check it on the Multi DRM > DRM Settings screen of the DoveRunner console.
--access_keystringY (for the old proprietary communication)An authentication key issued to the service site. You can check it on the DoveRunner console site the same as site_id value.
--content_idstringYUnique ID of the content being packaged. Enter the ID value managed by the customer’s CMS, and the same CID must be used in the subsequent client integration step. (Maximum 200 bytes)
--cmafboolY (Must input at least one of the five packaging type parameters)Perform CMAF packaging which supports three multi-DRM (Widevine, PlayReady, FPS) with a single content. Cannot be processed simultaneously with other types of packaging.
--dashboolPerform DASH-CENC(Widevine, PlayReady) packaging
--hlsboolPerform HLS-AES (FPS) packaging
--ncgboolPerform NCG packaging
--hls_ncgboolPerform HLS-AES (NCG) packaging. Generate HLS-AES content to protect keys using NCG DRM. Cannot be apply with other packaging types such as --dash and --hls.
-i (--input_file)stringYSource filename. Enable adaptive streaming if two or more files are input.
[Additional options] Add after the source filename in :{key}={value} format with no special character in the value.
- :name Name of video/audio track (e.g. :name=1080p or :name='English Audio') Can input space, period, and underscore characters.
- :lang Language code(ISO 639-1, lowercase two-letter) of audio track (e.g. :lang=en)
- :video_bandwidth Video track bandwidth(bps) (e.g. :video_bandwidth=5000000)
-o (--output_dir)stringNOutput folder name.
Default: Create an output directory at the current location (add the -f command to allow folders and files to be overwritten)
--config_filestringNConfig filename with fixed options such as Site ID and access key. Json and XML standards are supported. The default is Json (xml parsing is applied if the file extension is xml)
--clear_leadnumberNApply clear(unencrypted) part at the beginning of the packaged content. Default: 0 (second)
--skip_audio_encryptionboolNDisable audio track encryption. Default: false(encrypt audio)
--multi_keyboolNApply multiple key sets for each track. Cannot be applied to NCG packaging.
--max_sd_heightnumberNMax resolution to be packaged as SD track. Default: 480
--max_hd_heightnumberNMax resolution to be packaged as HD track. Default: 1080
--max_uhd1_heightnumberNMax resolution to be packaged as UHD track. Default: 2160
--fragment_durationnumberNFragment duration (seconds)
--segment_durationnumberNSegment duration (seconds)
--on_demandboolNApply on-demand profile in DASH packaging.
If omitted or ‘N’, live profile is used.
--output_single_fileboolNSet HLS packaging output as fMP4 file
--mpd_filenamestringNFilename of DASH manifest (.mpd)
--m3u8_filenamestringNFilename of HLS master manifest (.m3u8)
--subtitlestringNFilename of subtitles
[Additional options] Add after the subtitle filename in :{key}={value} format with no special character in the value.
- :name Name of subtitle language (e.g. :name=English)
- :lang Language code(ISO 639-1, lowercase two-letter) of subtitle (e.g. :lang=en)
--mp4_subtitleboolNWhen entering subtitles with the --subtitle parameter, the output subtitle format can be set to Embedded MP4 with this parameter. If the parameter is omitted, the subtitle in Text VTT format is created by default.
- :format Internal formatting within the MP4 container(e.g. :format=ttmlor :format=vtt)
--generate_tracktype_manifestsboolNCreate multiple manifest (playlist) files for multi-key packaging. For adaptive streams containing SD to UHD tracks, three manifests are created: ‘SD_ONLY’, ‘SD_HD’, and ‘SD_UHD’.
--enable_average_bandwidth_mpdboolNApply the bandwidth of each track in the MPD file as an average value instead of the maximum value (default: false)
--skip_pallycon_custom_infoboolNDon’t input Custom Info to manifest files(mpd, m3u8) (default: false)
--stop_indicatorboolNHide packaging status indicator
--quietboolNHide packaging logs
--license_urlstringNLicense acquisition URL. Required when using external key.
Default: https://drm-license.doverunner.com/ri/licenseManager.do
--generate_psshboolNWhen this option is applied, the PSSH value generated by the packager itself is used instead of getting the value from the key server.
--ascending_track_order_in_manifestboolNWhen this option is applied, video tracks in the manifest of ABR content are sorted in ascending order according to their bandwidth. If not applied, sort in descending order (default)
--wiseplay_drmboolNApply WisePlay DRM for Huawei devices to DASH packaging when this option is applied. Must be used with the --dash option.

This option is used when packaging with a key that is managed separately by the service site, without using the encryption key generated by DoveRunner key server.

When using external keys, parameters such as --enc_token, --site_id, and --access_key are not used because it does not require communication with the DoveRunner key server.

NameTypeRequiredDescription
--enable_raw_key_encryptionboolYEnable the use of external key
--providerstringNDRM Provider name for Widevine PSSH
Default: doverunner
--keysstringYEncryption key and key ID pair (16byte HEX string)
label=:key_id=16byte_hex:key=16byte_hex
--ncg_cekstringY (for NCG DRM packaging)32 bytes key for NCG DRM (HEX)
--ivstringY (for HLS-FPS packaging)16 bytes initial vector (HEX)
--psshstringNPlayReady, Widevine PSSH data
<?xml version="1.0" encoding="UTF-8"?>
<PallyconPackager>
<RESULT>0</RESULT>
</PallyconPackager>

RESULT: ‘0’ if succeeded. Error code if failed.

Error CodeDescription
0Succeeded
1101None of the argument values after the run command are passed.
1102An invalid parameter value was entered. (Please refer to INFO.)
1103The number of the following argument values is not correct.
1201The file is not located in the specified path.
1202Can not access file. (Permission / file name problem)
1203Creation failed because the path to the file / folder is too long.
1204Creation failed because file / folder name is too long.
1205File / folder creation failed due to insufficient storage space.
1206Moving to that location in the file failed.
1207Failed to get file size.
2001An error occurred while sending the request to the server.
2002An error was returned from the server. (Please refer to INFO.)
2003Invalid block size.
2004You do not have a private key.
2005Invalid private key.

PlayReady, Widevine DRM-protected DASH stream packaging. Usually run with HLS packaging. (type --dash --hls)

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --dash -i ./input/test-content-1.mp4 -o ./output/test-content-1

FairPlay Streaming DRM-protected HLS stream packaging. Usually run with DASH packaging. (type --dash --hls)

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --hls -i ./input/test-content-1.mp4 -o ./output/test-content-1

PlayReady, Widevine, FPS DRM-protected CMAF stream packaging.

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --cmaf -i ./input/test-content-1.mp4 -o ./output/test-content-1

HLS stream packaging that protects clear keys of SAMPLE-AES with NCG DRM. This cannot be done along with other types of packaging such as DASH or HLS(FPS).

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --hls_ncg -i ./input/test-content-1.mp4 -o ./output/test-content-1

NCG DRM-encoded MP4 file packaging used for download or progressive download scenarios. (creates .ncg extension file)

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --ncg -i ./input/test-content-1.mp4 -o ./output/test-content-1

You can use the below command to package DASH content protected by WisePlay DRM for support on Huawei devices.

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --dash --wiseplay_drm -i ./input/test-content-1.mp4 -o ./output/test-content-1

For DASH or HLS packaging, you can enter content with multiple resolutions and package it for adaptive streaming.

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 --dash --hls -i ./input/test-content-1-480p.mp4 ./input/test-content-1-720p.mp4 ./input/test-content-1-1080p.mp4 -o ./output/test-content-1

This is a method of multi DRM packaging using the key managed by the service site instead of the encryption key generated by DoveRunner key server.

Terminal window
./PallyConPackager --content_id test-content-1 --dash --hls --enable_raw_key_encryption --keys label=:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519 -i ./input/test-content-1.mp4 -o ./output/test-content-1

This is a method of packaging NCG DRM using the key managed by the service site instead of the encryption key generated by DoveRunner key server.

Terminal window
./PallyConPackager --site_id SITE --content_id test-content-1 --enable_raw_key_encryption --ncg_cek a4631a153a443df9eed0593043db7519f3c5e0361e6654b28f8049c778b23946 --ncg --hls_ncg -i ./input/test-content-1.mp4 -o ./output/test-content-1

It is a method to save fixed setting values among input parameters as a separate config file.

Terminal window
./PallyConPackager --config_file ./config.txt --content_id test-content-1 -i ./input/test-content-1.mp4 -o ./output/test-content-1
  • config.txt (Default = Json)

    {
    "site_id": "SITE",
    "access_key": "DgBluIlxajZpPPjSIuqS6NcknqqG7RCt"
    }
  • config.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <config>
    <site_id>SITE</site_id>
    <access_key>DgBluIlxajZpPPjSIuqS6NcknqqG7RCt</access_key>
    </config>

Supports external subtitles in VTT format only.

Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 -i ./input/test-content-1.mp4 -o ./output/test-content-1 --dash --hls --subtitle ./input/test-content-1-en.vtt:lang=en:name=English ./input/test-content-1-ko.vtt:lang=ko:name=Korean ./input/test-content-1-fr.vtt:lang=fr:name=French ...
Terminal window
./PallyConPackager --enc_token YOUR-KMS-TOKEN-VALUE --content_id test-content-1 -i ./input/test-content-1-720p.mp4 ./input/test-content-1-1080p.mp4 -o ./output/test-content-1 --dash --multi_key
Terminal window
./PallyConPackager --content_id test-content-1 --dash --enable_raw_key_encryption --keys label=SD:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519, label=HD:key_id=8f8049c778b23946f3c5e0361e6654b2:key=eed0593043db7519a4631a153a443df9, label=AUDIO:key_id=e0361e6654b28f80f3c549c778b23946:key=1a153a443df9eed0a463593043db7519 -i ./input/test-content-1-480p.mp4 ./input/test-content-1-720p.mp4 ./input/test-content-1-audio.m4a -o ./output/test-content-1

Multiple manifests for allowed track types

Section titled “Multiple manifests for allowed track types”
Terminal window
./PallyConPackager --site_id <site id> --access_key <access key> --content_id <content id> -o <output directory> --dash --multi_key -i <input file1> <input file2> ... --generate_tracktype_manifests