Raw key

Packager allows encrypting contents with raw key.

Synopsis

$ packager {stream_descriptor} [stream_descriptor] ... \
  --enable_fixed_key_encryption \
  --key_id <key_id> --key <key> \
  [--pssh <concatenated PSSHs>] \
  [Other options, e.g. DASH options, HLS options]

Custom PSSH(s) can be provided in –pssh. If absent, v1 common PSSH box is generated.

Examples

The examples below uses the H264 streams created in Media Encoding. Here are examples with DASH. It can be applied to HLS in a similar way.

Common PSSH:

$ packager \
  in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4 \
  in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4 \
  in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4 \
  in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4 \
  in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4 \
  --enable_fixed_key_encryption \
  --key_id abba271e8bcf552bbd2e86a434a9a5d9 \
  --key 69eaa802a6763af979e8d1940fb88392 \
  --mpd_output h264.mpd

Widevine PSSH:

$ packager \
  in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4 \
  in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4 \
  in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4 \
  in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4 \
  in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4 \
  --enable_fixed_key_encryption \
  --key_id abba271e8bcf552bbd2e86a434a9a5d9 \
  --key 69eaa802a6763af979e8d1940fb88392 \
  --pssh 000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964 \
  --mpd_output h264.mpd

Refer to player setup on how to config the DRM in Shaka Player.

Test vectors used in this tutorial

Key ID

abba271e8bcf552bbd2e86a434a9a5d9

Key ID must be 16 bytes or 32 digits in HEX.

Key

69eaa802a6763af979e8d1940fb88392

Key must be 16 bytes or 32 digits in HEX.

Widevine PSSH

000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964

The PSSH is generated using pssh-box script:

$ pssh-box.py --widevine-system-id \
  --content-id 7465737420636f6e74656e74206964 --provider widevine_test

Raw key encryption options

--enable_fixed_key_encryption
 Enable encryption with fixed key.
--enable_fixed_key_decryption
 Enable decryption with fixed key.
--key_id <32-digit hex string>
 The key id in hex string format. HEX.
--key <32-digit hex string>
 The key in hex string format.
--iv <16-digit or 32-digit hex string>
 IV in hex string format. If not specified, a random IV will be generated. This flag should only be used for testing. IV must be either 8 bytes (16 digits HEX) or 16 bytes (32 digits in HEX).
--pssh <hex string>
 One or more concatenated PSSH boxes in hex string format. If not specified, a v1 common PSSH box will be generated.