mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-05 12:48:09 +08:00
Add filter_
and filter_multi
functions
This commit is contained in:
parent
e14e9e5a35
commit
637a2a5bc3
@ -90,6 +90,12 @@
|
|||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="index.html#module-ffmpeg">ffmpeg (module)</a>
|
<li><a href="index.html#module-ffmpeg">ffmpeg (module)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="index.html#ffmpeg.filter_">filter_() (in module ffmpeg)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="index.html#ffmpeg.filter_multi">filter_multi() (in module ffmpeg)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
@ -121,6 +121,62 @@ video with inverted luma.</li>
|
|||||||
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#drawbox">drawbox</a></p>
|
<p>Official documentation: <a class="reference external" href="https://ffmpeg.org/ffmpeg-filters.html#drawbox">drawbox</a></p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="ffmpeg.filter_">
|
||||||
|
<code class="descclassname">ffmpeg.</code><code class="descname">filter_</code><span class="sig-paren">(</span><em>parent_node</em>, <em>filter_name</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.filter_" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Apply custom single-source filter.</p>
|
||||||
|
<p><code class="docutils literal"><span class="pre">filter_</span></code> is normally used by higher-level filter functions such as <code class="docutils literal"><span class="pre">hflip</span></code>, but if a filter implementation
|
||||||
|
is missing from <code class="docutils literal"><span class="pre">fmpeg-python</span></code>, you can call <code class="docutils literal"><span class="pre">filter_</span></code> directly to have <code class="docutils literal"><span class="pre">fmpeg-python</span></code> pass the filter name
|
||||||
|
and arguments to ffmpeg verbatim.</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>parent_node</strong> – Source stream to apply filter to.</li>
|
||||||
|
<li><strong>filter_name</strong> – ffmpeg filter name, e.g. <cite>colorchannelmixer</cite></li>
|
||||||
|
<li><strong>*args</strong> – list of args to pass to ffmpeg verbatim</li>
|
||||||
|
<li><strong>**kwargs</strong> – list of keyword-args to pass to ffmpeg verbatim</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>This function is used internally by all of the other single-source filters (e.g. <code class="docutils literal"><span class="pre">hflip</span></code>, <code class="docutils literal"><span class="pre">crop</span></code>, etc.).
|
||||||
|
For custom multi-source filters, see <code class="docutils literal"><span class="pre">filter_multi</span></code> instead.</p>
|
||||||
|
<p>The function name is suffixed with <code class="docutils literal"><span class="pre">_</span></code> in order avoid confusion with the standard python <code class="docutils literal"><span class="pre">filter</span></code> function.</p>
|
||||||
|
<p class="rubric">Example</p>
|
||||||
|
<p><code class="docutils literal"><span class="pre">ffmpeg.input('in.mp4').filter_('hflip').output('out.mp4').run()</span></code></p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="ffmpeg.filter_multi">
|
||||||
|
<code class="descclassname">ffmpeg.</code><code class="descname">filter_multi</code><span class="sig-paren">(</span><em>parent_nodes</em>, <em>filter_name</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ffmpeg.filter_multi" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Apply custom multi-source filter.</p>
|
||||||
|
<p>This is nearly identical to the <code class="docutils literal"><span class="pre">filter</span></code> function except that it allows filters to be applied to multiple
|
||||||
|
streams. It’s normally used by higher-level filter functions such as <code class="docutils literal"><span class="pre">concat</span></code>, but if a filter implementation
|
||||||
|
is missing from <code class="docutils literal"><span class="pre">fmpeg-python</span></code>, you can call <code class="docutils literal"><span class="pre">filter_multi</span></code> directly.</p>
|
||||||
|
<p>Note that because it applies to multiple streams, it can’t be used as an operator, unlike the <code class="docutils literal"><span class="pre">filter</span></code> function
|
||||||
|
(e.g. <code class="docutils literal"><span class="pre">ffmpeg.input('in.mp4').filter_('hflip')</span></code>)</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>parent_nodes</strong> – List of source streams to apply filter to.</li>
|
||||||
|
<li><strong>filter_name</strong> – ffmpeg filter name, e.g. <cite>concat</cite></li>
|
||||||
|
<li><strong>*args</strong> – list of args to pass to ffmpeg verbatim</li>
|
||||||
|
<li><strong>**kwargs</strong> – list of keyword-args to pass to ffmpeg verbatim</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>For custom single-source filters, see <code class="docutils literal"><span class="pre">filter_multi</span></code> instead.</p>
|
||||||
|
<p class="rubric">Example</p>
|
||||||
|
<p><code class="docutils literal"><span class="pre">ffmpeg.filter_multi(ffmpeg.input('in1.mp4'),</span> <span class="pre">ffmpeg.input('in2.mp4'),</span> <span class="pre">'concat',</span> <span class="pre">n=2).output('out.mp4').run()</span></code></p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt id="ffmpeg.hflip">
|
<dt id="ffmpeg.hflip">
|
||||||
<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>
|
<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>
|
||||||
|
@ -2,7 +2,5 @@
|
|||||||
# Project: ffmpeg-python
|
# Project: ffmpeg-python
|
||||||
# Version:
|
# Version:
|
||||||
# The remainder of this file is compressed using zlib.
|
# The remainder of this file is compressed using zlib.
|
||||||
xÚ<EFBFBD>ÓÁŠƒ0à»O1°{µl¯>@¡‡…Â>@‰:‰<>d&ĤÕ>ýªAÚÂÂÎI™|¿3!FkÐ@˜Ï}v_`©Çé0$ï>Jþ„ºÒ<tì8vƒ"Bçí„q<E2809E>êL]²Lp|
¿¥¨SIDû¨î-O"k0]U4£ÚÙ “EÎRȲMyŒ¯œÓ<12>M[¬ŒÞ0:5‹í=Ú´#
|
xÚ•ÓÁj„0à»O1Ð^]ºW`¡‡ÂB@¢Nb ™„8ÙÕ>}Õ Ý…B§'eòýÎD<C38E>Ö>¢<>¸4>Ù!¼<>¥çÓÈÞ½”Zý
|
||||||
ÅL"7b
|
u¥wxꃩ:ogL[TgêÙ‚ócø)E½b’ºwaYmcjÿc}vlEƒÜªd&µ³Q&3Šœ¥˜eoÌc2؆Ìk@6m±2zÃäÔ"¶÷dùFJ™DnBŽÂíq²^oâ¯ö‚<>ê<EFBFBD>I
Ò^<5E>‰‡Æ©Ôg8ª»ƒ÷í¶úaCè7ô JÇ:.<jàº_¡[…¥õoÔ!Á岑j=<3D>¿ô‹K},”~”ƒ]:O¨Öãûœ(µ‚?ËúU¬¾ÿMp-
|
||||||
Âí¥h½Þħö`öAý3©AÚ*0¦¾qªEõöêæ༾VOÖs·¢Q:ÖaNS—í í",-£æ§ÓJªåýÑ/Ìõ¾P>ø]î^é<¢ZnØ{¢Ô
|
|
||||||
þ)ëe°ú§|OŒ
|
|
@ -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,""],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,com: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,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,github:0,graph:0,handl:0,have:0,hd720:0,height:0,heigth:0,hflip:0,horizont:0,how:0,http: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,kkroen: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,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}})
|
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,""],filter_:[0,1,1,""],filter_multi:[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,"function":0,For:0,PTS:0,The:0,accept:0,action:0,activ:0,adjust:0,after:0,alia:0,all:0,allow: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,avoid:0,becaus:0,behavior:0,both:0,box:0,bright:0,call:0,can:0,chang:0,channel:0,check:0,cmd:0,codec:0,color:0,colorchannelmix:0,com:0,command:0,common:0,concat:0,concaten:0,configur:0,confus:0,construct:0,contain:0,continu:0,convert:0,coordin:0,corner:0,correctli:0,correspond:0,crop:0,custom:0,degre:0,deprec:0,differ:0,directli: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,etc:0,eval:0,evalu:0,exactli:0,exampl:0,except:0,explicitli:0,expr:0,express:0,fail:0,file:0,filenam:0,filter:0,filter_:0,filter_multi:0,filter_nam:0,first:0,flip:0,fmpeg:0,follow:0,forc:0,format:0,fps:0,frame:0,from:0,gbrp:0,gener:0,get:0,get_arg:0,github:0,graph:0,handl:0,have:0,hd720:0,height:0,heigth:0,hflip:0,higher:0,horizont:0,how:0,http:0,hue:0,huge:0,ident:0,imag:0,immedi:0,implement:0,in1:0,in2:0,includ:0,incom:0,index:0,init:0,initi:0,input:0,instead:0,intern:0,interpret:0,invalid:0,invert:0,its:0,join:0,kept:0,keyword:0,kkroen:0,kwarg:0,last:0,layout:0,left:0,level:0,line:0,list:0,longest:0,luma:0,main:0,main_parent_nod:0,mani:0,manual:0,maximum:0,mean:0,merge_output:0,miss:0,mix:0,mode:0,modifi:0,modul:0,mp4:0,multi:0,multipl:0,must:0,name:0,nearli:0,necessari:0,node:0,none:0,normal:0,note:0,number:0,offici:0,onc:0,one:0,onli:0,oper:0,option:0,order:0,other:0,out: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,see:0,segment:0,select:0,set:0,setpt:0,shorter:0,shortest:0,should:0,silenc:0,singl:0,size:0,sloppi:0,sourc:0,space:0,special:0,specifi:0,standard:0,start:0,start_fram:0,start_pt:0,stream:0,subpart:0,suffix: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,unlik:0,unsaf:0,until:0,url:0,use:0,used:0,user:0,util:0,valu:0,variabl:0,variou:0,verbatim:0,vertic:0,vflip:0,video:0,visibl:0,when:0,which:0,width:0,within:0,without:0,work:0,write:0,you: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}})
|
@ -4,6 +4,58 @@ from .nodes import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@operator()
|
||||||
|
def filter_(parent_node, filter_name, *args, **kwargs):
|
||||||
|
"""Apply custom single-source filter.
|
||||||
|
|
||||||
|
``filter_`` is normally used by higher-level filter functions such as ``hflip``, but if a filter implementation
|
||||||
|
is missing from ``fmpeg-python``, you can call ``filter_`` directly to have ``fmpeg-python`` pass the filter name
|
||||||
|
and arguments to ffmpeg verbatim.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent_node: Source stream to apply filter to.
|
||||||
|
filter_name: ffmpeg filter name, e.g. `colorchannelmixer`
|
||||||
|
*args: list of args to pass to ffmpeg verbatim
|
||||||
|
**kwargs: list of keyword-args to pass to ffmpeg verbatim
|
||||||
|
|
||||||
|
This function is used internally by all of the other single-source filters (e.g. ``hflip``, ``crop``, etc.).
|
||||||
|
For custom multi-source filters, see ``filter_multi`` instead.
|
||||||
|
|
||||||
|
The function name is suffixed with ``_`` in order avoid confusion with the standard python ``filter`` function.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
``ffmpeg.input('in.mp4').filter_('hflip').output('out.mp4').run()``
|
||||||
|
"""
|
||||||
|
return FilterNode([parent_node], filter_name, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def filter_multi(parent_nodes, filter_name, *args, **kwargs):
|
||||||
|
"""Apply custom multi-source filter.
|
||||||
|
|
||||||
|
This is nearly identical to the ``filter`` function except that it allows filters to be applied to multiple
|
||||||
|
streams. It's normally used by higher-level filter functions such as ``concat``, but if a filter implementation
|
||||||
|
is missing from ``fmpeg-python``, you can call ``filter_multi`` directly.
|
||||||
|
|
||||||
|
Note that because it applies to multiple streams, it can't be used as an operator, unlike the ``filter`` function
|
||||||
|
(e.g. ``ffmpeg.input('in.mp4').filter_('hflip')``)
|
||||||
|
|
||||||
|
Args:
|
||||||
|
parent_nodes: List of source streams to apply filter to.
|
||||||
|
filter_name: ffmpeg filter name, e.g. `concat`
|
||||||
|
*args: list of args to pass to ffmpeg verbatim
|
||||||
|
**kwargs: list of keyword-args to pass to ffmpeg verbatim
|
||||||
|
|
||||||
|
For custom single-source filters, see ``filter_multi`` instead.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
``ffmpeg.filter_multi(ffmpeg.input('in1.mp4'), ffmpeg.input('in2.mp4'), 'concat', n=2).output('out.mp4').run()``
|
||||||
|
"""
|
||||||
|
return FilterNode(parent_nodes, filter_name, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
def setpts(parent_node, expr):
|
def setpts(parent_node, expr):
|
||||||
"""Change the PTS (presentation timestamp) of the input frames.
|
"""Change the PTS (presentation timestamp) of the input frames.
|
||||||
@ -13,7 +65,7 @@ def setpts(parent_node, expr):
|
|||||||
|
|
||||||
Official documentation: `setpts, asetpts <https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts>`__
|
Official documentation: `setpts, asetpts <https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], setpts.__name__, expr)
|
return filter_(parent_node, setpts.__name__, expr)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -35,7 +87,7 @@ def trim(parent_node, **kwargs):
|
|||||||
|
|
||||||
Official documentation: `trim <https://ffmpeg.org/ffmpeg-filters.html#trim>`__
|
Official documentation: `trim <https://ffmpeg.org/ffmpeg-filters.html#trim>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], trim.__name__, **kwargs)
|
return filter_(parent_node, trim.__name__, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -83,7 +135,7 @@ def overlay(main_parent_node, overlay_parent_node, eof_action='repeat', **kwargs
|
|||||||
Official documentation: `overlay <https://ffmpeg.org/ffmpeg-filters.html#overlay-1>`__
|
Official documentation: `overlay <https://ffmpeg.org/ffmpeg-filters.html#overlay-1>`__
|
||||||
"""
|
"""
|
||||||
kwargs['eof_action'] = eof_action
|
kwargs['eof_action'] = eof_action
|
||||||
return FilterNode([main_parent_node, overlay_parent_node], overlay.__name__, **kwargs)
|
return filter_multi([main_parent_node, overlay_parent_node], overlay.__name__, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -92,7 +144,7 @@ def hflip(parent_node):
|
|||||||
|
|
||||||
Official documentation: `hflip <https://ffmpeg.org/ffmpeg-filters.html#hflip>`__
|
Official documentation: `hflip <https://ffmpeg.org/ffmpeg-filters.html#hflip>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], hflip.__name__)
|
return filter_(parent_node, hflip.__name__)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -101,7 +153,7 @@ def vflip(parent_node):
|
|||||||
|
|
||||||
Official documentation: `vflip <https://ffmpeg.org/ffmpeg-filters.html#vflip>`__
|
Official documentation: `vflip <https://ffmpeg.org/ffmpeg-filters.html#vflip>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], vflip.__name__)
|
return filter_(parent_node, vflip.__name__)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -126,7 +178,7 @@ def drawbox(parent_node, x, y, width, height, color, thickness=None, **kwargs):
|
|||||||
"""
|
"""
|
||||||
if thickness:
|
if thickness:
|
||||||
kwargs['t'] = thickness
|
kwargs['t'] = thickness
|
||||||
return FilterNode([parent_node], drawbox.__name__, x, y, width, height, color, **kwargs)
|
return filter_(parent_node, drawbox.__name__, x, y, width, height, color, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -156,7 +208,7 @@ def concat(*parent_nodes, **kwargs):
|
|||||||
Official documentation: `concat <https://ffmpeg.org/ffmpeg-filters.html#concat>`__
|
Official documentation: `concat <https://ffmpeg.org/ffmpeg-filters.html#concat>`__
|
||||||
"""
|
"""
|
||||||
kwargs['n'] = len(parent_nodes)
|
kwargs['n'] = len(parent_nodes)
|
||||||
return FilterNode(parent_nodes, concat.__name__, **kwargs)
|
return filter_multi(parent_nodes, concat.__name__, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -175,7 +227,7 @@ def zoompan(parent_node, **kwargs):
|
|||||||
|
|
||||||
Official documentation: `zoompan <https://ffmpeg.org/ffmpeg-filters.html#zoompan>`__
|
Official documentation: `zoompan <https://ffmpeg.org/ffmpeg-filters.html#zoompan>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], zoompan.__name__, **kwargs)
|
return filter_(parent_node, zoompan.__name__, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -190,7 +242,7 @@ def hue(parent_node, **kwargs):
|
|||||||
|
|
||||||
Official documentation: `hue <https://ffmpeg.org/ffmpeg-filters.html#hue>`__
|
Official documentation: `hue <https://ffmpeg.org/ffmpeg-filters.html#hue>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], hue.__name__, **kwargs)
|
return filter_(parent_node, hue.__name__, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@operator()
|
@operator()
|
||||||
@ -199,13 +251,15 @@ def colorchannelmixer(parent_node, *args, **kwargs):
|
|||||||
|
|
||||||
Official documentation: `colorchannelmixer <https://ffmpeg.org/ffmpeg-filters.html#colorchannelmixer>`__
|
Official documentation: `colorchannelmixer <https://ffmpeg.org/ffmpeg-filters.html#colorchannelmixer>`__
|
||||||
"""
|
"""
|
||||||
return FilterNode([parent_node], colorchannelmixer.__name__, **kwargs)
|
return filter_(parent_node, colorchannelmixer.__name__, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'colorchannelmixer',
|
'colorchannelmixer',
|
||||||
'concat',
|
'concat',
|
||||||
'drawbox',
|
'drawbox',
|
||||||
|
'filter_',
|
||||||
|
'filter_multi',
|
||||||
'hflip',
|
'hflip',
|
||||||
'hue',
|
'hue',
|
||||||
'overlay',
|
'overlay',
|
||||||
|
@ -142,7 +142,7 @@ def test_run_failing_cmd():
|
|||||||
|
|
||||||
def test_custom_filter():
|
def test_custom_filter():
|
||||||
node = ffmpeg.input('dummy.mp4')
|
node = ffmpeg.input('dummy.mp4')
|
||||||
node = FilterNode([node], 'custom_filter', 'a', 'b', kwarg1='c')
|
node = ffmpeg.filter_(node, 'custom_filter', 'a', 'b', kwarg1='c')
|
||||||
node = ffmpeg.output(node, 'dummy2.mp4')
|
node = ffmpeg.output(node, 'dummy2.mp4')
|
||||||
assert node.get_args() == [
|
assert node.get_args() == [
|
||||||
'-i', 'dummy.mp4',
|
'-i', 'dummy.mp4',
|
||||||
@ -153,13 +153,9 @@ def test_custom_filter():
|
|||||||
|
|
||||||
|
|
||||||
def test_custom_filter_fluent():
|
def test_custom_filter_fluent():
|
||||||
@operator()
|
|
||||||
def custom_filter(parent_node, arg1, arg2, kwarg1):
|
|
||||||
return FilterNode([parent_node], 'custom_filter', arg1, arg2, kwarg1=kwarg1)
|
|
||||||
|
|
||||||
node = ffmpeg \
|
node = ffmpeg \
|
||||||
.input('dummy.mp4') \
|
.input('dummy.mp4') \
|
||||||
.custom_filter('a', 'b', kwarg1='c') \
|
.filter_('custom_filter', 'a', 'b', kwarg1='c') \
|
||||||
.output('dummy2.mp4')
|
.output('dummy2.mp4')
|
||||||
assert node.get_args() == [
|
assert node.get_args() == [
|
||||||
'-i', 'dummy.mp4',
|
'-i', 'dummy.mp4',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user