shaka-packager/html/documentation.html

716 lines
39 KiB
HTML
Raw Normal View History

2018-02-10 23:37:42 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
2021-06-22 00:16:40 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Packager Documentation &#8212; Shaka Packager documentation</title>
2021-06-22 00:16:40 +00:00
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="_static/sphinxdoc_new.css" />
<link rel="stylesheet" type="text/css" href="_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="_static/table_styling.css" />
2021-06-22 00:16:40 +00:00
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Tutorials" href="tutorials/tutorials.html" />
<link rel="prev" title="Welcome to Shaka Packagers documentation!" href="index.html" />
</head><body>
<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="tutorials/tutorials.html" title="Tutorials"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to Shaka Packagers documentation!"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Shaka Packager documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Packager Documentation</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
2021-06-22 00:16:40 +00:00
<section id="packager-documentation">
<h1>Packager Documentation<a class="headerlink" href="#packager-documentation" title="Permalink to this headline"></a></h1>
<p>Shaka Packager is a tool and a media packaging SDK for DASH and HLS packaging
and encryption. It can transmux input media files from one container to another
container.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Shaka Packager does not do transcoding. Content must be pre-encoded before
passing to packager.</p>
</div>
<p>Packager operates in <em>streams</em>, described by <em>stream_descriptor</em>. The streams
2018-02-10 23:37:42 +00:00
can be read from the same “file” or different “files”, which can be regular
files, pipes, udp streams, etc.</p>
<p>This page is the documentation on using the <em>packager</em> tool. If you are
interested in integrating <em>packager</em> library into your own tool, please see
<a class="reference internal" href="library.html"><span class="doc">Shaka Packager Library</span></a>.</p>
2021-06-22 00:16:40 +00:00
<section id="getting-shaka-packager">
<h2>Getting Shaka Packager<a class="headerlink" href="#getting-shaka-packager" title="Permalink to this headline"></a></h2>
<p>There are several ways you can get Shaka Packager.</p>
<ul class="simple">
<li><p>Using <a class="reference external" href="https://www.docker.com/whatisdocker">Docker</a>.
Instructions are available at <a class="reference internal" href="docker_instructions.html"><span class="doc">Using Docker</span></a>.</p></li>
<li><p>Get prebuilt binaries from
<a class="reference external" href="https://github.com/google/shaka-packager/releases">release</a>.</p></li>
<li><p>Built from source, see <a class="reference internal" href="build_instructions.html"><span class="doc">Build Instructions</span></a> for details.</p></li>
</ul>
2021-06-22 00:16:40 +00:00
</section>
<section id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ packager &lt;stream_descriptor&gt; ... \
[--dump_stream_info] \
[--quiet] \
[Chunking Options] \
[MP4 Output Options] \
[encryption / decryption options] \
[DASH options] \
2018-08-16 00:35:22 +00:00
[HLS options] \
[Ads options]
</pre></div>
</div>
2021-06-22 00:16:40 +00:00
<section id="stream-descriptors">
<h3>Stream descriptors<a class="headerlink" href="#stream-descriptors" title="Permalink to this headline"></a></h3>
2018-02-10 23:37:42 +00:00
<p>There can be multiple <em>stream_descriptor</em> with input from the same “file” or
multiple different “files”.</p>
<p>Stream descriptor is of the form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">field</span><span class="o">&gt;=&lt;</span><span class="n">value</span><span class="o">&gt;</span><span class="p">[,</span><span class="o">&lt;</span><span class="n">field</span><span class="o">&gt;=&lt;</span><span class="n">value</span><span class="o">&gt;</span><span class="p">]</span><span class="o">...</span>
</pre></div>
</div>
<p>These are the available fields:</p>
<dl class="field-list">
<dt class="field-odd">input (in)</dt>
<dd class="field-odd"><p>input/source media “file” path, which can be regular files, pipes, udp
streams. See <a class="reference internal" href="options/udp_file_options.html"><span class="doc">UDP file options</span></a> on additional options for UDP
files.</p>
</dd>
<dt class="field-even">stream_selector (stream)</dt>
<dd class="field-even"><p>Required field with value audio, video, text or stream number (zero
based).</p>
</dd>
<dt class="field-odd">output (out)</dt>
<dd class="field-odd"><p>Required output file path (single file).</p>
</dd>
<dt class="field-even">init_segment</dt>
<dd class="field-even"><p>initialization segment path (multiple file).</p>
</dd>
<dt class="field-odd">segment_template (segment)</dt>
<dd class="field-odd"><p>Optional value which specifies the naming pattern for the segment files,
and that the stream should be split into multiple files. Its presence should
be consistent across streams. See
<a class="reference internal" href="options/segment_template_formatting.html"><span class="doc">Segment template formatting</span></a>.</p>
</dd>
<dt class="field-even">bandwidth (bw)</dt>
<dd class="field-even"><p>Optional value which contains a user-specified maximum bit rate for the
stream, in bits/sec. If specified, this value is propagated to (HLS)
EXT-X-STREAM-INF:BANDWIDTH or (DASH) Representation&#64;bandwidth and the
$Bandwidth$ template parameter for segment names. If not specified, the
bandwidth value is estimated from content bitrate. Note that it only affects
the generated manifests/playlists; it has no effect on the media content
itself.</p>
</dd>
<dt class="field-odd">language (lang)</dt>
<dd class="field-odd"><p>Optional value which contains a user-specified language tag. If specified,
this value overrides any language metadata in the input stream.</p>
</dd>
<dt class="field-even">output_format (format)</dt>
<dd class="field-even"><p>Optional value which specifies the format of the output files (MP4 or WebM).
If not specified, it will be derived from the file extension of the output
file.</p>
<p>For subtitles in MP4, you can specify vtt+mp4 or ttml+mp4 to control
which text format is used.</p>
</dd>
<dt class="field-odd">trick_play_factor (tpf)</dt>
<dd class="field-odd"><p>Optional value which specifies the trick play, a.k.a. trick mode, stream
sampling rate among key frames. If specified, the output is a trick play
stream.</p>
</dd>
<dt class="field-even">cc_index</dt>
<dd class="field-even"><p>Optional value which specifies the index/ID of the subtitle stream to use
for formats where multiple exist within the same stream. For example,
CEA allows specifying up to 4 streams within a single video stream. If not
specified, all subtitles will be merged together.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<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>
<dl class="field-list simple">
<dt class="field-odd">skip_encryption=0|1</dt>
<dd class="field-odd"><p>Optional. Defaults to 0 if not specified. If it is set to 1, no encryption
of the stream will be made.</p>
</dd>
<dt class="field-even">drm_label</dt>
<dd class="field-even"><p>Optional value for custom DRM label, which defines the encryption key
applied to the stream. Typically values include AUDIO, SD, HD, UHD1, UHD2.
2018-02-10 23:37:42 +00:00
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.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="dash-specific-stream-descriptor-fields">
<h3>DASH specific stream descriptor fields<a class="headerlink" href="#dash-specific-stream-descriptor-fields" title="Permalink to this headline"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">dash_accessibilities (accessibilities)</dt>
<dd class="field-odd"><p>Optional semicolon separated list of values for DASH Accessibility element.
The value should be in the format: scheme_id_uri=value, which propagates
to the Accessibility element in the result DASH manifest. See DASH
(ISO/IEC 23009-1) specification for details.</p>
</dd>
<dt class="field-even">dash_roles (roles)</dt>
<dd class="field-even"><p>Optional semicolon separated list of values for DASH Role element. The
value should be one of: <strong>caption</strong>, <strong>subtitle</strong>, <strong>main</strong>, <strong>alternate</strong>,
<strong>supplementary</strong>, <strong>commentary</strong> and <strong>dub</strong>. See DASH (ISO/IEC 23009-1)
specification for details.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="hls-specific-stream-descriptor-fields">
<h3>HLS specific stream descriptor fields<a class="headerlink" href="#hls-specific-stream-descriptor-fields" title="Permalink to this headline"></a></h3>
<dl class="field-list simple">
<dt class="field-odd">hls_name</dt>
<dd class="field-odd"><p>Used for HLS audio to set the NAME attribute for EXT-X-MEDIA.
Defaults to the base of the playlist name.</p>
</dd>
<dt class="field-even">hls_group_id</dt>
<dd class="field-even"><p>Used for HLS audio to set the GROUP-ID attribute for EXT-X-MEDIA.
Defaults to audio if not specified.</p>
</dd>
<dt class="field-odd">playlist_name</dt>
<dd class="field-odd"><p>The HLS playlist file to create. Usually ends with .m3u8, and is
2018-02-10 23:37:42 +00:00
relative to hls_master_playlist_output (see below). If unspecified,
defaults to something of the form stream_0.m3u8, stream_1.m3u8,
stream_2.m3u8, etc.</p>
</dd>
<dt class="field-even">iframe_playlist_name</dt>
<dd class="field-even"><p>The optional HLS I-Frames only playlist file to create. Usually ends with
2018-02-10 23:37:42 +00:00
.m3u8, and is relative to hls_master_playlist_output (see below). Should
only be set for video streams. If unspecified, no I-Frames only playlist is
created.</p>
</dd>
<dt class="field-odd">hls_characteristics (charcs)</dt>
<dd class="field-odd"><p>Optional colon or semi-colon separated list of values for the
CHARACTERISTICS attribute for EXT-X-MEDIA. See CHARACTERISTICS attribute in
<a class="reference external" href="http://bit.ly/2OOUkdB">http://bit.ly/2OOUkdB</a> for details.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="chunking-options">
<h3>Chunking options<a class="headerlink" href="#chunking-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--segment_duration <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Segment duration in seconds. If single_segment is specified, this parameter
sets the duration of a subsegment; otherwise, this parameter sets the
duration of a segment. Actual segment durations may not be exactly as
requested.</p>
</dd>
<dt><kbd><span class="option">--fragment_duration <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Fragment duration in seconds. Should not be larger than the segment
duration. Actual fragment durations may not be exactly as requested.</p>
</dd>
<dt><kbd><span class="option">--segment_sap_aligned</span></kbd></dt>
<dd><p>Force segments to begin with stream access points. Default enabled.</p>
</dd>
<dt><kbd><span class="option">--fragment_sap_aligned</span></kbd></dt>
<dd><p>Force fragments to begin with stream access points. This flag implies
<em>segment_sap_aligned</em>. Default enabled.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="mp4-output-options">
<h3>MP4 output options<a class="headerlink" href="#mp4-output-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--mp4_include_pssh_in_stream</span></kbd></dt>
<dd><p>MP4 only: include pssh in the encrypted stream. Default enabled.</p>
</dd>
<dt><kbd><span class="option">--mp4_use_decoding_timestamp_in_timeline</span></kbd></dt>
<dd><p>Deprecated. Do not use.</p>
</dd>
</dl>
2018-08-16 00:35:22 +00:00
<p>generate_sidx_in_media_segments
nogenerate_sidx_in_media_segments</p>
<blockquote>
<div><p>Indicates whether to generate sidx box in media segments. Note
that it is required for DASH on-demand profile (not using segment
template).</p>
<p>Default enabled.</p>
</div></blockquote>
2021-06-22 00:16:40 +00:00
</section>
<section id="transport-stream-output-options">
2018-08-16 00:35:22 +00:00
<h3>Transport stream output options<a class="headerlink" href="#transport-stream-output-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--transport_stream_timestamp_offset_ms</span></kbd></dt>
<dd><p>Transport stream only (MPEG2-TS, HLS Packed Audio): A positive value, in
2018-08-16 00:35:22 +00:00
milliseconds, by which output timestamps are offset to compensate for
possible negative timestamps in the input. For example, timestamps from
ISO-BMFF after adjusted by EditList could be negative. In transport streams,
timestamps are not allowed to be less than zero. Default: 100ms.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="dash-options">
<h3>DASH options<a class="headerlink" href="#dash-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--generate_static_live_mpd</span></kbd></dt>
<dd><p>If enabled, generates static mpd. If segment_template is specified in
stream descriptors, shaka-packager generates dynamic mpd by default; if
this flag is enabled, shaka-packager generates static mpd instead. Note
that if segment_template is not specified, shaka-packager always generates
static mpd regardless of the value of this flag.</p>
</dd>
<dt><kbd><span class="option">--mpd_output <var>&lt;file_path&gt;</var></span></kbd></dt>
<dd><p>MPD output file name.</p>
</dd>
<dt><kbd><span class="option">--base_urls <var>&lt;comma_separated_urls&gt;</var></span></kbd></dt>
<dd><dl class="simple">
<dt>Comma separated BaseURLs for the MPD:</dt><dd><p><strong>&lt;url&gt;[,&lt;url&gt;]…</strong>.</p>
</dd>
2018-05-23 23:12:00 +00:00
</dl>
<p>The values will be added as &lt;BaseURL&gt; element(s) immediately under the &lt;MPD&gt;
2018-05-23 23:12:00 +00:00
element.</p>
</dd>
<dt><kbd><span class="option">--min_buffer_time <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Specifies, in seconds, a common duration used in the definition of the MPD
Representation data rate.</p>
</dd>
<dt><kbd><span class="option">--minimum_update_period <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Indicates to the player how often to refresh the media presentation
description in seconds. This value is used for dynamic MPD only.</p>
</dd>
<dt><kbd><span class="option">--suggested_presentation_delay <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Specifies a delay, in seconds, to be added to the media presentation time.
This value is used for dynamic MPD only.</p>
</dd>
<dt><kbd><span class="option">--time_shift_buffer_depth <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Guaranteed duration of the time shifting buffer for dynamic media
presentations, in seconds.</p>
</dd>
<dt><kbd><span class="option">--preserved_segments_outside_live_window <var>&lt;num_segments&gt;</var></span></kbd></dt>
<dd><p>Segments outside the live window (defined by <cite>time_shift_buffer_depth</cite>
2018-05-23 23:12:00 +00:00
above) are automatically removed except for the most recent X segments
defined by this parameter. This is needed to accommodate latencies in
various stages of content serving pipeline, so that the segments stay
accessible as they may still be accessed by the player.</p>
<p>The segments are not removed if the value is zero.</p>
</dd>
<dt><kbd><span class="option">--utc_timings <var>&lt;scheme_id_uri_value_pairs&gt;</var></span></kbd></dt>
<dd><dl class="simple">
<dt>Comma separated UTCTiming schemeIdUri and value pairs for the MPD:</dt><dd><p><strong>&lt;scheme_id_uri&gt;=&lt;value&gt;[,&lt;scheme_id_uri&gt;=&lt;value&gt;]…</strong></p>
</dd>
2018-05-23 23:12:00 +00:00
</dl>
<p>This value is used for dynamic MPD only.</p>
</dd>
<dt><kbd><span class="option">--default_language <var>&lt;language&gt;</var></span></kbd></dt>
<dd><p>Any audio/text tracks tagged with this language will have
&lt;Role … value=&quot;main&quot; /&gt; in the manifest. This allows the player to
choose the correct default language for the content.</p>
<p>This applies to both audio and text tracks. The default language for text
tracks can be overriden by default_text_language.</p>
</dd>
<dt><kbd><span class="option">--default_text_language <var>&lt;text_language&gt;</var></span></kbd></dt>
<dd><p>Same as above, but this applies to text tracks only, and overrides the
default language for text tracks.</p>
</dd>
<dt><kbd><span class="option">--allow_approximate_segment_timeline</span></kbd></dt>
<dd><p>For live profile only.</p>
2018-05-23 23:12:00 +00:00
<p>If enabled, segments with close duration (i.e. with difference less than
one sample) are considered to have the same duration. This enables
MPD generator to generate less SegmentTimeline entries. If all segments
are of the same duration except the last one, we will do further
optimization to use <a class="reference external" href="mailto:SegmentTemplate&#37;&#52;&#48;duration">SegmentTemplate<span>&#64;</span>duration</a> instead and omit
SegmentTimeline completely.</p>
<p>Ignored if $Time$ is used in segment template, since $Time$ requires
2018-05-23 23:12:00 +00:00
accurate Segment Timeline.</p>
</dd>
</dl>
<p>dash_only=0|1</p>
<blockquote>
<div><p>Optional. Defaults to 0 if not specified. If it is set to 1, indicates the
stream is DASH only.</p>
</div></blockquote>
<dl class="option-list">
<dt><kbd><span class="option">--allow_codec_switching</span></kbd></dt>
<dd><p>If enabled, allow adaptive switching between different codecs, if they have
the same language, media type (audio, video etc) and container type.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="hls-options">
<h3>HLS options<a class="headerlink" href="#hls-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--hls_master_playlist_output <var>&lt;file_path&gt;</var></span></kbd></dt>
<dd><p>Output path for the master playlist for HLS. This flag must be used to
output HLS.</p>
</dd>
<dt><kbd><span class="option">--hls_base_url <var>&lt;url&gt;</var></span></kbd></dt>
<dd><p>The base URL for the Media Playlists and media files listed in the
playlists. This is the prefix for the files.</p>
</dd>
<dt><kbd><span class="option">--hls_key_uri <var>&lt;uri&gt;</var></span></kbd></dt>
<dd><p>The key uri for identity and com.apple.streamingkeydelivery (FairPlay)
2018-08-16 00:35:22 +00:00
key formats. Ignored if the playlist is not encrypted or not using the above
key formats.</p>
</dd>
<dt><kbd><span class="option">--hls_playlist_type <var>&lt;type&gt;</var></span></kbd></dt>
<dd><p>VOD, EVENT, or LIVE. This defines the EXT-X-PLAYLIST-TYPE in the HLS
specification. For hls_playlist_type of LIVE, EXT-X-PLAYLIST-TYPE tag is
omitted.</p>
</dd>
<dt><kbd><span class="option">--time_shift_buffer_depth <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Guaranteed duration of the time shifting buffer for LIVE playlists, in
seconds.</p>
</dd>
<dt><kbd><span class="option">--preserved_segments_outside_live_window <var>&lt;num_segments&gt;</var></span></kbd></dt>
<dd><p>Segments outside the live window (defined by <cite>time_shift_buffer_depth</cite>
2018-05-23 23:12:00 +00:00
above) are automatically removed except for the most recent X segments
defined by this parameter. This is needed to accommodate latencies in
various stages of content serving pipeline, so that the segments stay
accessible as they may still be accessed by the player.</p>
<p>The segments are not removed if the value is zero.</p>
</dd>
<dt><kbd><span class="option">--default_language <var>&lt;language&gt;</var></span></kbd></dt>
<dd><p>The first audio/text rendition in a group tagged with this language will
2018-02-10 23:37:42 +00:00
have DEFAULT attribute set to YES. This allows the player to choose the
correct default language for the content.</p>
<p>This applies to both audio and text tracks. The default language for text
tracks can be overriden by default_text_language.</p>
</dd>
<dt><kbd><span class="option">--default_text_language <var>&lt;text_language&gt;</var></span></kbd></dt>
<dd><p>Same as above, but this applies to text tracks only, and overrides the
default language for text tracks.</p>
</dd>
<dt><kbd><span class="option">--hls_media_sequence_number <var>&lt;unsigned_number&gt;</var></span></kbd></dt>
<dd><p>HLS uses the EXT-X-MEDIA-SEQUENCE tag at the start of a live playlist in
order to specify the first segment sequence number. This is because any
live playlist have a limited number of segments, and they also keep
updating with new segments while removing old ones. When a player refreshes
the playlist, this information is important for keeping track of segments
positions.</p>
<p>When the packager starts, it naturally starts this count from zero. However,
there are many situations where the packager may be restarted, without this
meaning starting this value from zero (but continuing a previous sequence).
The most common situations are problems in the encoder feeding the packager.</p>
<p>With those cases in mind, this parameter allows to set the initial
EXT-X-MEDIA-SEQUENCE value. This way, its possible to continue the sequence
number from previous packager run.</p>
<p>For more information about the reasoning of this, please see issue
<a class="reference external" href="https://github.com/google/shaka-packager/issues/691">#691</a>.</p>
<p>The EXT-X-MEDIA-SEQUENCE documentation can be read here:
<a class="reference external" href="https://tools.ietf.org/html/rfc8216#section-4.3.3.2">https://tools.ietf.org/html/rfc8216#section-4.3.3.2</a>.</p>
</dd>
</dl>
<p>hls_only=0|1</p>
<blockquote>
<div><p>Optional. Defaults to 0 if not specified. If it is set to 1, indicates the
stream is HLS only.</p>
</div></blockquote>
2021-06-22 00:16:40 +00:00
</section>
<section id="ads-options">
2018-08-16 00:35:22 +00:00
<h3>Ads options<a class="headerlink" href="#ads-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--ad_cues <var>&lt;start_time[;start_time]…&gt;</var></span></kbd></dt>
<dd><p>List of cuepoint markers separated by semicolon. The start_time represents
2018-08-16 00:35:22 +00:00
the start of the cue marker in seconds (double precision) relative to the
start of the program. This flag preconditions content for
<a class="reference external" href="http://bit.ly/2KK10DD">Dynamic Ad Insertion</a> with Google Ad Manager.
For DASH, multiple periods will be generated with period boundaries at the
next key frame to the designated start times; For HLS, segments will be
terminated at the next key frame to the designated start times and
#EXT-X-PLACEMENT-OPPORTUNITY tag will be inserted after the segment in
media playlist.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
</section>
<section id="encryption-decryption-options">
<h2>Encryption / decryption options<a class="headerlink" href="#encryption-decryption-options" title="Permalink to this headline"></a></h2>
<p>Shaka Packager supports three different types of key providers:</p>
<ul class="simple">
<li><p>Raw key: keys are provided in command line</p></li>
<li><p>Widevine: fetches keys from Widevine key server</p></li>
<li><p>PlayReady: fetches keys from PlayReady key server</p></li>
</ul>
<p>Different key providers cannot be specified at the same time.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="o">--</span><span class="n">enable_widevine_encryption</span> <span class="o">&lt;</span><span class="n">Widevine</span> <span class="n">Encryption</span> <span class="n">Options</span><span class="o">&gt;</span><span class="p">]</span> \
2018-05-23 23:12:00 +00:00
<span class="p">[</span><span class="o">--</span><span class="n">enable_widevine_decryption</span> <span class="o">&lt;</span><span class="n">Widevine</span> <span class="n">Decryption</span> <span class="n">Options</span><span class="o">&gt;</span><span class="p">]</span> \
<span class="p">[</span><span class="o">--</span><span class="n">enable_raw_key_encryption</span> <span class="o">&lt;</span><span class="n">Raw</span> <span class="n">Key</span> <span class="n">Encryption</span> <span class="n">Options</span><span class="o">&gt;</span><span class="p">]</span> \
<span class="p">[</span><span class="o">--</span><span class="n">enable_raw_key_decryption</span> <span class="o">&lt;</span><span class="n">Raw</span> <span class="n">Key</span> <span class="n">Decryption</span> <span class="n">Options</span><span class="o">&gt;</span><span class="p">]</span> \
<span class="p">[</span><span class="o">--</span><span class="n">enable_playready_encryption</span> <span class="o">&lt;</span><span class="n">PlayReady</span> <span class="n">Encryption</span> <span class="n">Options</span><span class="o">&gt;</span><span class="p">]</span>
</pre></div>
</div>
2021-06-22 00:16:40 +00:00
<section id="general-encryption-options">
<h3>General encryption options<a class="headerlink" href="#general-encryption-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--protection_scheme <var>&lt;scheme&gt;</var></span></kbd></dt>
<dd><p>Specify a protection scheme, cenc or cbc1 or pattern-based protection
schemes cens or cbcs.</p>
</dd>
<dt><kbd><span class="option">--crypt_byte_block</span></kbd></dt>
<dd><p>Specify the count of the encrypted blocks in the protection pattern, where
block is of size 16-bytes.</p>
<p>There are three common patterns (crypt_byte_block:skip_byte_block):
1:9 (default), 5:5, 10:0.</p>
<p>Apply to video streams with cbcs and cens protection schemes only;
ignored otherwise.</p>
</dd>
<dt><kbd><span class="option">--skip_byte_block</span></kbd></dt>
<dd><p>Specify the count of the unencrypted blocks in the protection pattern.</p>
<p>Apply to video streams with cbcs and cens protection schemes only;
ignored otherwise.</p>
</dd>
<dt><kbd><span class="option">--vp9_subsample_encryption</span>, <span class="option">--novp9_subsample_encryption</span></kbd></dt>
<dd><p>Enable / disable VP9 subsample encryption. Enabled by default.</p>
</dd>
<dt><kbd><span class="option">--clear_lead <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Clear lead in seconds if encryption is enabled.
Shaka Packager does not support partial encrypted segments, all the
segments including the partial segment overlapping with the initial
clear_lead seconds are not encrypted, with all the following segments
encrypted. If segment_duration is greater than clear_lead, then only the
first segment is not encrypted.
Default: 5</p>
</dd>
<dt><kbd><span class="option">--protection_systems</span></kbd></dt>
<dd><p>Protection systems to be generated. Supported protection systems include
Widevine, PlayReady, FairPlay, Marlin, and
<a class="reference external" href="https://goo.gl/s8RIhr">CommonSystem</a>.</p>
</dd>
<dt><kbd><span class="option">--playready_extra_header_data <var>&lt;string&gt;</var></span></kbd></dt>
<dd><p>Extra XML data to add to PlayReady PSSH data. Can be specified even if
using another key source.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<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>
<dl class="option-list">
<dt><kbd><span class="option">--enable_raw_key_encryption</span></kbd></dt>
<dd><p>Enable encryption with raw key (keys provided in command line)). This
2018-08-16 00:35:22 +00:00
generates <a class="reference external" href="https://goo.gl/s8RIhr">Common protection system</a> if neither
pssh nor protection_systems is specified. Use pssh to provide custom
protection systems or use protection_systems to generate protection
systems automatically.</p>
</dd>
<dt><kbd><span class="option">--enable_raw_key_decryption</span></kbd></dt>
<dd><p>Enable decryption with raw key (keys provided in command line).</p>
</dd>
<dt><kbd><span class="option">--keys <var>&lt;key_info_string[,key_info_string][,key_info_string]…&gt;</var></span></kbd></dt>
<dd><p><strong>key_info_string</strong> is of the form:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">label</span><span class="o">=&lt;</span><span class="n">label</span><span class="o">&gt;</span><span class="p">:</span><span class="n">key_id</span><span class="o">=&lt;</span><span class="n">key_id</span><span class="o">&gt;</span><span class="p">:</span><span class="n">key</span><span class="o">=&lt;</span><span class="n">key</span><span class="o">&gt;</span><span class="p">[:</span><span class="n">iv</span><span class="o">=&lt;</span><span class="n">initialization_vector</span><span class="o">&gt;</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><em>key_id</em> and <em>key</em> should be 32-digit hex strings.</p>
<p><em>initialization_vector</em> is an optional IV with the same format and semantics
as the parameter for the <em>iv</em> option below. This is mutually exclusive with
that option.</p>
</dd>
<dt><kbd><span class="option">--iv <var>&lt;16-digit or 32-digit hex string&gt;</var></span></kbd></dt>
<dd><p>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).</p>
</dd>
<dt><kbd><span class="option">--pssh <var>&lt;hex string&gt;</var></span></kbd></dt>
<dd><p>One or more concatenated PSSH boxes in hex string format. If neither this
2018-08-16 00:35:22 +00:00
flag nor protection_systems is specified, a
<a class="reference external" href="https://goo.gl/s8RIhr">v1 common PSSH box</a> will be generated.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="widevine-encryption-options">
<h3>Widevine encryption options<a class="headerlink" href="#widevine-encryption-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--enable_widevine_encryption</span></kbd></dt>
<dd><p>Enable encryption with Widevine key server. User should provide either
2018-02-10 23:37:42 +00:00
AES signing key (aes_signing_key, aes_signing_iv) or RSA signing key
2018-08-16 00:35:22 +00:00
(rsa_signing_key_path). This generates Widevine protection system if
protection_systems is not specified. Use protection_systems to generate
multiple protection systems.</p>
</dd>
<dt><kbd><span class="option">--enable_widevine_decryption</span></kbd></dt>
<dd><p>Enable decryption with Widevine key server. User should provide either
2018-02-10 23:37:42 +00:00
AES signing key (aes_signing_key, aes_signing_iv) or RSA signing key
(rsa_signing_key_path).</p>
</dd>
<dt><kbd><span class="option">--key_server_url <var>&lt;url&gt;</var></span></kbd></dt>
<dd><p>Key server url. Required for Widevine encryption and decryption.</p>
</dd>
<dt><kbd><span class="option">--content_id <var>&lt;hex&gt;</var></span></kbd></dt>
<dd><p>Content identifier that uniquely identifies the content.</p>
</dd>
<dt><kbd><span class="option">--policy <var>&lt;policy&gt;</var></span></kbd></dt>
<dd><p>The name of a stored policy, which specifies DRM content rights.</p>
</dd>
<dt><kbd><span class="option">--max_sd_pixels <var>&lt;pixels&gt;</var></span></kbd></dt>
<dd><p>The video track is considered SD if its max pixels per frame is no higher
than <em>max_sd_pixels</em>. Default: 442368 (768 x 576).</p>
</dd>
<dt><kbd><span class="option">--max_hd_pixels <var>&lt;pixels&gt;</var></span></kbd></dt>
<dd><p>The video track is considered HD if its max pixels per frame is higher than
<em>max_sd_pixels</em>, but no higher than <em>max_hd_pixels</em>. Default: 2073600
(1920 x 1080).</p>
</dd>
<dt><kbd><span class="option">--max_uhd1_pixels <var>&lt;pixels&gt;</var></span></kbd></dt>
<dd><p>The video track is considered UHD1 if its max pixels per frame is higher
than <em>max_hd_pixels</em>, but no higher than <em>max_uhd1_pixels</em>. Otherwise it is
UHD2. Default: 8847360 (4096 x 2160).</p>
</dd>
<dt><kbd><span class="option">--signer <var>&lt;signer&gt;</var></span></kbd></dt>
<dd><p>The name of the signer.</p>
</dd>
<dt><kbd><span class="option">--aes_signing_key <var>&lt;hex&gt;</var></span></kbd></dt>
<dd><p>AES signing key in hex string. <em>aes_signing_iv</em> is required if
<em>aes_signing_key</em> is specified. This option is exclusive with
<em>rsa_signing_key_path</em>.</p>
</dd>
<dt><kbd><span class="option">--aes_signing_iv <var>&lt;hex&gt;</var></span></kbd></dt>
<dd><p>AES signing iv in hex string.</p>
</dd>
<dt><kbd><span class="option">--rsa_signing_key_path <var>&lt;file path&gt;</var></span></kbd></dt>
<dd><p>Path to the file containing PKCS#1 RSA private key for request signing.
This option is exclusive with <em>aes_signing_key</em>.</p>
</dd>
<dt><kbd><span class="option">--crypto_period_duration <var>&lt;seconds&gt;</var></span></kbd></dt>
<dd><p>Defines how often key rotates. If it is non-zero, key rotation is enabled.</p>
</dd>
<dt><kbd><span class="option">--group_id <var>&lt;hex&gt;</var></span></kbd></dt>
<dd><p>Identifier for a group of licenses.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
<section id="playready-encryption-options">
2018-05-23 23:12:00 +00:00
<h3>PlayReady encryption options<a class="headerlink" href="#playready-encryption-options" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd><span class="option">--enable_playready_encryption</span></kbd></dt>
<dd><p>Enable encryption with PlayReady key. This generates PlayReady protection
2018-08-16 00:35:22 +00:00
system if protection_systems is not specified. Use protection_system to
generate multiple protection systems.</p>
</dd>
<dt><kbd><span class="option">--playready_server_url <var>&lt;url&gt;</var></span></kbd></dt>
<dd><p>PlayReady packaging server url.</p>
</dd>
<dt><kbd><span class="option">--program_identifier <var>&lt;program_identifier&gt;</var></span></kbd></dt>
<dd><p>Program identifier for packaging request.</p>
</dd>
<dt><kbd><span class="option">--ca_file <var>&lt;file path&gt;</var></span></kbd></dt>
<dd><p>Absolute path to the certificate authority file for the server cert.
PEM format. Optional, depends on server configuration.</p>
</dd>
<dt><kbd><span class="option">--client_cert_file <var>&lt;file path&gt;</var></span></kbd></dt>
<dd><p>Absolute path to client certificate file. Optional, depends on server
configuration.</p>
</dd>
<dt><kbd><span class="option">--client_cert_private_key_file <var>&lt;file path&gt;</var></span></kbd></dt>
<dd><p>Absolute path to the private key file. Optional, depends on server
configuration.</p>
</dd>
<dt><kbd><span class="option">--client_cert_private_key_password <var>&lt;string&gt;</var></span></kbd></dt>
<dd><p>Password to the private key file. Optional, depends on server configuration.</p>
</dd>
</dl>
2021-06-22 00:16:40 +00:00
</section>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</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="#">Packager Documentation</a><ul>
<li><a class="reference internal" href="#getting-shaka-packager">Getting Shaka Packager</a></li>
<li><a class="reference internal" href="#synopsis">Synopsis</a><ul>
<li><a class="reference internal" href="#stream-descriptors">Stream descriptors</a></li>
<li><a class="reference internal" href="#drm-related-stream-descriptor-fields">DRM related Stream descriptor fields</a></li>
<li><a class="reference internal" href="#dash-specific-stream-descriptor-fields">DASH specific stream descriptor fields</a></li>
<li><a class="reference internal" href="#hls-specific-stream-descriptor-fields">HLS specific stream descriptor fields</a></li>
<li><a class="reference internal" href="#chunking-options">Chunking options</a></li>
<li><a class="reference internal" href="#mp4-output-options">MP4 output options</a></li>
<li><a class="reference internal" href="#transport-stream-output-options">Transport stream output options</a></li>
<li><a class="reference internal" href="#dash-options">DASH options</a></li>
<li><a class="reference internal" href="#hls-options">HLS options</a></li>
<li><a class="reference internal" href="#ads-options">Ads options</a></li>
</ul>
</li>
<li><a class="reference internal" href="#encryption-decryption-options">Encryption / decryption options</a><ul>
<li><a class="reference internal" href="#general-encryption-options">General encryption options</a></li>
<li><a class="reference internal" href="#raw-key-encryption-options">Raw key encryption options</a></li>
<li><a class="reference internal" href="#widevine-encryption-options">Widevine encryption options</a></li>
<li><a class="reference internal" href="#playready-encryption-options">PlayReady encryption options</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">Welcome to Shaka Packagers documentation!</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="tutorials/tutorials.html"
title="next chapter">Tutorials</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/documentation.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</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="tutorials/tutorials.html" title="Tutorials"
>next</a> |</li>
<li class="right" >
<a href="index.html" title="Welcome to Shaka Packagers documentation!"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Shaka Packager documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Packager Documentation</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2017, Google.
2021-06-22 00:16:40 +00:00
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.0.2.
</div>
</body>
</html>