2018-08-10 18:40:10 +00:00
|
|
|
Using Raw Key
|
|
|
|
=============
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
Shaka Packager supports raw keys, for which keys and key_ids are provided to
|
|
|
|
Shaka Packager directly.
|
|
|
|
|
|
|
|
This is often used if you are managing the encryption keys yourself. It also
|
|
|
|
allows you to support multi-DRM by providing custom PSSHs.
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
Synopsis
|
|
|
|
--------
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2018-05-02 17:55:51 +00:00
|
|
|
$ packager <stream_descriptor> ... \
|
2017-10-17 23:03:08 +00:00
|
|
|
--enable_raw_key_encryption \
|
2018-05-02 17:55:51 +00:00
|
|
|
--keys <key_info_string>[,<key_info_string>]... \
|
|
|
|
[--pssh <concatenated_PSSHs>] \
|
2017-09-06 20:57:30 +00:00
|
|
|
[Other options, e.g. DASH options, HLS options]
|
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
**key_info_string** is of the form::
|
|
|
|
|
2018-05-02 17:55:51 +00:00
|
|
|
label=<label>:key_id=<key_id>:key=<key>
|
2017-10-17 22:47:43 +00:00
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
Custom PSSH(s) can be provided in *--pssh*. If neither --pssh nor
|
|
|
|
--protection_systems is specified, `v1 common PSSH box <https://goo.gl/s8RIhr>`_
|
|
|
|
is generated.
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
Examples
|
|
|
|
--------
|
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
The examples below use the H264 streams created in :doc:`encoding`.
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
* Example with pre-generated PSSH::
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
$ packager \
|
2018-08-10 18:40:10 +00:00
|
|
|
in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4,drm_label=AUDIO \
|
|
|
|
in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \
|
|
|
|
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \
|
2017-10-17 23:03:08 +00:00
|
|
|
--enable_raw_key_encryption \
|
2018-08-10 18:40:10 +00:00
|
|
|
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \
|
|
|
|
--pssh 000000317073736800000000EDEF8BA979D64ACEA3C827DCD51D21ED00000011220F7465737420636F6E74656E74206964 \
|
|
|
|
--mpd_output h264.mpd \
|
|
|
|
--hls_master_playlist_output h264_master.m3u8
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
* Common PSSH is generated if no PSSH or protection system flag is specified::
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
$ packager \
|
2017-10-17 22:47:43 +00:00
|
|
|
in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4,drm_label=AUDIO \
|
|
|
|
in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \
|
|
|
|
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \
|
2017-10-17 23:03:08 +00:00
|
|
|
--enable_raw_key_encryption \
|
2017-10-17 22:47:43 +00:00
|
|
|
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \
|
|
|
|
--mpd_output h264.mpd
|
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
* Example with FairPlay using 'cbcs' protection scheme::
|
2017-10-17 22:47:43 +00:00
|
|
|
|
|
|
|
$ packager \
|
|
|
|
in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4,drm_label=AUDIO \
|
|
|
|
in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \
|
|
|
|
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \
|
2018-08-10 18:40:10 +00:00
|
|
|
--protection_scheme cbcs \
|
2017-10-17 23:03:08 +00:00
|
|
|
--enable_raw_key_encryption \
|
2017-10-17 22:47:43 +00:00
|
|
|
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \
|
2018-08-10 18:40:10 +00:00
|
|
|
--protection_systems FairPlay \
|
|
|
|
--iv 11223344556677889900112233445566
|
|
|
|
--hls_master_playlist_output h264_master.m3u8 \
|
|
|
|
--hls_key_uri skd://testAssetID
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
* Example with multi-drm (Widevine and PlayReady)::
|
2018-07-20 00:31:28 +00:00
|
|
|
|
|
|
|
$ packager \
|
|
|
|
in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4,drm_label=AUDIO \
|
|
|
|
in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_480p_1000.mp4,stream=video,output=h264_480p.mp4,drm_label=SD \
|
|
|
|
in=h264_main_720p_3000.mp4,stream=video,output=h264_720p.mp4,drm_label=HD \
|
|
|
|
in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p.mp4,drm_label=HD \
|
|
|
|
--enable_raw_key_encryption \
|
|
|
|
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519,label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=6d76f25cb17f5e16b8eaef6bbf582d8e:key=cb541084c99731aef4fff74500c12ead \
|
2018-08-10 20:31:17 +00:00
|
|
|
--protection_systems Widevine,PlayReady \
|
2018-07-20 00:31:28 +00:00
|
|
|
--mpd_output h264.mpd
|
|
|
|
|
2018-08-06 23:12:19 +00:00
|
|
|
.. note::
|
|
|
|
|
2018-08-10 18:40:10 +00:00
|
|
|
Users are responsible for setting up the license servers and managing keys
|
|
|
|
there unless they are using a cloud service provided by the DRM provider or
|
|
|
|
third_parties.
|
2018-07-20 00:31:28 +00:00
|
|
|
|
2017-09-06 20:57:30 +00:00
|
|
|
Refer to
|
|
|
|
`player setup <https://shaka-player-demo.appspot.com/docs/api/tutorial-drm-config.html>`_
|
|
|
|
on how to config the DRM in Shaka Player.
|
|
|
|
|
|
|
|
Test vectors used in this tutorial
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
:Key ID:
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
| SD: abba271e8bcf552bbd2e86a434a9a5d9
|
|
|
|
| HD: 6d76f25cb17f5e16b8eaef6bbf582d8e
|
|
|
|
| AUDIO: f3c5e0361e6654b28f8049c778b23946
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
Key ID must be 16 bytes or 32 digits in HEX.
|
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
:Key:
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
| SD: 69eaa802a6763af979e8d1940fb88392
|
|
|
|
| HD: cb541084c99731aef4fff74500c12ead
|
|
|
|
| AUDIO: a4631a153a443df9eed0593043db7519
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
Key must be 16 bytes or 32 digits in HEX.
|
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
:Widevine PSSH:
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2020-01-23 20:18:44 +00:00
|
|
|
The PSSH 00000031707373... is generated using
|
2017-09-06 20:57:30 +00:00
|
|
|
`pssh-box script <https://github.com/google/shaka-packager/tree/master/packager/tools/pssh>`_::
|
|
|
|
|
|
|
|
$ pssh-box.py --widevine-system-id \
|
2018-08-02 21:23:14 +00:00
|
|
|
--content-id 7465737420636f6e74656e74206964 --hex
|
2017-09-06 20:57:30 +00:00
|
|
|
|
2018-08-16 00:44:19 +00:00
|
|
|
Configuration options
|
|
|
|
---------------------
|
|
|
|
|
2017-10-17 22:47:43 +00:00
|
|
|
.. include:: /options/drm_stream_descriptors.rst
|
2018-02-07 21:24:42 +00:00
|
|
|
.. include:: /options/general_encryption_options.rst
|
2017-09-06 20:57:30 +00:00
|
|
|
.. include:: /options/raw_key_encryption_options.rst
|
|
|
|
|
|
|
|
pssh-box (Utility to generate PSSH boxes)
|
2018-08-16 00:44:19 +00:00
|
|
|
-----------------------------------------
|
2017-09-06 20:57:30 +00:00
|
|
|
|
|
|
|
https://github.com/google/shaka-packager/tree/master/packager/tools/pssh
|