filters.texi 63 KB

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