shaka-packager/html/tutorials/ads.html

215 lines
10 KiB
HTML
Raw Normal View History

2018-08-16 00:35:22 +00:00
<!DOCTYPE html>
2018-08-16 00:35:22 +00:00
<html>
2018-08-16 00:35:22 +00:00
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2018-08-16 00:35:22 +00:00
<title>Ad Insertion &#8212; Shaka Packager documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/sphinxdoc_new.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<link rel="stylesheet" type="text/css" href="../_static/table_styling.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
2018-08-16 00:35:22 +00:00
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="FFmpeg piping" href="ffmpeg_piping.html" />
<link rel="prev" title="Text output formats" href="text.html" />
</head><body>
2018-08-16 00:35:22 +00:00
<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="ffmpeg_piping.html" title="FFmpeg piping"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="text.html" title="Text output formats"
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-1"><a href="tutorials.html" accesskey="U">Tutorials</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Ad Insertion</a></li>
2018-08-16 00:35:22 +00:00
</ul>
</div>
2018-08-16 00:35:22 +00:00
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="ad-insertion">
<h1>Ad Insertion<a class="headerlink" href="#ad-insertion" title="Permalink to this headline"></a></h1>
<p>Shaka Packager does not do Ad Insertion directly, but it can precondition
content for <a class="reference external" href="http://bit.ly/2KK10DD">Dynamic Ad Insertion</a> with Google Ad
Manager.</p>
<p>Both DASH and HLS are supported.</p>
<div class="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; ... \
2018-08-16 00:35:22 +00:00
--ad_cues &lt;start_time[;start_time]...&gt; \
[Other options, e.g. DRM options, DASH options, HLS options]
</pre></div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<p>The examples below use the H264 streams created in <a class="reference internal" href="encoding.html"><span class="doc">Media Encoding</span></a>.</p>
<p>Three midroll cue markers are inserted at 10 minutes, 30 minutes and 50 minutes
respectively.</p>
<ul>
<li><p>DASH with live profile:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ packager \
2018-08-16 00:35:22 +00:00
&#39;in=h264_baseline_360p_600.mp4,stream=audio,init_segment=audio/init.mp4,segment_template=audio/$Number$.m4s&#39; \
&#39;in=input_text.vtt,stream=text,init_segment=text/init.mp4,segment_template=text/$Number$.m4s&#39; \
&#39;in=h264_baseline_360p_600.mp4,stream=video,init_segment=h264_360p/init.mp4,segment_template=h264_360p/$Number$.m4s&#39; \
&#39;in=h264_main_480p_1000.mp4,stream=video,init_segment=h264_480p/init.mp4,segment_template=h264_480p/$Number$.m4s&#39; \
&#39;in=h264_main_720p_3000.mp4,stream=video,init_segment=h264_720p/init.mp4,segment_template=h264_720p/$Number$.m4s&#39; \
&#39;in=h264_high_1080p_6000.mp4,stream=video,init_segment=h264_1080p/init.mp4,segment_template=h264_1080p/$Number$.m4s&#39; \
--ad_cues 600;1800;3000 \
--generate_static_live_mpd --mpd_output h264.mpd
2018-08-16 00:35:22 +00:00
</pre></div>
</div>
</li>
<li><p>DASH with on-demand profile:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ packager \
2018-08-16 00:35:22 +00:00
in=h264_baseline_360p_600.mp4,stream=audio,output=audio.mp4 \
in=input_text.vtt,stream=text,output=output_text.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 \
--ad_cues 600;1800;3000 \
--mpd_output h264.mpd
</pre></div>
</div>
</li>
</ul>
<p>This generates six single-segment media files, one per stream, spanning multiple
periods. There may be problems handling this type of DASH contents in some
players, although it is recommended by <a class="reference external" href="http://bit.ly/2B0HL9q">DASH IF IOP</a>.
Use the below option if your player does not like it.</p>
<ul>
<li><p>DASH with on-demand profile but one file per Period:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ packager \
2018-08-16 00:35:22 +00:00
&#39;in=h264_baseline_360p_600.mp4,stream=audio,output=audio_$Number$.mp4&#39; \
&#39;in=input_text.vtt,stream=text,output=output_text_$Number$.mp4&#39; \
&#39;in=h264_baseline_360p_600.mp4,stream=video,output=h264_360p_$Number$.mp4&#39; \
&#39;in=h264_main_480p_1000.mp4,stream=video,output=h264_480p_$Number$.mp4&#39; \
&#39;in=h264_main_720p_3000.mp4,stream=video,output=h264_720p_$Number$.mp4&#39; \
&#39;in=h264_high_1080p_6000.mp4,stream=video,output=h264_1080p_$Number$.mp4&#39; \
--ad_cues 600;1800;3000 \
--mpd_output h264.mpd
</pre></div>
</div>
</li>
<li><p>HLS using transport streams:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ packager \
2018-08-16 00:35:22 +00:00
&#39;in=h264_baseline_360p_600.mp4,stream=audio,segment_template=audio_$Number$.aac&#39; \
&#39;in=input_text.vtt,stream=text,segment_template=output_text_$Number$.vtt&#39; \
&#39;in=h264_baseline_360p_600.mp4,stream=video,segment_template=h264_360p_$Number$.ts&#39; \
&#39;in=h264_main_480p_1000.mp4,stream=video,segment_template=h264_480p_$Number$.ts&#39; \
&#39;in=h264_main_720p_3000.mp4,stream=video,segment_template=h264_720p_$Number$.ts&#39; \
&#39;in=h264_high_1080p_6000.mp4,stream=video,segment_template=h264_1080p_$Number$.ts&#39; \
--ad_cues 600;1800;3000 \
--hls_master_playlist_output h264_master.m3u8
</pre></div>
</div>
</li>
</ul>
</div>
<div class="section" id="configuration-options">
<h2>Configuration options<a class="headerlink" href="#configuration-options" title="Permalink to this headline"></a></h2>
2018-08-16 00:35:22 +00:00
<div class="section" id="ads-options">
<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>
2018-08-16 00:35:22 +00:00
</div>
</div>
</div>
<div class="clearer"></div>
2018-08-16 00:35:22 +00:00
</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="#">Ad Insertion</a><ul>
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#configuration-options">Configuration options</a><ul>
<li><a class="reference internal" href="#ads-options">Ads options</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="text.html"
title="previous chapter">Text output formats</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="ffmpeg_piping.html"
title="next chapter">FFmpeg piping</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/tutorials/ads.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>
2018-08-16 00:35:22 +00:00
<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="ffmpeg_piping.html" title="FFmpeg piping"
>next</a> |</li>
<li class="right" >
<a href="text.html" title="Text output formats"
>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-1"><a href="tutorials.html" >Tutorials</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Ad Insertion</a></li>
2018-08-16 00:35:22 +00:00
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2017, Google.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3.
2018-08-16 00:35:22 +00:00
</div>
</body>
</html>