filters.texi 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283
  1. @chapter Filtergraph description
  2. @c man begin FILTERGRAPH DESCRIPTION
  3. A filtergraph is a directed graph of connected filters. It can contain
  4. cycles, and there can be multiple links between a pair of
  5. filters. Each link has one input pad on one side connecting it to one
  6. filter from which it takes its input, and one output pad on the other
  7. side connecting it to the one filter accepting its output.
  8. Each filter in a filtergraph is an instance of a filter class
  9. registered in the application, which defines the features and the
  10. number of input and output pads of the filter.
  11. A filter with no input pads is called a "source", a filter with no
  12. output pads is called a "sink".
  13. @section Filtergraph syntax
  14. A filtergraph can be represented using a textual representation, which
  15. is recognized by the @code{-vf} and @code{-af} options of the ff*
  16. tools, and by the @code{avfilter_graph_parse()} function defined in
  17. @file{libavfilter/avfiltergraph.h}.
  18. A filterchain consists of a sequence of connected filters, each one
  19. connected to the previous one in the sequence. A filterchain is
  20. represented by a list of ","-separated filter descriptions.
  21. A filtergraph consists of a sequence of filterchains. A sequence of
  22. filterchains is represented by a list of ";"-separated filterchain
  23. descriptions.
  24. A filter is represented by a string of the form:
  25. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  26. @var{filter_name} is the name of the filter class of which the
  27. described filter is an instance of, and has to be the name of one of
  28. the filter classes registered in the program.
  29. The name of the filter class is optionally followed by a string
  30. "=@var{arguments}".
  31. @var{arguments} is a string which contains the parameters used to
  32. initialize the filter instance, and are described in the filter
  33. descriptions below.
  34. The list of arguments can be quoted using the character "'" as initial
  35. and ending mark, and the character '\' for escaping the characters
  36. within the quoted text; otherwise the argument string is considered
  37. terminated when the next special character (belonging to the set
  38. "[]=;,") is encountered.
  39. The name and arguments of the filter are optionally preceded and
  40. followed by a list of link labels.
  41. A link label allows to name a link and associate it to a filter output
  42. or input pad. The preceding labels @var{in_link_1}
  43. ... @var{in_link_N}, are associated to the filter input pads,
  44. the following labels @var{out_link_1} ... @var{out_link_M}, are
  45. associated to the output pads.
  46. When two link labels with the same name are found in the
  47. filtergraph, a link between the corresponding input and output pad is
  48. created.
  49. If an output pad is not labelled, it is linked by default to the first
  50. unlabelled input pad of the next filter in the filterchain.
  51. For example in the filterchain:
  52. @example
  53. nullsrc, split[L1], [L2]overlay, nullsink
  54. @end example
  55. the split filter instance has two output pads, and the overlay filter
  56. instance two input pads. The first output pad of split is labelled
  57. "L1", the first input pad of overlay is labelled "L2", and the second
  58. output pad of split is linked to the second input pad of overlay,
  59. which are both unlabelled.
  60. In a complete filterchain all the unlabelled filter input and output
  61. pads must be connected. A filtergraph is considered valid if all the
  62. filter input and output pads of all the filterchains are connected.
  63. Follows a BNF description for the filtergraph syntax:
  64. @example
  65. @var{NAME} ::= sequence of alphanumeric characters and '_'
  66. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  67. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  68. @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
  69. @var{FILTER} ::= [@var{LINKNAMES}] @var{NAME} ["=" @var{ARGUMENTS}] [@var{LINKNAMES}]
  70. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  71. @var{FILTERGRAPH} ::= @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  72. @end example
  73. @c man end FILTERGRAPH DESCRIPTION
  74. @chapter Audio Filters
  75. @c man begin AUDIO FILTERS
  76. When you configure your FFmpeg build, you can disable any of the
  77. existing filters using --disable-filters.
  78. The configure output will show the audio filters included in your
  79. build.
  80. Below is a description of the currently available audio filters.
  81. @section aformat
  82. Convert the input audio to one of the specified formats. The framework will
  83. negotiate the most appropriate format to minimize conversions.
  84. The filter accepts three lists of formats, separated by ":", in the form:
  85. "@var{sample_formats}:@var{channel_layouts}:@var{packing_formats}".
  86. Elements in each list are separated by "," which has to be escaped in the
  87. filtergraph specification.
  88. The special parameter "all", in place of a list of elements, signifies all
  89. supported formats.
  90. Some examples follow:
  91. @example
  92. aformat=u8\\,s16:mono:packed
  93. aformat=s16:mono\\,stereo:all
  94. @end example
  95. @section anull
  96. Pass the audio source unchanged to the output.
  97. @c man end AUDIO FILTERS
  98. @chapter Audio Sources
  99. @c man begin AUDIO SOURCES
  100. Below is a description of the currently available audio sources.
  101. @section anullsrc
  102. Null audio source, never return audio frames. It is mainly useful as a
  103. template and to be employed in analysis / debugging tools.
  104. It accepts as optional parameter a string of the form
  105. @var{sample_rate}:@var{channel_layout}.
  106. @var{sample_rate} specify the sample rate, and defaults to 44100.
  107. @var{channel_layout} specify the channel layout, and can be either an
  108. integer or a string representing a channel layout. The default value
  109. of @var{channel_layout} is 3, which corresponds to CH_LAYOUT_STEREO.
  110. Check the channel_layout_map definition in
  111. @file{libavcodec/audioconvert.c} for the mapping between strings and
  112. channel layout values.
  113. Follow some examples:
  114. @example
  115. # set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO.
  116. anullsrc=48000:4
  117. # same as
  118. anullsrc=48000:mono
  119. @end example
  120. @c man end AUDIO SOURCES
  121. @chapter Audio Sinks
  122. @c man begin AUDIO SINKS
  123. Below is a description of the currently available audio sinks.
  124. @section abuffersink
  125. Buffer audio frames, and make them available to the end of filter chain.
  126. This sink is mainly intended for programmatic use, in particular
  127. through the interface defined in @file{libavfilter/asink_abuffer.h}.
  128. It requires a pointer to a ABufferSinkContext structure, which defines the
  129. incoming buffers' format, to be passed as the opaque parameter to
  130. @code{avfilter_init_filter} for initialization.
  131. @section anullsink
  132. Null audio sink, do absolutely nothing with the input audio. It is
  133. mainly useful as a template and to be employed in analysis / debugging
  134. tools.
  135. @c man end AUDIO SINKS
  136. @chapter Video Filters
  137. @c man begin VIDEO FILTERS
  138. When you configure your FFmpeg build, you can disable any of the
  139. existing filters using --disable-filters.
  140. The configure output will show the video filters included in your
  141. build.
  142. Below is a description of the currently available video filters.
  143. @section blackframe
  144. Detect frames that are (almost) completely black. Can be useful to
  145. detect chapter transitions or commercials. Output lines consist of
  146. the frame number of the detected frame, the percentage of blackness,
  147. the position in the file if known or -1 and the timestamp in seconds.
  148. In order to display the output lines, you need to set the loglevel at
  149. least to the AV_LOG_INFO value.
  150. The filter accepts the syntax:
  151. @example
  152. blackframe[=@var{amount}:[@var{threshold}]]
  153. @end example
  154. @var{amount} is the percentage of the pixels that have to be below the
  155. threshold, and defaults to 98.
  156. @var{threshold} is the threshold below which a pixel value is
  157. considered black, and defaults to 32.
  158. @section boxblur
  159. Apply boxblur algorithm to the input video.
  160. This filter accepts the parameters:
  161. @var{luma_power}:@var{luma_radius}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
  162. Chroma and alpha parameters are optional, if not specified they default
  163. to the corresponding values set for @var{luma_radius} and
  164. @var{luma_power}.
  165. @var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent
  166. the radius in pixels of the box used for blurring the corresponding
  167. input plane. They are expressions, and can contain the following
  168. constants:
  169. @table @option
  170. @item w, h
  171. the input width and heigth in pixels
  172. @item cw, ch
  173. the input chroma image width and height in pixels
  174. @item hsub, vsub
  175. horizontal and vertical chroma subsample values. For example for the
  176. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  177. @end table
  178. The radius must be a non-negative number, and must be not greater than
  179. the value of the expression @code{min(w,h)/2} for the luma and alpha planes,
  180. and of @code{min(cw,ch)/2} for the chroma planes.
  181. @var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent
  182. how many times the boxblur filter is applied to the corresponding
  183. plane.
  184. Some examples follow:
  185. @itemize
  186. @item
  187. Apply a boxblur filter with luma, chroma, and alpha radius
  188. set to 2:
  189. @example
  190. boxblur=2:1
  191. @end example
  192. @item
  193. Set luma radius to 2, alpha and chroma radius to 0
  194. @example
  195. boxblur=2:1:0:0:0:0
  196. @end example
  197. @item
  198. Set luma and chroma radius to a fraction of the video dimension
  199. @example
  200. boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
  201. @end example
  202. @end itemize
  203. @section copy
  204. Copy the input source unchanged to the output. Mainly useful for
  205. testing purposes.
  206. @section crop
  207. Crop the input video to @var{out_w}:@var{out_h}:@var{x}:@var{y}.
  208. The parameters are expressions containing the following constants:
  209. @table @option
  210. @item E, PI, PHI
  211. the corresponding mathematical approximated values for e
  212. (euler number), pi (greek PI), PHI (golden ratio)
  213. @item x, y
  214. the computed values for @var{x} and @var{y}. They are evaluated for
  215. each new frame.
  216. @item in_w, in_h
  217. the input width and heigth
  218. @item iw, ih
  219. same as @var{in_w} and @var{in_h}
  220. @item out_w, out_h
  221. the output (cropped) width and heigth
  222. @item ow, oh
  223. same as @var{out_w} and @var{out_h}
  224. @item a
  225. same as @var{iw} / @var{ih}
  226. @item sar
  227. input sample aspect ratio
  228. @item dar
  229. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  230. @item hsub, vsub
  231. horizontal and vertical chroma subsample values. For example for the
  232. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  233. @item n
  234. the number of input frame, starting from 0
  235. @item pos
  236. the position in the file of the input frame, NAN if unknown
  237. @item t
  238. timestamp expressed in seconds, NAN if the input timestamp is unknown
  239. @end table
  240. The @var{out_w} and @var{out_h} parameters specify the expressions for
  241. the width and height of the output (cropped) video. They are
  242. evaluated just at the configuration of the filter.
  243. The default value of @var{out_w} is "in_w", and the default value of
  244. @var{out_h} is "in_h".
  245. The expression for @var{out_w} may depend on the value of @var{out_h},
  246. and the expression for @var{out_h} may depend on @var{out_w}, but they
  247. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  248. evaluated after @var{out_w} and @var{out_h}.
  249. The @var{x} and @var{y} parameters specify the expressions for the
  250. position of the top-left corner of the output (non-cropped) area. They
  251. are evaluated for each frame. If the evaluated value is not valid, it
  252. is approximated to the nearest valid value.
  253. The default value of @var{x} is "(in_w-out_w)/2", and the default
  254. value for @var{y} is "(in_h-out_h)/2", which set the cropped area at
  255. the center of the input image.
  256. The expression for @var{x} may depend on @var{y}, and the expression
  257. for @var{y} may depend on @var{x}.
  258. Follow some examples:
  259. @example
  260. # crop the central input area with size 100x100
  261. crop=100:100
  262. # crop the central input area with size 2/3 of the input video
  263. "crop=2/3*in_w:2/3*in_h"
  264. # crop the input video central square
  265. crop=in_h
  266. # delimit the rectangle with the top-left corner placed at position
  267. # 100:100 and the right-bottom corner corresponding to the right-bottom
  268. # corner of the input image.
  269. crop=in_w-100:in_h-100:100:100
  270. # crop 10 pixels from the left and right borders, and 20 pixels from
  271. # the top and bottom borders
  272. "crop=in_w-2*10:in_h-2*20"
  273. # keep only the bottom right quarter of the input image
  274. "crop=in_w/2:in_h/2:in_w/2:in_h/2"
  275. # crop height for getting Greek harmony
  276. "crop=in_w:1/PHI*in_w"
  277. # trembling effect
  278. "crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)"
  279. # erratic camera effect depending on timestamp
  280. "crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  281. # set x depending on the value of y
  282. "crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
  283. @end example
  284. @section cropdetect
  285. Auto-detect crop size.
  286. Calculate necessary cropping parameters and prints the recommended
  287. parameters through the logging system. The detected dimensions
  288. correspond to the non-black area of the input video.
  289. It accepts the syntax:
  290. @example
  291. cropdetect[=@var{limit}[:@var{round}[:@var{reset}]]]
  292. @end example
  293. @table @option
  294. @item limit
  295. Threshold, which can be optionally specified from nothing (0) to
  296. everything (255), defaults to 24.
  297. @item round
  298. Value which the width/height should be divisible by, defaults to
  299. 16. The offset is automatically adjusted to center the video. Use 2 to
  300. get only even dimensions (needed for 4:2:2 video). 16 is best when
  301. encoding to most video codecs.
  302. @item reset
  303. Counter that determines after how many frames cropdetect will reset
  304. the previously detected largest video area and start over to detect
  305. the current optimal crop area. Defaults to 0.
  306. This can be useful when channel logos distort the video area. 0
  307. indicates never reset and return the largest area encountered during
  308. playback.
  309. @end table
  310. @section delogo
  311. Suppress a TV station logo by a simple interpolation of the surrounding
  312. pixels. Just set a rectangle covering the logo and watch it disappear
  313. (and sometimes something even uglier appear - your mileage may vary).
  314. The filter accepts parameters as a string of the form
  315. "@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
  316. @var{key}=@var{value} pairs, separated by ":".
  317. The description of the accepted parameters follows.
  318. @table @option
  319. @item x, y
  320. Specify the top left corner coordinates of the logo. They must be
  321. specified.
  322. @item w, h
  323. Specify the width and height of the logo to clear. They must be
  324. specified.
  325. @item band, t
  326. Specify the thickness of the fuzzy edge of the rectangle (added to
  327. @var{w} and @var{h}). The default value is 4.
  328. @item show
  329. When set to 1, a green rectangle is drawn on the screen to simplify
  330. finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
  331. @var{band} is set to 4. The default value is 0.
  332. @end table
  333. Some examples follow.
  334. @itemize
  335. @item
  336. Set a rectangle covering the area with top left corner coordinates 0,0
  337. and size 100x77, setting a band of size 10:
  338. @example
  339. delogo=0:0:100:77:10
  340. @end example
  341. @item
  342. As the previous example, but use named options:
  343. @example
  344. delogo=x=0:y=0:w=100:h=77:band=10
  345. @end example
  346. @end itemize
  347. @section drawbox
  348. Draw a colored box on the input image.
  349. It accepts the syntax:
  350. @example
  351. drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
  352. @end example
  353. @table @option
  354. @item x, y
  355. Specify the top left corner coordinates of the box. Default to 0.
  356. @item width, height
  357. Specify the width and height of the box, if 0 they are interpreted as
  358. the input width and height. Default to 0.
  359. @item color
  360. Specify the color of the box to write, it can be the name of a color
  361. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  362. @end table
  363. Follow some examples:
  364. @example
  365. # draw a black box around the edge of the input image
  366. drawbox
  367. # draw a box with color red and an opacity of 50%
  368. drawbox=10:20:200:60:red@@0.5"
  369. @end example
  370. @section drawtext
  371. Draw text string or text from specified file on top of video using the
  372. libfreetype library.
  373. To enable compilation of this filter you need to configure FFmpeg with
  374. @code{--enable-libfreetype}.
  375. The filter also recognizes strftime() sequences in the provided text
  376. and expands them accordingly. Check the documentation of strftime().
  377. The filter accepts parameters as a list of @var{key}=@var{value} pairs,
  378. separated by ":".
  379. The description of the accepted parameters follows.
  380. @table @option
  381. @item fontfile
  382. The font file to be used for drawing text. Path must be included.
  383. This parameter is mandatory.
  384. @item text
  385. The text string to be drawn. The text must be a sequence of UTF-8
  386. encoded characters.
  387. This parameter is mandatory if no file is specified with the parameter
  388. @var{textfile}.
  389. @item textfile
  390. A text file containing text to be drawn. The text must be a sequence
  391. of UTF-8 encoded characters.
  392. This parameter is mandatory if no text string is specified with the
  393. parameter @var{text}.
  394. If both text and textfile are specified, an error is thrown.
  395. @item x, y
  396. The offsets where text will be drawn within the video frame.
  397. Relative to the top/left border of the output image.
  398. The default value of @var{x} and @var{y} is 0.
  399. @item fontsize
  400. The font size to be used for drawing text.
  401. The default value of @var{fontsize} is 16.
  402. @item fontcolor
  403. The color to be used for drawing fonts.
  404. Either a string (e.g. "red") or in 0xRRGGBB[AA] format
  405. (e.g. "0xff000033"), possibly followed by an alpha specifier.
  406. The default value of @var{fontcolor} is "black".
  407. @item boxcolor
  408. The color to be used for drawing box around text.
  409. Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
  410. (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  411. The default value of @var{boxcolor} is "white".
  412. @item box
  413. Used to draw a box around text using background color.
  414. Value should be either 1 (enable) or 0 (disable).
  415. The default value of @var{box} is 0.
  416. @item shadowx, shadowy
  417. The x and y offsets for the text shadow position with respect to the
  418. position of the text. They can be either positive or negative
  419. values. Default value for both is "0".
  420. @item shadowcolor
  421. The color to be used for drawing a shadow behind the drawn text. It
  422. can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
  423. form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
  424. The default value of @var{shadowcolor} is "black".
  425. @item ft_load_flags
  426. Flags to be used for loading the fonts.
  427. The flags map the corresponding flags supported by libfreetype, and are
  428. a combination of the following values:
  429. @table @var
  430. @item default
  431. @item no_scale
  432. @item no_hinting
  433. @item render
  434. @item no_bitmap
  435. @item vertical_layout
  436. @item force_autohint
  437. @item crop_bitmap
  438. @item pedantic
  439. @item ignore_global_advance_width
  440. @item no_recurse
  441. @item ignore_transform
  442. @item monochrome
  443. @item linear_design
  444. @item no_autohint
  445. @item end table
  446. @end table
  447. Default value is "render".
  448. For more information consult the documentation for the FT_LOAD_*
  449. libfreetype flags.
  450. @item tabsize
  451. The size in number of spaces to use for rendering the tab.
  452. Default value is 4.
  453. @end table
  454. For example the command:
  455. @example
  456. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  457. @end example
  458. will draw "Test Text" with font FreeSerif, using the default values
  459. for the optional parameters.
  460. The command:
  461. @example
  462. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  463. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  464. @end example
  465. will draw 'Test Text' with font FreeSerif of size 24 at position x=100
  466. and y=50 (counting from the top-left corner of the screen), text is
  467. yellow with a red box around it. Both the text and the box have an
  468. opacity of 20%.
  469. Note that the double quotes are not necessary if spaces are not used
  470. within the parameter list.
  471. For more information about libfreetype, check:
  472. @url{http://www.freetype.org/}.
  473. @section fade
  474. Apply fade-in/out effect to input video.
  475. It accepts the parameters:
  476. @var{type}:@var{start_frame}:@var{nb_frames}
  477. @var{type} specifies if the effect type, can be either "in" for
  478. fade-in, or "out" for a fade-out effect.
  479. @var{start_frame} specifies the number of the start frame for starting
  480. to apply the fade effect.
  481. @var{nb_frames} specifies the number of frames for which the fade
  482. effect has to last. At the end of the fade-in effect the output video
  483. will have the same intensity as the input video, at the end of the
  484. fade-out transition the output video will be completely black.
  485. A few usage examples follow, usable too as test scenarios.
  486. @example
  487. # fade in first 30 frames of video
  488. fade=in:0:30
  489. # fade out last 45 frames of a 200-frame video
  490. fade=out:155:45
  491. # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
  492. fade=in:0:25, fade=out:975:25
  493. # make first 5 frames black, then fade in from frame 5-24
  494. fade=in:5:20
  495. @end example
  496. @section fieldorder
  497. Transform the field order of the input video.
  498. It accepts one parameter which specifies the required field order that
  499. the input interlaced video will be transformed to. The parameter can
  500. assume one of the following values:
  501. @table @option
  502. @item 0 or bff
  503. output bottom field first
  504. @item 1 or tff
  505. output top field first
  506. @end table
  507. Default value is "tff".
  508. Transformation is achieved by shifting the picture content up or down
  509. by one line, and filling the remaining line with appropriate picture content.
  510. This method is consistent with most broadcast field order converters.
  511. If the input video is not flagged as being interlaced, or it is already
  512. flagged as being of the required output field order then this filter does
  513. not alter the incoming video.
  514. This filter is very useful when converting to or from PAL DV material,
  515. which is bottom field first.
  516. For example:
  517. @example
  518. ./ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  519. @end example
  520. @section fifo
  521. Buffer input images and send them when they are requested.
  522. This filter is mainly useful when auto-inserted by the libavfilter
  523. framework.
  524. The filter does not take parameters.
  525. @section format
  526. Convert the input video to one of the specified pixel formats.
  527. Libavfilter will try to pick one that is supported for the input to
  528. the next filter.
  529. The filter accepts a list of pixel format names, separated by ":",
  530. for example "yuv420p:monow:rgb24".
  531. Some examples follow:
  532. @example
  533. # convert the input video to the format "yuv420p"
  534. format=yuv420p
  535. # convert the input video to any of the formats in the list
  536. format=yuv420p:yuv444p:yuv410p
  537. @end example
  538. @anchor{frei0r}
  539. @section frei0r
  540. Apply a frei0r effect to the input video.
  541. To enable compilation of this filter you need to install the frei0r
  542. header and configure FFmpeg with --enable-frei0r.
  543. The filter supports the syntax:
  544. @example
  545. @var{filter_name}[@{:|=@}@var{param1}:@var{param2}:...:@var{paramN}]
  546. @end example
  547. @var{filter_name} is the name to the frei0r effect to load. If the
  548. environment variable @env{FREI0R_PATH} is defined, the frei0r effect
  549. is searched in each one of the directories specified by the colon
  550. separated list in @env{FREIOR_PATH}, otherwise in the standard frei0r
  551. paths, which are in this order: @file{HOME/.frei0r-1/lib/},
  552. @file{/usr/local/lib/frei0r-1/}, @file{/usr/lib/frei0r-1/}.
  553. @var{param1}, @var{param2}, ... , @var{paramN} specify the parameters
  554. for the frei0r effect.
  555. A frei0r effect parameter can be a boolean (whose values are specified
  556. with "y" and "n"), a double, a color (specified by the syntax
  557. @var{R}/@var{G}/@var{B}, @var{R}, @var{G}, and @var{B} being float
  558. numbers from 0.0 to 1.0) or by an @code{av_parse_color()} color
  559. description), a position (specified by the syntax @var{X}/@var{Y},
  560. @var{X} and @var{Y} being float numbers) and a string.
  561. The number and kind of parameters depend on the loaded effect. If an
  562. effect parameter is not specified the default value is set.
  563. Some examples follow:
  564. @example
  565. # apply the distort0r effect, set the first two double parameters
  566. frei0r=distort0r:0.5:0.01
  567. # apply the colordistance effect, takes a color as first parameter
  568. frei0r=colordistance:0.2/0.3/0.4
  569. frei0r=colordistance:violet
  570. frei0r=colordistance:0x112233
  571. # apply the perspective effect, specify the top left and top right
  572. # image positions
  573. frei0r=perspective:0.2/0.2:0.8/0.2
  574. @end example
  575. For more information see:
  576. @url{http://piksel.org/frei0r}
  577. @section gradfun
  578. Fix the banding artifacts that are sometimes introduced into nearly flat
  579. regions by truncation to 8bit colordepth.
  580. Interpolate the gradients that should go where the bands are, and
  581. dither them.
  582. This filter is designed for playback only. Do not use it prior to
  583. lossy compression, because compression tends to lose the dither and
  584. bring back the bands.
  585. The filter takes two optional parameters, separated by ':':
  586. @var{strength}:@var{radius}
  587. @var{strength} is the maximum amount by which the filter will change
  588. any one pixel. Also the threshold for detecting nearly flat
  589. regions. Acceptable values range from .51 to 255, default value is
  590. 1.2, out-of-range values will be clipped to the valid range.
  591. @var{radius} is the neighborhood to fit the gradient to. A larger
  592. radius makes for smoother gradients, but also prevents the filter from
  593. modifying the pixels near detailed regions. Acceptable values are
  594. 8-32, default value is 16, out-of-range values will be clipped to the
  595. valid range.
  596. @example
  597. # default parameters
  598. gradfun=1.2:16
  599. # omitting radius
  600. gradfun=1.2
  601. @end example
  602. @section hflip
  603. Flip the input video horizontally.
  604. For example to horizontally flip the video in input with
  605. @file{ffmpeg}:
  606. @example
  607. ffmpeg -i in.avi -vf "hflip" out.avi
  608. @end example
  609. @section hqdn3d
  610. High precision/quality 3d denoise filter. This filter aims to reduce
  611. image noise producing smooth images and making still images really
  612. still. It should enhance compressibility.
  613. It accepts the following optional parameters:
  614. @var{luma_spatial}:@var{chroma_spatial}:@var{luma_tmp}:@var{chroma_tmp}
  615. @table @option
  616. @item luma_spatial
  617. a non-negative float number which specifies spatial luma strength,
  618. defaults to 4.0
  619. @item chroma_spatial
  620. a non-negative float number which specifies spatial chroma strength,
  621. defaults to 3.0*@var{luma_spatial}/4.0
  622. @item luma_tmp
  623. a float number which specifies luma temporal strength, defaults to
  624. 6.0*@var{luma_spatial}/4.0
  625. @item chroma_tmp
  626. a float number which specifies chroma temporal strength, defaults to
  627. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  628. @end table
  629. @section lut, lutrgb, lutyuv
  630. Compute a look-up table for binding each pixel component input value
  631. to an output value, and apply it to input video.
  632. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  633. to an RGB input video.
  634. These filters accept in input a ":"-separated list of options, which
  635. specify the expressions used for computing the lookup table for the
  636. corresponding pixel component values.
  637. The @var{lut} filter requires either YUV or RGB pixel formats in
  638. input, and accepts the options:
  639. @table @option
  640. @var{c0} (first pixel component)
  641. @var{c1} (second pixel component)
  642. @var{c2} (third pixel component)
  643. @var{c3} (fourth pixel component, corresponds to the alpha component)
  644. @end table
  645. The exact component associated to each option depends on the format in
  646. input.
  647. The @var{lutrgb} filter requires RGB pixel formats in input, and
  648. accepts the options:
  649. @table @option
  650. @var{r} (red component)
  651. @var{g} (green component)
  652. @var{b} (blue component)
  653. @var{a} (alpha component)
  654. @end table
  655. The @var{lutyuv} filter requires YUV pixel formats in input, and
  656. accepts the options:
  657. @table @option
  658. @var{y} (Y/luminance component)
  659. @var{u} (U/Cb component)
  660. @var{v} (V/Cr component)
  661. @var{a} (alpha component)
  662. @end table
  663. The expressions can contain the following constants and functions:
  664. @table @option
  665. @item E, PI, PHI
  666. the corresponding mathematical approximated values for e
  667. (euler number), pi (greek PI), PHI (golden ratio)
  668. @item w, h
  669. the input width and heigth
  670. @item val
  671. input value for the pixel component
  672. @item clipval
  673. the input value clipped in the @var{minval}-@var{maxval} range
  674. @item maxval
  675. maximum value for the pixel component
  676. @item minval
  677. minimum value for the pixel component
  678. @item negval
  679. the negated value for the pixel component value clipped in the
  680. @var{minval}-@var{maxval} range , it corresponds to the expression
  681. "maxval-clipval+minval"
  682. @item clip(val)
  683. the computed value in @var{val} clipped in the
  684. @var{minval}-@var{maxval} range
  685. @item gammaval(gamma)
  686. the computed gamma correction value of the pixel component value
  687. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  688. expression
  689. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  690. @end table
  691. All expressions default to "val".
  692. Some examples follow:
  693. @example
  694. # negate input video
  695. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  696. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  697. # the above is the same as
  698. lutrgb="r=negval:g=negval:b=negval"
  699. lutyuv="y=negval:u=negval:v=negval"
  700. # negate luminance
  701. lutyuv=negval
  702. # remove chroma components, turns the video into a graytone image
  703. lutyuv="u=128:v=128"
  704. # apply a luma burning effect
  705. lutyuv="y=2*val"
  706. # remove green and blue components
  707. lutrgb="g=0:b=0"
  708. # set a constant alpha channel value on input
  709. format=rgba,lutrgb=a="maxval-minval/2"
  710. # correct luminance gamma by a 0.5 factor
  711. lutyuv=y=gammaval(0.5)
  712. @end example
  713. @section mp
  714. Apply an MPlayer filter to the input video.
  715. This filter provides a wrapper around most of the filters of
  716. MPlayer/MEncoder.
  717. This wrapper is considered experimental. Some of the wrapped filters
  718. may not work properly and we may drop support for them, as they will
  719. be implemented natively into FFmpeg. Thus you should avoid
  720. depending on them when writing portable scripts.
  721. The filters accepts the parameters:
  722. @var{filter_name}[:=]@var{filter_params}
  723. @var{filter_name} is the name of a supported MPlayer filter,
  724. @var{filter_params} is a string containing the parameters accepted by
  725. the named filter.
  726. The list of the currently supported filters follows:
  727. @table @var
  728. @item 2xsai
  729. @item decimate
  730. @item delogo
  731. @item denoise3d
  732. @item detc
  733. @item dint
  734. @item divtc
  735. @item down3dright
  736. @item dsize
  737. @item eq2
  738. @item eq
  739. @item field
  740. @item fil
  741. @item fixpts
  742. @item framestep
  743. @item fspp
  744. @item geq
  745. @item harddup
  746. @item hqdn3d
  747. @item hue
  748. @item il
  749. @item ilpack
  750. @item ivtc
  751. @item kerndeint
  752. @item mcdeint
  753. @item mirror
  754. @item noise
  755. @item ow
  756. @item palette
  757. @item perspective
  758. @item phase
  759. @item pp7
  760. @item pullup
  761. @item qp
  762. @item rectangle
  763. @item remove-logo
  764. @item rotate
  765. @item sab
  766. @item screenshot
  767. @item smartblur
  768. @item softpulldown
  769. @item softskip
  770. @item spp
  771. @item swapuv
  772. @item telecine
  773. @item tile
  774. @item tinterlace
  775. @item unsharp
  776. @item uspp
  777. @item yuvcsp
  778. @item yvu9
  779. @end table
  780. The parameter syntax and behavior for the listed filters are the same
  781. of the corresponding MPlayer filters. For detailed instructions check
  782. the "VIDEO FILTERS" section in the MPlayer manual.
  783. Some examples follow:
  784. @example
  785. # remove a logo by interpolating the surrounding pixels
  786. mp=delogo=200:200:80:20:1
  787. # adjust gamma, brightness, contrast
  788. mp=eq2=1.0:2:0.5
  789. # tweak hue and saturation
  790. mp=hue=100:-10
  791. @end example
  792. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  793. @section negate
  794. Negate input video.
  795. This filter accepts an integer in input, if non-zero it negates the
  796. alpha component (if available). The default value in input is 0.
  797. @section noformat
  798. Force libavfilter not to use any of the specified pixel formats for the
  799. input to the next filter.
  800. The filter accepts a list of pixel format names, separated by ":",
  801. for example "yuv420p:monow:rgb24".
  802. Some examples follow:
  803. @example
  804. # force libavfilter to use a format different from "yuv420p" for the
  805. # input to the vflip filter
  806. noformat=yuv420p,vflip
  807. # convert the input video to any of the formats not contained in the list
  808. noformat=yuv420p:yuv444p:yuv410p
  809. @end example
  810. @section null
  811. Pass the video source unchanged to the output.
  812. @section ocv
  813. Apply video transform using libopencv.
  814. To enable this filter install libopencv library and headers and
  815. configure FFmpeg with --enable-libopencv.
  816. The filter takes the parameters: @var{filter_name}@{:=@}@var{filter_params}.
  817. @var{filter_name} is the name of the libopencv filter to apply.
  818. @var{filter_params} specifies the parameters to pass to the libopencv
  819. filter. If not specified the default values are assumed.
  820. Refer to the official libopencv documentation for more precise
  821. informations:
  822. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  823. Follows the list of supported libopencv filters.
  824. @anchor{dilate}
  825. @subsection dilate
  826. Dilate an image by using a specific structuring element.
  827. This filter corresponds to the libopencv function @code{cvDilate}.
  828. It accepts the parameters: @var{struct_el}:@var{nb_iterations}.
  829. @var{struct_el} represents a structuring element, and has the syntax:
  830. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  831. @var{cols} and @var{rows} represent the number of colums and rows of
  832. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  833. point, and @var{shape} the shape for the structuring element, and
  834. can be one of the values "rect", "cross", "ellipse", "custom".
  835. If the value for @var{shape} is "custom", it must be followed by a
  836. string of the form "=@var{filename}". The file with name
  837. @var{filename} is assumed to represent a binary image, with each
  838. printable character corresponding to a bright pixel. When a custom
  839. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  840. or columns and rows of the read file are assumed instead.
  841. The default value for @var{struct_el} is "3x3+0x0/rect".
  842. @var{nb_iterations} specifies the number of times the transform is
  843. applied to the image, and defaults to 1.
  844. Follow some example:
  845. @example
  846. # use the default values
  847. ocv=dilate
  848. # dilate using a structuring element with a 5x5 cross, iterate two times
  849. ocv=dilate=5x5+2x2/cross:2
  850. # read the shape from the file diamond.shape, iterate two times
  851. # the file diamond.shape may contain a pattern of characters like this:
  852. # *
  853. # ***
  854. # *****
  855. # ***
  856. # *
  857. # the specified cols and rows are ignored (but not the anchor point coordinates)
  858. ocv=0x0+2x2/custom=diamond.shape:2
  859. @end example
  860. @subsection erode
  861. Erode an image by using a specific structuring element.
  862. This filter corresponds to the libopencv function @code{cvErode}.
  863. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  864. with the same syntax and semantics as the @ref{dilate} filter.
  865. @subsection smooth
  866. Smooth the input video.
  867. The filter takes the following parameters:
  868. @var{type}:@var{param1}:@var{param2}:@var{param3}:@var{param4}.
  869. @var{type} is the type of smooth filter to apply, and can be one of
  870. the following values: "blur", "blur_no_scale", "median", "gaussian",
  871. "bilateral". The default value is "gaussian".
  872. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  873. parameters whose meanings depend on smooth type. @var{param1} and
  874. @var{param2} accept integer positive values or 0, @var{param3} and
  875. @var{param4} accept float values.
  876. The default value for @var{param1} is 3, the default value for the
  877. other parameters is 0.
  878. These parameters correspond to the parameters assigned to the
  879. libopencv function @code{cvSmooth}.
  880. @section overlay
  881. Overlay one video on top of another.
  882. It takes two inputs and one output, the first input is the "main"
  883. video on which the second input is overlayed.
  884. It accepts the parameters: @var{x}:@var{y}.
  885. @var{x} is the x coordinate of the overlayed video on the main video,
  886. @var{y} is the y coordinate. The parameters are expressions containing
  887. the following parameters:
  888. @table @option
  889. @item main_w, main_h
  890. main input width and height
  891. @item W, H
  892. same as @var{main_w} and @var{main_h}
  893. @item overlay_w, overlay_h
  894. overlay input width and height
  895. @item w, h
  896. same as @var{overlay_w} and @var{overlay_h}
  897. @end table
  898. Be aware that frames are taken from each input video in timestamp
  899. order, hence, if their initial timestamps differ, it is a a good idea
  900. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  901. have them begin in the same zero timestamp, as it does the example for
  902. the @var{movie} filter.
  903. Follow some examples:
  904. @example
  905. # draw the overlay at 10 pixels from the bottom right
  906. # corner of the main video.
  907. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  908. # insert a transparent PNG logo in the bottom left corner of the input
  909. movie=logo.png [logo];
  910. [in][logo] overlay=10:main_h-overlay_h-10 [out]
  911. # insert 2 different transparent PNG logos (second logo on bottom
  912. # right corner):
  913. movie=logo1.png [logo1];
  914. movie=logo2.png [logo2];
  915. [in][logo1] overlay=10:H-h-10 [in+logo1];
  916. [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
  917. # add a transparent color layer on top of the main video,
  918. # WxH specifies the size of the main input to the overlay filter
  919. color=red@.3:WxH [over]; [in][over] overlay [out]
  920. @end example
  921. You can chain togheter more overlays but the efficiency of such
  922. approach is yet to be tested.
  923. @section pad
  924. Add paddings to the input image, and places the original input at the
  925. given coordinates @var{x}, @var{y}.
  926. It accepts the following parameters:
  927. @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
  928. The parameters @var{width}, @var{height}, @var{x}, and @var{y} are
  929. expressions containing the following constants:
  930. @table @option
  931. @item E, PI, PHI
  932. the corresponding mathematical approximated values for e
  933. (euler number), pi (greek PI), phi (golden ratio)
  934. @item in_w, in_h
  935. the input video width and heigth
  936. @item iw, ih
  937. same as @var{in_w} and @var{in_h}
  938. @item out_w, out_h
  939. the output width and heigth, that is the size of the padded area as
  940. specified by the @var{width} and @var{height} expressions
  941. @item ow, oh
  942. same as @var{out_w} and @var{out_h}
  943. @item x, y
  944. x and y offsets as specified by the @var{x} and @var{y}
  945. expressions, or NAN if not yet specified
  946. @item a
  947. same as @var{iw} / @var{ih}
  948. @item sar
  949. input sample aspect ratio
  950. @item dar
  951. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  952. @item hsub, vsub
  953. horizontal and vertical chroma subsample values. For example for the
  954. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  955. @end table
  956. Follows the description of the accepted parameters.
  957. @table @option
  958. @item width, height
  959. Specify the size of the output image with the paddings added. If the
  960. value for @var{width} or @var{height} is 0, the corresponding input size
  961. is used for the output.
  962. The @var{width} expression can reference the value set by the
  963. @var{height} expression, and viceversa.
  964. The default value of @var{width} and @var{height} is 0.
  965. @item x, y
  966. Specify the offsets where to place the input image in the padded area
  967. with respect to the top/left border of the output image.
  968. The @var{x} expression can reference the value set by the @var{y}
  969. expression, and viceversa.
  970. The default value of @var{x} and @var{y} is 0.
  971. @item color
  972. Specify the color of the padded area, it can be the name of a color
  973. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  974. The default value of @var{color} is "black".
  975. @end table
  976. Some examples follow:
  977. @example
  978. # Add paddings with color "violet" to the input video. Output video
  979. # size is 640x480, the top-left corner of the input video is placed at
  980. # column 0, row 40.
  981. pad=640:480:0:40:violet
  982. # pad the input to get an output with dimensions increased bt 3/2,
  983. # and put the input video at the center of the padded area
  984. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  985. # pad the input to get a squared output with size equal to the maximum
  986. # value between the input width and height, and put the input video at
  987. # the center of the padded area
  988. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  989. # pad the input to get a final w/h ratio of 16:9
  990. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  991. # for anamorphic video, in order to set the output display aspect ratio,
  992. # it is necessary to use sar in the expression, according to the relation:
  993. # (ih * X / ih) * sar = output_dar
  994. # X = output_dar / sar
  995. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  996. # double output size and put the input video in the bottom-right
  997. # corner of the output padded area
  998. pad="2*iw:2*ih:ow-iw:oh-ih"
  999. @end example
  1000. @section pixdesctest
  1001. Pixel format descriptor test filter, mainly useful for internal
  1002. testing. The output video should be equal to the input video.
  1003. For example:
  1004. @example
  1005. format=monow, pixdesctest
  1006. @end example
  1007. can be used to test the monowhite pixel format descriptor definition.
  1008. @section scale
  1009. Scale the input video to @var{width}:@var{height} and/or convert the image format.
  1010. The parameters @var{width} and @var{height} are expressions containing
  1011. the following constants:
  1012. @table @option
  1013. @item E, PI, PHI
  1014. the corresponding mathematical approximated values for e
  1015. (euler number), pi (greek PI), phi (golden ratio)
  1016. @item in_w, in_h
  1017. the input width and heigth
  1018. @item iw, ih
  1019. same as @var{in_w} and @var{in_h}
  1020. @item out_w, out_h
  1021. the output (cropped) width and heigth
  1022. @item ow, oh
  1023. same as @var{out_w} and @var{out_h}
  1024. @item a
  1025. same as @var{iw} / @var{ih}
  1026. @item sar
  1027. input sample aspect ratio
  1028. @item dar
  1029. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  1030. @item hsub, vsub
  1031. horizontal and vertical chroma subsample values. For example for the
  1032. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  1033. @end table
  1034. If the input image format is different from the format requested by
  1035. the next filter, the scale filter will convert the input to the
  1036. requested format.
  1037. If the value for @var{width} or @var{height} is 0, the respective input
  1038. size is used for the output.
  1039. If the value for @var{width} or @var{height} is -1, the scale filter will
  1040. use, for the respective output size, a value that maintains the aspect
  1041. ratio of the input image.
  1042. The default value of @var{width} and @var{height} is 0.
  1043. Some examples follow:
  1044. @example
  1045. # scale the input video to a size of 200x100.
  1046. scale=200:100
  1047. # scale the input to 2x
  1048. scale=2*iw:2*ih
  1049. # the above is the same as
  1050. scale=2*in_w:2*in_h
  1051. # scale the input to half size
  1052. scale=iw/2:ih/2
  1053. # increase the width, and set the height to the same size
  1054. scale=3/2*iw:ow
  1055. # seek for Greek harmony
  1056. scale=iw:1/PHI*iw
  1057. scale=ih*PHI:ih
  1058. # increase the height, and set the width to 3/2 of the height
  1059. scale=3/2*oh:3/5*ih
  1060. # increase the size, but make the size a multiple of the chroma
  1061. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  1062. # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
  1063. scale='min(500\, iw*3/2):-1'
  1064. @end example
  1065. @section select
  1066. Select frames to pass in output.
  1067. It accepts in input an expression, which is evaluated for each input
  1068. frame. If the expression is evaluated to a non-zero value, the frame
  1069. is selected and passed to the output, otherwise it is discarded.
  1070. The expression can contain the following constants:
  1071. @table @option
  1072. @item PI
  1073. Greek PI
  1074. @item PHI
  1075. golden ratio
  1076. @item E
  1077. Euler number
  1078. @item n
  1079. the sequential number of the filtered frame, starting from 0
  1080. @item selected_n
  1081. the sequential number of the selected frame, starting from 0
  1082. @item prev_selected_n
  1083. the sequential number of the last selected frame, NAN if undefined
  1084. @item TB
  1085. timebase of the input timestamps
  1086. @item pts
  1087. the PTS (Presentation TimeStamp) of the filtered video frame,
  1088. expressed in @var{TB} units, NAN if undefined
  1089. @item t
  1090. the PTS (Presentation TimeStamp) of the filtered video frame,
  1091. expressed in seconds, NAN if undefined
  1092. @item prev_pts
  1093. the PTS of the previously filtered video frame, NAN if undefined
  1094. @item prev_selected_pts
  1095. the PTS of the last previously filtered video frame, NAN if undefined
  1096. @item prev_selected_t
  1097. the PTS of the last previously selected video frame, NAN if undefined
  1098. @item start_pts
  1099. the PTS of the first video frame in the video, NAN if undefined
  1100. @item start_t
  1101. the time of the first video frame in the video, NAN if undefined
  1102. @item pict_type
  1103. the picture type of the filtered frame, can assume one of the following
  1104. values:
  1105. @table @option
  1106. @item PICT_TYPE_I
  1107. @item PICT_TYPE_P
  1108. @item PICT_TYPE_B
  1109. @item PICT_TYPE_S
  1110. @item PICT_TYPE_SI
  1111. @item PICT_TYPE_SP
  1112. @item PICT_TYPE_BI
  1113. @end table
  1114. @item interlace_type
  1115. the frame interlace type, can assume one of the following values:
  1116. @table @option
  1117. @item INTERLACE_TYPE_P
  1118. the frame is progressive (not interlaced)
  1119. @item INTERLACE_TYPE_T
  1120. the frame is top-field-first
  1121. @item INTERLACE_TYPE_B
  1122. the frame is bottom-field-first
  1123. @end table
  1124. @item key
  1125. 1 if the filtered frame is a key-frame, 0 otherwise
  1126. @item pos
  1127. the position in the file of the filtered frame, -1 if the information
  1128. is not available (e.g. for synthetic video)
  1129. @end table
  1130. The default value of the select expression is "1".
  1131. Some examples follow:
  1132. @example
  1133. # select all frames in input
  1134. select
  1135. # the above is the same as:
  1136. select=1
  1137. # skip all frames:
  1138. select=0
  1139. # select only I-frames
  1140. select='eq(pict_type\,PICT_TYPE_I)'
  1141. # select one frame every 100
  1142. select='not(mod(n\,100))'
  1143. # select only frames contained in the 10-20 time interval
  1144. select='gte(t\,10)*lte(t\,20)'
  1145. # select only I frames contained in the 10-20 time interval
  1146. select='gte(t\,10)*lte(t\,20)*eq(pict_type\,PICT_TYPE_I)'
  1147. # select frames with a minimum distance of 10 seconds
  1148. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  1149. @end example
  1150. @anchor{setdar}
  1151. @section setdar
  1152. Set the Display Aspect Ratio for the filter output video.
  1153. This is done by changing the specified Sample (aka Pixel) Aspect
  1154. Ratio, according to the following equation:
  1155. @math{DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR}
  1156. Keep in mind that this filter does not modify the pixel dimensions of
  1157. the video frame. Also the display aspect ratio set by this filter may
  1158. be changed by later filters in the filterchain, e.g. in case of
  1159. scaling or if another "setdar" or a "setsar" filter is applied.
  1160. The filter accepts a parameter string which represents the wanted
  1161. display aspect ratio.
  1162. The parameter can be a floating point number string, or an expression
  1163. of the form @var{num}:@var{den}, where @var{num} and @var{den} are the
  1164. numerator and denominator of the aspect ratio.
  1165. If the parameter is not specified, it is assumed the value "0:1".
  1166. For example to change the display aspect ratio to 16:9, specify:
  1167. @example
  1168. setdar=16:9
  1169. # the above is equivalent to
  1170. setdar=1.77777
  1171. @end example
  1172. See also the @ref{setsar} filter documentation.
  1173. @section setpts
  1174. Change the PTS (presentation timestamp) of the input video frames.
  1175. Accept in input an expression evaluated through the eval API, which
  1176. can contain the following constants:
  1177. @table @option
  1178. @item PTS
  1179. the presentation timestamp in input
  1180. @item PI
  1181. Greek PI
  1182. @item PHI
  1183. golden ratio
  1184. @item E
  1185. Euler number
  1186. @item N
  1187. the count of the input frame, starting from 0.
  1188. @item STARTPTS
  1189. the PTS of the first video frame
  1190. @item INTERLACED
  1191. tell if the current frame is interlaced
  1192. @item POS
  1193. original position in the file of the frame, or undefined if undefined
  1194. for the current frame
  1195. @item PREV_INPTS
  1196. previous input PTS
  1197. @item PREV_OUTPTS
  1198. previous output PTS
  1199. @end table
  1200. Some examples follow:
  1201. @example
  1202. # start counting PTS from zero
  1203. setpts=PTS-STARTPTS
  1204. # fast motion
  1205. setpts=0.5*PTS
  1206. # slow motion
  1207. setpts=2.0*PTS
  1208. # fixed rate 25 fps
  1209. setpts=N/(25*TB)
  1210. # fixed rate 25 fps with some jitter
  1211. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  1212. @end example
  1213. @anchor{setsar}
  1214. @section setsar
  1215. Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
  1216. Note that as a consequence of the application of this filter, the
  1217. output display aspect ratio will change according to the following
  1218. equation:
  1219. @math{DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR}
  1220. Keep in mind that the sample aspect ratio set by this filter may be
  1221. changed by later filters in the filterchain, e.g. if another "setsar"
  1222. or a "setdar" filter is applied.
  1223. The filter accepts a parameter string which represents the wanted
  1224. sample aspect ratio.
  1225. The parameter can be a floating point number string, or an expression
  1226. of the form @var{num}:@var{den}, where @var{num} and @var{den} are the
  1227. numerator and denominator of the aspect ratio.
  1228. If the parameter is not specified, it is assumed the value "0:1".
  1229. For example to change the sample aspect ratio to 10:11, specify:
  1230. @example
  1231. setsar=10:11
  1232. @end example
  1233. @section settb
  1234. Set the timebase to use for the output frames timestamps.
  1235. It is mainly useful for testing timebase configuration.
  1236. It accepts in input an arithmetic expression representing a rational.
  1237. The expression can contain the constants "PI", "E", "PHI", "AVTB" (the
  1238. default timebase), and "intb" (the input timebase).
  1239. The default value for the input is "intb".
  1240. Follow some examples.
  1241. @example
  1242. # set the timebase to 1/25
  1243. settb=1/25
  1244. # set the timebase to 1/10
  1245. settb=0.1
  1246. #set the timebase to 1001/1000
  1247. settb=1+0.001
  1248. #set the timebase to 2*intb
  1249. settb=2*intb
  1250. #set the default timebase value
  1251. settb=AVTB
  1252. @end example
  1253. @section showinfo
  1254. Show a line containing various information for each input video frame.
  1255. The input video is not modified.
  1256. The shown line contains a sequence of key/value pairs of the form
  1257. @var{key}:@var{value}.
  1258. A description of each shown parameter follows:
  1259. @table @option
  1260. @item n
  1261. sequential number of the input frame, starting from 0
  1262. @item pts
  1263. Presentation TimeStamp of the input frame, expressed as a number of
  1264. time base units. The time base unit depends on the filter input pad.
  1265. @item pts_time
  1266. Presentation TimeStamp of the input frame, expressed as a number of
  1267. seconds
  1268. @item pos
  1269. position of the frame in the input stream, -1 if this information in
  1270. unavailable and/or meanigless (for example in case of synthetic video)
  1271. @item fmt
  1272. pixel format name
  1273. @item sar
  1274. sample aspect ratio of the input frame, expressed in the form
  1275. @var{num}/@var{den}
  1276. @item s
  1277. size of the input frame, expressed in the form
  1278. @var{width}x@var{height}
  1279. @item i
  1280. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  1281. for bottom field first)
  1282. @item iskey
  1283. 1 if the frame is a key frame, 0 otherwise
  1284. @item type
  1285. picture type of the input frame ("I" for an I-frame, "P" for a
  1286. P-frame, "B" for a B-frame, "?" for unknown type).
  1287. Check also the documentation of the @code{AVPictureType} enum and of
  1288. the @code{av_get_picture_type_char} function defined in
  1289. @file{libavutil/avutil.h}.
  1290. @item checksum
  1291. Adler-32 checksum of all the planes of the input frame
  1292. @item plane_checksum
  1293. Adler-32 checksum of each plane of the input frame, expressed in the form
  1294. "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  1295. @end table
  1296. @section slicify
  1297. Pass the images of input video on to next video filter as multiple
  1298. slices.
  1299. @example
  1300. ./ffmpeg -i in.avi -vf "slicify=32" out.avi
  1301. @end example
  1302. The filter accepts the slice height as parameter. If the parameter is
  1303. not specified it will use the default value of 16.
  1304. Adding this in the beginning of filter chains should make filtering
  1305. faster due to better use of the memory cache.
  1306. @section split
  1307. Pass on the input video to two outputs. Both outputs are identical to
  1308. the input video.
  1309. For example:
  1310. @example
  1311. [in] split [splitout1][splitout2];
  1312. [splitout1] crop=100:100:0:0 [cropout];
  1313. [splitout2] pad=200:200:100:100 [padout];
  1314. @end example
  1315. will create two separate outputs from the same input, one cropped and
  1316. one padded.
  1317. @section transpose
  1318. Transpose rows with columns in the input video and optionally flip it.
  1319. It accepts a parameter representing an integer, which can assume the
  1320. values:
  1321. @table @samp
  1322. @item 0
  1323. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  1324. @example
  1325. L.R L.l
  1326. . . -> . .
  1327. l.r R.r
  1328. @end example
  1329. @item 1
  1330. Rotate by 90 degrees clockwise, that is:
  1331. @example
  1332. L.R l.L
  1333. . . -> . .
  1334. l.r r.R
  1335. @end example
  1336. @item 2
  1337. Rotate by 90 degrees counterclockwise, that is:
  1338. @example
  1339. L.R R.r
  1340. . . -> . .
  1341. l.r L.l
  1342. @end example
  1343. @item 3
  1344. Rotate by 90 degrees clockwise and vertically flip, that is:
  1345. @example
  1346. L.R r.R
  1347. . . -> . .
  1348. l.r l.L
  1349. @end example
  1350. @end table
  1351. @section unsharp
  1352. Sharpen or blur the input video.
  1353. It accepts the following parameters:
  1354. @var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
  1355. Negative values for the amount will blur the input video, while positive
  1356. values will sharpen. All parameters are optional and default to the
  1357. equivalent of the string '5:5:1.0:0:0:0.0'.
  1358. @table @option
  1359. @item luma_msize_x
  1360. Set the luma matrix horizontal size. It can be an integer between 3
  1361. and 13, default value is 5.
  1362. @item luma_msize_y
  1363. Set the luma matrix vertical size. It can be an integer between 3
  1364. and 13, default value is 5.
  1365. @item luma_amount
  1366. Set the luma effect strength. It can be a float number between -2.0
  1367. and 5.0, default value is 1.0.
  1368. @item chroma_msize_x
  1369. Set the chroma matrix horizontal size. It can be an integer between 3
  1370. and 13, default value is 0.
  1371. @item chroma_msize_y
  1372. Set the chroma matrix vertical size. It can be an integer between 3
  1373. and 13, default value is 0.
  1374. @item chroma_amount
  1375. Set the chroma effect strength. It can be a float number between -2.0
  1376. and 5.0, default value is 0.0.
  1377. @end table
  1378. @example
  1379. # Strong luma sharpen effect parameters
  1380. unsharp=7:7:2.5
  1381. # Strong blur of both luma and chroma parameters
  1382. unsharp=7:7:-2:7:7:-2
  1383. # Use the default values with @command{ffmpeg}
  1384. ./ffmpeg -i in.avi -vf "unsharp" out.mp4
  1385. @end example
  1386. @section vflip
  1387. Flip the input video vertically.
  1388. @example
  1389. ./ffmpeg -i in.avi -vf "vflip" out.avi
  1390. @end example
  1391. @section yadif
  1392. Deinterlace the input video ("yadif" means "yet another deinterlacing
  1393. filter").
  1394. It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}.
  1395. @var{mode} specifies the interlacing mode to adopt, accepts one of the
  1396. following values:
  1397. @table @option
  1398. @item 0
  1399. output 1 frame for each frame
  1400. @item 1
  1401. output 1 frame for each field
  1402. @item 2
  1403. like 0 but skips spatial interlacing check
  1404. @item 3
  1405. like 1 but skips spatial interlacing check
  1406. @end table
  1407. Default value is 0.
  1408. @var{parity} specifies the picture field parity assumed for the input
  1409. interlaced video, accepts one of the following values:
  1410. @table @option
  1411. @item 0
  1412. assume top field first
  1413. @item 1
  1414. assume bottom field first
  1415. @item -1
  1416. enable automatic detection
  1417. @end table
  1418. Default value is -1.
  1419. If interlacing is unknown or decoder does not export this information,
  1420. top field first will be assumed.
  1421. @var{auto} specifies if deinterlacer should trust the interlaced flag
  1422. and only deinterlace frames marked as interlaced
  1423. @table @option
  1424. @item 0
  1425. deinterlace all frames
  1426. @item 1
  1427. only deinterlace frames marked as interlaced
  1428. @end table
  1429. Default value is 0.
  1430. @c man end VIDEO FILTERS
  1431. @chapter Video Sources
  1432. @c man begin VIDEO SOURCES
  1433. Below is a description of the currently available video sources.
  1434. @section buffer
  1435. Buffer video frames, and make them available to the filter chain.
  1436. This source is mainly intended for a programmatic use, in particular
  1437. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  1438. It accepts the following parameters:
  1439. @var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den}:@var{scale_params}
  1440. All the parameters but @var{scale_params} need to be explicitely
  1441. defined.
  1442. Follows the list of the accepted parameters.
  1443. @table @option
  1444. @item width, height
  1445. Specify the width and height of the buffered video frames.
  1446. @item pix_fmt_string
  1447. A string representing the pixel format of the buffered video frames.
  1448. It may be a number corresponding to a pixel format, or a pixel format
  1449. name.
  1450. @item timebase_num, timebase_den
  1451. Specify numerator and denomitor of the timebase assumed by the
  1452. timestamps of the buffered frames.
  1453. @item sample_aspect_ratio.num, sample_aspect_ratio.den
  1454. Specify numerator and denominator of the sample aspect ratio assumed
  1455. by the video frames.
  1456. @item scale_params
  1457. Specify the optional parameters to be used for the scale filter which
  1458. is automatically inserted when an input change is detected in the
  1459. input size or format.
  1460. @end table
  1461. For example:
  1462. @example
  1463. buffer=320:240:yuv410p:1:24:1:1
  1464. @end example
  1465. will instruct the source to accept video frames with size 320x240 and
  1466. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  1467. square pixels (1:1 sample aspect ratio).
  1468. Since the pixel format with name "yuv410p" corresponds to the number 6
  1469. (check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
  1470. this example corresponds to:
  1471. @example
  1472. buffer=320:240:6:1:24:1:1
  1473. @end example
  1474. @section color
  1475. Provide an uniformly colored input.
  1476. It accepts the following parameters:
  1477. @var{color}:@var{frame_size}:@var{frame_rate}
  1478. Follows the description of the accepted parameters.
  1479. @table @option
  1480. @item color
  1481. Specify the color of the source. It can be the name of a color (case
  1482. insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
  1483. alpha specifier. The default value is "black".
  1484. @item frame_size
  1485. Specify the size of the sourced video, it may be a string of the form
  1486. @var{width}x@var{heigth}, or the name of a size abbreviation. The
  1487. default value is "320x240".
  1488. @item frame_rate
  1489. Specify the frame rate of the sourced video, as the number of frames
  1490. generated per second. It has to be a string in the format
  1491. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  1492. number or a valid video frame rate abbreviation. The default value is
  1493. "25".
  1494. @end table
  1495. For example the following graph description will generate a red source
  1496. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  1497. frames per second, which will be overlayed over the source connected
  1498. to the pad with identifier "in".
  1499. @example
  1500. "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]"
  1501. @end example
  1502. @section movie
  1503. Read a video stream from a movie container.
  1504. It accepts the syntax: @var{movie_name}[:@var{options}] where
  1505. @var{movie_name} is the name of the resource to read (not necessarily
  1506. a file but also a device or a stream accessed through some protocol),
  1507. and @var{options} is an optional sequence of @var{key}=@var{value}
  1508. pairs, separated by ":".
  1509. The description of the accepted options follows.
  1510. @table @option
  1511. @item format_name, f
  1512. Specifies the format assumed for the movie to read, and can be either
  1513. the name of a container or an input device. If not specified the
  1514. format is guessed from @var{movie_name} or by probing.
  1515. @item seek_point, sp
  1516. Specifies the seek point in seconds, the frames will be output
  1517. starting from this seek point, the parameter is evaluated with
  1518. @code{av_strtod} so the numerical value may be suffixed by an IS
  1519. postfix. Default value is "0".
  1520. @item stream_index, si
  1521. Specifies the index of the video stream to read. If the value is -1,
  1522. the best suited video stream will be automatically selected. Default
  1523. value is "-1".
  1524. @end table
  1525. This filter allows to overlay a second video on top of main input of
  1526. a filtergraph as shown in this graph:
  1527. @example
  1528. input -----------> deltapts0 --> overlay --> output
  1529. ^
  1530. |
  1531. movie --> scale--> deltapts1 -------+
  1532. @end example
  1533. Some examples follow:
  1534. @example
  1535. # skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  1536. # on top of the input labelled as "in".
  1537. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  1538. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  1539. # read from a video4linux2 device, and overlay it on top of the input
  1540. # labelled as "in"
  1541. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
  1542. [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
  1543. @end example
  1544. @section mptestsrc
  1545. Generate various test patterns, as generated by the MPlayer test filter.
  1546. The size of the generated video is fixed, and is 256x256.
  1547. This source is useful in particular for testing encoding features.
  1548. This source accepts an optional sequence of @var{key}=@var{value} pairs,
  1549. separated by ":". The description of the accepted options follows.
  1550. @table @option
  1551. @item rate, r
  1552. Specify the frame rate of the sourced video, as the number of frames
  1553. generated per second. It has to be a string in the format
  1554. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  1555. number or a valid video frame rate abbreviation. The default value is
  1556. "25".
  1557. @item duration, d
  1558. Set the video duration of the sourced video. The accepted syntax is:
  1559. @example
  1560. [-]HH[:MM[:SS[.m...]]]
  1561. [-]S+[.m...]
  1562. @end example
  1563. See also the function @code{av_parse_time()}.
  1564. If not specified, or the expressed duration is negative, the video is
  1565. supposed to be generated forever.
  1566. @item test, t
  1567. Set the number or the name of the test to perform. Supported tests are:
  1568. @table @option
  1569. @item dc_luma
  1570. @item dc_chroma
  1571. @item freq_luma
  1572. @item freq_chroma
  1573. @item amp_luma
  1574. @item amp_chroma
  1575. @item cbp
  1576. @item mv
  1577. @item ring1
  1578. @item ring2
  1579. @item all
  1580. @end table
  1581. Default value is "all", which will cycle through the list of all tests.
  1582. @end table
  1583. For example the following:
  1584. @example
  1585. testsrc=t=dc_luma
  1586. @end example
  1587. will generate a "dc_luma" test pattern.
  1588. @section nullsrc
  1589. Null video source, never return images. It is mainly useful as a
  1590. template and to be employed in analysis / debugging tools.
  1591. It accepts as optional parameter a string of the form
  1592. @var{width}:@var{height}:@var{timebase}.
  1593. @var{width} and @var{height} specify the size of the configured
  1594. source. The default values of @var{width} and @var{height} are
  1595. respectively 352 and 288 (corresponding to the CIF size format).
  1596. @var{timebase} specifies an arithmetic expression representing a
  1597. timebase. The expression can contain the constants "PI", "E", "PHI",
  1598. "AVTB" (the default timebase), and defaults to the value "AVTB".
  1599. @section frei0r_src
  1600. Provide a frei0r source.
  1601. To enable compilation of this filter you need to install the frei0r
  1602. header and configure FFmpeg with --enable-frei0r.
  1603. The source supports the syntax:
  1604. @example
  1605. @var{size}:@var{rate}:@var{src_name}[@{=|:@}@var{param1}:@var{param2}:...:@var{paramN}]
  1606. @end example
  1607. @var{size} is the size of the video to generate, may be a string of the
  1608. form @var{width}x@var{height} or a frame size abbreviation.
  1609. @var{rate} is the rate of the video to generate, may be a string of
  1610. the form @var{num}/@var{den} or a frame rate abbreviation.
  1611. @var{src_name} is the name to the frei0r source to load. For more
  1612. information regarding frei0r and how to set the parameters read the
  1613. section @ref{frei0r} in the description of the video filters.
  1614. Some examples follow:
  1615. @example
  1616. # generate a frei0r partik0l source with size 200x200 and framerate 10
  1617. # which is overlayed on the overlay filter main input
  1618. frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
  1619. @end example
  1620. @section rgbtestsrc, testsrc
  1621. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  1622. detecting RGB vs BGR issues. You should see a red, green and blue
  1623. stripe from top to bottom.
  1624. The @code{testsrc} source generates a test video pattern, showing a
  1625. color pattern, a scrolling gradient and a timestamp. This is mainly
  1626. intended for testing purposes.
  1627. Both sources accept an optional sequence of @var{key}=@var{value} pairs,
  1628. separated by ":". The description of the accepted options follows.
  1629. @table @option
  1630. @item size, s
  1631. Specify the size of the sourced video, it may be a string of the form
  1632. @var{width}x@var{heigth}, or the name of a size abbreviation. The
  1633. default value is "320x240".
  1634. @item rate, r
  1635. Specify the frame rate of the sourced video, as the number of frames
  1636. generated per second. It has to be a string in the format
  1637. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  1638. number or a valid video frame rate abbreviation. The default value is
  1639. "25".
  1640. @item duration
  1641. Set the video duration of the sourced video. The accepted syntax is:
  1642. @example
  1643. [-]HH[:MM[:SS[.m...]]]
  1644. [-]S+[.m...]
  1645. @end example
  1646. See also the function @code{av_parse_time()}.
  1647. If not specified, or the expressed duration is negative, the video is
  1648. supposed to be generated forever.
  1649. @end table
  1650. For example the following:
  1651. @example
  1652. testsrc=duration=5.3:size=qcif:rate=10
  1653. @end example
  1654. will generate a video with a duration of 5.3 seconds, with size
  1655. 176x144 and a framerate of 10 frames per second.
  1656. @c man end VIDEO SOURCES
  1657. @chapter Video Sinks
  1658. @c man begin VIDEO SINKS
  1659. Below is a description of the currently available video sinks.
  1660. @section buffersink
  1661. Buffer video frames, and make them available to the end of the filter
  1662. graph.
  1663. This sink is mainly intended for a programmatic use, in particular
  1664. through the interface defined in @file{libavfilter/vsink_buffer.h}.
  1665. It does not require a string parameter in input, but you need to
  1666. specify a pointer to a list of supported pixel formats terminated by
  1667. -1 in the opaque parameter provided to @code{avfilter_init_filter}
  1668. when initializing this sink.
  1669. @section nullsink
  1670. Null video sink, do absolutely nothing with the input video. It is
  1671. mainly useful as a template and to be employed in analysis / debugging
  1672. tools.
  1673. @c man end VIDEO SINKS