mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-05 04:22:51 +08:00
#1: update docs
This commit is contained in:
parent
8abe60fdee
commit
8d142c5fa9
@ -17,6 +17,7 @@ help:
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@rm -rf html doctrees
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
| <a href="#F"><strong>F</strong></a>
|
||||
| <a href="#G"><strong>G</strong></a>
|
||||
| <a href="#H"><strong>H</strong></a>
|
||||
| <a href="#I"><strong>I</strong></a>
|
||||
| <a href="#M"><strong>M</strong></a>
|
||||
| <a href="#O"><strong>O</strong></a>
|
||||
| <a href="#R"><strong>R</strong></a>
|
||||
@ -114,6 +115,14 @@
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="I">I</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="index.html#ffmpeg.input">input() (in module ffmpeg)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="M">M</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
@ -125,10 +134,12 @@
|
||||
<h2 id="O">O</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="index.html#ffmpeg.overlay">overlay() (in module ffmpeg)</a>
|
||||
<li><a href="index.html#ffmpeg.output">output() (in module ffmpeg)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="index.html#ffmpeg.overlay">overlay() (in module ffmpeg)</a>
|
||||
</li>
|
||||
<li><a href="index.html#ffmpeg.overwrite_output">overwrite_output() (in module ffmpeg)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
|
@ -47,85 +47,278 @@
|
||||
</div>
|
||||
<span class="target" id="module-ffmpeg"></span><dl class="function">
|
||||
<dt id="ffmpeg.colorchannelmixer">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">colorchannelmixer</code><span class="sig-paren">(</span><em>parent</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.colorchannelmixer" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">colorchannelmixer</code><span class="sig-paren">(</span><em>parent_node</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.colorchannelmixer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Adjust video input frames by re-mixing color channels.</p>
|
||||
<p><a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#toc-colorchannelmixer">FFmpeg colorchannelmixer filter</a></p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#colorchannelmixer">colorchannelmixer</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.concat">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">concat</code><span class="sig-paren">(</span><em>*parents</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.concat" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">concat</code><span class="sig-paren">(</span><em>*parent_nodes</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.concat" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Concatenate audio and video streams, joining them together one after the other.</p>
|
||||
<p>The filter works on segments of synchronized video and audio streams. All segments must have the same number of
|
||||
streams of each type, and that will also be the number of streams at output.</p>
|
||||
<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">Parameters:</th><td class="field-body"><strong>unsafe</strong> – Activate unsafe mode: do not fail if segments have a different format.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Related streams do not always have exactly the same duration, for various reasons including codec frame size or
|
||||
sloppy authoring. For that reason, related synchronized streams (e.g. a video and its audio track) should be
|
||||
concatenated at once. The concat filter will use the duration of the longest stream in each segment (except the
|
||||
last one), and if necessary pad shorter audio streams with silence.</p>
|
||||
<p>For this filter to work correctly, all segments must start at timestamp 0.</p>
|
||||
<p>All corresponding streams must have the same parameters in all segments; the filtering system will automatically
|
||||
select a common pixel format for video streams, and a common sample format, sample rate and channel layout for
|
||||
audio streams, but other settings, such as resolution, must be converted explicitly by the user.</p>
|
||||
<p>Different frame rates are acceptable but will result in variable frame rate at output; be sure to configure the
|
||||
output file to handle it.</p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#concat">concat</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.drawbox">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">drawbox</code><span class="sig-paren">(</span><em>parent</em>, <em>x</em>, <em>y</em>, <em>width</em>, <em>height</em>, <em>color</em>, <em>thickness=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.drawbox" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">drawbox</code><span class="sig-paren">(</span><em>parent_node</em>, <em>x</em>, <em>y</em>, <em>width</em>, <em>height</em>, <em>color</em>, <em>thickness=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.drawbox" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Draw a colored box on the input image.</p>
|
||||
<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">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>x</strong> – The expression which specifies the top left corner x coordinate of the box. It defaults to 0.</li>
|
||||
<li><strong>y</strong> – The expression which specifies the top left corner y coordinate of the box. It defaults to 0.</li>
|
||||
<li><strong>width</strong> – Specify the width of the box; if 0 interpreted as the input width. It defaults to 0.</li>
|
||||
<li><strong>heigth</strong> – Specify the height of the box; if 0 interpreted as the input height. It defaults to 0.</li>
|
||||
<li><strong>color</strong> – Specify the color of the box to write. For the general syntax of this option, check the “Color” section
|
||||
in the ffmpeg-utils manual. If the special value invert is used, the box edge color is the same as the
|
||||
video with inverted luma.</li>
|
||||
<li><strong>thickness</strong> – The expression which sets the thickness of the box edge. Default value is 3.</li>
|
||||
<li><strong>w</strong> – Alias for <code class="docutils literal"><span class="pre">width</span></code>.</li>
|
||||
<li><strong>h</strong> – Alias for <code class="docutils literal"><span class="pre">height</span></code>.</li>
|
||||
<li><strong>c</strong> – Alias for <code class="docutils literal"><span class="pre">color</span></code>.</li>
|
||||
<li><strong>t</strong> – Alias for <code class="docutils literal"><span class="pre">thickness</span></code>.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#drawbox">drawbox</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.hflip">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">hflip</code><span class="sig-paren">(</span><em>parent</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.hflip" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">hflip</code><span class="sig-paren">(</span><em>parent_node</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.hflip" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Flip the input video horizontally.</p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#hflip">hflip</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.hue">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">hue</code><span class="sig-paren">(</span><em>parent</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.hue" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">hue</code><span class="sig-paren">(</span><em>parent_node</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.hue" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Modify the hue and/or the saturation of the input.</p>
|
||||
<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">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>h</strong> – Specify the hue angle as a number of degrees. It accepts an expression, and defaults to “0”.</li>
|
||||
<li><strong>s</strong> – Specify the saturation in the [-10,10] range. It accepts an expression and defaults to “1”.</li>
|
||||
<li><strong>H</strong> – Specify the hue angle as a number of radians. It accepts an expression, and defaults to “0”.</li>
|
||||
<li><strong>b</strong> – Specify the brightness in the [-10,10] range. It accepts an expression and defaults to “0”.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#hue">hue</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.overlay">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">overlay</code><span class="sig-paren">(</span><em>main_parent</em>, <em>overlay_parent</em>, <em>eof_action=’repeat’</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.overlay" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">overlay</code><span class="sig-paren">(</span><em>main_parent_node</em>, <em>overlay_parent_node</em>, <em>eof_action=’repeat’</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.overlay" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Overlay one video on top of another.</p>
|
||||
<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">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>x</strong> – Set the expression for the x coordinates of the overlaid video on the main video. Default value is 0. In
|
||||
case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed
|
||||
within the output visible area).</li>
|
||||
<li><strong>y</strong> – Set the expression for the y coordinates of the overlaid video on the main video. Default value is 0. In
|
||||
case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed
|
||||
within the output visible area).</li>
|
||||
<li><strong>eof_action</strong> – <p>The action to take when EOF is encountered on the secondary input; it accepts one of the following
|
||||
values:</p>
|
||||
<ul>
|
||||
<li><code class="docutils literal"><span class="pre">repeat</span></code>: Repeat the last frame (the default).</li>
|
||||
<li><code class="docutils literal"><span class="pre">endall</span></code>: End both streams.</li>
|
||||
<li><code class="docutils literal"><span class="pre">pass</span></code>: Pass the main input through.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>eval</strong> – <p>Set when the expressions for x, and y are evaluated.
|
||||
It accepts the following values:</p>
|
||||
<ul>
|
||||
<li><dl class="first docutils">
|
||||
<dt><code class="docutils literal"><span class="pre">init</span></code>: only evaluate expressions once during the filter initialization or when a command is</dt>
|
||||
<dd>processed</dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li><code class="docutils literal"><span class="pre">frame</span></code>: evaluate expressions for each incoming frame</li>
|
||||
</ul>
|
||||
<p>Default value is <code class="docutils literal"><span class="pre">frame</span></code>.</p>
|
||||
</li>
|
||||
<li><strong>shortest</strong> – If set to 1, force the output to terminate when the shortest input terminates. Default value is 0.</li>
|
||||
<li><strong>format</strong> – <p>Set the format for the output video.
|
||||
It accepts the following values:</p>
|
||||
<ul>
|
||||
<li><code class="docutils literal"><span class="pre">yuv420</span></code>: force YUV420 output</li>
|
||||
<li><code class="docutils literal"><span class="pre">yuv422</span></code>: force YUV422 output</li>
|
||||
<li><code class="docutils literal"><span class="pre">yuv444</span></code>: force YUV444 output</li>
|
||||
<li><code class="docutils literal"><span class="pre">rgb</span></code>: force packed RGB output</li>
|
||||
<li><code class="docutils literal"><span class="pre">gbrp</span></code>: force planar RGB output</li>
|
||||
</ul>
|
||||
<p>Default value is <code class="docutils literal"><span class="pre">yuv420</span></code>.</p>
|
||||
</li>
|
||||
<li><strong>rgb</strong> (<em>deprecated</em>) – If set to 1, force the filter to accept inputs in the RGB color space. Default value is 0.
|
||||
This option is deprecated, use format instead.</li>
|
||||
<li><strong>repeatlast</strong> – If set to 1, force the filter to draw the last overlay frame over the main input until the end of
|
||||
the stream. A value of 0 disables this behavior. Default value is 1.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#overlay-1">overlay</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.setpts">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">setpts</code><span class="sig-paren">(</span><em>parent</em>, <em>expr</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.setpts" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">setpts</code><span class="sig-paren">(</span><em>parent_node</em>, <em>expr</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.setpts" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Change the PTS (presentation timestamp) of the input frames.</p>
|
||||
<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">Parameters:</th><td class="field-body"><strong>expr</strong> – The expression which is evaluated for each frame to construct its timestamp.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts">setpts, asetpts</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.trim">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">trim</code><span class="sig-paren">(</span><em>parent</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.trim" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">trim</code><span class="sig-paren">(</span><em>parent_node</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.trim" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Trim the input so that the output contains one continuous subpart of the input.</p>
|
||||
<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">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>start</strong> – Specify the time of the start of the kept section, i.e. the frame with the timestamp start will be the
|
||||
first frame in the output.</li>
|
||||
<li><strong>end</strong> – Specify the time of the first frame that will be dropped, i.e. the frame immediately preceding the one
|
||||
with the timestamp end will be the last frame in the output.</li>
|
||||
<li><strong>start_pts</strong> – This is the same as start, except this option sets the start timestamp in timebase units instead of
|
||||
seconds.</li>
|
||||
<li><strong>end_pts</strong> – This is the same as end, except this option sets the end timestamp in timebase units instead of
|
||||
seconds.</li>
|
||||
<li><strong>duration</strong> – The maximum duration of the output in seconds.</li>
|
||||
<li><strong>start_frame</strong> – The number of the first frame that should be passed to the output.</li>
|
||||
<li><strong>end_frame</strong> – The number of the first frame that should be dropped.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#trim">trim</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.vflip">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">vflip</code><span class="sig-paren">(</span><em>parent</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.vflip" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">vflip</code><span class="sig-paren">(</span><em>parent_node</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.vflip" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Flip the input video vertically.</p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#vflip">vflip</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.zoompan">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">zoompan</code><span class="sig-paren">(</span><em>parent</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.zoompan" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">zoompan</code><span class="sig-paren">(</span><em>parent_node</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.zoompan" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Apply Zoom & Pan effect.</p>
|
||||
<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">Parameters:</th><td class="field-body"><ul class="first last simple">
|
||||
<li><strong>zoom</strong> – Set the zoom expression. Default is 1.</li>
|
||||
<li><strong>x</strong> – Set the x expression. Default is 0.</li>
|
||||
<li><strong>y</strong> – Set the y expression. Default is 0.</li>
|
||||
<li><strong>d</strong> – Set the duration expression in number of frames. This sets for how many number of frames effect will last
|
||||
for single input image.</li>
|
||||
<li><strong>s</strong> – Set the output image size, default is <code class="docutils literal"><span class="pre">hd720</span></code>.</li>
|
||||
<li><strong>fps</strong> – Set the output frame rate, default is 25.</li>
|
||||
<li><strong>z</strong> – Alias for <code class="docutils literal"><span class="pre">zoom</span></code>.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#zoompan">zoompan</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.file_input">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">file_input</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.file_input" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<dd><p>Input file URL (ffmpeg <code class="docutils literal"><span class="pre">-i</span></code> option)</p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Main-options">Main options</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.file_output">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">file_output</code><span class="sig-paren">(</span><em>parent</em>, <em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.file_output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">file_output</code><span class="sig-paren">(</span><em>parent_node</em>, <em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.file_output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Output file URL</p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Synopsis">Synopsis</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.input">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">input</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.input" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Shorthand for <code class="docutils literal"><span class="pre">file_input</span></code></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.merge_outputs">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">merge_outputs</code><span class="sig-paren">(</span><em>*parents</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.merge_outputs" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">merge_outputs</code><span class="sig-paren">(</span><em>*parent_nodes</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.merge_outputs" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.output">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">output</code><span class="sig-paren">(</span><em>parent_node</em>, <em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Shorthand for <code class="docutils literal"><span class="pre">file_output</span></code></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.overwrite_output">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">overwrite_output</code><span class="sig-paren">(</span><em>parent</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.overwrite_output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">overwrite_output</code><span class="sig-paren">(</span><em>parent_node</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.overwrite_output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Overwrite output files without asking (ffmpeg <code class="docutils literal"><span class="pre">-y</span></code> option)</p>
|
||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg.html#Main-options">Main options</a></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.get_args">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">get_args</code><span class="sig-paren">(</span><em>parent</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.get_args" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">get_args</code><span class="sig-paren">(</span><em>node</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.get_args" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get command-line arguments for ffmpeg.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="ffmpeg.run">
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">run</code><span class="sig-paren">(</span><em>parent</em>, <em>cmd=’ffmpeg’</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.run" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
<code class="descclassname">ffmpeg.</code><code class="descname">run</code><span class="sig-paren">(</span><em>node</em>, <em>cmd=’ffmpeg’</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.run" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Run ffmpeg on node graph.</p>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
<div class="section" id="indices-and-tables">
|
||||
|
Binary file not shown.
@ -1 +1 @@
|
||||
Search.setIndex({docnames:["index"],envversion:52,filenames:["index.rst"],objects:{"":{ffmpeg:[0,0,0,"-"]},ffmpeg:{colorchannelmixer:[0,1,1,""],concat:[0,1,1,""],drawbox:[0,1,1,""],file_input:[0,1,1,""],file_output:[0,1,1,""],get_args:[0,1,1,""],hflip:[0,1,1,""],hue:[0,1,1,""],merge_outputs:[0,1,1,""],overlay:[0,1,1,""],overwrite_output:[0,1,1,""],run:[0,1,1,""],setpts:[0,1,1,""],trim:[0,1,1,""],vflip:[0,1,1,""],zoompan:[0,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:function"},terms:{"class":[],"function":[],adjust:0,arg:0,base:[],bind:[],channel:0,cmd:0,color:0,colorchannelmix:0,concat:0,correspond:[],decor:[],drawbox:0,eof_act:0,expr:0,file:[],file_input:0,file_output:0,filenam:0,filter:0,filternod:[],fixm:[],fluent:[],frame:0,from:[],get_arg:0,globalnod:[],height:0,hflip:0,hue:0,index:0,input:0,inputnod:[],instanc:[],kwarg:0,list:[],main_par:0,make:[],merge_output:0,method:[],mix:0,modul:0,name:[],node:[],node_class:[],none:0,object:[],oper:[],option:[],outputnod:[],overlai:0,overlay_par:0,overwrite_output:0,page:0,paramet:[],parent:0,repeat:0,run:0,search:0,set:[],setpt:0,show:[],specifi:[],thick:0,trim:0,vflip:0,video:0,width:0,zoompan:0},titles:["ffmpeg-python: Python bindings for FFmpeg"],titleterms:{bind:0,document:[],ffmpeg:0,indic:0,python:0,tabl:0,welcom:[]}})
|
||||
Search.setIndex({docnames:["index"],envversion:52,filenames:["index.rst"],objects:{"":{ffmpeg:[0,0,0,"-"]},ffmpeg:{colorchannelmixer:[0,1,1,""],concat:[0,1,1,""],drawbox:[0,1,1,""],file_input:[0,1,1,""],file_output:[0,1,1,""],get_args:[0,1,1,""],hflip:[0,1,1,""],hue:[0,1,1,""],input:[0,1,1,""],merge_outputs:[0,1,1,""],output:[0,1,1,""],overlay:[0,1,1,""],overwrite_output:[0,1,1,""],run:[0,1,1,""],setpts:[0,1,1,""],trim:[0,1,1,""],vflip:[0,1,1,""],zoompan:[0,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:function"},terms:{"case":0,"default":0,For:0,PTS:0,The:0,accept:0,action:0,activ:0,adjust:0,after:0,alia:0,all:0,also:0,alwai:0,angl:0,anoth:0,appli:0,area:0,arg:0,argument:0,asetpt:0,ask:0,audio:0,author:0,automat:0,behavior:0,both:0,box:0,bright:0,chang:0,channel:0,check:0,cmd:0,codec:0,color:0,colorchannelmix:0,command:0,common:0,concat:0,concaten:0,configur:0,construct:0,contain:0,continu:0,convert:0,coordin:0,corner:0,correctli:0,correspond:0,degre:0,deprec:0,differ:0,disabl:0,displai:0,document:0,draw:0,drawbox:0,drop:0,durat:0,dure:0,each:0,edg:0,effect:0,encount:0,end:0,end_fram:0,end_pt:0,endal:0,eof:0,eof_act:0,eval:0,evalu:0,exactli:0,except:0,explicitli:0,expr:0,express:0,fail:0,file:0,file_input:0,file_output:0,filenam:0,filter:0,first:0,flip:0,follow:0,forc:0,format:0,fps:0,frame:0,gbrp:0,gener:0,get:0,get_arg:0,graph:0,handl:0,have:0,hd720:0,height:0,heigth:0,hflip:0,horizont:0,how:0,hue:0,huge:0,imag:0,immedi:0,includ:0,incom:0,index:0,init:0,initi:0,input:0,instead:0,interpret:0,invalid:0,invert:0,its:0,join:0,kept:0,kwarg:0,last:0,layout:0,left:0,line:0,longest:0,luma:0,main:0,main_parent_nod:0,mani:0,manual:0,maximum:0,mean:0,merge_output:0,mix:0,mode:0,modifi:0,modul:0,must:0,necessari:0,node:0,none:0,number:0,offici:0,onc:0,one:0,onli:0,option:0,other:0,output:0,over:0,overlai:0,overlaid:0,overlay_parent_nod:0,overwrit:0,overwrite_output:0,pack:0,pad:0,page:0,pan:0,paramet:0,parent_nod:0,pass:0,pixel:0,planar:0,preced:0,present:0,process:0,radian:0,rang:0,rate:0,reason:0,relat:0,repeat:0,repeatlast:0,resolut:0,result:0,rgb:0,run:0,same:0,sampl:0,satur:0,search:0,second:0,secondari:0,section:0,segment:0,select:0,set:0,setpt:0,shorter:0,shortest:0,shorthand:0,should:0,silenc:0,singl:0,size:0,sloppi:0,space:0,special:0,specifi:0,start:0,start_fram:0,start_pt:0,stream:0,subpart:0,sure:0,synchron:0,synopsi:0,syntax:0,system:0,take:0,termin:0,them:0,thi:0,thick:0,through:0,time:0,timebas:0,timestamp:0,togeth:0,top:0,track:0,trim:0,type:0,unit:0,unsaf:0,until:0,url:0,use:0,used:0,user:0,util:0,valu:0,variabl:0,variou:0,vertic:0,vflip:0,video:0,visibl:0,when:0,which:0,width:0,within:0,without:0,work:0,write:0,yuv420:0,yuv422:0,yuv444:0,zoom:0,zoompan:0},titles:["ffmpeg-python: Python bindings for FFmpeg"],titleterms:{bind:0,ffmpeg:0,indic:0,python:0,tabl:0}})
|
@ -30,7 +30,7 @@ sys.path.insert(0, os.path.abspath('../..'))
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = ['sphinx.ext.autodoc']
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon']
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
@ -8,27 +8,53 @@ from .nodes import (
|
||||
|
||||
|
||||
def file_input(filename):
|
||||
"""Input file URL (ffmpeg ``-i`` option)
|
||||
|
||||
Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`__
|
||||
"""
|
||||
return InputNode(file_input.__name__, filename=filename)
|
||||
|
||||
|
||||
def input(filename):
|
||||
"""Shorthand for ``file_input``"""
|
||||
return file_input(filename)
|
||||
|
||||
|
||||
@operator(node_classes={OutputNode, GlobalNode})
|
||||
def overwrite_output(parent):
|
||||
return GlobalNode(parent, overwrite_output.__name__)
|
||||
def overwrite_output(parent_node):
|
||||
"""Overwrite output files without asking (ffmpeg ``-y`` option)
|
||||
|
||||
Official documentation: `Main options <https://ffmpeg.org/ffmpeg.html#Main-options>`__
|
||||
"""
|
||||
return GlobalNode(parent_node, overwrite_output.__name__)
|
||||
|
||||
|
||||
@operator(node_classes={OutputNode})
|
||||
def merge_outputs(*parents):
|
||||
return OutputNode(parents, merge_outputs.__name__)
|
||||
def merge_outputs(*parent_nodes):
|
||||
return OutputNode(parent_nodes, merge_outputs.__name__)
|
||||
|
||||
|
||||
@operator(node_classes={InputNode, FilterNode})
|
||||
def file_output(parent, filename):
|
||||
return OutputNode([parent], file_output.__name__, filename=filename)
|
||||
def file_output(parent_node, filename):
|
||||
"""Output file URL
|
||||
|
||||
Official documentation: `Synopsis <https://ffmpeg.org/ffmpeg.html#Synopsis>`__
|
||||
"""
|
||||
return OutputNode([parent_node], file_output.__name__, filename=filename)
|
||||
|
||||
|
||||
@operator(node_classes={InputNode, FilterNode})
|
||||
def output(parent_node, filename):
|
||||
"""Shorthand for ``file_output``"""
|
||||
return file_output(parent_node, filename)
|
||||
|
||||
|
||||
|
||||
__all__ = [
|
||||
'file_input',
|
||||
'file_output',
|
||||
'input',
|
||||
'merge_outputs',
|
||||
'output',
|
||||
'overwrite_output',
|
||||
]
|
||||
|
@ -5,64 +5,201 @@ from .nodes import (
|
||||
|
||||
|
||||
@operator()
|
||||
def setpts(parent, expr):
|
||||
return FilterNode([parent], setpts.__name__, expr)
|
||||
def setpts(parent_node, expr):
|
||||
"""Change the PTS (presentation timestamp) of the input frames.
|
||||
|
||||
Args:
|
||||
expr: The expression which is evaluated for each frame to construct its timestamp.
|
||||
|
||||
Official documentation: `setpts, asetpts <https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts>`__
|
||||
"""
|
||||
return FilterNode([parent_node], setpts.__name__, expr)
|
||||
|
||||
|
||||
@operator()
|
||||
def trim(parent, **kwargs):
|
||||
return FilterNode([parent], trim.__name__, **kwargs)
|
||||
def trim(parent_node, **kwargs):
|
||||
"""Trim the input so that the output contains one continuous subpart of the input.
|
||||
|
||||
Args:
|
||||
start: Specify the time of the start of the kept section, i.e. the frame with the timestamp start will be the
|
||||
first frame in the output.
|
||||
end: Specify the time of the first frame that will be dropped, i.e. the frame immediately preceding the one
|
||||
with the timestamp end will be the last frame in the output.
|
||||
start_pts: This is the same as start, except this option sets the start timestamp in timebase units instead of
|
||||
seconds.
|
||||
end_pts: This is the same as end, except this option sets the end timestamp in timebase units instead of
|
||||
seconds.
|
||||
duration: The maximum duration of the output in seconds.
|
||||
start_frame: The number of the first frame that should be passed to the output.
|
||||
end_frame: The number of the first frame that should be dropped.
|
||||
|
||||
Official documentation: `trim <https://ffmpeg.org/ffmpeg-filters.html#trim>`__
|
||||
"""
|
||||
return FilterNode([parent_node], trim.__name__, **kwargs)
|
||||
|
||||
|
||||
@operator()
|
||||
def overlay(main_parent, overlay_parent, eof_action='repeat', **kwargs):
|
||||
def overlay(main_parent_node, overlay_parent_node, eof_action='repeat', **kwargs):
|
||||
"""Overlay one video on top of another.
|
||||
|
||||
Args:
|
||||
x: Set the expression for the x coordinates of the overlaid video on the main video. Default value is 0. In
|
||||
case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed
|
||||
within the output visible area).
|
||||
y: Set the expression for the y coordinates of the overlaid video on the main video. Default value is 0. In
|
||||
case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed
|
||||
within the output visible area).
|
||||
eof_action: The action to take when EOF is encountered on the secondary input; it accepts one of the following
|
||||
values:
|
||||
|
||||
* ``repeat``: Repeat the last frame (the default).
|
||||
* ``endall``: End both streams.
|
||||
* ``pass``: Pass the main input through.
|
||||
|
||||
eval: Set when the expressions for x, and y are evaluated.
|
||||
It accepts the following values:
|
||||
|
||||
* ``init``: only evaluate expressions once during the filter initialization or when a command is
|
||||
processed
|
||||
* ``frame``: evaluate expressions for each incoming frame
|
||||
|
||||
Default value is ``frame``.
|
||||
shortest: If set to 1, force the output to terminate when the shortest input terminates. Default value is 0.
|
||||
format: Set the format for the output video.
|
||||
It accepts the following values:
|
||||
|
||||
* ``yuv420``: force YUV420 output
|
||||
* ``yuv422``: force YUV422 output
|
||||
* ``yuv444``: force YUV444 output
|
||||
* ``rgb``: force packed RGB output
|
||||
* ``gbrp``: force planar RGB output
|
||||
|
||||
Default value is ``yuv420``.
|
||||
rgb (deprecated): If set to 1, force the filter to accept inputs in the RGB color space. Default value is 0.
|
||||
This option is deprecated, use format instead.
|
||||
repeatlast: If set to 1, force the filter to draw the last overlay frame over the main input until the end of
|
||||
the stream. A value of 0 disables this behavior. Default value is 1.
|
||||
|
||||
Official documentation: `overlay <https://ffmpeg.org/ffmpeg-filters.html#overlay-1>`__
|
||||
"""
|
||||
kwargs['eof_action'] = eof_action
|
||||
return FilterNode([main_parent, overlay_parent], overlay.__name__, **kwargs)
|
||||
return FilterNode([main_parent_node, overlay_parent_node], overlay.__name__, **kwargs)
|
||||
|
||||
|
||||
@operator()
|
||||
def hflip(parent):
|
||||
return FilterNode([parent], hflip.__name__)
|
||||
def hflip(parent_node):
|
||||
"""Flip the input video horizontally.
|
||||
|
||||
Official documentation: `hflip <https://ffmpeg.org/ffmpeg-filters.html#hflip>`__
|
||||
"""
|
||||
return FilterNode([parent_node], hflip.__name__)
|
||||
|
||||
|
||||
@operator()
|
||||
def vflip(parent):
|
||||
return FilterNode([parent], vflip.__name__)
|
||||
def vflip(parent_node):
|
||||
"""Flip the input video vertically.
|
||||
|
||||
Official documentation: `vflip <https://ffmpeg.org/ffmpeg-filters.html#vflip>`__
|
||||
"""
|
||||
return FilterNode([parent_node], vflip.__name__)
|
||||
|
||||
|
||||
@operator()
|
||||
def drawbox(parent, x, y, width, height, color, thickness=None, **kwargs):
|
||||
def drawbox(parent_node, x, y, width, height, color, thickness=None, **kwargs):
|
||||
"""Draw a colored box on the input image.
|
||||
|
||||
Args:
|
||||
x: The expression which specifies the top left corner x coordinate of the box. It defaults to 0.
|
||||
y: The expression which specifies the top left corner y coordinate of the box. It defaults to 0.
|
||||
width: Specify the width of the box; if 0 interpreted as the input width. It defaults to 0.
|
||||
heigth: Specify the height of the box; if 0 interpreted as the input height. It defaults to 0.
|
||||
color: Specify the color of the box to write. For the general syntax of this option, check the "Color" section
|
||||
in the ffmpeg-utils manual. If the special value invert is used, the box edge color is the same as the
|
||||
video with inverted luma.
|
||||
thickness: The expression which sets the thickness of the box edge. Default value is 3.
|
||||
w: Alias for ``width``.
|
||||
h: Alias for ``height``.
|
||||
c: Alias for ``color``.
|
||||
t: Alias for ``thickness``.
|
||||
|
||||
Official documentation: `drawbox <https://ffmpeg.org/ffmpeg-filters.html#drawbox>`__
|
||||
"""
|
||||
if thickness:
|
||||
kwargs['t'] = thickness
|
||||
return FilterNode([parent], drawbox.__name__, x, y, width, height, color, **kwargs)
|
||||
return FilterNode([parent_node], drawbox.__name__, x, y, width, height, color, **kwargs)
|
||||
|
||||
|
||||
@operator()
|
||||
def concat(*parents, **kwargs):
|
||||
kwargs['n'] = len(parents)
|
||||
return FilterNode(parents, concat.__name__, **kwargs)
|
||||
def concat(*parent_nodes, **kwargs):
|
||||
"""Concatenate audio and video streams, joining them together one after the other.
|
||||
|
||||
The filter works on segments of synchronized video and audio streams. All segments must have the same number of
|
||||
streams of each type, and that will also be the number of streams at output.
|
||||
|
||||
Args:
|
||||
unsafe: Activate unsafe mode: do not fail if segments have a different format.
|
||||
|
||||
Related streams do not always have exactly the same duration, for various reasons including codec frame size or
|
||||
sloppy authoring. For that reason, related synchronized streams (e.g. a video and its audio track) should be
|
||||
concatenated at once. The concat filter will use the duration of the longest stream in each segment (except the
|
||||
last one), and if necessary pad shorter audio streams with silence.
|
||||
|
||||
For this filter to work correctly, all segments must start at timestamp 0.
|
||||
|
||||
All corresponding streams must have the same parameters in all segments; the filtering system will automatically
|
||||
select a common pixel format for video streams, and a common sample format, sample rate and channel layout for
|
||||
audio streams, but other settings, such as resolution, must be converted explicitly by the user.
|
||||
|
||||
Different frame rates are acceptable but will result in variable frame rate at output; be sure to configure the
|
||||
output file to handle it.
|
||||
|
||||
Official documentation: `concat <https://ffmpeg.org/ffmpeg-filters.html#concat>`__
|
||||
"""
|
||||
kwargs['n'] = len(parent_nodes)
|
||||
return FilterNode(parent_nodes, concat.__name__, **kwargs)
|
||||
|
||||
|
||||
@operator()
|
||||
def zoompan(parent, **kwargs):
|
||||
return FilterNode([parent], zoompan.__name__, **kwargs)
|
||||
def zoompan(parent_node, **kwargs):
|
||||
"""Apply Zoom & Pan effect.
|
||||
|
||||
Args:
|
||||
zoom: Set the zoom expression. Default is 1.
|
||||
x: Set the x expression. Default is 0.
|
||||
y: Set the y expression. Default is 0.
|
||||
d: Set the duration expression in number of frames. This sets for how many number of frames effect will last
|
||||
for single input image.
|
||||
s: Set the output image size, default is ``hd720``.
|
||||
fps: Set the output frame rate, default is 25.
|
||||
z: Alias for ``zoom``.
|
||||
|
||||
Official documentation: `zoompan <https://ffmpeg.org/ffmpeg-filters.html#zoompan>`__
|
||||
"""
|
||||
return FilterNode([parent_node], zoompan.__name__, **kwargs)
|
||||
|
||||
|
||||
@operator()
|
||||
def hue(parent, **kwargs):
|
||||
return FilterNode([parent], hue.__name__, **kwargs)
|
||||
def hue(parent_node, **kwargs):
|
||||
"""Modify the hue and/or the saturation of the input.
|
||||
|
||||
Args:
|
||||
h: Specify the hue angle as a number of degrees. It accepts an expression, and defaults to "0".
|
||||
s: Specify the saturation in the [-10,10] range. It accepts an expression and defaults to "1".
|
||||
H: Specify the hue angle as a number of radians. It accepts an expression, and defaults to "0".
|
||||
b: Specify the brightness in the [-10,10] range. It accepts an expression and defaults to "0".
|
||||
|
||||
Official documentation: `hue <https://ffmpeg.org/ffmpeg-filters.html#hue>`__
|
||||
"""
|
||||
return FilterNode([parent_node], hue.__name__, **kwargs)
|
||||
|
||||
|
||||
@operator()
|
||||
def colorchannelmixer(parent, *args, **kwargs):
|
||||
def colorchannelmixer(parent_node, *args, **kwargs):
|
||||
"""Adjust video input frames by re-mixing color channels.
|
||||
|
||||
`FFmpeg colorchannelmixer filter`_
|
||||
|
||||
.. _FFmpeg colorchannelmixer filter:
|
||||
https://ffmpeg.org/ffmpeg-filters.html#toc-colorchannelmixer
|
||||
Official documentation: `colorchannelmixer <https://ffmpeg.org/ffmpeg-filters.html#colorchannelmixer>`__
|
||||
"""
|
||||
return FilterNode([parent], colorchannelmixer.__name__, **kwargs)
|
||||
return FilterNode([parent_node], colorchannelmixer.__name__, **kwargs)
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
@ -81,10 +81,11 @@ def _get_output_args(node, stream_name_map):
|
||||
|
||||
|
||||
@operator(node_classes={OutputNode, GlobalNode})
|
||||
def get_args(parent):
|
||||
def get_args(node):
|
||||
"""Get command-line arguments for ffmpeg."""
|
||||
args = []
|
||||
# TODO: group nodes together, e.g. `-i somefile -r somerate`.
|
||||
sorted_nodes, child_map = _topo_sort(parent)
|
||||
sorted_nodes, child_map = _topo_sort(node)
|
||||
input_nodes = [node for node in sorted_nodes if isinstance(node, InputNode)]
|
||||
output_nodes = [node for node in sorted_nodes if isinstance(node, OutputNode) and not
|
||||
isinstance(node, GlobalNode)]
|
||||
@ -101,8 +102,9 @@ def get_args(parent):
|
||||
|
||||
|
||||
@operator(node_classes={OutputNode, GlobalNode})
|
||||
def run(parent, cmd='ffmpeg'):
|
||||
args = [cmd] + parent.get_args()
|
||||
def run(node, cmd='ffmpeg'):
|
||||
"""Run ffmpeg on node graph."""
|
||||
args = [cmd] + node.get_args()
|
||||
_subprocess.check_call(args)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user