You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10284 lines
277KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @example
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end example
  15. This filtergraph splits the input stream in two streams, sends one
  16. stream through the crop filter and the vflip filter before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that in output the top half of the video is mirrored
  23. onto the bottom half.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to the one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph can be represented using a textual representation, which is
  93. recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
  94. options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
  95. @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} function defined in
  96. @file{libavfilter/avfilter.h}.
  97. A filterchain consists of a sequence of connected filters, each one
  98. connected to the previous one in the sequence. A filterchain is
  99. represented by a list of ","-separated filter descriptions.
  100. A filtergraph consists of a sequence of filterchains. A sequence of
  101. filterchains is represented by a list of ";"-separated filterchain
  102. descriptions.
  103. A filter is represented by a string of the form:
  104. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  105. @var{filter_name} is the name of the filter class of which the
  106. described filter is an instance of, and has to be the name of one of
  107. the filter classes registered in the program.
  108. The name of the filter class is optionally followed by a string
  109. "=@var{arguments}".
  110. @var{arguments} is a string which contains the parameters used to
  111. initialize the filter instance. It may have one of the following forms:
  112. @itemize
  113. @item
  114. A ':'-separated list of @var{key=value} pairs.
  115. @item
  116. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  117. the option names in the order they are declared. E.g. the @code{fade} filter
  118. declares three options in this order -- @option{type}, @option{start_frame} and
  119. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  120. @var{in} is assigned to the option @option{type}, @var{0} to
  121. @option{start_frame} and @var{30} to @option{nb_frames}.
  122. @item
  123. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  124. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  125. follow the same constraints order of the previous point. The following
  126. @var{key=value} pairs can be set in any preferred order.
  127. @end itemize
  128. If the option value itself is a list of items (e.g. the @code{format} filter
  129. takes a list of pixel formats), the items in the list are usually separated by
  130. '|'.
  131. The list of arguments can be quoted using the character "'" as initial
  132. and ending mark, and the character '\' for escaping the characters
  133. within the quoted text; otherwise the argument string is considered
  134. terminated when the next special character (belonging to the set
  135. "[]=;,") is encountered.
  136. The name and arguments of the filter are optionally preceded and
  137. followed by a list of link labels.
  138. A link label allows to name a link and associate it to a filter output
  139. or input pad. The preceding labels @var{in_link_1}
  140. ... @var{in_link_N}, are associated to the filter input pads,
  141. the following labels @var{out_link_1} ... @var{out_link_M}, are
  142. associated to the output pads.
  143. When two link labels with the same name are found in the
  144. filtergraph, a link between the corresponding input and output pad is
  145. created.
  146. If an output pad is not labelled, it is linked by default to the first
  147. unlabelled input pad of the next filter in the filterchain.
  148. For example in the filterchain:
  149. @example
  150. nullsrc, split[L1], [L2]overlay, nullsink
  151. @end example
  152. the split filter instance has two output pads, and the overlay filter
  153. instance two input pads. The first output pad of split is labelled
  154. "L1", the first input pad of overlay is labelled "L2", and the second
  155. output pad of split is linked to the second input pad of overlay,
  156. which are both unlabelled.
  157. In a complete filterchain all the unlabelled filter input and output
  158. pads must be connected. A filtergraph is considered valid if all the
  159. filter input and output pads of all the filterchains are connected.
  160. Libavfilter will automatically insert @ref{scale} filters where format
  161. conversion is required. It is possible to specify swscale flags
  162. for those automatically inserted scalers by prepending
  163. @code{sws_flags=@var{flags};}
  164. to the filtergraph description.
  165. Follows a BNF description for the filtergraph syntax:
  166. @example
  167. @var{NAME} ::= sequence of alphanumeric characters and '_'
  168. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  169. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  170. @var{FILTER_ARGUMENTS} ::= sequence of chars (eventually quoted)
  171. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  172. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  173. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  174. @end example
  175. @section Notes on filtergraph escaping
  176. Some filter arguments require the use of special characters, typically
  177. @code{:} to separate key=value pairs in a named options list. In this
  178. case the user should perform a first level escaping when specifying
  179. the filter arguments. For example, consider the following literal
  180. string to be embedded in the @ref{drawtext} filter arguments:
  181. @example
  182. this is a 'string': may contain one, or more, special characters
  183. @end example
  184. Since @code{:} is special for the filter arguments syntax, it needs to
  185. be escaped, so you get:
  186. @example
  187. text=this is a \'string\'\: may contain one, or more, special characters
  188. @end example
  189. A second level of escaping is required when embedding the filter
  190. arguments in a filtergraph description, in order to escape all the
  191. filtergraph special characters. Thus the example above becomes:
  192. @example
  193. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  194. @end example
  195. Finally an additional level of escaping may be needed when writing the
  196. filtergraph description in a shell command, which depends on the
  197. escaping rules of the adopted shell. For example, assuming that
  198. @code{\} is special and needs to be escaped with another @code{\}, the
  199. previous string will finally result in:
  200. @example
  201. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  202. @end example
  203. Sometimes, it might be more convenient to employ quoting in place of
  204. escaping. For example the string:
  205. @example
  206. Caesar: tu quoque, Brute, fili mi
  207. @end example
  208. Can be quoted in the filter arguments as:
  209. @example
  210. text='Caesar: tu quoque, Brute, fili mi'
  211. @end example
  212. And finally inserted in a filtergraph like:
  213. @example
  214. drawtext=text=\'Caesar: tu quoque\, Brute\, fili mi\'
  215. @end example
  216. See the ``Quoting and escaping'' section in the ffmpeg-utils manual
  217. for more information about the escaping and quoting rules adopted by
  218. FFmpeg.
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @end table
  234. Additionally, these filters support an @option{enable} command that can be used
  235. to re-define the expression.
  236. Like any other filtering option, the @option{enable} option follows the same
  237. rules.
  238. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  239. minutes, and a @ref{curves} filter starting at 3 seconds:
  240. @example
  241. smartblur = enable='between(t,10,3*60)',
  242. curves = enable='gte(t,3)' : preset=cross_process
  243. @end example
  244. @c man end FILTERGRAPH DESCRIPTION
  245. @chapter Audio Filters
  246. @c man begin AUDIO FILTERS
  247. When you configure your FFmpeg build, you can disable any of the
  248. existing filters using @code{--disable-filters}.
  249. The configure output will show the audio filters included in your
  250. build.
  251. Below is a description of the currently available audio filters.
  252. @section aconvert
  253. Convert the input audio format to the specified formats.
  254. @emph{This filter is deprecated. Use @ref{aformat} instead.}
  255. The filter accepts a string of the form:
  256. "@var{sample_format}:@var{channel_layout}".
  257. @var{sample_format} specifies the sample format, and can be a string or the
  258. corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
  259. suffix for a planar sample format.
  260. @var{channel_layout} specifies the channel layout, and can be a string
  261. or the corresponding number value defined in @file{libavutil/channel_layout.h}.
  262. The special parameter "auto", signifies that the filter will
  263. automatically select the output format depending on the output filter.
  264. @subsection Examples
  265. @itemize
  266. @item
  267. Convert input to float, planar, stereo:
  268. @example
  269. aconvert=fltp:stereo
  270. @end example
  271. @item
  272. Convert input to unsigned 8-bit, automatically select out channel layout:
  273. @example
  274. aconvert=u8:auto
  275. @end example
  276. @end itemize
  277. @section adelay
  278. Delay one or more audio channels.
  279. Samples in delayed channel are filled with silence.
  280. The filter accepts the following option:
  281. @table @option
  282. @item delays
  283. Set list of delays in milliseconds for each channel separated by '|'.
  284. At least one delay greater than 0 should be provided.
  285. Unused delays will be silently ignored. If number of given delays is
  286. smaller than number of channels all remaining channels will not be delayed.
  287. @end table
  288. @subsection Examples
  289. @itemize
  290. @item
  291. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  292. the second channel (and any other channels that may be present) unchanged.
  293. @example
  294. adelay=1500|0|500
  295. @end example
  296. @end itemize
  297. @section aecho
  298. Apply echoing to the input audio.
  299. Echoes are reflected sound and can occur naturally amongst mountains
  300. (and sometimes large buildings) when talking or shouting; digital echo
  301. effects emulate this behaviour and are often used to help fill out the
  302. sound of a single instrument or vocal. The time difference between the
  303. original signal and the reflection is the @code{delay}, and the
  304. loudness of the reflected signal is the @code{decay}.
  305. Multiple echoes can have different delays and decays.
  306. A description of the accepted parameters follows.
  307. @table @option
  308. @item in_gain
  309. Set input gain of reflected signal. Default is @code{0.6}.
  310. @item out_gain
  311. Set output gain of reflected signal. Default is @code{0.3}.
  312. @item delays
  313. Set list of time intervals in milliseconds between original signal and reflections
  314. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  315. Default is @code{1000}.
  316. @item decays
  317. Set list of loudnesses of reflected signals separated by '|'.
  318. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  319. Default is @code{0.5}.
  320. @end table
  321. @subsection Examples
  322. @itemize
  323. @item
  324. Make it sound as if there are twice as many instruments as are actually playing:
  325. @example
  326. aecho=0.8:0.88:60:0.4
  327. @end example
  328. @item
  329. If delay is very short, then it sound like a (metallic) robot playing music:
  330. @example
  331. aecho=0.8:0.88:6:0.4
  332. @end example
  333. @item
  334. A longer delay will sound like an open air concert in the mountains:
  335. @example
  336. aecho=0.8:0.9:1000:0.3
  337. @end example
  338. @item
  339. Same as above but with one more mountain:
  340. @example
  341. aecho=0.8:0.9:1000|1800:0.3|0.25
  342. @end example
  343. @end itemize
  344. @section aeval
  345. Modify an audio signal according to the specified expressions.
  346. This filter accepts one or more expressions (one for each channel),
  347. which are evaluated and used to modify a corresponding audio signal.
  348. This filter accepts the following options:
  349. @table @option
  350. @item exprs
  351. Set the '|'-separated expressions list for each separate channel. If
  352. the number of input channels is greater than the number of
  353. expressions, the last specified expression is used for the remaining
  354. output channels.
  355. @item channel_layout, c
  356. Set output channel layout. If not specified, the channel layout is
  357. specified by the number of expressions. If set to @samp{same}, it will
  358. use by default the same input channel layout.
  359. @end table
  360. Each expression in @var{exprs} can contain the following constants and functions:
  361. @table @option
  362. @item ch
  363. channel number of the current expression
  364. @item n
  365. number of the evaluated sample, starting from 0
  366. @item s
  367. sample rate
  368. @item t
  369. time of the evaluated sample expressed in seconds
  370. @item nb_in_channels
  371. @item nb_out_channels
  372. input and output number of channels
  373. @item val(CH)
  374. the value of input channel with number @var{CH}
  375. @end table
  376. Note: this filter is slow. For faster processing you should use a
  377. dedicated filter.
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Half volume:
  382. @example
  383. aeval=val(ch)/2:c=same
  384. @end example
  385. @item
  386. Invert phase of the second channel:
  387. @example
  388. eval=val(0)|-val(1)
  389. @end example
  390. @end itemize
  391. @section afade
  392. Apply fade-in/out effect to input audio.
  393. A description of the accepted parameters follows.
  394. @table @option
  395. @item type, t
  396. Specify the effect type, can be either @code{in} for fade-in, or
  397. @code{out} for a fade-out effect. Default is @code{in}.
  398. @item start_sample, ss
  399. Specify the number of the start sample for starting to apply the fade
  400. effect. Default is 0.
  401. @item nb_samples, ns
  402. Specify the number of samples for which the fade effect has to last. At
  403. the end of the fade-in effect the output audio will have the same
  404. volume as the input audio, at the end of the fade-out transition
  405. the output audio will be silence. Default is 44100.
  406. @item start_time, st
  407. Specify time for starting to apply the fade effect. Default is 0.
  408. The accepted syntax is:
  409. @example
  410. [-]HH[:MM[:SS[.m...]]]
  411. [-]S+[.m...]
  412. @end example
  413. See also the function @code{av_parse_time()}.
  414. If set this option is used instead of @var{start_sample} one.
  415. @item duration, d
  416. Specify the duration for which the fade effect has to last. Default is 0.
  417. The accepted syntax is:
  418. @example
  419. [-]HH[:MM[:SS[.m...]]]
  420. [-]S+[.m...]
  421. @end example
  422. See also the function @code{av_parse_time()}.
  423. At the end of the fade-in effect the output audio will have the same
  424. volume as the input audio, at the end of the fade-out transition
  425. the output audio will be silence.
  426. If set this option is used instead of @var{nb_samples} one.
  427. @item curve
  428. Set curve for fade transition.
  429. It accepts the following values:
  430. @table @option
  431. @item tri
  432. select triangular, linear slope (default)
  433. @item qsin
  434. select quarter of sine wave
  435. @item hsin
  436. select half of sine wave
  437. @item esin
  438. select exponential sine wave
  439. @item log
  440. select logarithmic
  441. @item par
  442. select inverted parabola
  443. @item qua
  444. select quadratic
  445. @item cub
  446. select cubic
  447. @item squ
  448. select square root
  449. @item cbr
  450. select cubic root
  451. @end table
  452. @end table
  453. @subsection Examples
  454. @itemize
  455. @item
  456. Fade in first 15 seconds of audio:
  457. @example
  458. afade=t=in:ss=0:d=15
  459. @end example
  460. @item
  461. Fade out last 25 seconds of a 900 seconds audio:
  462. @example
  463. afade=t=out:st=875:d=25
  464. @end example
  465. @end itemize
  466. @anchor{aformat}
  467. @section aformat
  468. Set output format constraints for the input audio. The framework will
  469. negotiate the most appropriate format to minimize conversions.
  470. The filter accepts the following named parameters:
  471. @table @option
  472. @item sample_fmts
  473. A '|'-separated list of requested sample formats.
  474. @item sample_rates
  475. A '|'-separated list of requested sample rates.
  476. @item channel_layouts
  477. A '|'-separated list of requested channel layouts.
  478. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  479. for the required syntax.
  480. @end table
  481. If a parameter is omitted, all values are allowed.
  482. For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
  483. @example
  484. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  485. @end example
  486. @section allpass
  487. Apply a two-pole all-pass filter with central frequency (in Hz)
  488. @var{frequency}, and filter-width @var{width}.
  489. An all-pass filter changes the audio's frequency to phase relationship
  490. without changing its frequency to amplitude relationship.
  491. The filter accepts the following options:
  492. @table @option
  493. @item frequency, f
  494. Set frequency in Hz.
  495. @item width_type
  496. Set method to specify band-width of filter.
  497. @table @option
  498. @item h
  499. Hz
  500. @item q
  501. Q-Factor
  502. @item o
  503. octave
  504. @item s
  505. slope
  506. @end table
  507. @item width, w
  508. Specify the band-width of a filter in width_type units.
  509. @end table
  510. @section amerge
  511. Merge two or more audio streams into a single multi-channel stream.
  512. The filter accepts the following options:
  513. @table @option
  514. @item inputs
  515. Set the number of inputs. Default is 2.
  516. @end table
  517. If the channel layouts of the inputs are disjoint, and therefore compatible,
  518. the channel layout of the output will be set accordingly and the channels
  519. will be reordered as necessary. If the channel layouts of the inputs are not
  520. disjoint, the output will have all the channels of the first input then all
  521. the channels of the second input, in that order, and the channel layout of
  522. the output will be the default value corresponding to the total number of
  523. channels.
  524. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  525. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  526. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  527. first input, b1 is the first channel of the second input).
  528. On the other hand, if both input are in stereo, the output channels will be
  529. in the default order: a1, a2, b1, b2, and the channel layout will be
  530. arbitrarily set to 4.0, which may or may not be the expected value.
  531. All inputs must have the same sample rate, and format.
  532. If inputs do not have the same duration, the output will stop with the
  533. shortest.
  534. @subsection Examples
  535. @itemize
  536. @item
  537. Merge two mono files into a stereo stream:
  538. @example
  539. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  540. @end example
  541. @item
  542. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  543. @example
  544. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  545. @end example
  546. @end itemize
  547. @section amix
  548. Mixes multiple audio inputs into a single output.
  549. For example
  550. @example
  551. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  552. @end example
  553. will mix 3 input audio streams to a single output with the same duration as the
  554. first input and a dropout transition time of 3 seconds.
  555. The filter accepts the following named parameters:
  556. @table @option
  557. @item inputs
  558. Number of inputs. If unspecified, it defaults to 2.
  559. @item duration
  560. How to determine the end-of-stream.
  561. @table @option
  562. @item longest
  563. Duration of longest input. (default)
  564. @item shortest
  565. Duration of shortest input.
  566. @item first
  567. Duration of first input.
  568. @end table
  569. @item dropout_transition
  570. Transition time, in seconds, for volume renormalization when an input
  571. stream ends. The default value is 2 seconds.
  572. @end table
  573. @section anull
  574. Pass the audio source unchanged to the output.
  575. @section apad
  576. Pad the end of a audio stream with silence, this can be used together with
  577. -shortest to extend audio streams to the same length as the video stream.
  578. @section aphaser
  579. Add a phasing effect to the input audio.
  580. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  581. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  582. A description of the accepted parameters follows.
  583. @table @option
  584. @item in_gain
  585. Set input gain. Default is 0.4.
  586. @item out_gain
  587. Set output gain. Default is 0.74
  588. @item delay
  589. Set delay in milliseconds. Default is 3.0.
  590. @item decay
  591. Set decay. Default is 0.4.
  592. @item speed
  593. Set modulation speed in Hz. Default is 0.5.
  594. @item type
  595. Set modulation type. Default is triangular.
  596. It accepts the following values:
  597. @table @samp
  598. @item triangular, t
  599. @item sinusoidal, s
  600. @end table
  601. @end table
  602. @anchor{aresample}
  603. @section aresample
  604. Resample the input audio to the specified parameters, using the
  605. libswresample library. If none are specified then the filter will
  606. automatically convert between its input and output.
  607. This filter is also able to stretch/squeeze the audio data to make it match
  608. the timestamps or to inject silence / cut out audio to make it match the
  609. timestamps, do a combination of both or do neither.
  610. The filter accepts the syntax
  611. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  612. expresses a sample rate and @var{resampler_options} is a list of
  613. @var{key}=@var{value} pairs, separated by ":". See the
  614. ffmpeg-resampler manual for the complete list of supported options.
  615. @subsection Examples
  616. @itemize
  617. @item
  618. Resample the input audio to 44100Hz:
  619. @example
  620. aresample=44100
  621. @end example
  622. @item
  623. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  624. samples per second compensation:
  625. @example
  626. aresample=async=1000
  627. @end example
  628. @end itemize
  629. @section asetnsamples
  630. Set the number of samples per each output audio frame.
  631. The last output packet may contain a different number of samples, as
  632. the filter will flush all the remaining samples when the input audio
  633. signal its end.
  634. The filter accepts the following options:
  635. @table @option
  636. @item nb_out_samples, n
  637. Set the number of frames per each output audio frame. The number is
  638. intended as the number of samples @emph{per each channel}.
  639. Default value is 1024.
  640. @item pad, p
  641. If set to 1, the filter will pad the last audio frame with zeroes, so
  642. that the last frame will contain the same number of samples as the
  643. previous ones. Default value is 1.
  644. @end table
  645. For example, to set the number of per-frame samples to 1234 and
  646. disable padding for the last frame, use:
  647. @example
  648. asetnsamples=n=1234:p=0
  649. @end example
  650. @section asetrate
  651. Set the sample rate without altering the PCM data.
  652. This will result in a change of speed and pitch.
  653. The filter accepts the following options:
  654. @table @option
  655. @item sample_rate, r
  656. Set the output sample rate. Default is 44100 Hz.
  657. @end table
  658. @section ashowinfo
  659. Show a line containing various information for each input audio frame.
  660. The input audio is not modified.
  661. The shown line contains a sequence of key/value pairs of the form
  662. @var{key}:@var{value}.
  663. A description of each shown parameter follows:
  664. @table @option
  665. @item n
  666. sequential number of the input frame, starting from 0
  667. @item pts
  668. Presentation timestamp of the input frame, in time base units; the time base
  669. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  670. @item pts_time
  671. presentation timestamp of the input frame in seconds
  672. @item pos
  673. position of the frame in the input stream, -1 if this information in
  674. unavailable and/or meaningless (for example in case of synthetic audio)
  675. @item fmt
  676. sample format
  677. @item chlayout
  678. channel layout
  679. @item rate
  680. sample rate for the audio frame
  681. @item nb_samples
  682. number of samples (per channel) in the frame
  683. @item checksum
  684. Adler-32 checksum (printed in hexadecimal) of the audio data. For planar audio
  685. the data is treated as if all the planes were concatenated.
  686. @item plane_checksums
  687. A list of Adler-32 checksums for each data plane.
  688. @end table
  689. @section astats
  690. Display time domain statistical information about the audio channels.
  691. Statistics are calculated and displayed for each audio channel and,
  692. where applicable, an overall figure is also given.
  693. The filter accepts the following option:
  694. @table @option
  695. @item length
  696. Short window length in seconds, used for peak and trough RMS measurement.
  697. Default is @code{0.05} (50 miliseconds). Allowed range is @code{[0.1 - 10]}.
  698. @end table
  699. A description of each shown parameter follows:
  700. @table @option
  701. @item DC offset
  702. Mean amplitude displacement from zero.
  703. @item Min level
  704. Minimal sample level.
  705. @item Max level
  706. Maximal sample level.
  707. @item Peak level dB
  708. @item RMS level dB
  709. Standard peak and RMS level measured in dBFS.
  710. @item RMS peak dB
  711. @item RMS trough dB
  712. Peak and trough values for RMS level measured over a short window.
  713. @item Crest factor
  714. Standard ratio of peak to RMS level (note: not in dB).
  715. @item Flat factor
  716. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  717. (i.e. either @var{Min level} or @var{Max level}).
  718. @item Peak count
  719. Number of occasions (not the number of samples) that the signal attained either
  720. @var{Min level} or @var{Max level}.
  721. @end table
  722. @section astreamsync
  723. Forward two audio streams and control the order the buffers are forwarded.
  724. The filter accepts the following options:
  725. @table @option
  726. @item expr, e
  727. Set the expression deciding which stream should be
  728. forwarded next: if the result is negative, the first stream is forwarded; if
  729. the result is positive or zero, the second stream is forwarded. It can use
  730. the following variables:
  731. @table @var
  732. @item b1 b2
  733. number of buffers forwarded so far on each stream
  734. @item s1 s2
  735. number of samples forwarded so far on each stream
  736. @item t1 t2
  737. current timestamp of each stream
  738. @end table
  739. The default value is @code{t1-t2}, which means to always forward the stream
  740. that has a smaller timestamp.
  741. @end table
  742. @subsection Examples
  743. Stress-test @code{amerge} by randomly sending buffers on the wrong
  744. input, while avoiding too much of a desynchronization:
  745. @example
  746. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  747. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  748. [a2] [b2] amerge
  749. @end example
  750. @section asyncts
  751. Synchronize audio data with timestamps by squeezing/stretching it and/or
  752. dropping samples/adding silence when needed.
  753. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  754. The filter accepts the following named parameters:
  755. @table @option
  756. @item compensate
  757. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  758. by default. When disabled, time gaps are covered with silence.
  759. @item min_delta
  760. Minimum difference between timestamps and audio data (in seconds) to trigger
  761. adding/dropping samples. Default value is 0.1. If you get non-perfect sync with
  762. this filter, try setting this parameter to 0.
  763. @item max_comp
  764. Maximum compensation in samples per second. Relevant only with compensate=1.
  765. Default value 500.
  766. @item first_pts
  767. Assume the first pts should be this value. The time base is 1 / sample rate.
  768. This allows for padding/trimming at the start of stream. By default, no
  769. assumption is made about the first frame's expected pts, so no padding or
  770. trimming is done. For example, this could be set to 0 to pad the beginning with
  771. silence if an audio stream starts after the video stream or to trim any samples
  772. with a negative pts due to encoder delay.
  773. @end table
  774. @section atempo
  775. Adjust audio tempo.
  776. The filter accepts exactly one parameter, the audio tempo. If not
  777. specified then the filter will assume nominal 1.0 tempo. Tempo must
  778. be in the [0.5, 2.0] range.
  779. @subsection Examples
  780. @itemize
  781. @item
  782. Slow down audio to 80% tempo:
  783. @example
  784. atempo=0.8
  785. @end example
  786. @item
  787. To speed up audio to 125% tempo:
  788. @example
  789. atempo=1.25
  790. @end example
  791. @end itemize
  792. @section atrim
  793. Trim the input so that the output contains one continuous subpart of the input.
  794. This filter accepts the following options:
  795. @table @option
  796. @item start
  797. Specify time of the start of the kept section, i.e. the audio sample
  798. with the timestamp @var{start} will be the first sample in the output.
  799. @item end
  800. Specify time of the first audio sample that will be dropped, i.e. the
  801. audio sample immediately preceding the one with the timestamp @var{end} will be
  802. the last sample in the output.
  803. @item start_pts
  804. Same as @var{start}, except this option sets the start timestamp in samples
  805. instead of seconds.
  806. @item end_pts
  807. Same as @var{end}, except this option sets the end timestamp in samples instead
  808. of seconds.
  809. @item duration
  810. Specify maximum duration of the output.
  811. @item start_sample
  812. Number of the first sample that should be passed to output.
  813. @item end_sample
  814. Number of the first sample that should be dropped.
  815. @end table
  816. @option{start}, @option{end}, @option{duration} are expressed as time
  817. duration specifications, check the "Time duration" section in the
  818. ffmpeg-utils manual.
  819. Note that the first two sets of the start/end options and the @option{duration}
  820. option look at the frame timestamp, while the _sample options simply count the
  821. samples that pass through the filter. So start/end_pts and start/end_sample will
  822. give different results when the timestamps are wrong, inexact or do not start at
  823. zero. Also note that this filter does not modify the timestamps. If you wish
  824. that the output timestamps start at zero, insert the asetpts filter after the
  825. atrim filter.
  826. If multiple start or end options are set, this filter tries to be greedy and
  827. keep all samples that match at least one of the specified constraints. To keep
  828. only the part that matches all the constraints at once, chain multiple atrim
  829. filters.
  830. The defaults are such that all the input is kept. So it is possible to set e.g.
  831. just the end values to keep everything before the specified time.
  832. Examples:
  833. @itemize
  834. @item
  835. drop everything except the second minute of input
  836. @example
  837. ffmpeg -i INPUT -af atrim=60:120
  838. @end example
  839. @item
  840. keep only the first 1000 samples
  841. @example
  842. ffmpeg -i INPUT -af atrim=end_sample=1000
  843. @end example
  844. @end itemize
  845. @section bandpass
  846. Apply a two-pole Butterworth band-pass filter with central
  847. frequency @var{frequency}, and (3dB-point) band-width width.
  848. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  849. instead of the default: constant 0dB peak gain.
  850. The filter roll off at 6dB per octave (20dB per decade).
  851. The filter accepts the following options:
  852. @table @option
  853. @item frequency, f
  854. Set the filter's central frequency. Default is @code{3000}.
  855. @item csg
  856. Constant skirt gain if set to 1. Defaults to 0.
  857. @item width_type
  858. Set method to specify band-width of filter.
  859. @table @option
  860. @item h
  861. Hz
  862. @item q
  863. Q-Factor
  864. @item o
  865. octave
  866. @item s
  867. slope
  868. @end table
  869. @item width, w
  870. Specify the band-width of a filter in width_type units.
  871. @end table
  872. @section bandreject
  873. Apply a two-pole Butterworth band-reject filter with central
  874. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  875. The filter roll off at 6dB per octave (20dB per decade).
  876. The filter accepts the following options:
  877. @table @option
  878. @item frequency, f
  879. Set the filter's central frequency. Default is @code{3000}.
  880. @item width_type
  881. Set method to specify band-width of filter.
  882. @table @option
  883. @item h
  884. Hz
  885. @item q
  886. Q-Factor
  887. @item o
  888. octave
  889. @item s
  890. slope
  891. @end table
  892. @item width, w
  893. Specify the band-width of a filter in width_type units.
  894. @end table
  895. @section bass
  896. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  897. shelving filter with a response similar to that of a standard
  898. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  899. The filter accepts the following options:
  900. @table @option
  901. @item gain, g
  902. Give the gain at 0 Hz. Its useful range is about -20
  903. (for a large cut) to +20 (for a large boost).
  904. Beware of clipping when using a positive gain.
  905. @item frequency, f
  906. Set the filter's central frequency and so can be used
  907. to extend or reduce the frequency range to be boosted or cut.
  908. The default value is @code{100} Hz.
  909. @item width_type
  910. Set method to specify band-width of filter.
  911. @table @option
  912. @item h
  913. Hz
  914. @item q
  915. Q-Factor
  916. @item o
  917. octave
  918. @item s
  919. slope
  920. @end table
  921. @item width, w
  922. Determine how steep is the filter's shelf transition.
  923. @end table
  924. @section biquad
  925. Apply a biquad IIR filter with the given coefficients.
  926. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  927. are the numerator and denominator coefficients respectively.
  928. @section channelmap
  929. Remap input channels to new locations.
  930. This filter accepts the following named parameters:
  931. @table @option
  932. @item channel_layout
  933. Channel layout of the output stream.
  934. @item map
  935. Map channels from input to output. The argument is a '|'-separated list of
  936. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  937. @var{in_channel} form. @var{in_channel} can be either the name of the input
  938. channel (e.g. FL for front left) or its index in the input channel layout.
  939. @var{out_channel} is the name of the output channel or its index in the output
  940. channel layout. If @var{out_channel} is not given then it is implicitly an
  941. index, starting with zero and increasing by one for each mapping.
  942. @end table
  943. If no mapping is present, the filter will implicitly map input channels to
  944. output channels preserving index.
  945. For example, assuming a 5.1+downmix input MOV file
  946. @example
  947. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  948. @end example
  949. will create an output WAV file tagged as stereo from the downmix channels of
  950. the input.
  951. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  952. @example
  953. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
  954. @end example
  955. @section channelsplit
  956. Split each channel in input audio stream into a separate output stream.
  957. This filter accepts the following named parameters:
  958. @table @option
  959. @item channel_layout
  960. Channel layout of the input stream. Default is "stereo".
  961. @end table
  962. For example, assuming a stereo input MP3 file
  963. @example
  964. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  965. @end example
  966. will create an output Matroska file with two audio streams, one containing only
  967. the left channel and the other the right channel.
  968. To split a 5.1 WAV file into per-channel files
  969. @example
  970. ffmpeg -i in.wav -filter_complex
  971. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  972. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  973. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  974. side_right.wav
  975. @end example
  976. @section compand
  977. Compress or expand audio dynamic range.
  978. A description of the accepted options follows.
  979. @table @option
  980. @item attacks
  981. @item decays
  982. Set list of times in seconds for each channel over which the instantaneous
  983. level of the input signal is averaged to determine its volume.
  984. @option{attacks} refers to increase of volume and @option{decays} refers
  985. to decrease of volume.
  986. For most situations, the attack time (response to the audio getting louder)
  987. should be shorter than the decay time because the human ear is more sensitive
  988. to sudden loud audio than sudden soft audio.
  989. Typical value for attack is @code{0.3} seconds and for decay @code{0.8}
  990. seconds.
  991. @item points
  992. Set list of points for transfer function, specified in dB relative to maximum
  993. possible signal amplitude.
  994. Each key points list need to be defined using the following syntax:
  995. @code{x0/y0 x1/y1 x2/y2 ...}.
  996. The input values must be in strictly increasing order but the transfer
  997. function does not have to be monotonically rising.
  998. The point @code{0/0} is assumed but may be overridden (by @code{0/out-dBn}).
  999. Typical values for the transfer function are @code{-70/-70 -60/-20}.
  1000. @item soft-knee
  1001. Set amount for which the points at where adjacent line segments on the
  1002. transfer function meet will be rounded. Defaults is @code{0.01}.
  1003. @item gain
  1004. Set additional gain in dB to be applied at all points on the transfer function
  1005. and allows easy adjustment of the overall gain.
  1006. Default is @code{0}.
  1007. @item volume
  1008. Set initial volume in dB to be assumed for each channel when filtering starts.
  1009. This permits the user to supply a nominal level initially, so that,
  1010. for example, a very large gain is not applied to initial signal levels before
  1011. the companding has begun to operate. A typical value for audio which is
  1012. initially quiet is -90 dB. Default is @code{0}.
  1013. @item delay
  1014. Set delay in seconds. Default is @code{0}. The input audio
  1015. is analysed immediately, but audio is delayed before being fed to the
  1016. volume adjuster. Specifying a delay approximately equal to the attack/decay
  1017. times allows the filter to effectively operate in predictive rather than
  1018. reactive mode.
  1019. @end table
  1020. @subsection Examples
  1021. @itemize
  1022. @item
  1023. Make music with both quiet and loud passages suitable for listening
  1024. in a noisy environment:
  1025. @example
  1026. compand=.3 .3:1 1:-90/-60 -60/-40 -40/-30 -20/-20:6:0:-90:0.2
  1027. @end example
  1028. @item
  1029. Noise-gate for when the noise is at a lower level than the signal:
  1030. @example
  1031. compand=.1 .1:.2 .2:-900/-900 -50.1/-900 -50/-50:.01:0:-90:.1
  1032. @end example
  1033. @item
  1034. Here is another noise-gate, this time for when the noise is at a higher level
  1035. than the signal (making it, in some ways, similar to squelch):
  1036. @example
  1037. compand=.1 .1:.1 .1:-45.1/-45.1 -45/-900 0/-900:.01:45:-90:.1
  1038. @end example
  1039. @end itemize
  1040. @section earwax
  1041. Make audio easier to listen to on headphones.
  1042. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1043. so that when listened to on headphones the stereo image is moved from
  1044. inside your head (standard for headphones) to outside and in front of
  1045. the listener (standard for speakers).
  1046. Ported from SoX.
  1047. @section equalizer
  1048. Apply a two-pole peaking equalisation (EQ) filter. With this
  1049. filter, the signal-level at and around a selected frequency can
  1050. be increased or decreased, whilst (unlike bandpass and bandreject
  1051. filters) that at all other frequencies is unchanged.
  1052. In order to produce complex equalisation curves, this filter can
  1053. be given several times, each with a different central frequency.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item frequency, f
  1057. Set the filter's central frequency in Hz.
  1058. @item width_type
  1059. Set method to specify band-width of filter.
  1060. @table @option
  1061. @item h
  1062. Hz
  1063. @item q
  1064. Q-Factor
  1065. @item o
  1066. octave
  1067. @item s
  1068. slope
  1069. @end table
  1070. @item width, w
  1071. Specify the band-width of a filter in width_type units.
  1072. @item gain, g
  1073. Set the required gain or attenuation in dB.
  1074. Beware of clipping when using a positive gain.
  1075. @end table
  1076. @subsection Examples
  1077. @itemize
  1078. @item
  1079. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1080. @example
  1081. equalizer=f=1000:width_type=h:width=200:g=-10
  1082. @end example
  1083. @item
  1084. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1085. @example
  1086. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1087. @end example
  1088. @end itemize
  1089. @section highpass
  1090. Apply a high-pass filter with 3dB point frequency.
  1091. The filter can be either single-pole, or double-pole (the default).
  1092. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1093. The filter accepts the following options:
  1094. @table @option
  1095. @item frequency, f
  1096. Set frequency in Hz. Default is 3000.
  1097. @item poles, p
  1098. Set number of poles. Default is 2.
  1099. @item width_type
  1100. Set method to specify band-width of filter.
  1101. @table @option
  1102. @item h
  1103. Hz
  1104. @item q
  1105. Q-Factor
  1106. @item o
  1107. octave
  1108. @item s
  1109. slope
  1110. @end table
  1111. @item width, w
  1112. Specify the band-width of a filter in width_type units.
  1113. Applies only to double-pole filter.
  1114. The default is 0.707q and gives a Butterworth response.
  1115. @end table
  1116. @section join
  1117. Join multiple input streams into one multi-channel stream.
  1118. The filter accepts the following named parameters:
  1119. @table @option
  1120. @item inputs
  1121. Number of input streams. Defaults to 2.
  1122. @item channel_layout
  1123. Desired output channel layout. Defaults to stereo.
  1124. @item map
  1125. Map channels from inputs to output. The argument is a '|'-separated list of
  1126. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1127. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1128. can be either the name of the input channel (e.g. FL for front left) or its
  1129. index in the specified input stream. @var{out_channel} is the name of the output
  1130. channel.
  1131. @end table
  1132. The filter will attempt to guess the mappings when those are not specified
  1133. explicitly. It does so by first trying to find an unused matching input channel
  1134. and if that fails it picks the first unused input channel.
  1135. E.g. to join 3 inputs (with properly set channel layouts)
  1136. @example
  1137. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1138. @end example
  1139. To build a 5.1 output from 6 single-channel streams:
  1140. @example
  1141. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1142. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  1143. out
  1144. @end example
  1145. @section ladspa
  1146. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1147. To enable compilation of this filter you need to configure FFmpeg with
  1148. @code{--enable-ladspa}.
  1149. @table @option
  1150. @item file, f
  1151. Specifies the name of LADSPA plugin library to load. If the environment
  1152. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1153. each one of the directories specified by the colon separated list in
  1154. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1155. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1156. @file{/usr/lib/ladspa/}.
  1157. @item plugin, p
  1158. Specifies the plugin within the library. Some libraries contain only
  1159. one plugin, but others contain many of them. If this is not set filter
  1160. will list all available plugins within the specified library.
  1161. @item controls, c
  1162. Set the '|' separated list of controls which are zero or more floating point
  1163. values that determine the behavior of the loaded plugin (for example delay,
  1164. threshold or gain).
  1165. Controls need to be defined using the following syntax:
  1166. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1167. @var{valuei} is the value set on the @var{i}-th control.
  1168. If @option{controls} is set to @code{help}, all available controls and
  1169. their valid ranges are printed.
  1170. @item sample_rate, s
  1171. Specify the sample rate, default to 44100. Only used if plugin have
  1172. zero inputs.
  1173. @item nb_samples, n
  1174. Set the number of samples per channel per each output frame, default
  1175. is 1024. Only used if plugin have zero inputs.
  1176. @item duration, d
  1177. Set the minimum duration of the sourced audio. See the function
  1178. @code{av_parse_time()} for the accepted format, also check the "Time duration"
  1179. section in the ffmpeg-utils manual.
  1180. Note that the resulting duration may be greater than the specified duration,
  1181. as the generated audio is always cut at the end of a complete frame.
  1182. If not specified, or the expressed duration is negative, the audio is
  1183. supposed to be generated forever.
  1184. Only used if plugin have zero inputs.
  1185. @end table
  1186. @subsection Examples
  1187. @itemize
  1188. @item
  1189. List all available plugins within amp (LADSPA example plugin) library:
  1190. @example
  1191. ladspa=file=amp
  1192. @end example
  1193. @item
  1194. List all available controls and their valid ranges for @code{vcf_notch}
  1195. plugin from @code{VCF} library:
  1196. @example
  1197. ladspa=f=vcf:p=vcf_notch:c=help
  1198. @end example
  1199. @item
  1200. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1201. plugin library:
  1202. @example
  1203. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1204. @end example
  1205. @item
  1206. Add reverberation to the audio using TAP-plugins
  1207. (Tom's Audio Processing plugins):
  1208. @example
  1209. ladspa=file=tap_reverb:tap_reverb
  1210. @end example
  1211. @item
  1212. Generate white noise, with 0.2 amplitude:
  1213. @example
  1214. ladspa=file=cmt:noise_source_white:c=c0=.2
  1215. @end example
  1216. @item
  1217. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1218. @code{C* Audio Plugin Suite} (CAPS) library:
  1219. @example
  1220. ladspa=file=caps:Click:c=c1=20'
  1221. @end example
  1222. @item
  1223. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1224. @example
  1225. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1226. @end example
  1227. @end itemize
  1228. @subsection Commands
  1229. This filter supports the following commands:
  1230. @table @option
  1231. @item cN
  1232. Modify the @var{N}-th control value.
  1233. If the specified value is not valid, it is ignored and prior one is kept.
  1234. @end table
  1235. @section lowpass
  1236. Apply a low-pass filter with 3dB point frequency.
  1237. The filter can be either single-pole or double-pole (the default).
  1238. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1239. The filter accepts the following options:
  1240. @table @option
  1241. @item frequency, f
  1242. Set frequency in Hz. Default is 500.
  1243. @item poles, p
  1244. Set number of poles. Default is 2.
  1245. @item width_type
  1246. Set method to specify band-width of filter.
  1247. @table @option
  1248. @item h
  1249. Hz
  1250. @item q
  1251. Q-Factor
  1252. @item o
  1253. octave
  1254. @item s
  1255. slope
  1256. @end table
  1257. @item width, w
  1258. Specify the band-width of a filter in width_type units.
  1259. Applies only to double-pole filter.
  1260. The default is 0.707q and gives a Butterworth response.
  1261. @end table
  1262. @section pan
  1263. Mix channels with specific gain levels. The filter accepts the output
  1264. channel layout followed by a set of channels definitions.
  1265. This filter is also designed to remap efficiently the channels of an audio
  1266. stream.
  1267. The filter accepts parameters of the form:
  1268. "@var{l}:@var{outdef}:@var{outdef}:..."
  1269. @table @option
  1270. @item l
  1271. output channel layout or number of channels
  1272. @item outdef
  1273. output channel specification, of the form:
  1274. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1275. @item out_name
  1276. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1277. number (c0, c1, etc.)
  1278. @item gain
  1279. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1280. @item in_name
  1281. input channel to use, see out_name for details; it is not possible to mix
  1282. named and numbered input channels
  1283. @end table
  1284. If the `=' in a channel specification is replaced by `<', then the gains for
  1285. that specification will be renormalized so that the total is 1, thus
  1286. avoiding clipping noise.
  1287. @subsection Mixing examples
  1288. For example, if you want to down-mix from stereo to mono, but with a bigger
  1289. factor for the left channel:
  1290. @example
  1291. pan=1:c0=0.9*c0+0.1*c1
  1292. @end example
  1293. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1294. 7-channels surround:
  1295. @example
  1296. pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1297. @end example
  1298. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1299. that should be preferred (see "-ac" option) unless you have very specific
  1300. needs.
  1301. @subsection Remapping examples
  1302. The channel remapping will be effective if, and only if:
  1303. @itemize
  1304. @item gain coefficients are zeroes or ones,
  1305. @item only one input per channel output,
  1306. @end itemize
  1307. If all these conditions are satisfied, the filter will notify the user ("Pure
  1308. channel mapping detected"), and use an optimized and lossless method to do the
  1309. remapping.
  1310. For example, if you have a 5.1 source and want a stereo audio stream by
  1311. dropping the extra channels:
  1312. @example
  1313. pan="stereo: c0=FL : c1=FR"
  1314. @end example
  1315. Given the same source, you can also switch front left and front right channels
  1316. and keep the input channel layout:
  1317. @example
  1318. pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
  1319. @end example
  1320. If the input is a stereo audio stream, you can mute the front left channel (and
  1321. still keep the stereo channel layout) with:
  1322. @example
  1323. pan="stereo:c1=c1"
  1324. @end example
  1325. Still with a stereo audio stream input, you can copy the right channel in both
  1326. front left and right:
  1327. @example
  1328. pan="stereo: c0=FR : c1=FR"
  1329. @end example
  1330. @section replaygain
  1331. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1332. outputs it unchanged.
  1333. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1334. @section resample
  1335. Convert the audio sample format, sample rate and channel layout. This filter is
  1336. not meant to be used directly.
  1337. @section silencedetect
  1338. Detect silence in an audio stream.
  1339. This filter logs a message when it detects that the input audio volume is less
  1340. or equal to a noise tolerance value for a duration greater or equal to the
  1341. minimum detected noise duration.
  1342. The printed times and duration are expressed in seconds.
  1343. The filter accepts the following options:
  1344. @table @option
  1345. @item duration, d
  1346. Set silence duration until notification (default is 2 seconds).
  1347. @item noise, n
  1348. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1349. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1350. @end table
  1351. @subsection Examples
  1352. @itemize
  1353. @item
  1354. Detect 5 seconds of silence with -50dB noise tolerance:
  1355. @example
  1356. silencedetect=n=-50dB:d=5
  1357. @end example
  1358. @item
  1359. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1360. tolerance in @file{silence.mp3}:
  1361. @example
  1362. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1363. @end example
  1364. @end itemize
  1365. @section treble
  1366. Boost or cut treble (upper) frequencies of the audio using a two-pole
  1367. shelving filter with a response similar to that of a standard
  1368. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1369. The filter accepts the following options:
  1370. @table @option
  1371. @item gain, g
  1372. Give the gain at whichever is the lower of ~22 kHz and the
  1373. Nyquist frequency. Its useful range is about -20 (for a large cut)
  1374. to +20 (for a large boost). Beware of clipping when using a positive gain.
  1375. @item frequency, f
  1376. Set the filter's central frequency and so can be used
  1377. to extend or reduce the frequency range to be boosted or cut.
  1378. The default value is @code{3000} Hz.
  1379. @item width_type
  1380. Set method to specify band-width of filter.
  1381. @table @option
  1382. @item h
  1383. Hz
  1384. @item q
  1385. Q-Factor
  1386. @item o
  1387. octave
  1388. @item s
  1389. slope
  1390. @end table
  1391. @item width, w
  1392. Determine how steep is the filter's shelf transition.
  1393. @end table
  1394. @section volume
  1395. Adjust the input audio volume.
  1396. The filter accepts the following options:
  1397. @table @option
  1398. @item volume
  1399. Set audio volume expression.
  1400. Output values are clipped to the maximum value.
  1401. The output audio volume is given by the relation:
  1402. @example
  1403. @var{output_volume} = @var{volume} * @var{input_volume}
  1404. @end example
  1405. Default value for @var{volume} is "1.0".
  1406. @item precision
  1407. Set the mathematical precision.
  1408. This determines which input sample formats will be allowed, which affects the
  1409. precision of the volume scaling.
  1410. @table @option
  1411. @item fixed
  1412. 8-bit fixed-point; limits input sample format to U8, S16, and S32.
  1413. @item float
  1414. 32-bit floating-point; limits input sample format to FLT. (default)
  1415. @item double
  1416. 64-bit floating-point; limits input sample format to DBL.
  1417. @end table
  1418. @item eval
  1419. Set when the volume expression is evaluated.
  1420. It accepts the following values:
  1421. @table @samp
  1422. @item once
  1423. only evaluate expression once during the filter initialization, or
  1424. when the @samp{volume} command is sent
  1425. @item frame
  1426. evaluate expression for each incoming frame
  1427. @end table
  1428. Default value is @samp{once}.
  1429. @end table
  1430. The volume expression can contain the following parameters.
  1431. @table @option
  1432. @item n
  1433. frame number (starting at zero)
  1434. @item nb_channels
  1435. number of channels
  1436. @item nb_consumed_samples
  1437. number of samples consumed by the filter
  1438. @item nb_samples
  1439. number of samples in the current frame
  1440. @item pos
  1441. original frame position in the file
  1442. @item pts
  1443. frame PTS
  1444. @item sample_rate
  1445. sample rate
  1446. @item startpts
  1447. PTS at start of stream
  1448. @item startt
  1449. time at start of stream
  1450. @item t
  1451. frame time
  1452. @item tb
  1453. timestamp timebase
  1454. @item volume
  1455. last set volume value
  1456. @end table
  1457. Note that when @option{eval} is set to @samp{once} only the
  1458. @var{sample_rate} and @var{tb} variables are available, all other
  1459. variables will evaluate to NAN.
  1460. @subsection Commands
  1461. This filter supports the following commands:
  1462. @table @option
  1463. @item volume
  1464. Modify the volume expression.
  1465. The command accepts the same syntax of the corresponding option.
  1466. If the specified expression is not valid, it is kept at its current
  1467. value.
  1468. @end table
  1469. @subsection Examples
  1470. @itemize
  1471. @item
  1472. Halve the input audio volume:
  1473. @example
  1474. volume=volume=0.5
  1475. volume=volume=1/2
  1476. volume=volume=-6.0206dB
  1477. @end example
  1478. In all the above example the named key for @option{volume} can be
  1479. omitted, for example like in:
  1480. @example
  1481. volume=0.5
  1482. @end example
  1483. @item
  1484. Increase input audio power by 6 decibels using fixed-point precision:
  1485. @example
  1486. volume=volume=6dB:precision=fixed
  1487. @end example
  1488. @item
  1489. Fade volume after time 10 with an annihilation period of 5 seconds:
  1490. @example
  1491. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  1492. @end example
  1493. @end itemize
  1494. @section volumedetect
  1495. Detect the volume of the input video.
  1496. The filter has no parameters. The input is not modified. Statistics about
  1497. the volume will be printed in the log when the input stream end is reached.
  1498. In particular it will show the mean volume (root mean square), maximum
  1499. volume (on a per-sample basis), and the beginning of a histogram of the
  1500. registered volume values (from the maximum value to a cumulated 1/1000 of
  1501. the samples).
  1502. All volumes are in decibels relative to the maximum PCM value.
  1503. @subsection Examples
  1504. Here is an excerpt of the output:
  1505. @example
  1506. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  1507. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  1508. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  1509. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  1510. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  1511. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  1512. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  1513. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  1514. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  1515. @end example
  1516. It means that:
  1517. @itemize
  1518. @item
  1519. The mean square energy is approximately -27 dB, or 10^-2.7.
  1520. @item
  1521. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  1522. @item
  1523. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  1524. @end itemize
  1525. In other words, raising the volume by +4 dB does not cause any clipping,
  1526. raising it by +5 dB causes clipping for 6 samples, etc.
  1527. @c man end AUDIO FILTERS
  1528. @chapter Audio Sources
  1529. @c man begin AUDIO SOURCES
  1530. Below is a description of the currently available audio sources.
  1531. @section abuffer
  1532. Buffer audio frames, and make them available to the filter chain.
  1533. This source is mainly intended for a programmatic use, in particular
  1534. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  1535. It accepts the following named parameters:
  1536. @table @option
  1537. @item time_base
  1538. Timebase which will be used for timestamps of submitted frames. It must be
  1539. either a floating-point number or in @var{numerator}/@var{denominator} form.
  1540. @item sample_rate
  1541. The sample rate of the incoming audio buffers.
  1542. @item sample_fmt
  1543. The sample format of the incoming audio buffers.
  1544. Either a sample format name or its corresponging integer representation from
  1545. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  1546. @item channel_layout
  1547. The channel layout of the incoming audio buffers.
  1548. Either a channel layout name from channel_layout_map in
  1549. @file{libavutil/channel_layout.c} or its corresponding integer representation
  1550. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  1551. @item channels
  1552. The number of channels of the incoming audio buffers.
  1553. If both @var{channels} and @var{channel_layout} are specified, then they
  1554. must be consistent.
  1555. @end table
  1556. @subsection Examples
  1557. @example
  1558. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  1559. @end example
  1560. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  1561. Since the sample format with name "s16p" corresponds to the number
  1562. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  1563. equivalent to:
  1564. @example
  1565. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  1566. @end example
  1567. @section aevalsrc
  1568. Generate an audio signal specified by an expression.
  1569. This source accepts in input one or more expressions (one for each
  1570. channel), which are evaluated and used to generate a corresponding
  1571. audio signal.
  1572. This source accepts the following options:
  1573. @table @option
  1574. @item exprs
  1575. Set the '|'-separated expressions list for each separate channel. In case the
  1576. @option{channel_layout} option is not specified, the selected channel layout
  1577. depends on the number of provided expressions. Otherwise the last
  1578. specified expression is applied to the remaining output channels.
  1579. @item channel_layout, c
  1580. Set the channel layout. The number of channels in the specified layout
  1581. must be equal to the number of specified expressions.
  1582. @item duration, d
  1583. Set the minimum duration of the sourced audio. See the function
  1584. @code{av_parse_time()} for the accepted format.
  1585. Note that the resulting duration may be greater than the specified
  1586. duration, as the generated audio is always cut at the end of a
  1587. complete frame.
  1588. If not specified, or the expressed duration is negative, the audio is
  1589. supposed to be generated forever.
  1590. @item nb_samples, n
  1591. Set the number of samples per channel per each output frame,
  1592. default to 1024.
  1593. @item sample_rate, s
  1594. Specify the sample rate, default to 44100.
  1595. @end table
  1596. Each expression in @var{exprs} can contain the following constants:
  1597. @table @option
  1598. @item n
  1599. number of the evaluated sample, starting from 0
  1600. @item t
  1601. time of the evaluated sample expressed in seconds, starting from 0
  1602. @item s
  1603. sample rate
  1604. @end table
  1605. @subsection Examples
  1606. @itemize
  1607. @item
  1608. Generate silence:
  1609. @example
  1610. aevalsrc=0
  1611. @end example
  1612. @item
  1613. Generate a sin signal with frequency of 440 Hz, set sample rate to
  1614. 8000 Hz:
  1615. @example
  1616. aevalsrc="sin(440*2*PI*t):s=8000"
  1617. @end example
  1618. @item
  1619. Generate a two channels signal, specify the channel layout (Front
  1620. Center + Back Center) explicitly:
  1621. @example
  1622. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  1623. @end example
  1624. @item
  1625. Generate white noise:
  1626. @example
  1627. aevalsrc="-2+random(0)"
  1628. @end example
  1629. @item
  1630. Generate an amplitude modulated signal:
  1631. @example
  1632. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  1633. @end example
  1634. @item
  1635. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  1636. @example
  1637. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  1638. @end example
  1639. @end itemize
  1640. @section anullsrc
  1641. Null audio source, return unprocessed audio frames. It is mainly useful
  1642. as a template and to be employed in analysis / debugging tools, or as
  1643. the source for filters which ignore the input data (for example the sox
  1644. synth filter).
  1645. This source accepts the following options:
  1646. @table @option
  1647. @item channel_layout, cl
  1648. Specify the channel layout, and can be either an integer or a string
  1649. representing a channel layout. The default value of @var{channel_layout}
  1650. is "stereo".
  1651. Check the channel_layout_map definition in
  1652. @file{libavutil/channel_layout.c} for the mapping between strings and
  1653. channel layout values.
  1654. @item sample_rate, r
  1655. Specify the sample rate, and defaults to 44100.
  1656. @item nb_samples, n
  1657. Set the number of samples per requested frames.
  1658. @end table
  1659. @subsection Examples
  1660. @itemize
  1661. @item
  1662. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  1663. @example
  1664. anullsrc=r=48000:cl=4
  1665. @end example
  1666. @item
  1667. Do the same operation with a more obvious syntax:
  1668. @example
  1669. anullsrc=r=48000:cl=mono
  1670. @end example
  1671. @end itemize
  1672. All the parameters need to be explicitly defined.
  1673. @section flite
  1674. Synthesize a voice utterance using the libflite library.
  1675. To enable compilation of this filter you need to configure FFmpeg with
  1676. @code{--enable-libflite}.
  1677. Note that the flite library is not thread-safe.
  1678. The filter accepts the following options:
  1679. @table @option
  1680. @item list_voices
  1681. If set to 1, list the names of the available voices and exit
  1682. immediately. Default value is 0.
  1683. @item nb_samples, n
  1684. Set the maximum number of samples per frame. Default value is 512.
  1685. @item textfile
  1686. Set the filename containing the text to speak.
  1687. @item text
  1688. Set the text to speak.
  1689. @item voice, v
  1690. Set the voice to use for the speech synthesis. Default value is
  1691. @code{kal}. See also the @var{list_voices} option.
  1692. @end table
  1693. @subsection Examples
  1694. @itemize
  1695. @item
  1696. Read from file @file{speech.txt}, and synthetize the text using the
  1697. standard flite voice:
  1698. @example
  1699. flite=textfile=speech.txt
  1700. @end example
  1701. @item
  1702. Read the specified text selecting the @code{slt} voice:
  1703. @example
  1704. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1705. @end example
  1706. @item
  1707. Input text to ffmpeg:
  1708. @example
  1709. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1710. @end example
  1711. @item
  1712. Make @file{ffplay} speak the specified text, using @code{flite} and
  1713. the @code{lavfi} device:
  1714. @example
  1715. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  1716. @end example
  1717. @end itemize
  1718. For more information about libflite, check:
  1719. @url{http://www.speech.cs.cmu.edu/flite/}
  1720. @section sine
  1721. Generate an audio signal made of a sine wave with amplitude 1/8.
  1722. The audio signal is bit-exact.
  1723. The filter accepts the following options:
  1724. @table @option
  1725. @item frequency, f
  1726. Set the carrier frequency. Default is 440 Hz.
  1727. @item beep_factor, b
  1728. Enable a periodic beep every second with frequency @var{beep_factor} times
  1729. the carrier frequency. Default is 0, meaning the beep is disabled.
  1730. @item sample_rate, r
  1731. Specify the sample rate, default is 44100.
  1732. @item duration, d
  1733. Specify the duration of the generated audio stream.
  1734. @item samples_per_frame
  1735. Set the number of samples per output frame, default is 1024.
  1736. @end table
  1737. @subsection Examples
  1738. @itemize
  1739. @item
  1740. Generate a simple 440 Hz sine wave:
  1741. @example
  1742. sine
  1743. @end example
  1744. @item
  1745. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  1746. @example
  1747. sine=220:4:d=5
  1748. sine=f=220:b=4:d=5
  1749. sine=frequency=220:beep_factor=4:duration=5
  1750. @end example
  1751. @end itemize
  1752. @c man end AUDIO SOURCES
  1753. @chapter Audio Sinks
  1754. @c man begin AUDIO SINKS
  1755. Below is a description of the currently available audio sinks.
  1756. @section abuffersink
  1757. Buffer audio frames, and make them available to the end of filter chain.
  1758. This sink is mainly intended for programmatic use, in particular
  1759. through the interface defined in @file{libavfilter/buffersink.h}
  1760. or the options system.
  1761. It accepts a pointer to an AVABufferSinkContext structure, which
  1762. defines the incoming buffers' formats, to be passed as the opaque
  1763. parameter to @code{avfilter_init_filter} for initialization.
  1764. @section anullsink
  1765. Null audio sink, do absolutely nothing with the input audio. It is
  1766. mainly useful as a template and to be employed in analysis / debugging
  1767. tools.
  1768. @c man end AUDIO SINKS
  1769. @chapter Video Filters
  1770. @c man begin VIDEO FILTERS
  1771. When you configure your FFmpeg build, you can disable any of the
  1772. existing filters using @code{--disable-filters}.
  1773. The configure output will show the video filters included in your
  1774. build.
  1775. Below is a description of the currently available video filters.
  1776. @section alphaextract
  1777. Extract the alpha component from the input as a grayscale video. This
  1778. is especially useful with the @var{alphamerge} filter.
  1779. @section alphamerge
  1780. Add or replace the alpha component of the primary input with the
  1781. grayscale value of a second input. This is intended for use with
  1782. @var{alphaextract} to allow the transmission or storage of frame
  1783. sequences that have alpha in a format that doesn't support an alpha
  1784. channel.
  1785. For example, to reconstruct full frames from a normal YUV-encoded video
  1786. and a separate video created with @var{alphaextract}, you might use:
  1787. @example
  1788. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  1789. @end example
  1790. Since this filter is designed for reconstruction, it operates on frame
  1791. sequences without considering timestamps, and terminates when either
  1792. input reaches end of stream. This will cause problems if your encoding
  1793. pipeline drops frames. If you're trying to apply an image as an
  1794. overlay to a video stream, consider the @var{overlay} filter instead.
  1795. @section ass
  1796. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  1797. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  1798. Substation Alpha) subtitles files.
  1799. @section bbox
  1800. Compute the bounding box for the non-black pixels in the input frame
  1801. luminance plane.
  1802. This filter computes the bounding box containing all the pixels with a
  1803. luminance value greater than the minimum allowed value.
  1804. The parameters describing the bounding box are printed on the filter
  1805. log.
  1806. The filter accepts the following option:
  1807. @table @option
  1808. @item min_val
  1809. Set the minimal luminance value. Default is @code{16}.
  1810. @end table
  1811. @section blackdetect
  1812. Detect video intervals that are (almost) completely black. Can be
  1813. useful to detect chapter transitions, commercials, or invalid
  1814. recordings. Output lines contains the time for the start, end and
  1815. duration of the detected black interval expressed in seconds.
  1816. In order to display the output lines, you need to set the loglevel at
  1817. least to the AV_LOG_INFO value.
  1818. The filter accepts the following options:
  1819. @table @option
  1820. @item black_min_duration, d
  1821. Set the minimum detected black duration expressed in seconds. It must
  1822. be a non-negative floating point number.
  1823. Default value is 2.0.
  1824. @item picture_black_ratio_th, pic_th
  1825. Set the threshold for considering a picture "black".
  1826. Express the minimum value for the ratio:
  1827. @example
  1828. @var{nb_black_pixels} / @var{nb_pixels}
  1829. @end example
  1830. for which a picture is considered black.
  1831. Default value is 0.98.
  1832. @item pixel_black_th, pix_th
  1833. Set the threshold for considering a pixel "black".
  1834. The threshold expresses the maximum pixel luminance value for which a
  1835. pixel is considered "black". The provided value is scaled according to
  1836. the following equation:
  1837. @example
  1838. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  1839. @end example
  1840. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  1841. the input video format, the range is [0-255] for YUV full-range
  1842. formats and [16-235] for YUV non full-range formats.
  1843. Default value is 0.10.
  1844. @end table
  1845. The following example sets the maximum pixel threshold to the minimum
  1846. value, and detects only black intervals of 2 or more seconds:
  1847. @example
  1848. blackdetect=d=2:pix_th=0.00
  1849. @end example
  1850. @section blackframe
  1851. Detect frames that are (almost) completely black. Can be useful to
  1852. detect chapter transitions or commercials. Output lines consist of
  1853. the frame number of the detected frame, the percentage of blackness,
  1854. the position in the file if known or -1 and the timestamp in seconds.
  1855. In order to display the output lines, you need to set the loglevel at
  1856. least to the AV_LOG_INFO value.
  1857. The filter accepts the following options:
  1858. @table @option
  1859. @item amount
  1860. Set the percentage of the pixels that have to be below the threshold, defaults
  1861. to @code{98}.
  1862. @item threshold, thresh
  1863. Set the threshold below which a pixel value is considered black, defaults to
  1864. @code{32}.
  1865. @end table
  1866. @section blend
  1867. Blend two video frames into each other.
  1868. It takes two input streams and outputs one stream, the first input is the
  1869. "top" layer and second input is "bottom" layer.
  1870. Output terminates when shortest input terminates.
  1871. A description of the accepted options follows.
  1872. @table @option
  1873. @item c0_mode
  1874. @item c1_mode
  1875. @item c2_mode
  1876. @item c3_mode
  1877. @item all_mode
  1878. Set blend mode for specific pixel component or all pixel components in case
  1879. of @var{all_mode}. Default value is @code{normal}.
  1880. Available values for component modes are:
  1881. @table @samp
  1882. @item addition
  1883. @item and
  1884. @item average
  1885. @item burn
  1886. @item darken
  1887. @item difference
  1888. @item divide
  1889. @item dodge
  1890. @item exclusion
  1891. @item hardlight
  1892. @item lighten
  1893. @item multiply
  1894. @item negation
  1895. @item normal
  1896. @item or
  1897. @item overlay
  1898. @item phoenix
  1899. @item pinlight
  1900. @item reflect
  1901. @item screen
  1902. @item softlight
  1903. @item subtract
  1904. @item vividlight
  1905. @item xor
  1906. @end table
  1907. @item c0_opacity
  1908. @item c1_opacity
  1909. @item c2_opacity
  1910. @item c3_opacity
  1911. @item all_opacity
  1912. Set blend opacity for specific pixel component or all pixel components in case
  1913. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  1914. @item c0_expr
  1915. @item c1_expr
  1916. @item c2_expr
  1917. @item c3_expr
  1918. @item all_expr
  1919. Set blend expression for specific pixel component or all pixel components in case
  1920. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  1921. The expressions can use the following variables:
  1922. @table @option
  1923. @item N
  1924. The sequential number of the filtered frame, starting from @code{0}.
  1925. @item X
  1926. @item Y
  1927. the coordinates of the current sample
  1928. @item W
  1929. @item H
  1930. the width and height of currently filtered plane
  1931. @item SW
  1932. @item SH
  1933. Width and height scale depending on the currently filtered plane. It is the
  1934. ratio between the corresponding luma plane number of pixels and the current
  1935. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  1936. @code{0.5,0.5} for chroma planes.
  1937. @item T
  1938. Time of the current frame, expressed in seconds.
  1939. @item TOP, A
  1940. Value of pixel component at current location for first video frame (top layer).
  1941. @item BOTTOM, B
  1942. Value of pixel component at current location for second video frame (bottom layer).
  1943. @end table
  1944. @item shortest
  1945. Force termination when the shortest input terminates. Default is @code{0}.
  1946. @item repeatlast
  1947. Continue applying the last bottom frame after the end of the stream. A value of
  1948. @code{0} disable the filter after the last frame of the bottom layer is reached.
  1949. Default is @code{1}.
  1950. @end table
  1951. @subsection Examples
  1952. @itemize
  1953. @item
  1954. Apply transition from bottom layer to top layer in first 10 seconds:
  1955. @example
  1956. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  1957. @end example
  1958. @item
  1959. Apply 1x1 checkerboard effect:
  1960. @example
  1961. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  1962. @end example
  1963. @item
  1964. Apply uncover left effect:
  1965. @example
  1966. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  1967. @end example
  1968. @item
  1969. Apply uncover down effect:
  1970. @example
  1971. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  1972. @end example
  1973. @item
  1974. Apply uncover up-left effect:
  1975. @example
  1976. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  1977. @end example
  1978. @end itemize
  1979. @section boxblur
  1980. Apply boxblur algorithm to the input video.
  1981. The filter accepts the following options:
  1982. @table @option
  1983. @item luma_radius, lr
  1984. @item luma_power, lp
  1985. @item chroma_radius, cr
  1986. @item chroma_power, cp
  1987. @item alpha_radius, ar
  1988. @item alpha_power, ap
  1989. @end table
  1990. A description of the accepted options follows.
  1991. @table @option
  1992. @item luma_radius, lr
  1993. @item chroma_radius, cr
  1994. @item alpha_radius, ar
  1995. Set an expression for the box radius in pixels used for blurring the
  1996. corresponding input plane.
  1997. The radius value must be a non-negative number, and must not be
  1998. greater than the value of the expression @code{min(w,h)/2} for the
  1999. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2000. planes.
  2001. Default value for @option{luma_radius} is "2". If not specified,
  2002. @option{chroma_radius} and @option{alpha_radius} default to the
  2003. corresponding value set for @option{luma_radius}.
  2004. The expressions can contain the following constants:
  2005. @table @option
  2006. @item w
  2007. @item h
  2008. the input width and height in pixels
  2009. @item cw
  2010. @item ch
  2011. the input chroma image width and height in pixels
  2012. @item hsub
  2013. @item vsub
  2014. horizontal and vertical chroma subsample values. For example for the
  2015. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2016. @end table
  2017. @item luma_power, lp
  2018. @item chroma_power, cp
  2019. @item alpha_power, ap
  2020. Specify how many times the boxblur filter is applied to the
  2021. corresponding plane.
  2022. Default value for @option{luma_power} is 2. If not specified,
  2023. @option{chroma_power} and @option{alpha_power} default to the
  2024. corresponding value set for @option{luma_power}.
  2025. A value of 0 will disable the effect.
  2026. @end table
  2027. @subsection Examples
  2028. @itemize
  2029. @item
  2030. Apply a boxblur filter with luma, chroma, and alpha radius
  2031. set to 2:
  2032. @example
  2033. boxblur=luma_radius=2:luma_power=1
  2034. boxblur=2:1
  2035. @end example
  2036. @item
  2037. Set luma radius to 2, alpha and chroma radius to 0:
  2038. @example
  2039. boxblur=2:1:cr=0:ar=0
  2040. @end example
  2041. @item
  2042. Set luma and chroma radius to a fraction of the video dimension:
  2043. @example
  2044. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2045. @end example
  2046. @end itemize
  2047. @section colorbalance
  2048. Modify intensity of primary colors (red, green and blue) of input frames.
  2049. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  2050. regions for the red-cyan, green-magenta or blue-yellow balance.
  2051. A positive adjustment value shifts the balance towards the primary color, a negative
  2052. value towards the complementary color.
  2053. The filter accepts the following options:
  2054. @table @option
  2055. @item rs
  2056. @item gs
  2057. @item bs
  2058. Adjust red, green and blue shadows (darkest pixels).
  2059. @item rm
  2060. @item gm
  2061. @item bm
  2062. Adjust red, green and blue midtones (medium pixels).
  2063. @item rh
  2064. @item gh
  2065. @item bh
  2066. Adjust red, green and blue highlights (brightest pixels).
  2067. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  2068. @end table
  2069. @subsection Examples
  2070. @itemize
  2071. @item
  2072. Add red color cast to shadows:
  2073. @example
  2074. colorbalance=rs=.3
  2075. @end example
  2076. @end itemize
  2077. @section colorchannelmixer
  2078. Adjust video input frames by re-mixing color channels.
  2079. This filter modifies a color channel by adding the values associated to
  2080. the other channels of the same pixels. For example if the value to
  2081. modify is red, the output value will be:
  2082. @example
  2083. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  2084. @end example
  2085. The filter accepts the following options:
  2086. @table @option
  2087. @item rr
  2088. @item rg
  2089. @item rb
  2090. @item ra
  2091. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  2092. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  2093. @item gr
  2094. @item gg
  2095. @item gb
  2096. @item ga
  2097. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  2098. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  2099. @item br
  2100. @item bg
  2101. @item bb
  2102. @item ba
  2103. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  2104. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  2105. @item ar
  2106. @item ag
  2107. @item ab
  2108. @item aa
  2109. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  2110. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  2111. Allowed ranges for options are @code{[-2.0, 2.0]}.
  2112. @end table
  2113. @subsection Examples
  2114. @itemize
  2115. @item
  2116. Convert source to grayscale:
  2117. @example
  2118. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  2119. @end example
  2120. @item
  2121. Simulate sepia tones:
  2122. @example
  2123. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  2124. @end example
  2125. @end itemize
  2126. @section colormatrix
  2127. Convert color matrix.
  2128. The filter accepts the following options:
  2129. @table @option
  2130. @item src
  2131. @item dst
  2132. Specify the source and destination color matrix. Both values must be
  2133. specified.
  2134. The accepted values are:
  2135. @table @samp
  2136. @item bt709
  2137. BT.709
  2138. @item bt601
  2139. BT.601
  2140. @item smpte240m
  2141. SMPTE-240M
  2142. @item fcc
  2143. FCC
  2144. @end table
  2145. @end table
  2146. For example to convert from BT.601 to SMPTE-240M, use the command:
  2147. @example
  2148. colormatrix=bt601:smpte240m
  2149. @end example
  2150. @section copy
  2151. Copy the input source unchanged to the output. Mainly useful for
  2152. testing purposes.
  2153. @section crop
  2154. Crop the input video to given dimensions.
  2155. The filter accepts the following options:
  2156. @table @option
  2157. @item w, out_w
  2158. Width of the output video. It defaults to @code{iw}.
  2159. This expression is evaluated only once during the filter
  2160. configuration.
  2161. @item h, out_h
  2162. Height of the output video. It defaults to @code{ih}.
  2163. This expression is evaluated only once during the filter
  2164. configuration.
  2165. @item x
  2166. Horizontal position, in the input video, of the left edge of the output video.
  2167. It defaults to @code{(in_w-out_w)/2}.
  2168. This expression is evaluated per-frame.
  2169. @item y
  2170. Vertical position, in the input video, of the top edge of the output video.
  2171. It defaults to @code{(in_h-out_h)/2}.
  2172. This expression is evaluated per-frame.
  2173. @item keep_aspect
  2174. If set to 1 will force the output display aspect ratio
  2175. to be the same of the input, by changing the output sample aspect
  2176. ratio. It defaults to 0.
  2177. @end table
  2178. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  2179. expressions containing the following constants:
  2180. @table @option
  2181. @item x
  2182. @item y
  2183. the computed values for @var{x} and @var{y}. They are evaluated for
  2184. each new frame.
  2185. @item in_w
  2186. @item in_h
  2187. the input width and height
  2188. @item iw
  2189. @item ih
  2190. same as @var{in_w} and @var{in_h}
  2191. @item out_w
  2192. @item out_h
  2193. the output (cropped) width and height
  2194. @item ow
  2195. @item oh
  2196. same as @var{out_w} and @var{out_h}
  2197. @item a
  2198. same as @var{iw} / @var{ih}
  2199. @item sar
  2200. input sample aspect ratio
  2201. @item dar
  2202. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  2203. @item hsub
  2204. @item vsub
  2205. horizontal and vertical chroma subsample values. For example for the
  2206. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2207. @item n
  2208. the number of input frame, starting from 0
  2209. @item pos
  2210. the position in the file of the input frame, NAN if unknown
  2211. @item t
  2212. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2213. @end table
  2214. The expression for @var{out_w} may depend on the value of @var{out_h},
  2215. and the expression for @var{out_h} may depend on @var{out_w}, but they
  2216. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  2217. evaluated after @var{out_w} and @var{out_h}.
  2218. The @var{x} and @var{y} parameters specify the expressions for the
  2219. position of the top-left corner of the output (non-cropped) area. They
  2220. are evaluated for each frame. If the evaluated value is not valid, it
  2221. is approximated to the nearest valid value.
  2222. The expression for @var{x} may depend on @var{y}, and the expression
  2223. for @var{y} may depend on @var{x}.
  2224. @subsection Examples
  2225. @itemize
  2226. @item
  2227. Crop area with size 100x100 at position (12,34).
  2228. @example
  2229. crop=100:100:12:34
  2230. @end example
  2231. Using named options, the example above becomes:
  2232. @example
  2233. crop=w=100:h=100:x=12:y=34
  2234. @end example
  2235. @item
  2236. Crop the central input area with size 100x100:
  2237. @example
  2238. crop=100:100
  2239. @end example
  2240. @item
  2241. Crop the central input area with size 2/3 of the input video:
  2242. @example
  2243. crop=2/3*in_w:2/3*in_h
  2244. @end example
  2245. @item
  2246. Crop the input video central square:
  2247. @example
  2248. crop=out_w=in_h
  2249. crop=in_h
  2250. @end example
  2251. @item
  2252. Delimit the rectangle with the top-left corner placed at position
  2253. 100:100 and the right-bottom corner corresponding to the right-bottom
  2254. corner of the input image:
  2255. @example
  2256. crop=in_w-100:in_h-100:100:100
  2257. @end example
  2258. @item
  2259. Crop 10 pixels from the left and right borders, and 20 pixels from
  2260. the top and bottom borders
  2261. @example
  2262. crop=in_w-2*10:in_h-2*20
  2263. @end example
  2264. @item
  2265. Keep only the bottom right quarter of the input image:
  2266. @example
  2267. crop=in_w/2:in_h/2:in_w/2:in_h/2
  2268. @end example
  2269. @item
  2270. Crop height for getting Greek harmony:
  2271. @example
  2272. crop=in_w:1/PHI*in_w
  2273. @end example
  2274. @item
  2275. Appply trembling effect:
  2276. @example
  2277. 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)
  2278. @end example
  2279. @item
  2280. Apply erratic camera effect depending on timestamp:
  2281. @example
  2282. 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)"
  2283. @end example
  2284. @item
  2285. Set x depending on the value of y:
  2286. @example
  2287. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  2288. @end example
  2289. @end itemize
  2290. @section cropdetect
  2291. Auto-detect crop size.
  2292. Calculate necessary cropping parameters and prints the recommended
  2293. parameters through the logging system. The detected dimensions
  2294. correspond to the non-black area of the input video.
  2295. The filter accepts the following options:
  2296. @table @option
  2297. @item limit
  2298. Set higher black value threshold, which can be optionally specified
  2299. from nothing (0) to everything (255). An intensity value greater
  2300. to the set value is considered non-black. Default value is 24.
  2301. @item round
  2302. Set the value for which the width/height should be divisible by. The
  2303. offset is automatically adjusted to center the video. Use 2 to get
  2304. only even dimensions (needed for 4:2:2 video). 16 is best when
  2305. encoding to most video codecs. Default value is 16.
  2306. @item reset_count, reset
  2307. Set the counter that determines after how many frames cropdetect will
  2308. reset the previously detected largest video area and start over to
  2309. detect the current optimal crop area. Default value is 0.
  2310. This can be useful when channel logos distort the video area. 0
  2311. indicates never reset and return the largest area encountered during
  2312. playback.
  2313. @end table
  2314. @anchor{curves}
  2315. @section curves
  2316. Apply color adjustments using curves.
  2317. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  2318. component (red, green and blue) has its values defined by @var{N} key points
  2319. tied from each other using a smooth curve. The x-axis represents the pixel
  2320. values from the input frame, and the y-axis the new pixel values to be set for
  2321. the output frame.
  2322. By default, a component curve is defined by the two points @var{(0;0)} and
  2323. @var{(1;1)}. This creates a straight line where each original pixel value is
  2324. "adjusted" to its own value, which means no change to the image.
  2325. The filter allows you to redefine these two points and add some more. A new
  2326. curve (using a natural cubic spline interpolation) will be define to pass
  2327. smoothly through all these new coordinates. The new defined points needs to be
  2328. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  2329. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  2330. the vector spaces, the values will be clipped accordingly.
  2331. If there is no key point defined in @code{x=0}, the filter will automatically
  2332. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  2333. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  2334. The filter accepts the following options:
  2335. @table @option
  2336. @item preset
  2337. Select one of the available color presets. This option can be used in addition
  2338. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  2339. options takes priority on the preset values.
  2340. Available presets are:
  2341. @table @samp
  2342. @item none
  2343. @item color_negative
  2344. @item cross_process
  2345. @item darker
  2346. @item increase_contrast
  2347. @item lighter
  2348. @item linear_contrast
  2349. @item medium_contrast
  2350. @item negative
  2351. @item strong_contrast
  2352. @item vintage
  2353. @end table
  2354. Default is @code{none}.
  2355. @item master, m
  2356. Set the master key points. These points will define a second pass mapping. It
  2357. is sometimes called a "luminance" or "value" mapping. It can be used with
  2358. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  2359. post-processing LUT.
  2360. @item red, r
  2361. Set the key points for the red component.
  2362. @item green, g
  2363. Set the key points for the green component.
  2364. @item blue, b
  2365. Set the key points for the blue component.
  2366. @item all
  2367. Set the key points for all components (not including master).
  2368. Can be used in addition to the other key points component
  2369. options. In this case, the unset component(s) will fallback on this
  2370. @option{all} setting.
  2371. @item psfile
  2372. Specify a Photoshop curves file (@code{.asv}) to import the settings from.
  2373. @end table
  2374. To avoid some filtergraph syntax conflicts, each key points list need to be
  2375. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  2376. @subsection Examples
  2377. @itemize
  2378. @item
  2379. Increase slightly the middle level of blue:
  2380. @example
  2381. curves=blue='0.5/0.58'
  2382. @end example
  2383. @item
  2384. Vintage effect:
  2385. @example
  2386. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  2387. @end example
  2388. Here we obtain the following coordinates for each components:
  2389. @table @var
  2390. @item red
  2391. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  2392. @item green
  2393. @code{(0;0) (0.50;0.48) (1;1)}
  2394. @item blue
  2395. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  2396. @end table
  2397. @item
  2398. The previous example can also be achieved with the associated built-in preset:
  2399. @example
  2400. curves=preset=vintage
  2401. @end example
  2402. @item
  2403. Or simply:
  2404. @example
  2405. curves=vintage
  2406. @end example
  2407. @item
  2408. Use a Photoshop preset and redefine the points of the green component:
  2409. @example
  2410. curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
  2411. @end example
  2412. @end itemize
  2413. @section dctdnoiz
  2414. Denoise frames using 2D DCT (frequency domain filtering).
  2415. This filter is not designed for real time and can be extremely slow.
  2416. The filter accepts the following options:
  2417. @table @option
  2418. @item sigma, s
  2419. Set the noise sigma constant.
  2420. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  2421. coefficient (absolute value) below this threshold with be dropped.
  2422. If you need a more advanced filtering, see @option{expr}.
  2423. Default is @code{0}.
  2424. @item overlap
  2425. Set number overlapping pixels for each block. Each block is of size
  2426. @code{16x16}. Since the filter can be slow, you may want to reduce this value,
  2427. at the cost of a less effective filter and the risk of various artefacts.
  2428. If the overlapping value doesn't allow to process the whole input width or
  2429. height, a warning will be displayed and according borders won't be denoised.
  2430. Default value is @code{15}.
  2431. @item expr, e
  2432. Set the coefficient factor expression.
  2433. For each coefficient of a DCT block, this expression will be evaluated as a
  2434. multiplier value for the coefficient.
  2435. If this is option is set, the @option{sigma} option will be ignored.
  2436. The absolute value of the coefficient can be accessed through the @var{c}
  2437. variable.
  2438. @end table
  2439. @subsection Examples
  2440. Apply a denoise with a @option{sigma} of @code{4.5}:
  2441. @example
  2442. dctdnoiz=4.5
  2443. @end example
  2444. The same operation can be achieved using the expression system:
  2445. @example
  2446. dctdnoiz=e='gte(c, 4.5*3)'
  2447. @end example
  2448. @anchor{decimate}
  2449. @section decimate
  2450. Drop duplicated frames at regular intervals.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item cycle
  2454. Set the number of frames from which one will be dropped. Setting this to
  2455. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  2456. Default is @code{5}.
  2457. @item dupthresh
  2458. Set the threshold for duplicate detection. If the difference metric for a frame
  2459. is less than or equal to this value, then it is declared as duplicate. Default
  2460. is @code{1.1}
  2461. @item scthresh
  2462. Set scene change threshold. Default is @code{15}.
  2463. @item blockx
  2464. @item blocky
  2465. Set the size of the x and y-axis blocks used during metric calculations.
  2466. Larger blocks give better noise suppression, but also give worse detection of
  2467. small movements. Must be a power of two. Default is @code{32}.
  2468. @item ppsrc
  2469. Mark main input as a pre-processed input and activate clean source input
  2470. stream. This allows the input to be pre-processed with various filters to help
  2471. the metrics calculation while keeping the frame selection lossless. When set to
  2472. @code{1}, the first stream is for the pre-processed input, and the second
  2473. stream is the clean source from where the kept frames are chosen. Default is
  2474. @code{0}.
  2475. @item chroma
  2476. Set whether or not chroma is considered in the metric calculations. Default is
  2477. @code{1}.
  2478. @end table
  2479. @section delogo
  2480. Suppress a TV station logo by a simple interpolation of the surrounding
  2481. pixels. Just set a rectangle covering the logo and watch it disappear
  2482. (and sometimes something even uglier appear - your mileage may vary).
  2483. This filter accepts the following options:
  2484. @table @option
  2485. @item x
  2486. @item y
  2487. Specify the top left corner coordinates of the logo. They must be
  2488. specified.
  2489. @item w
  2490. @item h
  2491. Specify the width and height of the logo to clear. They must be
  2492. specified.
  2493. @item band, t
  2494. Specify the thickness of the fuzzy edge of the rectangle (added to
  2495. @var{w} and @var{h}). The default value is 4.
  2496. @item show
  2497. When set to 1, a green rectangle is drawn on the screen to simplify
  2498. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  2499. The default value is 0.
  2500. The rectangle is drawn on the outermost pixels which will be (partly)
  2501. replaced with interpolated values. The values of the next pixels
  2502. immediately outside this rectangle in each direction will be used to
  2503. compute the interpolated pixel values inside the rectangle.
  2504. @end table
  2505. @subsection Examples
  2506. @itemize
  2507. @item
  2508. Set a rectangle covering the area with top left corner coordinates 0,0
  2509. and size 100x77, setting a band of size 10:
  2510. @example
  2511. delogo=x=0:y=0:w=100:h=77:band=10
  2512. @end example
  2513. @end itemize
  2514. @section deshake
  2515. Attempt to fix small changes in horizontal and/or vertical shift. This
  2516. filter helps remove camera shake from hand-holding a camera, bumping a
  2517. tripod, moving on a vehicle, etc.
  2518. The filter accepts the following options:
  2519. @table @option
  2520. @item x
  2521. @item y
  2522. @item w
  2523. @item h
  2524. Specify a rectangular area where to limit the search for motion
  2525. vectors.
  2526. If desired the search for motion vectors can be limited to a
  2527. rectangular area of the frame defined by its top left corner, width
  2528. and height. These parameters have the same meaning as the drawbox
  2529. filter which can be used to visualise the position of the bounding
  2530. box.
  2531. This is useful when simultaneous movement of subjects within the frame
  2532. might be confused for camera motion by the motion vector search.
  2533. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  2534. then the full frame is used. This allows later options to be set
  2535. without specifying the bounding box for the motion vector search.
  2536. Default - search the whole frame.
  2537. @item rx
  2538. @item ry
  2539. Specify the maximum extent of movement in x and y directions in the
  2540. range 0-64 pixels. Default 16.
  2541. @item edge
  2542. Specify how to generate pixels to fill blanks at the edge of the
  2543. frame. Available values are:
  2544. @table @samp
  2545. @item blank, 0
  2546. Fill zeroes at blank locations
  2547. @item original, 1
  2548. Original image at blank locations
  2549. @item clamp, 2
  2550. Extruded edge value at blank locations
  2551. @item mirror, 3
  2552. Mirrored edge at blank locations
  2553. @end table
  2554. Default value is @samp{mirror}.
  2555. @item blocksize
  2556. Specify the blocksize to use for motion search. Range 4-128 pixels,
  2557. default 8.
  2558. @item contrast
  2559. Specify the contrast threshold for blocks. Only blocks with more than
  2560. the specified contrast (difference between darkest and lightest
  2561. pixels) will be considered. Range 1-255, default 125.
  2562. @item search
  2563. Specify the search strategy. Available values are:
  2564. @table @samp
  2565. @item exhaustive, 0
  2566. Set exhaustive search
  2567. @item less, 1
  2568. Set less exhaustive search.
  2569. @end table
  2570. Default value is @samp{exhaustive}.
  2571. @item filename
  2572. If set then a detailed log of the motion search is written to the
  2573. specified file.
  2574. @item opencl
  2575. If set to 1, specify using OpenCL capabilities, only available if
  2576. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  2577. @end table
  2578. @section drawbox
  2579. Draw a colored box on the input image.
  2580. This filter accepts the following options:
  2581. @table @option
  2582. @item x
  2583. @item y
  2584. The expressions which specify the top left corner coordinates of the box. Default to 0.
  2585. @item width, w
  2586. @item height, h
  2587. The expressions which specify the width and height of the box, if 0 they are interpreted as
  2588. the input width and height. Default to 0.
  2589. @item color, c
  2590. Specify the color of the box to write. For the general syntax of this option,
  2591. check the "Color" section in the ffmpeg-utils manual. If the special
  2592. value @code{invert} is used, the box edge color is the same as the
  2593. video with inverted luma.
  2594. @item thickness, t
  2595. The expression which sets the thickness of the box edge. Default value is @code{3}.
  2596. See below for the list of accepted constants.
  2597. @end table
  2598. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2599. following constants:
  2600. @table @option
  2601. @item dar
  2602. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2603. @item hsub
  2604. @item vsub
  2605. horizontal and vertical chroma subsample values. For example for the
  2606. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2607. @item in_h, ih
  2608. @item in_w, iw
  2609. The input width and height.
  2610. @item sar
  2611. The input sample aspect ratio.
  2612. @item x
  2613. @item y
  2614. The x and y offset coordinates where the box is drawn.
  2615. @item w
  2616. @item h
  2617. The width and height of the drawn box.
  2618. @item t
  2619. The thickness of the drawn box.
  2620. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2621. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2622. @end table
  2623. @subsection Examples
  2624. @itemize
  2625. @item
  2626. Draw a black box around the edge of the input image:
  2627. @example
  2628. drawbox
  2629. @end example
  2630. @item
  2631. Draw a box with color red and an opacity of 50%:
  2632. @example
  2633. drawbox=10:20:200:60:red@@0.5
  2634. @end example
  2635. The previous example can be specified as:
  2636. @example
  2637. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  2638. @end example
  2639. @item
  2640. Fill the box with pink color:
  2641. @example
  2642. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  2643. @end example
  2644. @item
  2645. Draw a 2-pixel red 2.40:1 mask:
  2646. @example
  2647. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  2648. @end example
  2649. @end itemize
  2650. @section drawgrid
  2651. Draw a grid on the input image.
  2652. This filter accepts the following options:
  2653. @table @option
  2654. @item x
  2655. @item y
  2656. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  2657. @item width, w
  2658. @item height, h
  2659. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  2660. input width and height, respectively, minus @code{thickness}, so image gets
  2661. framed. Default to 0.
  2662. @item color, c
  2663. Specify the color of the grid. For the general syntax of this option,
  2664. check the "Color" section in the ffmpeg-utils manual. If the special
  2665. value @code{invert} is used, the grid color is the same as the
  2666. video with inverted luma.
  2667. @item thickness, t
  2668. The expression which sets the thickness of the grid line. Default value is @code{1}.
  2669. See below for the list of accepted constants.
  2670. @end table
  2671. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2672. following constants:
  2673. @table @option
  2674. @item dar
  2675. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2676. @item hsub
  2677. @item vsub
  2678. horizontal and vertical chroma subsample values. For example for the
  2679. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2680. @item in_h, ih
  2681. @item in_w, iw
  2682. The input grid cell width and height.
  2683. @item sar
  2684. The input sample aspect ratio.
  2685. @item x
  2686. @item y
  2687. The x and y coordinates of some point of grid intersection (meant to configure offset).
  2688. @item w
  2689. @item h
  2690. The width and height of the drawn cell.
  2691. @item t
  2692. The thickness of the drawn cell.
  2693. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2694. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2695. @end table
  2696. @subsection Examples
  2697. @itemize
  2698. @item
  2699. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  2700. @example
  2701. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  2702. @end example
  2703. @item
  2704. Draw a white 3x3 grid with an opacity of 50%:
  2705. @example
  2706. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  2707. @end example
  2708. @end itemize
  2709. @anchor{drawtext}
  2710. @section drawtext
  2711. Draw text string or text from specified file on top of video using the
  2712. libfreetype library.
  2713. To enable compilation of this filter you need to configure FFmpeg with
  2714. @code{--enable-libfreetype}.
  2715. @subsection Syntax
  2716. The description of the accepted parameters follows.
  2717. @table @option
  2718. @item box
  2719. Used to draw a box around text using background color.
  2720. Value should be either 1 (enable) or 0 (disable).
  2721. The default value of @var{box} is 0.
  2722. @item boxcolor
  2723. The color to be used for drawing box around text. For the syntax of this
  2724. option, check the "Color" section in the ffmpeg-utils manual.
  2725. The default value of @var{boxcolor} is "white".
  2726. @item expansion
  2727. Select how the @var{text} is expanded. Can be either @code{none},
  2728. @code{strftime} (deprecated) or
  2729. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  2730. below for details.
  2731. @item fix_bounds
  2732. If true, check and fix text coords to avoid clipping.
  2733. @item fontcolor
  2734. The color to be used for drawing fonts. For the syntax of this option, check
  2735. the "Color" section in the ffmpeg-utils manual.
  2736. The default value of @var{fontcolor} is "black".
  2737. @item fontfile
  2738. The font file to be used for drawing text. Path must be included.
  2739. This parameter is mandatory.
  2740. @item fontsize
  2741. The font size to be used for drawing text.
  2742. The default value of @var{fontsize} is 16.
  2743. @item ft_load_flags
  2744. Flags to be used for loading the fonts.
  2745. The flags map the corresponding flags supported by libfreetype, and are
  2746. a combination of the following values:
  2747. @table @var
  2748. @item default
  2749. @item no_scale
  2750. @item no_hinting
  2751. @item render
  2752. @item no_bitmap
  2753. @item vertical_layout
  2754. @item force_autohint
  2755. @item crop_bitmap
  2756. @item pedantic
  2757. @item ignore_global_advance_width
  2758. @item no_recurse
  2759. @item ignore_transform
  2760. @item monochrome
  2761. @item linear_design
  2762. @item no_autohint
  2763. @end table
  2764. Default value is "default".
  2765. For more information consult the documentation for the FT_LOAD_*
  2766. libfreetype flags.
  2767. @item shadowcolor
  2768. The color to be used for drawing a shadow behind the drawn text. For the
  2769. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  2770. The default value of @var{shadowcolor} is "black".
  2771. @item shadowx
  2772. @item shadowy
  2773. The x and y offsets for the text shadow position with respect to the
  2774. position of the text. They can be either positive or negative
  2775. values. Default value for both is "0".
  2776. @item start_number
  2777. The starting frame number for the n/frame_num variable. The default value
  2778. is "0".
  2779. @item tabsize
  2780. The size in number of spaces to use for rendering the tab.
  2781. Default value is 4.
  2782. @item timecode
  2783. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  2784. format. It can be used with or without text parameter. @var{timecode_rate}
  2785. option must be specified.
  2786. @item timecode_rate, rate, r
  2787. Set the timecode frame rate (timecode only).
  2788. @item text
  2789. The text string to be drawn. The text must be a sequence of UTF-8
  2790. encoded characters.
  2791. This parameter is mandatory if no file is specified with the parameter
  2792. @var{textfile}.
  2793. @item textfile
  2794. A text file containing text to be drawn. The text must be a sequence
  2795. of UTF-8 encoded characters.
  2796. This parameter is mandatory if no text string is specified with the
  2797. parameter @var{text}.
  2798. If both @var{text} and @var{textfile} are specified, an error is thrown.
  2799. @item reload
  2800. If set to 1, the @var{textfile} will be reloaded before each frame.
  2801. Be sure to update it atomically, or it may be read partially, or even fail.
  2802. @item x
  2803. @item y
  2804. The expressions which specify the offsets where text will be drawn
  2805. within the video frame. They are relative to the top/left border of the
  2806. output image.
  2807. The default value of @var{x} and @var{y} is "0".
  2808. See below for the list of accepted constants and functions.
  2809. @end table
  2810. The parameters for @var{x} and @var{y} are expressions containing the
  2811. following constants and functions:
  2812. @table @option
  2813. @item dar
  2814. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  2815. @item hsub
  2816. @item vsub
  2817. horizontal and vertical chroma subsample values. For example for the
  2818. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2819. @item line_h, lh
  2820. the height of each text line
  2821. @item main_h, h, H
  2822. the input height
  2823. @item main_w, w, W
  2824. the input width
  2825. @item max_glyph_a, ascent
  2826. the maximum distance from the baseline to the highest/upper grid
  2827. coordinate used to place a glyph outline point, for all the rendered
  2828. glyphs.
  2829. It is a positive value, due to the grid's orientation with the Y axis
  2830. upwards.
  2831. @item max_glyph_d, descent
  2832. the maximum distance from the baseline to the lowest grid coordinate
  2833. used to place a glyph outline point, for all the rendered glyphs.
  2834. This is a negative value, due to the grid's orientation, with the Y axis
  2835. upwards.
  2836. @item max_glyph_h
  2837. maximum glyph height, that is the maximum height for all the glyphs
  2838. contained in the rendered text, it is equivalent to @var{ascent} -
  2839. @var{descent}.
  2840. @item max_glyph_w
  2841. maximum glyph width, that is the maximum width for all the glyphs
  2842. contained in the rendered text
  2843. @item n
  2844. the number of input frame, starting from 0
  2845. @item rand(min, max)
  2846. return a random number included between @var{min} and @var{max}
  2847. @item sar
  2848. input sample aspect ratio
  2849. @item t
  2850. timestamp expressed in seconds, NAN if the input timestamp is unknown
  2851. @item text_h, th
  2852. the height of the rendered text
  2853. @item text_w, tw
  2854. the width of the rendered text
  2855. @item x
  2856. @item y
  2857. the x and y offset coordinates where the text is drawn.
  2858. These parameters allow the @var{x} and @var{y} expressions to refer
  2859. each other, so you can for example specify @code{y=x/dar}.
  2860. @end table
  2861. If libavfilter was built with @code{--enable-fontconfig}, then
  2862. @option{fontfile} can be a fontconfig pattern or omitted.
  2863. @anchor{drawtext_expansion}
  2864. @subsection Text expansion
  2865. If @option{expansion} is set to @code{strftime},
  2866. the filter recognizes strftime() sequences in the provided text and
  2867. expands them accordingly. Check the documentation of strftime(). This
  2868. feature is deprecated.
  2869. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  2870. If @option{expansion} is set to @code{normal} (which is the default),
  2871. the following expansion mechanism is used.
  2872. The backslash character '\', followed by any character, always expands to
  2873. the second character.
  2874. Sequence of the form @code{%@{...@}} are expanded. The text between the
  2875. braces is a function name, possibly followed by arguments separated by ':'.
  2876. If the arguments contain special characters or delimiters (':' or '@}'),
  2877. they should be escaped.
  2878. Note that they probably must also be escaped as the value for the
  2879. @option{text} option in the filter argument string and as the filter
  2880. argument in the filtergraph description, and possibly also for the shell,
  2881. that makes up to four levels of escaping; using a text file avoids these
  2882. problems.
  2883. The following functions are available:
  2884. @table @command
  2885. @item expr, e
  2886. The expression evaluation result.
  2887. It must take one argument specifying the expression to be evaluated,
  2888. which accepts the same constants and functions as the @var{x} and
  2889. @var{y} values. Note that not all constants should be used, for
  2890. example the text size is not known when evaluating the expression, so
  2891. the constants @var{text_w} and @var{text_h} will have an undefined
  2892. value.
  2893. @item gmtime
  2894. The time at which the filter is running, expressed in UTC.
  2895. It can accept an argument: a strftime() format string.
  2896. @item localtime
  2897. The time at which the filter is running, expressed in the local time zone.
  2898. It can accept an argument: a strftime() format string.
  2899. @item metadata
  2900. Frame metadata. It must take one argument specifying metadata key.
  2901. @item n, frame_num
  2902. The frame number, starting from 0.
  2903. @item pict_type
  2904. A 1 character description of the current picture type.
  2905. @item pts
  2906. The timestamp of the current frame, in seconds, with microsecond accuracy.
  2907. @end table
  2908. @subsection Examples
  2909. @itemize
  2910. @item
  2911. Draw "Test Text" with font FreeSerif, using the default values for the
  2912. optional parameters.
  2913. @example
  2914. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  2915. @end example
  2916. @item
  2917. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  2918. and y=50 (counting from the top-left corner of the screen), text is
  2919. yellow with a red box around it. Both the text and the box have an
  2920. opacity of 20%.
  2921. @example
  2922. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  2923. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  2924. @end example
  2925. Note that the double quotes are not necessary if spaces are not used
  2926. within the parameter list.
  2927. @item
  2928. Show the text at the center of the video frame:
  2929. @example
  2930. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
  2931. @end example
  2932. @item
  2933. Show a text line sliding from right to left in the last row of the video
  2934. frame. The file @file{LONG_LINE} is assumed to contain a single line
  2935. with no newlines.
  2936. @example
  2937. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  2938. @end example
  2939. @item
  2940. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  2941. @example
  2942. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  2943. @end example
  2944. @item
  2945. Draw a single green letter "g", at the center of the input video.
  2946. The glyph baseline is placed at half screen height.
  2947. @example
  2948. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  2949. @end example
  2950. @item
  2951. Show text for 1 second every 3 seconds:
  2952. @example
  2953. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  2954. @end example
  2955. @item
  2956. Use fontconfig to set the font. Note that the colons need to be escaped.
  2957. @example
  2958. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  2959. @end example
  2960. @item
  2961. Print the date of a real-time encoding (see strftime(3)):
  2962. @example
  2963. drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
  2964. @end example
  2965. @end itemize
  2966. For more information about libfreetype, check:
  2967. @url{http://www.freetype.org/}.
  2968. For more information about fontconfig, check:
  2969. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  2970. @section edgedetect
  2971. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  2972. The filter accepts the following options:
  2973. @table @option
  2974. @item low
  2975. @item high
  2976. Set low and high threshold values used by the Canny thresholding
  2977. algorithm.
  2978. The high threshold selects the "strong" edge pixels, which are then
  2979. connected through 8-connectivity with the "weak" edge pixels selected
  2980. by the low threshold.
  2981. @var{low} and @var{high} threshold values must be choosen in the range
  2982. [0,1], and @var{low} should be lesser or equal to @var{high}.
  2983. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  2984. is @code{50/255}.
  2985. @end table
  2986. Example:
  2987. @example
  2988. edgedetect=low=0.1:high=0.4
  2989. @end example
  2990. @section extractplanes
  2991. Extract color channel components from input video stream into
  2992. separate grayscale video streams.
  2993. The filter accepts the following option:
  2994. @table @option
  2995. @item planes
  2996. Set plane(s) to extract.
  2997. Available values for planes are:
  2998. @table @samp
  2999. @item y
  3000. @item u
  3001. @item v
  3002. @item a
  3003. @item r
  3004. @item g
  3005. @item b
  3006. @end table
  3007. Choosing planes not available in the input will result in an error.
  3008. That means you cannot select @code{r}, @code{g}, @code{b} planes
  3009. with @code{y}, @code{u}, @code{v} planes at same time.
  3010. @end table
  3011. @subsection Examples
  3012. @itemize
  3013. @item
  3014. Extract luma, u and v color channel component from input video frame
  3015. into 3 grayscale outputs:
  3016. @example
  3017. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  3018. @end example
  3019. @end itemize
  3020. @section elbg
  3021. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  3022. For each input image, the filter will compute the optimal mapping from
  3023. the input to the output given the codebook length, that is the number
  3024. of distinct output colors.
  3025. This filter accepts the following options.
  3026. @table @option
  3027. @item codebook_length, l
  3028. Set codebook length. The value must be a positive integer, and
  3029. represents the number of distinct output colors. Default value is 256.
  3030. @item nb_steps, n
  3031. Set the maximum number of iterations to apply for computing the optimal
  3032. mapping. The higher the value the better the result and the higher the
  3033. computation time. Default value is 1.
  3034. @item seed, s
  3035. Set a random seed, must be an integer included between 0 and
  3036. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  3037. will try to use a good random seed on a best effort basis.
  3038. @end table
  3039. @section fade
  3040. Apply fade-in/out effect to input video.
  3041. This filter accepts the following options:
  3042. @table @option
  3043. @item type, t
  3044. The effect type -- can be either "in" for fade-in, or "out" for a fade-out
  3045. effect.
  3046. Default is @code{in}.
  3047. @item start_frame, s
  3048. Specify the number of the start frame for starting to apply the fade
  3049. effect. Default is 0.
  3050. @item nb_frames, n
  3051. The number of frames for which the fade effect has to last. At the end of the
  3052. fade-in effect the output video will have the same intensity as the input video,
  3053. at the end of the fade-out transition the output video will be filled with the
  3054. selected @option{color}.
  3055. Default is 25.
  3056. @item alpha
  3057. If set to 1, fade only alpha channel, if one exists on the input.
  3058. Default value is 0.
  3059. @item start_time, st
  3060. Specify the timestamp (in seconds) of the frame to start to apply the fade
  3061. effect. If both start_frame and start_time are specified, the fade will start at
  3062. whichever comes last. Default is 0.
  3063. @item duration, d
  3064. The number of seconds for which the fade effect has to last. At the end of the
  3065. fade-in effect the output video will have the same intensity as the input video,
  3066. at the end of the fade-out transition the output video will be filled with the
  3067. selected @option{color}.
  3068. If both duration and nb_frames are specified, duration is used. Default is 0.
  3069. @item color, c
  3070. Specify the color of the fade. Default is "black".
  3071. @end table
  3072. @subsection Examples
  3073. @itemize
  3074. @item
  3075. Fade in first 30 frames of video:
  3076. @example
  3077. fade=in:0:30
  3078. @end example
  3079. The command above is equivalent to:
  3080. @example
  3081. fade=t=in:s=0:n=30
  3082. @end example
  3083. @item
  3084. Fade out last 45 frames of a 200-frame video:
  3085. @example
  3086. fade=out:155:45
  3087. fade=type=out:start_frame=155:nb_frames=45
  3088. @end example
  3089. @item
  3090. Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
  3091. @example
  3092. fade=in:0:25, fade=out:975:25
  3093. @end example
  3094. @item
  3095. Make first 5 frames yellow, then fade in from frame 5-24:
  3096. @example
  3097. fade=in:5:20:color=yellow
  3098. @end example
  3099. @item
  3100. Fade in alpha over first 25 frames of video:
  3101. @example
  3102. fade=in:0:25:alpha=1
  3103. @end example
  3104. @item
  3105. Make first 5.5 seconds black, then fade in for 0.5 seconds:
  3106. @example
  3107. fade=t=in:st=5.5:d=0.5
  3108. @end example
  3109. @end itemize
  3110. @section field
  3111. Extract a single field from an interlaced image using stride
  3112. arithmetic to avoid wasting CPU time. The output frames are marked as
  3113. non-interlaced.
  3114. The filter accepts the following options:
  3115. @table @option
  3116. @item type
  3117. Specify whether to extract the top (if the value is @code{0} or
  3118. @code{top}) or the bottom field (if the value is @code{1} or
  3119. @code{bottom}).
  3120. @end table
  3121. @section fieldmatch
  3122. Field matching filter for inverse telecine. It is meant to reconstruct the
  3123. progressive frames from a telecined stream. The filter does not drop duplicated
  3124. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  3125. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  3126. The separation of the field matching and the decimation is notably motivated by
  3127. the possibility of inserting a de-interlacing filter fallback between the two.
  3128. If the source has mixed telecined and real interlaced content,
  3129. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  3130. But these remaining combed frames will be marked as interlaced, and thus can be
  3131. de-interlaced by a later filter such as @ref{yadif} before decimation.
  3132. In addition to the various configuration options, @code{fieldmatch} can take an
  3133. optional second stream, activated through the @option{ppsrc} option. If
  3134. enabled, the frames reconstruction will be based on the fields and frames from
  3135. this second stream. This allows the first input to be pre-processed in order to
  3136. help the various algorithms of the filter, while keeping the output lossless
  3137. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  3138. or brightness/contrast adjustments can help.
  3139. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  3140. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  3141. which @code{fieldmatch} is based on. While the semantic and usage are very
  3142. close, some behaviour and options names can differ.
  3143. The filter accepts the following options:
  3144. @table @option
  3145. @item order
  3146. Specify the assumed field order of the input stream. Available values are:
  3147. @table @samp
  3148. @item auto
  3149. Auto detect parity (use FFmpeg's internal parity value).
  3150. @item bff
  3151. Assume bottom field first.
  3152. @item tff
  3153. Assume top field first.
  3154. @end table
  3155. Note that it is sometimes recommended not to trust the parity announced by the
  3156. stream.
  3157. Default value is @var{auto}.
  3158. @item mode
  3159. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  3160. sense that it won't risk creating jerkiness due to duplicate frames when
  3161. possible, but if there are bad edits or blended fields it will end up
  3162. outputting combed frames when a good match might actually exist. On the other
  3163. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  3164. but will almost always find a good frame if there is one. The other values are
  3165. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  3166. jerkiness and creating duplicate frames versus finding good matches in sections
  3167. with bad edits, orphaned fields, blended fields, etc.
  3168. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  3169. Available values are:
  3170. @table @samp
  3171. @item pc
  3172. 2-way matching (p/c)
  3173. @item pc_n
  3174. 2-way matching, and trying 3rd match if still combed (p/c + n)
  3175. @item pc_u
  3176. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  3177. @item pc_n_ub
  3178. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  3179. still combed (p/c + n + u/b)
  3180. @item pcn
  3181. 3-way matching (p/c/n)
  3182. @item pcn_ub
  3183. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  3184. detected as combed (p/c/n + u/b)
  3185. @end table
  3186. The parenthesis at the end indicate the matches that would be used for that
  3187. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  3188. @var{top}).
  3189. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  3190. the slowest.
  3191. Default value is @var{pc_n}.
  3192. @item ppsrc
  3193. Mark the main input stream as a pre-processed input, and enable the secondary
  3194. input stream as the clean source to pick the fields from. See the filter
  3195. introduction for more details. It is similar to the @option{clip2} feature from
  3196. VFM/TFM.
  3197. Default value is @code{0} (disabled).
  3198. @item field
  3199. Set the field to match from. It is recommended to set this to the same value as
  3200. @option{order} unless you experience matching failures with that setting. In
  3201. certain circumstances changing the field that is used to match from can have a
  3202. large impact on matching performance. Available values are:
  3203. @table @samp
  3204. @item auto
  3205. Automatic (same value as @option{order}).
  3206. @item bottom
  3207. Match from the bottom field.
  3208. @item top
  3209. Match from the top field.
  3210. @end table
  3211. Default value is @var{auto}.
  3212. @item mchroma
  3213. Set whether or not chroma is included during the match comparisons. In most
  3214. cases it is recommended to leave this enabled. You should set this to @code{0}
  3215. only if your clip has bad chroma problems such as heavy rainbowing or other
  3216. artifacts. Setting this to @code{0} could also be used to speed things up at
  3217. the cost of some accuracy.
  3218. Default value is @code{1}.
  3219. @item y0
  3220. @item y1
  3221. These define an exclusion band which excludes the lines between @option{y0} and
  3222. @option{y1} from being included in the field matching decision. An exclusion
  3223. band can be used to ignore subtitles, a logo, or other things that may
  3224. interfere with the matching. @option{y0} sets the starting scan line and
  3225. @option{y1} sets the ending line; all lines in between @option{y0} and
  3226. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  3227. @option{y0} and @option{y1} to the same value will disable the feature.
  3228. @option{y0} and @option{y1} defaults to @code{0}.
  3229. @item scthresh
  3230. Set the scene change detection threshold as a percentage of maximum change on
  3231. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  3232. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  3233. @option{scthresh} is @code{[0.0, 100.0]}.
  3234. Default value is @code{12.0}.
  3235. @item combmatch
  3236. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  3237. account the combed scores of matches when deciding what match to use as the
  3238. final match. Available values are:
  3239. @table @samp
  3240. @item none
  3241. No final matching based on combed scores.
  3242. @item sc
  3243. Combed scores are only used when a scene change is detected.
  3244. @item full
  3245. Use combed scores all the time.
  3246. @end table
  3247. Default is @var{sc}.
  3248. @item combdbg
  3249. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  3250. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  3251. Available values are:
  3252. @table @samp
  3253. @item none
  3254. No forced calculation.
  3255. @item pcn
  3256. Force p/c/n calculations.
  3257. @item pcnub
  3258. Force p/c/n/u/b calculations.
  3259. @end table
  3260. Default value is @var{none}.
  3261. @item cthresh
  3262. This is the area combing threshold used for combed frame detection. This
  3263. essentially controls how "strong" or "visible" combing must be to be detected.
  3264. Larger values mean combing must be more visible and smaller values mean combing
  3265. can be less visible or strong and still be detected. Valid settings are from
  3266. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  3267. be detected as combed). This is basically a pixel difference value. A good
  3268. range is @code{[8, 12]}.
  3269. Default value is @code{9}.
  3270. @item chroma
  3271. Sets whether or not chroma is considered in the combed frame decision. Only
  3272. disable this if your source has chroma problems (rainbowing, etc.) that are
  3273. causing problems for the combed frame detection with chroma enabled. Actually,
  3274. using @option{chroma}=@var{0} is usually more reliable, except for the case
  3275. where there is chroma only combing in the source.
  3276. Default value is @code{0}.
  3277. @item blockx
  3278. @item blocky
  3279. Respectively set the x-axis and y-axis size of the window used during combed
  3280. frame detection. This has to do with the size of the area in which
  3281. @option{combpel} pixels are required to be detected as combed for a frame to be
  3282. declared combed. See the @option{combpel} parameter description for more info.
  3283. Possible values are any number that is a power of 2 starting at 4 and going up
  3284. to 512.
  3285. Default value is @code{16}.
  3286. @item combpel
  3287. The number of combed pixels inside any of the @option{blocky} by
  3288. @option{blockx} size blocks on the frame for the frame to be detected as
  3289. combed. While @option{cthresh} controls how "visible" the combing must be, this
  3290. setting controls "how much" combing there must be in any localized area (a
  3291. window defined by the @option{blockx} and @option{blocky} settings) on the
  3292. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  3293. which point no frames will ever be detected as combed). This setting is known
  3294. as @option{MI} in TFM/VFM vocabulary.
  3295. Default value is @code{80}.
  3296. @end table
  3297. @anchor{p/c/n/u/b meaning}
  3298. @subsection p/c/n/u/b meaning
  3299. @subsubsection p/c/n
  3300. We assume the following telecined stream:
  3301. @example
  3302. Top fields: 1 2 2 3 4
  3303. Bottom fields: 1 2 3 4 4
  3304. @end example
  3305. The numbers correspond to the progressive frame the fields relate to. Here, the
  3306. first two frames are progressive, the 3rd and 4th are combed, and so on.
  3307. When @code{fieldmatch} is configured to run a matching from bottom
  3308. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  3309. @example
  3310. Input stream:
  3311. T 1 2 2 3 4
  3312. B 1 2 3 4 4 <-- matching reference
  3313. Matches: c c n n c
  3314. Output stream:
  3315. T 1 2 3 4 4
  3316. B 1 2 3 4 4
  3317. @end example
  3318. As a result of the field matching, we can see that some frames get duplicated.
  3319. To perform a complete inverse telecine, you need to rely on a decimation filter
  3320. after this operation. See for instance the @ref{decimate} filter.
  3321. The same operation now matching from top fields (@option{field}=@var{top})
  3322. looks like this:
  3323. @example
  3324. Input stream:
  3325. T 1 2 2 3 4 <-- matching reference
  3326. B 1 2 3 4 4
  3327. Matches: c c p p c
  3328. Output stream:
  3329. T 1 2 2 3 4
  3330. B 1 2 2 3 4
  3331. @end example
  3332. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  3333. basically, they refer to the frame and field of the opposite parity:
  3334. @itemize
  3335. @item @var{p} matches the field of the opposite parity in the previous frame
  3336. @item @var{c} matches the field of the opposite parity in the current frame
  3337. @item @var{n} matches the field of the opposite parity in the next frame
  3338. @end itemize
  3339. @subsubsection u/b
  3340. The @var{u} and @var{b} matching are a bit special in the sense that they match
  3341. from the opposite parity flag. In the following examples, we assume that we are
  3342. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  3343. 'x' is placed above and below each matched fields.
  3344. With bottom matching (@option{field}=@var{bottom}):
  3345. @example
  3346. Match: c p n b u
  3347. x x x x x
  3348. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3349. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3350. x x x x x
  3351. Output frames:
  3352. 2 1 2 2 2
  3353. 2 2 2 1 3
  3354. @end example
  3355. With top matching (@option{field}=@var{top}):
  3356. @example
  3357. Match: c p n b u
  3358. x x x x x
  3359. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3360. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3361. x x x x x
  3362. Output frames:
  3363. 2 2 2 1 2
  3364. 2 1 3 2 2
  3365. @end example
  3366. @subsection Examples
  3367. Simple IVTC of a top field first telecined stream:
  3368. @example
  3369. fieldmatch=order=tff:combmatch=none, decimate
  3370. @end example
  3371. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  3372. @example
  3373. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  3374. @end example
  3375. @section fieldorder
  3376. Transform the field order of the input video.
  3377. This filter accepts the following options:
  3378. @table @option
  3379. @item order
  3380. Output field order. Valid values are @var{tff} for top field first or @var{bff}
  3381. for bottom field first.
  3382. @end table
  3383. Default value is @samp{tff}.
  3384. Transformation is achieved by shifting the picture content up or down
  3385. by one line, and filling the remaining line with appropriate picture content.
  3386. This method is consistent with most broadcast field order converters.
  3387. If the input video is not flagged as being interlaced, or it is already
  3388. flagged as being of the required output field order then this filter does
  3389. not alter the incoming video.
  3390. This filter is very useful when converting to or from PAL DV material,
  3391. which is bottom field first.
  3392. For example:
  3393. @example
  3394. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  3395. @end example
  3396. @section fifo
  3397. Buffer input images and send them when they are requested.
  3398. This filter is mainly useful when auto-inserted by the libavfilter
  3399. framework.
  3400. The filter does not take parameters.
  3401. @anchor{format}
  3402. @section format
  3403. Convert the input video to one of the specified pixel formats.
  3404. Libavfilter will try to pick one that is supported for the input to
  3405. the next filter.
  3406. This filter accepts the following parameters:
  3407. @table @option
  3408. @item pix_fmts
  3409. A '|'-separated list of pixel format names, for example
  3410. "pix_fmts=yuv420p|monow|rgb24".
  3411. @end table
  3412. @subsection Examples
  3413. @itemize
  3414. @item
  3415. Convert the input video to the format @var{yuv420p}
  3416. @example
  3417. format=pix_fmts=yuv420p
  3418. @end example
  3419. Convert the input video to any of the formats in the list
  3420. @example
  3421. format=pix_fmts=yuv420p|yuv444p|yuv410p
  3422. @end example
  3423. @end itemize
  3424. @anchor{fps}
  3425. @section fps
  3426. Convert the video to specified constant frame rate by duplicating or dropping
  3427. frames as necessary.
  3428. This filter accepts the following named parameters:
  3429. @table @option
  3430. @item fps
  3431. Desired output frame rate. The default is @code{25}.
  3432. @item round
  3433. Rounding method.
  3434. Possible values are:
  3435. @table @option
  3436. @item zero
  3437. zero round towards 0
  3438. @item inf
  3439. round away from 0
  3440. @item down
  3441. round towards -infinity
  3442. @item up
  3443. round towards +infinity
  3444. @item near
  3445. round to nearest
  3446. @end table
  3447. The default is @code{near}.
  3448. @item start_time
  3449. Assume the first PTS should be the given value, in seconds. This allows for
  3450. padding/trimming at the start of stream. By default, no assumption is made
  3451. about the first frame's expected PTS, so no padding or trimming is done.
  3452. For example, this could be set to 0 to pad the beginning with duplicates of
  3453. the first frame if a video stream starts after the audio stream or to trim any
  3454. frames with a negative PTS.
  3455. @end table
  3456. Alternatively, the options can be specified as a flat string:
  3457. @var{fps}[:@var{round}].
  3458. See also the @ref{setpts} filter.
  3459. @subsection Examples
  3460. @itemize
  3461. @item
  3462. A typical usage in order to set the fps to 25:
  3463. @example
  3464. fps=fps=25
  3465. @end example
  3466. @item
  3467. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  3468. @example
  3469. fps=fps=film:round=near
  3470. @end example
  3471. @end itemize
  3472. @section framepack
  3473. Pack two different video streams into a stereoscopic video, setting proper
  3474. metadata on supported codecs. The two views should have the same size and
  3475. framerate and processing will stop when the shorter video ends. Please note
  3476. that you may conveniently adjust view properties with the @ref{scale} and
  3477. @ref{fps} filters.
  3478. This filter accepts the following named parameters:
  3479. @table @option
  3480. @item format
  3481. Desired packing format. Supported values are:
  3482. @table @option
  3483. @item sbs
  3484. Views are next to each other (default).
  3485. @item tab
  3486. Views are on top of each other.
  3487. @item lines
  3488. Views are packed by line.
  3489. @item columns
  3490. Views are eacked by column.
  3491. @item frameseq
  3492. Views are temporally interleaved.
  3493. @end table
  3494. @end table
  3495. Some examples follow:
  3496. @example
  3497. # Convert left and right views into a frame sequential video.
  3498. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  3499. # Convert views into a side-by-side video with the same output resolution as the input.
  3500. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  3501. @end example
  3502. @section framestep
  3503. Select one frame every N-th frame.
  3504. This filter accepts the following option:
  3505. @table @option
  3506. @item step
  3507. Select frame after every @code{step} frames.
  3508. Allowed values are positive integers higher than 0. Default value is @code{1}.
  3509. @end table
  3510. @anchor{frei0r}
  3511. @section frei0r
  3512. Apply a frei0r effect to the input video.
  3513. To enable compilation of this filter you need to install the frei0r
  3514. header and configure FFmpeg with @code{--enable-frei0r}.
  3515. This filter accepts the following options:
  3516. @table @option
  3517. @item filter_name
  3518. The name to the frei0r effect to load. If the environment variable
  3519. @env{FREI0R_PATH} is defined, the frei0r effect is searched in each one of the
  3520. directories specified by the colon separated list in @env{FREIOR_PATH},
  3521. otherwise in the standard frei0r paths, which are in this order:
  3522. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  3523. @file{/usr/lib/frei0r-1/}.
  3524. @item filter_params
  3525. A '|'-separated list of parameters to pass to the frei0r effect.
  3526. @end table
  3527. A frei0r effect parameter can be a boolean (whose values are specified
  3528. with "y" and "n"), a double, a color (specified by the syntax
  3529. @var{R}/@var{G}/@var{B}, (@var{R}, @var{G}, and @var{B} being float
  3530. numbers from 0.0 to 1.0) or by a color description specified in the "Color"
  3531. section in the ffmpeg-utils manual), a position (specified by the syntax @var{X}/@var{Y},
  3532. @var{X} and @var{Y} being float numbers) and a string.
  3533. The number and kind of parameters depend on the loaded effect. If an
  3534. effect parameter is not specified the default value is set.
  3535. @subsection Examples
  3536. @itemize
  3537. @item
  3538. Apply the distort0r effect, set the first two double parameters:
  3539. @example
  3540. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  3541. @end example
  3542. @item
  3543. Apply the colordistance effect, take a color as first parameter:
  3544. @example
  3545. frei0r=colordistance:0.2/0.3/0.4
  3546. frei0r=colordistance:violet
  3547. frei0r=colordistance:0x112233
  3548. @end example
  3549. @item
  3550. Apply the perspective effect, specify the top left and top right image
  3551. positions:
  3552. @example
  3553. frei0r=perspective:0.2/0.2|0.8/0.2
  3554. @end example
  3555. @end itemize
  3556. For more information see:
  3557. @url{http://frei0r.dyne.org}
  3558. @section geq
  3559. The filter accepts the following options:
  3560. @table @option
  3561. @item lum_expr, lum
  3562. Set the luminance expression.
  3563. @item cb_expr, cb
  3564. Set the chrominance blue expression.
  3565. @item cr_expr, cr
  3566. Set the chrominance red expression.
  3567. @item alpha_expr, a
  3568. Set the alpha expression.
  3569. @item red_expr, r
  3570. Set the red expression.
  3571. @item green_expr, g
  3572. Set the green expression.
  3573. @item blue_expr, b
  3574. Set the blue expression.
  3575. @end table
  3576. The colorspace is selected according to the specified options. If one
  3577. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  3578. options is specified, the filter will automatically select a YCbCr
  3579. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  3580. @option{blue_expr} options is specified, it will select an RGB
  3581. colorspace.
  3582. If one of the chrominance expression is not defined, it falls back on the other
  3583. one. If no alpha expression is specified it will evaluate to opaque value.
  3584. If none of chrominance expressions are specified, they will evaluate
  3585. to the luminance expression.
  3586. The expressions can use the following variables and functions:
  3587. @table @option
  3588. @item N
  3589. The sequential number of the filtered frame, starting from @code{0}.
  3590. @item X
  3591. @item Y
  3592. The coordinates of the current sample.
  3593. @item W
  3594. @item H
  3595. The width and height of the image.
  3596. @item SW
  3597. @item SH
  3598. Width and height scale depending on the currently filtered plane. It is the
  3599. ratio between the corresponding luma plane number of pixels and the current
  3600. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3601. @code{0.5,0.5} for chroma planes.
  3602. @item T
  3603. Time of the current frame, expressed in seconds.
  3604. @item p(x, y)
  3605. Return the value of the pixel at location (@var{x},@var{y}) of the current
  3606. plane.
  3607. @item lum(x, y)
  3608. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  3609. plane.
  3610. @item cb(x, y)
  3611. Return the value of the pixel at location (@var{x},@var{y}) of the
  3612. blue-difference chroma plane. Return 0 if there is no such plane.
  3613. @item cr(x, y)
  3614. Return the value of the pixel at location (@var{x},@var{y}) of the
  3615. red-difference chroma plane. Return 0 if there is no such plane.
  3616. @item r(x, y)
  3617. @item g(x, y)
  3618. @item b(x, y)
  3619. Return the value of the pixel at location (@var{x},@var{y}) of the
  3620. red/green/blue component. Return 0 if there is no such component.
  3621. @item alpha(x, y)
  3622. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  3623. plane. Return 0 if there is no such plane.
  3624. @end table
  3625. For functions, if @var{x} and @var{y} are outside the area, the value will be
  3626. automatically clipped to the closer edge.
  3627. @subsection Examples
  3628. @itemize
  3629. @item
  3630. Flip the image horizontally:
  3631. @example
  3632. geq=p(W-X\,Y)
  3633. @end example
  3634. @item
  3635. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  3636. wavelength of 100 pixels:
  3637. @example
  3638. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  3639. @end example
  3640. @item
  3641. Generate a fancy enigmatic moving light:
  3642. @example
  3643. nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
  3644. @end example
  3645. @item
  3646. Generate a quick emboss effect:
  3647. @example
  3648. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  3649. @end example
  3650. @item
  3651. Modify RGB components depending on pixel position:
  3652. @example
  3653. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  3654. @end example
  3655. @end itemize
  3656. @section gradfun
  3657. Fix the banding artifacts that are sometimes introduced into nearly flat
  3658. regions by truncation to 8bit color depth.
  3659. Interpolate the gradients that should go where the bands are, and
  3660. dither them.
  3661. This filter is designed for playback only. Do not use it prior to
  3662. lossy compression, because compression tends to lose the dither and
  3663. bring back the bands.
  3664. This filter accepts the following options:
  3665. @table @option
  3666. @item strength
  3667. The maximum amount by which the filter will change any one pixel. Also the
  3668. threshold for detecting nearly flat regions. Acceptable values range from .51 to
  3669. 64, default value is 1.2, out-of-range values will be clipped to the valid
  3670. range.
  3671. @item radius
  3672. The neighborhood to fit the gradient to. A larger radius makes for smoother
  3673. gradients, but also prevents the filter from modifying the pixels near detailed
  3674. regions. Acceptable values are 8-32, default value is 16, out-of-range values
  3675. will be clipped to the valid range.
  3676. @end table
  3677. Alternatively, the options can be specified as a flat string:
  3678. @var{strength}[:@var{radius}]
  3679. @subsection Examples
  3680. @itemize
  3681. @item
  3682. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  3683. @example
  3684. gradfun=3.5:8
  3685. @end example
  3686. @item
  3687. Specify radius, omitting the strength (which will fall-back to the default
  3688. value):
  3689. @example
  3690. gradfun=radius=8
  3691. @end example
  3692. @end itemize
  3693. @anchor{haldclut}
  3694. @section haldclut
  3695. Apply a Hald CLUT to a video stream.
  3696. First input is the video stream to process, and second one is the Hald CLUT.
  3697. The Hald CLUT input can be a simple picture or a complete video stream.
  3698. The filter accepts the following options:
  3699. @table @option
  3700. @item shortest
  3701. Force termination when the shortest input terminates. Default is @code{0}.
  3702. @item repeatlast
  3703. Continue applying the last CLUT after the end of the stream. A value of
  3704. @code{0} disable the filter after the last frame of the CLUT is reached.
  3705. Default is @code{1}.
  3706. @end table
  3707. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  3708. filters share the same internals).
  3709. More information about the Hald CLUT can be found on Eskil Steenberg's website
  3710. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  3711. @subsection Workflow examples
  3712. @subsubsection Hald CLUT video stream
  3713. Generate an identity Hald CLUT stream altered with various effects:
  3714. @example
  3715. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  3716. @end example
  3717. Note: make sure you use a lossless codec.
  3718. Then use it with @code{haldclut} to apply it on some random stream:
  3719. @example
  3720. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  3721. @end example
  3722. The Hald CLUT will be applied to the 10 first seconds (duration of
  3723. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  3724. to the remaining frames of the @code{mandelbrot} stream.
  3725. @subsubsection Hald CLUT with preview
  3726. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  3727. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  3728. biggest possible square starting at the top left of the picture. The remaining
  3729. padding pixels (bottom or right) will be ignored. This area can be used to add
  3730. a preview of the Hald CLUT.
  3731. Typically, the following generated Hald CLUT will be supported by the
  3732. @code{haldclut} filter:
  3733. @example
  3734. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  3735. pad=iw+320 [padded_clut];
  3736. smptebars=s=320x256, split [a][b];
  3737. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  3738. [main][b] overlay=W-320" -frames:v 1 clut.png
  3739. @end example
  3740. It contains the original and a preview of the effect of the CLUT: SMPTE color
  3741. bars are displayed on the right-top, and below the same color bars processed by
  3742. the color changes.
  3743. Then, the effect of this Hald CLUT can be visualized with:
  3744. @example
  3745. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  3746. @end example
  3747. @section hflip
  3748. Flip the input video horizontally.
  3749. For example to horizontally flip the input video with @command{ffmpeg}:
  3750. @example
  3751. ffmpeg -i in.avi -vf "hflip" out.avi
  3752. @end example
  3753. @section histeq
  3754. This filter applies a global color histogram equalization on a
  3755. per-frame basis.
  3756. It can be used to correct video that has a compressed range of pixel
  3757. intensities. The filter redistributes the pixel intensities to
  3758. equalize their distribution across the intensity range. It may be
  3759. viewed as an "automatically adjusting contrast filter". This filter is
  3760. useful only for correcting degraded or poorly captured source
  3761. video.
  3762. The filter accepts the following options:
  3763. @table @option
  3764. @item strength
  3765. Determine the amount of equalization to be applied. As the strength
  3766. is reduced, the distribution of pixel intensities more-and-more
  3767. approaches that of the input frame. The value must be a float number
  3768. in the range [0,1] and defaults to 0.200.
  3769. @item intensity
  3770. Set the maximum intensity that can generated and scale the output
  3771. values appropriately. The strength should be set as desired and then
  3772. the intensity can be limited if needed to avoid washing-out. The value
  3773. must be a float number in the range [0,1] and defaults to 0.210.
  3774. @item antibanding
  3775. Set the antibanding level. If enabled the filter will randomly vary
  3776. the luminance of output pixels by a small amount to avoid banding of
  3777. the histogram. Possible values are @code{none}, @code{weak} or
  3778. @code{strong}. It defaults to @code{none}.
  3779. @end table
  3780. @section histogram
  3781. Compute and draw a color distribution histogram for the input video.
  3782. The computed histogram is a representation of distribution of color components
  3783. in an image.
  3784. The filter accepts the following options:
  3785. @table @option
  3786. @item mode
  3787. Set histogram mode.
  3788. It accepts the following values:
  3789. @table @samp
  3790. @item levels
  3791. standard histogram that display color components distribution in an image.
  3792. Displays color graph for each color component. Shows distribution
  3793. of the Y, U, V, A or R, G, B components, depending on input format,
  3794. in current frame. Bellow each graph is color component scale meter.
  3795. @item color
  3796. chroma values in vectorscope, if brighter more such chroma values are
  3797. distributed in an image.
  3798. Displays chroma values (U/V color placement) in two dimensional graph
  3799. (which is called a vectorscope). It can be used to read of the hue and
  3800. saturation of the current frame. At a same time it is a histogram.
  3801. The whiter a pixel in the vectorscope, the more pixels of the input frame
  3802. correspond to that pixel (that is the more pixels have this chroma value).
  3803. The V component is displayed on the horizontal (X) axis, with the leftmost
  3804. side being V = 0 and the rightmost side being V = 255.
  3805. The U component is displayed on the vertical (Y) axis, with the top
  3806. representing U = 0 and the bottom representing U = 255.
  3807. The position of a white pixel in the graph corresponds to the chroma value
  3808. of a pixel of the input clip. So the graph can be used to read of the
  3809. hue (color flavor) and the saturation (the dominance of the hue in the color).
  3810. As the hue of a color changes, it moves around the square. At the center of
  3811. the square, the saturation is zero, which means that the corresponding pixel
  3812. has no color. If you increase the amount of a specific color, while leaving
  3813. the other colors unchanged, the saturation increases, and you move towards
  3814. the edge of the square.
  3815. @item color2
  3816. chroma values in vectorscope, similar as @code{color} but actual chroma values
  3817. are displayed.
  3818. @item waveform
  3819. per row/column color component graph. In row mode graph in the left side represents
  3820. color component value 0 and right side represents value = 255. In column mode top
  3821. side represents color component value = 0 and bottom side represents value = 255.
  3822. @end table
  3823. Default value is @code{levels}.
  3824. @item level_height
  3825. Set height of level in @code{levels}. Default value is @code{200}.
  3826. Allowed range is [50, 2048].
  3827. @item scale_height
  3828. Set height of color scale in @code{levels}. Default value is @code{12}.
  3829. Allowed range is [0, 40].
  3830. @item step
  3831. Set step for @code{waveform} mode. Smaller values are useful to find out how much
  3832. of same luminance values across input rows/columns are distributed.
  3833. Default value is @code{10}. Allowed range is [1, 255].
  3834. @item waveform_mode
  3835. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  3836. Default is @code{row}.
  3837. @item waveform_mirror
  3838. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  3839. means mirrored. In mirrored mode, higher values will be represented on the left
  3840. side for @code{row} mode and at the top for @code{column} mode. Default is
  3841. @code{0} (unmirrored).
  3842. @item display_mode
  3843. Set display mode for @code{waveform} and @code{levels}.
  3844. It accepts the following values:
  3845. @table @samp
  3846. @item parade
  3847. Display separate graph for the color components side by side in
  3848. @code{row} waveform mode or one below other in @code{column} waveform mode
  3849. for @code{waveform} histogram mode. For @code{levels} histogram mode
  3850. per color component graphs are placed one bellow other.
  3851. This display mode in @code{waveform} histogram mode makes it easy to spot
  3852. color casts in the highlights and shadows of an image, by comparing the
  3853. contours of the top and the bottom of each waveform.
  3854. Since whites, grays, and blacks are characterized by
  3855. exactly equal amounts of red, green, and blue, neutral areas of the
  3856. picture should display three waveforms of roughly equal width/height.
  3857. If not, the correction is easy to make by making adjustments to level the
  3858. three waveforms.
  3859. @item overlay
  3860. Presents information that's identical to that in the @code{parade}, except
  3861. that the graphs representing color components are superimposed directly
  3862. over one another.
  3863. This display mode in @code{waveform} histogram mode can make it easier to spot
  3864. the relative differences or similarities in overlapping areas of the color
  3865. components that are supposed to be identical, such as neutral whites, grays,
  3866. or blacks.
  3867. @end table
  3868. Default is @code{parade}.
  3869. @item levels_mode
  3870. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  3871. Default is @code{linear}.
  3872. @end table
  3873. @subsection Examples
  3874. @itemize
  3875. @item
  3876. Calculate and draw histogram:
  3877. @example
  3878. ffplay -i input -vf histogram
  3879. @end example
  3880. @end itemize
  3881. @anchor{hqdn3d}
  3882. @section hqdn3d
  3883. High precision/quality 3d denoise filter. This filter aims to reduce
  3884. image noise producing smooth images and making still images really
  3885. still. It should enhance compressibility.
  3886. It accepts the following optional parameters:
  3887. @table @option
  3888. @item luma_spatial
  3889. a non-negative float number which specifies spatial luma strength,
  3890. defaults to 4.0
  3891. @item chroma_spatial
  3892. a non-negative float number which specifies spatial chroma strength,
  3893. defaults to 3.0*@var{luma_spatial}/4.0
  3894. @item luma_tmp
  3895. a float number which specifies luma temporal strength, defaults to
  3896. 6.0*@var{luma_spatial}/4.0
  3897. @item chroma_tmp
  3898. a float number which specifies chroma temporal strength, defaults to
  3899. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
  3900. @end table
  3901. @section hue
  3902. Modify the hue and/or the saturation of the input.
  3903. This filter accepts the following options:
  3904. @table @option
  3905. @item h
  3906. Specify the hue angle as a number of degrees. It accepts an expression,
  3907. and defaults to "0".
  3908. @item s
  3909. Specify the saturation in the [-10,10] range. It accepts an expression and
  3910. defaults to "1".
  3911. @item H
  3912. Specify the hue angle as a number of radians. It accepts an
  3913. expression, and defaults to "0".
  3914. @item b
  3915. Specify the brightness in the [-10,10] range. It accepts an expression and
  3916. defaults to "0".
  3917. @end table
  3918. @option{h} and @option{H} are mutually exclusive, and can't be
  3919. specified at the same time.
  3920. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  3921. expressions containing the following constants:
  3922. @table @option
  3923. @item n
  3924. frame count of the input frame starting from 0
  3925. @item pts
  3926. presentation timestamp of the input frame expressed in time base units
  3927. @item r
  3928. frame rate of the input video, NAN if the input frame rate is unknown
  3929. @item t
  3930. timestamp expressed in seconds, NAN if the input timestamp is unknown
  3931. @item tb
  3932. time base of the input video
  3933. @end table
  3934. @subsection Examples
  3935. @itemize
  3936. @item
  3937. Set the hue to 90 degrees and the saturation to 1.0:
  3938. @example
  3939. hue=h=90:s=1
  3940. @end example
  3941. @item
  3942. Same command but expressing the hue in radians:
  3943. @example
  3944. hue=H=PI/2:s=1
  3945. @end example
  3946. @item
  3947. Rotate hue and make the saturation swing between 0
  3948. and 2 over a period of 1 second:
  3949. @example
  3950. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  3951. @end example
  3952. @item
  3953. Apply a 3 seconds saturation fade-in effect starting at 0:
  3954. @example
  3955. hue="s=min(t/3\,1)"
  3956. @end example
  3957. The general fade-in expression can be written as:
  3958. @example
  3959. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  3960. @end example
  3961. @item
  3962. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  3963. @example
  3964. hue="s=max(0\, min(1\, (8-t)/3))"
  3965. @end example
  3966. The general fade-out expression can be written as:
  3967. @example
  3968. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  3969. @end example
  3970. @end itemize
  3971. @subsection Commands
  3972. This filter supports the following commands:
  3973. @table @option
  3974. @item b
  3975. @item s
  3976. @item h
  3977. @item H
  3978. Modify the hue and/or the saturation and/or brightness of the input video.
  3979. The command accepts the same syntax of the corresponding option.
  3980. If the specified expression is not valid, it is kept at its current
  3981. value.
  3982. @end table
  3983. @section idet
  3984. Detect video interlacing type.
  3985. This filter tries to detect if the input is interlaced or progressive,
  3986. top or bottom field first.
  3987. The filter accepts the following options:
  3988. @table @option
  3989. @item intl_thres
  3990. Set interlacing threshold.
  3991. @item prog_thres
  3992. Set progressive threshold.
  3993. @end table
  3994. @section il
  3995. Deinterleave or interleave fields.
  3996. This filter allows to process interlaced images fields without
  3997. deinterlacing them. Deinterleaving splits the input frame into 2
  3998. fields (so called half pictures). Odd lines are moved to the top
  3999. half of the output image, even lines to the bottom half.
  4000. You can process (filter) them independently and then re-interleave them.
  4001. The filter accepts the following options:
  4002. @table @option
  4003. @item luma_mode, l
  4004. @item chroma_mode, c
  4005. @item alpha_mode, a
  4006. Available values for @var{luma_mode}, @var{chroma_mode} and
  4007. @var{alpha_mode} are:
  4008. @table @samp
  4009. @item none
  4010. Do nothing.
  4011. @item deinterleave, d
  4012. Deinterleave fields, placing one above the other.
  4013. @item interleave, i
  4014. Interleave fields. Reverse the effect of deinterleaving.
  4015. @end table
  4016. Default value is @code{none}.
  4017. @item luma_swap, ls
  4018. @item chroma_swap, cs
  4019. @item alpha_swap, as
  4020. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  4021. @end table
  4022. @section interlace
  4023. Simple interlacing filter from progressive contents. This interleaves upper (or
  4024. lower) lines from odd frames with lower (or upper) lines from even frames,
  4025. halving the frame rate and preserving image height.
  4026. @example
  4027. Original Original New Frame
  4028. Frame 'j' Frame 'j+1' (tff)
  4029. ========== =========== ==================
  4030. Line 0 --------------------> Frame 'j' Line 0
  4031. Line 1 Line 1 ----> Frame 'j+1' Line 1
  4032. Line 2 ---------------------> Frame 'j' Line 2
  4033. Line 3 Line 3 ----> Frame 'j+1' Line 3
  4034. ... ... ...
  4035. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  4036. @end example
  4037. It accepts the following optional parameters:
  4038. @table @option
  4039. @item scan
  4040. determines whether the interlaced frame is taken from the even (tff - default)
  4041. or odd (bff) lines of the progressive frame.
  4042. @item lowpass
  4043. Enable (default) or disable the vertical lowpass filter to avoid twitter
  4044. interlacing and reduce moire patterns.
  4045. @end table
  4046. @section kerndeint
  4047. Deinterlace input video by applying Donald Graft's adaptive kernel
  4048. deinterling. Work on interlaced parts of a video to produce
  4049. progressive frames.
  4050. The description of the accepted parameters follows.
  4051. @table @option
  4052. @item thresh
  4053. Set the threshold which affects the filter's tolerance when
  4054. determining if a pixel line must be processed. It must be an integer
  4055. in the range [0,255] and defaults to 10. A value of 0 will result in
  4056. applying the process on every pixels.
  4057. @item map
  4058. Paint pixels exceeding the threshold value to white if set to 1.
  4059. Default is 0.
  4060. @item order
  4061. Set the fields order. Swap fields if set to 1, leave fields alone if
  4062. 0. Default is 0.
  4063. @item sharp
  4064. Enable additional sharpening if set to 1. Default is 0.
  4065. @item twoway
  4066. Enable twoway sharpening if set to 1. Default is 0.
  4067. @end table
  4068. @subsection Examples
  4069. @itemize
  4070. @item
  4071. Apply default values:
  4072. @example
  4073. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  4074. @end example
  4075. @item
  4076. Enable additional sharpening:
  4077. @example
  4078. kerndeint=sharp=1
  4079. @end example
  4080. @item
  4081. Paint processed pixels in white:
  4082. @example
  4083. kerndeint=map=1
  4084. @end example
  4085. @end itemize
  4086. @anchor{lut3d}
  4087. @section lut3d
  4088. Apply a 3D LUT to an input video.
  4089. The filter accepts the following options:
  4090. @table @option
  4091. @item file
  4092. Set the 3D LUT file name.
  4093. Currently supported formats:
  4094. @table @samp
  4095. @item 3dl
  4096. AfterEffects
  4097. @item cube
  4098. Iridas
  4099. @item dat
  4100. DaVinci
  4101. @item m3d
  4102. Pandora
  4103. @end table
  4104. @item interp
  4105. Select interpolation mode.
  4106. Available values are:
  4107. @table @samp
  4108. @item nearest
  4109. Use values from the nearest defined point.
  4110. @item trilinear
  4111. Interpolate values using the 8 points defining a cube.
  4112. @item tetrahedral
  4113. Interpolate values using a tetrahedron.
  4114. @end table
  4115. @end table
  4116. @section lut, lutrgb, lutyuv
  4117. Compute a look-up table for binding each pixel component input value
  4118. to an output value, and apply it to input video.
  4119. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  4120. to an RGB input video.
  4121. These filters accept the following options:
  4122. @table @option
  4123. @item c0
  4124. set first pixel component expression
  4125. @item c1
  4126. set second pixel component expression
  4127. @item c2
  4128. set third pixel component expression
  4129. @item c3
  4130. set fourth pixel component expression, corresponds to the alpha component
  4131. @item r
  4132. set red component expression
  4133. @item g
  4134. set green component expression
  4135. @item b
  4136. set blue component expression
  4137. @item a
  4138. alpha component expression
  4139. @item y
  4140. set Y/luminance component expression
  4141. @item u
  4142. set U/Cb component expression
  4143. @item v
  4144. set V/Cr component expression
  4145. @end table
  4146. Each of them specifies the expression to use for computing the lookup table for
  4147. the corresponding pixel component values.
  4148. The exact component associated to each of the @var{c*} options depends on the
  4149. format in input.
  4150. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  4151. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  4152. The expressions can contain the following constants and functions:
  4153. @table @option
  4154. @item w
  4155. @item h
  4156. the input width and height
  4157. @item val
  4158. input value for the pixel component
  4159. @item clipval
  4160. the input value clipped in the @var{minval}-@var{maxval} range
  4161. @item maxval
  4162. maximum value for the pixel component
  4163. @item minval
  4164. minimum value for the pixel component
  4165. @item negval
  4166. the negated value for the pixel component value clipped in the
  4167. @var{minval}-@var{maxval} range , it corresponds to the expression
  4168. "maxval-clipval+minval"
  4169. @item clip(val)
  4170. the computed value in @var{val} clipped in the
  4171. @var{minval}-@var{maxval} range
  4172. @item gammaval(gamma)
  4173. the computed gamma correction value of the pixel component value
  4174. clipped in the @var{minval}-@var{maxval} range, corresponds to the
  4175. expression
  4176. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  4177. @end table
  4178. All expressions default to "val".
  4179. @subsection Examples
  4180. @itemize
  4181. @item
  4182. Negate input video:
  4183. @example
  4184. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  4185. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  4186. @end example
  4187. The above is the same as:
  4188. @example
  4189. lutrgb="r=negval:g=negval:b=negval"
  4190. lutyuv="y=negval:u=negval:v=negval"
  4191. @end example
  4192. @item
  4193. Negate luminance:
  4194. @example
  4195. lutyuv=y=negval
  4196. @end example
  4197. @item
  4198. Remove chroma components, turns the video into a graytone image:
  4199. @example
  4200. lutyuv="u=128:v=128"
  4201. @end example
  4202. @item
  4203. Apply a luma burning effect:
  4204. @example
  4205. lutyuv="y=2*val"
  4206. @end example
  4207. @item
  4208. Remove green and blue components:
  4209. @example
  4210. lutrgb="g=0:b=0"
  4211. @end example
  4212. @item
  4213. Set a constant alpha channel value on input:
  4214. @example
  4215. format=rgba,lutrgb=a="maxval-minval/2"
  4216. @end example
  4217. @item
  4218. Correct luminance gamma by a 0.5 factor:
  4219. @example
  4220. lutyuv=y=gammaval(0.5)
  4221. @end example
  4222. @item
  4223. Discard least significant bits of luma:
  4224. @example
  4225. lutyuv=y='bitand(val, 128+64+32)'
  4226. @end example
  4227. @end itemize
  4228. @section mergeplanes
  4229. Merge color channel components from several video streams.
  4230. The filter accepts up to 4 input streams, and merge selected input
  4231. planes to the output video.
  4232. This filter accepts the following options:
  4233. @table @option
  4234. @item mapping
  4235. Set input to output plane mapping. Default is @code{0}.
  4236. The mappings is specified as a bitmap. It should be specified as a
  4237. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  4238. mapping for the first plane of the output stream. 'A' sets the number of
  4239. the input stream to use (from 0 to 3), and 'a' the plane number of the
  4240. corresponding input to use (from 0 to 3). The rest of the mappings is
  4241. similar, 'Bb' describes the mapping for the output stream second
  4242. plane, 'Cc' describes the mapping for the output stream third plane and
  4243. 'Dd' describes the mapping for the output stream fourth plane.
  4244. @item format
  4245. Set output pixel format. Default is @code{yuva444p}.
  4246. @end table
  4247. @subsection Examples
  4248. @itemize
  4249. @item
  4250. Merge three gray video streams of same width and height into single video stream:
  4251. @example
  4252. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  4253. @end example
  4254. @item
  4255. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  4256. @example
  4257. [a0][a1]mergeplanes=0x00010210:yuva444p
  4258. @end example
  4259. @item
  4260. Swap Y and A plane in yuva444p stream:
  4261. @example
  4262. format=yuva444p,mergeplanes=0x03010200:yuva444p
  4263. @end example
  4264. @item
  4265. Swap U and V plane in yuv420p stream:
  4266. @example
  4267. format=yuv420p,mergeplanes=0x000201:yuv420p
  4268. @end example
  4269. @item
  4270. Cast a rgb24 clip to yuv444p:
  4271. @example
  4272. format=rgb24,mergeplanes=0x000102:yuv444p
  4273. @end example
  4274. @end itemize
  4275. @section mcdeint
  4276. Apply motion-compensation deinterlacing.
  4277. It needs one field per frame as input and must thus be used together
  4278. with yadif=1/3 or equivalent.
  4279. This filter accepts the following options:
  4280. @table @option
  4281. @item mode
  4282. Set the deinterlacing mode.
  4283. It accepts one of the following values:
  4284. @table @samp
  4285. @item fast
  4286. @item medium
  4287. @item slow
  4288. use iterative motion estimation
  4289. @item extra_slow
  4290. like @samp{slow}, but use multiple reference frames.
  4291. @end table
  4292. Default value is @samp{fast}.
  4293. @item parity
  4294. Set the picture field parity assumed for the input video. It must be
  4295. one of the following values:
  4296. @table @samp
  4297. @item 0, tff
  4298. assume top field first
  4299. @item 1, bff
  4300. assume bottom field first
  4301. @end table
  4302. Default value is @samp{bff}.
  4303. @item qp
  4304. Set per-block quantization parameter (QP) used by the internal
  4305. encoder.
  4306. Higher values should result in a smoother motion vector field but less
  4307. optimal individual vectors. Default value is 1.
  4308. @end table
  4309. @section mp
  4310. Apply an MPlayer filter to the input video.
  4311. This filter provides a wrapper around some of the filters of
  4312. MPlayer/MEncoder.
  4313. This wrapper is considered experimental. Some of the wrapped filters
  4314. may not work properly and we may drop support for them, as they will
  4315. be implemented natively into FFmpeg. Thus you should avoid
  4316. depending on them when writing portable scripts.
  4317. The filter accepts the parameters:
  4318. @var{filter_name}[:=]@var{filter_params}
  4319. @var{filter_name} is the name of a supported MPlayer filter,
  4320. @var{filter_params} is a string containing the parameters accepted by
  4321. the named filter.
  4322. The list of the currently supported filters follows:
  4323. @table @var
  4324. @item eq2
  4325. @item eq
  4326. @item fspp
  4327. @item ilpack
  4328. @item pp7
  4329. @item softpulldown
  4330. @item uspp
  4331. @end table
  4332. The parameter syntax and behavior for the listed filters are the same
  4333. of the corresponding MPlayer filters. For detailed instructions check
  4334. the "VIDEO FILTERS" section in the MPlayer manual.
  4335. @subsection Examples
  4336. @itemize
  4337. @item
  4338. Adjust gamma, brightness, contrast:
  4339. @example
  4340. mp=eq2=1.0:2:0.5
  4341. @end example
  4342. @end itemize
  4343. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  4344. @section mpdecimate
  4345. Drop frames that do not differ greatly from the previous frame in
  4346. order to reduce frame rate.
  4347. The main use of this filter is for very-low-bitrate encoding
  4348. (e.g. streaming over dialup modem), but it could in theory be used for
  4349. fixing movies that were inverse-telecined incorrectly.
  4350. A description of the accepted options follows.
  4351. @table @option
  4352. @item max
  4353. Set the maximum number of consecutive frames which can be dropped (if
  4354. positive), or the minimum interval between dropped frames (if
  4355. negative). If the value is 0, the frame is dropped unregarding the
  4356. number of previous sequentially dropped frames.
  4357. Default value is 0.
  4358. @item hi
  4359. @item lo
  4360. @item frac
  4361. Set the dropping threshold values.
  4362. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  4363. represent actual pixel value differences, so a threshold of 64
  4364. corresponds to 1 unit of difference for each pixel, or the same spread
  4365. out differently over the block.
  4366. A frame is a candidate for dropping if no 8x8 blocks differ by more
  4367. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  4368. meaning the whole image) differ by more than a threshold of @option{lo}.
  4369. Default value for @option{hi} is 64*12, default value for @option{lo} is
  4370. 64*5, and default value for @option{frac} is 0.33.
  4371. @end table
  4372. @section negate
  4373. Negate input video.
  4374. This filter accepts an integer in input, if non-zero it negates the
  4375. alpha component (if available). The default value in input is 0.
  4376. @section noformat
  4377. Force libavfilter not to use any of the specified pixel formats for the
  4378. input to the next filter.
  4379. This filter accepts the following parameters:
  4380. @table @option
  4381. @item pix_fmts
  4382. A '|'-separated list of pixel format names, for example
  4383. "pix_fmts=yuv420p|monow|rgb24".
  4384. @end table
  4385. @subsection Examples
  4386. @itemize
  4387. @item
  4388. Force libavfilter to use a format different from @var{yuv420p} for the
  4389. input to the vflip filter:
  4390. @example
  4391. noformat=pix_fmts=yuv420p,vflip
  4392. @end example
  4393. @item
  4394. Convert the input video to any of the formats not contained in the list:
  4395. @example
  4396. noformat=yuv420p|yuv444p|yuv410p
  4397. @end example
  4398. @end itemize
  4399. @section noise
  4400. Add noise on video input frame.
  4401. The filter accepts the following options:
  4402. @table @option
  4403. @item all_seed
  4404. @item c0_seed
  4405. @item c1_seed
  4406. @item c2_seed
  4407. @item c3_seed
  4408. Set noise seed for specific pixel component or all pixel components in case
  4409. of @var{all_seed}. Default value is @code{123457}.
  4410. @item all_strength, alls
  4411. @item c0_strength, c0s
  4412. @item c1_strength, c1s
  4413. @item c2_strength, c2s
  4414. @item c3_strength, c3s
  4415. Set noise strength for specific pixel component or all pixel components in case
  4416. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  4417. @item all_flags, allf
  4418. @item c0_flags, c0f
  4419. @item c1_flags, c1f
  4420. @item c2_flags, c2f
  4421. @item c3_flags, c3f
  4422. Set pixel component flags or set flags for all components if @var{all_flags}.
  4423. Available values for component flags are:
  4424. @table @samp
  4425. @item a
  4426. averaged temporal noise (smoother)
  4427. @item p
  4428. mix random noise with a (semi)regular pattern
  4429. @item t
  4430. temporal noise (noise pattern changes between frames)
  4431. @item u
  4432. uniform noise (gaussian otherwise)
  4433. @end table
  4434. @end table
  4435. @subsection Examples
  4436. Add temporal and uniform noise to input video:
  4437. @example
  4438. noise=alls=20:allf=t+u
  4439. @end example
  4440. @section null
  4441. Pass the video source unchanged to the output.
  4442. @section ocv
  4443. Apply video transform using libopencv.
  4444. To enable this filter install libopencv library and headers and
  4445. configure FFmpeg with @code{--enable-libopencv}.
  4446. This filter accepts the following parameters:
  4447. @table @option
  4448. @item filter_name
  4449. The name of the libopencv filter to apply.
  4450. @item filter_params
  4451. The parameters to pass to the libopencv filter. If not specified the default
  4452. values are assumed.
  4453. @end table
  4454. Refer to the official libopencv documentation for more precise
  4455. information:
  4456. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  4457. Follows the list of supported libopencv filters.
  4458. @anchor{dilate}
  4459. @subsection dilate
  4460. Dilate an image by using a specific structuring element.
  4461. This filter corresponds to the libopencv function @code{cvDilate}.
  4462. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  4463. @var{struct_el} represents a structuring element, and has the syntax:
  4464. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  4465. @var{cols} and @var{rows} represent the number of columns and rows of
  4466. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  4467. point, and @var{shape} the shape for the structuring element, and
  4468. can be one of the values "rect", "cross", "ellipse", "custom".
  4469. If the value for @var{shape} is "custom", it must be followed by a
  4470. string of the form "=@var{filename}". The file with name
  4471. @var{filename} is assumed to represent a binary image, with each
  4472. printable character corresponding to a bright pixel. When a custom
  4473. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  4474. or columns and rows of the read file are assumed instead.
  4475. The default value for @var{struct_el} is "3x3+0x0/rect".
  4476. @var{nb_iterations} specifies the number of times the transform is
  4477. applied to the image, and defaults to 1.
  4478. Follow some example:
  4479. @example
  4480. # use the default values
  4481. ocv=dilate
  4482. # dilate using a structuring element with a 5x5 cross, iterate two times
  4483. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  4484. # read the shape from the file diamond.shape, iterate two times
  4485. # the file diamond.shape may contain a pattern of characters like this:
  4486. # *
  4487. # ***
  4488. # *****
  4489. # ***
  4490. # *
  4491. # the specified cols and rows are ignored (but not the anchor point coordinates)
  4492. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  4493. @end example
  4494. @subsection erode
  4495. Erode an image by using a specific structuring element.
  4496. This filter corresponds to the libopencv function @code{cvErode}.
  4497. The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
  4498. with the same syntax and semantics as the @ref{dilate} filter.
  4499. @subsection smooth
  4500. Smooth the input video.
  4501. The filter takes the following parameters:
  4502. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  4503. @var{type} is the type of smooth filter to apply, and can be one of
  4504. the following values: "blur", "blur_no_scale", "median", "gaussian",
  4505. "bilateral". The default value is "gaussian".
  4506. @var{param1}, @var{param2}, @var{param3}, and @var{param4} are
  4507. parameters whose meanings depend on smooth type. @var{param1} and
  4508. @var{param2} accept integer positive values or 0, @var{param3} and
  4509. @var{param4} accept float values.
  4510. The default value for @var{param1} is 3, the default value for the
  4511. other parameters is 0.
  4512. These parameters correspond to the parameters assigned to the
  4513. libopencv function @code{cvSmooth}.
  4514. @anchor{overlay}
  4515. @section overlay
  4516. Overlay one video on top of another.
  4517. It takes two inputs and one output, the first input is the "main"
  4518. video on which the second input is overlayed.
  4519. This filter accepts the following parameters:
  4520. A description of the accepted options follows.
  4521. @table @option
  4522. @item x
  4523. @item y
  4524. Set the expression for the x and y coordinates of the overlayed video
  4525. on the main video. Default value is "0" for both expressions. In case
  4526. the expression is invalid, it is set to a huge value (meaning that the
  4527. overlay will not be displayed within the output visible area).
  4528. @item eval
  4529. Set when the expressions for @option{x}, and @option{y} are evaluated.
  4530. It accepts the following values:
  4531. @table @samp
  4532. @item init
  4533. only evaluate expressions once during the filter initialization or
  4534. when a command is processed
  4535. @item frame
  4536. evaluate expressions for each incoming frame
  4537. @end table
  4538. Default value is @samp{frame}.
  4539. @item shortest
  4540. If set to 1, force the output to terminate when the shortest input
  4541. terminates. Default value is 0.
  4542. @item format
  4543. Set the format for the output video.
  4544. It accepts the following values:
  4545. @table @samp
  4546. @item yuv420
  4547. force YUV420 output
  4548. @item yuv444
  4549. force YUV444 output
  4550. @item rgb
  4551. force RGB output
  4552. @end table
  4553. Default value is @samp{yuv420}.
  4554. @item rgb @emph{(deprecated)}
  4555. If set to 1, force the filter to accept inputs in the RGB
  4556. color space. Default value is 0. This option is deprecated, use
  4557. @option{format} instead.
  4558. @item repeatlast
  4559. If set to 1, force the filter to draw the last overlay frame over the
  4560. main input until the end of the stream. A value of 0 disables this
  4561. behavior. Default value is 1.
  4562. @end table
  4563. The @option{x}, and @option{y} expressions can contain the following
  4564. parameters.
  4565. @table @option
  4566. @item main_w, W
  4567. @item main_h, H
  4568. main input width and height
  4569. @item overlay_w, w
  4570. @item overlay_h, h
  4571. overlay input width and height
  4572. @item x
  4573. @item y
  4574. the computed values for @var{x} and @var{y}. They are evaluated for
  4575. each new frame.
  4576. @item hsub
  4577. @item vsub
  4578. horizontal and vertical chroma subsample values of the output
  4579. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  4580. @var{vsub} is 1.
  4581. @item n
  4582. the number of input frame, starting from 0
  4583. @item pos
  4584. the position in the file of the input frame, NAN if unknown
  4585. @item t
  4586. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4587. @end table
  4588. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  4589. when evaluation is done @emph{per frame}, and will evaluate to NAN
  4590. when @option{eval} is set to @samp{init}.
  4591. Be aware that frames are taken from each input video in timestamp
  4592. order, hence, if their initial timestamps differ, it is a good idea
  4593. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  4594. have them begin in the same zero timestamp, as it does the example for
  4595. the @var{movie} filter.
  4596. You can chain together more overlays but you should test the
  4597. efficiency of such approach.
  4598. @subsection Commands
  4599. This filter supports the following commands:
  4600. @table @option
  4601. @item x
  4602. @item y
  4603. Modify the x and y of the overlay input.
  4604. The command accepts the same syntax of the corresponding option.
  4605. If the specified expression is not valid, it is kept at its current
  4606. value.
  4607. @end table
  4608. @subsection Examples
  4609. @itemize
  4610. @item
  4611. Draw the overlay at 10 pixels from the bottom right corner of the main
  4612. video:
  4613. @example
  4614. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  4615. @end example
  4616. Using named options the example above becomes:
  4617. @example
  4618. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  4619. @end example
  4620. @item
  4621. Insert a transparent PNG logo in the bottom left corner of the input,
  4622. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  4623. @example
  4624. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  4625. @end example
  4626. @item
  4627. Insert 2 different transparent PNG logos (second logo on bottom
  4628. right corner) using the @command{ffmpeg} tool:
  4629. @example
  4630. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  4631. @end example
  4632. @item
  4633. Add a transparent color layer on top of the main video, @code{WxH}
  4634. must specify the size of the main input to the overlay filter:
  4635. @example
  4636. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  4637. @end example
  4638. @item
  4639. Play an original video and a filtered version (here with the deshake
  4640. filter) side by side using the @command{ffplay} tool:
  4641. @example
  4642. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  4643. @end example
  4644. The above command is the same as:
  4645. @example
  4646. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  4647. @end example
  4648. @item
  4649. Make a sliding overlay appearing from the left to the right top part of the
  4650. screen starting since time 2:
  4651. @example
  4652. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  4653. @end example
  4654. @item
  4655. Compose output by putting two input videos side to side:
  4656. @example
  4657. ffmpeg -i left.avi -i right.avi -filter_complex "
  4658. nullsrc=size=200x100 [background];
  4659. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  4660. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  4661. [background][left] overlay=shortest=1 [background+left];
  4662. [background+left][right] overlay=shortest=1:x=100 [left+right]
  4663. "
  4664. @end example
  4665. @item
  4666. Chain several overlays in cascade:
  4667. @example
  4668. nullsrc=s=200x200 [bg];
  4669. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  4670. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  4671. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  4672. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  4673. [in3] null, [mid2] overlay=100:100 [out0]
  4674. @end example
  4675. @end itemize
  4676. @section owdenoise
  4677. Apply Overcomplete Wavelet denoiser.
  4678. The filter accepts the following options:
  4679. @table @option
  4680. @item depth
  4681. Set depth.
  4682. Larger depth values will denoise lower frequency components more, but
  4683. slow down filtering.
  4684. Must be an int in the range 8-16, default is @code{8}.
  4685. @item luma_strength, ls
  4686. Set luma strength.
  4687. Must be a double value in the range 0-1000, default is @code{1.0}.
  4688. @item chroma_strength, cs
  4689. Set chroma strength.
  4690. Must be a double value in the range 0-1000, default is @code{1.0}.
  4691. @end table
  4692. @section pad
  4693. Add paddings to the input image, and place the original input at the
  4694. given coordinates @var{x}, @var{y}.
  4695. This filter accepts the following parameters:
  4696. @table @option
  4697. @item width, w
  4698. @item height, h
  4699. Specify an expression for the size of the output image with the
  4700. paddings added. If the value for @var{width} or @var{height} is 0, the
  4701. corresponding input size is used for the output.
  4702. The @var{width} expression can reference the value set by the
  4703. @var{height} expression, and vice versa.
  4704. The default value of @var{width} and @var{height} is 0.
  4705. @item x
  4706. @item y
  4707. Specify an expression for the offsets where to place the input image
  4708. in the padded area with respect to the top/left border of the output
  4709. image.
  4710. The @var{x} expression can reference the value set by the @var{y}
  4711. expression, and vice versa.
  4712. The default value of @var{x} and @var{y} is 0.
  4713. @item color
  4714. Specify the color of the padded area. For the syntax of this option,
  4715. check the "Color" section in the ffmpeg-utils manual.
  4716. The default value of @var{color} is "black".
  4717. @end table
  4718. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  4719. options are expressions containing the following constants:
  4720. @table @option
  4721. @item in_w
  4722. @item in_h
  4723. the input video width and height
  4724. @item iw
  4725. @item ih
  4726. same as @var{in_w} and @var{in_h}
  4727. @item out_w
  4728. @item out_h
  4729. the output width and height, that is the size of the padded area as
  4730. specified by the @var{width} and @var{height} expressions
  4731. @item ow
  4732. @item oh
  4733. same as @var{out_w} and @var{out_h}
  4734. @item x
  4735. @item y
  4736. x and y offsets as specified by the @var{x} and @var{y}
  4737. expressions, or NAN if not yet specified
  4738. @item a
  4739. same as @var{iw} / @var{ih}
  4740. @item sar
  4741. input sample aspect ratio
  4742. @item dar
  4743. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4744. @item hsub
  4745. @item vsub
  4746. horizontal and vertical chroma subsample values. For example for the
  4747. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4748. @end table
  4749. @subsection Examples
  4750. @itemize
  4751. @item
  4752. Add paddings with color "violet" to the input video. Output video
  4753. size is 640x480, the top-left corner of the input video is placed at
  4754. column 0, row 40:
  4755. @example
  4756. pad=640:480:0:40:violet
  4757. @end example
  4758. The example above is equivalent to the following command:
  4759. @example
  4760. pad=width=640:height=480:x=0:y=40:color=violet
  4761. @end example
  4762. @item
  4763. Pad the input to get an output with dimensions increased by 3/2,
  4764. and put the input video at the center of the padded area:
  4765. @example
  4766. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  4767. @end example
  4768. @item
  4769. Pad the input to get a squared output with size equal to the maximum
  4770. value between the input width and height, and put the input video at
  4771. the center of the padded area:
  4772. @example
  4773. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  4774. @end example
  4775. @item
  4776. Pad the input to get a final w/h ratio of 16:9:
  4777. @example
  4778. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  4779. @end example
  4780. @item
  4781. In case of anamorphic video, in order to set the output display aspect
  4782. correctly, it is necessary to use @var{sar} in the expression,
  4783. according to the relation:
  4784. @example
  4785. (ih * X / ih) * sar = output_dar
  4786. X = output_dar / sar
  4787. @end example
  4788. Thus the previous example needs to be modified to:
  4789. @example
  4790. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  4791. @end example
  4792. @item
  4793. Double output size and put the input video in the bottom-right
  4794. corner of the output padded area:
  4795. @example
  4796. pad="2*iw:2*ih:ow-iw:oh-ih"
  4797. @end example
  4798. @end itemize
  4799. @section perspective
  4800. Correct perspective of video not recorded perpendicular to the screen.
  4801. A description of the accepted parameters follows.
  4802. @table @option
  4803. @item x0
  4804. @item y0
  4805. @item x1
  4806. @item y1
  4807. @item x2
  4808. @item y2
  4809. @item x3
  4810. @item y3
  4811. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  4812. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  4813. The expressions can use the following variables:
  4814. @table @option
  4815. @item W
  4816. @item H
  4817. the width and height of video frame.
  4818. @end table
  4819. @item interpolation
  4820. Set interpolation for perspective correction.
  4821. It accepts the following values:
  4822. @table @samp
  4823. @item linear
  4824. @item cubic
  4825. @end table
  4826. Default value is @samp{linear}.
  4827. @end table
  4828. @section phase
  4829. Delay interlaced video by one field time so that the field order changes.
  4830. The intended use is to fix PAL movies that have been captured with the
  4831. opposite field order to the film-to-video transfer.
  4832. A description of the accepted parameters follows.
  4833. @table @option
  4834. @item mode
  4835. Set phase mode.
  4836. It accepts the following values:
  4837. @table @samp
  4838. @item t
  4839. Capture field order top-first, transfer bottom-first.
  4840. Filter will delay the bottom field.
  4841. @item b
  4842. Capture field order bottom-first, transfer top-first.
  4843. Filter will delay the top field.
  4844. @item p
  4845. Capture and transfer with the same field order. This mode only exists
  4846. for the documentation of the other options to refer to, but if you
  4847. actually select it, the filter will faithfully do nothing.
  4848. @item a
  4849. Capture field order determined automatically by field flags, transfer
  4850. opposite.
  4851. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  4852. basis using field flags. If no field information is available,
  4853. then this works just like @samp{u}.
  4854. @item u
  4855. Capture unknown or varying, transfer opposite.
  4856. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  4857. analyzing the images and selecting the alternative that produces best
  4858. match between the fields.
  4859. @item T
  4860. Capture top-first, transfer unknown or varying.
  4861. Filter selects among @samp{t} and @samp{p} using image analysis.
  4862. @item B
  4863. Capture bottom-first, transfer unknown or varying.
  4864. Filter selects among @samp{b} and @samp{p} using image analysis.
  4865. @item A
  4866. Capture determined by field flags, transfer unknown or varying.
  4867. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  4868. image analysis. If no field information is available, then this works just
  4869. like @samp{U}. This is the default mode.
  4870. @item U
  4871. Both capture and transfer unknown or varying.
  4872. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  4873. @end table
  4874. @end table
  4875. @section pixdesctest
  4876. Pixel format descriptor test filter, mainly useful for internal
  4877. testing. The output video should be equal to the input video.
  4878. For example:
  4879. @example
  4880. format=monow, pixdesctest
  4881. @end example
  4882. can be used to test the monowhite pixel format descriptor definition.
  4883. @section pp
  4884. Enable the specified chain of postprocessing subfilters using libpostproc. This
  4885. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  4886. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  4887. Each subfilter and some options have a short and a long name that can be used
  4888. interchangeably, i.e. dr/dering are the same.
  4889. The filters accept the following options:
  4890. @table @option
  4891. @item subfilters
  4892. Set postprocessing subfilters string.
  4893. @end table
  4894. All subfilters share common options to determine their scope:
  4895. @table @option
  4896. @item a/autoq
  4897. Honor the quality commands for this subfilter.
  4898. @item c/chrom
  4899. Do chrominance filtering, too (default).
  4900. @item y/nochrom
  4901. Do luminance filtering only (no chrominance).
  4902. @item n/noluma
  4903. Do chrominance filtering only (no luminance).
  4904. @end table
  4905. These options can be appended after the subfilter name, separated by a '|'.
  4906. Available subfilters are:
  4907. @table @option
  4908. @item hb/hdeblock[|difference[|flatness]]
  4909. Horizontal deblocking filter
  4910. @table @option
  4911. @item difference
  4912. Difference factor where higher values mean more deblocking (default: @code{32}).
  4913. @item flatness
  4914. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4915. @end table
  4916. @item vb/vdeblock[|difference[|flatness]]
  4917. Vertical deblocking filter
  4918. @table @option
  4919. @item difference
  4920. Difference factor where higher values mean more deblocking (default: @code{32}).
  4921. @item flatness
  4922. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4923. @end table
  4924. @item ha/hadeblock[|difference[|flatness]]
  4925. Accurate horizontal deblocking filter
  4926. @table @option
  4927. @item difference
  4928. Difference factor where higher values mean more deblocking (default: @code{32}).
  4929. @item flatness
  4930. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4931. @end table
  4932. @item va/vadeblock[|difference[|flatness]]
  4933. Accurate vertical deblocking filter
  4934. @table @option
  4935. @item difference
  4936. Difference factor where higher values mean more deblocking (default: @code{32}).
  4937. @item flatness
  4938. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  4939. @end table
  4940. @end table
  4941. The horizontal and vertical deblocking filters share the difference and
  4942. flatness values so you cannot set different horizontal and vertical
  4943. thresholds.
  4944. @table @option
  4945. @item h1/x1hdeblock
  4946. Experimental horizontal deblocking filter
  4947. @item v1/x1vdeblock
  4948. Experimental vertical deblocking filter
  4949. @item dr/dering
  4950. Deringing filter
  4951. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  4952. @table @option
  4953. @item threshold1
  4954. larger -> stronger filtering
  4955. @item threshold2
  4956. larger -> stronger filtering
  4957. @item threshold3
  4958. larger -> stronger filtering
  4959. @end table
  4960. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  4961. @table @option
  4962. @item f/fullyrange
  4963. Stretch luminance to @code{0-255}.
  4964. @end table
  4965. @item lb/linblenddeint
  4966. Linear blend deinterlacing filter that deinterlaces the given block by
  4967. filtering all lines with a @code{(1 2 1)} filter.
  4968. @item li/linipoldeint
  4969. Linear interpolating deinterlacing filter that deinterlaces the given block by
  4970. linearly interpolating every second line.
  4971. @item ci/cubicipoldeint
  4972. Cubic interpolating deinterlacing filter deinterlaces the given block by
  4973. cubically interpolating every second line.
  4974. @item md/mediandeint
  4975. Median deinterlacing filter that deinterlaces the given block by applying a
  4976. median filter to every second line.
  4977. @item fd/ffmpegdeint
  4978. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  4979. second line with a @code{(-1 4 2 4 -1)} filter.
  4980. @item l5/lowpass5
  4981. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  4982. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  4983. @item fq/forceQuant[|quantizer]
  4984. Overrides the quantizer table from the input with the constant quantizer you
  4985. specify.
  4986. @table @option
  4987. @item quantizer
  4988. Quantizer to use
  4989. @end table
  4990. @item de/default
  4991. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  4992. @item fa/fast
  4993. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  4994. @item ac
  4995. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  4996. @end table
  4997. @subsection Examples
  4998. @itemize
  4999. @item
  5000. Apply horizontal and vertical deblocking, deringing and automatic
  5001. brightness/contrast:
  5002. @example
  5003. pp=hb/vb/dr/al
  5004. @end example
  5005. @item
  5006. Apply default filters without brightness/contrast correction:
  5007. @example
  5008. pp=de/-al
  5009. @end example
  5010. @item
  5011. Apply default filters and temporal denoiser:
  5012. @example
  5013. pp=default/tmpnoise|1|2|3
  5014. @end example
  5015. @item
  5016. Apply deblocking on luminance only, and switch vertical deblocking on or off
  5017. automatically depending on available CPU time:
  5018. @example
  5019. pp=hb|y/vb|a
  5020. @end example
  5021. @end itemize
  5022. @section psnr
  5023. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  5024. Ratio) between two input videos.
  5025. This filter takes in input two input videos, the first input is
  5026. considered the "main" source and is passed unchanged to the
  5027. output. The second input is used as a "reference" video for computing
  5028. the PSNR.
  5029. Both video inputs must have the same resolution and pixel format for
  5030. this filter to work correctly. Also it assumes that both inputs
  5031. have the same number of frames, which are compared one by one.
  5032. The obtained average PSNR is printed through the logging system.
  5033. The filter stores the accumulated MSE (mean squared error) of each
  5034. frame, and at the end of the processing it is averaged across all frames
  5035. equally, and the following formula is applied to obtain the PSNR:
  5036. @example
  5037. PSNR = 10*log10(MAX^2/MSE)
  5038. @end example
  5039. Where MAX is the average of the maximum values of each component of the
  5040. image.
  5041. The description of the accepted parameters follows.
  5042. @table @option
  5043. @item stats_file, f
  5044. If specified the filter will use the named file to save the PSNR of
  5045. each individual frame.
  5046. @end table
  5047. The file printed if @var{stats_file} is selected, contains a sequence of
  5048. key/value pairs of the form @var{key}:@var{value} for each compared
  5049. couple of frames.
  5050. A description of each shown parameter follows:
  5051. @table @option
  5052. @item n
  5053. sequential number of the input frame, starting from 1
  5054. @item mse_avg
  5055. Mean Square Error pixel-by-pixel average difference of the compared
  5056. frames, averaged over all the image components.
  5057. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  5058. Mean Square Error pixel-by-pixel average difference of the compared
  5059. frames for the component specified by the suffix.
  5060. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  5061. Peak Signal to Noise ratio of the compared frames for the component
  5062. specified by the suffix.
  5063. @end table
  5064. For example:
  5065. @example
  5066. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  5067. [main][ref] psnr="stats_file=stats.log" [out]
  5068. @end example
  5069. On this example the input file being processed is compared with the
  5070. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  5071. is stored in @file{stats.log}.
  5072. @section pullup
  5073. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  5074. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  5075. content.
  5076. The pullup filter is designed to take advantage of future context in making
  5077. its decisions. This filter is stateless in the sense that it does not lock
  5078. onto a pattern to follow, but it instead looks forward to the following
  5079. fields in order to identify matches and rebuild progressive frames.
  5080. To produce content with an even framerate, insert the fps filter after
  5081. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  5082. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  5083. The filter accepts the following options:
  5084. @table @option
  5085. @item jl
  5086. @item jr
  5087. @item jt
  5088. @item jb
  5089. These options set the amount of "junk" to ignore at the left, right, top, and
  5090. bottom of the image, respectively. Left and right are in units of 8 pixels,
  5091. while top and bottom are in units of 2 lines.
  5092. The default is 8 pixels on each side.
  5093. @item sb
  5094. Set the strict breaks. Setting this option to 1 will reduce the chances of
  5095. filter generating an occasional mismatched frame, but it may also cause an
  5096. excessive number of frames to be dropped during high motion sequences.
  5097. Conversely, setting it to -1 will make filter match fields more easily.
  5098. This may help processing of video where there is slight blurring between
  5099. the fields, but may also cause there to be interlaced frames in the output.
  5100. Default value is @code{0}.
  5101. @item mp
  5102. Set the metric plane to use. It accepts the following values:
  5103. @table @samp
  5104. @item l
  5105. Use luma plane.
  5106. @item u
  5107. Use chroma blue plane.
  5108. @item v
  5109. Use chroma red plane.
  5110. @end table
  5111. This option may be set to use chroma plane instead of the default luma plane
  5112. for doing filter's computations. This may improve accuracy on very clean
  5113. source material, but more likely will decrease accuracy, especially if there
  5114. is chroma noise (rainbow effect) or any grayscale video.
  5115. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  5116. load and make pullup usable in realtime on slow machines.
  5117. @end table
  5118. For best results (without duplicated frames in the output file) it is
  5119. necessary to change the output frame rate. For example, to inverse
  5120. telecine NTSC input:
  5121. @example
  5122. ffmpeg -i input -vf pullup -r 24000/1001 ...
  5123. @end example
  5124. @section removelogo
  5125. Suppress a TV station logo, using an image file to determine which
  5126. pixels comprise the logo. It works by filling in the pixels that
  5127. comprise the logo with neighboring pixels.
  5128. The filter accepts the following options:
  5129. @table @option
  5130. @item filename, f
  5131. Set the filter bitmap file, which can be any image format supported by
  5132. libavformat. The width and height of the image file must match those of the
  5133. video stream being processed.
  5134. @end table
  5135. Pixels in the provided bitmap image with a value of zero are not
  5136. considered part of the logo, non-zero pixels are considered part of
  5137. the logo. If you use white (255) for the logo and black (0) for the
  5138. rest, you will be safe. For making the filter bitmap, it is
  5139. recommended to take a screen capture of a black frame with the logo
  5140. visible, and then using a threshold filter followed by the erode
  5141. filter once or twice.
  5142. If needed, little splotches can be fixed manually. Remember that if
  5143. logo pixels are not covered, the filter quality will be much
  5144. reduced. Marking too many pixels as part of the logo does not hurt as
  5145. much, but it will increase the amount of blurring needed to cover over
  5146. the image and will destroy more information than necessary, and extra
  5147. pixels will slow things down on a large logo.
  5148. @section rotate
  5149. Rotate video by an arbitrary angle expressed in radians.
  5150. The filter accepts the following options:
  5151. A description of the optional parameters follows.
  5152. @table @option
  5153. @item angle, a
  5154. Set an expression for the angle by which to rotate the input video
  5155. clockwise, expressed as a number of radians. A negative value will
  5156. result in a counter-clockwise rotation. By default it is set to "0".
  5157. This expression is evaluated for each frame.
  5158. @item out_w, ow
  5159. Set the output width expression, default value is "iw".
  5160. This expression is evaluated just once during configuration.
  5161. @item out_h, oh
  5162. Set the output height expression, default value is "ih".
  5163. This expression is evaluated just once during configuration.
  5164. @item bilinear
  5165. Enable bilinear interpolation if set to 1, a value of 0 disables
  5166. it. Default value is 1.
  5167. @item fillcolor, c
  5168. Set the color used to fill the output area not covered by the rotated
  5169. image. For the generalsyntax of this option, check the "Color" section in the
  5170. ffmpeg-utils manual. If the special value "none" is selected then no
  5171. background is printed (useful for example if the background is never shown).
  5172. Default value is "black".
  5173. @end table
  5174. The expressions for the angle and the output size can contain the
  5175. following constants and functions:
  5176. @table @option
  5177. @item n
  5178. sequential number of the input frame, starting from 0. It is always NAN
  5179. before the first frame is filtered.
  5180. @item t
  5181. time in seconds of the input frame, it is set to 0 when the filter is
  5182. configured. It is always NAN before the first frame is filtered.
  5183. @item hsub
  5184. @item vsub
  5185. horizontal and vertical chroma subsample values. For example for the
  5186. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5187. @item in_w, iw
  5188. @item in_h, ih
  5189. the input video width and heigth
  5190. @item out_w, ow
  5191. @item out_h, oh
  5192. the output width and heigth, that is the size of the padded area as
  5193. specified by the @var{width} and @var{height} expressions
  5194. @item rotw(a)
  5195. @item roth(a)
  5196. the minimal width/height required for completely containing the input
  5197. video rotated by @var{a} radians.
  5198. These are only available when computing the @option{out_w} and
  5199. @option{out_h} expressions.
  5200. @end table
  5201. @subsection Examples
  5202. @itemize
  5203. @item
  5204. Rotate the input by PI/6 radians clockwise:
  5205. @example
  5206. rotate=PI/6
  5207. @end example
  5208. @item
  5209. Rotate the input by PI/6 radians counter-clockwise:
  5210. @example
  5211. rotate=-PI/6
  5212. @end example
  5213. @item
  5214. Rotate the input by 45 degrees clockwise:
  5215. @example
  5216. rotate=45*PI/180
  5217. @end example
  5218. @item
  5219. Apply a constant rotation with period T, starting from an angle of PI/3:
  5220. @example
  5221. rotate=PI/3+2*PI*t/T
  5222. @end example
  5223. @item
  5224. Make the input video rotation oscillating with a period of T
  5225. seconds and an amplitude of A radians:
  5226. @example
  5227. rotate=A*sin(2*PI/T*t)
  5228. @end example
  5229. @item
  5230. Rotate the video, output size is choosen so that the whole rotating
  5231. input video is always completely contained in the output:
  5232. @example
  5233. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  5234. @end example
  5235. @item
  5236. Rotate the video, reduce the output size so that no background is ever
  5237. shown:
  5238. @example
  5239. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  5240. @end example
  5241. @end itemize
  5242. @subsection Commands
  5243. The filter supports the following commands:
  5244. @table @option
  5245. @item a, angle
  5246. Set the angle expression.
  5247. The command accepts the same syntax of the corresponding option.
  5248. If the specified expression is not valid, it is kept at its current
  5249. value.
  5250. @end table
  5251. @section sab
  5252. Apply Shape Adaptive Blur.
  5253. The filter accepts the following options:
  5254. @table @option
  5255. @item luma_radius, lr
  5256. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  5257. value is 1.0. A greater value will result in a more blurred image, and
  5258. in slower processing.
  5259. @item luma_pre_filter_radius, lpfr
  5260. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  5261. value is 1.0.
  5262. @item luma_strength, ls
  5263. Set luma maximum difference between pixels to still be considered, must
  5264. be a value in the 0.1-100.0 range, default value is 1.0.
  5265. @item chroma_radius, cr
  5266. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  5267. greater value will result in a more blurred image, and in slower
  5268. processing.
  5269. @item chroma_pre_filter_radius, cpfr
  5270. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  5271. @item chroma_strength, cs
  5272. Set chroma maximum difference between pixels to still be considered,
  5273. must be a value in the 0.1-100.0 range.
  5274. @end table
  5275. Each chroma option value, if not explicitly specified, is set to the
  5276. corresponding luma option value.
  5277. @anchor{scale}
  5278. @section scale
  5279. Scale (resize) the input video, using the libswscale library.
  5280. The scale filter forces the output display aspect ratio to be the same
  5281. of the input, by changing the output sample aspect ratio.
  5282. If the input image format is different from the format requested by
  5283. the next filter, the scale filter will convert the input to the
  5284. requested format.
  5285. @subsection Options
  5286. The filter accepts the following options, or any of the options
  5287. supported by the libswscale scaler.
  5288. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  5289. the complete list of scaler options.
  5290. @table @option
  5291. @item width, w
  5292. @item height, h
  5293. Set the output video dimension expression. Default value is the input
  5294. dimension.
  5295. If the value is 0, the input width is used for the output.
  5296. If one of the values is -1, the scale filter will use a value that
  5297. maintains the aspect ratio of the input image, calculated from the
  5298. other specified dimension. If both of them are -1, the input size is
  5299. used
  5300. See below for the list of accepted constants for use in the dimension
  5301. expression.
  5302. @item interl
  5303. Set the interlacing mode. It accepts the following values:
  5304. @table @samp
  5305. @item 1
  5306. Force interlaced aware scaling.
  5307. @item 0
  5308. Do not apply interlaced scaling.
  5309. @item -1
  5310. Select interlaced aware scaling depending on whether the source frames
  5311. are flagged as interlaced or not.
  5312. @end table
  5313. Default value is @samp{0}.
  5314. @item flags
  5315. Set libswscale scaling flags. See
  5316. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  5317. complete list of values. If not explictly specified the filter applies
  5318. the default flags.
  5319. @item size, s
  5320. Set the video size. For the syntax of this option, check the "Video size"
  5321. section in the ffmpeg-utils manual.
  5322. @item in_color_matrix
  5323. @item out_color_matrix
  5324. Set in/output YCbCr color space type.
  5325. This allows the autodetected value to be overridden as well as allows forcing
  5326. a specific value used for the output and encoder.
  5327. If not specified, the color space type depends on the pixel format.
  5328. Possible values:
  5329. @table @samp
  5330. @item auto
  5331. Choose automatically.
  5332. @item bt709
  5333. Format conforming to International Telecommunication Union (ITU)
  5334. Recommendation BT.709.
  5335. @item fcc
  5336. Set color space conforming to the United States Federal Communications
  5337. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  5338. @item bt601
  5339. Set color space conforming to:
  5340. @itemize
  5341. @item
  5342. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  5343. @item
  5344. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  5345. @item
  5346. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  5347. @end itemize
  5348. @item smpte240m
  5349. Set color space conforming to SMPTE ST 240:1999.
  5350. @end table
  5351. @item in_range
  5352. @item out_range
  5353. Set in/output YCbCr sample range.
  5354. This allows the autodetected value to be overridden as well as allows forcing
  5355. a specific value used for the output and encoder. If not specified, the
  5356. range depends on the pixel format. Possible values:
  5357. @table @samp
  5358. @item auto
  5359. Choose automatically.
  5360. @item jpeg/full/pc
  5361. Set full range (0-255 in case of 8-bit luma).
  5362. @item mpeg/tv
  5363. Set "MPEG" range (16-235 in case of 8-bit luma).
  5364. @end table
  5365. @item force_original_aspect_ratio
  5366. Enable decreasing or increasing output video width or height if necessary to
  5367. keep the original aspect ratio. Possible values:
  5368. @table @samp
  5369. @item disable
  5370. Scale the video as specified and disable this feature.
  5371. @item decrease
  5372. The output video dimensions will automatically be decreased if needed.
  5373. @item increase
  5374. The output video dimensions will automatically be increased if needed.
  5375. @end table
  5376. One useful instance of this option is that when you know a specific device's
  5377. maximum allowed resolution, you can use this to limit the output video to
  5378. that, while retaining the aspect ratio. For example, device A allows
  5379. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  5380. decrease) and specifying 1280x720 to the command line makes the output
  5381. 1280x533.
  5382. Please note that this is a different thing than specifying -1 for @option{w}
  5383. or @option{h}, you still need to specify the output resolution for this option
  5384. to work.
  5385. @end table
  5386. The values of the @option{w} and @option{h} options are expressions
  5387. containing the following constants:
  5388. @table @var
  5389. @item in_w
  5390. @item in_h
  5391. the input width and height
  5392. @item iw
  5393. @item ih
  5394. same as @var{in_w} and @var{in_h}
  5395. @item out_w
  5396. @item out_h
  5397. the output (scaled) width and height
  5398. @item ow
  5399. @item oh
  5400. same as @var{out_w} and @var{out_h}
  5401. @item a
  5402. same as @var{iw} / @var{ih}
  5403. @item sar
  5404. input sample aspect ratio
  5405. @item dar
  5406. input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  5407. @item hsub
  5408. @item vsub
  5409. horizontal and vertical input chroma subsample values. For example for the
  5410. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5411. @item ohsub
  5412. @item ovsub
  5413. horizontal and vertical output chroma subsample values. For example for the
  5414. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Scale the input video to a size of 200x100:
  5420. @example
  5421. scale=w=200:h=100
  5422. @end example
  5423. This is equivalent to:
  5424. @example
  5425. scale=200:100
  5426. @end example
  5427. or:
  5428. @example
  5429. scale=200x100
  5430. @end example
  5431. @item
  5432. Specify a size abbreviation for the output size:
  5433. @example
  5434. scale=qcif
  5435. @end example
  5436. which can also be written as:
  5437. @example
  5438. scale=size=qcif
  5439. @end example
  5440. @item
  5441. Scale the input to 2x:
  5442. @example
  5443. scale=w=2*iw:h=2*ih
  5444. @end example
  5445. @item
  5446. The above is the same as:
  5447. @example
  5448. scale=2*in_w:2*in_h
  5449. @end example
  5450. @item
  5451. Scale the input to 2x with forced interlaced scaling:
  5452. @example
  5453. scale=2*iw:2*ih:interl=1
  5454. @end example
  5455. @item
  5456. Scale the input to half size:
  5457. @example
  5458. scale=w=iw/2:h=ih/2
  5459. @end example
  5460. @item
  5461. Increase the width, and set the height to the same size:
  5462. @example
  5463. scale=3/2*iw:ow
  5464. @end example
  5465. @item
  5466. Seek for Greek harmony:
  5467. @example
  5468. scale=iw:1/PHI*iw
  5469. scale=ih*PHI:ih
  5470. @end example
  5471. @item
  5472. Increase the height, and set the width to 3/2 of the height:
  5473. @example
  5474. scale=w=3/2*oh:h=3/5*ih
  5475. @end example
  5476. @item
  5477. Increase the size, but make the size a multiple of the chroma
  5478. subsample values:
  5479. @example
  5480. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  5481. @end example
  5482. @item
  5483. Increase the width to a maximum of 500 pixels, keep the same input
  5484. aspect ratio:
  5485. @example
  5486. scale=w='min(500\, iw*3/2):h=-1'
  5487. @end example
  5488. @end itemize
  5489. @section separatefields
  5490. The @code{separatefields} takes a frame-based video input and splits
  5491. each frame into its components fields, producing a new half height clip
  5492. with twice the frame rate and twice the frame count.
  5493. This filter use field-dominance information in frame to decide which
  5494. of each pair of fields to place first in the output.
  5495. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  5496. @section setdar, setsar
  5497. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  5498. output video.
  5499. This is done by changing the specified Sample (aka Pixel) Aspect
  5500. Ratio, according to the following equation:
  5501. @example
  5502. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  5503. @end example
  5504. Keep in mind that the @code{setdar} filter does not modify the pixel
  5505. dimensions of the video frame. Also the display aspect ratio set by
  5506. this filter may be changed by later filters in the filterchain,
  5507. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  5508. applied.
  5509. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  5510. the filter output video.
  5511. Note that as a consequence of the application of this filter, the
  5512. output display aspect ratio will change according to the equation
  5513. above.
  5514. Keep in mind that the sample aspect ratio set by the @code{setsar}
  5515. filter may be changed by later filters in the filterchain, e.g. if
  5516. another "setsar" or a "setdar" filter is applied.
  5517. The filters accept the following options:
  5518. @table @option
  5519. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  5520. Set the aspect ratio used by the filter.
  5521. The parameter can be a floating point number string, an expression, or
  5522. a string of the form @var{num}:@var{den}, where @var{num} and
  5523. @var{den} are the numerator and denominator of the aspect ratio. If
  5524. the parameter is not specified, it is assumed the value "0".
  5525. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  5526. should be escaped.
  5527. @item max
  5528. Set the maximum integer value to use for expressing numerator and
  5529. denominator when reducing the expressed aspect ratio to a rational.
  5530. Default value is @code{100}.
  5531. @end table
  5532. The parameter @var{sar} is an expression containing
  5533. the following constants:
  5534. @table @option
  5535. @item E, PI, PHI
  5536. the corresponding mathematical approximated values for e
  5537. (euler number), pi (greek PI), phi (golden ratio)
  5538. @item w, h
  5539. the input width and height
  5540. @item a
  5541. same as @var{w} / @var{h}
  5542. @item sar
  5543. input sample aspect ratio
  5544. @item dar
  5545. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5546. @item hsub, vsub
  5547. horizontal and vertical chroma subsample values. For example for the
  5548. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5549. @end table
  5550. @subsection Examples
  5551. @itemize
  5552. @item
  5553. To change the display aspect ratio to 16:9, specify one of the following:
  5554. @example
  5555. setdar=dar=1.77777
  5556. setdar=dar=16/9
  5557. setdar=dar=1.77777
  5558. @end example
  5559. @item
  5560. To change the sample aspect ratio to 10:11, specify:
  5561. @example
  5562. setsar=sar=10/11
  5563. @end example
  5564. @item
  5565. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  5566. 1000 in the aspect ratio reduction, use the command:
  5567. @example
  5568. setdar=ratio=16/9:max=1000
  5569. @end example
  5570. @end itemize
  5571. @anchor{setfield}
  5572. @section setfield
  5573. Force field for the output video frame.
  5574. The @code{setfield} filter marks the interlace type field for the
  5575. output frames. It does not change the input frame, but only sets the
  5576. corresponding property, which affects how the frame is treated by
  5577. following filters (e.g. @code{fieldorder} or @code{yadif}).
  5578. The filter accepts the following options:
  5579. @table @option
  5580. @item mode
  5581. Available values are:
  5582. @table @samp
  5583. @item auto
  5584. Keep the same field property.
  5585. @item bff
  5586. Mark the frame as bottom-field-first.
  5587. @item tff
  5588. Mark the frame as top-field-first.
  5589. @item prog
  5590. Mark the frame as progressive.
  5591. @end table
  5592. @end table
  5593. @section showinfo
  5594. Show a line containing various information for each input video frame.
  5595. The input video is not modified.
  5596. The shown line contains a sequence of key/value pairs of the form
  5597. @var{key}:@var{value}.
  5598. A description of each shown parameter follows:
  5599. @table @option
  5600. @item n
  5601. sequential number of the input frame, starting from 0
  5602. @item pts
  5603. Presentation TimeStamp of the input frame, expressed as a number of
  5604. time base units. The time base unit depends on the filter input pad.
  5605. @item pts_time
  5606. Presentation TimeStamp of the input frame, expressed as a number of
  5607. seconds
  5608. @item pos
  5609. position of the frame in the input stream, -1 if this information in
  5610. unavailable and/or meaningless (for example in case of synthetic video)
  5611. @item fmt
  5612. pixel format name
  5613. @item sar
  5614. sample aspect ratio of the input frame, expressed in the form
  5615. @var{num}/@var{den}
  5616. @item s
  5617. size of the input frame. For the syntax of this option, check the "Video size"
  5618. section in the ffmpeg-utils manual.
  5619. @item i
  5620. interlaced mode ("P" for "progressive", "T" for top field first, "B"
  5621. for bottom field first)
  5622. @item iskey
  5623. 1 if the frame is a key frame, 0 otherwise
  5624. @item type
  5625. picture type of the input frame ("I" for an I-frame, "P" for a
  5626. P-frame, "B" for a B-frame, "?" for unknown type).
  5627. Check also the documentation of the @code{AVPictureType} enum and of
  5628. the @code{av_get_picture_type_char} function defined in
  5629. @file{libavutil/avutil.h}.
  5630. @item checksum
  5631. Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
  5632. @item plane_checksum
  5633. Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  5634. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]"
  5635. @end table
  5636. @anchor{smartblur}
  5637. @section smartblur
  5638. Blur the input video without impacting the outlines.
  5639. The filter accepts the following options:
  5640. @table @option
  5641. @item luma_radius, lr
  5642. Set the luma radius. The option value must be a float number in
  5643. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5644. used to blur the image (slower if larger). Default value is 1.0.
  5645. @item luma_strength, ls
  5646. Set the luma strength. The option value must be a float number
  5647. in the range [-1.0,1.0] that configures the blurring. A value included
  5648. in [0.0,1.0] will blur the image whereas a value included in
  5649. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5650. @item luma_threshold, lt
  5651. Set the luma threshold used as a coefficient to determine
  5652. whether a pixel should be blurred or not. The option value must be an
  5653. integer in the range [-30,30]. A value of 0 will filter all the image,
  5654. a value included in [0,30] will filter flat areas and a value included
  5655. in [-30,0] will filter edges. Default value is 0.
  5656. @item chroma_radius, cr
  5657. Set the chroma radius. The option value must be a float number in
  5658. the range [0.1,5.0] that specifies the variance of the gaussian filter
  5659. used to blur the image (slower if larger). Default value is 1.0.
  5660. @item chroma_strength, cs
  5661. Set the chroma strength. The option value must be a float number
  5662. in the range [-1.0,1.0] that configures the blurring. A value included
  5663. in [0.0,1.0] will blur the image whereas a value included in
  5664. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  5665. @item chroma_threshold, ct
  5666. Set the chroma threshold used as a coefficient to determine
  5667. whether a pixel should be blurred or not. The option value must be an
  5668. integer in the range [-30,30]. A value of 0 will filter all the image,
  5669. a value included in [0,30] will filter flat areas and a value included
  5670. in [-30,0] will filter edges. Default value is 0.
  5671. @end table
  5672. If a chroma option is not explicitly set, the corresponding luma value
  5673. is set.
  5674. @section stereo3d
  5675. Convert between different stereoscopic image formats.
  5676. The filters accept the following options:
  5677. @table @option
  5678. @item in
  5679. Set stereoscopic image format of input.
  5680. Available values for input image formats are:
  5681. @table @samp
  5682. @item sbsl
  5683. side by side parallel (left eye left, right eye right)
  5684. @item sbsr
  5685. side by side crosseye (right eye left, left eye right)
  5686. @item sbs2l
  5687. side by side parallel with half width resolution
  5688. (left eye left, right eye right)
  5689. @item sbs2r
  5690. side by side crosseye with half width resolution
  5691. (right eye left, left eye right)
  5692. @item abl
  5693. above-below (left eye above, right eye below)
  5694. @item abr
  5695. above-below (right eye above, left eye below)
  5696. @item ab2l
  5697. above-below with half height resolution
  5698. (left eye above, right eye below)
  5699. @item ab2r
  5700. above-below with half height resolution
  5701. (right eye above, left eye below)
  5702. @item al
  5703. alternating frames (left eye first, right eye second)
  5704. @item ar
  5705. alternating frames (right eye first, left eye second)
  5706. Default value is @samp{sbsl}.
  5707. @end table
  5708. @item out
  5709. Set stereoscopic image format of output.
  5710. Available values for output image formats are all the input formats as well as:
  5711. @table @samp
  5712. @item arbg
  5713. anaglyph red/blue gray
  5714. (red filter on left eye, blue filter on right eye)
  5715. @item argg
  5716. anaglyph red/green gray
  5717. (red filter on left eye, green filter on right eye)
  5718. @item arcg
  5719. anaglyph red/cyan gray
  5720. (red filter on left eye, cyan filter on right eye)
  5721. @item arch
  5722. anaglyph red/cyan half colored
  5723. (red filter on left eye, cyan filter on right eye)
  5724. @item arcc
  5725. anaglyph red/cyan color
  5726. (red filter on left eye, cyan filter on right eye)
  5727. @item arcd
  5728. anaglyph red/cyan color optimized with the least squares projection of dubois
  5729. (red filter on left eye, cyan filter on right eye)
  5730. @item agmg
  5731. anaglyph green/magenta gray
  5732. (green filter on left eye, magenta filter on right eye)
  5733. @item agmh
  5734. anaglyph green/magenta half colored
  5735. (green filter on left eye, magenta filter on right eye)
  5736. @item agmc
  5737. anaglyph green/magenta colored
  5738. (green filter on left eye, magenta filter on right eye)
  5739. @item agmd
  5740. anaglyph green/magenta color optimized with the least squares projection of dubois
  5741. (green filter on left eye, magenta filter on right eye)
  5742. @item aybg
  5743. anaglyph yellow/blue gray
  5744. (yellow filter on left eye, blue filter on right eye)
  5745. @item aybh
  5746. anaglyph yellow/blue half colored
  5747. (yellow filter on left eye, blue filter on right eye)
  5748. @item aybc
  5749. anaglyph yellow/blue colored
  5750. (yellow filter on left eye, blue filter on right eye)
  5751. @item aybd
  5752. anaglyph yellow/blue color optimized with the least squares projection of dubois
  5753. (yellow filter on left eye, blue filter on right eye)
  5754. @item irl
  5755. interleaved rows (left eye has top row, right eye starts on next row)
  5756. @item irr
  5757. interleaved rows (right eye has top row, left eye starts on next row)
  5758. @item ml
  5759. mono output (left eye only)
  5760. @item mr
  5761. mono output (right eye only)
  5762. @end table
  5763. Default value is @samp{arcd}.
  5764. @end table
  5765. @subsection Examples
  5766. @itemize
  5767. @item
  5768. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  5769. @example
  5770. stereo3d=sbsl:aybd
  5771. @end example
  5772. @item
  5773. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  5774. @example
  5775. stereo3d=abl:sbsr
  5776. @end example
  5777. @end itemize
  5778. @section spp
  5779. Apply a simple postprocessing filter that compresses and decompresses the image
  5780. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  5781. and average the results.
  5782. The filter accepts the following options:
  5783. @table @option
  5784. @item quality
  5785. Set quality. This option defines the number of levels for averaging. It accepts
  5786. an integer in the range 0-6. If set to @code{0}, the filter will have no
  5787. effect. A value of @code{6} means the higher quality. For each increment of
  5788. that value the speed drops by a factor of approximately 2. Default value is
  5789. @code{3}.
  5790. @item qp
  5791. Force a constant quantization parameter. If not set, the filter will use the QP
  5792. from the video stream (if available).
  5793. @item mode
  5794. Set thresholding mode. Available modes are:
  5795. @table @samp
  5796. @item hard
  5797. Set hard thresholding (default).
  5798. @item soft
  5799. Set soft thresholding (better de-ringing effect, but likely blurrier).
  5800. @end table
  5801. @item use_bframe_qp
  5802. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5803. option may cause flicker since the B-Frames have often larger QP. Default is
  5804. @code{0} (not enabled).
  5805. @end table
  5806. @anchor{subtitles}
  5807. @section subtitles
  5808. Draw subtitles on top of input video using the libass library.
  5809. To enable compilation of this filter you need to configure FFmpeg with
  5810. @code{--enable-libass}. This filter also requires a build with libavcodec and
  5811. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  5812. Alpha) subtitles format.
  5813. The filter accepts the following options:
  5814. @table @option
  5815. @item filename, f
  5816. Set the filename of the subtitle file to read. It must be specified.
  5817. @item original_size
  5818. Specify the size of the original video, the video for which the ASS file
  5819. was composed. For the syntax of this option, check the "Video size" section in
  5820. the ffmpeg-utils manual. Due to a misdesign in ASS aspect ratio arithmetic,
  5821. this is necessary to correctly scale the fonts if the aspect ratio has been
  5822. changed.
  5823. @item charenc
  5824. Set subtitles input character encoding. @code{subtitles} filter only. Only
  5825. useful if not UTF-8.
  5826. @end table
  5827. If the first key is not specified, it is assumed that the first value
  5828. specifies the @option{filename}.
  5829. For example, to render the file @file{sub.srt} on top of the input
  5830. video, use the command:
  5831. @example
  5832. subtitles=sub.srt
  5833. @end example
  5834. which is equivalent to:
  5835. @example
  5836. subtitles=filename=sub.srt
  5837. @end example
  5838. @section super2xsai
  5839. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  5840. Interpolate) pixel art scaling algorithm.
  5841. Useful for enlarging pixel art images without reducing sharpness.
  5842. @section swapuv
  5843. Swap U & V plane.
  5844. @section telecine
  5845. Apply telecine process to the video.
  5846. This filter accepts the following options:
  5847. @table @option
  5848. @item first_field
  5849. @table @samp
  5850. @item top, t
  5851. top field first
  5852. @item bottom, b
  5853. bottom field first
  5854. The default value is @code{top}.
  5855. @end table
  5856. @item pattern
  5857. A string of numbers representing the pulldown pattern you wish to apply.
  5858. The default value is @code{23}.
  5859. @end table
  5860. @example
  5861. Some typical patterns:
  5862. NTSC output (30i):
  5863. 27.5p: 32222
  5864. 24p: 23 (classic)
  5865. 24p: 2332 (preferred)
  5866. 20p: 33
  5867. 18p: 334
  5868. 16p: 3444
  5869. PAL output (25i):
  5870. 27.5p: 12222
  5871. 24p: 222222222223 ("Euro pulldown")
  5872. 16.67p: 33
  5873. 16p: 33333334
  5874. @end example
  5875. @section thumbnail
  5876. Select the most representative frame in a given sequence of consecutive frames.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item n
  5880. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  5881. will pick one of them, and then handle the next batch of @var{n} frames until
  5882. the end. Default is @code{100}.
  5883. @end table
  5884. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  5885. value will result in a higher memory usage, so a high value is not recommended.
  5886. @subsection Examples
  5887. @itemize
  5888. @item
  5889. Extract one picture each 50 frames:
  5890. @example
  5891. thumbnail=50
  5892. @end example
  5893. @item
  5894. Complete example of a thumbnail creation with @command{ffmpeg}:
  5895. @example
  5896. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  5897. @end example
  5898. @end itemize
  5899. @section tile
  5900. Tile several successive frames together.
  5901. The filter accepts the following options:
  5902. @table @option
  5903. @item layout
  5904. Set the grid size (i.e. the number of lines and columns). For the syntax of
  5905. this option, check the "Video size" section in the ffmpeg-utils manual.
  5906. @item nb_frames
  5907. Set the maximum number of frames to render in the given area. It must be less
  5908. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  5909. the area will be used.
  5910. @item margin
  5911. Set the outer border margin in pixels.
  5912. @item padding
  5913. Set the inner border thickness (i.e. the number of pixels between frames). For
  5914. more advanced padding options (such as having different values for the edges),
  5915. refer to the pad video filter.
  5916. @item color
  5917. Specify the color of the unused areaFor the syntax of this option, check the
  5918. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  5919. is "black".
  5920. @end table
  5921. @subsection Examples
  5922. @itemize
  5923. @item
  5924. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  5925. @example
  5926. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  5927. @end example
  5928. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  5929. duplicating each output frame to accomodate the originally detected frame
  5930. rate.
  5931. @item
  5932. Display @code{5} pictures in an area of @code{3x2} frames,
  5933. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  5934. mixed flat and named options:
  5935. @example
  5936. tile=3x2:nb_frames=5:padding=7:margin=2
  5937. @end example
  5938. @end itemize
  5939. @section tinterlace
  5940. Perform various types of temporal field interlacing.
  5941. Frames are counted starting from 1, so the first input frame is
  5942. considered odd.
  5943. The filter accepts the following options:
  5944. @table @option
  5945. @item mode
  5946. Specify the mode of the interlacing. This option can also be specified
  5947. as a value alone. See below for a list of values for this option.
  5948. Available values are:
  5949. @table @samp
  5950. @item merge, 0
  5951. Move odd frames into the upper field, even into the lower field,
  5952. generating a double height frame at half frame rate.
  5953. @item drop_odd, 1
  5954. Only output even frames, odd frames are dropped, generating a frame with
  5955. unchanged height at half frame rate.
  5956. @item drop_even, 2
  5957. Only output odd frames, even frames are dropped, generating a frame with
  5958. unchanged height at half frame rate.
  5959. @item pad, 3
  5960. Expand each frame to full height, but pad alternate lines with black,
  5961. generating a frame with double height at the same input frame rate.
  5962. @item interleave_top, 4
  5963. Interleave the upper field from odd frames with the lower field from
  5964. even frames, generating a frame with unchanged height at half frame rate.
  5965. @item interleave_bottom, 5
  5966. Interleave the lower field from odd frames with the upper field from
  5967. even frames, generating a frame with unchanged height at half frame rate.
  5968. @item interlacex2, 6
  5969. Double frame rate with unchanged height. Frames are inserted each
  5970. containing the second temporal field from the previous input frame and
  5971. the first temporal field from the next input frame. This mode relies on
  5972. the top_field_first flag. Useful for interlaced video displays with no
  5973. field synchronisation.
  5974. @end table
  5975. Numeric values are deprecated but are accepted for backward
  5976. compatibility reasons.
  5977. Default mode is @code{merge}.
  5978. @item flags
  5979. Specify flags influencing the filter process.
  5980. Available value for @var{flags} is:
  5981. @table @option
  5982. @item low_pass_filter, vlfp
  5983. Enable vertical low-pass filtering in the filter.
  5984. Vertical low-pass filtering is required when creating an interlaced
  5985. destination from a progressive source which contains high-frequency
  5986. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  5987. patterning.
  5988. Vertical low-pass filtering can only be enabled for @option{mode}
  5989. @var{interleave_top} and @var{interleave_bottom}.
  5990. @end table
  5991. @end table
  5992. @section transpose
  5993. Transpose rows with columns in the input video and optionally flip it.
  5994. This filter accepts the following options:
  5995. @table @option
  5996. @item dir
  5997. Specify the transposition direction.
  5998. Can assume the following values:
  5999. @table @samp
  6000. @item 0, 4, cclock_flip
  6001. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  6002. @example
  6003. L.R L.l
  6004. . . -> . .
  6005. l.r R.r
  6006. @end example
  6007. @item 1, 5, clock
  6008. Rotate by 90 degrees clockwise, that is:
  6009. @example
  6010. L.R l.L
  6011. . . -> . .
  6012. l.r r.R
  6013. @end example
  6014. @item 2, 6, cclock
  6015. Rotate by 90 degrees counterclockwise, that is:
  6016. @example
  6017. L.R R.r
  6018. . . -> . .
  6019. l.r L.l
  6020. @end example
  6021. @item 3, 7, clock_flip
  6022. Rotate by 90 degrees clockwise and vertically flip, that is:
  6023. @example
  6024. L.R r.R
  6025. . . -> . .
  6026. l.r l.L
  6027. @end example
  6028. @end table
  6029. For values between 4-7, the transposition is only done if the input
  6030. video geometry is portrait and not landscape. These values are
  6031. deprecated, the @code{passthrough} option should be used instead.
  6032. Numerical values are deprecated, and should be dropped in favor of
  6033. symbolic constants.
  6034. @item passthrough
  6035. Do not apply the transposition if the input geometry matches the one
  6036. specified by the specified value. It accepts the following values:
  6037. @table @samp
  6038. @item none
  6039. Always apply transposition.
  6040. @item portrait
  6041. Preserve portrait geometry (when @var{height} >= @var{width}).
  6042. @item landscape
  6043. Preserve landscape geometry (when @var{width} >= @var{height}).
  6044. @end table
  6045. Default value is @code{none}.
  6046. @end table
  6047. For example to rotate by 90 degrees clockwise and preserve portrait
  6048. layout:
  6049. @example
  6050. transpose=dir=1:passthrough=portrait
  6051. @end example
  6052. The command above can also be specified as:
  6053. @example
  6054. transpose=1:portrait
  6055. @end example
  6056. @section trim
  6057. Trim the input so that the output contains one continuous subpart of the input.
  6058. This filter accepts the following options:
  6059. @table @option
  6060. @item start
  6061. Specify time of the start of the kept section, i.e. the frame with the
  6062. timestamp @var{start} will be the first frame in the output.
  6063. @item end
  6064. Specify time of the first frame that will be dropped, i.e. the frame
  6065. immediately preceding the one with the timestamp @var{end} will be the last
  6066. frame in the output.
  6067. @item start_pts
  6068. Same as @var{start}, except this option sets the start timestamp in timebase
  6069. units instead of seconds.
  6070. @item end_pts
  6071. Same as @var{end}, except this option sets the end timestamp in timebase units
  6072. instead of seconds.
  6073. @item duration
  6074. Specify maximum duration of the output.
  6075. @item start_frame
  6076. Number of the first frame that should be passed to output.
  6077. @item end_frame
  6078. Number of the first frame that should be dropped.
  6079. @end table
  6080. @option{start}, @option{end}, @option{duration} are expressed as time
  6081. duration specifications, check the "Time duration" section in the
  6082. ffmpeg-utils manual.
  6083. Note that the first two sets of the start/end options and the @option{duration}
  6084. option look at the frame timestamp, while the _frame variants simply count the
  6085. frames that pass through the filter. Also note that this filter does not modify
  6086. the timestamps. If you wish that the output timestamps start at zero, insert a
  6087. setpts filter after the trim filter.
  6088. If multiple start or end options are set, this filter tries to be greedy and
  6089. keep all the frames that match at least one of the specified constraints. To keep
  6090. only the part that matches all the constraints at once, chain multiple trim
  6091. filters.
  6092. The defaults are such that all the input is kept. So it is possible to set e.g.
  6093. just the end values to keep everything before the specified time.
  6094. Examples:
  6095. @itemize
  6096. @item
  6097. drop everything except the second minute of input
  6098. @example
  6099. ffmpeg -i INPUT -vf trim=60:120
  6100. @end example
  6101. @item
  6102. keep only the first second
  6103. @example
  6104. ffmpeg -i INPUT -vf trim=duration=1
  6105. @end example
  6106. @end itemize
  6107. @section unsharp
  6108. Sharpen or blur the input video.
  6109. It accepts the following parameters:
  6110. @table @option
  6111. @item luma_msize_x, lx
  6112. Set the luma matrix horizontal size. It must be an odd integer between
  6113. 3 and 63, default value is 5.
  6114. @item luma_msize_y, ly
  6115. Set the luma matrix vertical size. It must be an odd integer between 3
  6116. and 63, default value is 5.
  6117. @item luma_amount, la
  6118. Set the luma effect strength. It can be a float number, reasonable
  6119. values lay between -1.5 and 1.5.
  6120. Negative values will blur the input video, while positive values will
  6121. sharpen it, a value of zero will disable the effect.
  6122. Default value is 1.0.
  6123. @item chroma_msize_x, cx
  6124. Set the chroma matrix horizontal size. It must be an odd integer
  6125. between 3 and 63, default value is 5.
  6126. @item chroma_msize_y, cy
  6127. Set the chroma matrix vertical size. It must be an odd integer
  6128. between 3 and 63, default value is 5.
  6129. @item chroma_amount, ca
  6130. Set the chroma effect strength. It can be a float number, reasonable
  6131. values lay between -1.5 and 1.5.
  6132. Negative values will blur the input video, while positive values will
  6133. sharpen it, a value of zero will disable the effect.
  6134. Default value is 0.0.
  6135. @item opencl
  6136. If set to 1, specify using OpenCL capabilities, only available if
  6137. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  6138. @end table
  6139. All parameters are optional and default to the equivalent of the
  6140. string '5:5:1.0:5:5:0.0'.
  6141. @subsection Examples
  6142. @itemize
  6143. @item
  6144. Apply strong luma sharpen effect:
  6145. @example
  6146. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  6147. @end example
  6148. @item
  6149. Apply strong blur of both luma and chroma parameters:
  6150. @example
  6151. unsharp=7:7:-2:7:7:-2
  6152. @end example
  6153. @end itemize
  6154. @anchor{vidstabdetect}
  6155. @section vidstabdetect
  6156. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  6157. @ref{vidstabtransform} for pass 2.
  6158. This filter generates a file with relative translation and rotation
  6159. transform information about subsequent frames, which is then used by
  6160. the @ref{vidstabtransform} filter.
  6161. To enable compilation of this filter you need to configure FFmpeg with
  6162. @code{--enable-libvidstab}.
  6163. This filter accepts the following options:
  6164. @table @option
  6165. @item result
  6166. Set the path to the file used to write the transforms information.
  6167. Default value is @file{transforms.trf}.
  6168. @item shakiness
  6169. Set how shaky the video is and how quick the camera is. It accepts an
  6170. integer in the range 1-10, a value of 1 means little shakiness, a
  6171. value of 10 means strong shakiness. Default value is 5.
  6172. @item accuracy
  6173. Set the accuracy of the detection process. It must be a value in the
  6174. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  6175. accuracy. Default value is 15.
  6176. @item stepsize
  6177. Set stepsize of the search process. The region around minimum is
  6178. scanned with 1 pixel resolution. Default value is 6.
  6179. @item mincontrast
  6180. Set minimum contrast. Below this value a local measurement field is
  6181. discarded. Must be a floating point value in the range 0-1. Default
  6182. value is 0.3.
  6183. @item tripod
  6184. Set reference frame number for tripod mode.
  6185. If enabled, the motion of the frames is compared to a reference frame
  6186. in the filtered stream, identified by the specified number. The idea
  6187. is to compensate all movements in a more-or-less static scene and keep
  6188. the camera view absolutely still.
  6189. If set to 0, it is disabled. The frames are counted starting from 1.
  6190. @item show
  6191. Show fields and transforms in the resulting frames. It accepts an
  6192. integer in the range 0-2. Default value is 0, which disables any
  6193. visualization.
  6194. @end table
  6195. @subsection Examples
  6196. @itemize
  6197. @item
  6198. Use default values:
  6199. @example
  6200. vidstabdetect
  6201. @end example
  6202. @item
  6203. Analyze strongly shaky movie and put the results in file
  6204. @file{mytransforms.trf}:
  6205. @example
  6206. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  6207. @end example
  6208. @item
  6209. Visualize the result of internal transformations in the resulting
  6210. video:
  6211. @example
  6212. vidstabdetect=show=1
  6213. @end example
  6214. @item
  6215. Analyze a video with medium shakiness using @command{ffmpeg}:
  6216. @example
  6217. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  6218. @end example
  6219. @end itemize
  6220. @anchor{vidstabtransform}
  6221. @section vidstabtransform
  6222. Video stabilization/deshaking: pass 2 of 2,
  6223. see @ref{vidstabdetect} for pass 1.
  6224. Read a file with transform information for each frame and
  6225. apply/compensate them. Together with the @ref{vidstabdetect}
  6226. filter this can be used to deshake videos. See also
  6227. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  6228. the unsharp filter, see below.
  6229. To enable compilation of this filter you need to configure FFmpeg with
  6230. @code{--enable-libvidstab}.
  6231. @subsection Options
  6232. @table @option
  6233. @item input
  6234. Set path to the file used to read the transforms. Default value is
  6235. @file{transforms.trf}).
  6236. @item smoothing
  6237. Set the number of frames (value*2 + 1) used for lowpass filtering the
  6238. camera movements. Default value is 10.
  6239. For example a number of 10 means that 21 frames are used (10 in the
  6240. past and 10 in the future) to smoothen the motion in the video. A
  6241. larger values leads to a smoother video, but limits the acceleration
  6242. of the camera (pan/tilt movements). 0 is a special case where a
  6243. static camera is simulated.
  6244. @item optalgo
  6245. Set the camera path optimization algorithm.
  6246. Accepted values are:
  6247. @table @samp
  6248. @item gauss
  6249. gaussian kernel low-pass filter on camera motion (default)
  6250. @item avg
  6251. averaging on transformations
  6252. @end table
  6253. @item maxshift
  6254. Set maximal number of pixels to translate frames. Default value is -1,
  6255. meaning no limit.
  6256. @item maxangle
  6257. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  6258. value is -1, meaning no limit.
  6259. @item crop
  6260. Specify how to deal with borders that may be visible due to movement
  6261. compensation.
  6262. Available values are:
  6263. @table @samp
  6264. @item keep
  6265. keep image information from previous frame (default)
  6266. @item black
  6267. fill the border black
  6268. @end table
  6269. @item invert
  6270. Invert transforms if set to 1. Default value is 0.
  6271. @item relative
  6272. Consider transforms as relative to previsou frame if set to 1,
  6273. absolute if set to 0. Default value is 0.
  6274. @item zoom
  6275. Set percentage to zoom. A positive value will result in a zoom-in
  6276. effect, a negative value in a zoom-out effect. Default value is 0 (no
  6277. zoom).
  6278. @item optzoom
  6279. Set optimal zooming to avoid borders.
  6280. Accepted values are:
  6281. @table @samp
  6282. @item 0
  6283. disabled
  6284. @item 1
  6285. optimal static zoom value is determined (only very strong movements
  6286. will lead to visible borders) (default)
  6287. @item 2
  6288. optimal adaptive zoom value is determined (no borders will be
  6289. visible), see @option{zoomspeed}
  6290. @end table
  6291. Note that the value given at zoom is added to the one calculated here.
  6292. @item zoomspeed
  6293. Set percent to zoom maximally each frame (enabled when
  6294. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  6295. 0.25.
  6296. @item interpol
  6297. Specify type of interpolation.
  6298. Available values are:
  6299. @table @samp
  6300. @item no
  6301. no interpolation
  6302. @item linear
  6303. linear only horizontal
  6304. @item bilinear
  6305. linear in both directions (default)
  6306. @item bicubic
  6307. cubic in both directions (slow)
  6308. @end table
  6309. @item tripod
  6310. Enable virtual tripod mode if set to 1, which is equivalent to
  6311. @code{relative=0:smoothing=0}. Default value is 0.
  6312. Use also @code{tripod} option of @ref{vidstabdetect}.
  6313. @item debug
  6314. Increase log verbosity if set to 1. Also the detected global motions
  6315. are written to the temporary file @file{global_motions.trf}. Default
  6316. value is 0.
  6317. @end table
  6318. @subsection Examples
  6319. @itemize
  6320. @item
  6321. Use @command{ffmpeg} for a typical stabilization with default values:
  6322. @example
  6323. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  6324. @end example
  6325. Note the use of the unsharp filter which is always recommended.
  6326. @item
  6327. Zoom in a bit more and load transform data from a given file:
  6328. @example
  6329. vidstabtransform=zoom=5:input="mytransforms.trf"
  6330. @end example
  6331. @item
  6332. Smoothen the video even more:
  6333. @example
  6334. vidstabtransform=smoothing=30
  6335. @end example
  6336. @end itemize
  6337. @section vflip
  6338. Flip the input video vertically.
  6339. For example, to vertically flip a video with @command{ffmpeg}:
  6340. @example
  6341. ffmpeg -i in.avi -vf "vflip" out.avi
  6342. @end example
  6343. @section vignette
  6344. Make or reverse a natural vignetting effect.
  6345. The filter accepts the following options:
  6346. @table @option
  6347. @item angle, a
  6348. Set lens angle expression as a number of radians.
  6349. The value is clipped in the @code{[0,PI/2]} range.
  6350. Default value: @code{"PI/5"}
  6351. @item x0
  6352. @item y0
  6353. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  6354. by default.
  6355. @item mode
  6356. Set forward/backward mode.
  6357. Available modes are:
  6358. @table @samp
  6359. @item forward
  6360. The larger the distance from the central point, the darker the image becomes.
  6361. @item backward
  6362. The larger the distance from the central point, the brighter the image becomes.
  6363. This can be used to reverse a vignette effect, though there is no automatic
  6364. detection to extract the lens @option{angle} and other settings (yet). It can
  6365. also be used to create a burning effect.
  6366. @end table
  6367. Default value is @samp{forward}.
  6368. @item eval
  6369. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  6370. It accepts the following values:
  6371. @table @samp
  6372. @item init
  6373. Evaluate expressions only once during the filter initialization.
  6374. @item frame
  6375. Evaluate expressions for each incoming frame. This is way slower than the
  6376. @samp{init} mode since it requires all the scalers to be re-computed, but it
  6377. allows advanced dynamic expressions.
  6378. @end table
  6379. Default value is @samp{init}.
  6380. @item dither
  6381. Set dithering to reduce the circular banding effects. Default is @code{1}
  6382. (enabled).
  6383. @item aspect
  6384. Set vignette aspect. This setting allows to adjust the shape of the vignette.
  6385. Setting this value to the SAR of the input will make a rectangular vignetting
  6386. following the dimensions of the video.
  6387. Default is @code{1/1}.
  6388. @end table
  6389. @subsection Expressions
  6390. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  6391. following parameters.
  6392. @table @option
  6393. @item w
  6394. @item h
  6395. input width and height
  6396. @item n
  6397. the number of input frame, starting from 0
  6398. @item pts
  6399. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  6400. @var{TB} units, NAN if undefined
  6401. @item r
  6402. frame rate of the input video, NAN if the input frame rate is unknown
  6403. @item t
  6404. the PTS (Presentation TimeStamp) of the filtered video frame,
  6405. expressed in seconds, NAN if undefined
  6406. @item tb
  6407. time base of the input video
  6408. @end table
  6409. @subsection Examples
  6410. @itemize
  6411. @item
  6412. Apply simple strong vignetting effect:
  6413. @example
  6414. vignette=PI/4
  6415. @end example
  6416. @item
  6417. Make a flickering vignetting:
  6418. @example
  6419. vignette='PI/4+random(1)*PI/50':eval=frame
  6420. @end example
  6421. @end itemize
  6422. @section w3fdif
  6423. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  6424. Deinterlacing Filter").
  6425. Based on the process described by Martin Weston for BBC R&D, and
  6426. implemented based on the de-interlace algorithm written by Jim
  6427. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  6428. uses filter coefficients calculated by BBC R&D.
  6429. There are two sets of filter coefficients, so called "simple":
  6430. and "complex". Which set of filter coefficients is used can
  6431. be set by passing an optional parameter:
  6432. @table @option
  6433. @item filter
  6434. Set the interlacing filter coefficients. Accepts one of the following values:
  6435. @table @samp
  6436. @item simple
  6437. Simple filter coefficient set.
  6438. @item complex
  6439. More-complex filter coefficient set.
  6440. @end table
  6441. Default value is @samp{complex}.
  6442. @item deint
  6443. Specify which frames to deinterlace. Accept one of the following values:
  6444. @table @samp
  6445. @item all
  6446. Deinterlace all frames,
  6447. @item interlaced
  6448. Only deinterlace frames marked as interlaced.
  6449. @end table
  6450. Default value is @samp{all}.
  6451. @end table
  6452. @anchor{yadif}
  6453. @section yadif
  6454. Deinterlace the input video ("yadif" means "yet another deinterlacing
  6455. filter").
  6456. This filter accepts the following options:
  6457. @table @option
  6458. @item mode
  6459. The interlacing mode to adopt, accepts one of the following values:
  6460. @table @option
  6461. @item 0, send_frame
  6462. output 1 frame for each frame
  6463. @item 1, send_field
  6464. output 1 frame for each field
  6465. @item 2, send_frame_nospatial
  6466. like @code{send_frame} but skip spatial interlacing check
  6467. @item 3, send_field_nospatial
  6468. like @code{send_field} but skip spatial interlacing check
  6469. @end table
  6470. Default value is @code{send_frame}.
  6471. @item parity
  6472. The picture field parity assumed for the input interlaced video, accepts one of
  6473. the following values:
  6474. @table @option
  6475. @item 0, tff
  6476. assume top field first
  6477. @item 1, bff
  6478. assume bottom field first
  6479. @item -1, auto
  6480. enable automatic detection
  6481. @end table
  6482. Default value is @code{auto}.
  6483. If interlacing is unknown or decoder does not export this information,
  6484. top field first will be assumed.
  6485. @item deint
  6486. Specify which frames to deinterlace. Accept one of the following
  6487. values:
  6488. @table @option
  6489. @item 0, all
  6490. deinterlace all frames
  6491. @item 1, interlaced
  6492. only deinterlace frames marked as interlaced
  6493. @end table
  6494. Default value is @code{all}.
  6495. @end table
  6496. @c man end VIDEO FILTERS
  6497. @chapter Video Sources
  6498. @c man begin VIDEO SOURCES
  6499. Below is a description of the currently available video sources.
  6500. @section buffer
  6501. Buffer video frames, and make them available to the filter chain.
  6502. This source is mainly intended for a programmatic use, in particular
  6503. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  6504. This source accepts the following options:
  6505. @table @option
  6506. @item video_size
  6507. Specify the size (width and height) of the buffered video frames. For the
  6508. syntax of this option, check the "Video size" section in the ffmpeg-utils
  6509. manual.
  6510. @item width
  6511. Input video width.
  6512. @item height
  6513. Input video height.
  6514. @item pix_fmt
  6515. A string representing the pixel format of the buffered video frames.
  6516. It may be a number corresponding to a pixel format, or a pixel format
  6517. name.
  6518. @item time_base
  6519. Specify the timebase assumed by the timestamps of the buffered frames.
  6520. @item frame_rate
  6521. Specify the frame rate expected for the video stream.
  6522. @item pixel_aspect, sar
  6523. Specify the sample aspect ratio assumed by the video frames.
  6524. @item sws_param
  6525. Specify the optional parameters to be used for the scale filter which
  6526. is automatically inserted when an input change is detected in the
  6527. input size or format.
  6528. @end table
  6529. For example:
  6530. @example
  6531. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  6532. @end example
  6533. will instruct the source to accept video frames with size 320x240 and
  6534. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  6535. square pixels (1:1 sample aspect ratio).
  6536. Since the pixel format with name "yuv410p" corresponds to the number 6
  6537. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  6538. this example corresponds to:
  6539. @example
  6540. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  6541. @end example
  6542. Alternatively, the options can be specified as a flat string, but this
  6543. syntax is deprecated:
  6544. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  6545. @section cellauto
  6546. Create a pattern generated by an elementary cellular automaton.
  6547. The initial state of the cellular automaton can be defined through the
  6548. @option{filename}, and @option{pattern} options. If such options are
  6549. not specified an initial state is created randomly.
  6550. At each new frame a new row in the video is filled with the result of
  6551. the cellular automaton next generation. The behavior when the whole
  6552. frame is filled is defined by the @option{scroll} option.
  6553. This source accepts the following options:
  6554. @table @option
  6555. @item filename, f
  6556. Read the initial cellular automaton state, i.e. the starting row, from
  6557. the specified file.
  6558. In the file, each non-whitespace character is considered an alive
  6559. cell, a newline will terminate the row, and further characters in the
  6560. file will be ignored.
  6561. @item pattern, p
  6562. Read the initial cellular automaton state, i.e. the starting row, from
  6563. the specified string.
  6564. Each non-whitespace character in the string is considered an alive
  6565. cell, a newline will terminate the row, and further characters in the
  6566. string will be ignored.
  6567. @item rate, r
  6568. Set the video rate, that is the number of frames generated per second.
  6569. Default is 25.
  6570. @item random_fill_ratio, ratio
  6571. Set the random fill ratio for the initial cellular automaton row. It
  6572. is a floating point number value ranging from 0 to 1, defaults to
  6573. 1/PHI.
  6574. This option is ignored when a file or a pattern is specified.
  6575. @item random_seed, seed
  6576. Set the seed for filling randomly the initial row, must be an integer
  6577. included between 0 and UINT32_MAX. If not specified, or if explicitly
  6578. set to -1, the filter will try to use a good random seed on a best
  6579. effort basis.
  6580. @item rule
  6581. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  6582. Default value is 110.
  6583. @item size, s
  6584. Set the size of the output video. For the syntax of this option, check
  6585. the "Video size" section in the ffmpeg-utils manual.
  6586. If @option{filename} or @option{pattern} is specified, the size is set
  6587. by default to the width of the specified initial state row, and the
  6588. height is set to @var{width} * PHI.
  6589. If @option{size} is set, it must contain the width of the specified
  6590. pattern string, and the specified pattern will be centered in the
  6591. larger row.
  6592. If a filename or a pattern string is not specified, the size value
  6593. defaults to "320x518" (used for a randomly generated initial state).
  6594. @item scroll
  6595. If set to 1, scroll the output upward when all the rows in the output
  6596. have been already filled. If set to 0, the new generated row will be
  6597. written over the top row just after the bottom row is filled.
  6598. Defaults to 1.
  6599. @item start_full, full
  6600. If set to 1, completely fill the output with generated rows before
  6601. outputting the first frame.
  6602. This is the default behavior, for disabling set the value to 0.
  6603. @item stitch
  6604. If set to 1, stitch the left and right row edges together.
  6605. This is the default behavior, for disabling set the value to 0.
  6606. @end table
  6607. @subsection Examples
  6608. @itemize
  6609. @item
  6610. Read the initial state from @file{pattern}, and specify an output of
  6611. size 200x400.
  6612. @example
  6613. cellauto=f=pattern:s=200x400
  6614. @end example
  6615. @item
  6616. Generate a random initial row with a width of 200 cells, with a fill
  6617. ratio of 2/3:
  6618. @example
  6619. cellauto=ratio=2/3:s=200x200
  6620. @end example
  6621. @item
  6622. Create a pattern generated by rule 18 starting by a single alive cell
  6623. centered on an initial row with width 100:
  6624. @example
  6625. cellauto=p=@@:s=100x400:full=0:rule=18
  6626. @end example
  6627. @item
  6628. Specify a more elaborated initial pattern:
  6629. @example
  6630. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  6631. @end example
  6632. @end itemize
  6633. @section mandelbrot
  6634. Generate a Mandelbrot set fractal, and progressively zoom towards the
  6635. point specified with @var{start_x} and @var{start_y}.
  6636. This source accepts the following options:
  6637. @table @option
  6638. @item end_pts
  6639. Set the terminal pts value. Default value is 400.
  6640. @item end_scale
  6641. Set the terminal scale value.
  6642. Must be a floating point value. Default value is 0.3.
  6643. @item inner
  6644. Set the inner coloring mode, that is the algorithm used to draw the
  6645. Mandelbrot fractal internal region.
  6646. It shall assume one of the following values:
  6647. @table @option
  6648. @item black
  6649. Set black mode.
  6650. @item convergence
  6651. Show time until convergence.
  6652. @item mincol
  6653. Set color based on point closest to the origin of the iterations.
  6654. @item period
  6655. Set period mode.
  6656. @end table
  6657. Default value is @var{mincol}.
  6658. @item bailout
  6659. Set the bailout value. Default value is 10.0.
  6660. @item maxiter
  6661. Set the maximum of iterations performed by the rendering
  6662. algorithm. Default value is 7189.
  6663. @item outer
  6664. Set outer coloring mode.
  6665. It shall assume one of following values:
  6666. @table @option
  6667. @item iteration_count
  6668. Set iteration cound mode.
  6669. @item normalized_iteration_count
  6670. set normalized iteration count mode.
  6671. @end table
  6672. Default value is @var{normalized_iteration_count}.
  6673. @item rate, r
  6674. Set frame rate, expressed as number of frames per second. Default
  6675. value is "25".
  6676. @item size, s
  6677. Set frame size. For the syntax of this option, check the "Video
  6678. size" section in the ffmpeg-utils manual. Default value is "640x480".
  6679. @item start_scale
  6680. Set the initial scale value. Default value is 3.0.
  6681. @item start_x
  6682. Set the initial x position. Must be a floating point value between
  6683. -100 and 100. Default value is -0.743643887037158704752191506114774.
  6684. @item start_y
  6685. Set the initial y position. Must be a floating point value between
  6686. -100 and 100. Default value is -0.131825904205311970493132056385139.
  6687. @end table
  6688. @section mptestsrc
  6689. Generate various test patterns, as generated by the MPlayer test filter.
  6690. The size of the generated video is fixed, and is 256x256.
  6691. This source is useful in particular for testing encoding features.
  6692. This source accepts the following options:
  6693. @table @option
  6694. @item rate, r
  6695. Specify the frame rate of the sourced video, as the number of frames
  6696. generated per second. It has to be a string in the format
  6697. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  6698. number or a valid video frame rate abbreviation. The default value is
  6699. "25".
  6700. @item duration, d
  6701. Set the video duration of the sourced video. The accepted syntax is:
  6702. @example
  6703. [-]HH:MM:SS[.m...]
  6704. [-]S+[.m...]
  6705. @end example
  6706. See also the function @code{av_parse_time()}.
  6707. If not specified, or the expressed duration is negative, the video is
  6708. supposed to be generated forever.
  6709. @item test, t
  6710. Set the number or the name of the test to perform. Supported tests are:
  6711. @table @option
  6712. @item dc_luma
  6713. @item dc_chroma
  6714. @item freq_luma
  6715. @item freq_chroma
  6716. @item amp_luma
  6717. @item amp_chroma
  6718. @item cbp
  6719. @item mv
  6720. @item ring1
  6721. @item ring2
  6722. @item all
  6723. @end table
  6724. Default value is "all", which will cycle through the list of all tests.
  6725. @end table
  6726. For example the following:
  6727. @example
  6728. testsrc=t=dc_luma
  6729. @end example
  6730. will generate a "dc_luma" test pattern.
  6731. @section frei0r_src
  6732. Provide a frei0r source.
  6733. To enable compilation of this filter you need to install the frei0r
  6734. header and configure FFmpeg with @code{--enable-frei0r}.
  6735. This source accepts the following options:
  6736. @table @option
  6737. @item size
  6738. The size of the video to generate. For the syntax of this option, check the
  6739. "Video size" section in the ffmpeg-utils manual.
  6740. @item framerate
  6741. Framerate of the generated video, may be a string of the form
  6742. @var{num}/@var{den} or a frame rate abbreviation.
  6743. @item filter_name
  6744. The name to the frei0r source to load. For more information regarding frei0r and
  6745. how to set the parameters read the section @ref{frei0r} in the description of
  6746. the video filters.
  6747. @item filter_params
  6748. A '|'-separated list of parameters to pass to the frei0r source.
  6749. @end table
  6750. For example, to generate a frei0r partik0l source with size 200x200
  6751. and frame rate 10 which is overlayed on the overlay filter main input:
  6752. @example
  6753. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  6754. @end example
  6755. @section life
  6756. Generate a life pattern.
  6757. This source is based on a generalization of John Conway's life game.
  6758. The sourced input represents a life grid, each pixel represents a cell
  6759. which can be in one of two possible states, alive or dead. Every cell
  6760. interacts with its eight neighbours, which are the cells that are
  6761. horizontally, vertically, or diagonally adjacent.
  6762. At each interaction the grid evolves according to the adopted rule,
  6763. which specifies the number of neighbor alive cells which will make a
  6764. cell stay alive or born. The @option{rule} option allows to specify
  6765. the rule to adopt.
  6766. This source accepts the following options:
  6767. @table @option
  6768. @item filename, f
  6769. Set the file from which to read the initial grid state. In the file,
  6770. each non-whitespace character is considered an alive cell, and newline
  6771. is used to delimit the end of each row.
  6772. If this option is not specified, the initial grid is generated
  6773. randomly.
  6774. @item rate, r
  6775. Set the video rate, that is the number of frames generated per second.
  6776. Default is 25.
  6777. @item random_fill_ratio, ratio
  6778. Set the random fill ratio for the initial random grid. It is a
  6779. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  6780. It is ignored when a file is specified.
  6781. @item random_seed, seed
  6782. Set the seed for filling the initial random grid, must be an integer
  6783. included between 0 and UINT32_MAX. If not specified, or if explicitly
  6784. set to -1, the filter will try to use a good random seed on a best
  6785. effort basis.
  6786. @item rule
  6787. Set the life rule.
  6788. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  6789. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  6790. @var{NS} specifies the number of alive neighbor cells which make a
  6791. live cell stay alive, and @var{NB} the number of alive neighbor cells
  6792. which make a dead cell to become alive (i.e. to "born").
  6793. "s" and "b" can be used in place of "S" and "B", respectively.
  6794. Alternatively a rule can be specified by an 18-bits integer. The 9
  6795. high order bits are used to encode the next cell state if it is alive
  6796. for each number of neighbor alive cells, the low order bits specify
  6797. the rule for "borning" new cells. Higher order bits encode for an
  6798. higher number of neighbor cells.
  6799. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  6800. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  6801. Default value is "S23/B3", which is the original Conway's game of life
  6802. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  6803. cells, and will born a new cell if there are three alive cells around
  6804. a dead cell.
  6805. @item size, s
  6806. Set the size of the output video. For the syntax of this option, check the
  6807. "Video size" section in the ffmpeg-utils manual.
  6808. If @option{filename} is specified, the size is set by default to the
  6809. same size of the input file. If @option{size} is set, it must contain
  6810. the size specified in the input file, and the initial grid defined in
  6811. that file is centered in the larger resulting area.
  6812. If a filename is not specified, the size value defaults to "320x240"
  6813. (used for a randomly generated initial grid).
  6814. @item stitch
  6815. If set to 1, stitch the left and right grid edges together, and the
  6816. top and bottom edges also. Defaults to 1.
  6817. @item mold
  6818. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  6819. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  6820. value from 0 to 255.
  6821. @item life_color
  6822. Set the color of living (or new born) cells.
  6823. @item death_color
  6824. Set the color of dead cells. If @option{mold} is set, this is the first color
  6825. used to represent a dead cell.
  6826. @item mold_color
  6827. Set mold color, for definitely dead and moldy cells.
  6828. For the syntax of these 3 color options, check the "Color" section in the
  6829. ffmpeg-utils manual.
  6830. @end table
  6831. @subsection Examples
  6832. @itemize
  6833. @item
  6834. Read a grid from @file{pattern}, and center it on a grid of size
  6835. 300x300 pixels:
  6836. @example
  6837. life=f=pattern:s=300x300
  6838. @end example
  6839. @item
  6840. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  6841. @example
  6842. life=ratio=2/3:s=200x200
  6843. @end example
  6844. @item
  6845. Specify a custom rule for evolving a randomly generated grid:
  6846. @example
  6847. life=rule=S14/B34
  6848. @end example
  6849. @item
  6850. Full example with slow death effect (mold) using @command{ffplay}:
  6851. @example
  6852. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  6853. @end example
  6854. @end itemize
  6855. @anchor{color}
  6856. @anchor{haldclutsrc}
  6857. @anchor{nullsrc}
  6858. @anchor{rgbtestsrc}
  6859. @anchor{smptebars}
  6860. @anchor{smptehdbars}
  6861. @anchor{testsrc}
  6862. @section color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  6863. The @code{color} source provides an uniformly colored input.
  6864. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  6865. @ref{haldclut} filter.
  6866. The @code{nullsrc} source returns unprocessed video frames. It is
  6867. mainly useful to be employed in analysis / debugging tools, or as the
  6868. source for filters which ignore the input data.
  6869. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  6870. detecting RGB vs BGR issues. You should see a red, green and blue
  6871. stripe from top to bottom.
  6872. The @code{smptebars} source generates a color bars pattern, based on
  6873. the SMPTE Engineering Guideline EG 1-1990.
  6874. The @code{smptehdbars} source generates a color bars pattern, based on
  6875. the SMPTE RP 219-2002.
  6876. The @code{testsrc} source generates a test video pattern, showing a
  6877. color pattern, a scrolling gradient and a timestamp. This is mainly
  6878. intended for testing purposes.
  6879. The sources accept the following options:
  6880. @table @option
  6881. @item color, c
  6882. Specify the color of the source, only available in the @code{color}
  6883. source. For the syntax of this option, check the "Color" section in the
  6884. ffmpeg-utils manual.
  6885. @item level
  6886. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  6887. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  6888. pixels to be used as identity matrix for 3D lookup tables. Each component is
  6889. coded on a @code{1/(N*N)} scale.
  6890. @item size, s
  6891. Specify the size of the sourced video. For the syntax of this option, check the
  6892. "Video size" section in the ffmpeg-utils manual. The default value is
  6893. "320x240".
  6894. This option is not available with the @code{haldclutsrc} filter.
  6895. @item rate, r
  6896. Specify the frame rate of the sourced video, as the number of frames
  6897. generated per second. It has to be a string in the format
  6898. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  6899. number or a valid video frame rate abbreviation. The default value is
  6900. "25".
  6901. @item sar
  6902. Set the sample aspect ratio of the sourced video.
  6903. @item duration, d
  6904. Set the video duration of the sourced video. The accepted syntax is:
  6905. @example
  6906. [-]HH[:MM[:SS[.m...]]]
  6907. [-]S+[.m...]
  6908. @end example
  6909. See also the function @code{av_parse_time()}.
  6910. If not specified, or the expressed duration is negative, the video is
  6911. supposed to be generated forever.
  6912. @item decimals, n
  6913. Set the number of decimals to show in the timestamp, only available in the
  6914. @code{testsrc} source.
  6915. The displayed timestamp value will correspond to the original
  6916. timestamp value multiplied by the power of 10 of the specified
  6917. value. Default value is 0.
  6918. @end table
  6919. For example the following:
  6920. @example
  6921. testsrc=duration=5.3:size=qcif:rate=10
  6922. @end example
  6923. will generate a video with a duration of 5.3 seconds, with size
  6924. 176x144 and a frame rate of 10 frames per second.
  6925. The following graph description will generate a red source
  6926. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  6927. frames per second.
  6928. @example
  6929. color=c=red@@0.2:s=qcif:r=10
  6930. @end example
  6931. If the input content is to be ignored, @code{nullsrc} can be used. The
  6932. following command generates noise in the luminance plane by employing
  6933. the @code{geq} filter:
  6934. @example
  6935. nullsrc=s=256x256, geq=random(1)*255:128:128
  6936. @end example
  6937. @subsection Commands
  6938. The @code{color} source supports the following commands:
  6939. @table @option
  6940. @item c, color
  6941. Set the color of the created image. Accepts the same syntax of the
  6942. corresponding @option{color} option.
  6943. @end table
  6944. @c man end VIDEO SOURCES
  6945. @chapter Video Sinks
  6946. @c man begin VIDEO SINKS
  6947. Below is a description of the currently available video sinks.
  6948. @section buffersink
  6949. Buffer video frames, and make them available to the end of the filter
  6950. graph.
  6951. This sink is mainly intended for a programmatic use, in particular
  6952. through the interface defined in @file{libavfilter/buffersink.h}
  6953. or the options system.
  6954. It accepts a pointer to an AVBufferSinkContext structure, which
  6955. defines the incoming buffers' formats, to be passed as the opaque
  6956. parameter to @code{avfilter_init_filter} for initialization.
  6957. @section nullsink
  6958. Null video sink, do absolutely nothing with the input video. It is
  6959. mainly useful as a template and to be employed in analysis / debugging
  6960. tools.
  6961. @c man end VIDEO SINKS
  6962. @chapter Multimedia Filters
  6963. @c man begin MULTIMEDIA FILTERS
  6964. Below is a description of the currently available multimedia filters.
  6965. @section avectorscope
  6966. Convert input audio to a video output, representing the audio vector
  6967. scope.
  6968. The filter is used to measure the difference between channels of stereo
  6969. audio stream. A monoaural signal, consisting of identical left and right
  6970. signal, results in straight vertical line. Any stereo separation is visible
  6971. as a deviation from this line, creating a Lissajous figure.
  6972. If the straight (or deviation from it) but horizontal line appears this
  6973. indicates that the left and right channels are out of phase.
  6974. The filter accepts the following options:
  6975. @table @option
  6976. @item mode, m
  6977. Set the vectorscope mode.
  6978. Available values are:
  6979. @table @samp
  6980. @item lissajous
  6981. Lissajous rotated by 45 degrees.
  6982. @item lissajous_xy
  6983. Same as above but not rotated.
  6984. @end table
  6985. Default value is @samp{lissajous}.
  6986. @item size, s
  6987. Set the video size for the output. For the syntax of this option, check the "Video size"
  6988. section in the ffmpeg-utils manual. Default value is @code{400x400}.
  6989. @item rate, r
  6990. Set the output frame rate. Default value is @code{25}.
  6991. @item rc
  6992. @item gc
  6993. @item bc
  6994. Specify the red, green and blue contrast. Default values are @code{40}, @code{160} and @code{80}.
  6995. Allowed range is @code{[0, 255]}.
  6996. @item rf
  6997. @item gf
  6998. @item bf
  6999. Specify the red, green and blue fade. Default values are @code{15}, @code{10} and @code{5}.
  7000. Allowed range is @code{[0, 255]}.
  7001. @item zoom
  7002. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  7003. @end table
  7004. @subsection Examples
  7005. @itemize
  7006. @item
  7007. Complete example using @command{ffplay}:
  7008. @example
  7009. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  7010. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  7011. @end example
  7012. @end itemize
  7013. @section concat
  7014. Concatenate audio and video streams, joining them together one after the
  7015. other.
  7016. The filter works on segments of synchronized video and audio streams. All
  7017. segments must have the same number of streams of each type, and that will
  7018. also be the number of streams at output.
  7019. The filter accepts the following options:
  7020. @table @option
  7021. @item n
  7022. Set the number of segments. Default is 2.
  7023. @item v
  7024. Set the number of output video streams, that is also the number of video
  7025. streams in each segment. Default is 1.
  7026. @item a
  7027. Set the number of output audio streams, that is also the number of video
  7028. streams in each segment. Default is 0.
  7029. @item unsafe
  7030. Activate unsafe mode: do not fail if segments have a different format.
  7031. @end table
  7032. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  7033. @var{a} audio outputs.
  7034. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  7035. segment, in the same order as the outputs, then the inputs for the second
  7036. segment, etc.
  7037. Related streams do not always have exactly the same duration, for various
  7038. reasons including codec frame size or sloppy authoring. For that reason,
  7039. related synchronized streams (e.g. a video and its audio track) should be
  7040. concatenated at once. The concat filter will use the duration of the longest
  7041. stream in each segment (except the last one), and if necessary pad shorter
  7042. audio streams with silence.
  7043. For this filter to work correctly, all segments must start at timestamp 0.
  7044. All corresponding streams must have the same parameters in all segments; the
  7045. filtering system will automatically select a common pixel format for video
  7046. streams, and a common sample format, sample rate and channel layout for
  7047. audio streams, but other settings, such as resolution, must be converted
  7048. explicitly by the user.
  7049. Different frame rates are acceptable but will result in variable frame rate
  7050. at output; be sure to configure the output file to handle it.
  7051. @subsection Examples
  7052. @itemize
  7053. @item
  7054. Concatenate an opening, an episode and an ending, all in bilingual version
  7055. (video in stream 0, audio in streams 1 and 2):
  7056. @example
  7057. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  7058. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  7059. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  7060. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  7061. @end example
  7062. @item
  7063. Concatenate two parts, handling audio and video separately, using the
  7064. (a)movie sources, and adjusting the resolution:
  7065. @example
  7066. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  7067. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  7068. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  7069. @end example
  7070. Note that a desync will happen at the stitch if the audio and video streams
  7071. do not have exactly the same duration in the first file.
  7072. @end itemize
  7073. @section ebur128
  7074. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  7075. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  7076. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  7077. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  7078. The filter also has a video output (see the @var{video} option) with a real
  7079. time graph to observe the loudness evolution. The graphic contains the logged
  7080. message mentioned above, so it is not printed anymore when this option is set,
  7081. unless the verbose logging is set. The main graphing area contains the
  7082. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  7083. the momentary loudness (400 milliseconds).
  7084. More information about the Loudness Recommendation EBU R128 on
  7085. @url{http://tech.ebu.ch/loudness}.
  7086. The filter accepts the following options:
  7087. @table @option
  7088. @item video
  7089. Activate the video output. The audio stream is passed unchanged whether this
  7090. option is set or no. The video stream will be the first output stream if
  7091. activated. Default is @code{0}.
  7092. @item size
  7093. Set the video size. This option is for video only. For the syntax of this
  7094. option, check the "Video size" section in the ffmpeg-utils manual. Default
  7095. and minimum resolution is @code{640x480}.
  7096. @item meter
  7097. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  7098. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  7099. other integer value between this range is allowed.
  7100. @item metadata
  7101. Set metadata injection. If set to @code{1}, the audio input will be segmented
  7102. into 100ms output frames, each of them containing various loudness information
  7103. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  7104. Default is @code{0}.
  7105. @item framelog
  7106. Force the frame logging level.
  7107. Available values are:
  7108. @table @samp
  7109. @item info
  7110. information logging level
  7111. @item verbose
  7112. verbose logging level
  7113. @end table
  7114. By default, the logging level is set to @var{info}. If the @option{video} or
  7115. the @option{metadata} options are set, it switches to @var{verbose}.
  7116. @end table
  7117. @subsection Examples
  7118. @itemize
  7119. @item
  7120. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  7121. @example
  7122. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  7123. @end example
  7124. @item
  7125. Run an analysis with @command{ffmpeg}:
  7126. @example
  7127. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  7128. @end example
  7129. @end itemize
  7130. @section interleave, ainterleave
  7131. Temporally interleave frames from several inputs.
  7132. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  7133. These filters read frames from several inputs and send the oldest
  7134. queued frame to the output.
  7135. Input streams must have a well defined, monotonically increasing frame
  7136. timestamp values.
  7137. In order to submit one frame to output, these filters need to enqueue
  7138. at least one frame for each input, so they cannot work in case one
  7139. input is not yet terminated and will not receive incoming frames.
  7140. For example consider the case when one input is a @code{select} filter
  7141. which always drop input frames. The @code{interleave} filter will keep
  7142. reading from that input, but it will never be able to send new frames
  7143. to output until the input will send an end-of-stream signal.
  7144. Also, depending on inputs synchronization, the filters will drop
  7145. frames in case one input receives more frames than the other ones, and
  7146. the queue is already filled.
  7147. These filters accept the following options:
  7148. @table @option
  7149. @item nb_inputs, n
  7150. Set the number of different inputs, it is 2 by default.
  7151. @end table
  7152. @subsection Examples
  7153. @itemize
  7154. @item
  7155. Interleave frames belonging to different streams using @command{ffmpeg}:
  7156. @example
  7157. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  7158. @end example
  7159. @item
  7160. Add flickering blur effect:
  7161. @example
  7162. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  7163. @end example
  7164. @end itemize
  7165. @section perms, aperms
  7166. Set read/write permissions for the output frames.
  7167. These filters are mainly aimed at developers to test direct path in the
  7168. following filter in the filtergraph.
  7169. The filters accept the following options:
  7170. @table @option
  7171. @item mode
  7172. Select the permissions mode.
  7173. It accepts the following values:
  7174. @table @samp
  7175. @item none
  7176. Do nothing. This is the default.
  7177. @item ro
  7178. Set all the output frames read-only.
  7179. @item rw
  7180. Set all the output frames directly writable.
  7181. @item toggle
  7182. Make the frame read-only if writable, and writable if read-only.
  7183. @item random
  7184. Set each output frame read-only or writable randomly.
  7185. @end table
  7186. @item seed
  7187. Set the seed for the @var{random} mode, must be an integer included between
  7188. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7189. @code{-1}, the filter will try to use a good random seed on a best effort
  7190. basis.
  7191. @end table
  7192. Note: in case of auto-inserted filter between the permission filter and the
  7193. following one, the permission might not be received as expected in that
  7194. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  7195. perms/aperms filter can avoid this problem.
  7196. @section select, aselect
  7197. Select frames to pass in output.
  7198. This filter accepts the following options:
  7199. @table @option
  7200. @item expr, e
  7201. Set expression, which is evaluated for each input frame.
  7202. If the expression is evaluated to zero, the frame is discarded.
  7203. If the evaluation result is negative or NaN, the frame is sent to the
  7204. first output; otherwise it is sent to the output with index
  7205. @code{ceil(val)-1}, assuming that the input index starts from 0.
  7206. For example a value of @code{1.2} corresponds to the output with index
  7207. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  7208. @item outputs, n
  7209. Set the number of outputs. The output to which to send the selected
  7210. frame is based on the result of the evaluation. Default value is 1.
  7211. @end table
  7212. The expression can contain the following constants:
  7213. @table @option
  7214. @item n
  7215. the sequential number of the filtered frame, starting from 0
  7216. @item selected_n
  7217. the sequential number of the selected frame, starting from 0
  7218. @item prev_selected_n
  7219. the sequential number of the last selected frame, NAN if undefined
  7220. @item TB
  7221. timebase of the input timestamps
  7222. @item pts
  7223. the PTS (Presentation TimeStamp) of the filtered video frame,
  7224. expressed in @var{TB} units, NAN if undefined
  7225. @item t
  7226. the PTS (Presentation TimeStamp) of the filtered video frame,
  7227. expressed in seconds, NAN if undefined
  7228. @item prev_pts
  7229. the PTS of the previously filtered video frame, NAN if undefined
  7230. @item prev_selected_pts
  7231. the PTS of the last previously filtered video frame, NAN if undefined
  7232. @item prev_selected_t
  7233. the PTS of the last previously selected video frame, NAN if undefined
  7234. @item start_pts
  7235. the PTS of the first video frame in the video, NAN if undefined
  7236. @item start_t
  7237. the time of the first video frame in the video, NAN if undefined
  7238. @item pict_type @emph{(video only)}
  7239. the type of the filtered frame, can assume one of the following
  7240. values:
  7241. @table @option
  7242. @item I
  7243. @item P
  7244. @item B
  7245. @item S
  7246. @item SI
  7247. @item SP
  7248. @item BI
  7249. @end table
  7250. @item interlace_type @emph{(video only)}
  7251. the frame interlace type, can assume one of the following values:
  7252. @table @option
  7253. @item PROGRESSIVE
  7254. the frame is progressive (not interlaced)
  7255. @item TOPFIRST
  7256. the frame is top-field-first
  7257. @item BOTTOMFIRST
  7258. the frame is bottom-field-first
  7259. @end table
  7260. @item consumed_sample_n @emph{(audio only)}
  7261. the number of selected samples before the current frame
  7262. @item samples_n @emph{(audio only)}
  7263. the number of samples in the current frame
  7264. @item sample_rate @emph{(audio only)}
  7265. the input sample rate
  7266. @item key
  7267. 1 if the filtered frame is a key-frame, 0 otherwise
  7268. @item pos
  7269. the position in the file of the filtered frame, -1 if the information
  7270. is not available (e.g. for synthetic video)
  7271. @item scene @emph{(video only)}
  7272. value between 0 and 1 to indicate a new scene; a low value reflects a low
  7273. probability for the current frame to introduce a new scene, while a higher
  7274. value means the current frame is more likely to be one (see the example below)
  7275. @end table
  7276. The default value of the select expression is "1".
  7277. @subsection Examples
  7278. @itemize
  7279. @item
  7280. Select all frames in input:
  7281. @example
  7282. select
  7283. @end example
  7284. The example above is the same as:
  7285. @example
  7286. select=1
  7287. @end example
  7288. @item
  7289. Skip all frames:
  7290. @example
  7291. select=0
  7292. @end example
  7293. @item
  7294. Select only I-frames:
  7295. @example
  7296. select='eq(pict_type\,I)'
  7297. @end example
  7298. @item
  7299. Select one frame every 100:
  7300. @example
  7301. select='not(mod(n\,100))'
  7302. @end example
  7303. @item
  7304. Select only frames contained in the 10-20 time interval:
  7305. @example
  7306. select=between(t\,10\,20)
  7307. @end example
  7308. @item
  7309. Select only I frames contained in the 10-20 time interval:
  7310. @example
  7311. select=between(t\,10\,20)*eq(pict_type\,I)
  7312. @end example
  7313. @item
  7314. Select frames with a minimum distance of 10 seconds:
  7315. @example
  7316. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  7317. @end example
  7318. @item
  7319. Use aselect to select only audio frames with samples number > 100:
  7320. @example
  7321. aselect='gt(samples_n\,100)'
  7322. @end example
  7323. @item
  7324. Create a mosaic of the first scenes:
  7325. @example
  7326. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  7327. @end example
  7328. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  7329. choice.
  7330. @item
  7331. Send even and odd frames to separate outputs, and compose them:
  7332. @example
  7333. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  7334. @end example
  7335. @end itemize
  7336. @section sendcmd, asendcmd
  7337. Send commands to filters in the filtergraph.
  7338. These filters read commands to be sent to other filters in the
  7339. filtergraph.
  7340. @code{sendcmd} must be inserted between two video filters,
  7341. @code{asendcmd} must be inserted between two audio filters, but apart
  7342. from that they act the same way.
  7343. The specification of commands can be provided in the filter arguments
  7344. with the @var{commands} option, or in a file specified by the
  7345. @var{filename} option.
  7346. These filters accept the following options:
  7347. @table @option
  7348. @item commands, c
  7349. Set the commands to be read and sent to the other filters.
  7350. @item filename, f
  7351. Set the filename of the commands to be read and sent to the other
  7352. filters.
  7353. @end table
  7354. @subsection Commands syntax
  7355. A commands description consists of a sequence of interval
  7356. specifications, comprising a list of commands to be executed when a
  7357. particular event related to that interval occurs. The occurring event
  7358. is typically the current frame time entering or leaving a given time
  7359. interval.
  7360. An interval is specified by the following syntax:
  7361. @example
  7362. @var{START}[-@var{END}] @var{COMMANDS};
  7363. @end example
  7364. The time interval is specified by the @var{START} and @var{END} times.
  7365. @var{END} is optional and defaults to the maximum time.
  7366. The current frame time is considered within the specified interval if
  7367. it is included in the interval [@var{START}, @var{END}), that is when
  7368. the time is greater or equal to @var{START} and is lesser than
  7369. @var{END}.
  7370. @var{COMMANDS} consists of a sequence of one or more command
  7371. specifications, separated by ",", relating to that interval. The
  7372. syntax of a command specification is given by:
  7373. @example
  7374. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  7375. @end example
  7376. @var{FLAGS} is optional and specifies the type of events relating to
  7377. the time interval which enable sending the specified command, and must
  7378. be a non-null sequence of identifier flags separated by "+" or "|" and
  7379. enclosed between "[" and "]".
  7380. The following flags are recognized:
  7381. @table @option
  7382. @item enter
  7383. The command is sent when the current frame timestamp enters the
  7384. specified interval. In other words, the command is sent when the
  7385. previous frame timestamp was not in the given interval, and the
  7386. current is.
  7387. @item leave
  7388. The command is sent when the current frame timestamp leaves the
  7389. specified interval. In other words, the command is sent when the
  7390. previous frame timestamp was in the given interval, and the
  7391. current is not.
  7392. @end table
  7393. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  7394. assumed.
  7395. @var{TARGET} specifies the target of the command, usually the name of
  7396. the filter class or a specific filter instance name.
  7397. @var{COMMAND} specifies the name of the command for the target filter.
  7398. @var{ARG} is optional and specifies the optional list of argument for
  7399. the given @var{COMMAND}.
  7400. Between one interval specification and another, whitespaces, or
  7401. sequences of characters starting with @code{#} until the end of line,
  7402. are ignored and can be used to annotate comments.
  7403. A simplified BNF description of the commands specification syntax
  7404. follows:
  7405. @example
  7406. @var{COMMAND_FLAG} ::= "enter" | "leave"
  7407. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  7408. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  7409. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  7410. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  7411. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  7412. @end example
  7413. @subsection Examples
  7414. @itemize
  7415. @item
  7416. Specify audio tempo change at second 4:
  7417. @example
  7418. asendcmd=c='4.0 atempo tempo 1.5',atempo
  7419. @end example
  7420. @item
  7421. Specify a list of drawtext and hue commands in a file.
  7422. @example
  7423. # show text in the interval 5-10
  7424. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  7425. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  7426. # desaturate the image in the interval 15-20
  7427. 15.0-20.0 [enter] hue s 0,
  7428. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  7429. [leave] hue s 1,
  7430. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  7431. # apply an exponential saturation fade-out effect, starting from time 25
  7432. 25 [enter] hue s exp(25-t)
  7433. @end example
  7434. A filtergraph allowing to read and process the above command list
  7435. stored in a file @file{test.cmd}, can be specified with:
  7436. @example
  7437. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  7438. @end example
  7439. @end itemize
  7440. @anchor{setpts}
  7441. @section setpts, asetpts
  7442. Change the PTS (presentation timestamp) of the input frames.
  7443. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  7444. This filter accepts the following options:
  7445. @table @option
  7446. @item expr
  7447. The expression which is evaluated for each frame to construct its timestamp.
  7448. @end table
  7449. The expression is evaluated through the eval API and can contain the following
  7450. constants:
  7451. @table @option
  7452. @item FRAME_RATE
  7453. frame rate, only defined for constant frame-rate video
  7454. @item PTS
  7455. the presentation timestamp in input
  7456. @item N
  7457. the count of the input frame for video or the number of consumed samples,
  7458. not including the current frame for audio, starting from 0.
  7459. @item NB_CONSUMED_SAMPLES
  7460. the number of consumed samples, not including the current frame (only
  7461. audio)
  7462. @item NB_SAMPLES, S
  7463. the number of samples in the current frame (only audio)
  7464. @item SAMPLE_RATE, SR
  7465. audio sample rate
  7466. @item STARTPTS
  7467. the PTS of the first frame
  7468. @item STARTT
  7469. the time in seconds of the first frame
  7470. @item INTERLACED
  7471. tell if the current frame is interlaced
  7472. @item T
  7473. the time in seconds of the current frame
  7474. @item POS
  7475. original position in the file of the frame, or undefined if undefined
  7476. for the current frame
  7477. @item PREV_INPTS
  7478. previous input PTS
  7479. @item PREV_INT
  7480. previous input time in seconds
  7481. @item PREV_OUTPTS
  7482. previous output PTS
  7483. @item PREV_OUTT
  7484. previous output time in seconds
  7485. @item RTCTIME
  7486. wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  7487. instead.
  7488. @item RTCSTART
  7489. wallclock (RTC) time at the start of the movie in microseconds
  7490. @item TB
  7491. timebase of the input timestamps
  7492. @end table
  7493. @subsection Examples
  7494. @itemize
  7495. @item
  7496. Start counting PTS from zero
  7497. @example
  7498. setpts=PTS-STARTPTS
  7499. @end example
  7500. @item
  7501. Apply fast motion effect:
  7502. @example
  7503. setpts=0.5*PTS
  7504. @end example
  7505. @item
  7506. Apply slow motion effect:
  7507. @example
  7508. setpts=2.0*PTS
  7509. @end example
  7510. @item
  7511. Set fixed rate of 25 frames per second:
  7512. @example
  7513. setpts=N/(25*TB)
  7514. @end example
  7515. @item
  7516. Set fixed rate 25 fps with some jitter:
  7517. @example
  7518. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  7519. @end example
  7520. @item
  7521. Apply an offset of 10 seconds to the input PTS:
  7522. @example
  7523. setpts=PTS+10/TB
  7524. @end example
  7525. @item
  7526. Generate timestamps from a "live source" and rebase onto the current timebase:
  7527. @example
  7528. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  7529. @end example
  7530. @item
  7531. Generate timestamps by counting samples:
  7532. @example
  7533. asetpts=N/SR/TB
  7534. @end example
  7535. @end itemize
  7536. @section settb, asettb
  7537. Set the timebase to use for the output frames timestamps.
  7538. It is mainly useful for testing timebase configuration.
  7539. This filter accepts the following options:
  7540. @table @option
  7541. @item expr, tb
  7542. The expression which is evaluated into the output timebase.
  7543. @end table
  7544. The value for @option{tb} is an arithmetic expression representing a
  7545. rational. The expression can contain the constants "AVTB" (the default
  7546. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  7547. audio only). Default value is "intb".
  7548. @subsection Examples
  7549. @itemize
  7550. @item
  7551. Set the timebase to 1/25:
  7552. @example
  7553. settb=expr=1/25
  7554. @end example
  7555. @item
  7556. Set the timebase to 1/10:
  7557. @example
  7558. settb=expr=0.1
  7559. @end example
  7560. @item
  7561. Set the timebase to 1001/1000:
  7562. @example
  7563. settb=1+0.001
  7564. @end example
  7565. @item
  7566. Set the timebase to 2*intb:
  7567. @example
  7568. settb=2*intb
  7569. @end example
  7570. @item
  7571. Set the default timebase value:
  7572. @example
  7573. settb=AVTB
  7574. @end example
  7575. @end itemize
  7576. @section showspectrum
  7577. Convert input audio to a video output, representing the audio frequency
  7578. spectrum.
  7579. The filter accepts the following options:
  7580. @table @option
  7581. @item size, s
  7582. Specify the video size for the output. For the syntax of this option, check
  7583. the "Video size" section in the ffmpeg-utils manual. Default value is
  7584. @code{640x512}.
  7585. @item slide
  7586. Specify if the spectrum should slide along the window. Default value is
  7587. @code{0}.
  7588. @item mode
  7589. Specify display mode.
  7590. It accepts the following values:
  7591. @table @samp
  7592. @item combined
  7593. all channels are displayed in the same row
  7594. @item separate
  7595. all channels are displayed in separate rows
  7596. @end table
  7597. Default value is @samp{combined}.
  7598. @item color
  7599. Specify display color mode.
  7600. It accepts the following values:
  7601. @table @samp
  7602. @item channel
  7603. each channel is displayed in a separate color
  7604. @item intensity
  7605. each channel is is displayed using the same color scheme
  7606. @end table
  7607. Default value is @samp{channel}.
  7608. @item scale
  7609. Specify scale used for calculating intensity color values.
  7610. It accepts the following values:
  7611. @table @samp
  7612. @item lin
  7613. linear
  7614. @item sqrt
  7615. square root, default
  7616. @item cbrt
  7617. cubic root
  7618. @item log
  7619. logarithmic
  7620. @end table
  7621. Default value is @samp{sqrt}.
  7622. @item saturation
  7623. Set saturation modifier for displayed colors. Negative values provide
  7624. alternative color scheme. @code{0} is no saturation at all.
  7625. Saturation must be in [-10.0, 10.0] range.
  7626. Default value is @code{1}.
  7627. @item win_func
  7628. Set window function.
  7629. It accepts the following values:
  7630. @table @samp
  7631. @item none
  7632. No samples pre-processing (do not expect this to be faster)
  7633. @item hann
  7634. Hann window
  7635. @item hamming
  7636. Hamming window
  7637. @item blackman
  7638. Blackman window
  7639. @end table
  7640. Default value is @code{hann}.
  7641. @end table
  7642. The usage is very similar to the showwaves filter; see the examples in that
  7643. section.
  7644. @subsection Examples
  7645. @itemize
  7646. @item
  7647. Large window with logarithmic color scaling:
  7648. @example
  7649. showspectrum=s=1280x480:scale=log
  7650. @end example
  7651. @item
  7652. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  7653. @example
  7654. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  7655. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  7656. @end example
  7657. @end itemize
  7658. @section showwaves
  7659. Convert input audio to a video output, representing the samples waves.
  7660. The filter accepts the following options:
  7661. @table @option
  7662. @item size, s
  7663. Specify the video size for the output. For the syntax of this option, check
  7664. the "Video size" section in the ffmpeg-utils manual. Default value
  7665. is "600x240".
  7666. @item mode
  7667. Set display mode.
  7668. Available values are:
  7669. @table @samp
  7670. @item point
  7671. Draw a point for each sample.
  7672. @item line
  7673. Draw a vertical line for each sample.
  7674. @end table
  7675. Default value is @code{point}.
  7676. @item n
  7677. Set the number of samples which are printed on the same column. A
  7678. larger value will decrease the frame rate. Must be a positive
  7679. integer. This option can be set only if the value for @var{rate}
  7680. is not explicitly specified.
  7681. @item rate, r
  7682. Set the (approximate) output frame rate. This is done by setting the
  7683. option @var{n}. Default value is "25".
  7684. @end table
  7685. @subsection Examples
  7686. @itemize
  7687. @item
  7688. Output the input file audio and the corresponding video representation
  7689. at the same time:
  7690. @example
  7691. amovie=a.mp3,asplit[out0],showwaves[out1]
  7692. @end example
  7693. @item
  7694. Create a synthetic signal and show it with showwaves, forcing a
  7695. frame rate of 30 frames per second:
  7696. @example
  7697. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  7698. @end example
  7699. @end itemize
  7700. @section split, asplit
  7701. Split input into several identical outputs.
  7702. @code{asplit} works with audio input, @code{split} with video.
  7703. The filter accepts a single parameter which specifies the number of outputs. If
  7704. unspecified, it defaults to 2.
  7705. @subsection Examples
  7706. @itemize
  7707. @item
  7708. Create two separate outputs from the same input:
  7709. @example
  7710. [in] split [out0][out1]
  7711. @end example
  7712. @item
  7713. To create 3 or more outputs, you need to specify the number of
  7714. outputs, like in:
  7715. @example
  7716. [in] asplit=3 [out0][out1][out2]
  7717. @end example
  7718. @item
  7719. Create two separate outputs from the same input, one cropped and
  7720. one padded:
  7721. @example
  7722. [in] split [splitout1][splitout2];
  7723. [splitout1] crop=100:100:0:0 [cropout];
  7724. [splitout2] pad=200:200:100:100 [padout];
  7725. @end example
  7726. @item
  7727. Create 5 copies of the input audio with @command{ffmpeg}:
  7728. @example
  7729. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  7730. @end example
  7731. @end itemize
  7732. @section zmq, azmq
  7733. Receive commands sent through a libzmq client, and forward them to
  7734. filters in the filtergraph.
  7735. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  7736. must be inserted between two video filters, @code{azmq} between two
  7737. audio filters.
  7738. To enable these filters you need to install the libzmq library and
  7739. headers and configure FFmpeg with @code{--enable-libzmq}.
  7740. For more information about libzmq see:
  7741. @url{http://www.zeromq.org/}
  7742. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  7743. receives messages sent through a network interface defined by the
  7744. @option{bind_address} option.
  7745. The received message must be in the form:
  7746. @example
  7747. @var{TARGET} @var{COMMAND} [@var{ARG}]
  7748. @end example
  7749. @var{TARGET} specifies the target of the command, usually the name of
  7750. the filter class or a specific filter instance name.
  7751. @var{COMMAND} specifies the name of the command for the target filter.
  7752. @var{ARG} is optional and specifies the optional argument list for the
  7753. given @var{COMMAND}.
  7754. Upon reception, the message is processed and the corresponding command
  7755. is injected into the filtergraph. Depending on the result, the filter
  7756. will send a reply to the client, adopting the format:
  7757. @example
  7758. @var{ERROR_CODE} @var{ERROR_REASON}
  7759. @var{MESSAGE}
  7760. @end example
  7761. @var{MESSAGE} is optional.
  7762. @subsection Examples
  7763. Look at @file{tools/zmqsend} for an example of a zmq client which can
  7764. be used to send commands processed by these filters.
  7765. Consider the following filtergraph generated by @command{ffplay}
  7766. @example
  7767. ffplay -dumpgraph 1 -f lavfi "
  7768. color=s=100x100:c=red [l];
  7769. color=s=100x100:c=blue [r];
  7770. nullsrc=s=200x100, zmq [bg];
  7771. [bg][l] overlay [bg+l];
  7772. [bg+l][r] overlay=x=100 "
  7773. @end example
  7774. To change the color of the left side of the video, the following
  7775. command can be used:
  7776. @example
  7777. echo Parsed_color_0 c yellow | tools/zmqsend
  7778. @end example
  7779. To change the right side:
  7780. @example
  7781. echo Parsed_color_1 c pink | tools/zmqsend
  7782. @end example
  7783. @c man end MULTIMEDIA FILTERS
  7784. @chapter Multimedia Sources
  7785. @c man begin MULTIMEDIA SOURCES
  7786. Below is a description of the currently available multimedia sources.
  7787. @section amovie
  7788. This is the same as @ref{movie} source, except it selects an audio
  7789. stream by default.
  7790. @anchor{movie}
  7791. @section movie
  7792. Read audio and/or video stream(s) from a movie container.
  7793. This filter accepts the following options:
  7794. @table @option
  7795. @item filename
  7796. The name of the resource to read (not necessarily a file but also a device or a
  7797. stream accessed through some protocol).
  7798. @item format_name, f
  7799. Specifies the format assumed for the movie to read, and can be either
  7800. the name of a container or an input device. If not specified the
  7801. format is guessed from @var{movie_name} or by probing.
  7802. @item seek_point, sp
  7803. Specifies the seek point in seconds, the frames will be output
  7804. starting from this seek point, the parameter is evaluated with
  7805. @code{av_strtod} so the numerical value may be suffixed by an IS
  7806. postfix. Default value is "0".
  7807. @item streams, s
  7808. Specifies the streams to read. Several streams can be specified,
  7809. separated by "+". The source will then have as many outputs, in the
  7810. same order. The syntax is explained in the ``Stream specifiers''
  7811. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  7812. respectively the default (best suited) video and audio stream. Default
  7813. is "dv", or "da" if the filter is called as "amovie".
  7814. @item stream_index, si
  7815. Specifies the index of the video stream to read. If the value is -1,
  7816. the best suited video stream will be automatically selected. Default
  7817. value is "-1". Deprecated. If the filter is called "amovie", it will select
  7818. audio instead of video.
  7819. @item loop
  7820. Specifies how many times to read the stream in sequence.
  7821. If the value is less than 1, the stream will be read again and again.
  7822. Default value is "1".
  7823. Note that when the movie is looped the source timestamps are not
  7824. changed, so it will generate non monotonically increasing timestamps.
  7825. @end table
  7826. This filter allows to overlay a second video on top of main input of
  7827. a filtergraph as shown in this graph:
  7828. @example
  7829. input -----------> deltapts0 --> overlay --> output
  7830. ^
  7831. |
  7832. movie --> scale--> deltapts1 -------+
  7833. @end example
  7834. @subsection Examples
  7835. @itemize
  7836. @item
  7837. Skip 3.2 seconds from the start of the avi file in.avi, and overlay it
  7838. on top of the input labelled as "in":
  7839. @example
  7840. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  7841. [in] setpts=PTS-STARTPTS [main];
  7842. [main][over] overlay=16:16 [out]
  7843. @end example
  7844. @item
  7845. Read from a video4linux2 device, and overlay it on top of the input
  7846. labelled as "in":
  7847. @example
  7848. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  7849. [in] setpts=PTS-STARTPTS [main];
  7850. [main][over] overlay=16:16 [out]
  7851. @end example
  7852. @item
  7853. Read the first video stream and the audio stream with id 0x81 from
  7854. dvd.vob; the video is connected to the pad named "video" and the audio is
  7855. connected to the pad named "audio":
  7856. @example
  7857. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  7858. @end example
  7859. @end itemize
  7860. @c man end MULTIMEDIA SOURCES