2017-09-20 02:35:05 +00:00
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > Raw key — Shaka Packager documentation< / title >
< link rel = "stylesheet" href = "../_static/sphinxdoc_new.css" type = "text/css" / >
< link rel = "stylesheet" href = "../_static/pygments.css" type = "text/css" / >
< link rel = "stylesheet" href = "../_static/table_styling.css" type = "text/css" / >
< script type = "text/javascript" >
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
< / script >
< script type = "text/javascript" src = "../_static/jquery.js" > < / script >
< script type = "text/javascript" src = "../_static/underscore.js" > < / script >
< script type = "text/javascript" src = "../_static/doctools.js" > < / script >
< script type = "text/javascript" src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" > < / script >
< link rel = "index" title = "Index" href = "../genindex.html" / >
< link rel = "search" title = "Search" href = "../search.html" / >
< link rel = "next" title = "Widevine" href = "widevine.html" / >
< link rel = "prev" title = "DRM" href = "drm.html" / >
< / head >
< body role = "document" >
< div class = "related" role = "navigation" aria-label = "related navigation" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../genindex.html" title = "General Index"
accesskey="I">index< / a > < / li >
< li class = "right" >
< a href = "widevine.html" title = "Widevine"
accesskey="N">next< / a > |< / li >
< li class = "right" >
< a href = "drm.html" title = "DRM"
accesskey="P">previous< / a > |< / li >
< li class = "nav-item nav-item-0" > < a href = "../index.html" > Shaka Packager documentation< / a > » < / li >
< li class = "nav-item nav-item-1" > < a href = "tutorials.html" > Tutorials< / a > » < / li >
< li class = "nav-item nav-item-2" > < a href = "drm.html" accesskey = "U" > DRM< / a > » < / li >
< / ul >
< / div >
< div class = "sphinxsidebar" role = "navigation" aria-label = "main navigation" >
< div class = "sphinxsidebarwrapper" >
< h3 > < a href = "../index.html" > Table Of Contents< / a > < / h3 >
< ul >
< li > < a class = "reference internal" href = "#" > Raw key< / a > < ul >
< li > < a class = "reference internal" href = "#synopsis" > Synopsis< / a > < / li >
< li > < a class = "reference internal" href = "#examples" > Examples< / a > < ul >
< li > < a class = "reference internal" href = "#test-vectors-used-in-this-tutorial" > Test vectors used in this tutorial< / a > < / li >
2017-10-24 22:51:02 +00:00
< li > < a class = "reference internal" href = "#drm-related-stream-descriptor-fields" > DRM related Stream descriptor fields< / a > < / li >
2017-09-20 02:35:05 +00:00
< li > < a class = "reference internal" href = "#raw-key-encryption-options" > Raw key encryption options< / a > < / li >
< li > < a class = "reference internal" href = "#pssh-box-utility-to-generate-pssh-boxes" > pssh-box (Utility to generate PSSH boxes)< / a > < / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 > Previous topic< / h4 >
< p class = "topless" > < a href = "drm.html"
title="previous chapter">DRM< / a > < / p >
< h4 > Next topic< / h4 >
< p class = "topless" > < a href = "widevine.html"
title="next chapter">Widevine< / a > < / p >
< div role = "note" aria-label = "source link" >
< h3 > This Page< / h3 >
< ul class = "this-page-menu" >
< li > < a href = "../_sources/tutorials/raw_key.rst.txt"
rel="nofollow">Show Source< / a > < / li >
< / ul >
< / div >
< div id = "searchbox" style = "display: none" role = "search" >
< h3 > Quick search< / h3 >
< form class = "search" action = "../search.html" method = "get" >
< div > < input type = "text" name = "q" / > < / div >
< div > < input type = "submit" value = "Go" / > < / div >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
< script type = "text/javascript" > $ ( '#searchbox' ) . show ( 0 ) ; < / script >
< / div >
< / div >
< div class = "document" >
< div class = "documentwrapper" >
< div class = "bodywrapper" >
< div class = "body" role = "main" >
< div class = "section" id = "raw-key" >
< h1 > Raw key< a class = "headerlink" href = "#raw-key" title = "Permalink to this headline" > ¶< / a > < / h1 >
< p > < em > Packager< / em > allows encrypting contents with raw key.< / p >
< div class = "section" id = "synopsis" >
< h2 > Synopsis< a class = "headerlink" href = "#synopsis" title = "Permalink to this headline" > ¶< / a > < / h2 >
< div class = "highlight-default" > < div class = "highlight" > < pre > < span > < / span > $ packager {stream_descriptor} [stream_descriptor] ... \
2017-10-24 22:51:02 +00:00
--enable_raw_key_encryption \
--keys < key_info_string[,key_info_string][,key_info_string]...> \
2017-09-20 02:35:05 +00:00
[--pssh < concatenated PSSHs> ] \
[Other options, e.g. DASH options, HLS options]
< / pre > < / div >
< / div >
2017-10-24 22:51:02 +00:00
< p > < strong > key_info_string< / strong > is of the form:< / p >
< div class = "highlight-default" > < div class = "highlight" > < pre > < span > < / span > < span class = "n" > label< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "n" > label< / span > < span class = "p" > }:< / span > < span class = "n" > key_id< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "n" > key_id< / span > < span class = "p" > }:< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "n" > key< / span > < span class = "p" > }< / span >
< / pre > < / div >
< / div >
2017-09-20 02:35:05 +00:00
< p > Custom PSSH(s) can be provided in < em > – pssh< / em > . If absent,
< a class = "reference external" href = "https://goo.gl/s8RIhr" > v1 common PSSH box< / a > is generated.< / p >
< / div >
< div class = "section" id = "examples" >
< h2 > Examples< a class = "headerlink" href = "#examples" title = "Permalink to this headline" > ¶< / a > < / h2 >
2017-10-24 22:51:02 +00:00
< p > The examples below uses the H264 streams created in < a class = "reference internal" href = "encoding.html" > < span class = "doc" > Media Encoding< / span > < / a > . Here are
examples with DASH. It can be applied to HLS in a similar way.< / p >
< p > Common PSSH (one key for all streams):< / p >
2017-09-20 02:35:05 +00:00
< div class = "highlight-default" > < div class = "highlight" > < pre > < span > < / span > $ 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 \
2017-10-24 22:51:02 +00:00
--enable_raw_key_encryption \
--keys label=:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392 \
2017-09-20 02:35:05 +00:00
--mpd_output h264.mpd
< / pre > < / div >
< / div >
2017-10-24 22:51:02 +00:00
< p > Common PSSH (different keys for different streams):< / p >
2017-09-20 02:35:05 +00:00
< div class = "highlight-default" > < div class = "highlight" > < pre > < span > < / span > $ packager \
2017-10-24 22:51:02 +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 \
--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 \
--mpd_output h264.mpd
< / pre > < / div >
< / div >
< p > Widevine PSSH (different keys for different streams):< / p >
< div class = "highlight-default" > < div class = "highlight" > < pre > < span > < / span > $ 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 \
2017-09-20 02:35:05 +00:00
--pssh 000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964 \
--mpd_output h264.mpd
< / pre > < / div >
< / div >
< p > Refer to
< a class = "reference external" href = "https://shaka-player-demo.appspot.com/docs/api/tutorial-drm-config.html" > player setup< / a >
on how to config the DRM in Shaka Player.< / p >
< div class = "section" id = "test-vectors-used-in-this-tutorial" >
< h3 > Test vectors used in this tutorial< a class = "headerlink" href = "#test-vectors-used-in-this-tutorial" title = "Permalink to this headline" > ¶< / a > < / h3 >
2017-10-24 22:51:02 +00:00
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field-odd field" > < th class = "field-name" > Key ID:< / th > < td class = "field-body" > < div class = "first line-block" >
< div class = "line" > SD: abba271e8bcf552bbd2e86a434a9a5d9< / div >
< div class = "line" > HD: 6d76f25cb17f5e16b8eaef6bbf582d8e< / div >
< div class = "line" > AUDIO: f3c5e0361e6654b28f8049c778b23946< / div >
< / div >
2017-09-20 02:35:05 +00:00
< p > Key ID must be 16 bytes or 32 digits in HEX.< / p >
2017-10-24 22:51:02 +00:00
< / td >
< / tr >
< tr class = "field-even field" > < th class = "field-name" > Key:< / th > < td class = "field-body" > < div class = "first line-block" >
< div class = "line" > SD: 69eaa802a6763af979e8d1940fb88392< / div >
< div class = "line" > HD: cb541084c99731aef4fff74500c12ead< / div >
< div class = "line" > AUDIO: a4631a153a443df9eed0593043db7519< / div >
< / div >
2017-09-20 02:35:05 +00:00
< p > Key must be 16 bytes or 32 digits in HEX.< / p >
2017-10-24 22:51:02 +00:00
< / td >
< / tr >
< tr class = "field-odd field" > < th class = "field-name" > Widevine PSSH:< / th > < td class = "field-body" > < p class = "first" > 000000407073736800000000edef8ba979d64acea3c827dcd51d21ed000000201a0d7769646576696e655f74657374220f7465737420636f6e74656e74206964< / p >
2017-09-20 02:35:05 +00:00
< p > The PSSH is generated using
< a class = "reference external" href = "https://github.com/google/shaka-packager/tree/master/packager/tools/pssh" > pssh-box script< / a > :< / p >
2017-10-24 22:51:02 +00:00
< div class = "last highlight-default" > < div class = "highlight" > < pre > < span > < / span > $ pssh-box.py --widevine-system-id \
2017-09-20 02:35:05 +00:00
--content-id 7465737420636f6e74656e74206964 --provider widevine_test
< / pre > < / div >
< / div >
2017-10-24 22:51:02 +00:00
< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div class = "section" id = "drm-related-stream-descriptor-fields" >
< h3 > DRM related Stream descriptor fields< a class = "headerlink" href = "#drm-related-stream-descriptor-fields" title = "Permalink to this headline" > ¶< / a > < / h3 >
< table class = "docutils field-list" frame = "void" rules = "none" >
< col class = "field-name" / >
< col class = "field-body" / >
< tbody valign = "top" >
< tr class = "field-odd field" > < th class = "field-name" colspan = "2" > skip_encryption=0|1:< / th > < / tr >
< tr class = "field-odd field" > < td >   < / td > < td class = "field-body" > Optional. Defaults to 0 if not specified. If it is set to 1, no encryption
of the stream will be made.< / td >
< / tr >
< tr class = "field-even field" > < th class = "field-name" > drm_label:< / th > < td class = "field-body" > Optional value for custom DRM label, which defines the encryption key
applied to the stream. Typically values include AUDIO, SD, HD, UHD1, UHD2.
For raw key, it should be a label defined in – keys. If not provided, the
DRM label is derived from stream type (video, audio), resolutions, etc.
Note that it is case sensitive.< / td >
< / tr >
< / tbody >
< / table >
2017-09-20 02:35:05 +00:00
< / div >
< div class = "section" id = "raw-key-encryption-options" >
< h3 > Raw key encryption options< a class = "headerlink" href = "#raw-key-encryption-options" title = "Permalink to this headline" > ¶< / a > < / h3 >
< table class = "docutils option-list" frame = "void" rules = "none" >
< col class = "option" / >
< col class = "description" / >
< tbody valign = "top" >
< tr > < td class = "option-group" colspan = "2" >
2017-10-24 22:51:02 +00:00
< kbd > < span class = "option" > --enable_raw_key_encryption< / span > < / kbd > < / td >
2017-09-20 02:35:05 +00:00
< / tr >
2017-10-24 22:51:02 +00:00
< tr > < td >   < / td > < td > Enable encryption with raw key (keys provided in command line)).< / td > < / tr >
2017-09-20 02:35:05 +00:00
< tr > < td class = "option-group" colspan = "2" >
2017-10-24 22:51:02 +00:00
< kbd > < span class = "option" > --enable_raw_key_decryption< / span > < / kbd > < / td >
2017-09-20 02:35:05 +00:00
< / tr >
2017-10-24 22:51:02 +00:00
< tr > < td >   < / td > < td > Enable decryption with raw key (keys provided in command line).< / td > < / tr >
2017-09-20 02:35:05 +00:00
< tr > < td class = "option-group" colspan = "2" >
2017-10-24 22:51:02 +00:00
< kbd > < span class = "option" > --keys < var > < key_info_string[,key_info_string][,key_info_string]...> < / var > < / span > < / kbd > < / td >
2017-09-20 02:35:05 +00:00
< / tr >
2017-10-24 22:51:02 +00:00
< tr > < td >   < / td > < td > < p class = "first" > < strong > key_info_string< / strong > is of the form:< / p >
< div class = "highlight-default" > < div class = "highlight" > < pre > < span > < / span > < span class = "n" > label< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "n" > label< / span > < span class = "p" > }:< / span > < span class = "n" > key_id< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "n" > key_id< / span > < span class = "p" > }:< / span > < span class = "n" > key< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "n" > key< / span > < span class = "p" > }< / span >
< / pre > < / div >
< / div >
< p > < em > label< / em > can be an arbitrary string or a predefined DRM label like AUDIO,
SD, HD, etc. Label with an empty string indicates the default key and
key_id. The < em > drm_label< / em > in < a class = "reference internal" href = "../options/stream_descriptors.html" > < span class = "doc" > Stream descriptors< / span > < / a > ,
which can be implicit, determines which key info is applied to the stream
by matching the < em > drm_label< / em > with the < em > label< / em > in key info.< / p >
< p class = "last" > < em > key_id< / em > and < em > key< / em > should be 32-digit hex strings.< / p >
< / td > < / tr >
2017-09-20 02:35:05 +00:00
< tr > < td class = "option-group" colspan = "2" >
< kbd > < span class = "option" > --iv < var > < 16-digit or 32-digit hex string> < / var > < / span > < / kbd > < / td >
< / tr >
< tr > < td >   < / td > < td > 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).< / td > < / tr >
< tr > < td class = "option-group" colspan = "2" >
< kbd > < span class = "option" > --pssh < var > < hex string> < / var > < / span > < / kbd > < / td >
< / tr >
< tr > < td >   < / td > < td > One or more concatenated PSSH boxes in hex string format. If not specified,
a < a class = "reference external" href = "https://goo.gl/s8RIhr" > v1 common PSSH box< / a > will be generated.< / td > < / tr >
< / tbody >
< / table >
< / div >
< div class = "section" id = "pssh-box-utility-to-generate-pssh-boxes" >
< h3 > pssh-box (Utility to generate PSSH boxes)< a class = "headerlink" href = "#pssh-box-utility-to-generate-pssh-boxes" title = "Permalink to this headline" > ¶< / a > < / h3 >
< p > < a class = "reference external" href = "https://github.com/google/shaka-packager/tree/master/packager/tools/pssh" > https://github.com/google/shaka-packager/tree/master/packager/tools/pssh< / a > < / p >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "clearer" > < / div >
< / div >
< div class = "related" role = "navigation" aria-label = "related navigation" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../genindex.html" title = "General Index"
>index< / a > < / li >
< li class = "right" >
< a href = "widevine.html" title = "Widevine"
>next< / a > |< / li >
< li class = "right" >
< a href = "drm.html" title = "DRM"
>previous< / a > |< / li >
< li class = "nav-item nav-item-0" > < a href = "../index.html" > Shaka Packager documentation< / a > » < / li >
< li class = "nav-item nav-item-1" > < a href = "tutorials.html" > Tutorials< / a > » < / li >
< li class = "nav-item nav-item-2" > < a href = "drm.html" > DRM< / a > » < / li >
< / ul >
< / div >
< div class = "footer" role = "contentinfo" >
© Copyright 2017, Google.
Created using < a href = "http://sphinx-doc.org/" > Sphinx< / a > 1.5.3.
< / div >
< / body >
< / html >