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.

26299 lines
699KB

  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. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then 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 the top half of the video is mirrored
  23. onto the bottom half of the output video.
  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 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", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @section acue
  505. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  506. filter.
  507. @section adeclick
  508. Remove impulsive noise from input audio.
  509. Samples detected as impulsive noise are replaced by interpolated samples using
  510. autoregressive modelling.
  511. @table @option
  512. @item w
  513. Set window size, in milliseconds. Allowed range is from @code{10} to
  514. @code{100}. Default value is @code{55} milliseconds.
  515. This sets size of window which will be processed at once.
  516. @item o
  517. Set window overlap, in percentage of window size. Allowed range is from
  518. @code{50} to @code{95}. Default value is @code{75} percent.
  519. Setting this to a very high value increases impulsive noise removal but makes
  520. whole process much slower.
  521. @item a
  522. Set autoregression order, in percentage of window size. Allowed range is from
  523. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  524. controls quality of interpolated samples using neighbour good samples.
  525. @item t
  526. Set threshold value. Allowed range is from @code{1} to @code{100}.
  527. Default value is @code{2}.
  528. This controls the strength of impulsive noise which is going to be removed.
  529. The lower value, the more samples will be detected as impulsive noise.
  530. @item b
  531. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  532. @code{10}. Default value is @code{2}.
  533. If any two samples detected as noise are spaced less than this value then any
  534. sample between those two samples will be also detected as noise.
  535. @item m
  536. Set overlap method.
  537. It accepts the following values:
  538. @table @option
  539. @item a
  540. Select overlap-add method. Even not interpolated samples are slightly
  541. changed with this method.
  542. @item s
  543. Select overlap-save method. Not interpolated samples remain unchanged.
  544. @end table
  545. Default value is @code{a}.
  546. @end table
  547. @section adeclip
  548. Remove clipped samples from input audio.
  549. Samples detected as clipped are replaced by interpolated samples using
  550. autoregressive modelling.
  551. @table @option
  552. @item w
  553. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  554. Default value is @code{55} milliseconds.
  555. This sets size of window which will be processed at once.
  556. @item o
  557. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  558. to @code{95}. Default value is @code{75} percent.
  559. @item a
  560. Set autoregression order, in percentage of window size. Allowed range is from
  561. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  562. quality of interpolated samples using neighbour good samples.
  563. @item t
  564. Set threshold value. Allowed range is from @code{1} to @code{100}.
  565. Default value is @code{10}. Higher values make clip detection less aggressive.
  566. @item n
  567. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  568. Default value is @code{1000}. Higher values make clip detection less aggressive.
  569. @item m
  570. Set overlap method.
  571. It accepts the following values:
  572. @table @option
  573. @item a
  574. Select overlap-add method. Even not interpolated samples are slightly changed
  575. with this method.
  576. @item s
  577. Select overlap-save method. Not interpolated samples remain unchanged.
  578. @end table
  579. Default value is @code{a}.
  580. @end table
  581. @section adelay
  582. Delay one or more audio channels.
  583. Samples in delayed channel are filled with silence.
  584. The filter accepts the following option:
  585. @table @option
  586. @item delays
  587. Set list of delays in milliseconds for each channel separated by '|'.
  588. Unused delays will be silently ignored. If number of given delays is
  589. smaller than number of channels all remaining channels will not be delayed.
  590. If you want to delay exact number of samples, append 'S' to number.
  591. If you want instead to delay in seconds, append 's' to number.
  592. @item all
  593. Use last set delay for all remaining channels. By default is disabled.
  594. This option if enabled changes how option @code{delays} is interpreted.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  600. the second channel (and any other channels that may be present) unchanged.
  601. @example
  602. adelay=1500|0|500
  603. @end example
  604. @item
  605. Delay second channel by 500 samples, the third channel by 700 samples and leave
  606. the first channel (and any other channels that may be present) unchanged.
  607. @example
  608. adelay=0|500S|700S
  609. @end example
  610. @item
  611. Delay all channels by same number of samples:
  612. @example
  613. adelay=delays=64S:all=1
  614. @end example
  615. @end itemize
  616. @section adenorm
  617. Remedy denormals in audio by adding extremely low-level noise.
  618. This filter shall be placed before any filter that can produce denormals.
  619. A description of the accepted parameters follows.
  620. @table @option
  621. @item level
  622. Set level of added noise in dB. Default is @code{-351}.
  623. Allowed range is from -451 to -90.
  624. @item type
  625. Set type of added noise.
  626. @table @option
  627. @item dc
  628. Add DC signal.
  629. @item ac
  630. Add AC signal.
  631. @item square
  632. Add square signal.
  633. @item pulse
  634. Add pulse signal.
  635. @end table
  636. Default is @code{dc}.
  637. @end table
  638. @subsection Commands
  639. This filter supports the all above options as @ref{commands}.
  640. @section aderivative, aintegral
  641. Compute derivative/integral of audio stream.
  642. Applying both filters one after another produces original audio.
  643. @section aecho
  644. Apply echoing to the input audio.
  645. Echoes are reflected sound and can occur naturally amongst mountains
  646. (and sometimes large buildings) when talking or shouting; digital echo
  647. effects emulate this behaviour and are often used to help fill out the
  648. sound of a single instrument or vocal. The time difference between the
  649. original signal and the reflection is the @code{delay}, and the
  650. loudness of the reflected signal is the @code{decay}.
  651. Multiple echoes can have different delays and decays.
  652. A description of the accepted parameters follows.
  653. @table @option
  654. @item in_gain
  655. Set input gain of reflected signal. Default is @code{0.6}.
  656. @item out_gain
  657. Set output gain of reflected signal. Default is @code{0.3}.
  658. @item delays
  659. Set list of time intervals in milliseconds between original signal and reflections
  660. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  661. Default is @code{1000}.
  662. @item decays
  663. Set list of loudness of reflected signals separated by '|'.
  664. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  665. Default is @code{0.5}.
  666. @end table
  667. @subsection Examples
  668. @itemize
  669. @item
  670. Make it sound as if there are twice as many instruments as are actually playing:
  671. @example
  672. aecho=0.8:0.88:60:0.4
  673. @end example
  674. @item
  675. If delay is very short, then it sounds like a (metallic) robot playing music:
  676. @example
  677. aecho=0.8:0.88:6:0.4
  678. @end example
  679. @item
  680. A longer delay will sound like an open air concert in the mountains:
  681. @example
  682. aecho=0.8:0.9:1000:0.3
  683. @end example
  684. @item
  685. Same as above but with one more mountain:
  686. @example
  687. aecho=0.8:0.9:1000|1800:0.3|0.25
  688. @end example
  689. @end itemize
  690. @section aemphasis
  691. Audio emphasis filter creates or restores material directly taken from LPs or
  692. emphased CDs with different filter curves. E.g. to store music on vinyl the
  693. signal has to be altered by a filter first to even out the disadvantages of
  694. this recording medium.
  695. Once the material is played back the inverse filter has to be applied to
  696. restore the distortion of the frequency response.
  697. The filter accepts the following options:
  698. @table @option
  699. @item level_in
  700. Set input gain.
  701. @item level_out
  702. Set output gain.
  703. @item mode
  704. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  705. use @code{production} mode. Default is @code{reproduction} mode.
  706. @item type
  707. Set filter type. Selects medium. Can be one of the following:
  708. @table @option
  709. @item col
  710. select Columbia.
  711. @item emi
  712. select EMI.
  713. @item bsi
  714. select BSI (78RPM).
  715. @item riaa
  716. select RIAA.
  717. @item cd
  718. select Compact Disc (CD).
  719. @item 50fm
  720. select 50µs (FM).
  721. @item 75fm
  722. select 75µs (FM).
  723. @item 50kf
  724. select 50µs (FM-KF).
  725. @item 75kf
  726. select 75µs (FM-KF).
  727. @end table
  728. @end table
  729. @subsection Commands
  730. This filter supports the all above options as @ref{commands}.
  731. @section aeval
  732. Modify an audio signal according to the specified expressions.
  733. This filter accepts one or more expressions (one for each channel),
  734. which are evaluated and used to modify a corresponding audio signal.
  735. It accepts the following parameters:
  736. @table @option
  737. @item exprs
  738. Set the '|'-separated expressions list for each separate channel. If
  739. the number of input channels is greater than the number of
  740. expressions, the last specified expression is used for the remaining
  741. output channels.
  742. @item channel_layout, c
  743. Set output channel layout. If not specified, the channel layout is
  744. specified by the number of expressions. If set to @samp{same}, it will
  745. use by default the same input channel layout.
  746. @end table
  747. Each expression in @var{exprs} can contain the following constants and functions:
  748. @table @option
  749. @item ch
  750. channel number of the current expression
  751. @item n
  752. number of the evaluated sample, starting from 0
  753. @item s
  754. sample rate
  755. @item t
  756. time of the evaluated sample expressed in seconds
  757. @item nb_in_channels
  758. @item nb_out_channels
  759. input and output number of channels
  760. @item val(CH)
  761. the value of input channel with number @var{CH}
  762. @end table
  763. Note: this filter is slow. For faster processing you should use a
  764. dedicated filter.
  765. @subsection Examples
  766. @itemize
  767. @item
  768. Half volume:
  769. @example
  770. aeval=val(ch)/2:c=same
  771. @end example
  772. @item
  773. Invert phase of the second channel:
  774. @example
  775. aeval=val(0)|-val(1)
  776. @end example
  777. @end itemize
  778. @anchor{afade}
  779. @section afade
  780. Apply fade-in/out effect to input audio.
  781. A description of the accepted parameters follows.
  782. @table @option
  783. @item type, t
  784. Specify the effect type, can be either @code{in} for fade-in, or
  785. @code{out} for a fade-out effect. Default is @code{in}.
  786. @item start_sample, ss
  787. Specify the number of the start sample for starting to apply the fade
  788. effect. Default is 0.
  789. @item nb_samples, ns
  790. Specify the number of samples for which the fade effect has to last. At
  791. the end of the fade-in effect the output audio will have the same
  792. volume as the input audio, at the end of the fade-out transition
  793. the output audio will be silence. Default is 44100.
  794. @item start_time, st
  795. Specify the start time of the fade effect. Default is 0.
  796. The value must be specified as a time duration; see
  797. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  798. for the accepted syntax.
  799. If set this option is used instead of @var{start_sample}.
  800. @item duration, d
  801. Specify the duration of the fade effect. See
  802. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  803. for the accepted syntax.
  804. At the end of the fade-in effect the output audio will have the same
  805. volume as the input audio, at the end of the fade-out transition
  806. the output audio will be silence.
  807. By default the duration is determined by @var{nb_samples}.
  808. If set this option is used instead of @var{nb_samples}.
  809. @item curve
  810. Set curve for fade transition.
  811. It accepts the following values:
  812. @table @option
  813. @item tri
  814. select triangular, linear slope (default)
  815. @item qsin
  816. select quarter of sine wave
  817. @item hsin
  818. select half of sine wave
  819. @item esin
  820. select exponential sine wave
  821. @item log
  822. select logarithmic
  823. @item ipar
  824. select inverted parabola
  825. @item qua
  826. select quadratic
  827. @item cub
  828. select cubic
  829. @item squ
  830. select square root
  831. @item cbr
  832. select cubic root
  833. @item par
  834. select parabola
  835. @item exp
  836. select exponential
  837. @item iqsin
  838. select inverted quarter of sine wave
  839. @item ihsin
  840. select inverted half of sine wave
  841. @item dese
  842. select double-exponential seat
  843. @item desi
  844. select double-exponential sigmoid
  845. @item losi
  846. select logistic sigmoid
  847. @item sinc
  848. select sine cardinal function
  849. @item isinc
  850. select inverted sine cardinal function
  851. @item nofade
  852. no fade applied
  853. @end table
  854. @end table
  855. @subsection Examples
  856. @itemize
  857. @item
  858. Fade in first 15 seconds of audio:
  859. @example
  860. afade=t=in:ss=0:d=15
  861. @end example
  862. @item
  863. Fade out last 25 seconds of a 900 seconds audio:
  864. @example
  865. afade=t=out:st=875:d=25
  866. @end example
  867. @end itemize
  868. @section afftdn
  869. Denoise audio samples with FFT.
  870. A description of the accepted parameters follows.
  871. @table @option
  872. @item nr
  873. Set the noise reduction in dB, allowed range is 0.01 to 97.
  874. Default value is 12 dB.
  875. @item nf
  876. Set the noise floor in dB, allowed range is -80 to -20.
  877. Default value is -50 dB.
  878. @item nt
  879. Set the noise type.
  880. It accepts the following values:
  881. @table @option
  882. @item w
  883. Select white noise.
  884. @item v
  885. Select vinyl noise.
  886. @item s
  887. Select shellac noise.
  888. @item c
  889. Select custom noise, defined in @code{bn} option.
  890. Default value is white noise.
  891. @end table
  892. @item bn
  893. Set custom band noise for every one of 15 bands.
  894. Bands are separated by ' ' or '|'.
  895. @item rf
  896. Set the residual floor in dB, allowed range is -80 to -20.
  897. Default value is -38 dB.
  898. @item tn
  899. Enable noise tracking. By default is disabled.
  900. With this enabled, noise floor is automatically adjusted.
  901. @item tr
  902. Enable residual tracking. By default is disabled.
  903. @item om
  904. Set the output mode.
  905. It accepts the following values:
  906. @table @option
  907. @item i
  908. Pass input unchanged.
  909. @item o
  910. Pass noise filtered out.
  911. @item n
  912. Pass only noise.
  913. Default value is @var{o}.
  914. @end table
  915. @end table
  916. @subsection Commands
  917. This filter supports the following commands:
  918. @table @option
  919. @item sample_noise, sn
  920. Start or stop measuring noise profile.
  921. Syntax for the command is : "start" or "stop" string.
  922. After measuring noise profile is stopped it will be
  923. automatically applied in filtering.
  924. @item noise_reduction, nr
  925. Change noise reduction. Argument is single float number.
  926. Syntax for the command is : "@var{noise_reduction}"
  927. @item noise_floor, nf
  928. Change noise floor. Argument is single float number.
  929. Syntax for the command is : "@var{noise_floor}"
  930. @item output_mode, om
  931. Change output mode operation.
  932. Syntax for the command is : "i", "o" or "n" string.
  933. @end table
  934. @section afftfilt
  935. Apply arbitrary expressions to samples in frequency domain.
  936. @table @option
  937. @item real
  938. Set frequency domain real expression for each separate channel separated
  939. by '|'. Default is "re".
  940. If the number of input channels is greater than the number of
  941. expressions, the last specified expression is used for the remaining
  942. output channels.
  943. @item imag
  944. Set frequency domain imaginary expression for each separate channel
  945. separated by '|'. Default is "im".
  946. Each expression in @var{real} and @var{imag} can contain the following
  947. constants and functions:
  948. @table @option
  949. @item sr
  950. sample rate
  951. @item b
  952. current frequency bin number
  953. @item nb
  954. number of available bins
  955. @item ch
  956. channel number of the current expression
  957. @item chs
  958. number of channels
  959. @item pts
  960. current frame pts
  961. @item re
  962. current real part of frequency bin of current channel
  963. @item im
  964. current imaginary part of frequency bin of current channel
  965. @item real(b, ch)
  966. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  967. @item imag(b, ch)
  968. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  969. @end table
  970. @item win_size
  971. Set window size. Allowed range is from 16 to 131072.
  972. Default is @code{4096}
  973. @item win_func
  974. Set window function. Default is @code{hann}.
  975. @item overlap
  976. Set window overlap. If set to 1, the recommended overlap for selected
  977. window function will be picked. Default is @code{0.75}.
  978. @end table
  979. @subsection Examples
  980. @itemize
  981. @item
  982. Leave almost only low frequencies in audio:
  983. @example
  984. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  985. @end example
  986. @item
  987. Apply robotize effect:
  988. @example
  989. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  990. @end example
  991. @item
  992. Apply whisper effect:
  993. @example
  994. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  995. @end example
  996. @end itemize
  997. @anchor{afir}
  998. @section afir
  999. Apply an arbitrary Finite Impulse Response filter.
  1000. This filter is designed for applying long FIR filters,
  1001. up to 60 seconds long.
  1002. It can be used as component for digital crossover filters,
  1003. room equalization, cross talk cancellation, wavefield synthesis,
  1004. auralization, ambiophonics, ambisonics and spatialization.
  1005. This filter uses the streams higher than first one as FIR coefficients.
  1006. If the non-first stream holds a single channel, it will be used
  1007. for all input channels in the first stream, otherwise
  1008. the number of channels in the non-first stream must be same as
  1009. the number of channels in the first stream.
  1010. It accepts the following parameters:
  1011. @table @option
  1012. @item dry
  1013. Set dry gain. This sets input gain.
  1014. @item wet
  1015. Set wet gain. This sets final output gain.
  1016. @item length
  1017. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1018. @item gtype
  1019. Enable applying gain measured from power of IR.
  1020. Set which approach to use for auto gain measurement.
  1021. @table @option
  1022. @item none
  1023. Do not apply any gain.
  1024. @item peak
  1025. select peak gain, very conservative approach. This is default value.
  1026. @item dc
  1027. select DC gain, limited application.
  1028. @item gn
  1029. select gain to noise approach, this is most popular one.
  1030. @end table
  1031. @item irgain
  1032. Set gain to be applied to IR coefficients before filtering.
  1033. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1034. @item irfmt
  1035. Set format of IR stream. Can be @code{mono} or @code{input}.
  1036. Default is @code{input}.
  1037. @item maxir
  1038. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1039. Allowed range is 0.1 to 60 seconds.
  1040. @item response
  1041. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1042. By default it is disabled.
  1043. @item channel
  1044. Set for which IR channel to display frequency response. By default is first channel
  1045. displayed. This option is used only when @var{response} is enabled.
  1046. @item size
  1047. Set video stream size. This option is used only when @var{response} is enabled.
  1048. @item rate
  1049. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1050. @item minp
  1051. Set minimal partition size used for convolution. Default is @var{8192}.
  1052. Allowed range is from @var{1} to @var{32768}.
  1053. Lower values decreases latency at cost of higher CPU usage.
  1054. @item maxp
  1055. Set maximal partition size used for convolution. Default is @var{8192}.
  1056. Allowed range is from @var{8} to @var{32768}.
  1057. Lower values may increase CPU usage.
  1058. @item nbirs
  1059. Set number of input impulse responses streams which will be switchable at runtime.
  1060. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1061. @item ir
  1062. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1063. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1064. This option can be changed at runtime via @ref{commands}.
  1065. @end table
  1066. @subsection Examples
  1067. @itemize
  1068. @item
  1069. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1070. @example
  1071. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1072. @end example
  1073. @end itemize
  1074. @anchor{aformat}
  1075. @section aformat
  1076. Set output format constraints for the input audio. The framework will
  1077. negotiate the most appropriate format to minimize conversions.
  1078. It accepts the following parameters:
  1079. @table @option
  1080. @item sample_fmts, f
  1081. A '|'-separated list of requested sample formats.
  1082. @item sample_rates, r
  1083. A '|'-separated list of requested sample rates.
  1084. @item channel_layouts, cl
  1085. A '|'-separated list of requested channel layouts.
  1086. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1087. for the required syntax.
  1088. @end table
  1089. If a parameter is omitted, all values are allowed.
  1090. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1091. @example
  1092. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1093. @end example
  1094. @section afreqshift
  1095. Apply frequency shift to input audio samples.
  1096. The filter accepts the following options:
  1097. @table @option
  1098. @item shift
  1099. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1100. Default value is 0.0.
  1101. @end table
  1102. @subsection Commands
  1103. This filter supports the above option as @ref{commands}.
  1104. @section agate
  1105. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1106. processing reduces disturbing noise between useful signals.
  1107. Gating is done by detecting the volume below a chosen level @var{threshold}
  1108. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1109. floor is set via @var{range}. Because an exact manipulation of the signal
  1110. would cause distortion of the waveform the reduction can be levelled over
  1111. time. This is done by setting @var{attack} and @var{release}.
  1112. @var{attack} determines how long the signal has to fall below the threshold
  1113. before any reduction will occur and @var{release} sets the time the signal
  1114. has to rise above the threshold to reduce the reduction again.
  1115. Shorter signals than the chosen attack time will be left untouched.
  1116. @table @option
  1117. @item level_in
  1118. Set input level before filtering.
  1119. Default is 1. Allowed range is from 0.015625 to 64.
  1120. @item mode
  1121. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1122. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1123. will be amplified, expanding dynamic range in upward direction.
  1124. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1125. @item range
  1126. Set the level of gain reduction when the signal is below the threshold.
  1127. Default is 0.06125. Allowed range is from 0 to 1.
  1128. Setting this to 0 disables reduction and then filter behaves like expander.
  1129. @item threshold
  1130. If a signal rises above this level the gain reduction is released.
  1131. Default is 0.125. Allowed range is from 0 to 1.
  1132. @item ratio
  1133. Set a ratio by which the signal is reduced.
  1134. Default is 2. Allowed range is from 1 to 9000.
  1135. @item attack
  1136. Amount of milliseconds the signal has to rise above the threshold before gain
  1137. reduction stops.
  1138. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1139. @item release
  1140. Amount of milliseconds the signal has to fall below the threshold before the
  1141. reduction is increased again. Default is 250 milliseconds.
  1142. Allowed range is from 0.01 to 9000.
  1143. @item makeup
  1144. Set amount of amplification of signal after processing.
  1145. Default is 1. Allowed range is from 1 to 64.
  1146. @item knee
  1147. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1148. Default is 2.828427125. Allowed range is from 1 to 8.
  1149. @item detection
  1150. Choose if exact signal should be taken for detection or an RMS like one.
  1151. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1152. @item link
  1153. Choose if the average level between all channels or the louder channel affects
  1154. the reduction.
  1155. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1156. @end table
  1157. @subsection Commands
  1158. This filter supports the all above options as @ref{commands}.
  1159. @section aiir
  1160. Apply an arbitrary Infinite Impulse Response filter.
  1161. It accepts the following parameters:
  1162. @table @option
  1163. @item zeros, z
  1164. Set B/numerator/zeros/reflection coefficients.
  1165. @item poles, p
  1166. Set A/denominator/poles/ladder coefficients.
  1167. @item gains, k
  1168. Set channels gains.
  1169. @item dry_gain
  1170. Set input gain.
  1171. @item wet_gain
  1172. Set output gain.
  1173. @item format, f
  1174. Set coefficients format.
  1175. @table @samp
  1176. @item ll
  1177. lattice-ladder function
  1178. @item sf
  1179. analog transfer function
  1180. @item tf
  1181. digital transfer function
  1182. @item zp
  1183. Z-plane zeros/poles, cartesian (default)
  1184. @item pr
  1185. Z-plane zeros/poles, polar radians
  1186. @item pd
  1187. Z-plane zeros/poles, polar degrees
  1188. @item sp
  1189. S-plane zeros/poles
  1190. @end table
  1191. @item process, r
  1192. Set type of processing.
  1193. @table @samp
  1194. @item d
  1195. direct processing
  1196. @item s
  1197. serial processing
  1198. @item p
  1199. parallel processing
  1200. @end table
  1201. @item precision, e
  1202. Set filtering precision.
  1203. @table @samp
  1204. @item dbl
  1205. double-precision floating-point (default)
  1206. @item flt
  1207. single-precision floating-point
  1208. @item i32
  1209. 32-bit integers
  1210. @item i16
  1211. 16-bit integers
  1212. @end table
  1213. @item normalize, n
  1214. Normalize filter coefficients, by default is enabled.
  1215. Enabling it will normalize magnitude response at DC to 0dB.
  1216. @item mix
  1217. How much to use filtered signal in output. Default is 1.
  1218. Range is between 0 and 1.
  1219. @item response
  1220. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1221. By default it is disabled.
  1222. @item channel
  1223. Set for which IR channel to display frequency response. By default is first channel
  1224. displayed. This option is used only when @var{response} is enabled.
  1225. @item size
  1226. Set video stream size. This option is used only when @var{response} is enabled.
  1227. @end table
  1228. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1229. order.
  1230. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1231. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1232. imaginary unit.
  1233. Different coefficients and gains can be provided for every channel, in such case
  1234. use '|' to separate coefficients or gains. Last provided coefficients will be
  1235. used for all remaining channels.
  1236. @subsection Examples
  1237. @itemize
  1238. @item
  1239. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1240. @example
  1241. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1242. @end example
  1243. @item
  1244. Same as above but in @code{zp} format:
  1245. @example
  1246. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1247. @end example
  1248. @item
  1249. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1250. @example
  1251. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1252. @end example
  1253. @end itemize
  1254. @section alimiter
  1255. The limiter prevents an input signal from rising over a desired threshold.
  1256. This limiter uses lookahead technology to prevent your signal from distorting.
  1257. It means that there is a small delay after the signal is processed. Keep in mind
  1258. that the delay it produces is the attack time you set.
  1259. The filter accepts the following options:
  1260. @table @option
  1261. @item level_in
  1262. Set input gain. Default is 1.
  1263. @item level_out
  1264. Set output gain. Default is 1.
  1265. @item limit
  1266. Don't let signals above this level pass the limiter. Default is 1.
  1267. @item attack
  1268. The limiter will reach its attenuation level in this amount of time in
  1269. milliseconds. Default is 5 milliseconds.
  1270. @item release
  1271. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1272. Default is 50 milliseconds.
  1273. @item asc
  1274. When gain reduction is always needed ASC takes care of releasing to an
  1275. average reduction level rather than reaching a reduction of 0 in the release
  1276. time.
  1277. @item asc_level
  1278. Select how much the release time is affected by ASC, 0 means nearly no changes
  1279. in release time while 1 produces higher release times.
  1280. @item level
  1281. Auto level output signal. Default is enabled.
  1282. This normalizes audio back to 0dB if enabled.
  1283. @end table
  1284. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1285. with @ref{aresample} before applying this filter.
  1286. @section allpass
  1287. Apply a two-pole all-pass filter with central frequency (in Hz)
  1288. @var{frequency}, and filter-width @var{width}.
  1289. An all-pass filter changes the audio's frequency to phase relationship
  1290. without changing its frequency to amplitude relationship.
  1291. The filter accepts the following options:
  1292. @table @option
  1293. @item frequency, f
  1294. Set frequency in Hz.
  1295. @item width_type, t
  1296. Set method to specify band-width of filter.
  1297. @table @option
  1298. @item h
  1299. Hz
  1300. @item q
  1301. Q-Factor
  1302. @item o
  1303. octave
  1304. @item s
  1305. slope
  1306. @item k
  1307. kHz
  1308. @end table
  1309. @item width, w
  1310. Specify the band-width of a filter in width_type units.
  1311. @item mix, m
  1312. How much to use filtered signal in output. Default is 1.
  1313. Range is between 0 and 1.
  1314. @item channels, c
  1315. Specify which channels to filter, by default all available are filtered.
  1316. @item normalize, n
  1317. Normalize biquad coefficients, by default is disabled.
  1318. Enabling it will normalize magnitude response at DC to 0dB.
  1319. @item order, o
  1320. Set the filter order, can be 1 or 2. Default is 2.
  1321. @item transform, a
  1322. Set transform type of IIR filter.
  1323. @table @option
  1324. @item di
  1325. @item dii
  1326. @item tdii
  1327. @item latt
  1328. @end table
  1329. @end table
  1330. @subsection Commands
  1331. This filter supports the following commands:
  1332. @table @option
  1333. @item frequency, f
  1334. Change allpass frequency.
  1335. Syntax for the command is : "@var{frequency}"
  1336. @item width_type, t
  1337. Change allpass width_type.
  1338. Syntax for the command is : "@var{width_type}"
  1339. @item width, w
  1340. Change allpass width.
  1341. Syntax for the command is : "@var{width}"
  1342. @item mix, m
  1343. Change allpass mix.
  1344. Syntax for the command is : "@var{mix}"
  1345. @end table
  1346. @section aloop
  1347. Loop audio samples.
  1348. The filter accepts the following options:
  1349. @table @option
  1350. @item loop
  1351. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1352. Default is 0.
  1353. @item size
  1354. Set maximal number of samples. Default is 0.
  1355. @item start
  1356. Set first sample of loop. Default is 0.
  1357. @end table
  1358. @anchor{amerge}
  1359. @section amerge
  1360. Merge two or more audio streams into a single multi-channel stream.
  1361. The filter accepts the following options:
  1362. @table @option
  1363. @item inputs
  1364. Set the number of inputs. Default is 2.
  1365. @end table
  1366. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1367. the channel layout of the output will be set accordingly and the channels
  1368. will be reordered as necessary. If the channel layouts of the inputs are not
  1369. disjoint, the output will have all the channels of the first input then all
  1370. the channels of the second input, in that order, and the channel layout of
  1371. the output will be the default value corresponding to the total number of
  1372. channels.
  1373. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1374. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1375. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1376. first input, b1 is the first channel of the second input).
  1377. On the other hand, if both input are in stereo, the output channels will be
  1378. in the default order: a1, a2, b1, b2, and the channel layout will be
  1379. arbitrarily set to 4.0, which may or may not be the expected value.
  1380. All inputs must have the same sample rate, and format.
  1381. If inputs do not have the same duration, the output will stop with the
  1382. shortest.
  1383. @subsection Examples
  1384. @itemize
  1385. @item
  1386. Merge two mono files into a stereo stream:
  1387. @example
  1388. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1389. @end example
  1390. @item
  1391. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1392. @example
  1393. 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
  1394. @end example
  1395. @end itemize
  1396. @section amix
  1397. Mixes multiple audio inputs into a single output.
  1398. Note that this filter only supports float samples (the @var{amerge}
  1399. and @var{pan} audio filters support many formats). If the @var{amix}
  1400. input has integer samples then @ref{aresample} will be automatically
  1401. inserted to perform the conversion to float samples.
  1402. For example
  1403. @example
  1404. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1405. @end example
  1406. will mix 3 input audio streams to a single output with the same duration as the
  1407. first input and a dropout transition time of 3 seconds.
  1408. It accepts the following parameters:
  1409. @table @option
  1410. @item inputs
  1411. The number of inputs. If unspecified, it defaults to 2.
  1412. @item duration
  1413. How to determine the end-of-stream.
  1414. @table @option
  1415. @item longest
  1416. The duration of the longest input. (default)
  1417. @item shortest
  1418. The duration of the shortest input.
  1419. @item first
  1420. The duration of the first input.
  1421. @end table
  1422. @item dropout_transition
  1423. The transition time, in seconds, for volume renormalization when an input
  1424. stream ends. The default value is 2 seconds.
  1425. @item weights
  1426. Specify weight of each input audio stream as sequence.
  1427. Each weight is separated by space. By default all inputs have same weight.
  1428. @end table
  1429. @subsection Commands
  1430. This filter supports the following commands:
  1431. @table @option
  1432. @item weights
  1433. Syntax is same as option with same name.
  1434. @end table
  1435. @section amultiply
  1436. Multiply first audio stream with second audio stream and store result
  1437. in output audio stream. Multiplication is done by multiplying each
  1438. sample from first stream with sample at same position from second stream.
  1439. With this element-wise multiplication one can create amplitude fades and
  1440. amplitude modulations.
  1441. @section anequalizer
  1442. High-order parametric multiband equalizer for each channel.
  1443. It accepts the following parameters:
  1444. @table @option
  1445. @item params
  1446. This option string is in format:
  1447. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1448. Each equalizer band is separated by '|'.
  1449. @table @option
  1450. @item chn
  1451. Set channel number to which equalization will be applied.
  1452. If input doesn't have that channel the entry is ignored.
  1453. @item f
  1454. Set central frequency for band.
  1455. If input doesn't have that frequency the entry is ignored.
  1456. @item w
  1457. Set band width in Hertz.
  1458. @item g
  1459. Set band gain in dB.
  1460. @item t
  1461. Set filter type for band, optional, can be:
  1462. @table @samp
  1463. @item 0
  1464. Butterworth, this is default.
  1465. @item 1
  1466. Chebyshev type 1.
  1467. @item 2
  1468. Chebyshev type 2.
  1469. @end table
  1470. @end table
  1471. @item curves
  1472. With this option activated frequency response of anequalizer is displayed
  1473. in video stream.
  1474. @item size
  1475. Set video stream size. Only useful if curves option is activated.
  1476. @item mgain
  1477. Set max gain that will be displayed. Only useful if curves option is activated.
  1478. Setting this to a reasonable value makes it possible to display gain which is derived from
  1479. neighbour bands which are too close to each other and thus produce higher gain
  1480. when both are activated.
  1481. @item fscale
  1482. Set frequency scale used to draw frequency response in video output.
  1483. Can be linear or logarithmic. Default is logarithmic.
  1484. @item colors
  1485. Set color for each channel curve which is going to be displayed in video stream.
  1486. This is list of color names separated by space or by '|'.
  1487. Unrecognised or missing colors will be replaced by white color.
  1488. @end table
  1489. @subsection Examples
  1490. @itemize
  1491. @item
  1492. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1493. for first 2 channels using Chebyshev type 1 filter:
  1494. @example
  1495. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1496. @end example
  1497. @end itemize
  1498. @subsection Commands
  1499. This filter supports the following commands:
  1500. @table @option
  1501. @item change
  1502. Alter existing filter parameters.
  1503. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1504. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1505. error is returned.
  1506. @var{freq} set new frequency parameter.
  1507. @var{width} set new width parameter in Hertz.
  1508. @var{gain} set new gain parameter in dB.
  1509. Full filter invocation with asendcmd may look like this:
  1510. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1511. @end table
  1512. @section anlmdn
  1513. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1514. Each sample is adjusted by looking for other samples with similar contexts. This
  1515. context similarity is defined by comparing their surrounding patches of size
  1516. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1517. The filter accepts the following options:
  1518. @table @option
  1519. @item s
  1520. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1521. @item p
  1522. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1523. Default value is 2 milliseconds.
  1524. @item r
  1525. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1526. Default value is 6 milliseconds.
  1527. @item o
  1528. Set the output mode.
  1529. It accepts the following values:
  1530. @table @option
  1531. @item i
  1532. Pass input unchanged.
  1533. @item o
  1534. Pass noise filtered out.
  1535. @item n
  1536. Pass only noise.
  1537. Default value is @var{o}.
  1538. @end table
  1539. @item m
  1540. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1541. @end table
  1542. @subsection Commands
  1543. This filter supports the all above options as @ref{commands}.
  1544. @section anlms
  1545. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1546. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1547. relate to producing the least mean square of the error signal (difference between the desired,
  1548. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1549. A description of the accepted options follows.
  1550. @table @option
  1551. @item order
  1552. Set filter order.
  1553. @item mu
  1554. Set filter mu.
  1555. @item eps
  1556. Set the filter eps.
  1557. @item leakage
  1558. Set the filter leakage.
  1559. @item out_mode
  1560. It accepts the following values:
  1561. @table @option
  1562. @item i
  1563. Pass the 1st input.
  1564. @item d
  1565. Pass the 2nd input.
  1566. @item o
  1567. Pass filtered samples.
  1568. @item n
  1569. Pass difference between desired and filtered samples.
  1570. Default value is @var{o}.
  1571. @end table
  1572. @end table
  1573. @subsection Examples
  1574. @itemize
  1575. @item
  1576. One of many usages of this filter is noise reduction, input audio is filtered
  1577. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1578. @example
  1579. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1580. @end example
  1581. @end itemize
  1582. @subsection Commands
  1583. This filter supports the same commands as options, excluding option @code{order}.
  1584. @section anull
  1585. Pass the audio source unchanged to the output.
  1586. @section apad
  1587. Pad the end of an audio stream with silence.
  1588. This can be used together with @command{ffmpeg} @option{-shortest} to
  1589. extend audio streams to the same length as the video stream.
  1590. A description of the accepted options follows.
  1591. @table @option
  1592. @item packet_size
  1593. Set silence packet size. Default value is 4096.
  1594. @item pad_len
  1595. Set the number of samples of silence to add to the end. After the
  1596. value is reached, the stream is terminated. This option is mutually
  1597. exclusive with @option{whole_len}.
  1598. @item whole_len
  1599. Set the minimum total number of samples in the output audio stream. If
  1600. the value is longer than the input audio length, silence is added to
  1601. the end, until the value is reached. This option is mutually exclusive
  1602. with @option{pad_len}.
  1603. @item pad_dur
  1604. Specify the duration of samples of silence to add. See
  1605. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1606. for the accepted syntax. Used only if set to non-zero value.
  1607. @item whole_dur
  1608. Specify the minimum total duration in the output audio stream. See
  1609. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1610. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1611. the input audio length, silence is added to the end, until the value is reached.
  1612. This option is mutually exclusive with @option{pad_dur}
  1613. @end table
  1614. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1615. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1616. the input stream indefinitely.
  1617. @subsection Examples
  1618. @itemize
  1619. @item
  1620. Add 1024 samples of silence to the end of the input:
  1621. @example
  1622. apad=pad_len=1024
  1623. @end example
  1624. @item
  1625. Make sure the audio output will contain at least 10000 samples, pad
  1626. the input with silence if required:
  1627. @example
  1628. apad=whole_len=10000
  1629. @end example
  1630. @item
  1631. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1632. video stream will always result the shortest and will be converted
  1633. until the end in the output file when using the @option{shortest}
  1634. option:
  1635. @example
  1636. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1637. @end example
  1638. @end itemize
  1639. @section aphaser
  1640. Add a phasing effect to the input audio.
  1641. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1642. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1643. A description of the accepted parameters follows.
  1644. @table @option
  1645. @item in_gain
  1646. Set input gain. Default is 0.4.
  1647. @item out_gain
  1648. Set output gain. Default is 0.74
  1649. @item delay
  1650. Set delay in milliseconds. Default is 3.0.
  1651. @item decay
  1652. Set decay. Default is 0.4.
  1653. @item speed
  1654. Set modulation speed in Hz. Default is 0.5.
  1655. @item type
  1656. Set modulation type. Default is triangular.
  1657. It accepts the following values:
  1658. @table @samp
  1659. @item triangular, t
  1660. @item sinusoidal, s
  1661. @end table
  1662. @end table
  1663. @section aphaseshift
  1664. Apply phase shift to input audio samples.
  1665. The filter accepts the following options:
  1666. @table @option
  1667. @item shift
  1668. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1669. Default value is 0.0.
  1670. @end table
  1671. @subsection Commands
  1672. This filter supports the above option as @ref{commands}.
  1673. @section apulsator
  1674. Audio pulsator is something between an autopanner and a tremolo.
  1675. But it can produce funny stereo effects as well. Pulsator changes the volume
  1676. of the left and right channel based on a LFO (low frequency oscillator) with
  1677. different waveforms and shifted phases.
  1678. This filter have the ability to define an offset between left and right
  1679. channel. An offset of 0 means that both LFO shapes match each other.
  1680. The left and right channel are altered equally - a conventional tremolo.
  1681. An offset of 50% means that the shape of the right channel is exactly shifted
  1682. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1683. an autopanner. At 1 both curves match again. Every setting in between moves the
  1684. phase shift gapless between all stages and produces some "bypassing" sounds with
  1685. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1686. the 0.5) the faster the signal passes from the left to the right speaker.
  1687. The filter accepts the following options:
  1688. @table @option
  1689. @item level_in
  1690. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1691. @item level_out
  1692. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1693. @item mode
  1694. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1695. sawup or sawdown. Default is sine.
  1696. @item amount
  1697. Set modulation. Define how much of original signal is affected by the LFO.
  1698. @item offset_l
  1699. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1700. @item offset_r
  1701. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1702. @item width
  1703. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1704. @item timing
  1705. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1706. @item bpm
  1707. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1708. is set to bpm.
  1709. @item ms
  1710. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1711. is set to ms.
  1712. @item hz
  1713. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1714. if timing is set to hz.
  1715. @end table
  1716. @anchor{aresample}
  1717. @section aresample
  1718. Resample the input audio to the specified parameters, using the
  1719. libswresample library. If none are specified then the filter will
  1720. automatically convert between its input and output.
  1721. This filter is also able to stretch/squeeze the audio data to make it match
  1722. the timestamps or to inject silence / cut out audio to make it match the
  1723. timestamps, do a combination of both or do neither.
  1724. The filter accepts the syntax
  1725. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1726. expresses a sample rate and @var{resampler_options} is a list of
  1727. @var{key}=@var{value} pairs, separated by ":". See the
  1728. @ref{Resampler Options,,"Resampler Options" section in the
  1729. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1730. for the complete list of supported options.
  1731. @subsection Examples
  1732. @itemize
  1733. @item
  1734. Resample the input audio to 44100Hz:
  1735. @example
  1736. aresample=44100
  1737. @end example
  1738. @item
  1739. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1740. samples per second compensation:
  1741. @example
  1742. aresample=async=1000
  1743. @end example
  1744. @end itemize
  1745. @section areverse
  1746. Reverse an audio clip.
  1747. Warning: This filter requires memory to buffer the entire clip, so trimming
  1748. is suggested.
  1749. @subsection Examples
  1750. @itemize
  1751. @item
  1752. Take the first 5 seconds of a clip, and reverse it.
  1753. @example
  1754. atrim=end=5,areverse
  1755. @end example
  1756. @end itemize
  1757. @section arnndn
  1758. Reduce noise from speech using Recurrent Neural Networks.
  1759. This filter accepts the following options:
  1760. @table @option
  1761. @item model, m
  1762. Set train model file to load. This option is always required.
  1763. @item mix
  1764. Set how much to mix filtered samples into final output.
  1765. Allowed range is from -1 to 1. Default value is 1.
  1766. Negative values are special, they set how much to keep filtered noise
  1767. in the final filter output. Set this option to -1 to hear actual
  1768. noise removed from input signal.
  1769. @end table
  1770. @section asetnsamples
  1771. Set the number of samples per each output audio frame.
  1772. The last output packet may contain a different number of samples, as
  1773. the filter will flush all the remaining samples when the input audio
  1774. signals its end.
  1775. The filter accepts the following options:
  1776. @table @option
  1777. @item nb_out_samples, n
  1778. Set the number of frames per each output audio frame. The number is
  1779. intended as the number of samples @emph{per each channel}.
  1780. Default value is 1024.
  1781. @item pad, p
  1782. If set to 1, the filter will pad the last audio frame with zeroes, so
  1783. that the last frame will contain the same number of samples as the
  1784. previous ones. Default value is 1.
  1785. @end table
  1786. For example, to set the number of per-frame samples to 1234 and
  1787. disable padding for the last frame, use:
  1788. @example
  1789. asetnsamples=n=1234:p=0
  1790. @end example
  1791. @section asetrate
  1792. Set the sample rate without altering the PCM data.
  1793. This will result in a change of speed and pitch.
  1794. The filter accepts the following options:
  1795. @table @option
  1796. @item sample_rate, r
  1797. Set the output sample rate. Default is 44100 Hz.
  1798. @end table
  1799. @section ashowinfo
  1800. Show a line containing various information for each input audio frame.
  1801. The input audio is not modified.
  1802. The shown line contains a sequence of key/value pairs of the form
  1803. @var{key}:@var{value}.
  1804. The following values are shown in the output:
  1805. @table @option
  1806. @item n
  1807. The (sequential) number of the input frame, starting from 0.
  1808. @item pts
  1809. The presentation timestamp of the input frame, in time base units; the time base
  1810. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1811. @item pts_time
  1812. The presentation timestamp of the input frame in seconds.
  1813. @item pos
  1814. position of the frame in the input stream, -1 if this information in
  1815. unavailable and/or meaningless (for example in case of synthetic audio)
  1816. @item fmt
  1817. The sample format.
  1818. @item chlayout
  1819. The channel layout.
  1820. @item rate
  1821. The sample rate for the audio frame.
  1822. @item nb_samples
  1823. The number of samples (per channel) in the frame.
  1824. @item checksum
  1825. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1826. audio, the data is treated as if all the planes were concatenated.
  1827. @item plane_checksums
  1828. A list of Adler-32 checksums for each data plane.
  1829. @end table
  1830. @section asoftclip
  1831. Apply audio soft clipping.
  1832. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1833. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1834. This filter accepts the following options:
  1835. @table @option
  1836. @item type
  1837. Set type of soft-clipping.
  1838. It accepts the following values:
  1839. @table @option
  1840. @item hard
  1841. @item tanh
  1842. @item atan
  1843. @item cubic
  1844. @item exp
  1845. @item alg
  1846. @item quintic
  1847. @item sin
  1848. @item erf
  1849. @end table
  1850. @item param
  1851. Set additional parameter which controls sigmoid function.
  1852. @item oversample
  1853. Set oversampling factor.
  1854. @end table
  1855. @subsection Commands
  1856. This filter supports the all above options as @ref{commands}.
  1857. @section asr
  1858. Automatic Speech Recognition
  1859. This filter uses PocketSphinx for speech recognition. To enable
  1860. compilation of this filter, you need to configure FFmpeg with
  1861. @code{--enable-pocketsphinx}.
  1862. It accepts the following options:
  1863. @table @option
  1864. @item rate
  1865. Set sampling rate of input audio. Defaults is @code{16000}.
  1866. This need to match speech models, otherwise one will get poor results.
  1867. @item hmm
  1868. Set dictionary containing acoustic model files.
  1869. @item dict
  1870. Set pronunciation dictionary.
  1871. @item lm
  1872. Set language model file.
  1873. @item lmctl
  1874. Set language model set.
  1875. @item lmname
  1876. Set which language model to use.
  1877. @item logfn
  1878. Set output for log messages.
  1879. @end table
  1880. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1881. @anchor{astats}
  1882. @section astats
  1883. Display time domain statistical information about the audio channels.
  1884. Statistics are calculated and displayed for each audio channel and,
  1885. where applicable, an overall figure is also given.
  1886. It accepts the following option:
  1887. @table @option
  1888. @item length
  1889. Short window length in seconds, used for peak and trough RMS measurement.
  1890. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1891. @item metadata
  1892. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1893. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1894. disabled.
  1895. Available keys for each channel are:
  1896. DC_offset
  1897. Min_level
  1898. Max_level
  1899. Min_difference
  1900. Max_difference
  1901. Mean_difference
  1902. RMS_difference
  1903. Peak_level
  1904. RMS_peak
  1905. RMS_trough
  1906. Crest_factor
  1907. Flat_factor
  1908. Peak_count
  1909. Noise_floor
  1910. Noise_floor_count
  1911. Bit_depth
  1912. Dynamic_range
  1913. Zero_crossings
  1914. Zero_crossings_rate
  1915. Number_of_NaNs
  1916. Number_of_Infs
  1917. Number_of_denormals
  1918. and for Overall:
  1919. DC_offset
  1920. Min_level
  1921. Max_level
  1922. Min_difference
  1923. Max_difference
  1924. Mean_difference
  1925. RMS_difference
  1926. Peak_level
  1927. RMS_level
  1928. RMS_peak
  1929. RMS_trough
  1930. Flat_factor
  1931. Peak_count
  1932. Noise_floor
  1933. Noise_floor_count
  1934. Bit_depth
  1935. Number_of_samples
  1936. Number_of_NaNs
  1937. Number_of_Infs
  1938. Number_of_denormals
  1939. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1940. this @code{lavfi.astats.Overall.Peak_count}.
  1941. For description what each key means read below.
  1942. @item reset
  1943. Set number of frame after which stats are going to be recalculated.
  1944. Default is disabled.
  1945. @item measure_perchannel
  1946. Select the entries which need to be measured per channel. The metadata keys can
  1947. be used as flags, default is @option{all} which measures everything.
  1948. @option{none} disables all per channel measurement.
  1949. @item measure_overall
  1950. Select the entries which need to be measured overall. The metadata keys can
  1951. be used as flags, default is @option{all} which measures everything.
  1952. @option{none} disables all overall measurement.
  1953. @end table
  1954. A description of each shown parameter follows:
  1955. @table @option
  1956. @item DC offset
  1957. Mean amplitude displacement from zero.
  1958. @item Min level
  1959. Minimal sample level.
  1960. @item Max level
  1961. Maximal sample level.
  1962. @item Min difference
  1963. Minimal difference between two consecutive samples.
  1964. @item Max difference
  1965. Maximal difference between two consecutive samples.
  1966. @item Mean difference
  1967. Mean difference between two consecutive samples.
  1968. The average of each difference between two consecutive samples.
  1969. @item RMS difference
  1970. Root Mean Square difference between two consecutive samples.
  1971. @item Peak level dB
  1972. @item RMS level dB
  1973. Standard peak and RMS level measured in dBFS.
  1974. @item RMS peak dB
  1975. @item RMS trough dB
  1976. Peak and trough values for RMS level measured over a short window.
  1977. @item Crest factor
  1978. Standard ratio of peak to RMS level (note: not in dB).
  1979. @item Flat factor
  1980. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1981. (i.e. either @var{Min level} or @var{Max level}).
  1982. @item Peak count
  1983. Number of occasions (not the number of samples) that the signal attained either
  1984. @var{Min level} or @var{Max level}.
  1985. @item Noise floor dB
  1986. Minimum local peak measured in dBFS over a short window.
  1987. @item Noise floor count
  1988. Number of occasions (not the number of samples) that the signal attained
  1989. @var{Noise floor}.
  1990. @item Bit depth
  1991. Overall bit depth of audio. Number of bits used for each sample.
  1992. @item Dynamic range
  1993. Measured dynamic range of audio in dB.
  1994. @item Zero crossings
  1995. Number of points where the waveform crosses the zero level axis.
  1996. @item Zero crossings rate
  1997. Rate of Zero crossings and number of audio samples.
  1998. @end table
  1999. @section asubboost
  2000. Boost subwoofer frequencies.
  2001. The filter accepts the following options:
  2002. @table @option
  2003. @item dry
  2004. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2005. Default value is 0.7.
  2006. @item wet
  2007. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2008. Default value is 0.7.
  2009. @item decay
  2010. Set delay line decay gain value. Allowed range is from 0 to 1.
  2011. Default value is 0.7.
  2012. @item feedback
  2013. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2014. Default value is 0.9.
  2015. @item cutoff
  2016. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2017. Default value is 100.
  2018. @item slope
  2019. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2020. Default value is 0.5.
  2021. @item delay
  2022. Set delay. Allowed range is from 1 to 100.
  2023. Default value is 20.
  2024. @end table
  2025. @subsection Commands
  2026. This filter supports the all above options as @ref{commands}.
  2027. @section asupercut
  2028. Cut super frequencies.
  2029. The filter accepts the following options:
  2030. @table @option
  2031. @item cutoff
  2032. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2033. Default value is 20000.
  2034. @item order
  2035. Set filter order. Available values are from 3 to 20.
  2036. Default value is 10.
  2037. @end table
  2038. @subsection Commands
  2039. This filter supports the all above options as @ref{commands}.
  2040. @section atempo
  2041. Adjust audio tempo.
  2042. The filter accepts exactly one parameter, the audio tempo. If not
  2043. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2044. be in the [0.5, 100.0] range.
  2045. Note that tempo greater than 2 will skip some samples rather than
  2046. blend them in. If for any reason this is a concern it is always
  2047. possible to daisy-chain several instances of atempo to achieve the
  2048. desired product tempo.
  2049. @subsection Examples
  2050. @itemize
  2051. @item
  2052. Slow down audio to 80% tempo:
  2053. @example
  2054. atempo=0.8
  2055. @end example
  2056. @item
  2057. To speed up audio to 300% tempo:
  2058. @example
  2059. atempo=3
  2060. @end example
  2061. @item
  2062. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2063. @example
  2064. atempo=sqrt(3),atempo=sqrt(3)
  2065. @end example
  2066. @end itemize
  2067. @subsection Commands
  2068. This filter supports the following commands:
  2069. @table @option
  2070. @item tempo
  2071. Change filter tempo scale factor.
  2072. Syntax for the command is : "@var{tempo}"
  2073. @end table
  2074. @section atrim
  2075. Trim the input so that the output contains one continuous subpart of the input.
  2076. It accepts the following parameters:
  2077. @table @option
  2078. @item start
  2079. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2080. sample with the timestamp @var{start} will be the first sample in the output.
  2081. @item end
  2082. Specify time of the first audio sample that will be dropped, i.e. the
  2083. audio sample immediately preceding the one with the timestamp @var{end} will be
  2084. the last sample in the output.
  2085. @item start_pts
  2086. Same as @var{start}, except this option sets the start timestamp in samples
  2087. instead of seconds.
  2088. @item end_pts
  2089. Same as @var{end}, except this option sets the end timestamp in samples instead
  2090. of seconds.
  2091. @item duration
  2092. The maximum duration of the output in seconds.
  2093. @item start_sample
  2094. The number of the first sample that should be output.
  2095. @item end_sample
  2096. The number of the first sample that should be dropped.
  2097. @end table
  2098. @option{start}, @option{end}, and @option{duration} are expressed as time
  2099. duration specifications; see
  2100. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2101. Note that the first two sets of the start/end options and the @option{duration}
  2102. option look at the frame timestamp, while the _sample options simply count the
  2103. samples that pass through the filter. So start/end_pts and start/end_sample will
  2104. give different results when the timestamps are wrong, inexact or do not start at
  2105. zero. Also note that this filter does not modify the timestamps. If you wish
  2106. to have the output timestamps start at zero, insert the asetpts filter after the
  2107. atrim filter.
  2108. If multiple start or end options are set, this filter tries to be greedy and
  2109. keep all samples that match at least one of the specified constraints. To keep
  2110. only the part that matches all the constraints at once, chain multiple atrim
  2111. filters.
  2112. The defaults are such that all the input is kept. So it is possible to set e.g.
  2113. just the end values to keep everything before the specified time.
  2114. Examples:
  2115. @itemize
  2116. @item
  2117. Drop everything except the second minute of input:
  2118. @example
  2119. ffmpeg -i INPUT -af atrim=60:120
  2120. @end example
  2121. @item
  2122. Keep only the first 1000 samples:
  2123. @example
  2124. ffmpeg -i INPUT -af atrim=end_sample=1000
  2125. @end example
  2126. @end itemize
  2127. @section axcorrelate
  2128. Calculate normalized cross-correlation between two input audio streams.
  2129. Resulted samples are always between -1 and 1 inclusive.
  2130. If result is 1 it means two input samples are highly correlated in that selected segment.
  2131. Result 0 means they are not correlated at all.
  2132. If result is -1 it means two input samples are out of phase, which means they cancel each
  2133. other.
  2134. The filter accepts the following options:
  2135. @table @option
  2136. @item size
  2137. Set size of segment over which cross-correlation is calculated.
  2138. Default is 256. Allowed range is from 2 to 131072.
  2139. @item algo
  2140. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2141. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2142. are always zero and thus need much less calculations to make.
  2143. This is generally not true, but is valid for typical audio streams.
  2144. @end table
  2145. @subsection Examples
  2146. @itemize
  2147. @item
  2148. Calculate correlation between channels in stereo audio stream:
  2149. @example
  2150. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2151. @end example
  2152. @end itemize
  2153. @section bandpass
  2154. Apply a two-pole Butterworth band-pass filter with central
  2155. frequency @var{frequency}, and (3dB-point) band-width width.
  2156. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2157. instead of the default: constant 0dB peak gain.
  2158. The filter roll off at 6dB per octave (20dB per decade).
  2159. The filter accepts the following options:
  2160. @table @option
  2161. @item frequency, f
  2162. Set the filter's central frequency. Default is @code{3000}.
  2163. @item csg
  2164. Constant skirt gain if set to 1. Defaults to 0.
  2165. @item width_type, t
  2166. Set method to specify band-width of filter.
  2167. @table @option
  2168. @item h
  2169. Hz
  2170. @item q
  2171. Q-Factor
  2172. @item o
  2173. octave
  2174. @item s
  2175. slope
  2176. @item k
  2177. kHz
  2178. @end table
  2179. @item width, w
  2180. Specify the band-width of a filter in width_type units.
  2181. @item mix, m
  2182. How much to use filtered signal in output. Default is 1.
  2183. Range is between 0 and 1.
  2184. @item channels, c
  2185. Specify which channels to filter, by default all available are filtered.
  2186. @item normalize, n
  2187. Normalize biquad coefficients, by default is disabled.
  2188. Enabling it will normalize magnitude response at DC to 0dB.
  2189. @item transform, a
  2190. Set transform type of IIR filter.
  2191. @table @option
  2192. @item di
  2193. @item dii
  2194. @item tdii
  2195. @item latt
  2196. @end table
  2197. @end table
  2198. @subsection Commands
  2199. This filter supports the following commands:
  2200. @table @option
  2201. @item frequency, f
  2202. Change bandpass frequency.
  2203. Syntax for the command is : "@var{frequency}"
  2204. @item width_type, t
  2205. Change bandpass width_type.
  2206. Syntax for the command is : "@var{width_type}"
  2207. @item width, w
  2208. Change bandpass width.
  2209. Syntax for the command is : "@var{width}"
  2210. @item mix, m
  2211. Change bandpass mix.
  2212. Syntax for the command is : "@var{mix}"
  2213. @end table
  2214. @section bandreject
  2215. Apply a two-pole Butterworth band-reject filter with central
  2216. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2217. The filter roll off at 6dB per octave (20dB per decade).
  2218. The filter accepts the following options:
  2219. @table @option
  2220. @item frequency, f
  2221. Set the filter's central frequency. Default is @code{3000}.
  2222. @item width_type, t
  2223. Set method to specify band-width of filter.
  2224. @table @option
  2225. @item h
  2226. Hz
  2227. @item q
  2228. Q-Factor
  2229. @item o
  2230. octave
  2231. @item s
  2232. slope
  2233. @item k
  2234. kHz
  2235. @end table
  2236. @item width, w
  2237. Specify the band-width of a filter in width_type units.
  2238. @item mix, m
  2239. How much to use filtered signal in output. Default is 1.
  2240. Range is between 0 and 1.
  2241. @item channels, c
  2242. Specify which channels to filter, by default all available are filtered.
  2243. @item normalize, n
  2244. Normalize biquad coefficients, by default is disabled.
  2245. Enabling it will normalize magnitude response at DC to 0dB.
  2246. @item transform, a
  2247. Set transform type of IIR filter.
  2248. @table @option
  2249. @item di
  2250. @item dii
  2251. @item tdii
  2252. @item latt
  2253. @end table
  2254. @end table
  2255. @subsection Commands
  2256. This filter supports the following commands:
  2257. @table @option
  2258. @item frequency, f
  2259. Change bandreject frequency.
  2260. Syntax for the command is : "@var{frequency}"
  2261. @item width_type, t
  2262. Change bandreject width_type.
  2263. Syntax for the command is : "@var{width_type}"
  2264. @item width, w
  2265. Change bandreject width.
  2266. Syntax for the command is : "@var{width}"
  2267. @item mix, m
  2268. Change bandreject mix.
  2269. Syntax for the command is : "@var{mix}"
  2270. @end table
  2271. @section bass, lowshelf
  2272. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2273. shelving filter with a response similar to that of a standard
  2274. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2275. The filter accepts the following options:
  2276. @table @option
  2277. @item gain, g
  2278. Give the gain at 0 Hz. Its useful range is about -20
  2279. (for a large cut) to +20 (for a large boost).
  2280. Beware of clipping when using a positive gain.
  2281. @item frequency, f
  2282. Set the filter's central frequency and so can be used
  2283. to extend or reduce the frequency range to be boosted or cut.
  2284. The default value is @code{100} Hz.
  2285. @item width_type, t
  2286. Set method to specify band-width of filter.
  2287. @table @option
  2288. @item h
  2289. Hz
  2290. @item q
  2291. Q-Factor
  2292. @item o
  2293. octave
  2294. @item s
  2295. slope
  2296. @item k
  2297. kHz
  2298. @end table
  2299. @item width, w
  2300. Determine how steep is the filter's shelf transition.
  2301. @item mix, m
  2302. How much to use filtered signal in output. Default is 1.
  2303. Range is between 0 and 1.
  2304. @item channels, c
  2305. Specify which channels to filter, by default all available are filtered.
  2306. @item normalize, n
  2307. Normalize biquad coefficients, by default is disabled.
  2308. Enabling it will normalize magnitude response at DC to 0dB.
  2309. @item transform, a
  2310. Set transform type of IIR filter.
  2311. @table @option
  2312. @item di
  2313. @item dii
  2314. @item tdii
  2315. @item latt
  2316. @end table
  2317. @end table
  2318. @subsection Commands
  2319. This filter supports the following commands:
  2320. @table @option
  2321. @item frequency, f
  2322. Change bass frequency.
  2323. Syntax for the command is : "@var{frequency}"
  2324. @item width_type, t
  2325. Change bass width_type.
  2326. Syntax for the command is : "@var{width_type}"
  2327. @item width, w
  2328. Change bass width.
  2329. Syntax for the command is : "@var{width}"
  2330. @item gain, g
  2331. Change bass gain.
  2332. Syntax for the command is : "@var{gain}"
  2333. @item mix, m
  2334. Change bass mix.
  2335. Syntax for the command is : "@var{mix}"
  2336. @end table
  2337. @section biquad
  2338. Apply a biquad IIR filter with the given coefficients.
  2339. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2340. are the numerator and denominator coefficients respectively.
  2341. and @var{channels}, @var{c} specify which channels to filter, by default all
  2342. available are filtered.
  2343. @subsection Commands
  2344. This filter supports the following commands:
  2345. @table @option
  2346. @item a0
  2347. @item a1
  2348. @item a2
  2349. @item b0
  2350. @item b1
  2351. @item b2
  2352. Change biquad parameter.
  2353. Syntax for the command is : "@var{value}"
  2354. @item mix, m
  2355. How much to use filtered signal in output. Default is 1.
  2356. Range is between 0 and 1.
  2357. @item channels, c
  2358. Specify which channels to filter, by default all available are filtered.
  2359. @item normalize, n
  2360. Normalize biquad coefficients, by default is disabled.
  2361. Enabling it will normalize magnitude response at DC to 0dB.
  2362. @item transform, a
  2363. Set transform type of IIR filter.
  2364. @table @option
  2365. @item di
  2366. @item dii
  2367. @item tdii
  2368. @item latt
  2369. @end table
  2370. @end table
  2371. @section bs2b
  2372. Bauer stereo to binaural transformation, which improves headphone listening of
  2373. stereo audio records.
  2374. To enable compilation of this filter you need to configure FFmpeg with
  2375. @code{--enable-libbs2b}.
  2376. It accepts the following parameters:
  2377. @table @option
  2378. @item profile
  2379. Pre-defined crossfeed level.
  2380. @table @option
  2381. @item default
  2382. Default level (fcut=700, feed=50).
  2383. @item cmoy
  2384. Chu Moy circuit (fcut=700, feed=60).
  2385. @item jmeier
  2386. Jan Meier circuit (fcut=650, feed=95).
  2387. @end table
  2388. @item fcut
  2389. Cut frequency (in Hz).
  2390. @item feed
  2391. Feed level (in Hz).
  2392. @end table
  2393. @section channelmap
  2394. Remap input channels to new locations.
  2395. It accepts the following parameters:
  2396. @table @option
  2397. @item map
  2398. Map channels from input to output. The argument is a '|'-separated list of
  2399. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2400. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2401. channel (e.g. FL for front left) or its index in the input channel layout.
  2402. @var{out_channel} is the name of the output channel or its index in the output
  2403. channel layout. If @var{out_channel} is not given then it is implicitly an
  2404. index, starting with zero and increasing by one for each mapping.
  2405. @item channel_layout
  2406. The channel layout of the output stream.
  2407. @end table
  2408. If no mapping is present, the filter will implicitly map input channels to
  2409. output channels, preserving indices.
  2410. @subsection Examples
  2411. @itemize
  2412. @item
  2413. For example, assuming a 5.1+downmix input MOV file,
  2414. @example
  2415. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2416. @end example
  2417. will create an output WAV file tagged as stereo from the downmix channels of
  2418. the input.
  2419. @item
  2420. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2421. @example
  2422. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2423. @end example
  2424. @end itemize
  2425. @section channelsplit
  2426. Split each channel from an input audio stream into a separate output stream.
  2427. It accepts the following parameters:
  2428. @table @option
  2429. @item channel_layout
  2430. The channel layout of the input stream. The default is "stereo".
  2431. @item channels
  2432. A channel layout describing the channels to be extracted as separate output streams
  2433. or "all" to extract each input channel as a separate stream. The default is "all".
  2434. Choosing channels not present in channel layout in the input will result in an error.
  2435. @end table
  2436. @subsection Examples
  2437. @itemize
  2438. @item
  2439. For example, assuming a stereo input MP3 file,
  2440. @example
  2441. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2442. @end example
  2443. will create an output Matroska file with two audio streams, one containing only
  2444. the left channel and the other the right channel.
  2445. @item
  2446. Split a 5.1 WAV file into per-channel files:
  2447. @example
  2448. ffmpeg -i in.wav -filter_complex
  2449. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2450. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2451. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2452. side_right.wav
  2453. @end example
  2454. @item
  2455. Extract only LFE from a 5.1 WAV file:
  2456. @example
  2457. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2458. -map '[LFE]' lfe.wav
  2459. @end example
  2460. @end itemize
  2461. @section chorus
  2462. Add a chorus effect to the audio.
  2463. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2464. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2465. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2466. The modulation depth defines the range the modulated delay is played before or after
  2467. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2468. sound tuned around the original one, like in a chorus where some vocals are slightly
  2469. off key.
  2470. It accepts the following parameters:
  2471. @table @option
  2472. @item in_gain
  2473. Set input gain. Default is 0.4.
  2474. @item out_gain
  2475. Set output gain. Default is 0.4.
  2476. @item delays
  2477. Set delays. A typical delay is around 40ms to 60ms.
  2478. @item decays
  2479. Set decays.
  2480. @item speeds
  2481. Set speeds.
  2482. @item depths
  2483. Set depths.
  2484. @end table
  2485. @subsection Examples
  2486. @itemize
  2487. @item
  2488. A single delay:
  2489. @example
  2490. chorus=0.7:0.9:55:0.4:0.25:2
  2491. @end example
  2492. @item
  2493. Two delays:
  2494. @example
  2495. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2496. @end example
  2497. @item
  2498. Fuller sounding chorus with three delays:
  2499. @example
  2500. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  2501. @end example
  2502. @end itemize
  2503. @section compand
  2504. Compress or expand the audio's dynamic range.
  2505. It accepts the following parameters:
  2506. @table @option
  2507. @item attacks
  2508. @item decays
  2509. A list of times in seconds for each channel over which the instantaneous level
  2510. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2511. increase of volume and @var{decays} refers to decrease of volume. For most
  2512. situations, the attack time (response to the audio getting louder) should be
  2513. shorter than the decay time, because the human ear is more sensitive to sudden
  2514. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2515. a typical value for decay is 0.8 seconds.
  2516. If specified number of attacks & decays is lower than number of channels, the last
  2517. set attack/decay will be used for all remaining channels.
  2518. @item points
  2519. A list of points for the transfer function, specified in dB relative to the
  2520. maximum possible signal amplitude. Each key points list must be defined using
  2521. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2522. @code{x0/y0 x1/y1 x2/y2 ....}
  2523. The input values must be in strictly increasing order but the transfer function
  2524. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2525. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2526. function are @code{-70/-70|-60/-20|1/0}.
  2527. @item soft-knee
  2528. Set the curve radius in dB for all joints. It defaults to 0.01.
  2529. @item gain
  2530. Set the additional gain in dB to be applied at all points on the transfer
  2531. function. This allows for easy adjustment of the overall gain.
  2532. It defaults to 0.
  2533. @item volume
  2534. Set an initial volume, in dB, to be assumed for each channel when filtering
  2535. starts. This permits the user to supply a nominal level initially, so that, for
  2536. example, a very large gain is not applied to initial signal levels before the
  2537. companding has begun to operate. A typical value for audio which is initially
  2538. quiet is -90 dB. It defaults to 0.
  2539. @item delay
  2540. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2541. delayed before being fed to the volume adjuster. Specifying a delay
  2542. approximately equal to the attack/decay times allows the filter to effectively
  2543. operate in predictive rather than reactive mode. It defaults to 0.
  2544. @end table
  2545. @subsection Examples
  2546. @itemize
  2547. @item
  2548. Make music with both quiet and loud passages suitable for listening to in a
  2549. noisy environment:
  2550. @example
  2551. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2552. @end example
  2553. Another example for audio with whisper and explosion parts:
  2554. @example
  2555. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2556. @end example
  2557. @item
  2558. A noise gate for when the noise is at a lower level than the signal:
  2559. @example
  2560. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2561. @end example
  2562. @item
  2563. Here is another noise gate, this time for when the noise is at a higher level
  2564. than the signal (making it, in some ways, similar to squelch):
  2565. @example
  2566. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2567. @end example
  2568. @item
  2569. 2:1 compression starting at -6dB:
  2570. @example
  2571. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2572. @end example
  2573. @item
  2574. 2:1 compression starting at -9dB:
  2575. @example
  2576. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2577. @end example
  2578. @item
  2579. 2:1 compression starting at -12dB:
  2580. @example
  2581. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2582. @end example
  2583. @item
  2584. 2:1 compression starting at -18dB:
  2585. @example
  2586. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2587. @end example
  2588. @item
  2589. 3:1 compression starting at -15dB:
  2590. @example
  2591. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2592. @end example
  2593. @item
  2594. Compressor/Gate:
  2595. @example
  2596. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2597. @end example
  2598. @item
  2599. Expander:
  2600. @example
  2601. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  2602. @end example
  2603. @item
  2604. Hard limiter at -6dB:
  2605. @example
  2606. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2607. @end example
  2608. @item
  2609. Hard limiter at -12dB:
  2610. @example
  2611. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2612. @end example
  2613. @item
  2614. Hard noise gate at -35 dB:
  2615. @example
  2616. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2617. @end example
  2618. @item
  2619. Soft limiter:
  2620. @example
  2621. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2622. @end example
  2623. @end itemize
  2624. @section compensationdelay
  2625. Compensation Delay Line is a metric based delay to compensate differing
  2626. positions of microphones or speakers.
  2627. For example, you have recorded guitar with two microphones placed in
  2628. different locations. Because the front of sound wave has fixed speed in
  2629. normal conditions, the phasing of microphones can vary and depends on
  2630. their location and interposition. The best sound mix can be achieved when
  2631. these microphones are in phase (synchronized). Note that a distance of
  2632. ~30 cm between microphones makes one microphone capture the signal in
  2633. antiphase to the other microphone. That makes the final mix sound moody.
  2634. This filter helps to solve phasing problems by adding different delays
  2635. to each microphone track and make them synchronized.
  2636. The best result can be reached when you take one track as base and
  2637. synchronize other tracks one by one with it.
  2638. Remember that synchronization/delay tolerance depends on sample rate, too.
  2639. Higher sample rates will give more tolerance.
  2640. The filter accepts the following parameters:
  2641. @table @option
  2642. @item mm
  2643. Set millimeters distance. This is compensation distance for fine tuning.
  2644. Default is 0.
  2645. @item cm
  2646. Set cm distance. This is compensation distance for tightening distance setup.
  2647. Default is 0.
  2648. @item m
  2649. Set meters distance. This is compensation distance for hard distance setup.
  2650. Default is 0.
  2651. @item dry
  2652. Set dry amount. Amount of unprocessed (dry) signal.
  2653. Default is 0.
  2654. @item wet
  2655. Set wet amount. Amount of processed (wet) signal.
  2656. Default is 1.
  2657. @item temp
  2658. Set temperature in degrees Celsius. This is the temperature of the environment.
  2659. Default is 20.
  2660. @end table
  2661. @section crossfeed
  2662. Apply headphone crossfeed filter.
  2663. Crossfeed is the process of blending the left and right channels of stereo
  2664. audio recording.
  2665. It is mainly used to reduce extreme stereo separation of low frequencies.
  2666. The intent is to produce more speaker like sound to the listener.
  2667. The filter accepts the following options:
  2668. @table @option
  2669. @item strength
  2670. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2671. This sets gain of low shelf filter for side part of stereo image.
  2672. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2673. @item range
  2674. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2675. This sets cut off frequency of low shelf filter. Default is cut off near
  2676. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2677. @item slope
  2678. Set curve slope of low shelf filter. Default is 0.5.
  2679. Allowed range is from 0.01 to 1.
  2680. @item level_in
  2681. Set input gain. Default is 0.9.
  2682. @item level_out
  2683. Set output gain. Default is 1.
  2684. @end table
  2685. @subsection Commands
  2686. This filter supports the all above options as @ref{commands}.
  2687. @section crystalizer
  2688. Simple algorithm to expand audio dynamic range.
  2689. The filter accepts the following options:
  2690. @table @option
  2691. @item i
  2692. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2693. (unchanged sound) to 10.0 (maximum effect).
  2694. @item c
  2695. Enable clipping. By default is enabled.
  2696. @end table
  2697. @subsection Commands
  2698. This filter supports the all above options as @ref{commands}.
  2699. @section dcshift
  2700. Apply a DC shift to the audio.
  2701. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2702. in the recording chain) from the audio. The effect of a DC offset is reduced
  2703. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2704. a signal has a DC offset.
  2705. @table @option
  2706. @item shift
  2707. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2708. the audio.
  2709. @item limitergain
  2710. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2711. used to prevent clipping.
  2712. @end table
  2713. @section deesser
  2714. Apply de-essing to the audio samples.
  2715. @table @option
  2716. @item i
  2717. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2718. Default is 0.
  2719. @item m
  2720. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2721. Default is 0.5.
  2722. @item f
  2723. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2724. Default is 0.5.
  2725. @item s
  2726. Set the output mode.
  2727. It accepts the following values:
  2728. @table @option
  2729. @item i
  2730. Pass input unchanged.
  2731. @item o
  2732. Pass ess filtered out.
  2733. @item e
  2734. Pass only ess.
  2735. Default value is @var{o}.
  2736. @end table
  2737. @end table
  2738. @section drmeter
  2739. Measure audio dynamic range.
  2740. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2741. is found in transition material. And anything less that 8 have very poor dynamics
  2742. and is very compressed.
  2743. The filter accepts the following options:
  2744. @table @option
  2745. @item length
  2746. Set window length in seconds used to split audio into segments of equal length.
  2747. Default is 3 seconds.
  2748. @end table
  2749. @section dynaudnorm
  2750. Dynamic Audio Normalizer.
  2751. This filter applies a certain amount of gain to the input audio in order
  2752. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2753. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2754. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2755. This allows for applying extra gain to the "quiet" sections of the audio
  2756. while avoiding distortions or clipping the "loud" sections. In other words:
  2757. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2758. sections, in the sense that the volume of each section is brought to the
  2759. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2760. this goal *without* applying "dynamic range compressing". It will retain 100%
  2761. of the dynamic range *within* each section of the audio file.
  2762. @table @option
  2763. @item framelen, f
  2764. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2765. Default is 500 milliseconds.
  2766. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2767. referred to as frames. This is required, because a peak magnitude has no
  2768. meaning for just a single sample value. Instead, we need to determine the
  2769. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2770. normalizer would simply use the peak magnitude of the complete file, the
  2771. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2772. frame. The length of a frame is specified in milliseconds. By default, the
  2773. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2774. been found to give good results with most files.
  2775. Note that the exact frame length, in number of samples, will be determined
  2776. automatically, based on the sampling rate of the individual input audio file.
  2777. @item gausssize, g
  2778. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2779. number. Default is 31.
  2780. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2781. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2782. is specified in frames, centered around the current frame. For the sake of
  2783. simplicity, this must be an odd number. Consequently, the default value of 31
  2784. takes into account the current frame, as well as the 15 preceding frames and
  2785. the 15 subsequent frames. Using a larger window results in a stronger
  2786. smoothing effect and thus in less gain variation, i.e. slower gain
  2787. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2788. effect and thus in more gain variation, i.e. faster gain adaptation.
  2789. In other words, the more you increase this value, the more the Dynamic Audio
  2790. Normalizer will behave like a "traditional" normalization filter. On the
  2791. contrary, the more you decrease this value, the more the Dynamic Audio
  2792. Normalizer will behave like a dynamic range compressor.
  2793. @item peak, p
  2794. Set the target peak value. This specifies the highest permissible magnitude
  2795. level for the normalized audio input. This filter will try to approach the
  2796. target peak magnitude as closely as possible, but at the same time it also
  2797. makes sure that the normalized signal will never exceed the peak magnitude.
  2798. A frame's maximum local gain factor is imposed directly by the target peak
  2799. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2800. It is not recommended to go above this value.
  2801. @item maxgain, m
  2802. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2803. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2804. factor for each input frame, i.e. the maximum gain factor that does not
  2805. result in clipping or distortion. The maximum gain factor is determined by
  2806. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2807. additionally bounds the frame's maximum gain factor by a predetermined
  2808. (global) maximum gain factor. This is done in order to avoid excessive gain
  2809. factors in "silent" or almost silent frames. By default, the maximum gain
  2810. factor is 10.0, For most inputs the default value should be sufficient and
  2811. it usually is not recommended to increase this value. Though, for input
  2812. with an extremely low overall volume level, it may be necessary to allow even
  2813. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2814. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2815. Instead, a "sigmoid" threshold function will be applied. This way, the
  2816. gain factors will smoothly approach the threshold value, but never exceed that
  2817. value.
  2818. @item targetrms, r
  2819. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2820. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2821. This means that the maximum local gain factor for each frame is defined
  2822. (only) by the frame's highest magnitude sample. This way, the samples can
  2823. be amplified as much as possible without exceeding the maximum signal
  2824. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2825. Normalizer can also take into account the frame's root mean square,
  2826. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2827. determine the power of a time-varying signal. It is therefore considered
  2828. that the RMS is a better approximation of the "perceived loudness" than
  2829. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2830. frames to a constant RMS value, a uniform "perceived loudness" can be
  2831. established. If a target RMS value has been specified, a frame's local gain
  2832. factor is defined as the factor that would result in exactly that RMS value.
  2833. Note, however, that the maximum local gain factor is still restricted by the
  2834. frame's highest magnitude sample, in order to prevent clipping.
  2835. @item coupling, n
  2836. Enable channels coupling. By default is enabled.
  2837. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2838. amount. This means the same gain factor will be applied to all channels, i.e.
  2839. the maximum possible gain factor is determined by the "loudest" channel.
  2840. However, in some recordings, it may happen that the volume of the different
  2841. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2842. In this case, this option can be used to disable the channel coupling. This way,
  2843. the gain factor will be determined independently for each channel, depending
  2844. only on the individual channel's highest magnitude sample. This allows for
  2845. harmonizing the volume of the different channels.
  2846. @item correctdc, c
  2847. Enable DC bias correction. By default is disabled.
  2848. An audio signal (in the time domain) is a sequence of sample values.
  2849. In the Dynamic Audio Normalizer these sample values are represented in the
  2850. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2851. audio signal, or "waveform", should be centered around the zero point.
  2852. That means if we calculate the mean value of all samples in a file, or in a
  2853. single frame, then the result should be 0.0 or at least very close to that
  2854. value. If, however, there is a significant deviation of the mean value from
  2855. 0.0, in either positive or negative direction, this is referred to as a
  2856. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2857. Audio Normalizer provides optional DC bias correction.
  2858. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2859. the mean value, or "DC correction" offset, of each input frame and subtract
  2860. that value from all of the frame's sample values which ensures those samples
  2861. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2862. boundaries, the DC correction offset values will be interpolated smoothly
  2863. between neighbouring frames.
  2864. @item altboundary, b
  2865. Enable alternative boundary mode. By default is disabled.
  2866. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2867. around each frame. This includes the preceding frames as well as the
  2868. subsequent frames. However, for the "boundary" frames, located at the very
  2869. beginning and at the very end of the audio file, not all neighbouring
  2870. frames are available. In particular, for the first few frames in the audio
  2871. file, the preceding frames are not known. And, similarly, for the last few
  2872. frames in the audio file, the subsequent frames are not known. Thus, the
  2873. question arises which gain factors should be assumed for the missing frames
  2874. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2875. to deal with this situation. The default boundary mode assumes a gain factor
  2876. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2877. "fade out" at the beginning and at the end of the input, respectively.
  2878. @item compress, s
  2879. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2880. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2881. compression. This means that signal peaks will not be pruned and thus the
  2882. full dynamic range will be retained within each local neighbourhood. However,
  2883. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2884. normalization algorithm with a more "traditional" compression.
  2885. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2886. (thresholding) function. If (and only if) the compression feature is enabled,
  2887. all input frames will be processed by a soft knee thresholding function prior
  2888. to the actual normalization process. Put simply, the thresholding function is
  2889. going to prune all samples whose magnitude exceeds a certain threshold value.
  2890. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2891. value. Instead, the threshold value will be adjusted for each individual
  2892. frame.
  2893. In general, smaller parameters result in stronger compression, and vice versa.
  2894. Values below 3.0 are not recommended, because audible distortion may appear.
  2895. @item threshold, t
  2896. Set the target threshold value. This specifies the lowest permissible
  2897. magnitude level for the audio input which will be normalized.
  2898. If input frame volume is above this value frame will be normalized.
  2899. Otherwise frame may not be normalized at all. The default value is set
  2900. to 0, which means all input frames will be normalized.
  2901. This option is mostly useful if digital noise is not wanted to be amplified.
  2902. @end table
  2903. @subsection Commands
  2904. This filter supports the all above options as @ref{commands}.
  2905. @section earwax
  2906. Make audio easier to listen to on headphones.
  2907. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2908. so that when listened to on headphones the stereo image is moved from
  2909. inside your head (standard for headphones) to outside and in front of
  2910. the listener (standard for speakers).
  2911. Ported from SoX.
  2912. @section equalizer
  2913. Apply a two-pole peaking equalisation (EQ) filter. With this
  2914. filter, the signal-level at and around a selected frequency can
  2915. be increased or decreased, whilst (unlike bandpass and bandreject
  2916. filters) that at all other frequencies is unchanged.
  2917. In order to produce complex equalisation curves, this filter can
  2918. be given several times, each with a different central frequency.
  2919. The filter accepts the following options:
  2920. @table @option
  2921. @item frequency, f
  2922. Set the filter's central frequency in Hz.
  2923. @item width_type, t
  2924. Set method to specify band-width of filter.
  2925. @table @option
  2926. @item h
  2927. Hz
  2928. @item q
  2929. Q-Factor
  2930. @item o
  2931. octave
  2932. @item s
  2933. slope
  2934. @item k
  2935. kHz
  2936. @end table
  2937. @item width, w
  2938. Specify the band-width of a filter in width_type units.
  2939. @item gain, g
  2940. Set the required gain or attenuation in dB.
  2941. Beware of clipping when using a positive gain.
  2942. @item mix, m
  2943. How much to use filtered signal in output. Default is 1.
  2944. Range is between 0 and 1.
  2945. @item channels, c
  2946. Specify which channels to filter, by default all available are filtered.
  2947. @item normalize, n
  2948. Normalize biquad coefficients, by default is disabled.
  2949. Enabling it will normalize magnitude response at DC to 0dB.
  2950. @item transform, a
  2951. Set transform type of IIR filter.
  2952. @table @option
  2953. @item di
  2954. @item dii
  2955. @item tdii
  2956. @item latt
  2957. @end table
  2958. @end table
  2959. @subsection Examples
  2960. @itemize
  2961. @item
  2962. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2963. @example
  2964. equalizer=f=1000:t=h:width=200:g=-10
  2965. @end example
  2966. @item
  2967. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2968. @example
  2969. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2970. @end example
  2971. @end itemize
  2972. @subsection Commands
  2973. This filter supports the following commands:
  2974. @table @option
  2975. @item frequency, f
  2976. Change equalizer frequency.
  2977. Syntax for the command is : "@var{frequency}"
  2978. @item width_type, t
  2979. Change equalizer width_type.
  2980. Syntax for the command is : "@var{width_type}"
  2981. @item width, w
  2982. Change equalizer width.
  2983. Syntax for the command is : "@var{width}"
  2984. @item gain, g
  2985. Change equalizer gain.
  2986. Syntax for the command is : "@var{gain}"
  2987. @item mix, m
  2988. Change equalizer mix.
  2989. Syntax for the command is : "@var{mix}"
  2990. @end table
  2991. @section extrastereo
  2992. Linearly increases the difference between left and right channels which
  2993. adds some sort of "live" effect to playback.
  2994. The filter accepts the following options:
  2995. @table @option
  2996. @item m
  2997. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2998. (average of both channels), with 1.0 sound will be unchanged, with
  2999. -1.0 left and right channels will be swapped.
  3000. @item c
  3001. Enable clipping. By default is enabled.
  3002. @end table
  3003. @subsection Commands
  3004. This filter supports the all above options as @ref{commands}.
  3005. @section firequalizer
  3006. Apply FIR Equalization using arbitrary frequency response.
  3007. The filter accepts the following option:
  3008. @table @option
  3009. @item gain
  3010. Set gain curve equation (in dB). The expression can contain variables:
  3011. @table @option
  3012. @item f
  3013. the evaluated frequency
  3014. @item sr
  3015. sample rate
  3016. @item ch
  3017. channel number, set to 0 when multichannels evaluation is disabled
  3018. @item chid
  3019. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3020. multichannels evaluation is disabled
  3021. @item chs
  3022. number of channels
  3023. @item chlayout
  3024. channel_layout, see libavutil/channel_layout.h
  3025. @end table
  3026. and functions:
  3027. @table @option
  3028. @item gain_interpolate(f)
  3029. interpolate gain on frequency f based on gain_entry
  3030. @item cubic_interpolate(f)
  3031. same as gain_interpolate, but smoother
  3032. @end table
  3033. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3034. @item gain_entry
  3035. Set gain entry for gain_interpolate function. The expression can
  3036. contain functions:
  3037. @table @option
  3038. @item entry(f, g)
  3039. store gain entry at frequency f with value g
  3040. @end table
  3041. This option is also available as command.
  3042. @item delay
  3043. Set filter delay in seconds. Higher value means more accurate.
  3044. Default is @code{0.01}.
  3045. @item accuracy
  3046. Set filter accuracy in Hz. Lower value means more accurate.
  3047. Default is @code{5}.
  3048. @item wfunc
  3049. Set window function. Acceptable values are:
  3050. @table @option
  3051. @item rectangular
  3052. rectangular window, useful when gain curve is already smooth
  3053. @item hann
  3054. hann window (default)
  3055. @item hamming
  3056. hamming window
  3057. @item blackman
  3058. blackman window
  3059. @item nuttall3
  3060. 3-terms continuous 1st derivative nuttall window
  3061. @item mnuttall3
  3062. minimum 3-terms discontinuous nuttall window
  3063. @item nuttall
  3064. 4-terms continuous 1st derivative nuttall window
  3065. @item bnuttall
  3066. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3067. @item bharris
  3068. blackman-harris window
  3069. @item tukey
  3070. tukey window
  3071. @end table
  3072. @item fixed
  3073. If enabled, use fixed number of audio samples. This improves speed when
  3074. filtering with large delay. Default is disabled.
  3075. @item multi
  3076. Enable multichannels evaluation on gain. Default is disabled.
  3077. @item zero_phase
  3078. Enable zero phase mode by subtracting timestamp to compensate delay.
  3079. Default is disabled.
  3080. @item scale
  3081. Set scale used by gain. Acceptable values are:
  3082. @table @option
  3083. @item linlin
  3084. linear frequency, linear gain
  3085. @item linlog
  3086. linear frequency, logarithmic (in dB) gain (default)
  3087. @item loglin
  3088. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3089. @item loglog
  3090. logarithmic frequency, logarithmic gain
  3091. @end table
  3092. @item dumpfile
  3093. Set file for dumping, suitable for gnuplot.
  3094. @item dumpscale
  3095. Set scale for dumpfile. Acceptable values are same with scale option.
  3096. Default is linlog.
  3097. @item fft2
  3098. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3099. Default is disabled.
  3100. @item min_phase
  3101. Enable minimum phase impulse response. Default is disabled.
  3102. @end table
  3103. @subsection Examples
  3104. @itemize
  3105. @item
  3106. lowpass at 1000 Hz:
  3107. @example
  3108. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3109. @end example
  3110. @item
  3111. lowpass at 1000 Hz with gain_entry:
  3112. @example
  3113. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3114. @end example
  3115. @item
  3116. custom equalization:
  3117. @example
  3118. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3119. @end example
  3120. @item
  3121. higher delay with zero phase to compensate delay:
  3122. @example
  3123. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3124. @end example
  3125. @item
  3126. lowpass on left channel, highpass on right channel:
  3127. @example
  3128. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3129. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3130. @end example
  3131. @end itemize
  3132. @section flanger
  3133. Apply a flanging effect to the audio.
  3134. The filter accepts the following options:
  3135. @table @option
  3136. @item delay
  3137. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3138. @item depth
  3139. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3140. @item regen
  3141. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3142. Default value is 0.
  3143. @item width
  3144. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3145. Default value is 71.
  3146. @item speed
  3147. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3148. @item shape
  3149. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3150. Default value is @var{sinusoidal}.
  3151. @item phase
  3152. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3153. Default value is 25.
  3154. @item interp
  3155. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3156. Default is @var{linear}.
  3157. @end table
  3158. @section haas
  3159. Apply Haas effect to audio.
  3160. Note that this makes most sense to apply on mono signals.
  3161. With this filter applied to mono signals it give some directionality and
  3162. stretches its stereo image.
  3163. The filter accepts the following options:
  3164. @table @option
  3165. @item level_in
  3166. Set input level. By default is @var{1}, or 0dB
  3167. @item level_out
  3168. Set output level. By default is @var{1}, or 0dB.
  3169. @item side_gain
  3170. Set gain applied to side part of signal. By default is @var{1}.
  3171. @item middle_source
  3172. Set kind of middle source. Can be one of the following:
  3173. @table @samp
  3174. @item left
  3175. Pick left channel.
  3176. @item right
  3177. Pick right channel.
  3178. @item mid
  3179. Pick middle part signal of stereo image.
  3180. @item side
  3181. Pick side part signal of stereo image.
  3182. @end table
  3183. @item middle_phase
  3184. Change middle phase. By default is disabled.
  3185. @item left_delay
  3186. Set left channel delay. By default is @var{2.05} milliseconds.
  3187. @item left_balance
  3188. Set left channel balance. By default is @var{-1}.
  3189. @item left_gain
  3190. Set left channel gain. By default is @var{1}.
  3191. @item left_phase
  3192. Change left phase. By default is disabled.
  3193. @item right_delay
  3194. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3195. @item right_balance
  3196. Set right channel balance. By default is @var{1}.
  3197. @item right_gain
  3198. Set right channel gain. By default is @var{1}.
  3199. @item right_phase
  3200. Change right phase. By default is enabled.
  3201. @end table
  3202. @section hdcd
  3203. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3204. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3205. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3206. of HDCD, and detects the Transient Filter flag.
  3207. @example
  3208. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3209. @end example
  3210. When using the filter with wav, note the default encoding for wav is 16-bit,
  3211. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3212. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3213. @example
  3214. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3215. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3216. @end example
  3217. The filter accepts the following options:
  3218. @table @option
  3219. @item disable_autoconvert
  3220. Disable any automatic format conversion or resampling in the filter graph.
  3221. @item process_stereo
  3222. Process the stereo channels together. If target_gain does not match between
  3223. channels, consider it invalid and use the last valid target_gain.
  3224. @item cdt_ms
  3225. Set the code detect timer period in ms.
  3226. @item force_pe
  3227. Always extend peaks above -3dBFS even if PE isn't signaled.
  3228. @item analyze_mode
  3229. Replace audio with a solid tone and adjust the amplitude to signal some
  3230. specific aspect of the decoding process. The output file can be loaded in
  3231. an audio editor alongside the original to aid analysis.
  3232. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3233. Modes are:
  3234. @table @samp
  3235. @item 0, off
  3236. Disabled
  3237. @item 1, lle
  3238. Gain adjustment level at each sample
  3239. @item 2, pe
  3240. Samples where peak extend occurs
  3241. @item 3, cdt
  3242. Samples where the code detect timer is active
  3243. @item 4, tgm
  3244. Samples where the target gain does not match between channels
  3245. @end table
  3246. @end table
  3247. @section headphone
  3248. Apply head-related transfer functions (HRTFs) to create virtual
  3249. loudspeakers around the user for binaural listening via headphones.
  3250. The HRIRs are provided via additional streams, for each channel
  3251. one stereo input stream is needed.
  3252. The filter accepts the following options:
  3253. @table @option
  3254. @item map
  3255. Set mapping of input streams for convolution.
  3256. The argument is a '|'-separated list of channel names in order as they
  3257. are given as additional stream inputs for filter.
  3258. This also specify number of input streams. Number of input streams
  3259. must be not less than number of channels in first stream plus one.
  3260. @item gain
  3261. Set gain applied to audio. Value is in dB. Default is 0.
  3262. @item type
  3263. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3264. processing audio in time domain which is slow.
  3265. @var{freq} is processing audio in frequency domain which is fast.
  3266. Default is @var{freq}.
  3267. @item lfe
  3268. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3269. @item size
  3270. Set size of frame in number of samples which will be processed at once.
  3271. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3272. @item hrir
  3273. Set format of hrir stream.
  3274. Default value is @var{stereo}. Alternative value is @var{multich}.
  3275. If value is set to @var{stereo}, number of additional streams should
  3276. be greater or equal to number of input channels in first input stream.
  3277. Also each additional stream should have stereo number of channels.
  3278. If value is set to @var{multich}, number of additional streams should
  3279. be exactly one. Also number of input channels of additional stream
  3280. should be equal or greater than twice number of channels of first input
  3281. stream.
  3282. @end table
  3283. @subsection Examples
  3284. @itemize
  3285. @item
  3286. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3287. each amovie filter use stereo file with IR coefficients as input.
  3288. The files give coefficients for each position of virtual loudspeaker:
  3289. @example
  3290. ffmpeg -i input.wav
  3291. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  3292. output.wav
  3293. @end example
  3294. @item
  3295. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3296. but now in @var{multich} @var{hrir} format.
  3297. @example
  3298. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  3299. output.wav
  3300. @end example
  3301. @end itemize
  3302. @section highpass
  3303. Apply a high-pass filter with 3dB point frequency.
  3304. The filter can be either single-pole, or double-pole (the default).
  3305. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3306. The filter accepts the following options:
  3307. @table @option
  3308. @item frequency, f
  3309. Set frequency in Hz. Default is 3000.
  3310. @item poles, p
  3311. Set number of poles. Default is 2.
  3312. @item width_type, t
  3313. Set method to specify band-width of filter.
  3314. @table @option
  3315. @item h
  3316. Hz
  3317. @item q
  3318. Q-Factor
  3319. @item o
  3320. octave
  3321. @item s
  3322. slope
  3323. @item k
  3324. kHz
  3325. @end table
  3326. @item width, w
  3327. Specify the band-width of a filter in width_type units.
  3328. Applies only to double-pole filter.
  3329. The default is 0.707q and gives a Butterworth response.
  3330. @item mix, m
  3331. How much to use filtered signal in output. Default is 1.
  3332. Range is between 0 and 1.
  3333. @item channels, c
  3334. Specify which channels to filter, by default all available are filtered.
  3335. @item normalize, n
  3336. Normalize biquad coefficients, by default is disabled.
  3337. Enabling it will normalize magnitude response at DC to 0dB.
  3338. @item transform, a
  3339. Set transform type of IIR filter.
  3340. @table @option
  3341. @item di
  3342. @item dii
  3343. @item tdii
  3344. @item latt
  3345. @end table
  3346. @end table
  3347. @subsection Commands
  3348. This filter supports the following commands:
  3349. @table @option
  3350. @item frequency, f
  3351. Change highpass frequency.
  3352. Syntax for the command is : "@var{frequency}"
  3353. @item width_type, t
  3354. Change highpass width_type.
  3355. Syntax for the command is : "@var{width_type}"
  3356. @item width, w
  3357. Change highpass width.
  3358. Syntax for the command is : "@var{width}"
  3359. @item mix, m
  3360. Change highpass mix.
  3361. Syntax for the command is : "@var{mix}"
  3362. @end table
  3363. @section join
  3364. Join multiple input streams into one multi-channel stream.
  3365. It accepts the following parameters:
  3366. @table @option
  3367. @item inputs
  3368. The number of input streams. It defaults to 2.
  3369. @item channel_layout
  3370. The desired output channel layout. It defaults to stereo.
  3371. @item map
  3372. Map channels from inputs to output. The argument is a '|'-separated list of
  3373. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3374. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3375. can be either the name of the input channel (e.g. FL for front left) or its
  3376. index in the specified input stream. @var{out_channel} is the name of the output
  3377. channel.
  3378. @end table
  3379. The filter will attempt to guess the mappings when they are not specified
  3380. explicitly. It does so by first trying to find an unused matching input channel
  3381. and if that fails it picks the first unused input channel.
  3382. Join 3 inputs (with properly set channel layouts):
  3383. @example
  3384. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3385. @end example
  3386. Build a 5.1 output from 6 single-channel streams:
  3387. @example
  3388. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3389. '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'
  3390. out
  3391. @end example
  3392. @section ladspa
  3393. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3394. To enable compilation of this filter you need to configure FFmpeg with
  3395. @code{--enable-ladspa}.
  3396. @table @option
  3397. @item file, f
  3398. Specifies the name of LADSPA plugin library to load. If the environment
  3399. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3400. each one of the directories specified by the colon separated list in
  3401. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3402. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3403. @file{/usr/lib/ladspa/}.
  3404. @item plugin, p
  3405. Specifies the plugin within the library. Some libraries contain only
  3406. one plugin, but others contain many of them. If this is not set filter
  3407. will list all available plugins within the specified library.
  3408. @item controls, c
  3409. Set the '|' separated list of controls which are zero or more floating point
  3410. values that determine the behavior of the loaded plugin (for example delay,
  3411. threshold or gain).
  3412. Controls need to be defined using the following syntax:
  3413. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3414. @var{valuei} is the value set on the @var{i}-th control.
  3415. Alternatively they can be also defined using the following syntax:
  3416. @var{value0}|@var{value1}|@var{value2}|..., where
  3417. @var{valuei} is the value set on the @var{i}-th control.
  3418. If @option{controls} is set to @code{help}, all available controls and
  3419. their valid ranges are printed.
  3420. @item sample_rate, s
  3421. Specify the sample rate, default to 44100. Only used if plugin have
  3422. zero inputs.
  3423. @item nb_samples, n
  3424. Set the number of samples per channel per each output frame, default
  3425. is 1024. Only used if plugin have zero inputs.
  3426. @item duration, d
  3427. Set the minimum duration of the sourced audio. See
  3428. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3429. for the accepted syntax.
  3430. Note that the resulting duration may be greater than the specified duration,
  3431. as the generated audio is always cut at the end of a complete frame.
  3432. If not specified, or the expressed duration is negative, the audio is
  3433. supposed to be generated forever.
  3434. Only used if plugin have zero inputs.
  3435. @item latency, l
  3436. Enable latency compensation, by default is disabled.
  3437. Only used if plugin have inputs.
  3438. @end table
  3439. @subsection Examples
  3440. @itemize
  3441. @item
  3442. List all available plugins within amp (LADSPA example plugin) library:
  3443. @example
  3444. ladspa=file=amp
  3445. @end example
  3446. @item
  3447. List all available controls and their valid ranges for @code{vcf_notch}
  3448. plugin from @code{VCF} library:
  3449. @example
  3450. ladspa=f=vcf:p=vcf_notch:c=help
  3451. @end example
  3452. @item
  3453. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3454. plugin library:
  3455. @example
  3456. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3457. @end example
  3458. @item
  3459. Add reverberation to the audio using TAP-plugins
  3460. (Tom's Audio Processing plugins):
  3461. @example
  3462. ladspa=file=tap_reverb:tap_reverb
  3463. @end example
  3464. @item
  3465. Generate white noise, with 0.2 amplitude:
  3466. @example
  3467. ladspa=file=cmt:noise_source_white:c=c0=.2
  3468. @end example
  3469. @item
  3470. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3471. @code{C* Audio Plugin Suite} (CAPS) library:
  3472. @example
  3473. ladspa=file=caps:Click:c=c1=20'
  3474. @end example
  3475. @item
  3476. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3477. @example
  3478. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3479. @end example
  3480. @item
  3481. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3482. @code{SWH Plugins} collection:
  3483. @example
  3484. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3485. @end example
  3486. @item
  3487. Attenuate low frequencies using Multiband EQ from Steve Harris
  3488. @code{SWH Plugins} collection:
  3489. @example
  3490. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3491. @end example
  3492. @item
  3493. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3494. (CAPS) library:
  3495. @example
  3496. ladspa=caps:Narrower
  3497. @end example
  3498. @item
  3499. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3500. @example
  3501. ladspa=caps:White:.2
  3502. @end example
  3503. @item
  3504. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3505. @example
  3506. ladspa=caps:Fractal:c=c1=1
  3507. @end example
  3508. @item
  3509. Dynamic volume normalization using @code{VLevel} plugin:
  3510. @example
  3511. ladspa=vlevel-ladspa:vlevel_mono
  3512. @end example
  3513. @end itemize
  3514. @subsection Commands
  3515. This filter supports the following commands:
  3516. @table @option
  3517. @item cN
  3518. Modify the @var{N}-th control value.
  3519. If the specified value is not valid, it is ignored and prior one is kept.
  3520. @end table
  3521. @section loudnorm
  3522. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3523. Support for both single pass (livestreams, files) and double pass (files) modes.
  3524. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3525. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3526. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3527. The filter accepts the following options:
  3528. @table @option
  3529. @item I, i
  3530. Set integrated loudness target.
  3531. Range is -70.0 - -5.0. Default value is -24.0.
  3532. @item LRA, lra
  3533. Set loudness range target.
  3534. Range is 1.0 - 20.0. Default value is 7.0.
  3535. @item TP, tp
  3536. Set maximum true peak.
  3537. Range is -9.0 - +0.0. Default value is -2.0.
  3538. @item measured_I, measured_i
  3539. Measured IL of input file.
  3540. Range is -99.0 - +0.0.
  3541. @item measured_LRA, measured_lra
  3542. Measured LRA of input file.
  3543. Range is 0.0 - 99.0.
  3544. @item measured_TP, measured_tp
  3545. Measured true peak of input file.
  3546. Range is -99.0 - +99.0.
  3547. @item measured_thresh
  3548. Measured threshold of input file.
  3549. Range is -99.0 - +0.0.
  3550. @item offset
  3551. Set offset gain. Gain is applied before the true-peak limiter.
  3552. Range is -99.0 - +99.0. Default is +0.0.
  3553. @item linear
  3554. Normalize by linearly scaling the source audio.
  3555. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3556. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3557. be lower than source LRA and the change in integrated loudness shouldn't
  3558. result in a true peak which exceeds the target TP. If any of these
  3559. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3560. Options are @code{true} or @code{false}. Default is @code{true}.
  3561. @item dual_mono
  3562. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3563. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3564. If set to @code{true}, this option will compensate for this effect.
  3565. Multi-channel input files are not affected by this option.
  3566. Options are true or false. Default is false.
  3567. @item print_format
  3568. Set print format for stats. Options are summary, json, or none.
  3569. Default value is none.
  3570. @end table
  3571. @section lowpass
  3572. Apply a low-pass filter with 3dB point frequency.
  3573. The filter can be either single-pole or double-pole (the default).
  3574. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3575. The filter accepts the following options:
  3576. @table @option
  3577. @item frequency, f
  3578. Set frequency in Hz. Default is 500.
  3579. @item poles, p
  3580. Set number of poles. Default is 2.
  3581. @item width_type, t
  3582. Set method to specify band-width of filter.
  3583. @table @option
  3584. @item h
  3585. Hz
  3586. @item q
  3587. Q-Factor
  3588. @item o
  3589. octave
  3590. @item s
  3591. slope
  3592. @item k
  3593. kHz
  3594. @end table
  3595. @item width, w
  3596. Specify the band-width of a filter in width_type units.
  3597. Applies only to double-pole filter.
  3598. The default is 0.707q and gives a Butterworth response.
  3599. @item mix, m
  3600. How much to use filtered signal in output. Default is 1.
  3601. Range is between 0 and 1.
  3602. @item channels, c
  3603. Specify which channels to filter, by default all available are filtered.
  3604. @item normalize, n
  3605. Normalize biquad coefficients, by default is disabled.
  3606. Enabling it will normalize magnitude response at DC to 0dB.
  3607. @item transform, a
  3608. Set transform type of IIR filter.
  3609. @table @option
  3610. @item di
  3611. @item dii
  3612. @item tdii
  3613. @item latt
  3614. @end table
  3615. @end table
  3616. @subsection Examples
  3617. @itemize
  3618. @item
  3619. Lowpass only LFE channel, it LFE is not present it does nothing:
  3620. @example
  3621. lowpass=c=LFE
  3622. @end example
  3623. @end itemize
  3624. @subsection Commands
  3625. This filter supports the following commands:
  3626. @table @option
  3627. @item frequency, f
  3628. Change lowpass frequency.
  3629. Syntax for the command is : "@var{frequency}"
  3630. @item width_type, t
  3631. Change lowpass width_type.
  3632. Syntax for the command is : "@var{width_type}"
  3633. @item width, w
  3634. Change lowpass width.
  3635. Syntax for the command is : "@var{width}"
  3636. @item mix, m
  3637. Change lowpass mix.
  3638. Syntax for the command is : "@var{mix}"
  3639. @end table
  3640. @section lv2
  3641. Load a LV2 (LADSPA Version 2) plugin.
  3642. To enable compilation of this filter you need to configure FFmpeg with
  3643. @code{--enable-lv2}.
  3644. @table @option
  3645. @item plugin, p
  3646. Specifies the plugin URI. You may need to escape ':'.
  3647. @item controls, c
  3648. Set the '|' separated list of controls which are zero or more floating point
  3649. values that determine the behavior of the loaded plugin (for example delay,
  3650. threshold or gain).
  3651. If @option{controls} is set to @code{help}, all available controls and
  3652. their valid ranges are printed.
  3653. @item sample_rate, s
  3654. Specify the sample rate, default to 44100. Only used if plugin have
  3655. zero inputs.
  3656. @item nb_samples, n
  3657. Set the number of samples per channel per each output frame, default
  3658. is 1024. Only used if plugin have zero inputs.
  3659. @item duration, d
  3660. Set the minimum duration of the sourced audio. See
  3661. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3662. for the accepted syntax.
  3663. Note that the resulting duration may be greater than the specified duration,
  3664. as the generated audio is always cut at the end of a complete frame.
  3665. If not specified, or the expressed duration is negative, the audio is
  3666. supposed to be generated forever.
  3667. Only used if plugin have zero inputs.
  3668. @end table
  3669. @subsection Examples
  3670. @itemize
  3671. @item
  3672. Apply bass enhancer plugin from Calf:
  3673. @example
  3674. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3675. @end example
  3676. @item
  3677. Apply vinyl plugin from Calf:
  3678. @example
  3679. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3680. @end example
  3681. @item
  3682. Apply bit crusher plugin from ArtyFX:
  3683. @example
  3684. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3685. @end example
  3686. @end itemize
  3687. @section mcompand
  3688. Multiband Compress or expand the audio's dynamic range.
  3689. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3690. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3691. response when absent compander action.
  3692. It accepts the following parameters:
  3693. @table @option
  3694. @item args
  3695. This option syntax is:
  3696. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3697. For explanation of each item refer to compand filter documentation.
  3698. @end table
  3699. @anchor{pan}
  3700. @section pan
  3701. Mix channels with specific gain levels. The filter accepts the output
  3702. channel layout followed by a set of channels definitions.
  3703. This filter is also designed to efficiently remap the channels of an audio
  3704. stream.
  3705. The filter accepts parameters of the form:
  3706. "@var{l}|@var{outdef}|@var{outdef}|..."
  3707. @table @option
  3708. @item l
  3709. output channel layout or number of channels
  3710. @item outdef
  3711. output channel specification, of the form:
  3712. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3713. @item out_name
  3714. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3715. number (c0, c1, etc.)
  3716. @item gain
  3717. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3718. @item in_name
  3719. input channel to use, see out_name for details; it is not possible to mix
  3720. named and numbered input channels
  3721. @end table
  3722. If the `=' in a channel specification is replaced by `<', then the gains for
  3723. that specification will be renormalized so that the total is 1, thus
  3724. avoiding clipping noise.
  3725. @subsection Mixing examples
  3726. For example, if you want to down-mix from stereo to mono, but with a bigger
  3727. factor for the left channel:
  3728. @example
  3729. pan=1c|c0=0.9*c0+0.1*c1
  3730. @end example
  3731. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3732. 7-channels surround:
  3733. @example
  3734. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3735. @end example
  3736. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3737. that should be preferred (see "-ac" option) unless you have very specific
  3738. needs.
  3739. @subsection Remapping examples
  3740. The channel remapping will be effective if, and only if:
  3741. @itemize
  3742. @item gain coefficients are zeroes or ones,
  3743. @item only one input per channel output,
  3744. @end itemize
  3745. If all these conditions are satisfied, the filter will notify the user ("Pure
  3746. channel mapping detected"), and use an optimized and lossless method to do the
  3747. remapping.
  3748. For example, if you have a 5.1 source and want a stereo audio stream by
  3749. dropping the extra channels:
  3750. @example
  3751. pan="stereo| c0=FL | c1=FR"
  3752. @end example
  3753. Given the same source, you can also switch front left and front right channels
  3754. and keep the input channel layout:
  3755. @example
  3756. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3757. @end example
  3758. If the input is a stereo audio stream, you can mute the front left channel (and
  3759. still keep the stereo channel layout) with:
  3760. @example
  3761. pan="stereo|c1=c1"
  3762. @end example
  3763. Still with a stereo audio stream input, you can copy the right channel in both
  3764. front left and right:
  3765. @example
  3766. pan="stereo| c0=FR | c1=FR"
  3767. @end example
  3768. @section replaygain
  3769. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3770. outputs it unchanged.
  3771. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3772. @section resample
  3773. Convert the audio sample format, sample rate and channel layout. It is
  3774. not meant to be used directly.
  3775. @section rubberband
  3776. Apply time-stretching and pitch-shifting with librubberband.
  3777. To enable compilation of this filter, you need to configure FFmpeg with
  3778. @code{--enable-librubberband}.
  3779. The filter accepts the following options:
  3780. @table @option
  3781. @item tempo
  3782. Set tempo scale factor.
  3783. @item pitch
  3784. Set pitch scale factor.
  3785. @item transients
  3786. Set transients detector.
  3787. Possible values are:
  3788. @table @var
  3789. @item crisp
  3790. @item mixed
  3791. @item smooth
  3792. @end table
  3793. @item detector
  3794. Set detector.
  3795. Possible values are:
  3796. @table @var
  3797. @item compound
  3798. @item percussive
  3799. @item soft
  3800. @end table
  3801. @item phase
  3802. Set phase.
  3803. Possible values are:
  3804. @table @var
  3805. @item laminar
  3806. @item independent
  3807. @end table
  3808. @item window
  3809. Set processing window size.
  3810. Possible values are:
  3811. @table @var
  3812. @item standard
  3813. @item short
  3814. @item long
  3815. @end table
  3816. @item smoothing
  3817. Set smoothing.
  3818. Possible values are:
  3819. @table @var
  3820. @item off
  3821. @item on
  3822. @end table
  3823. @item formant
  3824. Enable formant preservation when shift pitching.
  3825. Possible values are:
  3826. @table @var
  3827. @item shifted
  3828. @item preserved
  3829. @end table
  3830. @item pitchq
  3831. Set pitch quality.
  3832. Possible values are:
  3833. @table @var
  3834. @item quality
  3835. @item speed
  3836. @item consistency
  3837. @end table
  3838. @item channels
  3839. Set channels.
  3840. Possible values are:
  3841. @table @var
  3842. @item apart
  3843. @item together
  3844. @end table
  3845. @end table
  3846. @subsection Commands
  3847. This filter supports the following commands:
  3848. @table @option
  3849. @item tempo
  3850. Change filter tempo scale factor.
  3851. Syntax for the command is : "@var{tempo}"
  3852. @item pitch
  3853. Change filter pitch scale factor.
  3854. Syntax for the command is : "@var{pitch}"
  3855. @end table
  3856. @section sidechaincompress
  3857. This filter acts like normal compressor but has the ability to compress
  3858. detected signal using second input signal.
  3859. It needs two input streams and returns one output stream.
  3860. First input stream will be processed depending on second stream signal.
  3861. The filtered signal then can be filtered with other filters in later stages of
  3862. processing. See @ref{pan} and @ref{amerge} filter.
  3863. The filter accepts the following options:
  3864. @table @option
  3865. @item level_in
  3866. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3867. @item mode
  3868. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3869. Default is @code{downward}.
  3870. @item threshold
  3871. If a signal of second stream raises above this level it will affect the gain
  3872. reduction of first stream.
  3873. By default is 0.125. Range is between 0.00097563 and 1.
  3874. @item ratio
  3875. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3876. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3877. Default is 2. Range is between 1 and 20.
  3878. @item attack
  3879. Amount of milliseconds the signal has to rise above the threshold before gain
  3880. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3881. @item release
  3882. Amount of milliseconds the signal has to fall below the threshold before
  3883. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3884. @item makeup
  3885. Set the amount by how much signal will be amplified after processing.
  3886. Default is 1. Range is from 1 to 64.
  3887. @item knee
  3888. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3889. Default is 2.82843. Range is between 1 and 8.
  3890. @item link
  3891. Choose if the @code{average} level between all channels of side-chain stream
  3892. or the louder(@code{maximum}) channel of side-chain stream affects the
  3893. reduction. Default is @code{average}.
  3894. @item detection
  3895. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3896. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3897. @item level_sc
  3898. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3899. @item mix
  3900. How much to use compressed signal in output. Default is 1.
  3901. Range is between 0 and 1.
  3902. @end table
  3903. @subsection Commands
  3904. This filter supports the all above options as @ref{commands}.
  3905. @subsection Examples
  3906. @itemize
  3907. @item
  3908. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3909. depending on the signal of 2nd input and later compressed signal to be
  3910. merged with 2nd input:
  3911. @example
  3912. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3913. @end example
  3914. @end itemize
  3915. @section sidechaingate
  3916. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3917. filter the detected signal before sending it to the gain reduction stage.
  3918. Normally a gate uses the full range signal to detect a level above the
  3919. threshold.
  3920. For example: If you cut all lower frequencies from your sidechain signal
  3921. the gate will decrease the volume of your track only if not enough highs
  3922. appear. With this technique you are able to reduce the resonation of a
  3923. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3924. guitar.
  3925. It needs two input streams and returns one output stream.
  3926. First input stream will be processed depending on second stream signal.
  3927. The filter accepts the following options:
  3928. @table @option
  3929. @item level_in
  3930. Set input level before filtering.
  3931. Default is 1. Allowed range is from 0.015625 to 64.
  3932. @item mode
  3933. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3934. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3935. will be amplified, expanding dynamic range in upward direction.
  3936. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3937. @item range
  3938. Set the level of gain reduction when the signal is below the threshold.
  3939. Default is 0.06125. Allowed range is from 0 to 1.
  3940. Setting this to 0 disables reduction and then filter behaves like expander.
  3941. @item threshold
  3942. If a signal rises above this level the gain reduction is released.
  3943. Default is 0.125. Allowed range is from 0 to 1.
  3944. @item ratio
  3945. Set a ratio about which the signal is reduced.
  3946. Default is 2. Allowed range is from 1 to 9000.
  3947. @item attack
  3948. Amount of milliseconds the signal has to rise above the threshold before gain
  3949. reduction stops.
  3950. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3951. @item release
  3952. Amount of milliseconds the signal has to fall below the threshold before the
  3953. reduction is increased again. Default is 250 milliseconds.
  3954. Allowed range is from 0.01 to 9000.
  3955. @item makeup
  3956. Set amount of amplification of signal after processing.
  3957. Default is 1. Allowed range is from 1 to 64.
  3958. @item knee
  3959. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3960. Default is 2.828427125. Allowed range is from 1 to 8.
  3961. @item detection
  3962. Choose if exact signal should be taken for detection or an RMS like one.
  3963. Default is rms. Can be peak or rms.
  3964. @item link
  3965. Choose if the average level between all channels or the louder channel affects
  3966. the reduction.
  3967. Default is average. Can be average or maximum.
  3968. @item level_sc
  3969. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3970. @end table
  3971. @subsection Commands
  3972. This filter supports the all above options as @ref{commands}.
  3973. @section silencedetect
  3974. Detect silence in an audio stream.
  3975. This filter logs a message when it detects that the input audio volume is less
  3976. or equal to a noise tolerance value for a duration greater or equal to the
  3977. minimum detected noise duration.
  3978. The printed times and duration are expressed in seconds. The
  3979. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3980. is set on the first frame whose timestamp equals or exceeds the detection
  3981. duration and it contains the timestamp of the first frame of the silence.
  3982. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3983. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3984. keys are set on the first frame after the silence. If @option{mono} is
  3985. enabled, and each channel is evaluated separately, the @code{.X}
  3986. suffixed keys are used, and @code{X} corresponds to the channel number.
  3987. The filter accepts the following options:
  3988. @table @option
  3989. @item noise, n
  3990. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3991. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3992. @item duration, d
  3993. Set silence duration until notification (default is 2 seconds). See
  3994. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3995. for the accepted syntax.
  3996. @item mono, m
  3997. Process each channel separately, instead of combined. By default is disabled.
  3998. @end table
  3999. @subsection Examples
  4000. @itemize
  4001. @item
  4002. Detect 5 seconds of silence with -50dB noise tolerance:
  4003. @example
  4004. silencedetect=n=-50dB:d=5
  4005. @end example
  4006. @item
  4007. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4008. tolerance in @file{silence.mp3}:
  4009. @example
  4010. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4011. @end example
  4012. @end itemize
  4013. @section silenceremove
  4014. Remove silence from the beginning, middle or end of the audio.
  4015. The filter accepts the following options:
  4016. @table @option
  4017. @item start_periods
  4018. This value is used to indicate if audio should be trimmed at beginning of
  4019. the audio. A value of zero indicates no silence should be trimmed from the
  4020. beginning. When specifying a non-zero value, it trims audio up until it
  4021. finds non-silence. Normally, when trimming silence from beginning of audio
  4022. the @var{start_periods} will be @code{1} but it can be increased to higher
  4023. values to trim all audio up to specific count of non-silence periods.
  4024. Default value is @code{0}.
  4025. @item start_duration
  4026. Specify the amount of time that non-silence must be detected before it stops
  4027. trimming audio. By increasing the duration, bursts of noises can be treated
  4028. as silence and trimmed off. Default value is @code{0}.
  4029. @item start_threshold
  4030. This indicates what sample value should be treated as silence. For digital
  4031. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4032. you may wish to increase the value to account for background noise.
  4033. Can be specified in dB (in case "dB" is appended to the specified value)
  4034. or amplitude ratio. Default value is @code{0}.
  4035. @item start_silence
  4036. Specify max duration of silence at beginning that will be kept after
  4037. trimming. Default is 0, which is equal to trimming all samples detected
  4038. as silence.
  4039. @item start_mode
  4040. Specify mode of detection of silence end in start of multi-channel audio.
  4041. Can be @var{any} or @var{all}. Default is @var{any}.
  4042. With @var{any}, any sample that is detected as non-silence will cause
  4043. stopped trimming of silence.
  4044. With @var{all}, only if all channels are detected as non-silence will cause
  4045. stopped trimming of silence.
  4046. @item stop_periods
  4047. Set the count for trimming silence from the end of audio.
  4048. To remove silence from the middle of a file, specify a @var{stop_periods}
  4049. that is negative. This value is then treated as a positive value and is
  4050. used to indicate the effect should restart processing as specified by
  4051. @var{start_periods}, making it suitable for removing periods of silence
  4052. in the middle of the audio.
  4053. Default value is @code{0}.
  4054. @item stop_duration
  4055. Specify a duration of silence that must exist before audio is not copied any
  4056. more. By specifying a higher duration, silence that is wanted can be left in
  4057. the audio.
  4058. Default value is @code{0}.
  4059. @item stop_threshold
  4060. This is the same as @option{start_threshold} but for trimming silence from
  4061. the end of audio.
  4062. Can be specified in dB (in case "dB" is appended to the specified value)
  4063. or amplitude ratio. Default value is @code{0}.
  4064. @item stop_silence
  4065. Specify max duration of silence at end that will be kept after
  4066. trimming. Default is 0, which is equal to trimming all samples detected
  4067. as silence.
  4068. @item stop_mode
  4069. Specify mode of detection of silence start in end of multi-channel audio.
  4070. Can be @var{any} or @var{all}. Default is @var{any}.
  4071. With @var{any}, any sample that is detected as non-silence will cause
  4072. stopped trimming of silence.
  4073. With @var{all}, only if all channels are detected as non-silence will cause
  4074. stopped trimming of silence.
  4075. @item detection
  4076. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4077. and works better with digital silence which is exactly 0.
  4078. Default value is @code{rms}.
  4079. @item window
  4080. Set duration in number of seconds used to calculate size of window in number
  4081. of samples for detecting silence.
  4082. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4083. @end table
  4084. @subsection Examples
  4085. @itemize
  4086. @item
  4087. The following example shows how this filter can be used to start a recording
  4088. that does not contain the delay at the start which usually occurs between
  4089. pressing the record button and the start of the performance:
  4090. @example
  4091. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4092. @end example
  4093. @item
  4094. Trim all silence encountered from beginning to end where there is more than 1
  4095. second of silence in audio:
  4096. @example
  4097. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4098. @end example
  4099. @item
  4100. Trim all digital silence samples, using peak detection, from beginning to end
  4101. where there is more than 0 samples of digital silence in audio and digital
  4102. silence is detected in all channels at same positions in stream:
  4103. @example
  4104. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4105. @end example
  4106. @end itemize
  4107. @section sofalizer
  4108. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4109. loudspeakers around the user for binaural listening via headphones (audio
  4110. formats up to 9 channels supported).
  4111. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4112. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4113. Austrian Academy of Sciences.
  4114. To enable compilation of this filter you need to configure FFmpeg with
  4115. @code{--enable-libmysofa}.
  4116. The filter accepts the following options:
  4117. @table @option
  4118. @item sofa
  4119. Set the SOFA file used for rendering.
  4120. @item gain
  4121. Set gain applied to audio. Value is in dB. Default is 0.
  4122. @item rotation
  4123. Set rotation of virtual loudspeakers in deg. Default is 0.
  4124. @item elevation
  4125. Set elevation of virtual speakers in deg. Default is 0.
  4126. @item radius
  4127. Set distance in meters between loudspeakers and the listener with near-field
  4128. HRTFs. Default is 1.
  4129. @item type
  4130. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4131. processing audio in time domain which is slow.
  4132. @var{freq} is processing audio in frequency domain which is fast.
  4133. Default is @var{freq}.
  4134. @item speakers
  4135. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4136. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4137. Each virtual loudspeaker is described with short channel name following with
  4138. azimuth and elevation in degrees.
  4139. Each virtual loudspeaker description is separated by '|'.
  4140. For example to override front left and front right channel positions use:
  4141. 'speakers=FL 45 15|FR 345 15'.
  4142. Descriptions with unrecognised channel names are ignored.
  4143. @item lfegain
  4144. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4145. @item framesize
  4146. Set custom frame size in number of samples. Default is 1024.
  4147. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4148. is set to @var{freq}.
  4149. @item normalize
  4150. Should all IRs be normalized upon importing SOFA file.
  4151. By default is enabled.
  4152. @item interpolate
  4153. Should nearest IRs be interpolated with neighbor IRs if exact position
  4154. does not match. By default is disabled.
  4155. @item minphase
  4156. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4157. @item anglestep
  4158. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4159. @item radstep
  4160. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4161. @end table
  4162. @subsection Examples
  4163. @itemize
  4164. @item
  4165. Using ClubFritz6 sofa file:
  4166. @example
  4167. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4168. @end example
  4169. @item
  4170. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4171. @example
  4172. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4173. @end example
  4174. @item
  4175. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4176. and also with custom gain:
  4177. @example
  4178. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4179. @end example
  4180. @end itemize
  4181. @section speechnorm
  4182. Speech Normalizer.
  4183. This filter expands or compresses each half-cycle of audio samples
  4184. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4185. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4186. The filter accepts the following options:
  4187. @table @option
  4188. @item peak, p
  4189. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4190. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4191. @item expansion, e
  4192. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4193. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4194. would be such that local peak value reaches target peak value but never to surpass it and that
  4195. ratio between new and previous peak value does not surpass this option value.
  4196. @item compression, c
  4197. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4198. This option controls maximum local half-cycle of samples compression. This option is used
  4199. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4200. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4201. that peak's half-cycle will be compressed by current compression factor.
  4202. @item threshold, t
  4203. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4204. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4205. Any half-cycle samples with their local peak value below or same as this option value will be
  4206. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4207. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4208. @item raise, r
  4209. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4210. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4211. each new half-cycle until it reaches @option{expansion} value.
  4212. Setting this options too high may lead to distortions.
  4213. @item fall, f
  4214. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4215. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4216. each new half-cycle until it reaches @option{compression} value.
  4217. @item channels, h
  4218. Specify which channels to filter, by default all available channels are filtered.
  4219. @item invert, i
  4220. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4221. option. When enabled any half-cycle of samples with their local peak value below or same as
  4222. @option{threshold} option will be expanded otherwise it will be compressed.
  4223. @item link, l
  4224. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4225. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4226. is enabled the minimum of all possible gains for each filtered channel is used.
  4227. @end table
  4228. @subsection Commands
  4229. This filter supports the all above options as @ref{commands}.
  4230. @section stereotools
  4231. This filter has some handy utilities to manage stereo signals, for converting
  4232. M/S stereo recordings to L/R signal while having control over the parameters
  4233. or spreading the stereo image of master track.
  4234. The filter accepts the following options:
  4235. @table @option
  4236. @item level_in
  4237. Set input level before filtering for both channels. Defaults is 1.
  4238. Allowed range is from 0.015625 to 64.
  4239. @item level_out
  4240. Set output level after filtering for both channels. Defaults is 1.
  4241. Allowed range is from 0.015625 to 64.
  4242. @item balance_in
  4243. Set input balance between both channels. Default is 0.
  4244. Allowed range is from -1 to 1.
  4245. @item balance_out
  4246. Set output balance between both channels. Default is 0.
  4247. Allowed range is from -1 to 1.
  4248. @item softclip
  4249. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4250. clipping. Disabled by default.
  4251. @item mutel
  4252. Mute the left channel. Disabled by default.
  4253. @item muter
  4254. Mute the right channel. Disabled by default.
  4255. @item phasel
  4256. Change the phase of the left channel. Disabled by default.
  4257. @item phaser
  4258. Change the phase of the right channel. Disabled by default.
  4259. @item mode
  4260. Set stereo mode. Available values are:
  4261. @table @samp
  4262. @item lr>lr
  4263. Left/Right to Left/Right, this is default.
  4264. @item lr>ms
  4265. Left/Right to Mid/Side.
  4266. @item ms>lr
  4267. Mid/Side to Left/Right.
  4268. @item lr>ll
  4269. Left/Right to Left/Left.
  4270. @item lr>rr
  4271. Left/Right to Right/Right.
  4272. @item lr>l+r
  4273. Left/Right to Left + Right.
  4274. @item lr>rl
  4275. Left/Right to Right/Left.
  4276. @item ms>ll
  4277. Mid/Side to Left/Left.
  4278. @item ms>rr
  4279. Mid/Side to Right/Right.
  4280. @item ms>rl
  4281. Mid/Side to Right/Left.
  4282. @item lr>l-r
  4283. Left/Right to Left - Right.
  4284. @end table
  4285. @item slev
  4286. Set level of side signal. Default is 1.
  4287. Allowed range is from 0.015625 to 64.
  4288. @item sbal
  4289. Set balance of side signal. Default is 0.
  4290. Allowed range is from -1 to 1.
  4291. @item mlev
  4292. Set level of the middle signal. Default is 1.
  4293. Allowed range is from 0.015625 to 64.
  4294. @item mpan
  4295. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4296. @item base
  4297. Set stereo base between mono and inversed channels. Default is 0.
  4298. Allowed range is from -1 to 1.
  4299. @item delay
  4300. Set delay in milliseconds how much to delay left from right channel and
  4301. vice versa. Default is 0. Allowed range is from -20 to 20.
  4302. @item sclevel
  4303. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4304. @item phase
  4305. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4306. @item bmode_in, bmode_out
  4307. Set balance mode for balance_in/balance_out option.
  4308. Can be one of the following:
  4309. @table @samp
  4310. @item balance
  4311. Classic balance mode. Attenuate one channel at time.
  4312. Gain is raised up to 1.
  4313. @item amplitude
  4314. Similar as classic mode above but gain is raised up to 2.
  4315. @item power
  4316. Equal power distribution, from -6dB to +6dB range.
  4317. @end table
  4318. @end table
  4319. @subsection Commands
  4320. This filter supports the all above options as @ref{commands}.
  4321. @subsection Examples
  4322. @itemize
  4323. @item
  4324. Apply karaoke like effect:
  4325. @example
  4326. stereotools=mlev=0.015625
  4327. @end example
  4328. @item
  4329. Convert M/S signal to L/R:
  4330. @example
  4331. "stereotools=mode=ms>lr"
  4332. @end example
  4333. @end itemize
  4334. @section stereowiden
  4335. This filter enhance the stereo effect by suppressing signal common to both
  4336. channels and by delaying the signal of left into right and vice versa,
  4337. thereby widening the stereo effect.
  4338. The filter accepts the following options:
  4339. @table @option
  4340. @item delay
  4341. Time in milliseconds of the delay of left signal into right and vice versa.
  4342. Default is 20 milliseconds.
  4343. @item feedback
  4344. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4345. effect of left signal in right output and vice versa which gives widening
  4346. effect. Default is 0.3.
  4347. @item crossfeed
  4348. Cross feed of left into right with inverted phase. This helps in suppressing
  4349. the mono. If the value is 1 it will cancel all the signal common to both
  4350. channels. Default is 0.3.
  4351. @item drymix
  4352. Set level of input signal of original channel. Default is 0.8.
  4353. @end table
  4354. @subsection Commands
  4355. This filter supports the all above options except @code{delay} as @ref{commands}.
  4356. @section superequalizer
  4357. Apply 18 band equalizer.
  4358. The filter accepts the following options:
  4359. @table @option
  4360. @item 1b
  4361. Set 65Hz band gain.
  4362. @item 2b
  4363. Set 92Hz band gain.
  4364. @item 3b
  4365. Set 131Hz band gain.
  4366. @item 4b
  4367. Set 185Hz band gain.
  4368. @item 5b
  4369. Set 262Hz band gain.
  4370. @item 6b
  4371. Set 370Hz band gain.
  4372. @item 7b
  4373. Set 523Hz band gain.
  4374. @item 8b
  4375. Set 740Hz band gain.
  4376. @item 9b
  4377. Set 1047Hz band gain.
  4378. @item 10b
  4379. Set 1480Hz band gain.
  4380. @item 11b
  4381. Set 2093Hz band gain.
  4382. @item 12b
  4383. Set 2960Hz band gain.
  4384. @item 13b
  4385. Set 4186Hz band gain.
  4386. @item 14b
  4387. Set 5920Hz band gain.
  4388. @item 15b
  4389. Set 8372Hz band gain.
  4390. @item 16b
  4391. Set 11840Hz band gain.
  4392. @item 17b
  4393. Set 16744Hz band gain.
  4394. @item 18b
  4395. Set 20000Hz band gain.
  4396. @end table
  4397. @section surround
  4398. Apply audio surround upmix filter.
  4399. This filter allows to produce multichannel output from audio stream.
  4400. The filter accepts the following options:
  4401. @table @option
  4402. @item chl_out
  4403. Set output channel layout. By default, this is @var{5.1}.
  4404. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4405. for the required syntax.
  4406. @item chl_in
  4407. Set input channel layout. By default, this is @var{stereo}.
  4408. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4409. for the required syntax.
  4410. @item level_in
  4411. Set input volume level. By default, this is @var{1}.
  4412. @item level_out
  4413. Set output volume level. By default, this is @var{1}.
  4414. @item lfe
  4415. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4416. @item lfe_low
  4417. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4418. @item lfe_high
  4419. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4420. @item lfe_mode
  4421. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4422. In @var{add} mode, LFE channel is created from input audio and added to output.
  4423. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4424. also all non-LFE output channels are subtracted with output LFE channel.
  4425. @item angle
  4426. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4427. Default is @var{90}.
  4428. @item fc_in
  4429. Set front center input volume. By default, this is @var{1}.
  4430. @item fc_out
  4431. Set front center output volume. By default, this is @var{1}.
  4432. @item fl_in
  4433. Set front left input volume. By default, this is @var{1}.
  4434. @item fl_out
  4435. Set front left output volume. By default, this is @var{1}.
  4436. @item fr_in
  4437. Set front right input volume. By default, this is @var{1}.
  4438. @item fr_out
  4439. Set front right output volume. By default, this is @var{1}.
  4440. @item sl_in
  4441. Set side left input volume. By default, this is @var{1}.
  4442. @item sl_out
  4443. Set side left output volume. By default, this is @var{1}.
  4444. @item sr_in
  4445. Set side right input volume. By default, this is @var{1}.
  4446. @item sr_out
  4447. Set side right output volume. By default, this is @var{1}.
  4448. @item bl_in
  4449. Set back left input volume. By default, this is @var{1}.
  4450. @item bl_out
  4451. Set back left output volume. By default, this is @var{1}.
  4452. @item br_in
  4453. Set back right input volume. By default, this is @var{1}.
  4454. @item br_out
  4455. Set back right output volume. By default, this is @var{1}.
  4456. @item bc_in
  4457. Set back center input volume. By default, this is @var{1}.
  4458. @item bc_out
  4459. Set back center output volume. By default, this is @var{1}.
  4460. @item lfe_in
  4461. Set LFE input volume. By default, this is @var{1}.
  4462. @item lfe_out
  4463. Set LFE output volume. By default, this is @var{1}.
  4464. @item allx
  4465. Set spread usage of stereo image across X axis for all channels.
  4466. @item ally
  4467. Set spread usage of stereo image across Y axis for all channels.
  4468. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4469. Set spread usage of stereo image across X axis for each channel.
  4470. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4471. Set spread usage of stereo image across Y axis for each channel.
  4472. @item win_size
  4473. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4474. @item win_func
  4475. Set window function.
  4476. It accepts the following values:
  4477. @table @samp
  4478. @item rect
  4479. @item bartlett
  4480. @item hann, hanning
  4481. @item hamming
  4482. @item blackman
  4483. @item welch
  4484. @item flattop
  4485. @item bharris
  4486. @item bnuttall
  4487. @item bhann
  4488. @item sine
  4489. @item nuttall
  4490. @item lanczos
  4491. @item gauss
  4492. @item tukey
  4493. @item dolph
  4494. @item cauchy
  4495. @item parzen
  4496. @item poisson
  4497. @item bohman
  4498. @end table
  4499. Default is @code{hann}.
  4500. @item overlap
  4501. Set window overlap. If set to 1, the recommended overlap for selected
  4502. window function will be picked. Default is @code{0.5}.
  4503. @end table
  4504. @section treble, highshelf
  4505. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4506. shelving filter with a response similar to that of a standard
  4507. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4508. The filter accepts the following options:
  4509. @table @option
  4510. @item gain, g
  4511. Give the gain at whichever is the lower of ~22 kHz and the
  4512. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4513. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4514. @item frequency, f
  4515. Set the filter's central frequency and so can be used
  4516. to extend or reduce the frequency range to be boosted or cut.
  4517. The default value is @code{3000} Hz.
  4518. @item width_type, t
  4519. Set method to specify band-width of filter.
  4520. @table @option
  4521. @item h
  4522. Hz
  4523. @item q
  4524. Q-Factor
  4525. @item o
  4526. octave
  4527. @item s
  4528. slope
  4529. @item k
  4530. kHz
  4531. @end table
  4532. @item width, w
  4533. Determine how steep is the filter's shelf transition.
  4534. @item mix, m
  4535. How much to use filtered signal in output. Default is 1.
  4536. Range is between 0 and 1.
  4537. @item channels, c
  4538. Specify which channels to filter, by default all available are filtered.
  4539. @item normalize, n
  4540. Normalize biquad coefficients, by default is disabled.
  4541. Enabling it will normalize magnitude response at DC to 0dB.
  4542. @item transform, a
  4543. Set transform type of IIR filter.
  4544. @table @option
  4545. @item di
  4546. @item dii
  4547. @item tdii
  4548. @item latt
  4549. @end table
  4550. @end table
  4551. @subsection Commands
  4552. This filter supports the following commands:
  4553. @table @option
  4554. @item frequency, f
  4555. Change treble frequency.
  4556. Syntax for the command is : "@var{frequency}"
  4557. @item width_type, t
  4558. Change treble width_type.
  4559. Syntax for the command is : "@var{width_type}"
  4560. @item width, w
  4561. Change treble width.
  4562. Syntax for the command is : "@var{width}"
  4563. @item gain, g
  4564. Change treble gain.
  4565. Syntax for the command is : "@var{gain}"
  4566. @item mix, m
  4567. Change treble mix.
  4568. Syntax for the command is : "@var{mix}"
  4569. @end table
  4570. @section tremolo
  4571. Sinusoidal amplitude modulation.
  4572. The filter accepts the following options:
  4573. @table @option
  4574. @item f
  4575. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4576. (20 Hz or lower) will result in a tremolo effect.
  4577. This filter may also be used as a ring modulator by specifying
  4578. a modulation frequency higher than 20 Hz.
  4579. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4580. @item d
  4581. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4582. Default value is 0.5.
  4583. @end table
  4584. @section vibrato
  4585. Sinusoidal phase modulation.
  4586. The filter accepts the following options:
  4587. @table @option
  4588. @item f
  4589. Modulation frequency in Hertz.
  4590. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4591. @item d
  4592. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4593. Default value is 0.5.
  4594. @end table
  4595. @section volume
  4596. Adjust the input audio volume.
  4597. It accepts the following parameters:
  4598. @table @option
  4599. @item volume
  4600. Set audio volume expression.
  4601. Output values are clipped to the maximum value.
  4602. The output audio volume is given by the relation:
  4603. @example
  4604. @var{output_volume} = @var{volume} * @var{input_volume}
  4605. @end example
  4606. The default value for @var{volume} is "1.0".
  4607. @item precision
  4608. This parameter represents the mathematical precision.
  4609. It determines which input sample formats will be allowed, which affects the
  4610. precision of the volume scaling.
  4611. @table @option
  4612. @item fixed
  4613. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4614. @item float
  4615. 32-bit floating-point; this limits input sample format to FLT. (default)
  4616. @item double
  4617. 64-bit floating-point; this limits input sample format to DBL.
  4618. @end table
  4619. @item replaygain
  4620. Choose the behaviour on encountering ReplayGain side data in input frames.
  4621. @table @option
  4622. @item drop
  4623. Remove ReplayGain side data, ignoring its contents (the default).
  4624. @item ignore
  4625. Ignore ReplayGain side data, but leave it in the frame.
  4626. @item track
  4627. Prefer the track gain, if present.
  4628. @item album
  4629. Prefer the album gain, if present.
  4630. @end table
  4631. @item replaygain_preamp
  4632. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4633. Default value for @var{replaygain_preamp} is 0.0.
  4634. @item replaygain_noclip
  4635. Prevent clipping by limiting the gain applied.
  4636. Default value for @var{replaygain_noclip} is 1.
  4637. @item eval
  4638. Set when the volume expression is evaluated.
  4639. It accepts the following values:
  4640. @table @samp
  4641. @item once
  4642. only evaluate expression once during the filter initialization, or
  4643. when the @samp{volume} command is sent
  4644. @item frame
  4645. evaluate expression for each incoming frame
  4646. @end table
  4647. Default value is @samp{once}.
  4648. @end table
  4649. The volume expression can contain the following parameters.
  4650. @table @option
  4651. @item n
  4652. frame number (starting at zero)
  4653. @item nb_channels
  4654. number of channels
  4655. @item nb_consumed_samples
  4656. number of samples consumed by the filter
  4657. @item nb_samples
  4658. number of samples in the current frame
  4659. @item pos
  4660. original frame position in the file
  4661. @item pts
  4662. frame PTS
  4663. @item sample_rate
  4664. sample rate
  4665. @item startpts
  4666. PTS at start of stream
  4667. @item startt
  4668. time at start of stream
  4669. @item t
  4670. frame time
  4671. @item tb
  4672. timestamp timebase
  4673. @item volume
  4674. last set volume value
  4675. @end table
  4676. Note that when @option{eval} is set to @samp{once} only the
  4677. @var{sample_rate} and @var{tb} variables are available, all other
  4678. variables will evaluate to NAN.
  4679. @subsection Commands
  4680. This filter supports the following commands:
  4681. @table @option
  4682. @item volume
  4683. Modify the volume expression.
  4684. The command accepts the same syntax of the corresponding option.
  4685. If the specified expression is not valid, it is kept at its current
  4686. value.
  4687. @end table
  4688. @subsection Examples
  4689. @itemize
  4690. @item
  4691. Halve the input audio volume:
  4692. @example
  4693. volume=volume=0.5
  4694. volume=volume=1/2
  4695. volume=volume=-6.0206dB
  4696. @end example
  4697. In all the above example the named key for @option{volume} can be
  4698. omitted, for example like in:
  4699. @example
  4700. volume=0.5
  4701. @end example
  4702. @item
  4703. Increase input audio power by 6 decibels using fixed-point precision:
  4704. @example
  4705. volume=volume=6dB:precision=fixed
  4706. @end example
  4707. @item
  4708. Fade volume after time 10 with an annihilation period of 5 seconds:
  4709. @example
  4710. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4711. @end example
  4712. @end itemize
  4713. @section volumedetect
  4714. Detect the volume of the input video.
  4715. The filter has no parameters. The input is not modified. Statistics about
  4716. the volume will be printed in the log when the input stream end is reached.
  4717. In particular it will show the mean volume (root mean square), maximum
  4718. volume (on a per-sample basis), and the beginning of a histogram of the
  4719. registered volume values (from the maximum value to a cumulated 1/1000 of
  4720. the samples).
  4721. All volumes are in decibels relative to the maximum PCM value.
  4722. @subsection Examples
  4723. Here is an excerpt of the output:
  4724. @example
  4725. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4726. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4727. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4728. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4729. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4730. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4731. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4732. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4733. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4734. @end example
  4735. It means that:
  4736. @itemize
  4737. @item
  4738. The mean square energy is approximately -27 dB, or 10^-2.7.
  4739. @item
  4740. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4741. @item
  4742. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4743. @end itemize
  4744. In other words, raising the volume by +4 dB does not cause any clipping,
  4745. raising it by +5 dB causes clipping for 6 samples, etc.
  4746. @c man end AUDIO FILTERS
  4747. @chapter Audio Sources
  4748. @c man begin AUDIO SOURCES
  4749. Below is a description of the currently available audio sources.
  4750. @section abuffer
  4751. Buffer audio frames, and make them available to the filter chain.
  4752. This source is mainly intended for a programmatic use, in particular
  4753. through the interface defined in @file{libavfilter/buffersrc.h}.
  4754. It accepts the following parameters:
  4755. @table @option
  4756. @item time_base
  4757. The timebase which will be used for timestamps of submitted frames. It must be
  4758. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4759. @item sample_rate
  4760. The sample rate of the incoming audio buffers.
  4761. @item sample_fmt
  4762. The sample format of the incoming audio buffers.
  4763. Either a sample format name or its corresponding integer representation from
  4764. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4765. @item channel_layout
  4766. The channel layout of the incoming audio buffers.
  4767. Either a channel layout name from channel_layout_map in
  4768. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4769. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4770. @item channels
  4771. The number of channels of the incoming audio buffers.
  4772. If both @var{channels} and @var{channel_layout} are specified, then they
  4773. must be consistent.
  4774. @end table
  4775. @subsection Examples
  4776. @example
  4777. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4778. @end example
  4779. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4780. Since the sample format with name "s16p" corresponds to the number
  4781. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4782. equivalent to:
  4783. @example
  4784. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4785. @end example
  4786. @section aevalsrc
  4787. Generate an audio signal specified by an expression.
  4788. This source accepts in input one or more expressions (one for each
  4789. channel), which are evaluated and used to generate a corresponding
  4790. audio signal.
  4791. This source accepts the following options:
  4792. @table @option
  4793. @item exprs
  4794. Set the '|'-separated expressions list for each separate channel. In case the
  4795. @option{channel_layout} option is not specified, the selected channel layout
  4796. depends on the number of provided expressions. Otherwise the last
  4797. specified expression is applied to the remaining output channels.
  4798. @item channel_layout, c
  4799. Set the channel layout. The number of channels in the specified layout
  4800. must be equal to the number of specified expressions.
  4801. @item duration, d
  4802. Set the minimum duration of the sourced audio. See
  4803. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4804. for the accepted syntax.
  4805. Note that the resulting duration may be greater than the specified
  4806. duration, as the generated audio is always cut at the end of a
  4807. complete frame.
  4808. If not specified, or the expressed duration is negative, the audio is
  4809. supposed to be generated forever.
  4810. @item nb_samples, n
  4811. Set the number of samples per channel per each output frame,
  4812. default to 1024.
  4813. @item sample_rate, s
  4814. Specify the sample rate, default to 44100.
  4815. @end table
  4816. Each expression in @var{exprs} can contain the following constants:
  4817. @table @option
  4818. @item n
  4819. number of the evaluated sample, starting from 0
  4820. @item t
  4821. time of the evaluated sample expressed in seconds, starting from 0
  4822. @item s
  4823. sample rate
  4824. @end table
  4825. @subsection Examples
  4826. @itemize
  4827. @item
  4828. Generate silence:
  4829. @example
  4830. aevalsrc=0
  4831. @end example
  4832. @item
  4833. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4834. 8000 Hz:
  4835. @example
  4836. aevalsrc="sin(440*2*PI*t):s=8000"
  4837. @end example
  4838. @item
  4839. Generate a two channels signal, specify the channel layout (Front
  4840. Center + Back Center) explicitly:
  4841. @example
  4842. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4843. @end example
  4844. @item
  4845. Generate white noise:
  4846. @example
  4847. aevalsrc="-2+random(0)"
  4848. @end example
  4849. @item
  4850. Generate an amplitude modulated signal:
  4851. @example
  4852. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4853. @end example
  4854. @item
  4855. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4856. @example
  4857. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4858. @end example
  4859. @end itemize
  4860. @section afirsrc
  4861. Generate a FIR coefficients using frequency sampling method.
  4862. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4863. The filter accepts the following options:
  4864. @table @option
  4865. @item taps, t
  4866. Set number of filter coefficents in output audio stream.
  4867. Default value is 1025.
  4868. @item frequency, f
  4869. Set frequency points from where magnitude and phase are set.
  4870. This must be in non decreasing order, and first element must be 0, while last element
  4871. must be 1. Elements are separated by white spaces.
  4872. @item magnitude, m
  4873. Set magnitude value for every frequency point set by @option{frequency}.
  4874. Number of values must be same as number of frequency points.
  4875. Values are separated by white spaces.
  4876. @item phase, p
  4877. Set phase value for every frequency point set by @option{frequency}.
  4878. Number of values must be same as number of frequency points.
  4879. Values are separated by white spaces.
  4880. @item sample_rate, r
  4881. Set sample rate, default is 44100.
  4882. @item nb_samples, n
  4883. Set number of samples per each frame. Default is 1024.
  4884. @item win_func, w
  4885. Set window function. Default is blackman.
  4886. @end table
  4887. @section anullsrc
  4888. The null audio source, return unprocessed audio frames. It is mainly useful
  4889. as a template and to be employed in analysis / debugging tools, or as
  4890. the source for filters which ignore the input data (for example the sox
  4891. synth filter).
  4892. This source accepts the following options:
  4893. @table @option
  4894. @item channel_layout, cl
  4895. Specifies the channel layout, and can be either an integer or a string
  4896. representing a channel layout. The default value of @var{channel_layout}
  4897. is "stereo".
  4898. Check the channel_layout_map definition in
  4899. @file{libavutil/channel_layout.c} for the mapping between strings and
  4900. channel layout values.
  4901. @item sample_rate, r
  4902. Specifies the sample rate, and defaults to 44100.
  4903. @item nb_samples, n
  4904. Set the number of samples per requested frames.
  4905. @item duration, d
  4906. Set the duration of the sourced audio. See
  4907. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4908. for the accepted syntax.
  4909. If not specified, or the expressed duration is negative, the audio is
  4910. supposed to be generated forever.
  4911. @end table
  4912. @subsection Examples
  4913. @itemize
  4914. @item
  4915. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4916. @example
  4917. anullsrc=r=48000:cl=4
  4918. @end example
  4919. @item
  4920. Do the same operation with a more obvious syntax:
  4921. @example
  4922. anullsrc=r=48000:cl=mono
  4923. @end example
  4924. @end itemize
  4925. All the parameters need to be explicitly defined.
  4926. @section flite
  4927. Synthesize a voice utterance using the libflite library.
  4928. To enable compilation of this filter you need to configure FFmpeg with
  4929. @code{--enable-libflite}.
  4930. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4931. The filter accepts the following options:
  4932. @table @option
  4933. @item list_voices
  4934. If set to 1, list the names of the available voices and exit
  4935. immediately. Default value is 0.
  4936. @item nb_samples, n
  4937. Set the maximum number of samples per frame. Default value is 512.
  4938. @item textfile
  4939. Set the filename containing the text to speak.
  4940. @item text
  4941. Set the text to speak.
  4942. @item voice, v
  4943. Set the voice to use for the speech synthesis. Default value is
  4944. @code{kal}. See also the @var{list_voices} option.
  4945. @end table
  4946. @subsection Examples
  4947. @itemize
  4948. @item
  4949. Read from file @file{speech.txt}, and synthesize the text using the
  4950. standard flite voice:
  4951. @example
  4952. flite=textfile=speech.txt
  4953. @end example
  4954. @item
  4955. Read the specified text selecting the @code{slt} voice:
  4956. @example
  4957. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4958. @end example
  4959. @item
  4960. Input text to ffmpeg:
  4961. @example
  4962. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4963. @end example
  4964. @item
  4965. Make @file{ffplay} speak the specified text, using @code{flite} and
  4966. the @code{lavfi} device:
  4967. @example
  4968. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4969. @end example
  4970. @end itemize
  4971. For more information about libflite, check:
  4972. @url{http://www.festvox.org/flite/}
  4973. @section anoisesrc
  4974. Generate a noise audio signal.
  4975. The filter accepts the following options:
  4976. @table @option
  4977. @item sample_rate, r
  4978. Specify the sample rate. Default value is 48000 Hz.
  4979. @item amplitude, a
  4980. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4981. is 1.0.
  4982. @item duration, d
  4983. Specify the duration of the generated audio stream. Not specifying this option
  4984. results in noise with an infinite length.
  4985. @item color, colour, c
  4986. Specify the color of noise. Available noise colors are white, pink, brown,
  4987. blue, violet and velvet. Default color is white.
  4988. @item seed, s
  4989. Specify a value used to seed the PRNG.
  4990. @item nb_samples, n
  4991. Set the number of samples per each output frame, default is 1024.
  4992. @end table
  4993. @subsection Examples
  4994. @itemize
  4995. @item
  4996. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4997. @example
  4998. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4999. @end example
  5000. @end itemize
  5001. @section hilbert
  5002. Generate odd-tap Hilbert transform FIR coefficients.
  5003. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5004. the signal by 90 degrees.
  5005. This is used in many matrix coding schemes and for analytic signal generation.
  5006. The process is often written as a multiplication by i (or j), the imaginary unit.
  5007. The filter accepts the following options:
  5008. @table @option
  5009. @item sample_rate, s
  5010. Set sample rate, default is 44100.
  5011. @item taps, t
  5012. Set length of FIR filter, default is 22051.
  5013. @item nb_samples, n
  5014. Set number of samples per each frame.
  5015. @item win_func, w
  5016. Set window function to be used when generating FIR coefficients.
  5017. @end table
  5018. @section sinc
  5019. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5020. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5021. The filter accepts the following options:
  5022. @table @option
  5023. @item sample_rate, r
  5024. Set sample rate, default is 44100.
  5025. @item nb_samples, n
  5026. Set number of samples per each frame. Default is 1024.
  5027. @item hp
  5028. Set high-pass frequency. Default is 0.
  5029. @item lp
  5030. Set low-pass frequency. Default is 0.
  5031. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5032. is higher than 0 then filter will create band-pass filter coefficients,
  5033. otherwise band-reject filter coefficients.
  5034. @item phase
  5035. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5036. @item beta
  5037. Set Kaiser window beta.
  5038. @item att
  5039. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5040. @item round
  5041. Enable rounding, by default is disabled.
  5042. @item hptaps
  5043. Set number of taps for high-pass filter.
  5044. @item lptaps
  5045. Set number of taps for low-pass filter.
  5046. @end table
  5047. @section sine
  5048. Generate an audio signal made of a sine wave with amplitude 1/8.
  5049. The audio signal is bit-exact.
  5050. The filter accepts the following options:
  5051. @table @option
  5052. @item frequency, f
  5053. Set the carrier frequency. Default is 440 Hz.
  5054. @item beep_factor, b
  5055. Enable a periodic beep every second with frequency @var{beep_factor} times
  5056. the carrier frequency. Default is 0, meaning the beep is disabled.
  5057. @item sample_rate, r
  5058. Specify the sample rate, default is 44100.
  5059. @item duration, d
  5060. Specify the duration of the generated audio stream.
  5061. @item samples_per_frame
  5062. Set the number of samples per output frame.
  5063. The expression can contain the following constants:
  5064. @table @option
  5065. @item n
  5066. The (sequential) number of the output audio frame, starting from 0.
  5067. @item pts
  5068. The PTS (Presentation TimeStamp) of the output audio frame,
  5069. expressed in @var{TB} units.
  5070. @item t
  5071. The PTS of the output audio frame, expressed in seconds.
  5072. @item TB
  5073. The timebase of the output audio frames.
  5074. @end table
  5075. Default is @code{1024}.
  5076. @end table
  5077. @subsection Examples
  5078. @itemize
  5079. @item
  5080. Generate a simple 440 Hz sine wave:
  5081. @example
  5082. sine
  5083. @end example
  5084. @item
  5085. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5086. @example
  5087. sine=220:4:d=5
  5088. sine=f=220:b=4:d=5
  5089. sine=frequency=220:beep_factor=4:duration=5
  5090. @end example
  5091. @item
  5092. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5093. pattern:
  5094. @example
  5095. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5096. @end example
  5097. @end itemize
  5098. @c man end AUDIO SOURCES
  5099. @chapter Audio Sinks
  5100. @c man begin AUDIO SINKS
  5101. Below is a description of the currently available audio sinks.
  5102. @section abuffersink
  5103. Buffer audio frames, and make them available to the end of filter chain.
  5104. This sink is mainly intended for programmatic use, in particular
  5105. through the interface defined in @file{libavfilter/buffersink.h}
  5106. or the options system.
  5107. It accepts a pointer to an AVABufferSinkContext structure, which
  5108. defines the incoming buffers' formats, to be passed as the opaque
  5109. parameter to @code{avfilter_init_filter} for initialization.
  5110. @section anullsink
  5111. Null audio sink; do absolutely nothing with the input audio. It is
  5112. mainly useful as a template and for use in analysis / debugging
  5113. tools.
  5114. @c man end AUDIO SINKS
  5115. @chapter Video Filters
  5116. @c man begin VIDEO FILTERS
  5117. When you configure your FFmpeg build, you can disable any of the
  5118. existing filters using @code{--disable-filters}.
  5119. The configure output will show the video filters included in your
  5120. build.
  5121. Below is a description of the currently available video filters.
  5122. @section addroi
  5123. Mark a region of interest in a video frame.
  5124. The frame data is passed through unchanged, but metadata is attached
  5125. to the frame indicating regions of interest which can affect the
  5126. behaviour of later encoding. Multiple regions can be marked by
  5127. applying the filter multiple times.
  5128. @table @option
  5129. @item x
  5130. Region distance in pixels from the left edge of the frame.
  5131. @item y
  5132. Region distance in pixels from the top edge of the frame.
  5133. @item w
  5134. Region width in pixels.
  5135. @item h
  5136. Region height in pixels.
  5137. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5138. and may contain the following variables:
  5139. @table @option
  5140. @item iw
  5141. Width of the input frame.
  5142. @item ih
  5143. Height of the input frame.
  5144. @end table
  5145. @item qoffset
  5146. Quantisation offset to apply within the region.
  5147. This must be a real value in the range -1 to +1. A value of zero
  5148. indicates no quality change. A negative value asks for better quality
  5149. (less quantisation), while a positive value asks for worse quality
  5150. (greater quantisation).
  5151. The range is calibrated so that the extreme values indicate the
  5152. largest possible offset - if the rest of the frame is encoded with the
  5153. worst possible quality, an offset of -1 indicates that this region
  5154. should be encoded with the best possible quality anyway. Intermediate
  5155. values are then interpolated in some codec-dependent way.
  5156. For example, in 10-bit H.264 the quantisation parameter varies between
  5157. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5158. this region should be encoded with a QP around one-tenth of the full
  5159. range better than the rest of the frame. So, if most of the frame
  5160. were to be encoded with a QP of around 30, this region would get a QP
  5161. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5162. An extreme value of -1 would indicate that this region should be
  5163. encoded with the best possible quality regardless of the treatment of
  5164. the rest of the frame - that is, should be encoded at a QP of -12.
  5165. @item clear
  5166. If set to true, remove any existing regions of interest marked on the
  5167. frame before adding the new one.
  5168. @end table
  5169. @subsection Examples
  5170. @itemize
  5171. @item
  5172. Mark the centre quarter of the frame as interesting.
  5173. @example
  5174. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5175. @end example
  5176. @item
  5177. Mark the 100-pixel-wide region on the left edge of the frame as very
  5178. uninteresting (to be encoded at much lower quality than the rest of
  5179. the frame).
  5180. @example
  5181. addroi=0:0:100:ih:+1/5
  5182. @end example
  5183. @end itemize
  5184. @section alphaextract
  5185. Extract the alpha component from the input as a grayscale video. This
  5186. is especially useful with the @var{alphamerge} filter.
  5187. @section alphamerge
  5188. Add or replace the alpha component of the primary input with the
  5189. grayscale value of a second input. This is intended for use with
  5190. @var{alphaextract} to allow the transmission or storage of frame
  5191. sequences that have alpha in a format that doesn't support an alpha
  5192. channel.
  5193. For example, to reconstruct full frames from a normal YUV-encoded video
  5194. and a separate video created with @var{alphaextract}, you might use:
  5195. @example
  5196. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5197. @end example
  5198. @section amplify
  5199. Amplify differences between current pixel and pixels of adjacent frames in
  5200. same pixel location.
  5201. This filter accepts the following options:
  5202. @table @option
  5203. @item radius
  5204. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5205. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5206. @item factor
  5207. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5208. @item threshold
  5209. Set threshold for difference amplification. Any difference greater or equal to
  5210. this value will not alter source pixel. Default is 10.
  5211. Allowed range is from 0 to 65535.
  5212. @item tolerance
  5213. Set tolerance for difference amplification. Any difference lower to
  5214. this value will not alter source pixel. Default is 0.
  5215. Allowed range is from 0 to 65535.
  5216. @item low
  5217. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5218. This option controls maximum possible value that will decrease source pixel value.
  5219. @item high
  5220. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5221. This option controls maximum possible value that will increase source pixel value.
  5222. @item planes
  5223. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5224. @end table
  5225. @subsection Commands
  5226. This filter supports the following @ref{commands} that corresponds to option of same name:
  5227. @table @option
  5228. @item factor
  5229. @item threshold
  5230. @item tolerance
  5231. @item low
  5232. @item high
  5233. @item planes
  5234. @end table
  5235. @section ass
  5236. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5237. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5238. Substation Alpha) subtitles files.
  5239. This filter accepts the following option in addition to the common options from
  5240. the @ref{subtitles} filter:
  5241. @table @option
  5242. @item shaping
  5243. Set the shaping engine
  5244. Available values are:
  5245. @table @samp
  5246. @item auto
  5247. The default libass shaping engine, which is the best available.
  5248. @item simple
  5249. Fast, font-agnostic shaper that can do only substitutions
  5250. @item complex
  5251. Slower shaper using OpenType for substitutions and positioning
  5252. @end table
  5253. The default is @code{auto}.
  5254. @end table
  5255. @section atadenoise
  5256. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5257. The filter accepts the following options:
  5258. @table @option
  5259. @item 0a
  5260. Set threshold A for 1st plane. Default is 0.02.
  5261. Valid range is 0 to 0.3.
  5262. @item 0b
  5263. Set threshold B for 1st plane. Default is 0.04.
  5264. Valid range is 0 to 5.
  5265. @item 1a
  5266. Set threshold A for 2nd plane. Default is 0.02.
  5267. Valid range is 0 to 0.3.
  5268. @item 1b
  5269. Set threshold B for 2nd plane. Default is 0.04.
  5270. Valid range is 0 to 5.
  5271. @item 2a
  5272. Set threshold A for 3rd plane. Default is 0.02.
  5273. Valid range is 0 to 0.3.
  5274. @item 2b
  5275. Set threshold B for 3rd plane. Default is 0.04.
  5276. Valid range is 0 to 5.
  5277. Threshold A is designed to react on abrupt changes in the input signal and
  5278. threshold B is designed to react on continuous changes in the input signal.
  5279. @item s
  5280. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5281. number in range [5, 129].
  5282. @item p
  5283. Set what planes of frame filter will use for averaging. Default is all.
  5284. @item a
  5285. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5286. Alternatively can be set to @code{s} serial.
  5287. Parallel can be faster then serial, while other way around is never true.
  5288. Parallel will abort early on first change being greater then thresholds, while serial
  5289. will continue processing other side of frames if they are equal or below thresholds.
  5290. @end table
  5291. @subsection Commands
  5292. This filter supports same @ref{commands} as options except option @code{s}.
  5293. The command accepts the same syntax of the corresponding option.
  5294. @section avgblur
  5295. Apply average blur filter.
  5296. The filter accepts the following options:
  5297. @table @option
  5298. @item sizeX
  5299. Set horizontal radius size.
  5300. @item planes
  5301. Set which planes to filter. By default all planes are filtered.
  5302. @item sizeY
  5303. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5304. Default is @code{0}.
  5305. @end table
  5306. @subsection Commands
  5307. This filter supports same commands as options.
  5308. The command accepts the same syntax of the corresponding option.
  5309. If the specified expression is not valid, it is kept at its current
  5310. value.
  5311. @section bbox
  5312. Compute the bounding box for the non-black pixels in the input frame
  5313. luminance plane.
  5314. This filter computes the bounding box containing all the pixels with a
  5315. luminance value greater than the minimum allowed value.
  5316. The parameters describing the bounding box are printed on the filter
  5317. log.
  5318. The filter accepts the following option:
  5319. @table @option
  5320. @item min_val
  5321. Set the minimal luminance value. Default is @code{16}.
  5322. @end table
  5323. @section bilateral
  5324. Apply bilateral filter, spatial smoothing while preserving edges.
  5325. The filter accepts the following options:
  5326. @table @option
  5327. @item sigmaS
  5328. Set sigma of gaussian function to calculate spatial weight.
  5329. Allowed range is 0 to 512. Default is 0.1.
  5330. @item sigmaR
  5331. Set sigma of gaussian function to calculate range weight.
  5332. Allowed range is 0 to 1. Default is 0.1.
  5333. @item planes
  5334. Set planes to filter. Default is first only.
  5335. @end table
  5336. @section bitplanenoise
  5337. Show and measure bit plane noise.
  5338. The filter accepts the following options:
  5339. @table @option
  5340. @item bitplane
  5341. Set which plane to analyze. Default is @code{1}.
  5342. @item filter
  5343. Filter out noisy pixels from @code{bitplane} set above.
  5344. Default is disabled.
  5345. @end table
  5346. @section blackdetect
  5347. Detect video intervals that are (almost) completely black. Can be
  5348. useful to detect chapter transitions, commercials, or invalid
  5349. recordings.
  5350. The filter outputs its detection analysis to both the log as well as
  5351. frame metadata. If a black segment of at least the specified minimum
  5352. duration is found, a line with the start and end timestamps as well
  5353. as duration is printed to the log with level @code{info}. In addition,
  5354. a log line with level @code{debug} is printed per frame showing the
  5355. black amount detected for that frame.
  5356. The filter also attaches metadata to the first frame of a black
  5357. segment with key @code{lavfi.black_start} and to the first frame
  5358. after the black segment ends with key @code{lavfi.black_end}. The
  5359. value is the frame's timestamp. This metadata is added regardless
  5360. of the minimum duration specified.
  5361. The filter accepts the following options:
  5362. @table @option
  5363. @item black_min_duration, d
  5364. Set the minimum detected black duration expressed in seconds. It must
  5365. be a non-negative floating point number.
  5366. Default value is 2.0.
  5367. @item picture_black_ratio_th, pic_th
  5368. Set the threshold for considering a picture "black".
  5369. Express the minimum value for the ratio:
  5370. @example
  5371. @var{nb_black_pixels} / @var{nb_pixels}
  5372. @end example
  5373. for which a picture is considered black.
  5374. Default value is 0.98.
  5375. @item pixel_black_th, pix_th
  5376. Set the threshold for considering a pixel "black".
  5377. The threshold expresses the maximum pixel luminance value for which a
  5378. pixel is considered "black". The provided value is scaled according to
  5379. the following equation:
  5380. @example
  5381. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5382. @end example
  5383. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5384. the input video format, the range is [0-255] for YUV full-range
  5385. formats and [16-235] for YUV non full-range formats.
  5386. Default value is 0.10.
  5387. @end table
  5388. The following example sets the maximum pixel threshold to the minimum
  5389. value, and detects only black intervals of 2 or more seconds:
  5390. @example
  5391. blackdetect=d=2:pix_th=0.00
  5392. @end example
  5393. @section blackframe
  5394. Detect frames that are (almost) completely black. Can be useful to
  5395. detect chapter transitions or commercials. Output lines consist of
  5396. the frame number of the detected frame, the percentage of blackness,
  5397. the position in the file if known or -1 and the timestamp in seconds.
  5398. In order to display the output lines, you need to set the loglevel at
  5399. least to the AV_LOG_INFO value.
  5400. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5401. The value represents the percentage of pixels in the picture that
  5402. are below the threshold value.
  5403. It accepts the following parameters:
  5404. @table @option
  5405. @item amount
  5406. The percentage of the pixels that have to be below the threshold; it defaults to
  5407. @code{98}.
  5408. @item threshold, thresh
  5409. The threshold below which a pixel value is considered black; it defaults to
  5410. @code{32}.
  5411. @end table
  5412. @anchor{blend}
  5413. @section blend
  5414. Blend two video frames into each other.
  5415. The @code{blend} filter takes two input streams and outputs one
  5416. stream, the first input is the "top" layer and second input is
  5417. "bottom" layer. By default, the output terminates when the longest input terminates.
  5418. The @code{tblend} (time blend) filter takes two consecutive frames
  5419. from one single stream, and outputs the result obtained by blending
  5420. the new frame on top of the old frame.
  5421. A description of the accepted options follows.
  5422. @table @option
  5423. @item c0_mode
  5424. @item c1_mode
  5425. @item c2_mode
  5426. @item c3_mode
  5427. @item all_mode
  5428. Set blend mode for specific pixel component or all pixel components in case
  5429. of @var{all_mode}. Default value is @code{normal}.
  5430. Available values for component modes are:
  5431. @table @samp
  5432. @item addition
  5433. @item grainmerge
  5434. @item and
  5435. @item average
  5436. @item burn
  5437. @item darken
  5438. @item difference
  5439. @item grainextract
  5440. @item divide
  5441. @item dodge
  5442. @item freeze
  5443. @item exclusion
  5444. @item extremity
  5445. @item glow
  5446. @item hardlight
  5447. @item hardmix
  5448. @item heat
  5449. @item lighten
  5450. @item linearlight
  5451. @item multiply
  5452. @item multiply128
  5453. @item negation
  5454. @item normal
  5455. @item or
  5456. @item overlay
  5457. @item phoenix
  5458. @item pinlight
  5459. @item reflect
  5460. @item screen
  5461. @item softlight
  5462. @item subtract
  5463. @item vividlight
  5464. @item xor
  5465. @end table
  5466. @item c0_opacity
  5467. @item c1_opacity
  5468. @item c2_opacity
  5469. @item c3_opacity
  5470. @item all_opacity
  5471. Set blend opacity for specific pixel component or all pixel components in case
  5472. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5473. @item c0_expr
  5474. @item c1_expr
  5475. @item c2_expr
  5476. @item c3_expr
  5477. @item all_expr
  5478. Set blend expression for specific pixel component or all pixel components in case
  5479. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5480. The expressions can use the following variables:
  5481. @table @option
  5482. @item N
  5483. The sequential number of the filtered frame, starting from @code{0}.
  5484. @item X
  5485. @item Y
  5486. the coordinates of the current sample
  5487. @item W
  5488. @item H
  5489. the width and height of currently filtered plane
  5490. @item SW
  5491. @item SH
  5492. Width and height scale for the plane being filtered. It is the
  5493. ratio between the dimensions of the current plane to the luma plane,
  5494. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5495. the luma plane and @code{0.5,0.5} for the chroma planes.
  5496. @item T
  5497. Time of the current frame, expressed in seconds.
  5498. @item TOP, A
  5499. Value of pixel component at current location for first video frame (top layer).
  5500. @item BOTTOM, B
  5501. Value of pixel component at current location for second video frame (bottom layer).
  5502. @end table
  5503. @end table
  5504. The @code{blend} filter also supports the @ref{framesync} options.
  5505. @subsection Examples
  5506. @itemize
  5507. @item
  5508. Apply transition from bottom layer to top layer in first 10 seconds:
  5509. @example
  5510. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5511. @end example
  5512. @item
  5513. Apply linear horizontal transition from top layer to bottom layer:
  5514. @example
  5515. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5516. @end example
  5517. @item
  5518. Apply 1x1 checkerboard effect:
  5519. @example
  5520. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5521. @end example
  5522. @item
  5523. Apply uncover left effect:
  5524. @example
  5525. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5526. @end example
  5527. @item
  5528. Apply uncover down effect:
  5529. @example
  5530. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5531. @end example
  5532. @item
  5533. Apply uncover up-left effect:
  5534. @example
  5535. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5536. @end example
  5537. @item
  5538. Split diagonally video and shows top and bottom layer on each side:
  5539. @example
  5540. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5541. @end example
  5542. @item
  5543. Display differences between the current and the previous frame:
  5544. @example
  5545. tblend=all_mode=grainextract
  5546. @end example
  5547. @end itemize
  5548. @section bm3d
  5549. Denoise frames using Block-Matching 3D algorithm.
  5550. The filter accepts the following options.
  5551. @table @option
  5552. @item sigma
  5553. Set denoising strength. Default value is 1.
  5554. Allowed range is from 0 to 999.9.
  5555. The denoising algorithm is very sensitive to sigma, so adjust it
  5556. according to the source.
  5557. @item block
  5558. Set local patch size. This sets dimensions in 2D.
  5559. @item bstep
  5560. Set sliding step for processing blocks. Default value is 4.
  5561. Allowed range is from 1 to 64.
  5562. Smaller values allows processing more reference blocks and is slower.
  5563. @item group
  5564. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5565. When set to 1, no block matching is done. Larger values allows more blocks
  5566. in single group.
  5567. Allowed range is from 1 to 256.
  5568. @item range
  5569. Set radius for search block matching. Default is 9.
  5570. Allowed range is from 1 to INT32_MAX.
  5571. @item mstep
  5572. Set step between two search locations for block matching. Default is 1.
  5573. Allowed range is from 1 to 64. Smaller is slower.
  5574. @item thmse
  5575. Set threshold of mean square error for block matching. Valid range is 0 to
  5576. INT32_MAX.
  5577. @item hdthr
  5578. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5579. Larger values results in stronger hard-thresholding filtering in frequency
  5580. domain.
  5581. @item estim
  5582. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5583. Default is @code{basic}.
  5584. @item ref
  5585. If enabled, filter will use 2nd stream for block matching.
  5586. Default is disabled for @code{basic} value of @var{estim} option,
  5587. and always enabled if value of @var{estim} is @code{final}.
  5588. @item planes
  5589. Set planes to filter. Default is all available except alpha.
  5590. @end table
  5591. @subsection Examples
  5592. @itemize
  5593. @item
  5594. Basic filtering with bm3d:
  5595. @example
  5596. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5597. @end example
  5598. @item
  5599. Same as above, but filtering only luma:
  5600. @example
  5601. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5602. @end example
  5603. @item
  5604. Same as above, but with both estimation modes:
  5605. @example
  5606. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  5607. @end example
  5608. @item
  5609. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5610. @example
  5611. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  5612. @end example
  5613. @end itemize
  5614. @section boxblur
  5615. Apply a boxblur algorithm to the input video.
  5616. It accepts the following parameters:
  5617. @table @option
  5618. @item luma_radius, lr
  5619. @item luma_power, lp
  5620. @item chroma_radius, cr
  5621. @item chroma_power, cp
  5622. @item alpha_radius, ar
  5623. @item alpha_power, ap
  5624. @end table
  5625. A description of the accepted options follows.
  5626. @table @option
  5627. @item luma_radius, lr
  5628. @item chroma_radius, cr
  5629. @item alpha_radius, ar
  5630. Set an expression for the box radius in pixels used for blurring the
  5631. corresponding input plane.
  5632. The radius value must be a non-negative number, and must not be
  5633. greater than the value of the expression @code{min(w,h)/2} for the
  5634. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5635. planes.
  5636. Default value for @option{luma_radius} is "2". If not specified,
  5637. @option{chroma_radius} and @option{alpha_radius} default to the
  5638. corresponding value set for @option{luma_radius}.
  5639. The expressions can contain the following constants:
  5640. @table @option
  5641. @item w
  5642. @item h
  5643. The input width and height in pixels.
  5644. @item cw
  5645. @item ch
  5646. The input chroma image width and height in pixels.
  5647. @item hsub
  5648. @item vsub
  5649. The horizontal and vertical chroma subsample values. For example, for the
  5650. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5651. @end table
  5652. @item luma_power, lp
  5653. @item chroma_power, cp
  5654. @item alpha_power, ap
  5655. Specify how many times the boxblur filter is applied to the
  5656. corresponding plane.
  5657. Default value for @option{luma_power} is 2. If not specified,
  5658. @option{chroma_power} and @option{alpha_power} default to the
  5659. corresponding value set for @option{luma_power}.
  5660. A value of 0 will disable the effect.
  5661. @end table
  5662. @subsection Examples
  5663. @itemize
  5664. @item
  5665. Apply a boxblur filter with the luma, chroma, and alpha radii
  5666. set to 2:
  5667. @example
  5668. boxblur=luma_radius=2:luma_power=1
  5669. boxblur=2:1
  5670. @end example
  5671. @item
  5672. Set the luma radius to 2, and alpha and chroma radius to 0:
  5673. @example
  5674. boxblur=2:1:cr=0:ar=0
  5675. @end example
  5676. @item
  5677. Set the luma and chroma radii to a fraction of the video dimension:
  5678. @example
  5679. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5680. @end example
  5681. @end itemize
  5682. @section bwdif
  5683. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5684. Deinterlacing Filter").
  5685. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5686. interpolation algorithms.
  5687. It accepts the following parameters:
  5688. @table @option
  5689. @item mode
  5690. The interlacing mode to adopt. It accepts one of the following values:
  5691. @table @option
  5692. @item 0, send_frame
  5693. Output one frame for each frame.
  5694. @item 1, send_field
  5695. Output one frame for each field.
  5696. @end table
  5697. The default value is @code{send_field}.
  5698. @item parity
  5699. The picture field parity assumed for the input interlaced video. It accepts one
  5700. of the following values:
  5701. @table @option
  5702. @item 0, tff
  5703. Assume the top field is first.
  5704. @item 1, bff
  5705. Assume the bottom field is first.
  5706. @item -1, auto
  5707. Enable automatic detection of field parity.
  5708. @end table
  5709. The default value is @code{auto}.
  5710. If the interlacing is unknown or the decoder does not export this information,
  5711. top field first will be assumed.
  5712. @item deint
  5713. Specify which frames to deinterlace. Accepts one of the following
  5714. values:
  5715. @table @option
  5716. @item 0, all
  5717. Deinterlace all frames.
  5718. @item 1, interlaced
  5719. Only deinterlace frames marked as interlaced.
  5720. @end table
  5721. The default value is @code{all}.
  5722. @end table
  5723. @section cas
  5724. Apply Contrast Adaptive Sharpen filter to video stream.
  5725. The filter accepts the following options:
  5726. @table @option
  5727. @item strength
  5728. Set the sharpening strength. Default value is 0.
  5729. @item planes
  5730. Set planes to filter. Default value is to filter all
  5731. planes except alpha plane.
  5732. @end table
  5733. @section chromahold
  5734. Remove all color information for all colors except for certain one.
  5735. The filter accepts the following options:
  5736. @table @option
  5737. @item color
  5738. The color which will not be replaced with neutral chroma.
  5739. @item similarity
  5740. Similarity percentage with the above color.
  5741. 0.01 matches only the exact key color, while 1.0 matches everything.
  5742. @item blend
  5743. Blend percentage.
  5744. 0.0 makes pixels either fully gray, or not gray at all.
  5745. Higher values result in more preserved color.
  5746. @item yuv
  5747. Signals that the color passed is already in YUV instead of RGB.
  5748. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5749. This can be used to pass exact YUV values as hexadecimal numbers.
  5750. @end table
  5751. @subsection Commands
  5752. This filter supports same @ref{commands} as options.
  5753. The command accepts the same syntax of the corresponding option.
  5754. If the specified expression is not valid, it is kept at its current
  5755. value.
  5756. @section chromakey
  5757. YUV colorspace color/chroma keying.
  5758. The filter accepts the following options:
  5759. @table @option
  5760. @item color
  5761. The color which will be replaced with transparency.
  5762. @item similarity
  5763. Similarity percentage with the key color.
  5764. 0.01 matches only the exact key color, while 1.0 matches everything.
  5765. @item blend
  5766. Blend percentage.
  5767. 0.0 makes pixels either fully transparent, or not transparent at all.
  5768. Higher values result in semi-transparent pixels, with a higher transparency
  5769. the more similar the pixels color is to the key color.
  5770. @item yuv
  5771. Signals that the color passed is already in YUV instead of RGB.
  5772. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5773. This can be used to pass exact YUV values as hexadecimal numbers.
  5774. @end table
  5775. @subsection Commands
  5776. This filter supports same @ref{commands} as options.
  5777. The command accepts the same syntax of the corresponding option.
  5778. If the specified expression is not valid, it is kept at its current
  5779. value.
  5780. @subsection Examples
  5781. @itemize
  5782. @item
  5783. Make every green pixel in the input image transparent:
  5784. @example
  5785. ffmpeg -i input.png -vf chromakey=green out.png
  5786. @end example
  5787. @item
  5788. Overlay a greenscreen-video on top of a static black background.
  5789. @example
  5790. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  5791. @end example
  5792. @end itemize
  5793. @section chromanr
  5794. Reduce chrominance noise.
  5795. The filter accepts the following options:
  5796. @table @option
  5797. @item thres
  5798. Set threshold for averaging chrominance values.
  5799. Sum of absolute difference of U and V pixel components or current
  5800. pixel and neighbour pixels lower than this threshold will be used in
  5801. averaging. Luma component is left unchanged and is copied to output.
  5802. Default value is 30. Allowed range is from 1 to 200.
  5803. @item sizew
  5804. Set horizontal radius of rectangle used for averaging.
  5805. Allowed range is from 1 to 100. Default value is 5.
  5806. @item sizeh
  5807. Set vertical radius of rectangle used for averaging.
  5808. Allowed range is from 1 to 100. Default value is 5.
  5809. @item stepw
  5810. Set horizontal step when averaging. Default value is 1.
  5811. Allowed range is from 1 to 50.
  5812. Mostly useful to speed-up filtering.
  5813. @item steph
  5814. Set vertical step when averaging. Default value is 1.
  5815. Allowed range is from 1 to 50.
  5816. Mostly useful to speed-up filtering.
  5817. @end table
  5818. @subsection Commands
  5819. This filter supports same @ref{commands} as options.
  5820. The command accepts the same syntax of the corresponding option.
  5821. @section chromashift
  5822. Shift chroma pixels horizontally and/or vertically.
  5823. The filter accepts the following options:
  5824. @table @option
  5825. @item cbh
  5826. Set amount to shift chroma-blue horizontally.
  5827. @item cbv
  5828. Set amount to shift chroma-blue vertically.
  5829. @item crh
  5830. Set amount to shift chroma-red horizontally.
  5831. @item crv
  5832. Set amount to shift chroma-red vertically.
  5833. @item edge
  5834. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5835. @end table
  5836. @subsection Commands
  5837. This filter supports the all above options as @ref{commands}.
  5838. @section ciescope
  5839. Display CIE color diagram with pixels overlaid onto it.
  5840. The filter accepts the following options:
  5841. @table @option
  5842. @item system
  5843. Set color system.
  5844. @table @samp
  5845. @item ntsc, 470m
  5846. @item ebu, 470bg
  5847. @item smpte
  5848. @item 240m
  5849. @item apple
  5850. @item widergb
  5851. @item cie1931
  5852. @item rec709, hdtv
  5853. @item uhdtv, rec2020
  5854. @item dcip3
  5855. @end table
  5856. @item cie
  5857. Set CIE system.
  5858. @table @samp
  5859. @item xyy
  5860. @item ucs
  5861. @item luv
  5862. @end table
  5863. @item gamuts
  5864. Set what gamuts to draw.
  5865. See @code{system} option for available values.
  5866. @item size, s
  5867. Set ciescope size, by default set to 512.
  5868. @item intensity, i
  5869. Set intensity used to map input pixel values to CIE diagram.
  5870. @item contrast
  5871. Set contrast used to draw tongue colors that are out of active color system gamut.
  5872. @item corrgamma
  5873. Correct gamma displayed on scope, by default enabled.
  5874. @item showwhite
  5875. Show white point on CIE diagram, by default disabled.
  5876. @item gamma
  5877. Set input gamma. Used only with XYZ input color space.
  5878. @end table
  5879. @section codecview
  5880. Visualize information exported by some codecs.
  5881. Some codecs can export information through frames using side-data or other
  5882. means. For example, some MPEG based codecs export motion vectors through the
  5883. @var{export_mvs} flag in the codec @option{flags2} option.
  5884. The filter accepts the following option:
  5885. @table @option
  5886. @item mv
  5887. Set motion vectors to visualize.
  5888. Available flags for @var{mv} are:
  5889. @table @samp
  5890. @item pf
  5891. forward predicted MVs of P-frames
  5892. @item bf
  5893. forward predicted MVs of B-frames
  5894. @item bb
  5895. backward predicted MVs of B-frames
  5896. @end table
  5897. @item qp
  5898. Display quantization parameters using the chroma planes.
  5899. @item mv_type, mvt
  5900. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5901. Available flags for @var{mv_type} are:
  5902. @table @samp
  5903. @item fp
  5904. forward predicted MVs
  5905. @item bp
  5906. backward predicted MVs
  5907. @end table
  5908. @item frame_type, ft
  5909. Set frame type to visualize motion vectors of.
  5910. Available flags for @var{frame_type} are:
  5911. @table @samp
  5912. @item if
  5913. intra-coded frames (I-frames)
  5914. @item pf
  5915. predicted frames (P-frames)
  5916. @item bf
  5917. bi-directionally predicted frames (B-frames)
  5918. @end table
  5919. @end table
  5920. @subsection Examples
  5921. @itemize
  5922. @item
  5923. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5924. @example
  5925. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5926. @end example
  5927. @item
  5928. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5929. @example
  5930. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5931. @end example
  5932. @end itemize
  5933. @section colorbalance
  5934. Modify intensity of primary colors (red, green and blue) of input frames.
  5935. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5936. regions for the red-cyan, green-magenta or blue-yellow balance.
  5937. A positive adjustment value shifts the balance towards the primary color, a negative
  5938. value towards the complementary color.
  5939. The filter accepts the following options:
  5940. @table @option
  5941. @item rs
  5942. @item gs
  5943. @item bs
  5944. Adjust red, green and blue shadows (darkest pixels).
  5945. @item rm
  5946. @item gm
  5947. @item bm
  5948. Adjust red, green and blue midtones (medium pixels).
  5949. @item rh
  5950. @item gh
  5951. @item bh
  5952. Adjust red, green and blue highlights (brightest pixels).
  5953. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5954. @item pl
  5955. Preserve lightness when changing color balance. Default is disabled.
  5956. @end table
  5957. @subsection Examples
  5958. @itemize
  5959. @item
  5960. Add red color cast to shadows:
  5961. @example
  5962. colorbalance=rs=.3
  5963. @end example
  5964. @end itemize
  5965. @subsection Commands
  5966. This filter supports the all above options as @ref{commands}.
  5967. @section colorchannelmixer
  5968. Adjust video input frames by re-mixing color channels.
  5969. This filter modifies a color channel by adding the values associated to
  5970. the other channels of the same pixels. For example if the value to
  5971. modify is red, the output value will be:
  5972. @example
  5973. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5974. @end example
  5975. The filter accepts the following options:
  5976. @table @option
  5977. @item rr
  5978. @item rg
  5979. @item rb
  5980. @item ra
  5981. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5982. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5983. @item gr
  5984. @item gg
  5985. @item gb
  5986. @item ga
  5987. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5988. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5989. @item br
  5990. @item bg
  5991. @item bb
  5992. @item ba
  5993. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5994. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5995. @item ar
  5996. @item ag
  5997. @item ab
  5998. @item aa
  5999. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6000. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6001. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6002. @end table
  6003. @subsection Examples
  6004. @itemize
  6005. @item
  6006. Convert source to grayscale:
  6007. @example
  6008. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6009. @end example
  6010. @item
  6011. Simulate sepia tones:
  6012. @example
  6013. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6014. @end example
  6015. @end itemize
  6016. @subsection Commands
  6017. This filter supports the all above options as @ref{commands}.
  6018. @section colorkey
  6019. RGB colorspace color keying.
  6020. The filter accepts the following options:
  6021. @table @option
  6022. @item color
  6023. The color which will be replaced with transparency.
  6024. @item similarity
  6025. Similarity percentage with the key color.
  6026. 0.01 matches only the exact key color, while 1.0 matches everything.
  6027. @item blend
  6028. Blend percentage.
  6029. 0.0 makes pixels either fully transparent, or not transparent at all.
  6030. Higher values result in semi-transparent pixels, with a higher transparency
  6031. the more similar the pixels color is to the key color.
  6032. @end table
  6033. @subsection Examples
  6034. @itemize
  6035. @item
  6036. Make every green pixel in the input image transparent:
  6037. @example
  6038. ffmpeg -i input.png -vf colorkey=green out.png
  6039. @end example
  6040. @item
  6041. Overlay a greenscreen-video on top of a static background image.
  6042. @example
  6043. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  6044. @end example
  6045. @end itemize
  6046. @subsection Commands
  6047. This filter supports same @ref{commands} as options.
  6048. The command accepts the same syntax of the corresponding option.
  6049. If the specified expression is not valid, it is kept at its current
  6050. value.
  6051. @section colorhold
  6052. Remove all color information for all RGB colors except for certain one.
  6053. The filter accepts the following options:
  6054. @table @option
  6055. @item color
  6056. The color which will not be replaced with neutral gray.
  6057. @item similarity
  6058. Similarity percentage with the above color.
  6059. 0.01 matches only the exact key color, while 1.0 matches everything.
  6060. @item blend
  6061. Blend percentage. 0.0 makes pixels fully gray.
  6062. Higher values result in more preserved color.
  6063. @end table
  6064. @subsection Commands
  6065. This filter supports same @ref{commands} as options.
  6066. The command accepts the same syntax of the corresponding option.
  6067. If the specified expression is not valid, it is kept at its current
  6068. value.
  6069. @section colorlevels
  6070. Adjust video input frames using levels.
  6071. The filter accepts the following options:
  6072. @table @option
  6073. @item rimin
  6074. @item gimin
  6075. @item bimin
  6076. @item aimin
  6077. Adjust red, green, blue and alpha input black point.
  6078. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6079. @item rimax
  6080. @item gimax
  6081. @item bimax
  6082. @item aimax
  6083. Adjust red, green, blue and alpha input white point.
  6084. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6085. Input levels are used to lighten highlights (bright tones), darken shadows
  6086. (dark tones), change the balance of bright and dark tones.
  6087. @item romin
  6088. @item gomin
  6089. @item bomin
  6090. @item aomin
  6091. Adjust red, green, blue and alpha output black point.
  6092. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6093. @item romax
  6094. @item gomax
  6095. @item bomax
  6096. @item aomax
  6097. Adjust red, green, blue and alpha output white point.
  6098. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6099. Output levels allows manual selection of a constrained output level range.
  6100. @end table
  6101. @subsection Examples
  6102. @itemize
  6103. @item
  6104. Make video output darker:
  6105. @example
  6106. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6107. @end example
  6108. @item
  6109. Increase contrast:
  6110. @example
  6111. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6112. @end example
  6113. @item
  6114. Make video output lighter:
  6115. @example
  6116. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6117. @end example
  6118. @item
  6119. Increase brightness:
  6120. @example
  6121. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6122. @end example
  6123. @end itemize
  6124. @subsection Commands
  6125. This filter supports the all above options as @ref{commands}.
  6126. @section colormatrix
  6127. Convert color matrix.
  6128. The filter accepts the following options:
  6129. @table @option
  6130. @item src
  6131. @item dst
  6132. Specify the source and destination color matrix. Both values must be
  6133. specified.
  6134. The accepted values are:
  6135. @table @samp
  6136. @item bt709
  6137. BT.709
  6138. @item fcc
  6139. FCC
  6140. @item bt601
  6141. BT.601
  6142. @item bt470
  6143. BT.470
  6144. @item bt470bg
  6145. BT.470BG
  6146. @item smpte170m
  6147. SMPTE-170M
  6148. @item smpte240m
  6149. SMPTE-240M
  6150. @item bt2020
  6151. BT.2020
  6152. @end table
  6153. @end table
  6154. For example to convert from BT.601 to SMPTE-240M, use the command:
  6155. @example
  6156. colormatrix=bt601:smpte240m
  6157. @end example
  6158. @section colorspace
  6159. Convert colorspace, transfer characteristics or color primaries.
  6160. Input video needs to have an even size.
  6161. The filter accepts the following options:
  6162. @table @option
  6163. @anchor{all}
  6164. @item all
  6165. Specify all color properties at once.
  6166. The accepted values are:
  6167. @table @samp
  6168. @item bt470m
  6169. BT.470M
  6170. @item bt470bg
  6171. BT.470BG
  6172. @item bt601-6-525
  6173. BT.601-6 525
  6174. @item bt601-6-625
  6175. BT.601-6 625
  6176. @item bt709
  6177. BT.709
  6178. @item smpte170m
  6179. SMPTE-170M
  6180. @item smpte240m
  6181. SMPTE-240M
  6182. @item bt2020
  6183. BT.2020
  6184. @end table
  6185. @anchor{space}
  6186. @item space
  6187. Specify output colorspace.
  6188. The accepted values are:
  6189. @table @samp
  6190. @item bt709
  6191. BT.709
  6192. @item fcc
  6193. FCC
  6194. @item bt470bg
  6195. BT.470BG or BT.601-6 625
  6196. @item smpte170m
  6197. SMPTE-170M or BT.601-6 525
  6198. @item smpte240m
  6199. SMPTE-240M
  6200. @item ycgco
  6201. YCgCo
  6202. @item bt2020ncl
  6203. BT.2020 with non-constant luminance
  6204. @end table
  6205. @anchor{trc}
  6206. @item trc
  6207. Specify output transfer characteristics.
  6208. The accepted values are:
  6209. @table @samp
  6210. @item bt709
  6211. BT.709
  6212. @item bt470m
  6213. BT.470M
  6214. @item bt470bg
  6215. BT.470BG
  6216. @item gamma22
  6217. Constant gamma of 2.2
  6218. @item gamma28
  6219. Constant gamma of 2.8
  6220. @item smpte170m
  6221. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6222. @item smpte240m
  6223. SMPTE-240M
  6224. @item srgb
  6225. SRGB
  6226. @item iec61966-2-1
  6227. iec61966-2-1
  6228. @item iec61966-2-4
  6229. iec61966-2-4
  6230. @item xvycc
  6231. xvycc
  6232. @item bt2020-10
  6233. BT.2020 for 10-bits content
  6234. @item bt2020-12
  6235. BT.2020 for 12-bits content
  6236. @end table
  6237. @anchor{primaries}
  6238. @item primaries
  6239. Specify output color primaries.
  6240. The accepted values are:
  6241. @table @samp
  6242. @item bt709
  6243. BT.709
  6244. @item bt470m
  6245. BT.470M
  6246. @item bt470bg
  6247. BT.470BG or BT.601-6 625
  6248. @item smpte170m
  6249. SMPTE-170M or BT.601-6 525
  6250. @item smpte240m
  6251. SMPTE-240M
  6252. @item film
  6253. film
  6254. @item smpte431
  6255. SMPTE-431
  6256. @item smpte432
  6257. SMPTE-432
  6258. @item bt2020
  6259. BT.2020
  6260. @item jedec-p22
  6261. JEDEC P22 phosphors
  6262. @end table
  6263. @anchor{range}
  6264. @item range
  6265. Specify output color range.
  6266. The accepted values are:
  6267. @table @samp
  6268. @item tv
  6269. TV (restricted) range
  6270. @item mpeg
  6271. MPEG (restricted) range
  6272. @item pc
  6273. PC (full) range
  6274. @item jpeg
  6275. JPEG (full) range
  6276. @end table
  6277. @item format
  6278. Specify output color format.
  6279. The accepted values are:
  6280. @table @samp
  6281. @item yuv420p
  6282. YUV 4:2:0 planar 8-bits
  6283. @item yuv420p10
  6284. YUV 4:2:0 planar 10-bits
  6285. @item yuv420p12
  6286. YUV 4:2:0 planar 12-bits
  6287. @item yuv422p
  6288. YUV 4:2:2 planar 8-bits
  6289. @item yuv422p10
  6290. YUV 4:2:2 planar 10-bits
  6291. @item yuv422p12
  6292. YUV 4:2:2 planar 12-bits
  6293. @item yuv444p
  6294. YUV 4:4:4 planar 8-bits
  6295. @item yuv444p10
  6296. YUV 4:4:4 planar 10-bits
  6297. @item yuv444p12
  6298. YUV 4:4:4 planar 12-bits
  6299. @end table
  6300. @item fast
  6301. Do a fast conversion, which skips gamma/primary correction. This will take
  6302. significantly less CPU, but will be mathematically incorrect. To get output
  6303. compatible with that produced by the colormatrix filter, use fast=1.
  6304. @item dither
  6305. Specify dithering mode.
  6306. The accepted values are:
  6307. @table @samp
  6308. @item none
  6309. No dithering
  6310. @item fsb
  6311. Floyd-Steinberg dithering
  6312. @end table
  6313. @item wpadapt
  6314. Whitepoint adaptation mode.
  6315. The accepted values are:
  6316. @table @samp
  6317. @item bradford
  6318. Bradford whitepoint adaptation
  6319. @item vonkries
  6320. von Kries whitepoint adaptation
  6321. @item identity
  6322. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6323. @end table
  6324. @item iall
  6325. Override all input properties at once. Same accepted values as @ref{all}.
  6326. @item ispace
  6327. Override input colorspace. Same accepted values as @ref{space}.
  6328. @item iprimaries
  6329. Override input color primaries. Same accepted values as @ref{primaries}.
  6330. @item itrc
  6331. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6332. @item irange
  6333. Override input color range. Same accepted values as @ref{range}.
  6334. @end table
  6335. The filter converts the transfer characteristics, color space and color
  6336. primaries to the specified user values. The output value, if not specified,
  6337. is set to a default value based on the "all" property. If that property is
  6338. also not specified, the filter will log an error. The output color range and
  6339. format default to the same value as the input color range and format. The
  6340. input transfer characteristics, color space, color primaries and color range
  6341. should be set on the input data. If any of these are missing, the filter will
  6342. log an error and no conversion will take place.
  6343. For example to convert the input to SMPTE-240M, use the command:
  6344. @example
  6345. colorspace=smpte240m
  6346. @end example
  6347. @section convolution
  6348. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6349. The filter accepts the following options:
  6350. @table @option
  6351. @item 0m
  6352. @item 1m
  6353. @item 2m
  6354. @item 3m
  6355. Set matrix for each plane.
  6356. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6357. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6358. @item 0rdiv
  6359. @item 1rdiv
  6360. @item 2rdiv
  6361. @item 3rdiv
  6362. Set multiplier for calculated value for each plane.
  6363. If unset or 0, it will be sum of all matrix elements.
  6364. @item 0bias
  6365. @item 1bias
  6366. @item 2bias
  6367. @item 3bias
  6368. Set bias for each plane. This value is added to the result of the multiplication.
  6369. Useful for making the overall image brighter or darker. Default is 0.0.
  6370. @item 0mode
  6371. @item 1mode
  6372. @item 2mode
  6373. @item 3mode
  6374. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6375. Default is @var{square}.
  6376. @end table
  6377. @subsection Examples
  6378. @itemize
  6379. @item
  6380. Apply sharpen:
  6381. @example
  6382. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  6383. @end example
  6384. @item
  6385. Apply blur:
  6386. @example
  6387. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  6388. @end example
  6389. @item
  6390. Apply edge enhance:
  6391. @example
  6392. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  6393. @end example
  6394. @item
  6395. Apply edge detect:
  6396. @example
  6397. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  6398. @end example
  6399. @item
  6400. Apply laplacian edge detector which includes diagonals:
  6401. @example
  6402. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  6403. @end example
  6404. @item
  6405. Apply emboss:
  6406. @example
  6407. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  6408. @end example
  6409. @end itemize
  6410. @section convolve
  6411. Apply 2D convolution of video stream in frequency domain using second stream
  6412. as impulse.
  6413. The filter accepts the following options:
  6414. @table @option
  6415. @item planes
  6416. Set which planes to process.
  6417. @item impulse
  6418. Set which impulse video frames will be processed, can be @var{first}
  6419. or @var{all}. Default is @var{all}.
  6420. @end table
  6421. The @code{convolve} filter also supports the @ref{framesync} options.
  6422. @section copy
  6423. Copy the input video source unchanged to the output. This is mainly useful for
  6424. testing purposes.
  6425. @anchor{coreimage}
  6426. @section coreimage
  6427. Video filtering on GPU using Apple's CoreImage API on OSX.
  6428. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6429. processed by video hardware. However, software-based OpenGL implementations
  6430. exist which means there is no guarantee for hardware processing. It depends on
  6431. the respective OSX.
  6432. There are many filters and image generators provided by Apple that come with a
  6433. large variety of options. The filter has to be referenced by its name along
  6434. with its options.
  6435. The coreimage filter accepts the following options:
  6436. @table @option
  6437. @item list_filters
  6438. List all available filters and generators along with all their respective
  6439. options as well as possible minimum and maximum values along with the default
  6440. values.
  6441. @example
  6442. list_filters=true
  6443. @end example
  6444. @item filter
  6445. Specify all filters by their respective name and options.
  6446. Use @var{list_filters} to determine all valid filter names and options.
  6447. Numerical options are specified by a float value and are automatically clamped
  6448. to their respective value range. Vector and color options have to be specified
  6449. by a list of space separated float values. Character escaping has to be done.
  6450. A special option name @code{default} is available to use default options for a
  6451. filter.
  6452. It is required to specify either @code{default} or at least one of the filter options.
  6453. All omitted options are used with their default values.
  6454. The syntax of the filter string is as follows:
  6455. @example
  6456. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6457. @end example
  6458. @item output_rect
  6459. Specify a rectangle where the output of the filter chain is copied into the
  6460. input image. It is given by a list of space separated float values:
  6461. @example
  6462. output_rect=x\ y\ width\ height
  6463. @end example
  6464. If not given, the output rectangle equals the dimensions of the input image.
  6465. The output rectangle is automatically cropped at the borders of the input
  6466. image. Negative values are valid for each component.
  6467. @example
  6468. output_rect=25\ 25\ 100\ 100
  6469. @end example
  6470. @end table
  6471. Several filters can be chained for successive processing without GPU-HOST
  6472. transfers allowing for fast processing of complex filter chains.
  6473. Currently, only filters with zero (generators) or exactly one (filters) input
  6474. image and one output image are supported. Also, transition filters are not yet
  6475. usable as intended.
  6476. Some filters generate output images with additional padding depending on the
  6477. respective filter kernel. The padding is automatically removed to ensure the
  6478. filter output has the same size as the input image.
  6479. For image generators, the size of the output image is determined by the
  6480. previous output image of the filter chain or the input image of the whole
  6481. filterchain, respectively. The generators do not use the pixel information of
  6482. this image to generate their output. However, the generated output is
  6483. blended onto this image, resulting in partial or complete coverage of the
  6484. output image.
  6485. The @ref{coreimagesrc} video source can be used for generating input images
  6486. which are directly fed into the filter chain. By using it, providing input
  6487. images by another video source or an input video is not required.
  6488. @subsection Examples
  6489. @itemize
  6490. @item
  6491. List all filters available:
  6492. @example
  6493. coreimage=list_filters=true
  6494. @end example
  6495. @item
  6496. Use the CIBoxBlur filter with default options to blur an image:
  6497. @example
  6498. coreimage=filter=CIBoxBlur@@default
  6499. @end example
  6500. @item
  6501. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6502. its center at 100x100 and a radius of 50 pixels:
  6503. @example
  6504. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6505. @end example
  6506. @item
  6507. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6508. given as complete and escaped command-line for Apple's standard bash shell:
  6509. @example
  6510. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6511. @end example
  6512. @end itemize
  6513. @section cover_rect
  6514. Cover a rectangular object
  6515. It accepts the following options:
  6516. @table @option
  6517. @item cover
  6518. Filepath of the optional cover image, needs to be in yuv420.
  6519. @item mode
  6520. Set covering mode.
  6521. It accepts the following values:
  6522. @table @samp
  6523. @item cover
  6524. cover it by the supplied image
  6525. @item blur
  6526. cover it by interpolating the surrounding pixels
  6527. @end table
  6528. Default value is @var{blur}.
  6529. @end table
  6530. @subsection Examples
  6531. @itemize
  6532. @item
  6533. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6534. @example
  6535. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6536. @end example
  6537. @end itemize
  6538. @section crop
  6539. Crop the input video to given dimensions.
  6540. It accepts the following parameters:
  6541. @table @option
  6542. @item w, out_w
  6543. The width of the output video. It defaults to @code{iw}.
  6544. This expression is evaluated only once during the filter
  6545. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6546. @item h, out_h
  6547. The height of the output video. It defaults to @code{ih}.
  6548. This expression is evaluated only once during the filter
  6549. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6550. @item x
  6551. The horizontal position, in the input video, of the left edge of the output
  6552. video. It defaults to @code{(in_w-out_w)/2}.
  6553. This expression is evaluated per-frame.
  6554. @item y
  6555. The vertical position, in the input video, of the top edge of the output video.
  6556. It defaults to @code{(in_h-out_h)/2}.
  6557. This expression is evaluated per-frame.
  6558. @item keep_aspect
  6559. If set to 1 will force the output display aspect ratio
  6560. to be the same of the input, by changing the output sample aspect
  6561. ratio. It defaults to 0.
  6562. @item exact
  6563. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6564. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6565. It defaults to 0.
  6566. @end table
  6567. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6568. expressions containing the following constants:
  6569. @table @option
  6570. @item x
  6571. @item y
  6572. The computed values for @var{x} and @var{y}. They are evaluated for
  6573. each new frame.
  6574. @item in_w
  6575. @item in_h
  6576. The input width and height.
  6577. @item iw
  6578. @item ih
  6579. These are the same as @var{in_w} and @var{in_h}.
  6580. @item out_w
  6581. @item out_h
  6582. The output (cropped) width and height.
  6583. @item ow
  6584. @item oh
  6585. These are the same as @var{out_w} and @var{out_h}.
  6586. @item a
  6587. same as @var{iw} / @var{ih}
  6588. @item sar
  6589. input sample aspect ratio
  6590. @item dar
  6591. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6592. @item hsub
  6593. @item vsub
  6594. horizontal and vertical chroma subsample values. For example for the
  6595. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6596. @item n
  6597. The number of the input frame, starting from 0.
  6598. @item pos
  6599. the position in the file of the input frame, NAN if unknown
  6600. @item t
  6601. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6602. @end table
  6603. The expression for @var{out_w} may depend on the value of @var{out_h},
  6604. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6605. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6606. evaluated after @var{out_w} and @var{out_h}.
  6607. The @var{x} and @var{y} parameters specify the expressions for the
  6608. position of the top-left corner of the output (non-cropped) area. They
  6609. are evaluated for each frame. If the evaluated value is not valid, it
  6610. is approximated to the nearest valid value.
  6611. The expression for @var{x} may depend on @var{y}, and the expression
  6612. for @var{y} may depend on @var{x}.
  6613. @subsection Examples
  6614. @itemize
  6615. @item
  6616. Crop area with size 100x100 at position (12,34).
  6617. @example
  6618. crop=100:100:12:34
  6619. @end example
  6620. Using named options, the example above becomes:
  6621. @example
  6622. crop=w=100:h=100:x=12:y=34
  6623. @end example
  6624. @item
  6625. Crop the central input area with size 100x100:
  6626. @example
  6627. crop=100:100
  6628. @end example
  6629. @item
  6630. Crop the central input area with size 2/3 of the input video:
  6631. @example
  6632. crop=2/3*in_w:2/3*in_h
  6633. @end example
  6634. @item
  6635. Crop the input video central square:
  6636. @example
  6637. crop=out_w=in_h
  6638. crop=in_h
  6639. @end example
  6640. @item
  6641. Delimit the rectangle with the top-left corner placed at position
  6642. 100:100 and the right-bottom corner corresponding to the right-bottom
  6643. corner of the input image.
  6644. @example
  6645. crop=in_w-100:in_h-100:100:100
  6646. @end example
  6647. @item
  6648. Crop 10 pixels from the left and right borders, and 20 pixels from
  6649. the top and bottom borders
  6650. @example
  6651. crop=in_w-2*10:in_h-2*20
  6652. @end example
  6653. @item
  6654. Keep only the bottom right quarter of the input image:
  6655. @example
  6656. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6657. @end example
  6658. @item
  6659. Crop height for getting Greek harmony:
  6660. @example
  6661. crop=in_w:1/PHI*in_w
  6662. @end example
  6663. @item
  6664. Apply trembling effect:
  6665. @example
  6666. 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)
  6667. @end example
  6668. @item
  6669. Apply erratic camera effect depending on timestamp:
  6670. @example
  6671. 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)"
  6672. @end example
  6673. @item
  6674. Set x depending on the value of y:
  6675. @example
  6676. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6677. @end example
  6678. @end itemize
  6679. @subsection Commands
  6680. This filter supports the following commands:
  6681. @table @option
  6682. @item w, out_w
  6683. @item h, out_h
  6684. @item x
  6685. @item y
  6686. Set width/height of the output video and the horizontal/vertical position
  6687. in the input video.
  6688. The command accepts the same syntax of the corresponding option.
  6689. If the specified expression is not valid, it is kept at its current
  6690. value.
  6691. @end table
  6692. @section cropdetect
  6693. Auto-detect the crop size.
  6694. It calculates the necessary cropping parameters and prints the
  6695. recommended parameters via the logging system. The detected dimensions
  6696. correspond to the non-black area of the input video.
  6697. It accepts the following parameters:
  6698. @table @option
  6699. @item limit
  6700. Set higher black value threshold, which can be optionally specified
  6701. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6702. value greater to the set value is considered non-black. It defaults to 24.
  6703. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6704. on the bitdepth of the pixel format.
  6705. @item round
  6706. The value which the width/height should be divisible by. It defaults to
  6707. 16. The offset is automatically adjusted to center the video. Use 2 to
  6708. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6709. encoding to most video codecs.
  6710. @item reset_count, reset
  6711. Set the counter that determines after how many frames cropdetect will
  6712. reset the previously detected largest video area and start over to
  6713. detect the current optimal crop area. Default value is 0.
  6714. This can be useful when channel logos distort the video area. 0
  6715. indicates 'never reset', and returns the largest area encountered during
  6716. playback.
  6717. @end table
  6718. @anchor{cue}
  6719. @section cue
  6720. Delay video filtering until a given wallclock timestamp. The filter first
  6721. passes on @option{preroll} amount of frames, then it buffers at most
  6722. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6723. it forwards the buffered frames and also any subsequent frames coming in its
  6724. input.
  6725. The filter can be used synchronize the output of multiple ffmpeg processes for
  6726. realtime output devices like decklink. By putting the delay in the filtering
  6727. chain and pre-buffering frames the process can pass on data to output almost
  6728. immediately after the target wallclock timestamp is reached.
  6729. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6730. some use cases.
  6731. @table @option
  6732. @item cue
  6733. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6734. @item preroll
  6735. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6736. @item buffer
  6737. The maximum duration of content to buffer before waiting for the cue expressed
  6738. in seconds. Default is 0.
  6739. @end table
  6740. @anchor{curves}
  6741. @section curves
  6742. Apply color adjustments using curves.
  6743. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6744. component (red, green and blue) has its values defined by @var{N} key points
  6745. tied from each other using a smooth curve. The x-axis represents the pixel
  6746. values from the input frame, and the y-axis the new pixel values to be set for
  6747. the output frame.
  6748. By default, a component curve is defined by the two points @var{(0;0)} and
  6749. @var{(1;1)}. This creates a straight line where each original pixel value is
  6750. "adjusted" to its own value, which means no change to the image.
  6751. The filter allows you to redefine these two points and add some more. A new
  6752. curve (using a natural cubic spline interpolation) will be define to pass
  6753. smoothly through all these new coordinates. The new defined points needs to be
  6754. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6755. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6756. the vector spaces, the values will be clipped accordingly.
  6757. The filter accepts the following options:
  6758. @table @option
  6759. @item preset
  6760. Select one of the available color presets. This option can be used in addition
  6761. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6762. options takes priority on the preset values.
  6763. Available presets are:
  6764. @table @samp
  6765. @item none
  6766. @item color_negative
  6767. @item cross_process
  6768. @item darker
  6769. @item increase_contrast
  6770. @item lighter
  6771. @item linear_contrast
  6772. @item medium_contrast
  6773. @item negative
  6774. @item strong_contrast
  6775. @item vintage
  6776. @end table
  6777. Default is @code{none}.
  6778. @item master, m
  6779. Set the master key points. These points will define a second pass mapping. It
  6780. is sometimes called a "luminance" or "value" mapping. It can be used with
  6781. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6782. post-processing LUT.
  6783. @item red, r
  6784. Set the key points for the red component.
  6785. @item green, g
  6786. Set the key points for the green component.
  6787. @item blue, b
  6788. Set the key points for the blue component.
  6789. @item all
  6790. Set the key points for all components (not including master).
  6791. Can be used in addition to the other key points component
  6792. options. In this case, the unset component(s) will fallback on this
  6793. @option{all} setting.
  6794. @item psfile
  6795. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6796. @item plot
  6797. Save Gnuplot script of the curves in specified file.
  6798. @end table
  6799. To avoid some filtergraph syntax conflicts, each key points list need to be
  6800. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6801. @subsection Examples
  6802. @itemize
  6803. @item
  6804. Increase slightly the middle level of blue:
  6805. @example
  6806. curves=blue='0/0 0.5/0.58 1/1'
  6807. @end example
  6808. @item
  6809. Vintage effect:
  6810. @example
  6811. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  6812. @end example
  6813. Here we obtain the following coordinates for each components:
  6814. @table @var
  6815. @item red
  6816. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6817. @item green
  6818. @code{(0;0) (0.50;0.48) (1;1)}
  6819. @item blue
  6820. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6821. @end table
  6822. @item
  6823. The previous example can also be achieved with the associated built-in preset:
  6824. @example
  6825. curves=preset=vintage
  6826. @end example
  6827. @item
  6828. Or simply:
  6829. @example
  6830. curves=vintage
  6831. @end example
  6832. @item
  6833. Use a Photoshop preset and redefine the points of the green component:
  6834. @example
  6835. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6836. @end example
  6837. @item
  6838. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6839. and @command{gnuplot}:
  6840. @example
  6841. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6842. gnuplot -p /tmp/curves.plt
  6843. @end example
  6844. @end itemize
  6845. @section datascope
  6846. Video data analysis filter.
  6847. This filter shows hexadecimal pixel values of part of video.
  6848. The filter accepts the following options:
  6849. @table @option
  6850. @item size, s
  6851. Set output video size.
  6852. @item x
  6853. Set x offset from where to pick pixels.
  6854. @item y
  6855. Set y offset from where to pick pixels.
  6856. @item mode
  6857. Set scope mode, can be one of the following:
  6858. @table @samp
  6859. @item mono
  6860. Draw hexadecimal pixel values with white color on black background.
  6861. @item color
  6862. Draw hexadecimal pixel values with input video pixel color on black
  6863. background.
  6864. @item color2
  6865. Draw hexadecimal pixel values on color background picked from input video,
  6866. the text color is picked in such way so its always visible.
  6867. @end table
  6868. @item axis
  6869. Draw rows and columns numbers on left and top of video.
  6870. @item opacity
  6871. Set background opacity.
  6872. @item format
  6873. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6874. @end table
  6875. @section dblur
  6876. Apply Directional blur filter.
  6877. The filter accepts the following options:
  6878. @table @option
  6879. @item angle
  6880. Set angle of directional blur. Default is @code{45}.
  6881. @item radius
  6882. Set radius of directional blur. Default is @code{5}.
  6883. @item planes
  6884. Set which planes to filter. By default all planes are filtered.
  6885. @end table
  6886. @subsection Commands
  6887. This filter supports same @ref{commands} as options.
  6888. The command accepts the same syntax of the corresponding option.
  6889. If the specified expression is not valid, it is kept at its current
  6890. value.
  6891. @section dctdnoiz
  6892. Denoise frames using 2D DCT (frequency domain filtering).
  6893. This filter is not designed for real time.
  6894. The filter accepts the following options:
  6895. @table @option
  6896. @item sigma, s
  6897. Set the noise sigma constant.
  6898. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6899. coefficient (absolute value) below this threshold with be dropped.
  6900. If you need a more advanced filtering, see @option{expr}.
  6901. Default is @code{0}.
  6902. @item overlap
  6903. Set number overlapping pixels for each block. Since the filter can be slow, you
  6904. may want to reduce this value, at the cost of a less effective filter and the
  6905. risk of various artefacts.
  6906. If the overlapping value doesn't permit processing the whole input width or
  6907. height, a warning will be displayed and according borders won't be denoised.
  6908. Default value is @var{blocksize}-1, which is the best possible setting.
  6909. @item expr, e
  6910. Set the coefficient factor expression.
  6911. For each coefficient of a DCT block, this expression will be evaluated as a
  6912. multiplier value for the coefficient.
  6913. If this is option is set, the @option{sigma} option will be ignored.
  6914. The absolute value of the coefficient can be accessed through the @var{c}
  6915. variable.
  6916. @item n
  6917. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6918. @var{blocksize}, which is the width and height of the processed blocks.
  6919. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6920. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6921. on the speed processing. Also, a larger block size does not necessarily means a
  6922. better de-noising.
  6923. @end table
  6924. @subsection Examples
  6925. Apply a denoise with a @option{sigma} of @code{4.5}:
  6926. @example
  6927. dctdnoiz=4.5
  6928. @end example
  6929. The same operation can be achieved using the expression system:
  6930. @example
  6931. dctdnoiz=e='gte(c, 4.5*3)'
  6932. @end example
  6933. Violent denoise using a block size of @code{16x16}:
  6934. @example
  6935. dctdnoiz=15:n=4
  6936. @end example
  6937. @section deband
  6938. Remove banding artifacts from input video.
  6939. It works by replacing banded pixels with average value of referenced pixels.
  6940. The filter accepts the following options:
  6941. @table @option
  6942. @item 1thr
  6943. @item 2thr
  6944. @item 3thr
  6945. @item 4thr
  6946. Set banding detection threshold for each plane. Default is 0.02.
  6947. Valid range is 0.00003 to 0.5.
  6948. If difference between current pixel and reference pixel is less than threshold,
  6949. it will be considered as banded.
  6950. @item range, r
  6951. Banding detection range in pixels. Default is 16. If positive, random number
  6952. in range 0 to set value will be used. If negative, exact absolute value
  6953. will be used.
  6954. The range defines square of four pixels around current pixel.
  6955. @item direction, d
  6956. Set direction in radians from which four pixel will be compared. If positive,
  6957. random direction from 0 to set direction will be picked. If negative, exact of
  6958. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6959. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6960. column.
  6961. @item blur, b
  6962. If enabled, current pixel is compared with average value of all four
  6963. surrounding pixels. The default is enabled. If disabled current pixel is
  6964. compared with all four surrounding pixels. The pixel is considered banded
  6965. if only all four differences with surrounding pixels are less than threshold.
  6966. @item coupling, c
  6967. If enabled, current pixel is changed if and only if all pixel components are banded,
  6968. e.g. banding detection threshold is triggered for all color components.
  6969. The default is disabled.
  6970. @end table
  6971. @section deblock
  6972. Remove blocking artifacts from input video.
  6973. The filter accepts the following options:
  6974. @table @option
  6975. @item filter
  6976. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6977. This controls what kind of deblocking is applied.
  6978. @item block
  6979. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6980. @item alpha
  6981. @item beta
  6982. @item gamma
  6983. @item delta
  6984. Set blocking detection thresholds. Allowed range is 0 to 1.
  6985. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6986. Using higher threshold gives more deblocking strength.
  6987. Setting @var{alpha} controls threshold detection at exact edge of block.
  6988. Remaining options controls threshold detection near the edge. Each one for
  6989. below/above or left/right. Setting any of those to @var{0} disables
  6990. deblocking.
  6991. @item planes
  6992. Set planes to filter. Default is to filter all available planes.
  6993. @end table
  6994. @subsection Examples
  6995. @itemize
  6996. @item
  6997. Deblock using weak filter and block size of 4 pixels.
  6998. @example
  6999. deblock=filter=weak:block=4
  7000. @end example
  7001. @item
  7002. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7003. deblocking more edges.
  7004. @example
  7005. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7006. @end example
  7007. @item
  7008. Similar as above, but filter only first plane.
  7009. @example
  7010. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7011. @end example
  7012. @item
  7013. Similar as above, but filter only second and third plane.
  7014. @example
  7015. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7016. @end example
  7017. @end itemize
  7018. @anchor{decimate}
  7019. @section decimate
  7020. Drop duplicated frames at regular intervals.
  7021. The filter accepts the following options:
  7022. @table @option
  7023. @item cycle
  7024. Set the number of frames from which one will be dropped. Setting this to
  7025. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7026. Default is @code{5}.
  7027. @item dupthresh
  7028. Set the threshold for duplicate detection. If the difference metric for a frame
  7029. is less than or equal to this value, then it is declared as duplicate. Default
  7030. is @code{1.1}
  7031. @item scthresh
  7032. Set scene change threshold. Default is @code{15}.
  7033. @item blockx
  7034. @item blocky
  7035. Set the size of the x and y-axis blocks used during metric calculations.
  7036. Larger blocks give better noise suppression, but also give worse detection of
  7037. small movements. Must be a power of two. Default is @code{32}.
  7038. @item ppsrc
  7039. Mark main input as a pre-processed input and activate clean source input
  7040. stream. This allows the input to be pre-processed with various filters to help
  7041. the metrics calculation while keeping the frame selection lossless. When set to
  7042. @code{1}, the first stream is for the pre-processed input, and the second
  7043. stream is the clean source from where the kept frames are chosen. Default is
  7044. @code{0}.
  7045. @item chroma
  7046. Set whether or not chroma is considered in the metric calculations. Default is
  7047. @code{1}.
  7048. @end table
  7049. @section deconvolve
  7050. Apply 2D deconvolution of video stream in frequency domain using second stream
  7051. as impulse.
  7052. The filter accepts the following options:
  7053. @table @option
  7054. @item planes
  7055. Set which planes to process.
  7056. @item impulse
  7057. Set which impulse video frames will be processed, can be @var{first}
  7058. or @var{all}. Default is @var{all}.
  7059. @item noise
  7060. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7061. and height are not same and not power of 2 or if stream prior to convolving
  7062. had noise.
  7063. @end table
  7064. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7065. @section dedot
  7066. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7067. It accepts the following options:
  7068. @table @option
  7069. @item m
  7070. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7071. @var{rainbows} for cross-color reduction.
  7072. @item lt
  7073. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7074. @item tl
  7075. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7076. @item tc
  7077. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7078. @item ct
  7079. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7080. @end table
  7081. @section deflate
  7082. Apply deflate effect to the video.
  7083. This filter replaces the pixel by the local(3x3) average by taking into account
  7084. only values lower than the pixel.
  7085. It accepts the following options:
  7086. @table @option
  7087. @item threshold0
  7088. @item threshold1
  7089. @item threshold2
  7090. @item threshold3
  7091. Limit the maximum change for each plane, default is 65535.
  7092. If 0, plane will remain unchanged.
  7093. @end table
  7094. @subsection Commands
  7095. This filter supports the all above options as @ref{commands}.
  7096. @section deflicker
  7097. Remove temporal frame luminance variations.
  7098. It accepts the following options:
  7099. @table @option
  7100. @item size, s
  7101. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7102. @item mode, m
  7103. Set averaging mode to smooth temporal luminance variations.
  7104. Available values are:
  7105. @table @samp
  7106. @item am
  7107. Arithmetic mean
  7108. @item gm
  7109. Geometric mean
  7110. @item hm
  7111. Harmonic mean
  7112. @item qm
  7113. Quadratic mean
  7114. @item cm
  7115. Cubic mean
  7116. @item pm
  7117. Power mean
  7118. @item median
  7119. Median
  7120. @end table
  7121. @item bypass
  7122. Do not actually modify frame. Useful when one only wants metadata.
  7123. @end table
  7124. @section dejudder
  7125. Remove judder produced by partially interlaced telecined content.
  7126. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7127. source was partially telecined content then the output of @code{pullup,dejudder}
  7128. will have a variable frame rate. May change the recorded frame rate of the
  7129. container. Aside from that change, this filter will not affect constant frame
  7130. rate video.
  7131. The option available in this filter is:
  7132. @table @option
  7133. @item cycle
  7134. Specify the length of the window over which the judder repeats.
  7135. Accepts any integer greater than 1. Useful values are:
  7136. @table @samp
  7137. @item 4
  7138. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7139. @item 5
  7140. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7141. @item 20
  7142. If a mixture of the two.
  7143. @end table
  7144. The default is @samp{4}.
  7145. @end table
  7146. @section delogo
  7147. Suppress a TV station logo by a simple interpolation of the surrounding
  7148. pixels. Just set a rectangle covering the logo and watch it disappear
  7149. (and sometimes something even uglier appear - your mileage may vary).
  7150. It accepts the following parameters:
  7151. @table @option
  7152. @item x
  7153. @item y
  7154. Specify the top left corner coordinates of the logo. They must be
  7155. specified.
  7156. @item w
  7157. @item h
  7158. Specify the width and height of the logo to clear. They must be
  7159. specified.
  7160. @item band, t
  7161. Specify the thickness of the fuzzy edge of the rectangle (added to
  7162. @var{w} and @var{h}). The default value is 1. This option is
  7163. deprecated, setting higher values should no longer be necessary and
  7164. is not recommended.
  7165. @item show
  7166. When set to 1, a green rectangle is drawn on the screen to simplify
  7167. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7168. The default value is 0.
  7169. The rectangle is drawn on the outermost pixels which will be (partly)
  7170. replaced with interpolated values. The values of the next pixels
  7171. immediately outside this rectangle in each direction will be used to
  7172. compute the interpolated pixel values inside the rectangle.
  7173. @end table
  7174. @subsection Examples
  7175. @itemize
  7176. @item
  7177. Set a rectangle covering the area with top left corner coordinates 0,0
  7178. and size 100x77, and a band of size 10:
  7179. @example
  7180. delogo=x=0:y=0:w=100:h=77:band=10
  7181. @end example
  7182. @end itemize
  7183. @anchor{derain}
  7184. @section derain
  7185. Remove the rain in the input image/video by applying the derain methods based on
  7186. convolutional neural networks. Supported models:
  7187. @itemize
  7188. @item
  7189. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7190. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7191. @end itemize
  7192. Training as well as model generation scripts are provided in
  7193. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7194. Native model files (.model) can be generated from TensorFlow model
  7195. files (.pb) by using tools/python/convert.py
  7196. The filter accepts the following options:
  7197. @table @option
  7198. @item filter_type
  7199. Specify which filter to use. This option accepts the following values:
  7200. @table @samp
  7201. @item derain
  7202. Derain filter. To conduct derain filter, you need to use a derain model.
  7203. @item dehaze
  7204. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7205. @end table
  7206. Default value is @samp{derain}.
  7207. @item dnn_backend
  7208. Specify which DNN backend to use for model loading and execution. This option accepts
  7209. the following values:
  7210. @table @samp
  7211. @item native
  7212. Native implementation of DNN loading and execution.
  7213. @item tensorflow
  7214. TensorFlow backend. To enable this backend you
  7215. need to install the TensorFlow for C library (see
  7216. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7217. @code{--enable-libtensorflow}
  7218. @end table
  7219. Default value is @samp{native}.
  7220. @item model
  7221. Set path to model file specifying network architecture and its parameters.
  7222. Note that different backends use different file formats. TensorFlow and native
  7223. backend can load files for only its format.
  7224. @end table
  7225. It can also be finished with @ref{dnn_processing} filter.
  7226. @section deshake
  7227. Attempt to fix small changes in horizontal and/or vertical shift. This
  7228. filter helps remove camera shake from hand-holding a camera, bumping a
  7229. tripod, moving on a vehicle, etc.
  7230. The filter accepts the following options:
  7231. @table @option
  7232. @item x
  7233. @item y
  7234. @item w
  7235. @item h
  7236. Specify a rectangular area where to limit the search for motion
  7237. vectors.
  7238. If desired the search for motion vectors can be limited to a
  7239. rectangular area of the frame defined by its top left corner, width
  7240. and height. These parameters have the same meaning as the drawbox
  7241. filter which can be used to visualise the position of the bounding
  7242. box.
  7243. This is useful when simultaneous movement of subjects within the frame
  7244. might be confused for camera motion by the motion vector search.
  7245. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7246. then the full frame is used. This allows later options to be set
  7247. without specifying the bounding box for the motion vector search.
  7248. Default - search the whole frame.
  7249. @item rx
  7250. @item ry
  7251. Specify the maximum extent of movement in x and y directions in the
  7252. range 0-64 pixels. Default 16.
  7253. @item edge
  7254. Specify how to generate pixels to fill blanks at the edge of the
  7255. frame. Available values are:
  7256. @table @samp
  7257. @item blank, 0
  7258. Fill zeroes at blank locations
  7259. @item original, 1
  7260. Original image at blank locations
  7261. @item clamp, 2
  7262. Extruded edge value at blank locations
  7263. @item mirror, 3
  7264. Mirrored edge at blank locations
  7265. @end table
  7266. Default value is @samp{mirror}.
  7267. @item blocksize
  7268. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7269. default 8.
  7270. @item contrast
  7271. Specify the contrast threshold for blocks. Only blocks with more than
  7272. the specified contrast (difference between darkest and lightest
  7273. pixels) will be considered. Range 1-255, default 125.
  7274. @item search
  7275. Specify the search strategy. Available values are:
  7276. @table @samp
  7277. @item exhaustive, 0
  7278. Set exhaustive search
  7279. @item less, 1
  7280. Set less exhaustive search.
  7281. @end table
  7282. Default value is @samp{exhaustive}.
  7283. @item filename
  7284. If set then a detailed log of the motion search is written to the
  7285. specified file.
  7286. @end table
  7287. @section despill
  7288. Remove unwanted contamination of foreground colors, caused by reflected color of
  7289. greenscreen or bluescreen.
  7290. This filter accepts the following options:
  7291. @table @option
  7292. @item type
  7293. Set what type of despill to use.
  7294. @item mix
  7295. Set how spillmap will be generated.
  7296. @item expand
  7297. Set how much to get rid of still remaining spill.
  7298. @item red
  7299. Controls amount of red in spill area.
  7300. @item green
  7301. Controls amount of green in spill area.
  7302. Should be -1 for greenscreen.
  7303. @item blue
  7304. Controls amount of blue in spill area.
  7305. Should be -1 for bluescreen.
  7306. @item brightness
  7307. Controls brightness of spill area, preserving colors.
  7308. @item alpha
  7309. Modify alpha from generated spillmap.
  7310. @end table
  7311. @subsection Commands
  7312. This filter supports the all above options as @ref{commands}.
  7313. @section detelecine
  7314. Apply an exact inverse of the telecine operation. It requires a predefined
  7315. pattern specified using the pattern option which must be the same as that passed
  7316. to the telecine filter.
  7317. This filter accepts the following options:
  7318. @table @option
  7319. @item first_field
  7320. @table @samp
  7321. @item top, t
  7322. top field first
  7323. @item bottom, b
  7324. bottom field first
  7325. The default value is @code{top}.
  7326. @end table
  7327. @item pattern
  7328. A string of numbers representing the pulldown pattern you wish to apply.
  7329. The default value is @code{23}.
  7330. @item start_frame
  7331. A number representing position of the first frame with respect to the telecine
  7332. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7333. @end table
  7334. @section dilation
  7335. Apply dilation effect to the video.
  7336. This filter replaces the pixel by the local(3x3) maximum.
  7337. It accepts the following options:
  7338. @table @option
  7339. @item threshold0
  7340. @item threshold1
  7341. @item threshold2
  7342. @item threshold3
  7343. Limit the maximum change for each plane, default is 65535.
  7344. If 0, plane will remain unchanged.
  7345. @item coordinates
  7346. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7347. pixels are used.
  7348. Flags to local 3x3 coordinates maps like this:
  7349. 1 2 3
  7350. 4 5
  7351. 6 7 8
  7352. @end table
  7353. @subsection Commands
  7354. This filter supports the all above options as @ref{commands}.
  7355. @section displace
  7356. Displace pixels as indicated by second and third input stream.
  7357. It takes three input streams and outputs one stream, the first input is the
  7358. source, and second and third input are displacement maps.
  7359. The second input specifies how much to displace pixels along the
  7360. x-axis, while the third input specifies how much to displace pixels
  7361. along the y-axis.
  7362. If one of displacement map streams terminates, last frame from that
  7363. displacement map will be used.
  7364. Note that once generated, displacements maps can be reused over and over again.
  7365. A description of the accepted options follows.
  7366. @table @option
  7367. @item edge
  7368. Set displace behavior for pixels that are out of range.
  7369. Available values are:
  7370. @table @samp
  7371. @item blank
  7372. Missing pixels are replaced by black pixels.
  7373. @item smear
  7374. Adjacent pixels will spread out to replace missing pixels.
  7375. @item wrap
  7376. Out of range pixels are wrapped so they point to pixels of other side.
  7377. @item mirror
  7378. Out of range pixels will be replaced with mirrored pixels.
  7379. @end table
  7380. Default is @samp{smear}.
  7381. @end table
  7382. @subsection Examples
  7383. @itemize
  7384. @item
  7385. Add ripple effect to rgb input of video size hd720:
  7386. @example
  7387. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  7388. @end example
  7389. @item
  7390. Add wave effect to rgb input of video size hd720:
  7391. @example
  7392. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  7393. @end example
  7394. @end itemize
  7395. @anchor{dnn_processing}
  7396. @section dnn_processing
  7397. Do image processing with deep neural networks. It works together with another filter
  7398. which converts the pixel format of the Frame to what the dnn network requires.
  7399. The filter accepts the following options:
  7400. @table @option
  7401. @item dnn_backend
  7402. Specify which DNN backend to use for model loading and execution. This option accepts
  7403. the following values:
  7404. @table @samp
  7405. @item native
  7406. Native implementation of DNN loading and execution.
  7407. @item tensorflow
  7408. TensorFlow backend. To enable this backend you
  7409. need to install the TensorFlow for C library (see
  7410. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7411. @code{--enable-libtensorflow}
  7412. @item openvino
  7413. OpenVINO backend. To enable this backend you
  7414. need to build and install the OpenVINO for C library (see
  7415. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7416. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7417. be needed if the header files and libraries are not installed into system path)
  7418. @end table
  7419. Default value is @samp{native}.
  7420. @item model
  7421. Set path to model file specifying network architecture and its parameters.
  7422. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7423. backend can load files for only its format.
  7424. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7425. @item input
  7426. Set the input name of the dnn network.
  7427. @item output
  7428. Set the output name of the dnn network.
  7429. @end table
  7430. @subsection Examples
  7431. @itemize
  7432. @item
  7433. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7434. @example
  7435. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7436. @end example
  7437. @item
  7438. Halve the pixel value of the frame with format gray32f:
  7439. @example
  7440. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7441. @end example
  7442. @item
  7443. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7444. @example
  7445. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7446. @end example
  7447. @item
  7448. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7449. @example
  7450. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7451. @end example
  7452. @end itemize
  7453. @section drawbox
  7454. Draw a colored box on the input image.
  7455. It accepts the following parameters:
  7456. @table @option
  7457. @item x
  7458. @item y
  7459. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7460. @item width, w
  7461. @item height, h
  7462. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7463. the input width and height. It defaults to 0.
  7464. @item color, c
  7465. Specify the color of the box to write. For the general syntax of this option,
  7466. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7467. value @code{invert} is used, the box edge color is the same as the
  7468. video with inverted luma.
  7469. @item thickness, t
  7470. The expression which sets the thickness of the box edge.
  7471. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7472. See below for the list of accepted constants.
  7473. @item replace
  7474. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7475. will overwrite the video's color and alpha pixels.
  7476. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7477. @end table
  7478. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7479. following constants:
  7480. @table @option
  7481. @item dar
  7482. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7483. @item hsub
  7484. @item vsub
  7485. horizontal and vertical chroma subsample values. For example for the
  7486. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7487. @item in_h, ih
  7488. @item in_w, iw
  7489. The input width and height.
  7490. @item sar
  7491. The input sample aspect ratio.
  7492. @item x
  7493. @item y
  7494. The x and y offset coordinates where the box is drawn.
  7495. @item w
  7496. @item h
  7497. The width and height of the drawn box.
  7498. @item t
  7499. The thickness of the drawn box.
  7500. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7501. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7502. @end table
  7503. @subsection Examples
  7504. @itemize
  7505. @item
  7506. Draw a black box around the edge of the input image:
  7507. @example
  7508. drawbox
  7509. @end example
  7510. @item
  7511. Draw a box with color red and an opacity of 50%:
  7512. @example
  7513. drawbox=10:20:200:60:red@@0.5
  7514. @end example
  7515. The previous example can be specified as:
  7516. @example
  7517. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7518. @end example
  7519. @item
  7520. Fill the box with pink color:
  7521. @example
  7522. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7523. @end example
  7524. @item
  7525. Draw a 2-pixel red 2.40:1 mask:
  7526. @example
  7527. 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
  7528. @end example
  7529. @end itemize
  7530. @subsection Commands
  7531. This filter supports same commands as options.
  7532. The command accepts the same syntax of the corresponding option.
  7533. If the specified expression is not valid, it is kept at its current
  7534. value.
  7535. @anchor{drawgraph}
  7536. @section drawgraph
  7537. Draw a graph using input video metadata.
  7538. It accepts the following parameters:
  7539. @table @option
  7540. @item m1
  7541. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7542. @item fg1
  7543. Set 1st foreground color expression.
  7544. @item m2
  7545. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7546. @item fg2
  7547. Set 2nd foreground color expression.
  7548. @item m3
  7549. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7550. @item fg3
  7551. Set 3rd foreground color expression.
  7552. @item m4
  7553. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7554. @item fg4
  7555. Set 4th foreground color expression.
  7556. @item min
  7557. Set minimal value of metadata value.
  7558. @item max
  7559. Set maximal value of metadata value.
  7560. @item bg
  7561. Set graph background color. Default is white.
  7562. @item mode
  7563. Set graph mode.
  7564. Available values for mode is:
  7565. @table @samp
  7566. @item bar
  7567. @item dot
  7568. @item line
  7569. @end table
  7570. Default is @code{line}.
  7571. @item slide
  7572. Set slide mode.
  7573. Available values for slide is:
  7574. @table @samp
  7575. @item frame
  7576. Draw new frame when right border is reached.
  7577. @item replace
  7578. Replace old columns with new ones.
  7579. @item scroll
  7580. Scroll from right to left.
  7581. @item rscroll
  7582. Scroll from left to right.
  7583. @item picture
  7584. Draw single picture.
  7585. @end table
  7586. Default is @code{frame}.
  7587. @item size
  7588. Set size of graph video. For the syntax of this option, check the
  7589. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7590. The default value is @code{900x256}.
  7591. @item rate, r
  7592. Set the output frame rate. Default value is @code{25}.
  7593. The foreground color expressions can use the following variables:
  7594. @table @option
  7595. @item MIN
  7596. Minimal value of metadata value.
  7597. @item MAX
  7598. Maximal value of metadata value.
  7599. @item VAL
  7600. Current metadata key value.
  7601. @end table
  7602. The color is defined as 0xAABBGGRR.
  7603. @end table
  7604. Example using metadata from @ref{signalstats} filter:
  7605. @example
  7606. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7607. @end example
  7608. Example using metadata from @ref{ebur128} filter:
  7609. @example
  7610. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7611. @end example
  7612. @section drawgrid
  7613. Draw a grid on the input image.
  7614. It accepts the following parameters:
  7615. @table @option
  7616. @item x
  7617. @item y
  7618. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7619. @item width, w
  7620. @item height, h
  7621. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7622. input width and height, respectively, minus @code{thickness}, so image gets
  7623. framed. Default to 0.
  7624. @item color, c
  7625. Specify the color of the grid. For the general syntax of this option,
  7626. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7627. value @code{invert} is used, the grid color is the same as the
  7628. video with inverted luma.
  7629. @item thickness, t
  7630. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7631. See below for the list of accepted constants.
  7632. @item replace
  7633. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7634. will overwrite the video's color and alpha pixels.
  7635. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7636. @end table
  7637. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7638. following constants:
  7639. @table @option
  7640. @item dar
  7641. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7642. @item hsub
  7643. @item vsub
  7644. horizontal and vertical chroma subsample values. For example for the
  7645. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7646. @item in_h, ih
  7647. @item in_w, iw
  7648. The input grid cell width and height.
  7649. @item sar
  7650. The input sample aspect ratio.
  7651. @item x
  7652. @item y
  7653. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7654. @item w
  7655. @item h
  7656. The width and height of the drawn cell.
  7657. @item t
  7658. The thickness of the drawn cell.
  7659. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7660. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7661. @end table
  7662. @subsection Examples
  7663. @itemize
  7664. @item
  7665. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7666. @example
  7667. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7668. @end example
  7669. @item
  7670. Draw a white 3x3 grid with an opacity of 50%:
  7671. @example
  7672. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7673. @end example
  7674. @end itemize
  7675. @subsection Commands
  7676. This filter supports same commands as options.
  7677. The command accepts the same syntax of the corresponding option.
  7678. If the specified expression is not valid, it is kept at its current
  7679. value.
  7680. @anchor{drawtext}
  7681. @section drawtext
  7682. Draw a text string or text from a specified file on top of a video, using the
  7683. libfreetype library.
  7684. To enable compilation of this filter, you need to configure FFmpeg with
  7685. @code{--enable-libfreetype}.
  7686. To enable default font fallback and the @var{font} option you need to
  7687. configure FFmpeg with @code{--enable-libfontconfig}.
  7688. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7689. @code{--enable-libfribidi}.
  7690. @subsection Syntax
  7691. It accepts the following parameters:
  7692. @table @option
  7693. @item box
  7694. Used to draw a box around text using the background color.
  7695. The value must be either 1 (enable) or 0 (disable).
  7696. The default value of @var{box} is 0.
  7697. @item boxborderw
  7698. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7699. The default value of @var{boxborderw} is 0.
  7700. @item boxcolor
  7701. The color to be used for drawing box around text. For the syntax of this
  7702. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7703. The default value of @var{boxcolor} is "white".
  7704. @item line_spacing
  7705. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7706. The default value of @var{line_spacing} is 0.
  7707. @item borderw
  7708. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7709. The default value of @var{borderw} is 0.
  7710. @item bordercolor
  7711. Set the color to be used for drawing border around text. For the syntax of this
  7712. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7713. The default value of @var{bordercolor} is "black".
  7714. @item expansion
  7715. Select how the @var{text} is expanded. Can be either @code{none},
  7716. @code{strftime} (deprecated) or
  7717. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7718. below for details.
  7719. @item basetime
  7720. Set a start time for the count. Value is in microseconds. Only applied
  7721. in the deprecated strftime expansion mode. To emulate in normal expansion
  7722. mode use the @code{pts} function, supplying the start time (in seconds)
  7723. as the second argument.
  7724. @item fix_bounds
  7725. If true, check and fix text coords to avoid clipping.
  7726. @item fontcolor
  7727. The color to be used for drawing fonts. For the syntax of this option, check
  7728. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7729. The default value of @var{fontcolor} is "black".
  7730. @item fontcolor_expr
  7731. String which is expanded the same way as @var{text} to obtain dynamic
  7732. @var{fontcolor} value. By default this option has empty value and is not
  7733. processed. When this option is set, it overrides @var{fontcolor} option.
  7734. @item font
  7735. The font family to be used for drawing text. By default Sans.
  7736. @item fontfile
  7737. The font file to be used for drawing text. The path must be included.
  7738. This parameter is mandatory if the fontconfig support is disabled.
  7739. @item alpha
  7740. Draw the text applying alpha blending. The value can
  7741. be a number between 0.0 and 1.0.
  7742. The expression accepts the same variables @var{x, y} as well.
  7743. The default value is 1.
  7744. Please see @var{fontcolor_expr}.
  7745. @item fontsize
  7746. The font size to be used for drawing text.
  7747. The default value of @var{fontsize} is 16.
  7748. @item text_shaping
  7749. If set to 1, attempt to shape the text (for example, reverse the order of
  7750. right-to-left text and join Arabic characters) before drawing it.
  7751. Otherwise, just draw the text exactly as given.
  7752. By default 1 (if supported).
  7753. @item ft_load_flags
  7754. The flags to be used for loading the fonts.
  7755. The flags map the corresponding flags supported by libfreetype, and are
  7756. a combination of the following values:
  7757. @table @var
  7758. @item default
  7759. @item no_scale
  7760. @item no_hinting
  7761. @item render
  7762. @item no_bitmap
  7763. @item vertical_layout
  7764. @item force_autohint
  7765. @item crop_bitmap
  7766. @item pedantic
  7767. @item ignore_global_advance_width
  7768. @item no_recurse
  7769. @item ignore_transform
  7770. @item monochrome
  7771. @item linear_design
  7772. @item no_autohint
  7773. @end table
  7774. Default value is "default".
  7775. For more information consult the documentation for the FT_LOAD_*
  7776. libfreetype flags.
  7777. @item shadowcolor
  7778. The color to be used for drawing a shadow behind the drawn text. For the
  7779. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7780. ffmpeg-utils manual,ffmpeg-utils}.
  7781. The default value of @var{shadowcolor} is "black".
  7782. @item shadowx
  7783. @item shadowy
  7784. The x and y offsets for the text shadow position with respect to the
  7785. position of the text. They can be either positive or negative
  7786. values. The default value for both is "0".
  7787. @item start_number
  7788. The starting frame number for the n/frame_num variable. The default value
  7789. is "0".
  7790. @item tabsize
  7791. The size in number of spaces to use for rendering the tab.
  7792. Default value is 4.
  7793. @item timecode
  7794. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7795. format. It can be used with or without text parameter. @var{timecode_rate}
  7796. option must be specified.
  7797. @item timecode_rate, rate, r
  7798. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7799. integer. Minimum value is "1".
  7800. Drop-frame timecode is supported for frame rates 30 & 60.
  7801. @item tc24hmax
  7802. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7803. Default is 0 (disabled).
  7804. @item text
  7805. The text string to be drawn. The text must be a sequence of UTF-8
  7806. encoded characters.
  7807. This parameter is mandatory if no file is specified with the parameter
  7808. @var{textfile}.
  7809. @item textfile
  7810. A text file containing text to be drawn. The text must be a sequence
  7811. of UTF-8 encoded characters.
  7812. This parameter is mandatory if no text string is specified with the
  7813. parameter @var{text}.
  7814. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7815. @item reload
  7816. If set to 1, the @var{textfile} will be reloaded before each frame.
  7817. Be sure to update it atomically, or it may be read partially, or even fail.
  7818. @item x
  7819. @item y
  7820. The expressions which specify the offsets where text will be drawn
  7821. within the video frame. They are relative to the top/left border of the
  7822. output image.
  7823. The default value of @var{x} and @var{y} is "0".
  7824. See below for the list of accepted constants and functions.
  7825. @end table
  7826. The parameters for @var{x} and @var{y} are expressions containing the
  7827. following constants and functions:
  7828. @table @option
  7829. @item dar
  7830. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7831. @item hsub
  7832. @item vsub
  7833. horizontal and vertical chroma subsample values. For example for the
  7834. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7835. @item line_h, lh
  7836. the height of each text line
  7837. @item main_h, h, H
  7838. the input height
  7839. @item main_w, w, W
  7840. the input width
  7841. @item max_glyph_a, ascent
  7842. the maximum distance from the baseline to the highest/upper grid
  7843. coordinate used to place a glyph outline point, for all the rendered
  7844. glyphs.
  7845. It is a positive value, due to the grid's orientation with the Y axis
  7846. upwards.
  7847. @item max_glyph_d, descent
  7848. the maximum distance from the baseline to the lowest grid coordinate
  7849. used to place a glyph outline point, for all the rendered glyphs.
  7850. This is a negative value, due to the grid's orientation, with the Y axis
  7851. upwards.
  7852. @item max_glyph_h
  7853. maximum glyph height, that is the maximum height for all the glyphs
  7854. contained in the rendered text, it is equivalent to @var{ascent} -
  7855. @var{descent}.
  7856. @item max_glyph_w
  7857. maximum glyph width, that is the maximum width for all the glyphs
  7858. contained in the rendered text
  7859. @item n
  7860. the number of input frame, starting from 0
  7861. @item rand(min, max)
  7862. return a random number included between @var{min} and @var{max}
  7863. @item sar
  7864. The input sample aspect ratio.
  7865. @item t
  7866. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7867. @item text_h, th
  7868. the height of the rendered text
  7869. @item text_w, tw
  7870. the width of the rendered text
  7871. @item x
  7872. @item y
  7873. the x and y offset coordinates where the text is drawn.
  7874. These parameters allow the @var{x} and @var{y} expressions to refer
  7875. to each other, so you can for example specify @code{y=x/dar}.
  7876. @item pict_type
  7877. A one character description of the current frame's picture type.
  7878. @item pkt_pos
  7879. The current packet's position in the input file or stream
  7880. (in bytes, from the start of the input). A value of -1 indicates
  7881. this info is not available.
  7882. @item pkt_duration
  7883. The current packet's duration, in seconds.
  7884. @item pkt_size
  7885. The current packet's size (in bytes).
  7886. @end table
  7887. @anchor{drawtext_expansion}
  7888. @subsection Text expansion
  7889. If @option{expansion} is set to @code{strftime},
  7890. the filter recognizes strftime() sequences in the provided text and
  7891. expands them accordingly. Check the documentation of strftime(). This
  7892. feature is deprecated.
  7893. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7894. If @option{expansion} is set to @code{normal} (which is the default),
  7895. the following expansion mechanism is used.
  7896. The backslash character @samp{\}, followed by any character, always expands to
  7897. the second character.
  7898. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7899. braces is a function name, possibly followed by arguments separated by ':'.
  7900. If the arguments contain special characters or delimiters (':' or '@}'),
  7901. they should be escaped.
  7902. Note that they probably must also be escaped as the value for the
  7903. @option{text} option in the filter argument string and as the filter
  7904. argument in the filtergraph description, and possibly also for the shell,
  7905. that makes up to four levels of escaping; using a text file avoids these
  7906. problems.
  7907. The following functions are available:
  7908. @table @command
  7909. @item expr, e
  7910. The expression evaluation result.
  7911. It must take one argument specifying the expression to be evaluated,
  7912. which accepts the same constants and functions as the @var{x} and
  7913. @var{y} values. Note that not all constants should be used, for
  7914. example the text size is not known when evaluating the expression, so
  7915. the constants @var{text_w} and @var{text_h} will have an undefined
  7916. value.
  7917. @item expr_int_format, eif
  7918. Evaluate the expression's value and output as formatted integer.
  7919. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7920. The second argument specifies the output format. Allowed values are @samp{x},
  7921. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7922. @code{printf} function.
  7923. The third parameter is optional and sets the number of positions taken by the output.
  7924. It can be used to add padding with zeros from the left.
  7925. @item gmtime
  7926. The time at which the filter is running, expressed in UTC.
  7927. It can accept an argument: a strftime() format string.
  7928. @item localtime
  7929. The time at which the filter is running, expressed in the local time zone.
  7930. It can accept an argument: a strftime() format string.
  7931. @item metadata
  7932. Frame metadata. Takes one or two arguments.
  7933. The first argument is mandatory and specifies the metadata key.
  7934. The second argument is optional and specifies a default value, used when the
  7935. metadata key is not found or empty.
  7936. Available metadata can be identified by inspecting entries
  7937. starting with TAG included within each frame section
  7938. printed by running @code{ffprobe -show_frames}.
  7939. String metadata generated in filters leading to
  7940. the drawtext filter are also available.
  7941. @item n, frame_num
  7942. The frame number, starting from 0.
  7943. @item pict_type
  7944. A one character description of the current picture type.
  7945. @item pts
  7946. The timestamp of the current frame.
  7947. It can take up to three arguments.
  7948. The first argument is the format of the timestamp; it defaults to @code{flt}
  7949. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7950. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7951. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7952. @code{localtime} stands for the timestamp of the frame formatted as
  7953. local time zone time.
  7954. The second argument is an offset added to the timestamp.
  7955. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7956. supplied to present the hour part of the formatted timestamp in 24h format
  7957. (00-23).
  7958. If the format is set to @code{localtime} or @code{gmtime},
  7959. a third argument may be supplied: a strftime() format string.
  7960. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7961. @end table
  7962. @subsection Commands
  7963. This filter supports altering parameters via commands:
  7964. @table @option
  7965. @item reinit
  7966. Alter existing filter parameters.
  7967. Syntax for the argument is the same as for filter invocation, e.g.
  7968. @example
  7969. fontsize=56:fontcolor=green:text='Hello World'
  7970. @end example
  7971. Full filter invocation with sendcmd would look like this:
  7972. @example
  7973. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7974. @end example
  7975. @end table
  7976. If the entire argument can't be parsed or applied as valid values then the filter will
  7977. continue with its existing parameters.
  7978. @subsection Examples
  7979. @itemize
  7980. @item
  7981. Draw "Test Text" with font FreeSerif, using the default values for the
  7982. optional parameters.
  7983. @example
  7984. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7985. @end example
  7986. @item
  7987. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7988. and y=50 (counting from the top-left corner of the screen), text is
  7989. yellow with a red box around it. Both the text and the box have an
  7990. opacity of 20%.
  7991. @example
  7992. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7993. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7994. @end example
  7995. Note that the double quotes are not necessary if spaces are not used
  7996. within the parameter list.
  7997. @item
  7998. Show the text at the center of the video frame:
  7999. @example
  8000. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8001. @end example
  8002. @item
  8003. Show the text at a random position, switching to a new position every 30 seconds:
  8004. @example
  8005. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  8006. @end example
  8007. @item
  8008. Show a text line sliding from right to left in the last row of the video
  8009. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8010. with no newlines.
  8011. @example
  8012. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8013. @end example
  8014. @item
  8015. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8016. @example
  8017. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8018. @end example
  8019. @item
  8020. Draw a single green letter "g", at the center of the input video.
  8021. The glyph baseline is placed at half screen height.
  8022. @example
  8023. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8024. @end example
  8025. @item
  8026. Show text for 1 second every 3 seconds:
  8027. @example
  8028. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8029. @end example
  8030. @item
  8031. Use fontconfig to set the font. Note that the colons need to be escaped.
  8032. @example
  8033. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8034. @end example
  8035. @item
  8036. Draw "Test Text" with font size dependent on height of the video.
  8037. @example
  8038. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8039. @end example
  8040. @item
  8041. Print the date of a real-time encoding (see strftime(3)):
  8042. @example
  8043. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8044. @end example
  8045. @item
  8046. Show text fading in and out (appearing/disappearing):
  8047. @example
  8048. #!/bin/sh
  8049. DS=1.0 # display start
  8050. DE=10.0 # display end
  8051. FID=1.5 # fade in duration
  8052. FOD=5 # fade out duration
  8053. ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
  8054. @end example
  8055. @item
  8056. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8057. and the @option{fontsize} value are included in the @option{y} offset.
  8058. @example
  8059. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8060. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8061. @end example
  8062. @item
  8063. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8064. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8065. must have option @option{-export_path_metadata 1} for the special metadata fields
  8066. to be available for filters.
  8067. @example
  8068. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8069. @end example
  8070. @end itemize
  8071. For more information about libfreetype, check:
  8072. @url{http://www.freetype.org/}.
  8073. For more information about fontconfig, check:
  8074. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8075. For more information about libfribidi, check:
  8076. @url{http://fribidi.org/}.
  8077. @section edgedetect
  8078. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8079. The filter accepts the following options:
  8080. @table @option
  8081. @item low
  8082. @item high
  8083. Set low and high threshold values used by the Canny thresholding
  8084. algorithm.
  8085. The high threshold selects the "strong" edge pixels, which are then
  8086. connected through 8-connectivity with the "weak" edge pixels selected
  8087. by the low threshold.
  8088. @var{low} and @var{high} threshold values must be chosen in the range
  8089. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8090. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8091. is @code{50/255}.
  8092. @item mode
  8093. Define the drawing mode.
  8094. @table @samp
  8095. @item wires
  8096. Draw white/gray wires on black background.
  8097. @item colormix
  8098. Mix the colors to create a paint/cartoon effect.
  8099. @item canny
  8100. Apply Canny edge detector on all selected planes.
  8101. @end table
  8102. Default value is @var{wires}.
  8103. @item planes
  8104. Select planes for filtering. By default all available planes are filtered.
  8105. @end table
  8106. @subsection Examples
  8107. @itemize
  8108. @item
  8109. Standard edge detection with custom values for the hysteresis thresholding:
  8110. @example
  8111. edgedetect=low=0.1:high=0.4
  8112. @end example
  8113. @item
  8114. Painting effect without thresholding:
  8115. @example
  8116. edgedetect=mode=colormix:high=0
  8117. @end example
  8118. @end itemize
  8119. @section elbg
  8120. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8121. For each input image, the filter will compute the optimal mapping from
  8122. the input to the output given the codebook length, that is the number
  8123. of distinct output colors.
  8124. This filter accepts the following options.
  8125. @table @option
  8126. @item codebook_length, l
  8127. Set codebook length. The value must be a positive integer, and
  8128. represents the number of distinct output colors. Default value is 256.
  8129. @item nb_steps, n
  8130. Set the maximum number of iterations to apply for computing the optimal
  8131. mapping. The higher the value the better the result and the higher the
  8132. computation time. Default value is 1.
  8133. @item seed, s
  8134. Set a random seed, must be an integer included between 0 and
  8135. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8136. will try to use a good random seed on a best effort basis.
  8137. @item pal8
  8138. Set pal8 output pixel format. This option does not work with codebook
  8139. length greater than 256.
  8140. @end table
  8141. @section entropy
  8142. Measure graylevel entropy in histogram of color channels of video frames.
  8143. It accepts the following parameters:
  8144. @table @option
  8145. @item mode
  8146. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8147. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8148. between neighbour histogram values.
  8149. @end table
  8150. @section eq
  8151. Set brightness, contrast, saturation and approximate gamma adjustment.
  8152. The filter accepts the following options:
  8153. @table @option
  8154. @item contrast
  8155. Set the contrast expression. The value must be a float value in range
  8156. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8157. @item brightness
  8158. Set the brightness expression. The value must be a float value in
  8159. range @code{-1.0} to @code{1.0}. The default value is "0".
  8160. @item saturation
  8161. Set the saturation expression. The value must be a float in
  8162. range @code{0.0} to @code{3.0}. The default value is "1".
  8163. @item gamma
  8164. Set the gamma expression. The value must be a float in range
  8165. @code{0.1} to @code{10.0}. The default value is "1".
  8166. @item gamma_r
  8167. Set the gamma expression for red. The value must be a float in
  8168. range @code{0.1} to @code{10.0}. The default value is "1".
  8169. @item gamma_g
  8170. Set the gamma expression for green. The value must be a float in range
  8171. @code{0.1} to @code{10.0}. The default value is "1".
  8172. @item gamma_b
  8173. Set the gamma expression for blue. The value must be a float in range
  8174. @code{0.1} to @code{10.0}. The default value is "1".
  8175. @item gamma_weight
  8176. Set the gamma weight expression. It can be used to reduce the effect
  8177. of a high gamma value on bright image areas, e.g. keep them from
  8178. getting overamplified and just plain white. The value must be a float
  8179. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8180. gamma correction all the way down while @code{1.0} leaves it at its
  8181. full strength. Default is "1".
  8182. @item eval
  8183. Set when the expressions for brightness, contrast, saturation and
  8184. gamma expressions are evaluated.
  8185. It accepts the following values:
  8186. @table @samp
  8187. @item init
  8188. only evaluate expressions once during the filter initialization or
  8189. when a command is processed
  8190. @item frame
  8191. evaluate expressions for each incoming frame
  8192. @end table
  8193. Default value is @samp{init}.
  8194. @end table
  8195. The expressions accept the following parameters:
  8196. @table @option
  8197. @item n
  8198. frame count of the input frame starting from 0
  8199. @item pos
  8200. byte position of the corresponding packet in the input file, NAN if
  8201. unspecified
  8202. @item r
  8203. frame rate of the input video, NAN if the input frame rate is unknown
  8204. @item t
  8205. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8206. @end table
  8207. @subsection Commands
  8208. The filter supports the following commands:
  8209. @table @option
  8210. @item contrast
  8211. Set the contrast expression.
  8212. @item brightness
  8213. Set the brightness expression.
  8214. @item saturation
  8215. Set the saturation expression.
  8216. @item gamma
  8217. Set the gamma expression.
  8218. @item gamma_r
  8219. Set the gamma_r expression.
  8220. @item gamma_g
  8221. Set gamma_g expression.
  8222. @item gamma_b
  8223. Set gamma_b expression.
  8224. @item gamma_weight
  8225. Set gamma_weight expression.
  8226. The command accepts the same syntax of the corresponding option.
  8227. If the specified expression is not valid, it is kept at its current
  8228. value.
  8229. @end table
  8230. @section erosion
  8231. Apply erosion effect to the video.
  8232. This filter replaces the pixel by the local(3x3) minimum.
  8233. It accepts the following options:
  8234. @table @option
  8235. @item threshold0
  8236. @item threshold1
  8237. @item threshold2
  8238. @item threshold3
  8239. Limit the maximum change for each plane, default is 65535.
  8240. If 0, plane will remain unchanged.
  8241. @item coordinates
  8242. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8243. pixels are used.
  8244. Flags to local 3x3 coordinates maps like this:
  8245. 1 2 3
  8246. 4 5
  8247. 6 7 8
  8248. @end table
  8249. @subsection Commands
  8250. This filter supports the all above options as @ref{commands}.
  8251. @section extractplanes
  8252. Extract color channel components from input video stream into
  8253. separate grayscale video streams.
  8254. The filter accepts the following option:
  8255. @table @option
  8256. @item planes
  8257. Set plane(s) to extract.
  8258. Available values for planes are:
  8259. @table @samp
  8260. @item y
  8261. @item u
  8262. @item v
  8263. @item a
  8264. @item r
  8265. @item g
  8266. @item b
  8267. @end table
  8268. Choosing planes not available in the input will result in an error.
  8269. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8270. with @code{y}, @code{u}, @code{v} planes at same time.
  8271. @end table
  8272. @subsection Examples
  8273. @itemize
  8274. @item
  8275. Extract luma, u and v color channel component from input video frame
  8276. into 3 grayscale outputs:
  8277. @example
  8278. 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
  8279. @end example
  8280. @end itemize
  8281. @section fade
  8282. Apply a fade-in/out effect to the input video.
  8283. It accepts the following parameters:
  8284. @table @option
  8285. @item type, t
  8286. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8287. effect.
  8288. Default is @code{in}.
  8289. @item start_frame, s
  8290. Specify the number of the frame to start applying the fade
  8291. effect at. Default is 0.
  8292. @item nb_frames, n
  8293. The number of frames that the fade effect lasts. At the end of the
  8294. fade-in effect, the output video will have the same intensity as the input video.
  8295. At the end of the fade-out transition, the output video will be filled with the
  8296. selected @option{color}.
  8297. Default is 25.
  8298. @item alpha
  8299. If set to 1, fade only alpha channel, if one exists on the input.
  8300. Default value is 0.
  8301. @item start_time, st
  8302. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8303. effect. If both start_frame and start_time are specified, the fade will start at
  8304. whichever comes last. Default is 0.
  8305. @item duration, d
  8306. The number of seconds for which the fade effect has to last. At the end of the
  8307. fade-in effect the output video will have the same intensity as the input video,
  8308. at the end of the fade-out transition the output video will be filled with the
  8309. selected @option{color}.
  8310. If both duration and nb_frames are specified, duration is used. Default is 0
  8311. (nb_frames is used by default).
  8312. @item color, c
  8313. Specify the color of the fade. Default is "black".
  8314. @end table
  8315. @subsection Examples
  8316. @itemize
  8317. @item
  8318. Fade in the first 30 frames of video:
  8319. @example
  8320. fade=in:0:30
  8321. @end example
  8322. The command above is equivalent to:
  8323. @example
  8324. fade=t=in:s=0:n=30
  8325. @end example
  8326. @item
  8327. Fade out the last 45 frames of a 200-frame video:
  8328. @example
  8329. fade=out:155:45
  8330. fade=type=out:start_frame=155:nb_frames=45
  8331. @end example
  8332. @item
  8333. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8334. @example
  8335. fade=in:0:25, fade=out:975:25
  8336. @end example
  8337. @item
  8338. Make the first 5 frames yellow, then fade in from frame 5-24:
  8339. @example
  8340. fade=in:5:20:color=yellow
  8341. @end example
  8342. @item
  8343. Fade in alpha over first 25 frames of video:
  8344. @example
  8345. fade=in:0:25:alpha=1
  8346. @end example
  8347. @item
  8348. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8349. @example
  8350. fade=t=in:st=5.5:d=0.5
  8351. @end example
  8352. @end itemize
  8353. @section fftdnoiz
  8354. Denoise frames using 3D FFT (frequency domain filtering).
  8355. The filter accepts the following options:
  8356. @table @option
  8357. @item sigma
  8358. Set the noise sigma constant. This sets denoising strength.
  8359. Default value is 1. Allowed range is from 0 to 30.
  8360. Using very high sigma with low overlap may give blocking artifacts.
  8361. @item amount
  8362. Set amount of denoising. By default all detected noise is reduced.
  8363. Default value is 1. Allowed range is from 0 to 1.
  8364. @item block
  8365. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8366. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8367. block size in pixels is 2^4 which is 16.
  8368. @item overlap
  8369. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8370. @item prev
  8371. Set number of previous frames to use for denoising. By default is set to 0.
  8372. @item next
  8373. Set number of next frames to to use for denoising. By default is set to 0.
  8374. @item planes
  8375. Set planes which will be filtered, by default are all available filtered
  8376. except alpha.
  8377. @end table
  8378. @section fftfilt
  8379. Apply arbitrary expressions to samples in frequency domain
  8380. @table @option
  8381. @item dc_Y
  8382. Adjust the dc value (gain) of the luma plane of the image. The filter
  8383. accepts an integer value in range @code{0} to @code{1000}. The default
  8384. value is set to @code{0}.
  8385. @item dc_U
  8386. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8387. filter accepts an integer value in range @code{0} to @code{1000}. The
  8388. default value is set to @code{0}.
  8389. @item dc_V
  8390. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8391. filter accepts an integer value in range @code{0} to @code{1000}. The
  8392. default value is set to @code{0}.
  8393. @item weight_Y
  8394. Set the frequency domain weight expression for the luma plane.
  8395. @item weight_U
  8396. Set the frequency domain weight expression for the 1st chroma plane.
  8397. @item weight_V
  8398. Set the frequency domain weight expression for the 2nd chroma plane.
  8399. @item eval
  8400. Set when the expressions are evaluated.
  8401. It accepts the following values:
  8402. @table @samp
  8403. @item init
  8404. Only evaluate expressions once during the filter initialization.
  8405. @item frame
  8406. Evaluate expressions for each incoming frame.
  8407. @end table
  8408. Default value is @samp{init}.
  8409. The filter accepts the following variables:
  8410. @item X
  8411. @item Y
  8412. The coordinates of the current sample.
  8413. @item W
  8414. @item H
  8415. The width and height of the image.
  8416. @item N
  8417. The number of input frame, starting from 0.
  8418. @end table
  8419. @subsection Examples
  8420. @itemize
  8421. @item
  8422. High-pass:
  8423. @example
  8424. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8425. @end example
  8426. @item
  8427. Low-pass:
  8428. @example
  8429. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8430. @end example
  8431. @item
  8432. Sharpen:
  8433. @example
  8434. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8435. @end example
  8436. @item
  8437. Blur:
  8438. @example
  8439. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8440. @end example
  8441. @end itemize
  8442. @section field
  8443. Extract a single field from an interlaced image using stride
  8444. arithmetic to avoid wasting CPU time. The output frames are marked as
  8445. non-interlaced.
  8446. The filter accepts the following options:
  8447. @table @option
  8448. @item type
  8449. Specify whether to extract the top (if the value is @code{0} or
  8450. @code{top}) or the bottom field (if the value is @code{1} or
  8451. @code{bottom}).
  8452. @end table
  8453. @section fieldhint
  8454. Create new frames by copying the top and bottom fields from surrounding frames
  8455. supplied as numbers by the hint file.
  8456. @table @option
  8457. @item hint
  8458. Set file containing hints: absolute/relative frame numbers.
  8459. There must be one line for each frame in a clip. Each line must contain two
  8460. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8461. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8462. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8463. for @code{relative} mode. First number tells from which frame to pick up top
  8464. field and second number tells from which frame to pick up bottom field.
  8465. If optionally followed by @code{+} output frame will be marked as interlaced,
  8466. else if followed by @code{-} output frame will be marked as progressive, else
  8467. it will be marked same as input frame.
  8468. If optionally followed by @code{t} output frame will use only top field, or in
  8469. case of @code{b} it will use only bottom field.
  8470. If line starts with @code{#} or @code{;} that line is skipped.
  8471. @item mode
  8472. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8473. @end table
  8474. Example of first several lines of @code{hint} file for @code{relative} mode:
  8475. @example
  8476. 0,0 - # first frame
  8477. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8478. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8479. 1,0 -
  8480. 0,0 -
  8481. 0,0 -
  8482. 1,0 -
  8483. 1,0 -
  8484. 1,0 -
  8485. 0,0 -
  8486. 0,0 -
  8487. 1,0 -
  8488. 1,0 -
  8489. 1,0 -
  8490. 0,0 -
  8491. @end example
  8492. @section fieldmatch
  8493. Field matching filter for inverse telecine. It is meant to reconstruct the
  8494. progressive frames from a telecined stream. The filter does not drop duplicated
  8495. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8496. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8497. The separation of the field matching and the decimation is notably motivated by
  8498. the possibility of inserting a de-interlacing filter fallback between the two.
  8499. If the source has mixed telecined and real interlaced content,
  8500. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8501. But these remaining combed frames will be marked as interlaced, and thus can be
  8502. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8503. In addition to the various configuration options, @code{fieldmatch} can take an
  8504. optional second stream, activated through the @option{ppsrc} option. If
  8505. enabled, the frames reconstruction will be based on the fields and frames from
  8506. this second stream. This allows the first input to be pre-processed in order to
  8507. help the various algorithms of the filter, while keeping the output lossless
  8508. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8509. or brightness/contrast adjustments can help.
  8510. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8511. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8512. which @code{fieldmatch} is based on. While the semantic and usage are very
  8513. close, some behaviour and options names can differ.
  8514. The @ref{decimate} filter currently only works for constant frame rate input.
  8515. If your input has mixed telecined (30fps) and progressive content with a lower
  8516. framerate like 24fps use the following filterchain to produce the necessary cfr
  8517. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8518. The filter accepts the following options:
  8519. @table @option
  8520. @item order
  8521. Specify the assumed field order of the input stream. Available values are:
  8522. @table @samp
  8523. @item auto
  8524. Auto detect parity (use FFmpeg's internal parity value).
  8525. @item bff
  8526. Assume bottom field first.
  8527. @item tff
  8528. Assume top field first.
  8529. @end table
  8530. Note that it is sometimes recommended not to trust the parity announced by the
  8531. stream.
  8532. Default value is @var{auto}.
  8533. @item mode
  8534. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8535. sense that it won't risk creating jerkiness due to duplicate frames when
  8536. possible, but if there are bad edits or blended fields it will end up
  8537. outputting combed frames when a good match might actually exist. On the other
  8538. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8539. but will almost always find a good frame if there is one. The other values are
  8540. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8541. jerkiness and creating duplicate frames versus finding good matches in sections
  8542. with bad edits, orphaned fields, blended fields, etc.
  8543. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8544. Available values are:
  8545. @table @samp
  8546. @item pc
  8547. 2-way matching (p/c)
  8548. @item pc_n
  8549. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8550. @item pc_u
  8551. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8552. @item pc_n_ub
  8553. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8554. still combed (p/c + n + u/b)
  8555. @item pcn
  8556. 3-way matching (p/c/n)
  8557. @item pcn_ub
  8558. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8559. detected as combed (p/c/n + u/b)
  8560. @end table
  8561. The parenthesis at the end indicate the matches that would be used for that
  8562. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8563. @var{top}).
  8564. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8565. the slowest.
  8566. Default value is @var{pc_n}.
  8567. @item ppsrc
  8568. Mark the main input stream as a pre-processed input, and enable the secondary
  8569. input stream as the clean source to pick the fields from. See the filter
  8570. introduction for more details. It is similar to the @option{clip2} feature from
  8571. VFM/TFM.
  8572. Default value is @code{0} (disabled).
  8573. @item field
  8574. Set the field to match from. It is recommended to set this to the same value as
  8575. @option{order} unless you experience matching failures with that setting. In
  8576. certain circumstances changing the field that is used to match from can have a
  8577. large impact on matching performance. Available values are:
  8578. @table @samp
  8579. @item auto
  8580. Automatic (same value as @option{order}).
  8581. @item bottom
  8582. Match from the bottom field.
  8583. @item top
  8584. Match from the top field.
  8585. @end table
  8586. Default value is @var{auto}.
  8587. @item mchroma
  8588. Set whether or not chroma is included during the match comparisons. In most
  8589. cases it is recommended to leave this enabled. You should set this to @code{0}
  8590. only if your clip has bad chroma problems such as heavy rainbowing or other
  8591. artifacts. Setting this to @code{0} could also be used to speed things up at
  8592. the cost of some accuracy.
  8593. Default value is @code{1}.
  8594. @item y0
  8595. @item y1
  8596. These define an exclusion band which excludes the lines between @option{y0} and
  8597. @option{y1} from being included in the field matching decision. An exclusion
  8598. band can be used to ignore subtitles, a logo, or other things that may
  8599. interfere with the matching. @option{y0} sets the starting scan line and
  8600. @option{y1} sets the ending line; all lines in between @option{y0} and
  8601. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8602. @option{y0} and @option{y1} to the same value will disable the feature.
  8603. @option{y0} and @option{y1} defaults to @code{0}.
  8604. @item scthresh
  8605. Set the scene change detection threshold as a percentage of maximum change on
  8606. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8607. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8608. @option{scthresh} is @code{[0.0, 100.0]}.
  8609. Default value is @code{12.0}.
  8610. @item combmatch
  8611. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8612. account the combed scores of matches when deciding what match to use as the
  8613. final match. Available values are:
  8614. @table @samp
  8615. @item none
  8616. No final matching based on combed scores.
  8617. @item sc
  8618. Combed scores are only used when a scene change is detected.
  8619. @item full
  8620. Use combed scores all the time.
  8621. @end table
  8622. Default is @var{sc}.
  8623. @item combdbg
  8624. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8625. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8626. Available values are:
  8627. @table @samp
  8628. @item none
  8629. No forced calculation.
  8630. @item pcn
  8631. Force p/c/n calculations.
  8632. @item pcnub
  8633. Force p/c/n/u/b calculations.
  8634. @end table
  8635. Default value is @var{none}.
  8636. @item cthresh
  8637. This is the area combing threshold used for combed frame detection. This
  8638. essentially controls how "strong" or "visible" combing must be to be detected.
  8639. Larger values mean combing must be more visible and smaller values mean combing
  8640. can be less visible or strong and still be detected. Valid settings are from
  8641. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8642. be detected as combed). This is basically a pixel difference value. A good
  8643. range is @code{[8, 12]}.
  8644. Default value is @code{9}.
  8645. @item chroma
  8646. Sets whether or not chroma is considered in the combed frame decision. Only
  8647. disable this if your source has chroma problems (rainbowing, etc.) that are
  8648. causing problems for the combed frame detection with chroma enabled. Actually,
  8649. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8650. where there is chroma only combing in the source.
  8651. Default value is @code{0}.
  8652. @item blockx
  8653. @item blocky
  8654. Respectively set the x-axis and y-axis size of the window used during combed
  8655. frame detection. This has to do with the size of the area in which
  8656. @option{combpel} pixels are required to be detected as combed for a frame to be
  8657. declared combed. See the @option{combpel} parameter description for more info.
  8658. Possible values are any number that is a power of 2 starting at 4 and going up
  8659. to 512.
  8660. Default value is @code{16}.
  8661. @item combpel
  8662. The number of combed pixels inside any of the @option{blocky} by
  8663. @option{blockx} size blocks on the frame for the frame to be detected as
  8664. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8665. setting controls "how much" combing there must be in any localized area (a
  8666. window defined by the @option{blockx} and @option{blocky} settings) on the
  8667. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8668. which point no frames will ever be detected as combed). This setting is known
  8669. as @option{MI} in TFM/VFM vocabulary.
  8670. Default value is @code{80}.
  8671. @end table
  8672. @anchor{p/c/n/u/b meaning}
  8673. @subsection p/c/n/u/b meaning
  8674. @subsubsection p/c/n
  8675. We assume the following telecined stream:
  8676. @example
  8677. Top fields: 1 2 2 3 4
  8678. Bottom fields: 1 2 3 4 4
  8679. @end example
  8680. The numbers correspond to the progressive frame the fields relate to. Here, the
  8681. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8682. When @code{fieldmatch} is configured to run a matching from bottom
  8683. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8684. @example
  8685. Input stream:
  8686. T 1 2 2 3 4
  8687. B 1 2 3 4 4 <-- matching reference
  8688. Matches: c c n n c
  8689. Output stream:
  8690. T 1 2 3 4 4
  8691. B 1 2 3 4 4
  8692. @end example
  8693. As a result of the field matching, we can see that some frames get duplicated.
  8694. To perform a complete inverse telecine, you need to rely on a decimation filter
  8695. after this operation. See for instance the @ref{decimate} filter.
  8696. The same operation now matching from top fields (@option{field}=@var{top})
  8697. looks like this:
  8698. @example
  8699. Input stream:
  8700. T 1 2 2 3 4 <-- matching reference
  8701. B 1 2 3 4 4
  8702. Matches: c c p p c
  8703. Output stream:
  8704. T 1 2 2 3 4
  8705. B 1 2 2 3 4
  8706. @end example
  8707. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8708. basically, they refer to the frame and field of the opposite parity:
  8709. @itemize
  8710. @item @var{p} matches the field of the opposite parity in the previous frame
  8711. @item @var{c} matches the field of the opposite parity in the current frame
  8712. @item @var{n} matches the field of the opposite parity in the next frame
  8713. @end itemize
  8714. @subsubsection u/b
  8715. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8716. from the opposite parity flag. In the following examples, we assume that we are
  8717. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8718. 'x' is placed above and below each matched fields.
  8719. With bottom matching (@option{field}=@var{bottom}):
  8720. @example
  8721. Match: c p n b u
  8722. x x x x x
  8723. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8724. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8725. x x x x x
  8726. Output frames:
  8727. 2 1 2 2 2
  8728. 2 2 2 1 3
  8729. @end example
  8730. With top matching (@option{field}=@var{top}):
  8731. @example
  8732. Match: c p n b u
  8733. x x x x x
  8734. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8735. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8736. x x x x x
  8737. Output frames:
  8738. 2 2 2 1 2
  8739. 2 1 3 2 2
  8740. @end example
  8741. @subsection Examples
  8742. Simple IVTC of a top field first telecined stream:
  8743. @example
  8744. fieldmatch=order=tff:combmatch=none, decimate
  8745. @end example
  8746. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8747. @example
  8748. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8749. @end example
  8750. @section fieldorder
  8751. Transform the field order of the input video.
  8752. It accepts the following parameters:
  8753. @table @option
  8754. @item order
  8755. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8756. for bottom field first.
  8757. @end table
  8758. The default value is @samp{tff}.
  8759. The transformation is done by shifting the picture content up or down
  8760. by one line, and filling the remaining line with appropriate picture content.
  8761. This method is consistent with most broadcast field order converters.
  8762. If the input video is not flagged as being interlaced, or it is already
  8763. flagged as being of the required output field order, then this filter does
  8764. not alter the incoming video.
  8765. It is very useful when converting to or from PAL DV material,
  8766. which is bottom field first.
  8767. For example:
  8768. @example
  8769. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8770. @end example
  8771. @section fifo, afifo
  8772. Buffer input images and send them when they are requested.
  8773. It is mainly useful when auto-inserted by the libavfilter
  8774. framework.
  8775. It does not take parameters.
  8776. @section fillborders
  8777. Fill borders of the input video, without changing video stream dimensions.
  8778. Sometimes video can have garbage at the four edges and you may not want to
  8779. crop video input to keep size multiple of some number.
  8780. This filter accepts the following options:
  8781. @table @option
  8782. @item left
  8783. Number of pixels to fill from left border.
  8784. @item right
  8785. Number of pixels to fill from right border.
  8786. @item top
  8787. Number of pixels to fill from top border.
  8788. @item bottom
  8789. Number of pixels to fill from bottom border.
  8790. @item mode
  8791. Set fill mode.
  8792. It accepts the following values:
  8793. @table @samp
  8794. @item smear
  8795. fill pixels using outermost pixels
  8796. @item mirror
  8797. fill pixels using mirroring
  8798. @item fixed
  8799. fill pixels with constant value
  8800. @end table
  8801. Default is @var{smear}.
  8802. @item color
  8803. Set color for pixels in fixed mode. Default is @var{black}.
  8804. @end table
  8805. @subsection Commands
  8806. This filter supports same @ref{commands} as options.
  8807. The command accepts the same syntax of the corresponding option.
  8808. If the specified expression is not valid, it is kept at its current
  8809. value.
  8810. @section find_rect
  8811. Find a rectangular object
  8812. It accepts the following options:
  8813. @table @option
  8814. @item object
  8815. Filepath of the object image, needs to be in gray8.
  8816. @item threshold
  8817. Detection threshold, default is 0.5.
  8818. @item mipmaps
  8819. Number of mipmaps, default is 3.
  8820. @item xmin, ymin, xmax, ymax
  8821. Specifies the rectangle in which to search.
  8822. @end table
  8823. @subsection Examples
  8824. @itemize
  8825. @item
  8826. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8827. @example
  8828. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8829. @end example
  8830. @end itemize
  8831. @section floodfill
  8832. Flood area with values of same pixel components with another values.
  8833. It accepts the following options:
  8834. @table @option
  8835. @item x
  8836. Set pixel x coordinate.
  8837. @item y
  8838. Set pixel y coordinate.
  8839. @item s0
  8840. Set source #0 component value.
  8841. @item s1
  8842. Set source #1 component value.
  8843. @item s2
  8844. Set source #2 component value.
  8845. @item s3
  8846. Set source #3 component value.
  8847. @item d0
  8848. Set destination #0 component value.
  8849. @item d1
  8850. Set destination #1 component value.
  8851. @item d2
  8852. Set destination #2 component value.
  8853. @item d3
  8854. Set destination #3 component value.
  8855. @end table
  8856. @anchor{format}
  8857. @section format
  8858. Convert the input video to one of the specified pixel formats.
  8859. Libavfilter will try to pick one that is suitable as input to
  8860. the next filter.
  8861. It accepts the following parameters:
  8862. @table @option
  8863. @item pix_fmts
  8864. A '|'-separated list of pixel format names, such as
  8865. "pix_fmts=yuv420p|monow|rgb24".
  8866. @end table
  8867. @subsection Examples
  8868. @itemize
  8869. @item
  8870. Convert the input video to the @var{yuv420p} format
  8871. @example
  8872. format=pix_fmts=yuv420p
  8873. @end example
  8874. Convert the input video to any of the formats in the list
  8875. @example
  8876. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8877. @end example
  8878. @end itemize
  8879. @anchor{fps}
  8880. @section fps
  8881. Convert the video to specified constant frame rate by duplicating or dropping
  8882. frames as necessary.
  8883. It accepts the following parameters:
  8884. @table @option
  8885. @item fps
  8886. The desired output frame rate. The default is @code{25}.
  8887. @item start_time
  8888. Assume the first PTS should be the given value, in seconds. This allows for
  8889. padding/trimming at the start of stream. By default, no assumption is made
  8890. about the first frame's expected PTS, so no padding or trimming is done.
  8891. For example, this could be set to 0 to pad the beginning with duplicates of
  8892. the first frame if a video stream starts after the audio stream or to trim any
  8893. frames with a negative PTS.
  8894. @item round
  8895. Timestamp (PTS) rounding method.
  8896. Possible values are:
  8897. @table @option
  8898. @item zero
  8899. round towards 0
  8900. @item inf
  8901. round away from 0
  8902. @item down
  8903. round towards -infinity
  8904. @item up
  8905. round towards +infinity
  8906. @item near
  8907. round to nearest
  8908. @end table
  8909. The default is @code{near}.
  8910. @item eof_action
  8911. Action performed when reading the last frame.
  8912. Possible values are:
  8913. @table @option
  8914. @item round
  8915. Use same timestamp rounding method as used for other frames.
  8916. @item pass
  8917. Pass through last frame if input duration has not been reached yet.
  8918. @end table
  8919. The default is @code{round}.
  8920. @end table
  8921. Alternatively, the options can be specified as a flat string:
  8922. @var{fps}[:@var{start_time}[:@var{round}]].
  8923. See also the @ref{setpts} filter.
  8924. @subsection Examples
  8925. @itemize
  8926. @item
  8927. A typical usage in order to set the fps to 25:
  8928. @example
  8929. fps=fps=25
  8930. @end example
  8931. @item
  8932. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8933. @example
  8934. fps=fps=film:round=near
  8935. @end example
  8936. @end itemize
  8937. @section framepack
  8938. Pack two different video streams into a stereoscopic video, setting proper
  8939. metadata on supported codecs. The two views should have the same size and
  8940. framerate and processing will stop when the shorter video ends. Please note
  8941. that you may conveniently adjust view properties with the @ref{scale} and
  8942. @ref{fps} filters.
  8943. It accepts the following parameters:
  8944. @table @option
  8945. @item format
  8946. The desired packing format. Supported values are:
  8947. @table @option
  8948. @item sbs
  8949. The views are next to each other (default).
  8950. @item tab
  8951. The views are on top of each other.
  8952. @item lines
  8953. The views are packed by line.
  8954. @item columns
  8955. The views are packed by column.
  8956. @item frameseq
  8957. The views are temporally interleaved.
  8958. @end table
  8959. @end table
  8960. Some examples:
  8961. @example
  8962. # Convert left and right views into a frame-sequential video
  8963. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8964. # Convert views into a side-by-side video with the same output resolution as the input
  8965. 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
  8966. @end example
  8967. @section framerate
  8968. Change the frame rate by interpolating new video output frames from the source
  8969. frames.
  8970. This filter is not designed to function correctly with interlaced media. If
  8971. you wish to change the frame rate of interlaced media then you are required
  8972. to deinterlace before this filter and re-interlace after this filter.
  8973. A description of the accepted options follows.
  8974. @table @option
  8975. @item fps
  8976. Specify the output frames per second. This option can also be specified
  8977. as a value alone. The default is @code{50}.
  8978. @item interp_start
  8979. Specify the start of a range where the output frame will be created as a
  8980. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8981. the default is @code{15}.
  8982. @item interp_end
  8983. Specify the end of a range where the output frame will be created as a
  8984. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8985. the default is @code{240}.
  8986. @item scene
  8987. Specify the level at which a scene change is detected as a value between
  8988. 0 and 100 to indicate a new scene; a low value reflects a low
  8989. probability for the current frame to introduce a new scene, while a higher
  8990. value means the current frame is more likely to be one.
  8991. The default is @code{8.2}.
  8992. @item flags
  8993. Specify flags influencing the filter process.
  8994. Available value for @var{flags} is:
  8995. @table @option
  8996. @item scene_change_detect, scd
  8997. Enable scene change detection using the value of the option @var{scene}.
  8998. This flag is enabled by default.
  8999. @end table
  9000. @end table
  9001. @section framestep
  9002. Select one frame every N-th frame.
  9003. This filter accepts the following option:
  9004. @table @option
  9005. @item step
  9006. Select frame after every @code{step} frames.
  9007. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9008. @end table
  9009. @section freezedetect
  9010. Detect frozen video.
  9011. This filter logs a message and sets frame metadata when it detects that the
  9012. input video has no significant change in content during a specified duration.
  9013. Video freeze detection calculates the mean average absolute difference of all
  9014. the components of video frames and compares it to a noise floor.
  9015. The printed times and duration are expressed in seconds. The
  9016. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9017. whose timestamp equals or exceeds the detection duration and it contains the
  9018. timestamp of the first frame of the freeze. The
  9019. @code{lavfi.freezedetect.freeze_duration} and
  9020. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9021. after the freeze.
  9022. The filter accepts the following options:
  9023. @table @option
  9024. @item noise, n
  9025. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9026. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9027. 0.001.
  9028. @item duration, d
  9029. Set freeze duration until notification (default is 2 seconds).
  9030. @end table
  9031. @section freezeframes
  9032. Freeze video frames.
  9033. This filter freezes video frames using frame from 2nd input.
  9034. The filter accepts the following options:
  9035. @table @option
  9036. @item first
  9037. Set number of first frame from which to start freeze.
  9038. @item last
  9039. Set number of last frame from which to end freeze.
  9040. @item replace
  9041. Set number of frame from 2nd input which will be used instead of replaced frames.
  9042. @end table
  9043. @anchor{frei0r}
  9044. @section frei0r
  9045. Apply a frei0r effect to the input video.
  9046. To enable the compilation of this filter, you need to install the frei0r
  9047. header and configure FFmpeg with @code{--enable-frei0r}.
  9048. It accepts the following parameters:
  9049. @table @option
  9050. @item filter_name
  9051. The name of the frei0r effect to load. If the environment variable
  9052. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9053. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9054. Otherwise, the standard frei0r paths are searched, in this order:
  9055. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9056. @file{/usr/lib/frei0r-1/}.
  9057. @item filter_params
  9058. A '|'-separated list of parameters to pass to the frei0r effect.
  9059. @end table
  9060. A frei0r effect parameter can be a boolean (its value is either
  9061. "y" or "n"), a double, a color (specified as
  9062. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9063. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9064. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9065. a position (specified as @var{X}/@var{Y}, where
  9066. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9067. The number and types of parameters depend on the loaded effect. If an
  9068. effect parameter is not specified, the default value is set.
  9069. @subsection Examples
  9070. @itemize
  9071. @item
  9072. Apply the distort0r effect, setting the first two double parameters:
  9073. @example
  9074. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9075. @end example
  9076. @item
  9077. Apply the colordistance effect, taking a color as the first parameter:
  9078. @example
  9079. frei0r=colordistance:0.2/0.3/0.4
  9080. frei0r=colordistance:violet
  9081. frei0r=colordistance:0x112233
  9082. @end example
  9083. @item
  9084. Apply the perspective effect, specifying the top left and top right image
  9085. positions:
  9086. @example
  9087. frei0r=perspective:0.2/0.2|0.8/0.2
  9088. @end example
  9089. @end itemize
  9090. For more information, see
  9091. @url{http://frei0r.dyne.org}
  9092. @subsection Commands
  9093. This filter supports the @option{filter_params} option as @ref{commands}.
  9094. @section fspp
  9095. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9096. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9097. processing filter, one of them is performed once per block, not per pixel.
  9098. This allows for much higher speed.
  9099. The filter accepts the following options:
  9100. @table @option
  9101. @item quality
  9102. Set quality. This option defines the number of levels for averaging. It accepts
  9103. an integer in the range 4-5. Default value is @code{4}.
  9104. @item qp
  9105. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9106. If not set, the filter will use the QP from the video stream (if available).
  9107. @item strength
  9108. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9109. more details but also more artifacts, while higher values make the image smoother
  9110. but also blurrier. Default value is @code{0} − PSNR optimal.
  9111. @item use_bframe_qp
  9112. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9113. option may cause flicker since the B-Frames have often larger QP. Default is
  9114. @code{0} (not enabled).
  9115. @end table
  9116. @section gblur
  9117. Apply Gaussian blur filter.
  9118. The filter accepts the following options:
  9119. @table @option
  9120. @item sigma
  9121. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9122. @item steps
  9123. Set number of steps for Gaussian approximation. Default is @code{1}.
  9124. @item planes
  9125. Set which planes to filter. By default all planes are filtered.
  9126. @item sigmaV
  9127. Set vertical sigma, if negative it will be same as @code{sigma}.
  9128. Default is @code{-1}.
  9129. @end table
  9130. @subsection Commands
  9131. This filter supports same commands as options.
  9132. The command accepts the same syntax of the corresponding option.
  9133. If the specified expression is not valid, it is kept at its current
  9134. value.
  9135. @section geq
  9136. Apply generic equation to each pixel.
  9137. The filter accepts the following options:
  9138. @table @option
  9139. @item lum_expr, lum
  9140. Set the luminance expression.
  9141. @item cb_expr, cb
  9142. Set the chrominance blue expression.
  9143. @item cr_expr, cr
  9144. Set the chrominance red expression.
  9145. @item alpha_expr, a
  9146. Set the alpha expression.
  9147. @item red_expr, r
  9148. Set the red expression.
  9149. @item green_expr, g
  9150. Set the green expression.
  9151. @item blue_expr, b
  9152. Set the blue expression.
  9153. @end table
  9154. The colorspace is selected according to the specified options. If one
  9155. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9156. options is specified, the filter will automatically select a YCbCr
  9157. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9158. @option{blue_expr} options is specified, it will select an RGB
  9159. colorspace.
  9160. If one of the chrominance expression is not defined, it falls back on the other
  9161. one. If no alpha expression is specified it will evaluate to opaque value.
  9162. If none of chrominance expressions are specified, they will evaluate
  9163. to the luminance expression.
  9164. The expressions can use the following variables and functions:
  9165. @table @option
  9166. @item N
  9167. The sequential number of the filtered frame, starting from @code{0}.
  9168. @item X
  9169. @item Y
  9170. The coordinates of the current sample.
  9171. @item W
  9172. @item H
  9173. The width and height of the image.
  9174. @item SW
  9175. @item SH
  9176. Width and height scale depending on the currently filtered plane. It is the
  9177. ratio between the corresponding luma plane number of pixels and the current
  9178. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9179. @code{0.5,0.5} for chroma planes.
  9180. @item T
  9181. Time of the current frame, expressed in seconds.
  9182. @item p(x, y)
  9183. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9184. plane.
  9185. @item lum(x, y)
  9186. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9187. plane.
  9188. @item cb(x, y)
  9189. Return the value of the pixel at location (@var{x},@var{y}) of the
  9190. blue-difference chroma plane. Return 0 if there is no such plane.
  9191. @item cr(x, y)
  9192. Return the value of the pixel at location (@var{x},@var{y}) of the
  9193. red-difference chroma plane. Return 0 if there is no such plane.
  9194. @item r(x, y)
  9195. @item g(x, y)
  9196. @item b(x, y)
  9197. Return the value of the pixel at location (@var{x},@var{y}) of the
  9198. red/green/blue component. Return 0 if there is no such component.
  9199. @item alpha(x, y)
  9200. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9201. plane. Return 0 if there is no such plane.
  9202. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  9203. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9204. sums of samples within a rectangle. See the functions without the sum postfix.
  9205. @item interpolation
  9206. Set one of interpolation methods:
  9207. @table @option
  9208. @item nearest, n
  9209. @item bilinear, b
  9210. @end table
  9211. Default is bilinear.
  9212. @end table
  9213. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9214. automatically clipped to the closer edge.
  9215. Please note that this filter can use multiple threads in which case each slice
  9216. will have its own expression state. If you want to use only a single expression
  9217. state because your expressions depend on previous state then you should limit
  9218. the number of filter threads to 1.
  9219. @subsection Examples
  9220. @itemize
  9221. @item
  9222. Flip the image horizontally:
  9223. @example
  9224. geq=p(W-X\,Y)
  9225. @end example
  9226. @item
  9227. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9228. wavelength of 100 pixels:
  9229. @example
  9230. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9231. @end example
  9232. @item
  9233. Generate a fancy enigmatic moving light:
  9234. @example
  9235. 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
  9236. @end example
  9237. @item
  9238. Generate a quick emboss effect:
  9239. @example
  9240. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9241. @end example
  9242. @item
  9243. Modify RGB components depending on pixel position:
  9244. @example
  9245. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9246. @end example
  9247. @item
  9248. Create a radial gradient that is the same size as the input (also see
  9249. the @ref{vignette} filter):
  9250. @example
  9251. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9252. @end example
  9253. @end itemize
  9254. @section gradfun
  9255. Fix the banding artifacts that are sometimes introduced into nearly flat
  9256. regions by truncation to 8-bit color depth.
  9257. Interpolate the gradients that should go where the bands are, and
  9258. dither them.
  9259. It is designed for playback only. Do not use it prior to
  9260. lossy compression, because compression tends to lose the dither and
  9261. bring back the bands.
  9262. It accepts the following parameters:
  9263. @table @option
  9264. @item strength
  9265. The maximum amount by which the filter will change any one pixel. This is also
  9266. the threshold for detecting nearly flat regions. Acceptable values range from
  9267. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9268. valid range.
  9269. @item radius
  9270. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9271. gradients, but also prevents the filter from modifying the pixels near detailed
  9272. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9273. values will be clipped to the valid range.
  9274. @end table
  9275. Alternatively, the options can be specified as a flat string:
  9276. @var{strength}[:@var{radius}]
  9277. @subsection Examples
  9278. @itemize
  9279. @item
  9280. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9281. @example
  9282. gradfun=3.5:8
  9283. @end example
  9284. @item
  9285. Specify radius, omitting the strength (which will fall-back to the default
  9286. value):
  9287. @example
  9288. gradfun=radius=8
  9289. @end example
  9290. @end itemize
  9291. @anchor{graphmonitor}
  9292. @section graphmonitor
  9293. Show various filtergraph stats.
  9294. With this filter one can debug complete filtergraph.
  9295. Especially issues with links filling with queued frames.
  9296. The filter accepts the following options:
  9297. @table @option
  9298. @item size, s
  9299. Set video output size. Default is @var{hd720}.
  9300. @item opacity, o
  9301. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9302. @item mode, m
  9303. Set output mode, can be @var{fulll} or @var{compact}.
  9304. In @var{compact} mode only filters with some queued frames have displayed stats.
  9305. @item flags, f
  9306. Set flags which enable which stats are shown in video.
  9307. Available values for flags are:
  9308. @table @samp
  9309. @item queue
  9310. Display number of queued frames in each link.
  9311. @item frame_count_in
  9312. Display number of frames taken from filter.
  9313. @item frame_count_out
  9314. Display number of frames given out from filter.
  9315. @item pts
  9316. Display current filtered frame pts.
  9317. @item time
  9318. Display current filtered frame time.
  9319. @item timebase
  9320. Display time base for filter link.
  9321. @item format
  9322. Display used format for filter link.
  9323. @item size
  9324. Display video size or number of audio channels in case of audio used by filter link.
  9325. @item rate
  9326. Display video frame rate or sample rate in case of audio used by filter link.
  9327. @item eof
  9328. Display link output status.
  9329. @end table
  9330. @item rate, r
  9331. Set upper limit for video rate of output stream, Default value is @var{25}.
  9332. This guarantee that output video frame rate will not be higher than this value.
  9333. @end table
  9334. @section greyedge
  9335. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9336. and corrects the scene colors accordingly.
  9337. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9338. The filter accepts the following options:
  9339. @table @option
  9340. @item difford
  9341. The order of differentiation to be applied on the scene. Must be chosen in the range
  9342. [0,2] and default value is 1.
  9343. @item minknorm
  9344. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9345. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9346. max value instead of calculating Minkowski distance.
  9347. @item sigma
  9348. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9349. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9350. can't be equal to 0 if @var{difford} is greater than 0.
  9351. @end table
  9352. @subsection Examples
  9353. @itemize
  9354. @item
  9355. Grey Edge:
  9356. @example
  9357. greyedge=difford=1:minknorm=5:sigma=2
  9358. @end example
  9359. @item
  9360. Max Edge:
  9361. @example
  9362. greyedge=difford=1:minknorm=0:sigma=2
  9363. @end example
  9364. @end itemize
  9365. @anchor{haldclut}
  9366. @section haldclut
  9367. Apply a Hald CLUT to a video stream.
  9368. First input is the video stream to process, and second one is the Hald CLUT.
  9369. The Hald CLUT input can be a simple picture or a complete video stream.
  9370. The filter accepts the following options:
  9371. @table @option
  9372. @item shortest
  9373. Force termination when the shortest input terminates. Default is @code{0}.
  9374. @item repeatlast
  9375. Continue applying the last CLUT after the end of the stream. A value of
  9376. @code{0} disable the filter after the last frame of the CLUT is reached.
  9377. Default is @code{1}.
  9378. @end table
  9379. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9380. filters share the same internals).
  9381. This filter also supports the @ref{framesync} options.
  9382. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9383. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9384. @subsection Workflow examples
  9385. @subsubsection Hald CLUT video stream
  9386. Generate an identity Hald CLUT stream altered with various effects:
  9387. @example
  9388. 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
  9389. @end example
  9390. Note: make sure you use a lossless codec.
  9391. Then use it with @code{haldclut} to apply it on some random stream:
  9392. @example
  9393. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9394. @end example
  9395. The Hald CLUT will be applied to the 10 first seconds (duration of
  9396. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9397. to the remaining frames of the @code{mandelbrot} stream.
  9398. @subsubsection Hald CLUT with preview
  9399. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9400. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9401. biggest possible square starting at the top left of the picture. The remaining
  9402. padding pixels (bottom or right) will be ignored. This area can be used to add
  9403. a preview of the Hald CLUT.
  9404. Typically, the following generated Hald CLUT will be supported by the
  9405. @code{haldclut} filter:
  9406. @example
  9407. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9408. pad=iw+320 [padded_clut];
  9409. smptebars=s=320x256, split [a][b];
  9410. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9411. [main][b] overlay=W-320" -frames:v 1 clut.png
  9412. @end example
  9413. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9414. bars are displayed on the right-top, and below the same color bars processed by
  9415. the color changes.
  9416. Then, the effect of this Hald CLUT can be visualized with:
  9417. @example
  9418. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9419. @end example
  9420. @section hflip
  9421. Flip the input video horizontally.
  9422. For example, to horizontally flip the input video with @command{ffmpeg}:
  9423. @example
  9424. ffmpeg -i in.avi -vf "hflip" out.avi
  9425. @end example
  9426. @section histeq
  9427. This filter applies a global color histogram equalization on a
  9428. per-frame basis.
  9429. It can be used to correct video that has a compressed range of pixel
  9430. intensities. The filter redistributes the pixel intensities to
  9431. equalize their distribution across the intensity range. It may be
  9432. viewed as an "automatically adjusting contrast filter". This filter is
  9433. useful only for correcting degraded or poorly captured source
  9434. video.
  9435. The filter accepts the following options:
  9436. @table @option
  9437. @item strength
  9438. Determine the amount of equalization to be applied. As the strength
  9439. is reduced, the distribution of pixel intensities more-and-more
  9440. approaches that of the input frame. The value must be a float number
  9441. in the range [0,1] and defaults to 0.200.
  9442. @item intensity
  9443. Set the maximum intensity that can generated and scale the output
  9444. values appropriately. The strength should be set as desired and then
  9445. the intensity can be limited if needed to avoid washing-out. The value
  9446. must be a float number in the range [0,1] and defaults to 0.210.
  9447. @item antibanding
  9448. Set the antibanding level. If enabled the filter will randomly vary
  9449. the luminance of output pixels by a small amount to avoid banding of
  9450. the histogram. Possible values are @code{none}, @code{weak} or
  9451. @code{strong}. It defaults to @code{none}.
  9452. @end table
  9453. @anchor{histogram}
  9454. @section histogram
  9455. Compute and draw a color distribution histogram for the input video.
  9456. The computed histogram is a representation of the color component
  9457. distribution in an image.
  9458. Standard histogram displays the color components distribution in an image.
  9459. Displays color graph for each color component. Shows distribution of
  9460. the Y, U, V, A or R, G, B components, depending on input format, in the
  9461. current frame. Below each graph a color component scale meter is shown.
  9462. The filter accepts the following options:
  9463. @table @option
  9464. @item level_height
  9465. Set height of level. Default value is @code{200}.
  9466. Allowed range is [50, 2048].
  9467. @item scale_height
  9468. Set height of color scale. Default value is @code{12}.
  9469. Allowed range is [0, 40].
  9470. @item display_mode
  9471. Set display mode.
  9472. It accepts the following values:
  9473. @table @samp
  9474. @item stack
  9475. Per color component graphs are placed below each other.
  9476. @item parade
  9477. Per color component graphs are placed side by side.
  9478. @item overlay
  9479. Presents information identical to that in the @code{parade}, except
  9480. that the graphs representing color components are superimposed directly
  9481. over one another.
  9482. @end table
  9483. Default is @code{stack}.
  9484. @item levels_mode
  9485. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9486. Default is @code{linear}.
  9487. @item components
  9488. Set what color components to display.
  9489. Default is @code{7}.
  9490. @item fgopacity
  9491. Set foreground opacity. Default is @code{0.7}.
  9492. @item bgopacity
  9493. Set background opacity. Default is @code{0.5}.
  9494. @end table
  9495. @subsection Examples
  9496. @itemize
  9497. @item
  9498. Calculate and draw histogram:
  9499. @example
  9500. ffplay -i input -vf histogram
  9501. @end example
  9502. @end itemize
  9503. @anchor{hqdn3d}
  9504. @section hqdn3d
  9505. This is a high precision/quality 3d denoise filter. It aims to reduce
  9506. image noise, producing smooth images and making still images really
  9507. still. It should enhance compressibility.
  9508. It accepts the following optional parameters:
  9509. @table @option
  9510. @item luma_spatial
  9511. A non-negative floating point number which specifies spatial luma strength.
  9512. It defaults to 4.0.
  9513. @item chroma_spatial
  9514. A non-negative floating point number which specifies spatial chroma strength.
  9515. It defaults to 3.0*@var{luma_spatial}/4.0.
  9516. @item luma_tmp
  9517. A floating point number which specifies luma temporal strength. It defaults to
  9518. 6.0*@var{luma_spatial}/4.0.
  9519. @item chroma_tmp
  9520. A floating point number which specifies chroma temporal strength. It defaults to
  9521. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9522. @end table
  9523. @subsection Commands
  9524. This filter supports same @ref{commands} as options.
  9525. The command accepts the same syntax of the corresponding option.
  9526. If the specified expression is not valid, it is kept at its current
  9527. value.
  9528. @anchor{hwdownload}
  9529. @section hwdownload
  9530. Download hardware frames to system memory.
  9531. The input must be in hardware frames, and the output a non-hardware format.
  9532. Not all formats will be supported on the output - it may be necessary to insert
  9533. an additional @option{format} filter immediately following in the graph to get
  9534. the output in a supported format.
  9535. @section hwmap
  9536. Map hardware frames to system memory or to another device.
  9537. This filter has several different modes of operation; which one is used depends
  9538. on the input and output formats:
  9539. @itemize
  9540. @item
  9541. Hardware frame input, normal frame output
  9542. Map the input frames to system memory and pass them to the output. If the
  9543. original hardware frame is later required (for example, after overlaying
  9544. something else on part of it), the @option{hwmap} filter can be used again
  9545. in the next mode to retrieve it.
  9546. @item
  9547. Normal frame input, hardware frame output
  9548. If the input is actually a software-mapped hardware frame, then unmap it -
  9549. that is, return the original hardware frame.
  9550. Otherwise, a device must be provided. Create new hardware surfaces on that
  9551. device for the output, then map them back to the software format at the input
  9552. and give those frames to the preceding filter. This will then act like the
  9553. @option{hwupload} filter, but may be able to avoid an additional copy when
  9554. the input is already in a compatible format.
  9555. @item
  9556. Hardware frame input and output
  9557. A device must be supplied for the output, either directly or with the
  9558. @option{derive_device} option. The input and output devices must be of
  9559. different types and compatible - the exact meaning of this is
  9560. system-dependent, but typically it means that they must refer to the same
  9561. underlying hardware context (for example, refer to the same graphics card).
  9562. If the input frames were originally created on the output device, then unmap
  9563. to retrieve the original frames.
  9564. Otherwise, map the frames to the output device - create new hardware frames
  9565. on the output corresponding to the frames on the input.
  9566. @end itemize
  9567. The following additional parameters are accepted:
  9568. @table @option
  9569. @item mode
  9570. Set the frame mapping mode. Some combination of:
  9571. @table @var
  9572. @item read
  9573. The mapped frame should be readable.
  9574. @item write
  9575. The mapped frame should be writeable.
  9576. @item overwrite
  9577. The mapping will always overwrite the entire frame.
  9578. This may improve performance in some cases, as the original contents of the
  9579. frame need not be loaded.
  9580. @item direct
  9581. The mapping must not involve any copying.
  9582. Indirect mappings to copies of frames are created in some cases where either
  9583. direct mapping is not possible or it would have unexpected properties.
  9584. Setting this flag ensures that the mapping is direct and will fail if that is
  9585. not possible.
  9586. @end table
  9587. Defaults to @var{read+write} if not specified.
  9588. @item derive_device @var{type}
  9589. Rather than using the device supplied at initialisation, instead derive a new
  9590. device of type @var{type} from the device the input frames exist on.
  9591. @item reverse
  9592. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9593. and map them back to the source. This may be necessary in some cases where
  9594. a mapping in one direction is required but only the opposite direction is
  9595. supported by the devices being used.
  9596. This option is dangerous - it may break the preceding filter in undefined
  9597. ways if there are any additional constraints on that filter's output.
  9598. Do not use it without fully understanding the implications of its use.
  9599. @end table
  9600. @anchor{hwupload}
  9601. @section hwupload
  9602. Upload system memory frames to hardware surfaces.
  9603. The device to upload to must be supplied when the filter is initialised. If
  9604. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9605. option or with the @option{derive_device} option. The input and output devices
  9606. must be of different types and compatible - the exact meaning of this is
  9607. system-dependent, but typically it means that they must refer to the same
  9608. underlying hardware context (for example, refer to the same graphics card).
  9609. The following additional parameters are accepted:
  9610. @table @option
  9611. @item derive_device @var{type}
  9612. Rather than using the device supplied at initialisation, instead derive a new
  9613. device of type @var{type} from the device the input frames exist on.
  9614. @end table
  9615. @anchor{hwupload_cuda}
  9616. @section hwupload_cuda
  9617. Upload system memory frames to a CUDA device.
  9618. It accepts the following optional parameters:
  9619. @table @option
  9620. @item device
  9621. The number of the CUDA device to use
  9622. @end table
  9623. @section hqx
  9624. Apply a high-quality magnification filter designed for pixel art. This filter
  9625. was originally created by Maxim Stepin.
  9626. It accepts the following option:
  9627. @table @option
  9628. @item n
  9629. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9630. @code{hq3x} and @code{4} for @code{hq4x}.
  9631. Default is @code{3}.
  9632. @end table
  9633. @section hstack
  9634. Stack input videos horizontally.
  9635. All streams must be of same pixel format and of same height.
  9636. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9637. to create same output.
  9638. The filter accepts the following option:
  9639. @table @option
  9640. @item inputs
  9641. Set number of input streams. Default is 2.
  9642. @item shortest
  9643. If set to 1, force the output to terminate when the shortest input
  9644. terminates. Default value is 0.
  9645. @end table
  9646. @section hue
  9647. Modify the hue and/or the saturation of the input.
  9648. It accepts the following parameters:
  9649. @table @option
  9650. @item h
  9651. Specify the hue angle as a number of degrees. It accepts an expression,
  9652. and defaults to "0".
  9653. @item s
  9654. Specify the saturation in the [-10,10] range. It accepts an expression and
  9655. defaults to "1".
  9656. @item H
  9657. Specify the hue angle as a number of radians. It accepts an
  9658. expression, and defaults to "0".
  9659. @item b
  9660. Specify the brightness in the [-10,10] range. It accepts an expression and
  9661. defaults to "0".
  9662. @end table
  9663. @option{h} and @option{H} are mutually exclusive, and can't be
  9664. specified at the same time.
  9665. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9666. expressions containing the following constants:
  9667. @table @option
  9668. @item n
  9669. frame count of the input frame starting from 0
  9670. @item pts
  9671. presentation timestamp of the input frame expressed in time base units
  9672. @item r
  9673. frame rate of the input video, NAN if the input frame rate is unknown
  9674. @item t
  9675. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9676. @item tb
  9677. time base of the input video
  9678. @end table
  9679. @subsection Examples
  9680. @itemize
  9681. @item
  9682. Set the hue to 90 degrees and the saturation to 1.0:
  9683. @example
  9684. hue=h=90:s=1
  9685. @end example
  9686. @item
  9687. Same command but expressing the hue in radians:
  9688. @example
  9689. hue=H=PI/2:s=1
  9690. @end example
  9691. @item
  9692. Rotate hue and make the saturation swing between 0
  9693. and 2 over a period of 1 second:
  9694. @example
  9695. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9696. @end example
  9697. @item
  9698. Apply a 3 seconds saturation fade-in effect starting at 0:
  9699. @example
  9700. hue="s=min(t/3\,1)"
  9701. @end example
  9702. The general fade-in expression can be written as:
  9703. @example
  9704. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9705. @end example
  9706. @item
  9707. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9708. @example
  9709. hue="s=max(0\, min(1\, (8-t)/3))"
  9710. @end example
  9711. The general fade-out expression can be written as:
  9712. @example
  9713. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9714. @end example
  9715. @end itemize
  9716. @subsection Commands
  9717. This filter supports the following commands:
  9718. @table @option
  9719. @item b
  9720. @item s
  9721. @item h
  9722. @item H
  9723. Modify the hue and/or the saturation and/or brightness of the input video.
  9724. The command accepts the same syntax of the corresponding option.
  9725. If the specified expression is not valid, it is kept at its current
  9726. value.
  9727. @end table
  9728. @section hysteresis
  9729. Grow first stream into second stream by connecting components.
  9730. This makes it possible to build more robust edge masks.
  9731. This filter accepts the following options:
  9732. @table @option
  9733. @item planes
  9734. Set which planes will be processed as bitmap, unprocessed planes will be
  9735. copied from first stream.
  9736. By default value 0xf, all planes will be processed.
  9737. @item threshold
  9738. Set threshold which is used in filtering. If pixel component value is higher than
  9739. this value filter algorithm for connecting components is activated.
  9740. By default value is 0.
  9741. @end table
  9742. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9743. @section idet
  9744. Detect video interlacing type.
  9745. This filter tries to detect if the input frames are interlaced, progressive,
  9746. top or bottom field first. It will also try to detect fields that are
  9747. repeated between adjacent frames (a sign of telecine).
  9748. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9749. Multiple frame detection incorporates the classification history of previous frames.
  9750. The filter will log these metadata values:
  9751. @table @option
  9752. @item single.current_frame
  9753. Detected type of current frame using single-frame detection. One of:
  9754. ``tff'' (top field first), ``bff'' (bottom field first),
  9755. ``progressive'', or ``undetermined''
  9756. @item single.tff
  9757. Cumulative number of frames detected as top field first using single-frame detection.
  9758. @item multiple.tff
  9759. Cumulative number of frames detected as top field first using multiple-frame detection.
  9760. @item single.bff
  9761. Cumulative number of frames detected as bottom field first using single-frame detection.
  9762. @item multiple.current_frame
  9763. Detected type of current frame using multiple-frame detection. One of:
  9764. ``tff'' (top field first), ``bff'' (bottom field first),
  9765. ``progressive'', or ``undetermined''
  9766. @item multiple.bff
  9767. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9768. @item single.progressive
  9769. Cumulative number of frames detected as progressive using single-frame detection.
  9770. @item multiple.progressive
  9771. Cumulative number of frames detected as progressive using multiple-frame detection.
  9772. @item single.undetermined
  9773. Cumulative number of frames that could not be classified using single-frame detection.
  9774. @item multiple.undetermined
  9775. Cumulative number of frames that could not be classified using multiple-frame detection.
  9776. @item repeated.current_frame
  9777. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9778. @item repeated.neither
  9779. Cumulative number of frames with no repeated field.
  9780. @item repeated.top
  9781. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9782. @item repeated.bottom
  9783. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9784. @end table
  9785. The filter accepts the following options:
  9786. @table @option
  9787. @item intl_thres
  9788. Set interlacing threshold.
  9789. @item prog_thres
  9790. Set progressive threshold.
  9791. @item rep_thres
  9792. Threshold for repeated field detection.
  9793. @item half_life
  9794. Number of frames after which a given frame's contribution to the
  9795. statistics is halved (i.e., it contributes only 0.5 to its
  9796. classification). The default of 0 means that all frames seen are given
  9797. full weight of 1.0 forever.
  9798. @item analyze_interlaced_flag
  9799. When this is not 0 then idet will use the specified number of frames to determine
  9800. if the interlaced flag is accurate, it will not count undetermined frames.
  9801. If the flag is found to be accurate it will be used without any further
  9802. computations, if it is found to be inaccurate it will be cleared without any
  9803. further computations. This allows inserting the idet filter as a low computational
  9804. method to clean up the interlaced flag
  9805. @end table
  9806. @section il
  9807. Deinterleave or interleave fields.
  9808. This filter allows one to process interlaced images fields without
  9809. deinterlacing them. Deinterleaving splits the input frame into 2
  9810. fields (so called half pictures). Odd lines are moved to the top
  9811. half of the output image, even lines to the bottom half.
  9812. You can process (filter) them independently and then re-interleave them.
  9813. The filter accepts the following options:
  9814. @table @option
  9815. @item luma_mode, l
  9816. @item chroma_mode, c
  9817. @item alpha_mode, a
  9818. Available values for @var{luma_mode}, @var{chroma_mode} and
  9819. @var{alpha_mode} are:
  9820. @table @samp
  9821. @item none
  9822. Do nothing.
  9823. @item deinterleave, d
  9824. Deinterleave fields, placing one above the other.
  9825. @item interleave, i
  9826. Interleave fields. Reverse the effect of deinterleaving.
  9827. @end table
  9828. Default value is @code{none}.
  9829. @item luma_swap, ls
  9830. @item chroma_swap, cs
  9831. @item alpha_swap, as
  9832. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9833. @end table
  9834. @subsection Commands
  9835. This filter supports the all above options as @ref{commands}.
  9836. @section inflate
  9837. Apply inflate effect to the video.
  9838. This filter replaces the pixel by the local(3x3) average by taking into account
  9839. only values higher than the pixel.
  9840. It accepts the following options:
  9841. @table @option
  9842. @item threshold0
  9843. @item threshold1
  9844. @item threshold2
  9845. @item threshold3
  9846. Limit the maximum change for each plane, default is 65535.
  9847. If 0, plane will remain unchanged.
  9848. @end table
  9849. @subsection Commands
  9850. This filter supports the all above options as @ref{commands}.
  9851. @section interlace
  9852. Simple interlacing filter from progressive contents. This interleaves upper (or
  9853. lower) lines from odd frames with lower (or upper) lines from even frames,
  9854. halving the frame rate and preserving image height.
  9855. @example
  9856. Original Original New Frame
  9857. Frame 'j' Frame 'j+1' (tff)
  9858. ========== =========== ==================
  9859. Line 0 --------------------> Frame 'j' Line 0
  9860. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9861. Line 2 ---------------------> Frame 'j' Line 2
  9862. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9863. ... ... ...
  9864. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9865. @end example
  9866. It accepts the following optional parameters:
  9867. @table @option
  9868. @item scan
  9869. This determines whether the interlaced frame is taken from the even
  9870. (tff - default) or odd (bff) lines of the progressive frame.
  9871. @item lowpass
  9872. Vertical lowpass filter to avoid twitter interlacing and
  9873. reduce moire patterns.
  9874. @table @samp
  9875. @item 0, off
  9876. Disable vertical lowpass filter
  9877. @item 1, linear
  9878. Enable linear filter (default)
  9879. @item 2, complex
  9880. Enable complex filter. This will slightly less reduce twitter and moire
  9881. but better retain detail and subjective sharpness impression.
  9882. @end table
  9883. @end table
  9884. @section kerndeint
  9885. Deinterlace input video by applying Donald Graft's adaptive kernel
  9886. deinterling. Work on interlaced parts of a video to produce
  9887. progressive frames.
  9888. The description of the accepted parameters follows.
  9889. @table @option
  9890. @item thresh
  9891. Set the threshold which affects the filter's tolerance when
  9892. determining if a pixel line must be processed. It must be an integer
  9893. in the range [0,255] and defaults to 10. A value of 0 will result in
  9894. applying the process on every pixels.
  9895. @item map
  9896. Paint pixels exceeding the threshold value to white if set to 1.
  9897. Default is 0.
  9898. @item order
  9899. Set the fields order. Swap fields if set to 1, leave fields alone if
  9900. 0. Default is 0.
  9901. @item sharp
  9902. Enable additional sharpening if set to 1. Default is 0.
  9903. @item twoway
  9904. Enable twoway sharpening if set to 1. Default is 0.
  9905. @end table
  9906. @subsection Examples
  9907. @itemize
  9908. @item
  9909. Apply default values:
  9910. @example
  9911. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9912. @end example
  9913. @item
  9914. Enable additional sharpening:
  9915. @example
  9916. kerndeint=sharp=1
  9917. @end example
  9918. @item
  9919. Paint processed pixels in white:
  9920. @example
  9921. kerndeint=map=1
  9922. @end example
  9923. @end itemize
  9924. @section lagfun
  9925. Slowly update darker pixels.
  9926. This filter makes short flashes of light appear longer.
  9927. This filter accepts the following options:
  9928. @table @option
  9929. @item decay
  9930. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9931. @item planes
  9932. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9933. @end table
  9934. @section lenscorrection
  9935. Correct radial lens distortion
  9936. This filter can be used to correct for radial distortion as can result from the use
  9937. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9938. one can use tools available for example as part of opencv or simply trial-and-error.
  9939. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9940. and extract the k1 and k2 coefficients from the resulting matrix.
  9941. Note that effectively the same filter is available in the open-source tools Krita and
  9942. Digikam from the KDE project.
  9943. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9944. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9945. brightness distribution, so you may want to use both filters together in certain
  9946. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9947. be applied before or after lens correction.
  9948. @subsection Options
  9949. The filter accepts the following options:
  9950. @table @option
  9951. @item cx
  9952. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9953. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9954. width. Default is 0.5.
  9955. @item cy
  9956. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9957. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9958. height. Default is 0.5.
  9959. @item k1
  9960. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9961. no correction. Default is 0.
  9962. @item k2
  9963. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9964. 0 means no correction. Default is 0.
  9965. @end table
  9966. The formula that generates the correction is:
  9967. @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
  9968. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9969. distances from the focal point in the source and target images, respectively.
  9970. @section lensfun
  9971. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9972. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9973. to apply the lens correction. The filter will load the lensfun database and
  9974. query it to find the corresponding camera and lens entries in the database. As
  9975. long as these entries can be found with the given options, the filter can
  9976. perform corrections on frames. Note that incomplete strings will result in the
  9977. filter choosing the best match with the given options, and the filter will
  9978. output the chosen camera and lens models (logged with level "info"). You must
  9979. provide the make, camera model, and lens model as they are required.
  9980. The filter accepts the following options:
  9981. @table @option
  9982. @item make
  9983. The make of the camera (for example, "Canon"). This option is required.
  9984. @item model
  9985. The model of the camera (for example, "Canon EOS 100D"). This option is
  9986. required.
  9987. @item lens_model
  9988. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9989. option is required.
  9990. @item mode
  9991. The type of correction to apply. The following values are valid options:
  9992. @table @samp
  9993. @item vignetting
  9994. Enables fixing lens vignetting.
  9995. @item geometry
  9996. Enables fixing lens geometry. This is the default.
  9997. @item subpixel
  9998. Enables fixing chromatic aberrations.
  9999. @item vig_geo
  10000. Enables fixing lens vignetting and lens geometry.
  10001. @item vig_subpixel
  10002. Enables fixing lens vignetting and chromatic aberrations.
  10003. @item distortion
  10004. Enables fixing both lens geometry and chromatic aberrations.
  10005. @item all
  10006. Enables all possible corrections.
  10007. @end table
  10008. @item focal_length
  10009. The focal length of the image/video (zoom; expected constant for video). For
  10010. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10011. range should be chosen when using that lens. Default 18.
  10012. @item aperture
  10013. The aperture of the image/video (expected constant for video). Note that
  10014. aperture is only used for vignetting correction. Default 3.5.
  10015. @item focus_distance
  10016. The focus distance of the image/video (expected constant for video). Note that
  10017. focus distance is only used for vignetting and only slightly affects the
  10018. vignetting correction process. If unknown, leave it at the default value (which
  10019. is 1000).
  10020. @item scale
  10021. The scale factor which is applied after transformation. After correction the
  10022. video is no longer necessarily rectangular. This parameter controls how much of
  10023. the resulting image is visible. The value 0 means that a value will be chosen
  10024. automatically such that there is little or no unmapped area in the output
  10025. image. 1.0 means that no additional scaling is done. Lower values may result
  10026. in more of the corrected image being visible, while higher values may avoid
  10027. unmapped areas in the output.
  10028. @item target_geometry
  10029. The target geometry of the output image/video. The following values are valid
  10030. options:
  10031. @table @samp
  10032. @item rectilinear (default)
  10033. @item fisheye
  10034. @item panoramic
  10035. @item equirectangular
  10036. @item fisheye_orthographic
  10037. @item fisheye_stereographic
  10038. @item fisheye_equisolid
  10039. @item fisheye_thoby
  10040. @end table
  10041. @item reverse
  10042. Apply the reverse of image correction (instead of correcting distortion, apply
  10043. it).
  10044. @item interpolation
  10045. The type of interpolation used when correcting distortion. The following values
  10046. are valid options:
  10047. @table @samp
  10048. @item nearest
  10049. @item linear (default)
  10050. @item lanczos
  10051. @end table
  10052. @end table
  10053. @subsection Examples
  10054. @itemize
  10055. @item
  10056. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10057. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10058. aperture of "8.0".
  10059. @example
  10060. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  10061. @end example
  10062. @item
  10063. Apply the same as before, but only for the first 5 seconds of video.
  10064. @example
  10065. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  10066. @end example
  10067. @end itemize
  10068. @section libvmaf
  10069. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10070. score between two input videos.
  10071. The obtained VMAF score is printed through the logging system.
  10072. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10073. After installing the library it can be enabled using:
  10074. @code{./configure --enable-libvmaf}.
  10075. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10076. The filter has following options:
  10077. @table @option
  10078. @item model_path
  10079. Set the model path which is to be used for SVM.
  10080. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10081. @item log_path
  10082. Set the file path to be used to store logs.
  10083. @item log_fmt
  10084. Set the format of the log file (csv, json or xml).
  10085. @item enable_transform
  10086. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10087. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10088. Default value: @code{false}
  10089. @item phone_model
  10090. Invokes the phone model which will generate VMAF scores higher than in the
  10091. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10092. Default value: @code{false}
  10093. @item psnr
  10094. Enables computing psnr along with vmaf.
  10095. Default value: @code{false}
  10096. @item ssim
  10097. Enables computing ssim along with vmaf.
  10098. Default value: @code{false}
  10099. @item ms_ssim
  10100. Enables computing ms_ssim along with vmaf.
  10101. Default value: @code{false}
  10102. @item pool
  10103. Set the pool method to be used for computing vmaf.
  10104. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10105. @item n_threads
  10106. Set number of threads to be used when computing vmaf.
  10107. Default value: @code{0}, which makes use of all available logical processors.
  10108. @item n_subsample
  10109. Set interval for frame subsampling used when computing vmaf.
  10110. Default value: @code{1}
  10111. @item enable_conf_interval
  10112. Enables confidence interval.
  10113. Default value: @code{false}
  10114. @end table
  10115. This filter also supports the @ref{framesync} options.
  10116. @subsection Examples
  10117. @itemize
  10118. @item
  10119. On the below examples the input file @file{main.mpg} being processed is
  10120. compared with the reference file @file{ref.mpg}.
  10121. @example
  10122. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10123. @end example
  10124. @item
  10125. Example with options:
  10126. @example
  10127. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10128. @end example
  10129. @item
  10130. Example with options and different containers:
  10131. @example
  10132. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  10133. @end example
  10134. @end itemize
  10135. @section limiter
  10136. Limits the pixel components values to the specified range [min, max].
  10137. The filter accepts the following options:
  10138. @table @option
  10139. @item min
  10140. Lower bound. Defaults to the lowest allowed value for the input.
  10141. @item max
  10142. Upper bound. Defaults to the highest allowed value for the input.
  10143. @item planes
  10144. Specify which planes will be processed. Defaults to all available.
  10145. @end table
  10146. @section loop
  10147. Loop video frames.
  10148. The filter accepts the following options:
  10149. @table @option
  10150. @item loop
  10151. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10152. Default is 0.
  10153. @item size
  10154. Set maximal size in number of frames. Default is 0.
  10155. @item start
  10156. Set first frame of loop. Default is 0.
  10157. @end table
  10158. @subsection Examples
  10159. @itemize
  10160. @item
  10161. Loop single first frame infinitely:
  10162. @example
  10163. loop=loop=-1:size=1:start=0
  10164. @end example
  10165. @item
  10166. Loop single first frame 10 times:
  10167. @example
  10168. loop=loop=10:size=1:start=0
  10169. @end example
  10170. @item
  10171. Loop 10 first frames 5 times:
  10172. @example
  10173. loop=loop=5:size=10:start=0
  10174. @end example
  10175. @end itemize
  10176. @section lut1d
  10177. Apply a 1D LUT to an input video.
  10178. The filter accepts the following options:
  10179. @table @option
  10180. @item file
  10181. Set the 1D LUT file name.
  10182. Currently supported formats:
  10183. @table @samp
  10184. @item cube
  10185. Iridas
  10186. @item csp
  10187. cineSpace
  10188. @end table
  10189. @item interp
  10190. Select interpolation mode.
  10191. Available values are:
  10192. @table @samp
  10193. @item nearest
  10194. Use values from the nearest defined point.
  10195. @item linear
  10196. Interpolate values using the linear interpolation.
  10197. @item cosine
  10198. Interpolate values using the cosine interpolation.
  10199. @item cubic
  10200. Interpolate values using the cubic interpolation.
  10201. @item spline
  10202. Interpolate values using the spline interpolation.
  10203. @end table
  10204. @end table
  10205. @anchor{lut3d}
  10206. @section lut3d
  10207. Apply a 3D LUT to an input video.
  10208. The filter accepts the following options:
  10209. @table @option
  10210. @item file
  10211. Set the 3D LUT file name.
  10212. Currently supported formats:
  10213. @table @samp
  10214. @item 3dl
  10215. AfterEffects
  10216. @item cube
  10217. Iridas
  10218. @item dat
  10219. DaVinci
  10220. @item m3d
  10221. Pandora
  10222. @item csp
  10223. cineSpace
  10224. @end table
  10225. @item interp
  10226. Select interpolation mode.
  10227. Available values are:
  10228. @table @samp
  10229. @item nearest
  10230. Use values from the nearest defined point.
  10231. @item trilinear
  10232. Interpolate values using the 8 points defining a cube.
  10233. @item tetrahedral
  10234. Interpolate values using a tetrahedron.
  10235. @end table
  10236. @end table
  10237. @section lumakey
  10238. Turn certain luma values into transparency.
  10239. The filter accepts the following options:
  10240. @table @option
  10241. @item threshold
  10242. Set the luma which will be used as base for transparency.
  10243. Default value is @code{0}.
  10244. @item tolerance
  10245. Set the range of luma values to be keyed out.
  10246. Default value is @code{0.01}.
  10247. @item softness
  10248. Set the range of softness. Default value is @code{0}.
  10249. Use this to control gradual transition from zero to full transparency.
  10250. @end table
  10251. @subsection Commands
  10252. This filter supports same @ref{commands} as options.
  10253. The command accepts the same syntax of the corresponding option.
  10254. If the specified expression is not valid, it is kept at its current
  10255. value.
  10256. @section lut, lutrgb, lutyuv
  10257. Compute a look-up table for binding each pixel component input value
  10258. to an output value, and apply it to the input video.
  10259. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10260. to an RGB input video.
  10261. These filters accept the following parameters:
  10262. @table @option
  10263. @item c0
  10264. set first pixel component expression
  10265. @item c1
  10266. set second pixel component expression
  10267. @item c2
  10268. set third pixel component expression
  10269. @item c3
  10270. set fourth pixel component expression, corresponds to the alpha component
  10271. @item r
  10272. set red component expression
  10273. @item g
  10274. set green component expression
  10275. @item b
  10276. set blue component expression
  10277. @item a
  10278. alpha component expression
  10279. @item y
  10280. set Y/luminance component expression
  10281. @item u
  10282. set U/Cb component expression
  10283. @item v
  10284. set V/Cr component expression
  10285. @end table
  10286. Each of them specifies the expression to use for computing the lookup table for
  10287. the corresponding pixel component values.
  10288. The exact component associated to each of the @var{c*} options depends on the
  10289. format in input.
  10290. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10291. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10292. The expressions can contain the following constants and functions:
  10293. @table @option
  10294. @item w
  10295. @item h
  10296. The input width and height.
  10297. @item val
  10298. The input value for the pixel component.
  10299. @item clipval
  10300. The input value, clipped to the @var{minval}-@var{maxval} range.
  10301. @item maxval
  10302. The maximum value for the pixel component.
  10303. @item minval
  10304. The minimum value for the pixel component.
  10305. @item negval
  10306. The negated value for the pixel component value, clipped to the
  10307. @var{minval}-@var{maxval} range; it corresponds to the expression
  10308. "maxval-clipval+minval".
  10309. @item clip(val)
  10310. The computed value in @var{val}, clipped to the
  10311. @var{minval}-@var{maxval} range.
  10312. @item gammaval(gamma)
  10313. The computed gamma correction value of the pixel component value,
  10314. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10315. expression
  10316. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10317. @end table
  10318. All expressions default to "val".
  10319. @subsection Examples
  10320. @itemize
  10321. @item
  10322. Negate input video:
  10323. @example
  10324. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10325. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10326. @end example
  10327. The above is the same as:
  10328. @example
  10329. lutrgb="r=negval:g=negval:b=negval"
  10330. lutyuv="y=negval:u=negval:v=negval"
  10331. @end example
  10332. @item
  10333. Negate luminance:
  10334. @example
  10335. lutyuv=y=negval
  10336. @end example
  10337. @item
  10338. Remove chroma components, turning the video into a graytone image:
  10339. @example
  10340. lutyuv="u=128:v=128"
  10341. @end example
  10342. @item
  10343. Apply a luma burning effect:
  10344. @example
  10345. lutyuv="y=2*val"
  10346. @end example
  10347. @item
  10348. Remove green and blue components:
  10349. @example
  10350. lutrgb="g=0:b=0"
  10351. @end example
  10352. @item
  10353. Set a constant alpha channel value on input:
  10354. @example
  10355. format=rgba,lutrgb=a="maxval-minval/2"
  10356. @end example
  10357. @item
  10358. Correct luminance gamma by a factor of 0.5:
  10359. @example
  10360. lutyuv=y=gammaval(0.5)
  10361. @end example
  10362. @item
  10363. Discard least significant bits of luma:
  10364. @example
  10365. lutyuv=y='bitand(val, 128+64+32)'
  10366. @end example
  10367. @item
  10368. Technicolor like effect:
  10369. @example
  10370. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10371. @end example
  10372. @end itemize
  10373. @section lut2, tlut2
  10374. The @code{lut2} filter takes two input streams and outputs one
  10375. stream.
  10376. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10377. from one single stream.
  10378. This filter accepts the following parameters:
  10379. @table @option
  10380. @item c0
  10381. set first pixel component expression
  10382. @item c1
  10383. set second pixel component expression
  10384. @item c2
  10385. set third pixel component expression
  10386. @item c3
  10387. set fourth pixel component expression, corresponds to the alpha component
  10388. @item d
  10389. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10390. which means bit depth is automatically picked from first input format.
  10391. @end table
  10392. The @code{lut2} filter also supports the @ref{framesync} options.
  10393. Each of them specifies the expression to use for computing the lookup table for
  10394. the corresponding pixel component values.
  10395. The exact component associated to each of the @var{c*} options depends on the
  10396. format in inputs.
  10397. The expressions can contain the following constants:
  10398. @table @option
  10399. @item w
  10400. @item h
  10401. The input width and height.
  10402. @item x
  10403. The first input value for the pixel component.
  10404. @item y
  10405. The second input value for the pixel component.
  10406. @item bdx
  10407. The first input video bit depth.
  10408. @item bdy
  10409. The second input video bit depth.
  10410. @end table
  10411. All expressions default to "x".
  10412. @subsection Examples
  10413. @itemize
  10414. @item
  10415. Highlight differences between two RGB video streams:
  10416. @example
  10417. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  10418. @end example
  10419. @item
  10420. Highlight differences between two YUV video streams:
  10421. @example
  10422. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  10423. @end example
  10424. @item
  10425. Show max difference between two video streams:
  10426. @example
  10427. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  10428. @end example
  10429. @end itemize
  10430. @section maskedclamp
  10431. Clamp the first input stream with the second input and third input stream.
  10432. Returns the value of first stream to be between second input
  10433. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10434. This filter accepts the following options:
  10435. @table @option
  10436. @item undershoot
  10437. Default value is @code{0}.
  10438. @item overshoot
  10439. Default value is @code{0}.
  10440. @item planes
  10441. Set which planes will be processed as bitmap, unprocessed planes will be
  10442. copied from first stream.
  10443. By default value 0xf, all planes will be processed.
  10444. @end table
  10445. @section maskedmax
  10446. Merge the second and third input stream into output stream using absolute differences
  10447. between second input stream and first input stream and absolute difference between
  10448. third input stream and first input stream. The picked value will be from second input
  10449. stream if second absolute difference is greater than first one or from third input stream
  10450. otherwise.
  10451. This filter accepts the following options:
  10452. @table @option
  10453. @item planes
  10454. Set which planes will be processed as bitmap, unprocessed planes will be
  10455. copied from first stream.
  10456. By default value 0xf, all planes will be processed.
  10457. @end table
  10458. @section maskedmerge
  10459. Merge the first input stream with the second input stream using per pixel
  10460. weights in the third input stream.
  10461. A value of 0 in the third stream pixel component means that pixel component
  10462. from first stream is returned unchanged, while maximum value (eg. 255 for
  10463. 8-bit videos) means that pixel component from second stream is returned
  10464. unchanged. Intermediate values define the amount of merging between both
  10465. input stream's pixel components.
  10466. This filter accepts the following options:
  10467. @table @option
  10468. @item planes
  10469. Set which planes will be processed as bitmap, unprocessed planes will be
  10470. copied from first stream.
  10471. By default value 0xf, all planes will be processed.
  10472. @end table
  10473. @section maskedmin
  10474. Merge the second and third input stream into output stream using absolute differences
  10475. between second input stream and first input stream and absolute difference between
  10476. third input stream and first input stream. The picked value will be from second input
  10477. stream if second absolute difference is less than first one or from third input stream
  10478. otherwise.
  10479. This filter accepts the following options:
  10480. @table @option
  10481. @item planes
  10482. Set which planes will be processed as bitmap, unprocessed planes will be
  10483. copied from first stream.
  10484. By default value 0xf, all planes will be processed.
  10485. @end table
  10486. @section maskedthreshold
  10487. Pick pixels comparing absolute difference of two video streams with fixed
  10488. threshold.
  10489. If absolute difference between pixel component of first and second video
  10490. stream is equal or lower than user supplied threshold than pixel component
  10491. from first video stream is picked, otherwise pixel component from second
  10492. video stream is picked.
  10493. This filter accepts the following options:
  10494. @table @option
  10495. @item threshold
  10496. Set threshold used when picking pixels from absolute difference from two input
  10497. video streams.
  10498. @item planes
  10499. Set which planes will be processed as bitmap, unprocessed planes will be
  10500. copied from second stream.
  10501. By default value 0xf, all planes will be processed.
  10502. @end table
  10503. @section maskfun
  10504. Create mask from input video.
  10505. For example it is useful to create motion masks after @code{tblend} filter.
  10506. This filter accepts the following options:
  10507. @table @option
  10508. @item low
  10509. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10510. @item high
  10511. Set high threshold. Any pixel component higher than this value will be set to max value
  10512. allowed for current pixel format.
  10513. @item planes
  10514. Set planes to filter, by default all available planes are filtered.
  10515. @item fill
  10516. Fill all frame pixels with this value.
  10517. @item sum
  10518. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10519. average, output frame will be completely filled with value set by @var{fill} option.
  10520. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10521. @end table
  10522. @section mcdeint
  10523. Apply motion-compensation deinterlacing.
  10524. It needs one field per frame as input and must thus be used together
  10525. with yadif=1/3 or equivalent.
  10526. This filter accepts the following options:
  10527. @table @option
  10528. @item mode
  10529. Set the deinterlacing mode.
  10530. It accepts one of the following values:
  10531. @table @samp
  10532. @item fast
  10533. @item medium
  10534. @item slow
  10535. use iterative motion estimation
  10536. @item extra_slow
  10537. like @samp{slow}, but use multiple reference frames.
  10538. @end table
  10539. Default value is @samp{fast}.
  10540. @item parity
  10541. Set the picture field parity assumed for the input video. It must be
  10542. one of the following values:
  10543. @table @samp
  10544. @item 0, tff
  10545. assume top field first
  10546. @item 1, bff
  10547. assume bottom field first
  10548. @end table
  10549. Default value is @samp{bff}.
  10550. @item qp
  10551. Set per-block quantization parameter (QP) used by the internal
  10552. encoder.
  10553. Higher values should result in a smoother motion vector field but less
  10554. optimal individual vectors. Default value is 1.
  10555. @end table
  10556. @section median
  10557. Pick median pixel from certain rectangle defined by radius.
  10558. This filter accepts the following options:
  10559. @table @option
  10560. @item radius
  10561. Set horizontal radius size. Default value is @code{1}.
  10562. Allowed range is integer from 1 to 127.
  10563. @item planes
  10564. Set which planes to process. Default is @code{15}, which is all available planes.
  10565. @item radiusV
  10566. Set vertical radius size. Default value is @code{0}.
  10567. Allowed range is integer from 0 to 127.
  10568. If it is 0, value will be picked from horizontal @code{radius} option.
  10569. @item percentile
  10570. Set median percentile. Default value is @code{0.5}.
  10571. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10572. minimum values, and @code{1} maximum values.
  10573. @end table
  10574. @subsection Commands
  10575. This filter supports same @ref{commands} as options.
  10576. The command accepts the same syntax of the corresponding option.
  10577. If the specified expression is not valid, it is kept at its current
  10578. value.
  10579. @section mergeplanes
  10580. Merge color channel components from several video streams.
  10581. The filter accepts up to 4 input streams, and merge selected input
  10582. planes to the output video.
  10583. This filter accepts the following options:
  10584. @table @option
  10585. @item mapping
  10586. Set input to output plane mapping. Default is @code{0}.
  10587. The mappings is specified as a bitmap. It should be specified as a
  10588. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10589. mapping for the first plane of the output stream. 'A' sets the number of
  10590. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10591. corresponding input to use (from 0 to 3). The rest of the mappings is
  10592. similar, 'Bb' describes the mapping for the output stream second
  10593. plane, 'Cc' describes the mapping for the output stream third plane and
  10594. 'Dd' describes the mapping for the output stream fourth plane.
  10595. @item format
  10596. Set output pixel format. Default is @code{yuva444p}.
  10597. @end table
  10598. @subsection Examples
  10599. @itemize
  10600. @item
  10601. Merge three gray video streams of same width and height into single video stream:
  10602. @example
  10603. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10604. @end example
  10605. @item
  10606. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10607. @example
  10608. [a0][a1]mergeplanes=0x00010210:yuva444p
  10609. @end example
  10610. @item
  10611. Swap Y and A plane in yuva444p stream:
  10612. @example
  10613. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10614. @end example
  10615. @item
  10616. Swap U and V plane in yuv420p stream:
  10617. @example
  10618. format=yuv420p,mergeplanes=0x000201:yuv420p
  10619. @end example
  10620. @item
  10621. Cast a rgb24 clip to yuv444p:
  10622. @example
  10623. format=rgb24,mergeplanes=0x000102:yuv444p
  10624. @end example
  10625. @end itemize
  10626. @section mestimate
  10627. Estimate and export motion vectors using block matching algorithms.
  10628. Motion vectors are stored in frame side data to be used by other filters.
  10629. This filter accepts the following options:
  10630. @table @option
  10631. @item method
  10632. Specify the motion estimation method. Accepts one of the following values:
  10633. @table @samp
  10634. @item esa
  10635. Exhaustive search algorithm.
  10636. @item tss
  10637. Three step search algorithm.
  10638. @item tdls
  10639. Two dimensional logarithmic search algorithm.
  10640. @item ntss
  10641. New three step search algorithm.
  10642. @item fss
  10643. Four step search algorithm.
  10644. @item ds
  10645. Diamond search algorithm.
  10646. @item hexbs
  10647. Hexagon-based search algorithm.
  10648. @item epzs
  10649. Enhanced predictive zonal search algorithm.
  10650. @item umh
  10651. Uneven multi-hexagon search algorithm.
  10652. @end table
  10653. Default value is @samp{esa}.
  10654. @item mb_size
  10655. Macroblock size. Default @code{16}.
  10656. @item search_param
  10657. Search parameter. Default @code{7}.
  10658. @end table
  10659. @section midequalizer
  10660. Apply Midway Image Equalization effect using two video streams.
  10661. Midway Image Equalization adjusts a pair of images to have the same
  10662. histogram, while maintaining their dynamics as much as possible. It's
  10663. useful for e.g. matching exposures from a pair of stereo cameras.
  10664. This filter has two inputs and one output, which must be of same pixel format, but
  10665. may be of different sizes. The output of filter is first input adjusted with
  10666. midway histogram of both inputs.
  10667. This filter accepts the following option:
  10668. @table @option
  10669. @item planes
  10670. Set which planes to process. Default is @code{15}, which is all available planes.
  10671. @end table
  10672. @section minterpolate
  10673. Convert the video to specified frame rate using motion interpolation.
  10674. This filter accepts the following options:
  10675. @table @option
  10676. @item fps
  10677. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  10678. @item mi_mode
  10679. Motion interpolation mode. Following values are accepted:
  10680. @table @samp
  10681. @item dup
  10682. Duplicate previous or next frame for interpolating new ones.
  10683. @item blend
  10684. Blend source frames. Interpolated frame is mean of previous and next frames.
  10685. @item mci
  10686. Motion compensated interpolation. Following options are effective when this mode is selected:
  10687. @table @samp
  10688. @item mc_mode
  10689. Motion compensation mode. Following values are accepted:
  10690. @table @samp
  10691. @item obmc
  10692. Overlapped block motion compensation.
  10693. @item aobmc
  10694. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10695. @end table
  10696. Default mode is @samp{obmc}.
  10697. @item me_mode
  10698. Motion estimation mode. Following values are accepted:
  10699. @table @samp
  10700. @item bidir
  10701. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10702. @item bilat
  10703. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10704. @end table
  10705. Default mode is @samp{bilat}.
  10706. @item me
  10707. The algorithm to be used for motion estimation. Following values are accepted:
  10708. @table @samp
  10709. @item esa
  10710. Exhaustive search algorithm.
  10711. @item tss
  10712. Three step search algorithm.
  10713. @item tdls
  10714. Two dimensional logarithmic search algorithm.
  10715. @item ntss
  10716. New three step search algorithm.
  10717. @item fss
  10718. Four step search algorithm.
  10719. @item ds
  10720. Diamond search algorithm.
  10721. @item hexbs
  10722. Hexagon-based search algorithm.
  10723. @item epzs
  10724. Enhanced predictive zonal search algorithm.
  10725. @item umh
  10726. Uneven multi-hexagon search algorithm.
  10727. @end table
  10728. Default algorithm is @samp{epzs}.
  10729. @item mb_size
  10730. Macroblock size. Default @code{16}.
  10731. @item search_param
  10732. Motion estimation search parameter. Default @code{32}.
  10733. @item vsbmc
  10734. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  10735. @end table
  10736. @end table
  10737. @item scd
  10738. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  10739. @table @samp
  10740. @item none
  10741. Disable scene change detection.
  10742. @item fdiff
  10743. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10744. @end table
  10745. Default method is @samp{fdiff}.
  10746. @item scd_threshold
  10747. Scene change detection threshold. Default is @code{10.}.
  10748. @end table
  10749. @section mix
  10750. Mix several video input streams into one video stream.
  10751. A description of the accepted options follows.
  10752. @table @option
  10753. @item nb_inputs
  10754. The number of inputs. If unspecified, it defaults to 2.
  10755. @item weights
  10756. Specify weight of each input video stream as sequence.
  10757. Each weight is separated by space. If number of weights
  10758. is smaller than number of @var{frames} last specified
  10759. weight will be used for all remaining unset weights.
  10760. @item scale
  10761. Specify scale, if it is set it will be multiplied with sum
  10762. of each weight multiplied with pixel values to give final destination
  10763. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10764. @item duration
  10765. Specify how end of stream is determined.
  10766. @table @samp
  10767. @item longest
  10768. The duration of the longest input. (default)
  10769. @item shortest
  10770. The duration of the shortest input.
  10771. @item first
  10772. The duration of the first input.
  10773. @end table
  10774. @end table
  10775. @section mpdecimate
  10776. Drop frames that do not differ greatly from the previous frame in
  10777. order to reduce frame rate.
  10778. The main use of this filter is for very-low-bitrate encoding
  10779. (e.g. streaming over dialup modem), but it could in theory be used for
  10780. fixing movies that were inverse-telecined incorrectly.
  10781. A description of the accepted options follows.
  10782. @table @option
  10783. @item max
  10784. Set the maximum number of consecutive frames which can be dropped (if
  10785. positive), or the minimum interval between dropped frames (if
  10786. negative). If the value is 0, the frame is dropped disregarding the
  10787. number of previous sequentially dropped frames.
  10788. Default value is 0.
  10789. @item hi
  10790. @item lo
  10791. @item frac
  10792. Set the dropping threshold values.
  10793. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10794. represent actual pixel value differences, so a threshold of 64
  10795. corresponds to 1 unit of difference for each pixel, or the same spread
  10796. out differently over the block.
  10797. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10798. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10799. meaning the whole image) differ by more than a threshold of @option{lo}.
  10800. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10801. 64*5, and default value for @option{frac} is 0.33.
  10802. @end table
  10803. @section negate
  10804. Negate (invert) the input video.
  10805. It accepts the following option:
  10806. @table @option
  10807. @item negate_alpha
  10808. With value 1, it negates the alpha component, if present. Default value is 0.
  10809. @end table
  10810. @anchor{nlmeans}
  10811. @section nlmeans
  10812. Denoise frames using Non-Local Means algorithm.
  10813. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10814. context similarity is defined by comparing their surrounding patches of size
  10815. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10816. around the pixel.
  10817. Note that the research area defines centers for patches, which means some
  10818. patches will be made of pixels outside that research area.
  10819. The filter accepts the following options.
  10820. @table @option
  10821. @item s
  10822. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10823. @item p
  10824. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10825. @item pc
  10826. Same as @option{p} but for chroma planes.
  10827. The default value is @var{0} and means automatic.
  10828. @item r
  10829. Set research size. Default is 15. Must be odd number in range [0, 99].
  10830. @item rc
  10831. Same as @option{r} but for chroma planes.
  10832. The default value is @var{0} and means automatic.
  10833. @end table
  10834. @section nnedi
  10835. Deinterlace video using neural network edge directed interpolation.
  10836. This filter accepts the following options:
  10837. @table @option
  10838. @item weights
  10839. Mandatory option, without binary file filter can not work.
  10840. Currently file can be found here:
  10841. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10842. @item deint
  10843. Set which frames to deinterlace, by default it is @code{all}.
  10844. Can be @code{all} or @code{interlaced}.
  10845. @item field
  10846. Set mode of operation.
  10847. Can be one of the following:
  10848. @table @samp
  10849. @item af
  10850. Use frame flags, both fields.
  10851. @item a
  10852. Use frame flags, single field.
  10853. @item t
  10854. Use top field only.
  10855. @item b
  10856. Use bottom field only.
  10857. @item tf
  10858. Use both fields, top first.
  10859. @item bf
  10860. Use both fields, bottom first.
  10861. @end table
  10862. @item planes
  10863. Set which planes to process, by default filter process all frames.
  10864. @item nsize
  10865. Set size of local neighborhood around each pixel, used by the predictor neural
  10866. network.
  10867. Can be one of the following:
  10868. @table @samp
  10869. @item s8x6
  10870. @item s16x6
  10871. @item s32x6
  10872. @item s48x6
  10873. @item s8x4
  10874. @item s16x4
  10875. @item s32x4
  10876. @end table
  10877. @item nns
  10878. Set the number of neurons in predictor neural network.
  10879. Can be one of the following:
  10880. @table @samp
  10881. @item n16
  10882. @item n32
  10883. @item n64
  10884. @item n128
  10885. @item n256
  10886. @end table
  10887. @item qual
  10888. Controls the number of different neural network predictions that are blended
  10889. together to compute the final output value. Can be @code{fast}, default or
  10890. @code{slow}.
  10891. @item etype
  10892. Set which set of weights to use in the predictor.
  10893. Can be one of the following:
  10894. @table @samp
  10895. @item a
  10896. weights trained to minimize absolute error
  10897. @item s
  10898. weights trained to minimize squared error
  10899. @end table
  10900. @item pscrn
  10901. Controls whether or not the prescreener neural network is used to decide
  10902. which pixels should be processed by the predictor neural network and which
  10903. can be handled by simple cubic interpolation.
  10904. The prescreener is trained to know whether cubic interpolation will be
  10905. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10906. The computational complexity of the prescreener nn is much less than that of
  10907. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10908. using the prescreener generally results in much faster processing.
  10909. The prescreener is pretty accurate, so the difference between using it and not
  10910. using it is almost always unnoticeable.
  10911. Can be one of the following:
  10912. @table @samp
  10913. @item none
  10914. @item original
  10915. @item new
  10916. @end table
  10917. Default is @code{new}.
  10918. @item fapprox
  10919. Set various debugging flags.
  10920. @end table
  10921. @section noformat
  10922. Force libavfilter not to use any of the specified pixel formats for the
  10923. input to the next filter.
  10924. It accepts the following parameters:
  10925. @table @option
  10926. @item pix_fmts
  10927. A '|'-separated list of pixel format names, such as
  10928. pix_fmts=yuv420p|monow|rgb24".
  10929. @end table
  10930. @subsection Examples
  10931. @itemize
  10932. @item
  10933. Force libavfilter to use a format different from @var{yuv420p} for the
  10934. input to the vflip filter:
  10935. @example
  10936. noformat=pix_fmts=yuv420p,vflip
  10937. @end example
  10938. @item
  10939. Convert the input video to any of the formats not contained in the list:
  10940. @example
  10941. noformat=yuv420p|yuv444p|yuv410p
  10942. @end example
  10943. @end itemize
  10944. @section noise
  10945. Add noise on video input frame.
  10946. The filter accepts the following options:
  10947. @table @option
  10948. @item all_seed
  10949. @item c0_seed
  10950. @item c1_seed
  10951. @item c2_seed
  10952. @item c3_seed
  10953. Set noise seed for specific pixel component or all pixel components in case
  10954. of @var{all_seed}. Default value is @code{123457}.
  10955. @item all_strength, alls
  10956. @item c0_strength, c0s
  10957. @item c1_strength, c1s
  10958. @item c2_strength, c2s
  10959. @item c3_strength, c3s
  10960. Set noise strength for specific pixel component or all pixel components in case
  10961. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10962. @item all_flags, allf
  10963. @item c0_flags, c0f
  10964. @item c1_flags, c1f
  10965. @item c2_flags, c2f
  10966. @item c3_flags, c3f
  10967. Set pixel component flags or set flags for all components if @var{all_flags}.
  10968. Available values for component flags are:
  10969. @table @samp
  10970. @item a
  10971. averaged temporal noise (smoother)
  10972. @item p
  10973. mix random noise with a (semi)regular pattern
  10974. @item t
  10975. temporal noise (noise pattern changes between frames)
  10976. @item u
  10977. uniform noise (gaussian otherwise)
  10978. @end table
  10979. @end table
  10980. @subsection Examples
  10981. Add temporal and uniform noise to input video:
  10982. @example
  10983. noise=alls=20:allf=t+u
  10984. @end example
  10985. @section normalize
  10986. Normalize RGB video (aka histogram stretching, contrast stretching).
  10987. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10988. For each channel of each frame, the filter computes the input range and maps
  10989. it linearly to the user-specified output range. The output range defaults
  10990. to the full dynamic range from pure black to pure white.
  10991. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10992. changes in brightness) caused when small dark or bright objects enter or leave
  10993. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10994. video camera, and, like a video camera, it may cause a period of over- or
  10995. under-exposure of the video.
  10996. The R,G,B channels can be normalized independently, which may cause some
  10997. color shifting, or linked together as a single channel, which prevents
  10998. color shifting. Linked normalization preserves hue. Independent normalization
  10999. does not, so it can be used to remove some color casts. Independent and linked
  11000. normalization can be combined in any ratio.
  11001. The normalize filter accepts the following options:
  11002. @table @option
  11003. @item blackpt
  11004. @item whitept
  11005. Colors which define the output range. The minimum input value is mapped to
  11006. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11007. The defaults are black and white respectively. Specifying white for
  11008. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11009. normalized video. Shades of grey can be used to reduce the dynamic range
  11010. (contrast). Specifying saturated colors here can create some interesting
  11011. effects.
  11012. @item smoothing
  11013. The number of previous frames to use for temporal smoothing. The input range
  11014. of each channel is smoothed using a rolling average over the current frame
  11015. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11016. smoothing).
  11017. @item independence
  11018. Controls the ratio of independent (color shifting) channel normalization to
  11019. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11020. independent. Defaults to 1.0 (fully independent).
  11021. @item strength
  11022. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11023. expensive no-op. Defaults to 1.0 (full strength).
  11024. @end table
  11025. @subsection Commands
  11026. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11027. The command accepts the same syntax of the corresponding option.
  11028. If the specified expression is not valid, it is kept at its current
  11029. value.
  11030. @subsection Examples
  11031. Stretch video contrast to use the full dynamic range, with no temporal
  11032. smoothing; may flicker depending on the source content:
  11033. @example
  11034. normalize=blackpt=black:whitept=white:smoothing=0
  11035. @end example
  11036. As above, but with 50 frames of temporal smoothing; flicker should be
  11037. reduced, depending on the source content:
  11038. @example
  11039. normalize=blackpt=black:whitept=white:smoothing=50
  11040. @end example
  11041. As above, but with hue-preserving linked channel normalization:
  11042. @example
  11043. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11044. @end example
  11045. As above, but with half strength:
  11046. @example
  11047. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11048. @end example
  11049. Map the darkest input color to red, the brightest input color to cyan:
  11050. @example
  11051. normalize=blackpt=red:whitept=cyan
  11052. @end example
  11053. @section null
  11054. Pass the video source unchanged to the output.
  11055. @section ocr
  11056. Optical Character Recognition
  11057. This filter uses Tesseract for optical character recognition. To enable
  11058. compilation of this filter, you need to configure FFmpeg with
  11059. @code{--enable-libtesseract}.
  11060. It accepts the following options:
  11061. @table @option
  11062. @item datapath
  11063. Set datapath to tesseract data. Default is to use whatever was
  11064. set at installation.
  11065. @item language
  11066. Set language, default is "eng".
  11067. @item whitelist
  11068. Set character whitelist.
  11069. @item blacklist
  11070. Set character blacklist.
  11071. @end table
  11072. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11073. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11074. @section ocv
  11075. Apply a video transform using libopencv.
  11076. To enable this filter, install the libopencv library and headers and
  11077. configure FFmpeg with @code{--enable-libopencv}.
  11078. It accepts the following parameters:
  11079. @table @option
  11080. @item filter_name
  11081. The name of the libopencv filter to apply.
  11082. @item filter_params
  11083. The parameters to pass to the libopencv filter. If not specified, the default
  11084. values are assumed.
  11085. @end table
  11086. Refer to the official libopencv documentation for more precise
  11087. information:
  11088. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11089. Several libopencv filters are supported; see the following subsections.
  11090. @anchor{dilate}
  11091. @subsection dilate
  11092. Dilate an image by using a specific structuring element.
  11093. It corresponds to the libopencv function @code{cvDilate}.
  11094. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11095. @var{struct_el} represents a structuring element, and has the syntax:
  11096. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11097. @var{cols} and @var{rows} represent the number of columns and rows of
  11098. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11099. point, and @var{shape} the shape for the structuring element. @var{shape}
  11100. must be "rect", "cross", "ellipse", or "custom".
  11101. If the value for @var{shape} is "custom", it must be followed by a
  11102. string of the form "=@var{filename}". The file with name
  11103. @var{filename} is assumed to represent a binary image, with each
  11104. printable character corresponding to a bright pixel. When a custom
  11105. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11106. or columns and rows of the read file are assumed instead.
  11107. The default value for @var{struct_el} is "3x3+0x0/rect".
  11108. @var{nb_iterations} specifies the number of times the transform is
  11109. applied to the image, and defaults to 1.
  11110. Some examples:
  11111. @example
  11112. # Use the default values
  11113. ocv=dilate
  11114. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11115. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11116. # Read the shape from the file diamond.shape, iterating two times.
  11117. # The file diamond.shape may contain a pattern of characters like this
  11118. # *
  11119. # ***
  11120. # *****
  11121. # ***
  11122. # *
  11123. # The specified columns and rows are ignored
  11124. # but the anchor point coordinates are not
  11125. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11126. @end example
  11127. @subsection erode
  11128. Erode an image by using a specific structuring element.
  11129. It corresponds to the libopencv function @code{cvErode}.
  11130. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11131. with the same syntax and semantics as the @ref{dilate} filter.
  11132. @subsection smooth
  11133. Smooth the input video.
  11134. The filter takes the following parameters:
  11135. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11136. @var{type} is the type of smooth filter to apply, and must be one of
  11137. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11138. or "bilateral". The default value is "gaussian".
  11139. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11140. depends on the smooth type. @var{param1} and
  11141. @var{param2} accept integer positive values or 0. @var{param3} and
  11142. @var{param4} accept floating point values.
  11143. The default value for @var{param1} is 3. The default value for the
  11144. other parameters is 0.
  11145. These parameters correspond to the parameters assigned to the
  11146. libopencv function @code{cvSmooth}.
  11147. @section oscilloscope
  11148. 2D Video Oscilloscope.
  11149. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11150. It accepts the following parameters:
  11151. @table @option
  11152. @item x
  11153. Set scope center x position.
  11154. @item y
  11155. Set scope center y position.
  11156. @item s
  11157. Set scope size, relative to frame diagonal.
  11158. @item t
  11159. Set scope tilt/rotation.
  11160. @item o
  11161. Set trace opacity.
  11162. @item tx
  11163. Set trace center x position.
  11164. @item ty
  11165. Set trace center y position.
  11166. @item tw
  11167. Set trace width, relative to width of frame.
  11168. @item th
  11169. Set trace height, relative to height of frame.
  11170. @item c
  11171. Set which components to trace. By default it traces first three components.
  11172. @item g
  11173. Draw trace grid. By default is enabled.
  11174. @item st
  11175. Draw some statistics. By default is enabled.
  11176. @item sc
  11177. Draw scope. By default is enabled.
  11178. @end table
  11179. @subsection Commands
  11180. This filter supports same @ref{commands} as options.
  11181. The command accepts the same syntax of the corresponding option.
  11182. If the specified expression is not valid, it is kept at its current
  11183. value.
  11184. @subsection Examples
  11185. @itemize
  11186. @item
  11187. Inspect full first row of video frame.
  11188. @example
  11189. oscilloscope=x=0.5:y=0:s=1
  11190. @end example
  11191. @item
  11192. Inspect full last row of video frame.
  11193. @example
  11194. oscilloscope=x=0.5:y=1:s=1
  11195. @end example
  11196. @item
  11197. Inspect full 5th line of video frame of height 1080.
  11198. @example
  11199. oscilloscope=x=0.5:y=5/1080:s=1
  11200. @end example
  11201. @item
  11202. Inspect full last column of video frame.
  11203. @example
  11204. oscilloscope=x=1:y=0.5:s=1:t=1
  11205. @end example
  11206. @end itemize
  11207. @anchor{overlay}
  11208. @section overlay
  11209. Overlay one video on top of another.
  11210. It takes two inputs and has one output. The first input is the "main"
  11211. video on which the second input is overlaid.
  11212. It accepts the following parameters:
  11213. A description of the accepted options follows.
  11214. @table @option
  11215. @item x
  11216. @item y
  11217. Set the expression for the x and y coordinates of the overlaid video
  11218. on the main video. Default value is "0" for both expressions. In case
  11219. the expression is invalid, it is set to a huge value (meaning that the
  11220. overlay will not be displayed within the output visible area).
  11221. @item eof_action
  11222. See @ref{framesync}.
  11223. @item eval
  11224. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11225. It accepts the following values:
  11226. @table @samp
  11227. @item init
  11228. only evaluate expressions once during the filter initialization or
  11229. when a command is processed
  11230. @item frame
  11231. evaluate expressions for each incoming frame
  11232. @end table
  11233. Default value is @samp{frame}.
  11234. @item shortest
  11235. See @ref{framesync}.
  11236. @item format
  11237. Set the format for the output video.
  11238. It accepts the following values:
  11239. @table @samp
  11240. @item yuv420
  11241. force YUV420 output
  11242. @item yuv420p10
  11243. force YUV420p10 output
  11244. @item yuv422
  11245. force YUV422 output
  11246. @item yuv422p10
  11247. force YUV422p10 output
  11248. @item yuv444
  11249. force YUV444 output
  11250. @item rgb
  11251. force packed RGB output
  11252. @item gbrp
  11253. force planar RGB output
  11254. @item auto
  11255. automatically pick format
  11256. @end table
  11257. Default value is @samp{yuv420}.
  11258. @item repeatlast
  11259. See @ref{framesync}.
  11260. @item alpha
  11261. Set format of alpha of the overlaid video, it can be @var{straight} or
  11262. @var{premultiplied}. Default is @var{straight}.
  11263. @end table
  11264. The @option{x}, and @option{y} expressions can contain the following
  11265. parameters.
  11266. @table @option
  11267. @item main_w, W
  11268. @item main_h, H
  11269. The main input width and height.
  11270. @item overlay_w, w
  11271. @item overlay_h, h
  11272. The overlay input width and height.
  11273. @item x
  11274. @item y
  11275. The computed values for @var{x} and @var{y}. They are evaluated for
  11276. each new frame.
  11277. @item hsub
  11278. @item vsub
  11279. horizontal and vertical chroma subsample values of the output
  11280. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11281. @var{vsub} is 1.
  11282. @item n
  11283. the number of input frame, starting from 0
  11284. @item pos
  11285. the position in the file of the input frame, NAN if unknown
  11286. @item t
  11287. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11288. @end table
  11289. This filter also supports the @ref{framesync} options.
  11290. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11291. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11292. when @option{eval} is set to @samp{init}.
  11293. Be aware that frames are taken from each input video in timestamp
  11294. order, hence, if their initial timestamps differ, it is a good idea
  11295. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11296. have them begin in the same zero timestamp, as the example for
  11297. the @var{movie} filter does.
  11298. You can chain together more overlays but you should test the
  11299. efficiency of such approach.
  11300. @subsection Commands
  11301. This filter supports the following commands:
  11302. @table @option
  11303. @item x
  11304. @item y
  11305. Modify the x and y of the overlay input.
  11306. The command accepts the same syntax of the corresponding option.
  11307. If the specified expression is not valid, it is kept at its current
  11308. value.
  11309. @end table
  11310. @subsection Examples
  11311. @itemize
  11312. @item
  11313. Draw the overlay at 10 pixels from the bottom right corner of the main
  11314. video:
  11315. @example
  11316. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11317. @end example
  11318. Using named options the example above becomes:
  11319. @example
  11320. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11321. @end example
  11322. @item
  11323. Insert a transparent PNG logo in the bottom left corner of the input,
  11324. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11325. @example
  11326. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11327. @end example
  11328. @item
  11329. Insert 2 different transparent PNG logos (second logo on bottom
  11330. right corner) using the @command{ffmpeg} tool:
  11331. @example
  11332. 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
  11333. @end example
  11334. @item
  11335. Add a transparent color layer on top of the main video; @code{WxH}
  11336. must specify the size of the main input to the overlay filter:
  11337. @example
  11338. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11339. @end example
  11340. @item
  11341. Play an original video and a filtered version (here with the deshake
  11342. filter) side by side using the @command{ffplay} tool:
  11343. @example
  11344. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11345. @end example
  11346. The above command is the same as:
  11347. @example
  11348. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11349. @end example
  11350. @item
  11351. Make a sliding overlay appearing from the left to the right top part of the
  11352. screen starting since time 2:
  11353. @example
  11354. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11355. @end example
  11356. @item
  11357. Compose output by putting two input videos side to side:
  11358. @example
  11359. ffmpeg -i left.avi -i right.avi -filter_complex "
  11360. nullsrc=size=200x100 [background];
  11361. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11362. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11363. [background][left] overlay=shortest=1 [background+left];
  11364. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11365. "
  11366. @end example
  11367. @item
  11368. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11369. @example
  11370. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11371. -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
  11372. masked.avi
  11373. @end example
  11374. @item
  11375. Chain several overlays in cascade:
  11376. @example
  11377. nullsrc=s=200x200 [bg];
  11378. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11379. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11380. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11381. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11382. [in3] null, [mid2] overlay=100:100 [out0]
  11383. @end example
  11384. @end itemize
  11385. @anchor{overlay_cuda}
  11386. @section overlay_cuda
  11387. Overlay one video on top of another.
  11388. This is the CUDA variant of the @ref{overlay} filter.
  11389. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11390. It takes two inputs and has one output. The first input is the "main"
  11391. video on which the second input is overlaid.
  11392. It accepts the following parameters:
  11393. @table @option
  11394. @item x
  11395. @item y
  11396. Set the x and y coordinates of the overlaid video on the main video.
  11397. Default value is "0" for both expressions.
  11398. @item eof_action
  11399. See @ref{framesync}.
  11400. @item shortest
  11401. See @ref{framesync}.
  11402. @item repeatlast
  11403. See @ref{framesync}.
  11404. @end table
  11405. This filter also supports the @ref{framesync} options.
  11406. @section owdenoise
  11407. Apply Overcomplete Wavelet denoiser.
  11408. The filter accepts the following options:
  11409. @table @option
  11410. @item depth
  11411. Set depth.
  11412. Larger depth values will denoise lower frequency components more, but
  11413. slow down filtering.
  11414. Must be an int in the range 8-16, default is @code{8}.
  11415. @item luma_strength, ls
  11416. Set luma strength.
  11417. Must be a double value in the range 0-1000, default is @code{1.0}.
  11418. @item chroma_strength, cs
  11419. Set chroma strength.
  11420. Must be a double value in the range 0-1000, default is @code{1.0}.
  11421. @end table
  11422. @anchor{pad}
  11423. @section pad
  11424. Add paddings to the input image, and place the original input at the
  11425. provided @var{x}, @var{y} coordinates.
  11426. It accepts the following parameters:
  11427. @table @option
  11428. @item width, w
  11429. @item height, h
  11430. Specify an expression for the size of the output image with the
  11431. paddings added. If the value for @var{width} or @var{height} is 0, the
  11432. corresponding input size is used for the output.
  11433. The @var{width} expression can reference the value set by the
  11434. @var{height} expression, and vice versa.
  11435. The default value of @var{width} and @var{height} is 0.
  11436. @item x
  11437. @item y
  11438. Specify the offsets to place the input image at within the padded area,
  11439. with respect to the top/left border of the output image.
  11440. The @var{x} expression can reference the value set by the @var{y}
  11441. expression, and vice versa.
  11442. The default value of @var{x} and @var{y} is 0.
  11443. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11444. so the input image is centered on the padded area.
  11445. @item color
  11446. Specify the color of the padded area. For the syntax of this option,
  11447. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11448. manual,ffmpeg-utils}.
  11449. The default value of @var{color} is "black".
  11450. @item eval
  11451. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11452. It accepts the following values:
  11453. @table @samp
  11454. @item init
  11455. Only evaluate expressions once during the filter initialization or when
  11456. a command is processed.
  11457. @item frame
  11458. Evaluate expressions for each incoming frame.
  11459. @end table
  11460. Default value is @samp{init}.
  11461. @item aspect
  11462. Pad to aspect instead to a resolution.
  11463. @end table
  11464. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11465. options are expressions containing the following constants:
  11466. @table @option
  11467. @item in_w
  11468. @item in_h
  11469. The input video width and height.
  11470. @item iw
  11471. @item ih
  11472. These are the same as @var{in_w} and @var{in_h}.
  11473. @item out_w
  11474. @item out_h
  11475. The output width and height (the size of the padded area), as
  11476. specified by the @var{width} and @var{height} expressions.
  11477. @item ow
  11478. @item oh
  11479. These are the same as @var{out_w} and @var{out_h}.
  11480. @item x
  11481. @item y
  11482. The x and y offsets as specified by the @var{x} and @var{y}
  11483. expressions, or NAN if not yet specified.
  11484. @item a
  11485. same as @var{iw} / @var{ih}
  11486. @item sar
  11487. input sample aspect ratio
  11488. @item dar
  11489. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11490. @item hsub
  11491. @item vsub
  11492. The horizontal and vertical chroma subsample values. For example for the
  11493. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11494. @end table
  11495. @subsection Examples
  11496. @itemize
  11497. @item
  11498. Add paddings with the color "violet" to the input video. The output video
  11499. size is 640x480, and the top-left corner of the input video is placed at
  11500. column 0, row 40
  11501. @example
  11502. pad=640:480:0:40:violet
  11503. @end example
  11504. The example above is equivalent to the following command:
  11505. @example
  11506. pad=width=640:height=480:x=0:y=40:color=violet
  11507. @end example
  11508. @item
  11509. Pad the input to get an output with dimensions increased by 3/2,
  11510. and put the input video at the center of the padded area:
  11511. @example
  11512. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11513. @end example
  11514. @item
  11515. Pad the input to get a squared output with size equal to the maximum
  11516. value between the input width and height, and put the input video at
  11517. the center of the padded area:
  11518. @example
  11519. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11520. @end example
  11521. @item
  11522. Pad the input to get a final w/h ratio of 16:9:
  11523. @example
  11524. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11525. @end example
  11526. @item
  11527. In case of anamorphic video, in order to set the output display aspect
  11528. correctly, it is necessary to use @var{sar} in the expression,
  11529. according to the relation:
  11530. @example
  11531. (ih * X / ih) * sar = output_dar
  11532. X = output_dar / sar
  11533. @end example
  11534. Thus the previous example needs to be modified to:
  11535. @example
  11536. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11537. @end example
  11538. @item
  11539. Double the output size and put the input video in the bottom-right
  11540. corner of the output padded area:
  11541. @example
  11542. pad="2*iw:2*ih:ow-iw:oh-ih"
  11543. @end example
  11544. @end itemize
  11545. @anchor{palettegen}
  11546. @section palettegen
  11547. Generate one palette for a whole video stream.
  11548. It accepts the following options:
  11549. @table @option
  11550. @item max_colors
  11551. Set the maximum number of colors to quantize in the palette.
  11552. Note: the palette will still contain 256 colors; the unused palette entries
  11553. will be black.
  11554. @item reserve_transparent
  11555. Create a palette of 255 colors maximum and reserve the last one for
  11556. transparency. Reserving the transparency color is useful for GIF optimization.
  11557. If not set, the maximum of colors in the palette will be 256. You probably want
  11558. to disable this option for a standalone image.
  11559. Set by default.
  11560. @item transparency_color
  11561. Set the color that will be used as background for transparency.
  11562. @item stats_mode
  11563. Set statistics mode.
  11564. It accepts the following values:
  11565. @table @samp
  11566. @item full
  11567. Compute full frame histograms.
  11568. @item diff
  11569. Compute histograms only for the part that differs from previous frame. This
  11570. might be relevant to give more importance to the moving part of your input if
  11571. the background is static.
  11572. @item single
  11573. Compute new histogram for each frame.
  11574. @end table
  11575. Default value is @var{full}.
  11576. @end table
  11577. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11578. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11579. color quantization of the palette. This information is also visible at
  11580. @var{info} logging level.
  11581. @subsection Examples
  11582. @itemize
  11583. @item
  11584. Generate a representative palette of a given video using @command{ffmpeg}:
  11585. @example
  11586. ffmpeg -i input.mkv -vf palettegen palette.png
  11587. @end example
  11588. @end itemize
  11589. @section paletteuse
  11590. Use a palette to downsample an input video stream.
  11591. The filter takes two inputs: one video stream and a palette. The palette must
  11592. be a 256 pixels image.
  11593. It accepts the following options:
  11594. @table @option
  11595. @item dither
  11596. Select dithering mode. Available algorithms are:
  11597. @table @samp
  11598. @item bayer
  11599. Ordered 8x8 bayer dithering (deterministic)
  11600. @item heckbert
  11601. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11602. Note: this dithering is sometimes considered "wrong" and is included as a
  11603. reference.
  11604. @item floyd_steinberg
  11605. Floyd and Steingberg dithering (error diffusion)
  11606. @item sierra2
  11607. Frankie Sierra dithering v2 (error diffusion)
  11608. @item sierra2_4a
  11609. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11610. @end table
  11611. Default is @var{sierra2_4a}.
  11612. @item bayer_scale
  11613. When @var{bayer} dithering is selected, this option defines the scale of the
  11614. pattern (how much the crosshatch pattern is visible). A low value means more
  11615. visible pattern for less banding, and higher value means less visible pattern
  11616. at the cost of more banding.
  11617. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11618. @item diff_mode
  11619. If set, define the zone to process
  11620. @table @samp
  11621. @item rectangle
  11622. Only the changing rectangle will be reprocessed. This is similar to GIF
  11623. cropping/offsetting compression mechanism. This option can be useful for speed
  11624. if only a part of the image is changing, and has use cases such as limiting the
  11625. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11626. moving scene (it leads to more deterministic output if the scene doesn't change
  11627. much, and as a result less moving noise and better GIF compression).
  11628. @end table
  11629. Default is @var{none}.
  11630. @item new
  11631. Take new palette for each output frame.
  11632. @item alpha_threshold
  11633. Sets the alpha threshold for transparency. Alpha values above this threshold
  11634. will be treated as completely opaque, and values below this threshold will be
  11635. treated as completely transparent.
  11636. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11637. @end table
  11638. @subsection Examples
  11639. @itemize
  11640. @item
  11641. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11642. using @command{ffmpeg}:
  11643. @example
  11644. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11645. @end example
  11646. @end itemize
  11647. @section perspective
  11648. Correct perspective of video not recorded perpendicular to the screen.
  11649. A description of the accepted parameters follows.
  11650. @table @option
  11651. @item x0
  11652. @item y0
  11653. @item x1
  11654. @item y1
  11655. @item x2
  11656. @item y2
  11657. @item x3
  11658. @item y3
  11659. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11660. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11661. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11662. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11663. then the corners of the source will be sent to the specified coordinates.
  11664. The expressions can use the following variables:
  11665. @table @option
  11666. @item W
  11667. @item H
  11668. the width and height of video frame.
  11669. @item in
  11670. Input frame count.
  11671. @item on
  11672. Output frame count.
  11673. @end table
  11674. @item interpolation
  11675. Set interpolation for perspective correction.
  11676. It accepts the following values:
  11677. @table @samp
  11678. @item linear
  11679. @item cubic
  11680. @end table
  11681. Default value is @samp{linear}.
  11682. @item sense
  11683. Set interpretation of coordinate options.
  11684. It accepts the following values:
  11685. @table @samp
  11686. @item 0, source
  11687. Send point in the source specified by the given coordinates to
  11688. the corners of the destination.
  11689. @item 1, destination
  11690. Send the corners of the source to the point in the destination specified
  11691. by the given coordinates.
  11692. Default value is @samp{source}.
  11693. @end table
  11694. @item eval
  11695. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11696. It accepts the following values:
  11697. @table @samp
  11698. @item init
  11699. only evaluate expressions once during the filter initialization or
  11700. when a command is processed
  11701. @item frame
  11702. evaluate expressions for each incoming frame
  11703. @end table
  11704. Default value is @samp{init}.
  11705. @end table
  11706. @section phase
  11707. Delay interlaced video by one field time so that the field order changes.
  11708. The intended use is to fix PAL movies that have been captured with the
  11709. opposite field order to the film-to-video transfer.
  11710. A description of the accepted parameters follows.
  11711. @table @option
  11712. @item mode
  11713. Set phase mode.
  11714. It accepts the following values:
  11715. @table @samp
  11716. @item t
  11717. Capture field order top-first, transfer bottom-first.
  11718. Filter will delay the bottom field.
  11719. @item b
  11720. Capture field order bottom-first, transfer top-first.
  11721. Filter will delay the top field.
  11722. @item p
  11723. Capture and transfer with the same field order. This mode only exists
  11724. for the documentation of the other options to refer to, but if you
  11725. actually select it, the filter will faithfully do nothing.
  11726. @item a
  11727. Capture field order determined automatically by field flags, transfer
  11728. opposite.
  11729. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11730. basis using field flags. If no field information is available,
  11731. then this works just like @samp{u}.
  11732. @item u
  11733. Capture unknown or varying, transfer opposite.
  11734. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11735. analyzing the images and selecting the alternative that produces best
  11736. match between the fields.
  11737. @item T
  11738. Capture top-first, transfer unknown or varying.
  11739. Filter selects among @samp{t} and @samp{p} using image analysis.
  11740. @item B
  11741. Capture bottom-first, transfer unknown or varying.
  11742. Filter selects among @samp{b} and @samp{p} using image analysis.
  11743. @item A
  11744. Capture determined by field flags, transfer unknown or varying.
  11745. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11746. image analysis. If no field information is available, then this works just
  11747. like @samp{U}. This is the default mode.
  11748. @item U
  11749. Both capture and transfer unknown or varying.
  11750. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11751. @end table
  11752. @end table
  11753. @section photosensitivity
  11754. Reduce various flashes in video, so to help users with epilepsy.
  11755. It accepts the following options:
  11756. @table @option
  11757. @item frames, f
  11758. Set how many frames to use when filtering. Default is 30.
  11759. @item threshold, t
  11760. Set detection threshold factor. Default is 1.
  11761. Lower is stricter.
  11762. @item skip
  11763. Set how many pixels to skip when sampling frames. Default is 1.
  11764. Allowed range is from 1 to 1024.
  11765. @item bypass
  11766. Leave frames unchanged. Default is disabled.
  11767. @end table
  11768. @section pixdesctest
  11769. Pixel format descriptor test filter, mainly useful for internal
  11770. testing. The output video should be equal to the input video.
  11771. For example:
  11772. @example
  11773. format=monow, pixdesctest
  11774. @end example
  11775. can be used to test the monowhite pixel format descriptor definition.
  11776. @section pixscope
  11777. Display sample values of color channels. Mainly useful for checking color
  11778. and levels. Minimum supported resolution is 640x480.
  11779. The filters accept the following options:
  11780. @table @option
  11781. @item x
  11782. Set scope X position, relative offset on X axis.
  11783. @item y
  11784. Set scope Y position, relative offset on Y axis.
  11785. @item w
  11786. Set scope width.
  11787. @item h
  11788. Set scope height.
  11789. @item o
  11790. Set window opacity. This window also holds statistics about pixel area.
  11791. @item wx
  11792. Set window X position, relative offset on X axis.
  11793. @item wy
  11794. Set window Y position, relative offset on Y axis.
  11795. @end table
  11796. @section pp
  11797. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11798. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11799. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11800. Each subfilter and some options have a short and a long name that can be used
  11801. interchangeably, i.e. dr/dering are the same.
  11802. The filters accept the following options:
  11803. @table @option
  11804. @item subfilters
  11805. Set postprocessing subfilters string.
  11806. @end table
  11807. All subfilters share common options to determine their scope:
  11808. @table @option
  11809. @item a/autoq
  11810. Honor the quality commands for this subfilter.
  11811. @item c/chrom
  11812. Do chrominance filtering, too (default).
  11813. @item y/nochrom
  11814. Do luminance filtering only (no chrominance).
  11815. @item n/noluma
  11816. Do chrominance filtering only (no luminance).
  11817. @end table
  11818. These options can be appended after the subfilter name, separated by a '|'.
  11819. Available subfilters are:
  11820. @table @option
  11821. @item hb/hdeblock[|difference[|flatness]]
  11822. Horizontal deblocking filter
  11823. @table @option
  11824. @item difference
  11825. Difference factor where higher values mean more deblocking (default: @code{32}).
  11826. @item flatness
  11827. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11828. @end table
  11829. @item vb/vdeblock[|difference[|flatness]]
  11830. Vertical deblocking filter
  11831. @table @option
  11832. @item difference
  11833. Difference factor where higher values mean more deblocking (default: @code{32}).
  11834. @item flatness
  11835. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11836. @end table
  11837. @item ha/hadeblock[|difference[|flatness]]
  11838. Accurate horizontal deblocking filter
  11839. @table @option
  11840. @item difference
  11841. Difference factor where higher values mean more deblocking (default: @code{32}).
  11842. @item flatness
  11843. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11844. @end table
  11845. @item va/vadeblock[|difference[|flatness]]
  11846. Accurate vertical deblocking filter
  11847. @table @option
  11848. @item difference
  11849. Difference factor where higher values mean more deblocking (default: @code{32}).
  11850. @item flatness
  11851. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11852. @end table
  11853. @end table
  11854. The horizontal and vertical deblocking filters share the difference and
  11855. flatness values so you cannot set different horizontal and vertical
  11856. thresholds.
  11857. @table @option
  11858. @item h1/x1hdeblock
  11859. Experimental horizontal deblocking filter
  11860. @item v1/x1vdeblock
  11861. Experimental vertical deblocking filter
  11862. @item dr/dering
  11863. Deringing filter
  11864. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11865. @table @option
  11866. @item threshold1
  11867. larger -> stronger filtering
  11868. @item threshold2
  11869. larger -> stronger filtering
  11870. @item threshold3
  11871. larger -> stronger filtering
  11872. @end table
  11873. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11874. @table @option
  11875. @item f/fullyrange
  11876. Stretch luminance to @code{0-255}.
  11877. @end table
  11878. @item lb/linblenddeint
  11879. Linear blend deinterlacing filter that deinterlaces the given block by
  11880. filtering all lines with a @code{(1 2 1)} filter.
  11881. @item li/linipoldeint
  11882. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11883. linearly interpolating every second line.
  11884. @item ci/cubicipoldeint
  11885. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11886. cubically interpolating every second line.
  11887. @item md/mediandeint
  11888. Median deinterlacing filter that deinterlaces the given block by applying a
  11889. median filter to every second line.
  11890. @item fd/ffmpegdeint
  11891. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11892. second line with a @code{(-1 4 2 4 -1)} filter.
  11893. @item l5/lowpass5
  11894. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11895. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11896. @item fq/forceQuant[|quantizer]
  11897. Overrides the quantizer table from the input with the constant quantizer you
  11898. specify.
  11899. @table @option
  11900. @item quantizer
  11901. Quantizer to use
  11902. @end table
  11903. @item de/default
  11904. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11905. @item fa/fast
  11906. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11907. @item ac
  11908. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11909. @end table
  11910. @subsection Examples
  11911. @itemize
  11912. @item
  11913. Apply horizontal and vertical deblocking, deringing and automatic
  11914. brightness/contrast:
  11915. @example
  11916. pp=hb/vb/dr/al
  11917. @end example
  11918. @item
  11919. Apply default filters without brightness/contrast correction:
  11920. @example
  11921. pp=de/-al
  11922. @end example
  11923. @item
  11924. Apply default filters and temporal denoiser:
  11925. @example
  11926. pp=default/tmpnoise|1|2|3
  11927. @end example
  11928. @item
  11929. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11930. automatically depending on available CPU time:
  11931. @example
  11932. pp=hb|y/vb|a
  11933. @end example
  11934. @end itemize
  11935. @section pp7
  11936. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11937. similar to spp = 6 with 7 point DCT, where only the center sample is
  11938. used after IDCT.
  11939. The filter accepts the following options:
  11940. @table @option
  11941. @item qp
  11942. Force a constant quantization parameter. It accepts an integer in range
  11943. 0 to 63. If not set, the filter will use the QP from the video stream
  11944. (if available).
  11945. @item mode
  11946. Set thresholding mode. Available modes are:
  11947. @table @samp
  11948. @item hard
  11949. Set hard thresholding.
  11950. @item soft
  11951. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11952. @item medium
  11953. Set medium thresholding (good results, default).
  11954. @end table
  11955. @end table
  11956. @section premultiply
  11957. Apply alpha premultiply effect to input video stream using first plane
  11958. of second stream as alpha.
  11959. Both streams must have same dimensions and same pixel format.
  11960. The filter accepts the following option:
  11961. @table @option
  11962. @item planes
  11963. Set which planes will be processed, unprocessed planes will be copied.
  11964. By default value 0xf, all planes will be processed.
  11965. @item inplace
  11966. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11967. @end table
  11968. @section prewitt
  11969. Apply prewitt operator to input video stream.
  11970. The filter accepts the following option:
  11971. @table @option
  11972. @item planes
  11973. Set which planes will be processed, unprocessed planes will be copied.
  11974. By default value 0xf, all planes will be processed.
  11975. @item scale
  11976. Set value which will be multiplied with filtered result.
  11977. @item delta
  11978. Set value which will be added to filtered result.
  11979. @end table
  11980. @section pseudocolor
  11981. Alter frame colors in video with pseudocolors.
  11982. This filter accepts the following options:
  11983. @table @option
  11984. @item c0
  11985. set pixel first component expression
  11986. @item c1
  11987. set pixel second component expression
  11988. @item c2
  11989. set pixel third component expression
  11990. @item c3
  11991. set pixel fourth component expression, corresponds to the alpha component
  11992. @item i
  11993. set component to use as base for altering colors
  11994. @end table
  11995. Each of them specifies the expression to use for computing the lookup table for
  11996. the corresponding pixel component values.
  11997. The expressions can contain the following constants and functions:
  11998. @table @option
  11999. @item w
  12000. @item h
  12001. The input width and height.
  12002. @item val
  12003. The input value for the pixel component.
  12004. @item ymin, umin, vmin, amin
  12005. The minimum allowed component value.
  12006. @item ymax, umax, vmax, amax
  12007. The maximum allowed component value.
  12008. @end table
  12009. All expressions default to "val".
  12010. @subsection Examples
  12011. @itemize
  12012. @item
  12013. Change too high luma values to gradient:
  12014. @example
  12015. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  12016. @end example
  12017. @end itemize
  12018. @section psnr
  12019. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12020. Ratio) between two input videos.
  12021. This filter takes in input two input videos, the first input is
  12022. considered the "main" source and is passed unchanged to the
  12023. output. The second input is used as a "reference" video for computing
  12024. the PSNR.
  12025. Both video inputs must have the same resolution and pixel format for
  12026. this filter to work correctly. Also it assumes that both inputs
  12027. have the same number of frames, which are compared one by one.
  12028. The obtained average PSNR is printed through the logging system.
  12029. The filter stores the accumulated MSE (mean squared error) of each
  12030. frame, and at the end of the processing it is averaged across all frames
  12031. equally, and the following formula is applied to obtain the PSNR:
  12032. @example
  12033. PSNR = 10*log10(MAX^2/MSE)
  12034. @end example
  12035. Where MAX is the average of the maximum values of each component of the
  12036. image.
  12037. The description of the accepted parameters follows.
  12038. @table @option
  12039. @item stats_file, f
  12040. If specified the filter will use the named file to save the PSNR of
  12041. each individual frame. When filename equals "-" the data is sent to
  12042. standard output.
  12043. @item stats_version
  12044. Specifies which version of the stats file format to use. Details of
  12045. each format are written below.
  12046. Default value is 1.
  12047. @item stats_add_max
  12048. Determines whether the max value is output to the stats log.
  12049. Default value is 0.
  12050. Requires stats_version >= 2. If this is set and stats_version < 2,
  12051. the filter will return an error.
  12052. @end table
  12053. This filter also supports the @ref{framesync} options.
  12054. The file printed if @var{stats_file} is selected, contains a sequence of
  12055. key/value pairs of the form @var{key}:@var{value} for each compared
  12056. couple of frames.
  12057. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12058. the list of per-frame-pair stats, with key value pairs following the frame
  12059. format with the following parameters:
  12060. @table @option
  12061. @item psnr_log_version
  12062. The version of the log file format. Will match @var{stats_version}.
  12063. @item fields
  12064. A comma separated list of the per-frame-pair parameters included in
  12065. the log.
  12066. @end table
  12067. A description of each shown per-frame-pair parameter follows:
  12068. @table @option
  12069. @item n
  12070. sequential number of the input frame, starting from 1
  12071. @item mse_avg
  12072. Mean Square Error pixel-by-pixel average difference of the compared
  12073. frames, averaged over all the image components.
  12074. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12075. Mean Square Error pixel-by-pixel average difference of the compared
  12076. frames for the component specified by the suffix.
  12077. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12078. Peak Signal to Noise ratio of the compared frames for the component
  12079. specified by the suffix.
  12080. @item max_avg, max_y, max_u, max_v
  12081. Maximum allowed value for each channel, and average over all
  12082. channels.
  12083. @end table
  12084. @subsection Examples
  12085. @itemize
  12086. @item
  12087. For example:
  12088. @example
  12089. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12090. [main][ref] psnr="stats_file=stats.log" [out]
  12091. @end example
  12092. On this example the input file being processed is compared with the
  12093. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12094. is stored in @file{stats.log}.
  12095. @item
  12096. Another example with different containers:
  12097. @example
  12098. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  12099. @end example
  12100. @end itemize
  12101. @anchor{pullup}
  12102. @section pullup
  12103. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12104. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12105. content.
  12106. The pullup filter is designed to take advantage of future context in making
  12107. its decisions. This filter is stateless in the sense that it does not lock
  12108. onto a pattern to follow, but it instead looks forward to the following
  12109. fields in order to identify matches and rebuild progressive frames.
  12110. To produce content with an even framerate, insert the fps filter after
  12111. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12112. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12113. The filter accepts the following options:
  12114. @table @option
  12115. @item jl
  12116. @item jr
  12117. @item jt
  12118. @item jb
  12119. These options set the amount of "junk" to ignore at the left, right, top, and
  12120. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12121. while top and bottom are in units of 2 lines.
  12122. The default is 8 pixels on each side.
  12123. @item sb
  12124. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12125. filter generating an occasional mismatched frame, but it may also cause an
  12126. excessive number of frames to be dropped during high motion sequences.
  12127. Conversely, setting it to -1 will make filter match fields more easily.
  12128. This may help processing of video where there is slight blurring between
  12129. the fields, but may also cause there to be interlaced frames in the output.
  12130. Default value is @code{0}.
  12131. @item mp
  12132. Set the metric plane to use. It accepts the following values:
  12133. @table @samp
  12134. @item l
  12135. Use luma plane.
  12136. @item u
  12137. Use chroma blue plane.
  12138. @item v
  12139. Use chroma red plane.
  12140. @end table
  12141. This option may be set to use chroma plane instead of the default luma plane
  12142. for doing filter's computations. This may improve accuracy on very clean
  12143. source material, but more likely will decrease accuracy, especially if there
  12144. is chroma noise (rainbow effect) or any grayscale video.
  12145. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12146. load and make pullup usable in realtime on slow machines.
  12147. @end table
  12148. For best results (without duplicated frames in the output file) it is
  12149. necessary to change the output frame rate. For example, to inverse
  12150. telecine NTSC input:
  12151. @example
  12152. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12153. @end example
  12154. @section qp
  12155. Change video quantization parameters (QP).
  12156. The filter accepts the following option:
  12157. @table @option
  12158. @item qp
  12159. Set expression for quantization parameter.
  12160. @end table
  12161. The expression is evaluated through the eval API and can contain, among others,
  12162. the following constants:
  12163. @table @var
  12164. @item known
  12165. 1 if index is not 129, 0 otherwise.
  12166. @item qp
  12167. Sequential index starting from -129 to 128.
  12168. @end table
  12169. @subsection Examples
  12170. @itemize
  12171. @item
  12172. Some equation like:
  12173. @example
  12174. qp=2+2*sin(PI*qp)
  12175. @end example
  12176. @end itemize
  12177. @section random
  12178. Flush video frames from internal cache of frames into a random order.
  12179. No frame is discarded.
  12180. Inspired by @ref{frei0r} nervous filter.
  12181. @table @option
  12182. @item frames
  12183. Set size in number of frames of internal cache, in range from @code{2} to
  12184. @code{512}. Default is @code{30}.
  12185. @item seed
  12186. Set seed for random number generator, must be an integer included between
  12187. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12188. less than @code{0}, the filter will try to use a good random seed on a
  12189. best effort basis.
  12190. @end table
  12191. @section readeia608
  12192. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12193. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12194. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12195. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12196. @table @option
  12197. @item lavfi.readeia608.X.cc
  12198. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12199. @item lavfi.readeia608.X.line
  12200. The number of the line on which the EIA-608 data was identified and read.
  12201. @end table
  12202. This filter accepts the following options:
  12203. @table @option
  12204. @item scan_min
  12205. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12206. @item scan_max
  12207. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12208. @item spw
  12209. Set the ratio of width reserved for sync code detection.
  12210. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12211. @item chp
  12212. Enable checking the parity bit. In the event of a parity error, the filter will output
  12213. @code{0x00} for that character. Default is false.
  12214. @item lp
  12215. Lowpass lines prior to further processing. Default is enabled.
  12216. @end table
  12217. @subsection Commands
  12218. This filter supports the all above options as @ref{commands}.
  12219. @subsection Examples
  12220. @itemize
  12221. @item
  12222. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12223. @example
  12224. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  12225. @end example
  12226. @end itemize
  12227. @section readvitc
  12228. Read vertical interval timecode (VITC) information from the top lines of a
  12229. video frame.
  12230. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12231. timecode value, if a valid timecode has been detected. Further metadata key
  12232. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12233. timecode data has been found or not.
  12234. This filter accepts the following options:
  12235. @table @option
  12236. @item scan_max
  12237. Set the maximum number of lines to scan for VITC data. If the value is set to
  12238. @code{-1} the full video frame is scanned. Default is @code{45}.
  12239. @item thr_b
  12240. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12241. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12242. @item thr_w
  12243. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12244. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12245. @end table
  12246. @subsection Examples
  12247. @itemize
  12248. @item
  12249. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12250. draw @code{--:--:--:--} as a placeholder:
  12251. @example
  12252. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12253. @end example
  12254. @end itemize
  12255. @section remap
  12256. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12257. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12258. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12259. value for pixel will be used for destination pixel.
  12260. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12261. will have Xmap/Ymap video stream dimensions.
  12262. Xmap and Ymap input video streams are 16bit depth, single channel.
  12263. @table @option
  12264. @item format
  12265. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12266. Default is @code{color}.
  12267. @item fill
  12268. Specify the color of the unmapped pixels. For the syntax of this option,
  12269. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12270. manual,ffmpeg-utils}. Default color is @code{black}.
  12271. @end table
  12272. @section removegrain
  12273. The removegrain filter is a spatial denoiser for progressive video.
  12274. @table @option
  12275. @item m0
  12276. Set mode for the first plane.
  12277. @item m1
  12278. Set mode for the second plane.
  12279. @item m2
  12280. Set mode for the third plane.
  12281. @item m3
  12282. Set mode for the fourth plane.
  12283. @end table
  12284. Range of mode is from 0 to 24. Description of each mode follows:
  12285. @table @var
  12286. @item 0
  12287. Leave input plane unchanged. Default.
  12288. @item 1
  12289. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12290. @item 2
  12291. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12292. @item 3
  12293. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12294. @item 4
  12295. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12296. This is equivalent to a median filter.
  12297. @item 5
  12298. Line-sensitive clipping giving the minimal change.
  12299. @item 6
  12300. Line-sensitive clipping, intermediate.
  12301. @item 7
  12302. Line-sensitive clipping, intermediate.
  12303. @item 8
  12304. Line-sensitive clipping, intermediate.
  12305. @item 9
  12306. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12307. @item 10
  12308. Replaces the target pixel with the closest neighbour.
  12309. @item 11
  12310. [1 2 1] horizontal and vertical kernel blur.
  12311. @item 12
  12312. Same as mode 11.
  12313. @item 13
  12314. Bob mode, interpolates top field from the line where the neighbours
  12315. pixels are the closest.
  12316. @item 14
  12317. Bob mode, interpolates bottom field from the line where the neighbours
  12318. pixels are the closest.
  12319. @item 15
  12320. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12321. interpolation formula.
  12322. @item 16
  12323. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12324. interpolation formula.
  12325. @item 17
  12326. Clips the pixel with the minimum and maximum of respectively the maximum and
  12327. minimum of each pair of opposite neighbour pixels.
  12328. @item 18
  12329. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12330. the current pixel is minimal.
  12331. @item 19
  12332. Replaces the pixel with the average of its 8 neighbours.
  12333. @item 20
  12334. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12335. @item 21
  12336. Clips pixels using the averages of opposite neighbour.
  12337. @item 22
  12338. Same as mode 21 but simpler and faster.
  12339. @item 23
  12340. Small edge and halo removal, but reputed useless.
  12341. @item 24
  12342. Similar as 23.
  12343. @end table
  12344. @section removelogo
  12345. Suppress a TV station logo, using an image file to determine which
  12346. pixels comprise the logo. It works by filling in the pixels that
  12347. comprise the logo with neighboring pixels.
  12348. The filter accepts the following options:
  12349. @table @option
  12350. @item filename, f
  12351. Set the filter bitmap file, which can be any image format supported by
  12352. libavformat. The width and height of the image file must match those of the
  12353. video stream being processed.
  12354. @end table
  12355. Pixels in the provided bitmap image with a value of zero are not
  12356. considered part of the logo, non-zero pixels are considered part of
  12357. the logo. If you use white (255) for the logo and black (0) for the
  12358. rest, you will be safe. For making the filter bitmap, it is
  12359. recommended to take a screen capture of a black frame with the logo
  12360. visible, and then using a threshold filter followed by the erode
  12361. filter once or twice.
  12362. If needed, little splotches can be fixed manually. Remember that if
  12363. logo pixels are not covered, the filter quality will be much
  12364. reduced. Marking too many pixels as part of the logo does not hurt as
  12365. much, but it will increase the amount of blurring needed to cover over
  12366. the image and will destroy more information than necessary, and extra
  12367. pixels will slow things down on a large logo.
  12368. @section repeatfields
  12369. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12370. fields based on its value.
  12371. @section reverse
  12372. Reverse a video clip.
  12373. Warning: This filter requires memory to buffer the entire clip, so trimming
  12374. is suggested.
  12375. @subsection Examples
  12376. @itemize
  12377. @item
  12378. Take the first 5 seconds of a clip, and reverse it.
  12379. @example
  12380. trim=end=5,reverse
  12381. @end example
  12382. @end itemize
  12383. @section rgbashift
  12384. Shift R/G/B/A pixels horizontally and/or vertically.
  12385. The filter accepts the following options:
  12386. @table @option
  12387. @item rh
  12388. Set amount to shift red horizontally.
  12389. @item rv
  12390. Set amount to shift red vertically.
  12391. @item gh
  12392. Set amount to shift green horizontally.
  12393. @item gv
  12394. Set amount to shift green vertically.
  12395. @item bh
  12396. Set amount to shift blue horizontally.
  12397. @item bv
  12398. Set amount to shift blue vertically.
  12399. @item ah
  12400. Set amount to shift alpha horizontally.
  12401. @item av
  12402. Set amount to shift alpha vertically.
  12403. @item edge
  12404. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12405. @end table
  12406. @subsection Commands
  12407. This filter supports the all above options as @ref{commands}.
  12408. @section roberts
  12409. Apply roberts cross operator to input video stream.
  12410. The filter accepts the following option:
  12411. @table @option
  12412. @item planes
  12413. Set which planes will be processed, unprocessed planes will be copied.
  12414. By default value 0xf, all planes will be processed.
  12415. @item scale
  12416. Set value which will be multiplied with filtered result.
  12417. @item delta
  12418. Set value which will be added to filtered result.
  12419. @end table
  12420. @section rotate
  12421. Rotate video by an arbitrary angle expressed in radians.
  12422. The filter accepts the following options:
  12423. A description of the optional parameters follows.
  12424. @table @option
  12425. @item angle, a
  12426. Set an expression for the angle by which to rotate the input video
  12427. clockwise, expressed as a number of radians. A negative value will
  12428. result in a counter-clockwise rotation. By default it is set to "0".
  12429. This expression is evaluated for each frame.
  12430. @item out_w, ow
  12431. Set the output width expression, default value is "iw".
  12432. This expression is evaluated just once during configuration.
  12433. @item out_h, oh
  12434. Set the output height expression, default value is "ih".
  12435. This expression is evaluated just once during configuration.
  12436. @item bilinear
  12437. Enable bilinear interpolation if set to 1, a value of 0 disables
  12438. it. Default value is 1.
  12439. @item fillcolor, c
  12440. Set the color used to fill the output area not covered by the rotated
  12441. image. For the general syntax of this option, check the
  12442. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12443. If the special value "none" is selected then no
  12444. background is printed (useful for example if the background is never shown).
  12445. Default value is "black".
  12446. @end table
  12447. The expressions for the angle and the output size can contain the
  12448. following constants and functions:
  12449. @table @option
  12450. @item n
  12451. sequential number of the input frame, starting from 0. It is always NAN
  12452. before the first frame is filtered.
  12453. @item t
  12454. time in seconds of the input frame, it is set to 0 when the filter is
  12455. configured. It is always NAN before the first frame is filtered.
  12456. @item hsub
  12457. @item vsub
  12458. horizontal and vertical chroma subsample values. For example for the
  12459. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12460. @item in_w, iw
  12461. @item in_h, ih
  12462. the input video width and height
  12463. @item out_w, ow
  12464. @item out_h, oh
  12465. the output width and height, that is the size of the padded area as
  12466. specified by the @var{width} and @var{height} expressions
  12467. @item rotw(a)
  12468. @item roth(a)
  12469. the minimal width/height required for completely containing the input
  12470. video rotated by @var{a} radians.
  12471. These are only available when computing the @option{out_w} and
  12472. @option{out_h} expressions.
  12473. @end table
  12474. @subsection Examples
  12475. @itemize
  12476. @item
  12477. Rotate the input by PI/6 radians clockwise:
  12478. @example
  12479. rotate=PI/6
  12480. @end example
  12481. @item
  12482. Rotate the input by PI/6 radians counter-clockwise:
  12483. @example
  12484. rotate=-PI/6
  12485. @end example
  12486. @item
  12487. Rotate the input by 45 degrees clockwise:
  12488. @example
  12489. rotate=45*PI/180
  12490. @end example
  12491. @item
  12492. Apply a constant rotation with period T, starting from an angle of PI/3:
  12493. @example
  12494. rotate=PI/3+2*PI*t/T
  12495. @end example
  12496. @item
  12497. Make the input video rotation oscillating with a period of T
  12498. seconds and an amplitude of A radians:
  12499. @example
  12500. rotate=A*sin(2*PI/T*t)
  12501. @end example
  12502. @item
  12503. Rotate the video, output size is chosen so that the whole rotating
  12504. input video is always completely contained in the output:
  12505. @example
  12506. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12507. @end example
  12508. @item
  12509. Rotate the video, reduce the output size so that no background is ever
  12510. shown:
  12511. @example
  12512. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12513. @end example
  12514. @end itemize
  12515. @subsection Commands
  12516. The filter supports the following commands:
  12517. @table @option
  12518. @item a, angle
  12519. Set the angle expression.
  12520. The command accepts the same syntax of the corresponding option.
  12521. If the specified expression is not valid, it is kept at its current
  12522. value.
  12523. @end table
  12524. @section sab
  12525. Apply Shape Adaptive Blur.
  12526. The filter accepts the following options:
  12527. @table @option
  12528. @item luma_radius, lr
  12529. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12530. value is 1.0. A greater value will result in a more blurred image, and
  12531. in slower processing.
  12532. @item luma_pre_filter_radius, lpfr
  12533. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12534. value is 1.0.
  12535. @item luma_strength, ls
  12536. Set luma maximum difference between pixels to still be considered, must
  12537. be a value in the 0.1-100.0 range, default value is 1.0.
  12538. @item chroma_radius, cr
  12539. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12540. greater value will result in a more blurred image, and in slower
  12541. processing.
  12542. @item chroma_pre_filter_radius, cpfr
  12543. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12544. @item chroma_strength, cs
  12545. Set chroma maximum difference between pixels to still be considered,
  12546. must be a value in the -0.9-100.0 range.
  12547. @end table
  12548. Each chroma option value, if not explicitly specified, is set to the
  12549. corresponding luma option value.
  12550. @anchor{scale}
  12551. @section scale
  12552. Scale (resize) the input video, using the libswscale library.
  12553. The scale filter forces the output display aspect ratio to be the same
  12554. of the input, by changing the output sample aspect ratio.
  12555. If the input image format is different from the format requested by
  12556. the next filter, the scale filter will convert the input to the
  12557. requested format.
  12558. @subsection Options
  12559. The filter accepts the following options, or any of the options
  12560. supported by the libswscale scaler.
  12561. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12562. the complete list of scaler options.
  12563. @table @option
  12564. @item width, w
  12565. @item height, h
  12566. Set the output video dimension expression. Default value is the input
  12567. dimension.
  12568. If the @var{width} or @var{w} value is 0, the input width is used for
  12569. the output. If the @var{height} or @var{h} value is 0, the input height
  12570. is used for the output.
  12571. If one and only one of the values is -n with n >= 1, the scale filter
  12572. will use a value that maintains the aspect ratio of the input image,
  12573. calculated from the other specified dimension. After that it will,
  12574. however, make sure that the calculated dimension is divisible by n and
  12575. adjust the value if necessary.
  12576. If both values are -n with n >= 1, the behavior will be identical to
  12577. both values being set to 0 as previously detailed.
  12578. See below for the list of accepted constants for use in the dimension
  12579. expression.
  12580. @item eval
  12581. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12582. @table @samp
  12583. @item init
  12584. Only evaluate expressions once during the filter initialization or when a command is processed.
  12585. @item frame
  12586. Evaluate expressions for each incoming frame.
  12587. @end table
  12588. Default value is @samp{init}.
  12589. @item interl
  12590. Set the interlacing mode. It accepts the following values:
  12591. @table @samp
  12592. @item 1
  12593. Force interlaced aware scaling.
  12594. @item 0
  12595. Do not apply interlaced scaling.
  12596. @item -1
  12597. Select interlaced aware scaling depending on whether the source frames
  12598. are flagged as interlaced or not.
  12599. @end table
  12600. Default value is @samp{0}.
  12601. @item flags
  12602. Set libswscale scaling flags. See
  12603. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12604. complete list of values. If not explicitly specified the filter applies
  12605. the default flags.
  12606. @item param0, param1
  12607. Set libswscale input parameters for scaling algorithms that need them. See
  12608. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12609. complete documentation. If not explicitly specified the filter applies
  12610. empty parameters.
  12611. @item size, s
  12612. Set the video size. For the syntax of this option, check the
  12613. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12614. @item in_color_matrix
  12615. @item out_color_matrix
  12616. Set in/output YCbCr color space type.
  12617. This allows the autodetected value to be overridden as well as allows forcing
  12618. a specific value used for the output and encoder.
  12619. If not specified, the color space type depends on the pixel format.
  12620. Possible values:
  12621. @table @samp
  12622. @item auto
  12623. Choose automatically.
  12624. @item bt709
  12625. Format conforming to International Telecommunication Union (ITU)
  12626. Recommendation BT.709.
  12627. @item fcc
  12628. Set color space conforming to the United States Federal Communications
  12629. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12630. @item bt601
  12631. @item bt470
  12632. @item smpte170m
  12633. Set color space conforming to:
  12634. @itemize
  12635. @item
  12636. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12637. @item
  12638. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12639. @item
  12640. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12641. @end itemize
  12642. @item smpte240m
  12643. Set color space conforming to SMPTE ST 240:1999.
  12644. @item bt2020
  12645. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12646. @end table
  12647. @item in_range
  12648. @item out_range
  12649. Set in/output YCbCr sample range.
  12650. This allows the autodetected value to be overridden as well as allows forcing
  12651. a specific value used for the output and encoder. If not specified, the
  12652. range depends on the pixel format. Possible values:
  12653. @table @samp
  12654. @item auto/unknown
  12655. Choose automatically.
  12656. @item jpeg/full/pc
  12657. Set full range (0-255 in case of 8-bit luma).
  12658. @item mpeg/limited/tv
  12659. Set "MPEG" range (16-235 in case of 8-bit luma).
  12660. @end table
  12661. @item force_original_aspect_ratio
  12662. Enable decreasing or increasing output video width or height if necessary to
  12663. keep the original aspect ratio. Possible values:
  12664. @table @samp
  12665. @item disable
  12666. Scale the video as specified and disable this feature.
  12667. @item decrease
  12668. The output video dimensions will automatically be decreased if needed.
  12669. @item increase
  12670. The output video dimensions will automatically be increased if needed.
  12671. @end table
  12672. One useful instance of this option is that when you know a specific device's
  12673. maximum allowed resolution, you can use this to limit the output video to
  12674. that, while retaining the aspect ratio. For example, device A allows
  12675. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12676. decrease) and specifying 1280x720 to the command line makes the output
  12677. 1280x533.
  12678. Please note that this is a different thing than specifying -1 for @option{w}
  12679. or @option{h}, you still need to specify the output resolution for this option
  12680. to work.
  12681. @item force_divisible_by
  12682. Ensures that both the output dimensions, width and height, are divisible by the
  12683. given integer when used together with @option{force_original_aspect_ratio}. This
  12684. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12685. This option respects the value set for @option{force_original_aspect_ratio},
  12686. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12687. may be slightly modified.
  12688. This option can be handy if you need to have a video fit within or exceed
  12689. a defined resolution using @option{force_original_aspect_ratio} but also have
  12690. encoder restrictions on width or height divisibility.
  12691. @end table
  12692. The values of the @option{w} and @option{h} options are expressions
  12693. containing the following constants:
  12694. @table @var
  12695. @item in_w
  12696. @item in_h
  12697. The input width and height
  12698. @item iw
  12699. @item ih
  12700. These are the same as @var{in_w} and @var{in_h}.
  12701. @item out_w
  12702. @item out_h
  12703. The output (scaled) width and height
  12704. @item ow
  12705. @item oh
  12706. These are the same as @var{out_w} and @var{out_h}
  12707. @item a
  12708. The same as @var{iw} / @var{ih}
  12709. @item sar
  12710. input sample aspect ratio
  12711. @item dar
  12712. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12713. @item hsub
  12714. @item vsub
  12715. horizontal and vertical input chroma subsample values. For example for the
  12716. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12717. @item ohsub
  12718. @item ovsub
  12719. horizontal and vertical output chroma subsample values. For example for the
  12720. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12721. @item n
  12722. The (sequential) number of the input frame, starting from 0.
  12723. Only available with @code{eval=frame}.
  12724. @item t
  12725. The presentation timestamp of the input frame, expressed as a number of
  12726. seconds. Only available with @code{eval=frame}.
  12727. @item pos
  12728. The position (byte offset) of the frame in the input stream, or NaN if
  12729. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12730. Only available with @code{eval=frame}.
  12731. @end table
  12732. @subsection Examples
  12733. @itemize
  12734. @item
  12735. Scale the input video to a size of 200x100
  12736. @example
  12737. scale=w=200:h=100
  12738. @end example
  12739. This is equivalent to:
  12740. @example
  12741. scale=200:100
  12742. @end example
  12743. or:
  12744. @example
  12745. scale=200x100
  12746. @end example
  12747. @item
  12748. Specify a size abbreviation for the output size:
  12749. @example
  12750. scale=qcif
  12751. @end example
  12752. which can also be written as:
  12753. @example
  12754. scale=size=qcif
  12755. @end example
  12756. @item
  12757. Scale the input to 2x:
  12758. @example
  12759. scale=w=2*iw:h=2*ih
  12760. @end example
  12761. @item
  12762. The above is the same as:
  12763. @example
  12764. scale=2*in_w:2*in_h
  12765. @end example
  12766. @item
  12767. Scale the input to 2x with forced interlaced scaling:
  12768. @example
  12769. scale=2*iw:2*ih:interl=1
  12770. @end example
  12771. @item
  12772. Scale the input to half size:
  12773. @example
  12774. scale=w=iw/2:h=ih/2
  12775. @end example
  12776. @item
  12777. Increase the width, and set the height to the same size:
  12778. @example
  12779. scale=3/2*iw:ow
  12780. @end example
  12781. @item
  12782. Seek Greek harmony:
  12783. @example
  12784. scale=iw:1/PHI*iw
  12785. scale=ih*PHI:ih
  12786. @end example
  12787. @item
  12788. Increase the height, and set the width to 3/2 of the height:
  12789. @example
  12790. scale=w=3/2*oh:h=3/5*ih
  12791. @end example
  12792. @item
  12793. Increase the size, making the size a multiple of the chroma
  12794. subsample values:
  12795. @example
  12796. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12797. @end example
  12798. @item
  12799. Increase the width to a maximum of 500 pixels,
  12800. keeping the same aspect ratio as the input:
  12801. @example
  12802. scale=w='min(500\, iw*3/2):h=-1'
  12803. @end example
  12804. @item
  12805. Make pixels square by combining scale and setsar:
  12806. @example
  12807. scale='trunc(ih*dar):ih',setsar=1/1
  12808. @end example
  12809. @item
  12810. Make pixels square by combining scale and setsar,
  12811. making sure the resulting resolution is even (required by some codecs):
  12812. @example
  12813. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12814. @end example
  12815. @end itemize
  12816. @subsection Commands
  12817. This filter supports the following commands:
  12818. @table @option
  12819. @item width, w
  12820. @item height, h
  12821. Set the output video dimension expression.
  12822. The command accepts the same syntax of the corresponding option.
  12823. If the specified expression is not valid, it is kept at its current
  12824. value.
  12825. @end table
  12826. @section scale_npp
  12827. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12828. format conversion on CUDA video frames. Setting the output width and height
  12829. works in the same way as for the @var{scale} filter.
  12830. The following additional options are accepted:
  12831. @table @option
  12832. @item format
  12833. The pixel format of the output CUDA frames. If set to the string "same" (the
  12834. default), the input format will be kept. Note that automatic format negotiation
  12835. and conversion is not yet supported for hardware frames
  12836. @item interp_algo
  12837. The interpolation algorithm used for resizing. One of the following:
  12838. @table @option
  12839. @item nn
  12840. Nearest neighbour.
  12841. @item linear
  12842. @item cubic
  12843. @item cubic2p_bspline
  12844. 2-parameter cubic (B=1, C=0)
  12845. @item cubic2p_catmullrom
  12846. 2-parameter cubic (B=0, C=1/2)
  12847. @item cubic2p_b05c03
  12848. 2-parameter cubic (B=1/2, C=3/10)
  12849. @item super
  12850. Supersampling
  12851. @item lanczos
  12852. @end table
  12853. @item force_original_aspect_ratio
  12854. Enable decreasing or increasing output video width or height if necessary to
  12855. keep the original aspect ratio. Possible values:
  12856. @table @samp
  12857. @item disable
  12858. Scale the video as specified and disable this feature.
  12859. @item decrease
  12860. The output video dimensions will automatically be decreased if needed.
  12861. @item increase
  12862. The output video dimensions will automatically be increased if needed.
  12863. @end table
  12864. One useful instance of this option is that when you know a specific device's
  12865. maximum allowed resolution, you can use this to limit the output video to
  12866. that, while retaining the aspect ratio. For example, device A allows
  12867. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12868. decrease) and specifying 1280x720 to the command line makes the output
  12869. 1280x533.
  12870. Please note that this is a different thing than specifying -1 for @option{w}
  12871. or @option{h}, you still need to specify the output resolution for this option
  12872. to work.
  12873. @item force_divisible_by
  12874. Ensures that both the output dimensions, width and height, are divisible by the
  12875. given integer when used together with @option{force_original_aspect_ratio}. This
  12876. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12877. This option respects the value set for @option{force_original_aspect_ratio},
  12878. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12879. may be slightly modified.
  12880. This option can be handy if you need to have a video fit within or exceed
  12881. a defined resolution using @option{force_original_aspect_ratio} but also have
  12882. encoder restrictions on width or height divisibility.
  12883. @end table
  12884. @section scale2ref
  12885. Scale (resize) the input video, based on a reference video.
  12886. See the scale filter for available options, scale2ref supports the same but
  12887. uses the reference video instead of the main input as basis. scale2ref also
  12888. supports the following additional constants for the @option{w} and
  12889. @option{h} options:
  12890. @table @var
  12891. @item main_w
  12892. @item main_h
  12893. The main input video's width and height
  12894. @item main_a
  12895. The same as @var{main_w} / @var{main_h}
  12896. @item main_sar
  12897. The main input video's sample aspect ratio
  12898. @item main_dar, mdar
  12899. The main input video's display aspect ratio. Calculated from
  12900. @code{(main_w / main_h) * main_sar}.
  12901. @item main_hsub
  12902. @item main_vsub
  12903. The main input video's horizontal and vertical chroma subsample values.
  12904. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12905. is 1.
  12906. @item main_n
  12907. The (sequential) number of the main input frame, starting from 0.
  12908. Only available with @code{eval=frame}.
  12909. @item main_t
  12910. The presentation timestamp of the main input frame, expressed as a number of
  12911. seconds. Only available with @code{eval=frame}.
  12912. @item main_pos
  12913. The position (byte offset) of the frame in the main input stream, or NaN if
  12914. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12915. Only available with @code{eval=frame}.
  12916. @end table
  12917. @subsection Examples
  12918. @itemize
  12919. @item
  12920. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12921. @example
  12922. 'scale2ref[b][a];[a][b]overlay'
  12923. @end example
  12924. @item
  12925. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12926. @example
  12927. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12928. @end example
  12929. @end itemize
  12930. @subsection Commands
  12931. This filter supports the following commands:
  12932. @table @option
  12933. @item width, w
  12934. @item height, h
  12935. Set the output video dimension expression.
  12936. The command accepts the same syntax of the corresponding option.
  12937. If the specified expression is not valid, it is kept at its current
  12938. value.
  12939. @end table
  12940. @section scroll
  12941. Scroll input video horizontally and/or vertically by constant speed.
  12942. The filter accepts the following options:
  12943. @table @option
  12944. @item horizontal, h
  12945. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12946. Negative values changes scrolling direction.
  12947. @item vertical, v
  12948. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12949. Negative values changes scrolling direction.
  12950. @item hpos
  12951. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12952. @item vpos
  12953. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12954. @end table
  12955. @subsection Commands
  12956. This filter supports the following @ref{commands}:
  12957. @table @option
  12958. @item horizontal, h
  12959. Set the horizontal scrolling speed.
  12960. @item vertical, v
  12961. Set the vertical scrolling speed.
  12962. @end table
  12963. @anchor{scdet}
  12964. @section scdet
  12965. Detect video scene change.
  12966. This filter sets frame metadata with mafd between frame, the scene score, and
  12967. forward the frame to the next filter, so they can use these metadata to detect
  12968. scene change or others.
  12969. In addition, this filter logs a message and sets frame metadata when it detects
  12970. a scene change by @option{threshold}.
  12971. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12972. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12973. to detect scene change.
  12974. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12975. detect scene change with @option{threshold}.
  12976. The filter accepts the following options:
  12977. @table @option
  12978. @item threshold, t
  12979. Set the scene change detection threshold as a percentage of maximum change. Good
  12980. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12981. @code{[0., 100.]}.
  12982. Default value is @code{10.}.
  12983. @item sc_pass, s
  12984. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12985. You can enable it if you want to get snapshot of scene change frames only.
  12986. @end table
  12987. @anchor{selectivecolor}
  12988. @section selectivecolor
  12989. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12990. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12991. by the "purity" of the color (that is, how saturated it already is).
  12992. This filter is similar to the Adobe Photoshop Selective Color tool.
  12993. The filter accepts the following options:
  12994. @table @option
  12995. @item correction_method
  12996. Select color correction method.
  12997. Available values are:
  12998. @table @samp
  12999. @item absolute
  13000. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13001. component value).
  13002. @item relative
  13003. Specified adjustments are relative to the original component value.
  13004. @end table
  13005. Default is @code{absolute}.
  13006. @item reds
  13007. Adjustments for red pixels (pixels where the red component is the maximum)
  13008. @item yellows
  13009. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13010. @item greens
  13011. Adjustments for green pixels (pixels where the green component is the maximum)
  13012. @item cyans
  13013. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13014. @item blues
  13015. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13016. @item magentas
  13017. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13018. @item whites
  13019. Adjustments for white pixels (pixels where all components are greater than 128)
  13020. @item neutrals
  13021. Adjustments for all pixels except pure black and pure white
  13022. @item blacks
  13023. Adjustments for black pixels (pixels where all components are lesser than 128)
  13024. @item psfile
  13025. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13026. @end table
  13027. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13028. 4 space separated floating point adjustment values in the [-1,1] range,
  13029. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13030. pixels of its range.
  13031. @subsection Examples
  13032. @itemize
  13033. @item
  13034. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13035. increase magenta by 27% in blue areas:
  13036. @example
  13037. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13038. @end example
  13039. @item
  13040. Use a Photoshop selective color preset:
  13041. @example
  13042. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13043. @end example
  13044. @end itemize
  13045. @anchor{separatefields}
  13046. @section separatefields
  13047. The @code{separatefields} takes a frame-based video input and splits
  13048. each frame into its components fields, producing a new half height clip
  13049. with twice the frame rate and twice the frame count.
  13050. This filter use field-dominance information in frame to decide which
  13051. of each pair of fields to place first in the output.
  13052. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13053. @section setdar, setsar
  13054. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13055. output video.
  13056. This is done by changing the specified Sample (aka Pixel) Aspect
  13057. Ratio, according to the following equation:
  13058. @example
  13059. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13060. @end example
  13061. Keep in mind that the @code{setdar} filter does not modify the pixel
  13062. dimensions of the video frame. Also, the display aspect ratio set by
  13063. this filter may be changed by later filters in the filterchain,
  13064. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13065. applied.
  13066. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13067. the filter output video.
  13068. Note that as a consequence of the application of this filter, the
  13069. output display aspect ratio will change according to the equation
  13070. above.
  13071. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13072. filter may be changed by later filters in the filterchain, e.g. if
  13073. another "setsar" or a "setdar" filter is applied.
  13074. It accepts the following parameters:
  13075. @table @option
  13076. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13077. Set the aspect ratio used by the filter.
  13078. The parameter can be a floating point number string, an expression, or
  13079. a string of the form @var{num}:@var{den}, where @var{num} and
  13080. @var{den} are the numerator and denominator of the aspect ratio. If
  13081. the parameter is not specified, it is assumed the value "0".
  13082. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13083. should be escaped.
  13084. @item max
  13085. Set the maximum integer value to use for expressing numerator and
  13086. denominator when reducing the expressed aspect ratio to a rational.
  13087. Default value is @code{100}.
  13088. @end table
  13089. The parameter @var{sar} is an expression containing
  13090. the following constants:
  13091. @table @option
  13092. @item E, PI, PHI
  13093. These are approximated values for the mathematical constants e
  13094. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13095. @item w, h
  13096. The input width and height.
  13097. @item a
  13098. These are the same as @var{w} / @var{h}.
  13099. @item sar
  13100. The input sample aspect ratio.
  13101. @item dar
  13102. The input display aspect ratio. It is the same as
  13103. (@var{w} / @var{h}) * @var{sar}.
  13104. @item hsub, vsub
  13105. Horizontal and vertical chroma subsample values. For example, for the
  13106. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13107. @end table
  13108. @subsection Examples
  13109. @itemize
  13110. @item
  13111. To change the display aspect ratio to 16:9, specify one of the following:
  13112. @example
  13113. setdar=dar=1.77777
  13114. setdar=dar=16/9
  13115. @end example
  13116. @item
  13117. To change the sample aspect ratio to 10:11, specify:
  13118. @example
  13119. setsar=sar=10/11
  13120. @end example
  13121. @item
  13122. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13123. 1000 in the aspect ratio reduction, use the command:
  13124. @example
  13125. setdar=ratio=16/9:max=1000
  13126. @end example
  13127. @end itemize
  13128. @anchor{setfield}
  13129. @section setfield
  13130. Force field for the output video frame.
  13131. The @code{setfield} filter marks the interlace type field for the
  13132. output frames. It does not change the input frame, but only sets the
  13133. corresponding property, which affects how the frame is treated by
  13134. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13135. The filter accepts the following options:
  13136. @table @option
  13137. @item mode
  13138. Available values are:
  13139. @table @samp
  13140. @item auto
  13141. Keep the same field property.
  13142. @item bff
  13143. Mark the frame as bottom-field-first.
  13144. @item tff
  13145. Mark the frame as top-field-first.
  13146. @item prog
  13147. Mark the frame as progressive.
  13148. @end table
  13149. @end table
  13150. @anchor{setparams}
  13151. @section setparams
  13152. Force frame parameter for the output video frame.
  13153. The @code{setparams} filter marks interlace and color range for the
  13154. output frames. It does not change the input frame, but only sets the
  13155. corresponding property, which affects how the frame is treated by
  13156. filters/encoders.
  13157. @table @option
  13158. @item field_mode
  13159. Available values are:
  13160. @table @samp
  13161. @item auto
  13162. Keep the same field property (default).
  13163. @item bff
  13164. Mark the frame as bottom-field-first.
  13165. @item tff
  13166. Mark the frame as top-field-first.
  13167. @item prog
  13168. Mark the frame as progressive.
  13169. @end table
  13170. @item range
  13171. Available values are:
  13172. @table @samp
  13173. @item auto
  13174. Keep the same color range property (default).
  13175. @item unspecified, unknown
  13176. Mark the frame as unspecified color range.
  13177. @item limited, tv, mpeg
  13178. Mark the frame as limited range.
  13179. @item full, pc, jpeg
  13180. Mark the frame as full range.
  13181. @end table
  13182. @item color_primaries
  13183. Set the color primaries.
  13184. Available values are:
  13185. @table @samp
  13186. @item auto
  13187. Keep the same color primaries property (default).
  13188. @item bt709
  13189. @item unknown
  13190. @item bt470m
  13191. @item bt470bg
  13192. @item smpte170m
  13193. @item smpte240m
  13194. @item film
  13195. @item bt2020
  13196. @item smpte428
  13197. @item smpte431
  13198. @item smpte432
  13199. @item jedec-p22
  13200. @end table
  13201. @item color_trc
  13202. Set the color transfer.
  13203. Available values are:
  13204. @table @samp
  13205. @item auto
  13206. Keep the same color trc property (default).
  13207. @item bt709
  13208. @item unknown
  13209. @item bt470m
  13210. @item bt470bg
  13211. @item smpte170m
  13212. @item smpte240m
  13213. @item linear
  13214. @item log100
  13215. @item log316
  13216. @item iec61966-2-4
  13217. @item bt1361e
  13218. @item iec61966-2-1
  13219. @item bt2020-10
  13220. @item bt2020-12
  13221. @item smpte2084
  13222. @item smpte428
  13223. @item arib-std-b67
  13224. @end table
  13225. @item colorspace
  13226. Set the colorspace.
  13227. Available values are:
  13228. @table @samp
  13229. @item auto
  13230. Keep the same colorspace property (default).
  13231. @item gbr
  13232. @item bt709
  13233. @item unknown
  13234. @item fcc
  13235. @item bt470bg
  13236. @item smpte170m
  13237. @item smpte240m
  13238. @item ycgco
  13239. @item bt2020nc
  13240. @item bt2020c
  13241. @item smpte2085
  13242. @item chroma-derived-nc
  13243. @item chroma-derived-c
  13244. @item ictcp
  13245. @end table
  13246. @end table
  13247. @section showinfo
  13248. Show a line containing various information for each input video frame.
  13249. The input video is not modified.
  13250. This filter supports the following options:
  13251. @table @option
  13252. @item checksum
  13253. Calculate checksums of each plane. By default enabled.
  13254. @end table
  13255. The shown line contains a sequence of key/value pairs of the form
  13256. @var{key}:@var{value}.
  13257. The following values are shown in the output:
  13258. @table @option
  13259. @item n
  13260. The (sequential) number of the input frame, starting from 0.
  13261. @item pts
  13262. The Presentation TimeStamp of the input frame, expressed as a number of
  13263. time base units. The time base unit depends on the filter input pad.
  13264. @item pts_time
  13265. The Presentation TimeStamp of the input frame, expressed as a number of
  13266. seconds.
  13267. @item pos
  13268. The position of the frame in the input stream, or -1 if this information is
  13269. unavailable and/or meaningless (for example in case of synthetic video).
  13270. @item fmt
  13271. The pixel format name.
  13272. @item sar
  13273. The sample aspect ratio of the input frame, expressed in the form
  13274. @var{num}/@var{den}.
  13275. @item s
  13276. The size of the input frame. For the syntax of this option, check the
  13277. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13278. @item i
  13279. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13280. for bottom field first).
  13281. @item iskey
  13282. This is 1 if the frame is a key frame, 0 otherwise.
  13283. @item type
  13284. The picture type of the input frame ("I" for an I-frame, "P" for a
  13285. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13286. Also refer to the documentation of the @code{AVPictureType} enum and of
  13287. the @code{av_get_picture_type_char} function defined in
  13288. @file{libavutil/avutil.h}.
  13289. @item checksum
  13290. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13291. @item plane_checksum
  13292. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13293. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13294. @item mean
  13295. The mean value of pixels in each plane of the input frame, expressed in the form
  13296. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13297. @item stdev
  13298. The standard deviation of pixel values in each plane of the input frame, expressed
  13299. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13300. @end table
  13301. @section showpalette
  13302. Displays the 256 colors palette of each frame. This filter is only relevant for
  13303. @var{pal8} pixel format frames.
  13304. It accepts the following option:
  13305. @table @option
  13306. @item s
  13307. Set the size of the box used to represent one palette color entry. Default is
  13308. @code{30} (for a @code{30x30} pixel box).
  13309. @end table
  13310. @section shuffleframes
  13311. Reorder and/or duplicate and/or drop video frames.
  13312. It accepts the following parameters:
  13313. @table @option
  13314. @item mapping
  13315. Set the destination indexes of input frames.
  13316. This is space or '|' separated list of indexes that maps input frames to output
  13317. frames. Number of indexes also sets maximal value that each index may have.
  13318. '-1' index have special meaning and that is to drop frame.
  13319. @end table
  13320. The first frame has the index 0. The default is to keep the input unchanged.
  13321. @subsection Examples
  13322. @itemize
  13323. @item
  13324. Swap second and third frame of every three frames of the input:
  13325. @example
  13326. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13327. @end example
  13328. @item
  13329. Swap 10th and 1st frame of every ten frames of the input:
  13330. @example
  13331. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13332. @end example
  13333. @end itemize
  13334. @section shuffleplanes
  13335. Reorder and/or duplicate video planes.
  13336. It accepts the following parameters:
  13337. @table @option
  13338. @item map0
  13339. The index of the input plane to be used as the first output plane.
  13340. @item map1
  13341. The index of the input plane to be used as the second output plane.
  13342. @item map2
  13343. The index of the input plane to be used as the third output plane.
  13344. @item map3
  13345. The index of the input plane to be used as the fourth output plane.
  13346. @end table
  13347. The first plane has the index 0. The default is to keep the input unchanged.
  13348. @subsection Examples
  13349. @itemize
  13350. @item
  13351. Swap the second and third planes of the input:
  13352. @example
  13353. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13354. @end example
  13355. @end itemize
  13356. @anchor{signalstats}
  13357. @section signalstats
  13358. Evaluate various visual metrics that assist in determining issues associated
  13359. with the digitization of analog video media.
  13360. By default the filter will log these metadata values:
  13361. @table @option
  13362. @item YMIN
  13363. Display the minimal Y value contained within the input frame. Expressed in
  13364. range of [0-255].
  13365. @item YLOW
  13366. Display the Y value at the 10% percentile within the input frame. Expressed in
  13367. range of [0-255].
  13368. @item YAVG
  13369. Display the average Y value within the input frame. Expressed in range of
  13370. [0-255].
  13371. @item YHIGH
  13372. Display the Y value at the 90% percentile within the input frame. Expressed in
  13373. range of [0-255].
  13374. @item YMAX
  13375. Display the maximum Y value contained within the input frame. Expressed in
  13376. range of [0-255].
  13377. @item UMIN
  13378. Display the minimal U value contained within the input frame. Expressed in
  13379. range of [0-255].
  13380. @item ULOW
  13381. Display the U value at the 10% percentile within the input frame. Expressed in
  13382. range of [0-255].
  13383. @item UAVG
  13384. Display the average U value within the input frame. Expressed in range of
  13385. [0-255].
  13386. @item UHIGH
  13387. Display the U value at the 90% percentile within the input frame. Expressed in
  13388. range of [0-255].
  13389. @item UMAX
  13390. Display the maximum U value contained within the input frame. Expressed in
  13391. range of [0-255].
  13392. @item VMIN
  13393. Display the minimal V value contained within the input frame. Expressed in
  13394. range of [0-255].
  13395. @item VLOW
  13396. Display the V value at the 10% percentile within the input frame. Expressed in
  13397. range of [0-255].
  13398. @item VAVG
  13399. Display the average V value within the input frame. Expressed in range of
  13400. [0-255].
  13401. @item VHIGH
  13402. Display the V value at the 90% percentile within the input frame. Expressed in
  13403. range of [0-255].
  13404. @item VMAX
  13405. Display the maximum V value contained within the input frame. Expressed in
  13406. range of [0-255].
  13407. @item SATMIN
  13408. Display the minimal saturation value contained within the input frame.
  13409. Expressed in range of [0-~181.02].
  13410. @item SATLOW
  13411. Display the saturation value at the 10% percentile within the input frame.
  13412. Expressed in range of [0-~181.02].
  13413. @item SATAVG
  13414. Display the average saturation value within the input frame. Expressed in range
  13415. of [0-~181.02].
  13416. @item SATHIGH
  13417. Display the saturation value at the 90% percentile within the input frame.
  13418. Expressed in range of [0-~181.02].
  13419. @item SATMAX
  13420. Display the maximum saturation value contained within the input frame.
  13421. Expressed in range of [0-~181.02].
  13422. @item HUEMED
  13423. Display the median value for hue within the input frame. Expressed in range of
  13424. [0-360].
  13425. @item HUEAVG
  13426. Display the average value for hue within the input frame. Expressed in range of
  13427. [0-360].
  13428. @item YDIF
  13429. Display the average of sample value difference between all values of the Y
  13430. plane in the current frame and corresponding values of the previous input frame.
  13431. Expressed in range of [0-255].
  13432. @item UDIF
  13433. Display the average of sample value difference between all values of the U
  13434. plane in the current frame and corresponding values of the previous input frame.
  13435. Expressed in range of [0-255].
  13436. @item VDIF
  13437. Display the average of sample value difference between all values of the V
  13438. plane in the current frame and corresponding values of the previous input frame.
  13439. Expressed in range of [0-255].
  13440. @item YBITDEPTH
  13441. Display bit depth of Y plane in current frame.
  13442. Expressed in range of [0-16].
  13443. @item UBITDEPTH
  13444. Display bit depth of U plane in current frame.
  13445. Expressed in range of [0-16].
  13446. @item VBITDEPTH
  13447. Display bit depth of V plane in current frame.
  13448. Expressed in range of [0-16].
  13449. @end table
  13450. The filter accepts the following options:
  13451. @table @option
  13452. @item stat
  13453. @item out
  13454. @option{stat} specify an additional form of image analysis.
  13455. @option{out} output video with the specified type of pixel highlighted.
  13456. Both options accept the following values:
  13457. @table @samp
  13458. @item tout
  13459. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13460. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13461. include the results of video dropouts, head clogs, or tape tracking issues.
  13462. @item vrep
  13463. Identify @var{vertical line repetition}. Vertical line repetition includes
  13464. similar rows of pixels within a frame. In born-digital video vertical line
  13465. repetition is common, but this pattern is uncommon in video digitized from an
  13466. analog source. When it occurs in video that results from the digitization of an
  13467. analog source it can indicate concealment from a dropout compensator.
  13468. @item brng
  13469. Identify pixels that fall outside of legal broadcast range.
  13470. @end table
  13471. @item color, c
  13472. Set the highlight color for the @option{out} option. The default color is
  13473. yellow.
  13474. @end table
  13475. @subsection Examples
  13476. @itemize
  13477. @item
  13478. Output data of various video metrics:
  13479. @example
  13480. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13481. @end example
  13482. @item
  13483. Output specific data about the minimum and maximum values of the Y plane per frame:
  13484. @example
  13485. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13486. @end example
  13487. @item
  13488. Playback video while highlighting pixels that are outside of broadcast range in red.
  13489. @example
  13490. ffplay example.mov -vf signalstats="out=brng:color=red"
  13491. @end example
  13492. @item
  13493. Playback video with signalstats metadata drawn over the frame.
  13494. @example
  13495. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13496. @end example
  13497. The contents of signalstat_drawtext.txt used in the command are:
  13498. @example
  13499. time %@{pts:hms@}
  13500. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13501. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13502. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13503. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13504. @end example
  13505. @end itemize
  13506. @anchor{signature}
  13507. @section signature
  13508. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13509. input. In this case the matching between the inputs can be calculated additionally.
  13510. The filter always passes through the first input. The signature of each stream can
  13511. be written into a file.
  13512. It accepts the following options:
  13513. @table @option
  13514. @item detectmode
  13515. Enable or disable the matching process.
  13516. Available values are:
  13517. @table @samp
  13518. @item off
  13519. Disable the calculation of a matching (default).
  13520. @item full
  13521. Calculate the matching for the whole video and output whether the whole video
  13522. matches or only parts.
  13523. @item fast
  13524. Calculate only until a matching is found or the video ends. Should be faster in
  13525. some cases.
  13526. @end table
  13527. @item nb_inputs
  13528. Set the number of inputs. The option value must be a non negative integer.
  13529. Default value is 1.
  13530. @item filename
  13531. Set the path to which the output is written. If there is more than one input,
  13532. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13533. integer), that will be replaced with the input number. If no filename is
  13534. specified, no output will be written. This is the default.
  13535. @item format
  13536. Choose the output format.
  13537. Available values are:
  13538. @table @samp
  13539. @item binary
  13540. Use the specified binary representation (default).
  13541. @item xml
  13542. Use the specified xml representation.
  13543. @end table
  13544. @item th_d
  13545. Set threshold to detect one word as similar. The option value must be an integer
  13546. greater than zero. The default value is 9000.
  13547. @item th_dc
  13548. Set threshold to detect all words as similar. The option value must be an integer
  13549. greater than zero. The default value is 60000.
  13550. @item th_xh
  13551. Set threshold to detect frames as similar. The option value must be an integer
  13552. greater than zero. The default value is 116.
  13553. @item th_di
  13554. Set the minimum length of a sequence in frames to recognize it as matching
  13555. sequence. The option value must be a non negative integer value.
  13556. The default value is 0.
  13557. @item th_it
  13558. Set the minimum relation, that matching frames to all frames must have.
  13559. The option value must be a double value between 0 and 1. The default value is 0.5.
  13560. @end table
  13561. @subsection Examples
  13562. @itemize
  13563. @item
  13564. To calculate the signature of an input video and store it in signature.bin:
  13565. @example
  13566. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13567. @end example
  13568. @item
  13569. To detect whether two videos match and store the signatures in XML format in
  13570. signature0.xml and signature1.xml:
  13571. @example
  13572. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  13573. @end example
  13574. @end itemize
  13575. @anchor{smartblur}
  13576. @section smartblur
  13577. Blur the input video without impacting the outlines.
  13578. It accepts the following options:
  13579. @table @option
  13580. @item luma_radius, lr
  13581. Set the luma radius. The option value must be a float number in
  13582. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13583. used to blur the image (slower if larger). Default value is 1.0.
  13584. @item luma_strength, ls
  13585. Set the luma strength. The option value must be a float number
  13586. in the range [-1.0,1.0] that configures the blurring. A value included
  13587. in [0.0,1.0] will blur the image whereas a value included in
  13588. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13589. @item luma_threshold, lt
  13590. Set the luma threshold used as a coefficient to determine
  13591. whether a pixel should be blurred or not. The option value must be an
  13592. integer in the range [-30,30]. A value of 0 will filter all the image,
  13593. a value included in [0,30] will filter flat areas and a value included
  13594. in [-30,0] will filter edges. Default value is 0.
  13595. @item chroma_radius, cr
  13596. Set the chroma radius. The option value must be a float number in
  13597. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13598. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13599. @item chroma_strength, cs
  13600. Set the chroma strength. The option value must be a float number
  13601. in the range [-1.0,1.0] that configures the blurring. A value included
  13602. in [0.0,1.0] will blur the image whereas a value included in
  13603. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13604. @item chroma_threshold, ct
  13605. Set the chroma threshold used as a coefficient to determine
  13606. whether a pixel should be blurred or not. The option value must be an
  13607. integer in the range [-30,30]. A value of 0 will filter all the image,
  13608. a value included in [0,30] will filter flat areas and a value included
  13609. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13610. @end table
  13611. If a chroma option is not explicitly set, the corresponding luma value
  13612. is set.
  13613. @section sobel
  13614. Apply sobel operator to input video stream.
  13615. The filter accepts the following option:
  13616. @table @option
  13617. @item planes
  13618. Set which planes will be processed, unprocessed planes will be copied.
  13619. By default value 0xf, all planes will be processed.
  13620. @item scale
  13621. Set value which will be multiplied with filtered result.
  13622. @item delta
  13623. Set value which will be added to filtered result.
  13624. @end table
  13625. @anchor{spp}
  13626. @section spp
  13627. Apply a simple postprocessing filter that compresses and decompresses the image
  13628. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13629. and average the results.
  13630. The filter accepts the following options:
  13631. @table @option
  13632. @item quality
  13633. Set quality. This option defines the number of levels for averaging. It accepts
  13634. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13635. effect. A value of @code{6} means the higher quality. For each increment of
  13636. that value the speed drops by a factor of approximately 2. Default value is
  13637. @code{3}.
  13638. @item qp
  13639. Force a constant quantization parameter. If not set, the filter will use the QP
  13640. from the video stream (if available).
  13641. @item mode
  13642. Set thresholding mode. Available modes are:
  13643. @table @samp
  13644. @item hard
  13645. Set hard thresholding (default).
  13646. @item soft
  13647. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13648. @end table
  13649. @item use_bframe_qp
  13650. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13651. option may cause flicker since the B-Frames have often larger QP. Default is
  13652. @code{0} (not enabled).
  13653. @end table
  13654. @subsection Commands
  13655. This filter supports the following commands:
  13656. @table @option
  13657. @item quality, level
  13658. Set quality level. The value @code{max} can be used to set the maximum level,
  13659. currently @code{6}.
  13660. @end table
  13661. @anchor{sr}
  13662. @section sr
  13663. Scale the input by applying one of the super-resolution methods based on
  13664. convolutional neural networks. Supported models:
  13665. @itemize
  13666. @item
  13667. Super-Resolution Convolutional Neural Network model (SRCNN).
  13668. See @url{https://arxiv.org/abs/1501.00092}.
  13669. @item
  13670. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13671. See @url{https://arxiv.org/abs/1609.05158}.
  13672. @end itemize
  13673. Training scripts as well as scripts for model file (.pb) saving can be found at
  13674. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13675. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13676. Native model files (.model) can be generated from TensorFlow model
  13677. files (.pb) by using tools/python/convert.py
  13678. The filter accepts the following options:
  13679. @table @option
  13680. @item dnn_backend
  13681. Specify which DNN backend to use for model loading and execution. This option accepts
  13682. the following values:
  13683. @table @samp
  13684. @item native
  13685. Native implementation of DNN loading and execution.
  13686. @item tensorflow
  13687. TensorFlow backend. To enable this backend you
  13688. need to install the TensorFlow for C library (see
  13689. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13690. @code{--enable-libtensorflow}
  13691. @end table
  13692. Default value is @samp{native}.
  13693. @item model
  13694. Set path to model file specifying network architecture and its parameters.
  13695. Note that different backends use different file formats. TensorFlow backend
  13696. can load files for both formats, while native backend can load files for only
  13697. its format.
  13698. @item scale_factor
  13699. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13700. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13701. input upscaled using bicubic upscaling with proper scale factor.
  13702. @end table
  13703. This feature can also be finished with @ref{dnn_processing} filter.
  13704. @section ssim
  13705. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13706. This filter takes in input two input videos, the first input is
  13707. considered the "main" source and is passed unchanged to the
  13708. output. The second input is used as a "reference" video for computing
  13709. the SSIM.
  13710. Both video inputs must have the same resolution and pixel format for
  13711. this filter to work correctly. Also it assumes that both inputs
  13712. have the same number of frames, which are compared one by one.
  13713. The filter stores the calculated SSIM of each frame.
  13714. The description of the accepted parameters follows.
  13715. @table @option
  13716. @item stats_file, f
  13717. If specified the filter will use the named file to save the SSIM of
  13718. each individual frame. When filename equals "-" the data is sent to
  13719. standard output.
  13720. @end table
  13721. The file printed if @var{stats_file} is selected, contains a sequence of
  13722. key/value pairs of the form @var{key}:@var{value} for each compared
  13723. couple of frames.
  13724. A description of each shown parameter follows:
  13725. @table @option
  13726. @item n
  13727. sequential number of the input frame, starting from 1
  13728. @item Y, U, V, R, G, B
  13729. SSIM of the compared frames for the component specified by the suffix.
  13730. @item All
  13731. SSIM of the compared frames for the whole frame.
  13732. @item dB
  13733. Same as above but in dB representation.
  13734. @end table
  13735. This filter also supports the @ref{framesync} options.
  13736. @subsection Examples
  13737. @itemize
  13738. @item
  13739. For example:
  13740. @example
  13741. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13742. [main][ref] ssim="stats_file=stats.log" [out]
  13743. @end example
  13744. On this example the input file being processed is compared with the
  13745. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13746. is stored in @file{stats.log}.
  13747. @item
  13748. Another example with both psnr and ssim at same time:
  13749. @example
  13750. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13751. @end example
  13752. @item
  13753. Another example with different containers:
  13754. @example
  13755. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  13756. @end example
  13757. @end itemize
  13758. @section stereo3d
  13759. Convert between different stereoscopic image formats.
  13760. The filters accept the following options:
  13761. @table @option
  13762. @item in
  13763. Set stereoscopic image format of input.
  13764. Available values for input image formats are:
  13765. @table @samp
  13766. @item sbsl
  13767. side by side parallel (left eye left, right eye right)
  13768. @item sbsr
  13769. side by side crosseye (right eye left, left eye right)
  13770. @item sbs2l
  13771. side by side parallel with half width resolution
  13772. (left eye left, right eye right)
  13773. @item sbs2r
  13774. side by side crosseye with half width resolution
  13775. (right eye left, left eye right)
  13776. @item abl
  13777. @item tbl
  13778. above-below (left eye above, right eye below)
  13779. @item abr
  13780. @item tbr
  13781. above-below (right eye above, left eye below)
  13782. @item ab2l
  13783. @item tb2l
  13784. above-below with half height resolution
  13785. (left eye above, right eye below)
  13786. @item ab2r
  13787. @item tb2r
  13788. above-below with half height resolution
  13789. (right eye above, left eye below)
  13790. @item al
  13791. alternating frames (left eye first, right eye second)
  13792. @item ar
  13793. alternating frames (right eye first, left eye second)
  13794. @item irl
  13795. interleaved rows (left eye has top row, right eye starts on next row)
  13796. @item irr
  13797. interleaved rows (right eye has top row, left eye starts on next row)
  13798. @item icl
  13799. interleaved columns, left eye first
  13800. @item icr
  13801. interleaved columns, right eye first
  13802. Default value is @samp{sbsl}.
  13803. @end table
  13804. @item out
  13805. Set stereoscopic image format of output.
  13806. @table @samp
  13807. @item sbsl
  13808. side by side parallel (left eye left, right eye right)
  13809. @item sbsr
  13810. side by side crosseye (right eye left, left eye right)
  13811. @item sbs2l
  13812. side by side parallel with half width resolution
  13813. (left eye left, right eye right)
  13814. @item sbs2r
  13815. side by side crosseye with half width resolution
  13816. (right eye left, left eye right)
  13817. @item abl
  13818. @item tbl
  13819. above-below (left eye above, right eye below)
  13820. @item abr
  13821. @item tbr
  13822. above-below (right eye above, left eye below)
  13823. @item ab2l
  13824. @item tb2l
  13825. above-below with half height resolution
  13826. (left eye above, right eye below)
  13827. @item ab2r
  13828. @item tb2r
  13829. above-below with half height resolution
  13830. (right eye above, left eye below)
  13831. @item al
  13832. alternating frames (left eye first, right eye second)
  13833. @item ar
  13834. alternating frames (right eye first, left eye second)
  13835. @item irl
  13836. interleaved rows (left eye has top row, right eye starts on next row)
  13837. @item irr
  13838. interleaved rows (right eye has top row, left eye starts on next row)
  13839. @item arbg
  13840. anaglyph red/blue gray
  13841. (red filter on left eye, blue filter on right eye)
  13842. @item argg
  13843. anaglyph red/green gray
  13844. (red filter on left eye, green filter on right eye)
  13845. @item arcg
  13846. anaglyph red/cyan gray
  13847. (red filter on left eye, cyan filter on right eye)
  13848. @item arch
  13849. anaglyph red/cyan half colored
  13850. (red filter on left eye, cyan filter on right eye)
  13851. @item arcc
  13852. anaglyph red/cyan color
  13853. (red filter on left eye, cyan filter on right eye)
  13854. @item arcd
  13855. anaglyph red/cyan color optimized with the least squares projection of dubois
  13856. (red filter on left eye, cyan filter on right eye)
  13857. @item agmg
  13858. anaglyph green/magenta gray
  13859. (green filter on left eye, magenta filter on right eye)
  13860. @item agmh
  13861. anaglyph green/magenta half colored
  13862. (green filter on left eye, magenta filter on right eye)
  13863. @item agmc
  13864. anaglyph green/magenta colored
  13865. (green filter on left eye, magenta filter on right eye)
  13866. @item agmd
  13867. anaglyph green/magenta color optimized with the least squares projection of dubois
  13868. (green filter on left eye, magenta filter on right eye)
  13869. @item aybg
  13870. anaglyph yellow/blue gray
  13871. (yellow filter on left eye, blue filter on right eye)
  13872. @item aybh
  13873. anaglyph yellow/blue half colored
  13874. (yellow filter on left eye, blue filter on right eye)
  13875. @item aybc
  13876. anaglyph yellow/blue colored
  13877. (yellow filter on left eye, blue filter on right eye)
  13878. @item aybd
  13879. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13880. (yellow filter on left eye, blue filter on right eye)
  13881. @item ml
  13882. mono output (left eye only)
  13883. @item mr
  13884. mono output (right eye only)
  13885. @item chl
  13886. checkerboard, left eye first
  13887. @item chr
  13888. checkerboard, right eye first
  13889. @item icl
  13890. interleaved columns, left eye first
  13891. @item icr
  13892. interleaved columns, right eye first
  13893. @item hdmi
  13894. HDMI frame pack
  13895. @end table
  13896. Default value is @samp{arcd}.
  13897. @end table
  13898. @subsection Examples
  13899. @itemize
  13900. @item
  13901. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13902. @example
  13903. stereo3d=sbsl:aybd
  13904. @end example
  13905. @item
  13906. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13907. @example
  13908. stereo3d=abl:sbsr
  13909. @end example
  13910. @end itemize
  13911. @section streamselect, astreamselect
  13912. Select video or audio streams.
  13913. The filter accepts the following options:
  13914. @table @option
  13915. @item inputs
  13916. Set number of inputs. Default is 2.
  13917. @item map
  13918. Set input indexes to remap to outputs.
  13919. @end table
  13920. @subsection Commands
  13921. The @code{streamselect} and @code{astreamselect} filter supports the following
  13922. commands:
  13923. @table @option
  13924. @item map
  13925. Set input indexes to remap to outputs.
  13926. @end table
  13927. @subsection Examples
  13928. @itemize
  13929. @item
  13930. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13931. @example
  13932. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13933. @end example
  13934. @item
  13935. Same as above, but for audio:
  13936. @example
  13937. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13938. @end example
  13939. @end itemize
  13940. @anchor{subtitles}
  13941. @section subtitles
  13942. Draw subtitles on top of input video using the libass library.
  13943. To enable compilation of this filter you need to configure FFmpeg with
  13944. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13945. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13946. Alpha) subtitles format.
  13947. The filter accepts the following options:
  13948. @table @option
  13949. @item filename, f
  13950. Set the filename of the subtitle file to read. It must be specified.
  13951. @item original_size
  13952. Specify the size of the original video, the video for which the ASS file
  13953. was composed. For the syntax of this option, check the
  13954. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13955. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13956. correctly scale the fonts if the aspect ratio has been changed.
  13957. @item fontsdir
  13958. Set a directory path containing fonts that can be used by the filter.
  13959. These fonts will be used in addition to whatever the font provider uses.
  13960. @item alpha
  13961. Process alpha channel, by default alpha channel is untouched.
  13962. @item charenc
  13963. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13964. useful if not UTF-8.
  13965. @item stream_index, si
  13966. Set subtitles stream index. @code{subtitles} filter only.
  13967. @item force_style
  13968. Override default style or script info parameters of the subtitles. It accepts a
  13969. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13970. @end table
  13971. If the first key is not specified, it is assumed that the first value
  13972. specifies the @option{filename}.
  13973. For example, to render the file @file{sub.srt} on top of the input
  13974. video, use the command:
  13975. @example
  13976. subtitles=sub.srt
  13977. @end example
  13978. which is equivalent to:
  13979. @example
  13980. subtitles=filename=sub.srt
  13981. @end example
  13982. To render the default subtitles stream from file @file{video.mkv}, use:
  13983. @example
  13984. subtitles=video.mkv
  13985. @end example
  13986. To render the second subtitles stream from that file, use:
  13987. @example
  13988. subtitles=video.mkv:si=1
  13989. @end example
  13990. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13991. @code{DejaVu Serif}, use:
  13992. @example
  13993. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13994. @end example
  13995. @section super2xsai
  13996. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13997. Interpolate) pixel art scaling algorithm.
  13998. Useful for enlarging pixel art images without reducing sharpness.
  13999. @section swaprect
  14000. Swap two rectangular objects in video.
  14001. This filter accepts the following options:
  14002. @table @option
  14003. @item w
  14004. Set object width.
  14005. @item h
  14006. Set object height.
  14007. @item x1
  14008. Set 1st rect x coordinate.
  14009. @item y1
  14010. Set 1st rect y coordinate.
  14011. @item x2
  14012. Set 2nd rect x coordinate.
  14013. @item y2
  14014. Set 2nd rect y coordinate.
  14015. All expressions are evaluated once for each frame.
  14016. @end table
  14017. The all options are expressions containing the following constants:
  14018. @table @option
  14019. @item w
  14020. @item h
  14021. The input width and height.
  14022. @item a
  14023. same as @var{w} / @var{h}
  14024. @item sar
  14025. input sample aspect ratio
  14026. @item dar
  14027. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14028. @item n
  14029. The number of the input frame, starting from 0.
  14030. @item t
  14031. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14032. @item pos
  14033. the position in the file of the input frame, NAN if unknown
  14034. @end table
  14035. @section swapuv
  14036. Swap U & V plane.
  14037. @section tblend
  14038. Blend successive video frames.
  14039. See @ref{blend}
  14040. @section telecine
  14041. Apply telecine process to the video.
  14042. This filter accepts the following options:
  14043. @table @option
  14044. @item first_field
  14045. @table @samp
  14046. @item top, t
  14047. top field first
  14048. @item bottom, b
  14049. bottom field first
  14050. The default value is @code{top}.
  14051. @end table
  14052. @item pattern
  14053. A string of numbers representing the pulldown pattern you wish to apply.
  14054. The default value is @code{23}.
  14055. @end table
  14056. @example
  14057. Some typical patterns:
  14058. NTSC output (30i):
  14059. 27.5p: 32222
  14060. 24p: 23 (classic)
  14061. 24p: 2332 (preferred)
  14062. 20p: 33
  14063. 18p: 334
  14064. 16p: 3444
  14065. PAL output (25i):
  14066. 27.5p: 12222
  14067. 24p: 222222222223 ("Euro pulldown")
  14068. 16.67p: 33
  14069. 16p: 33333334
  14070. @end example
  14071. @section thistogram
  14072. Compute and draw a color distribution histogram for the input video across time.
  14073. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14074. at certain time, this filter shows also past histograms of number of frames defined
  14075. by @code{width} option.
  14076. The computed histogram is a representation of the color component
  14077. distribution in an image.
  14078. The filter accepts the following options:
  14079. @table @option
  14080. @item width, w
  14081. Set width of single color component output. Default value is @code{0}.
  14082. Value of @code{0} means width will be picked from input video.
  14083. This also set number of passed histograms to keep.
  14084. Allowed range is [0, 8192].
  14085. @item display_mode, d
  14086. Set display mode.
  14087. It accepts the following values:
  14088. @table @samp
  14089. @item stack
  14090. Per color component graphs are placed below each other.
  14091. @item parade
  14092. Per color component graphs are placed side by side.
  14093. @item overlay
  14094. Presents information identical to that in the @code{parade}, except
  14095. that the graphs representing color components are superimposed directly
  14096. over one another.
  14097. @end table
  14098. Default is @code{stack}.
  14099. @item levels_mode, m
  14100. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14101. Default is @code{linear}.
  14102. @item components, c
  14103. Set what color components to display.
  14104. Default is @code{7}.
  14105. @item bgopacity, b
  14106. Set background opacity. Default is @code{0.9}.
  14107. @item envelope, e
  14108. Show envelope. Default is disabled.
  14109. @item ecolor, ec
  14110. Set envelope color. Default is @code{gold}.
  14111. @item slide
  14112. Set slide mode.
  14113. Available values for slide is:
  14114. @table @samp
  14115. @item frame
  14116. Draw new frame when right border is reached.
  14117. @item replace
  14118. Replace old columns with new ones.
  14119. @item scroll
  14120. Scroll from right to left.
  14121. @item rscroll
  14122. Scroll from left to right.
  14123. @item picture
  14124. Draw single picture.
  14125. @end table
  14126. Default is @code{replace}.
  14127. @end table
  14128. @section threshold
  14129. Apply threshold effect to video stream.
  14130. This filter needs four video streams to perform thresholding.
  14131. First stream is stream we are filtering.
  14132. Second stream is holding threshold values, third stream is holding min values,
  14133. and last, fourth stream is holding max values.
  14134. The filter accepts the following option:
  14135. @table @option
  14136. @item planes
  14137. Set which planes will be processed, unprocessed planes will be copied.
  14138. By default value 0xf, all planes will be processed.
  14139. @end table
  14140. For example if first stream pixel's component value is less then threshold value
  14141. of pixel component from 2nd threshold stream, third stream value will picked,
  14142. otherwise fourth stream pixel component value will be picked.
  14143. Using color source filter one can perform various types of thresholding:
  14144. @subsection Examples
  14145. @itemize
  14146. @item
  14147. Binary threshold, using gray color as threshold:
  14148. @example
  14149. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14150. @end example
  14151. @item
  14152. Inverted binary threshold, using gray color as threshold:
  14153. @example
  14154. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14155. @end example
  14156. @item
  14157. Truncate binary threshold, using gray color as threshold:
  14158. @example
  14159. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14160. @end example
  14161. @item
  14162. Threshold to zero, using gray color as threshold:
  14163. @example
  14164. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14165. @end example
  14166. @item
  14167. Inverted threshold to zero, using gray color as threshold:
  14168. @example
  14169. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14170. @end example
  14171. @end itemize
  14172. @section thumbnail
  14173. Select the most representative frame in a given sequence of consecutive frames.
  14174. The filter accepts the following options:
  14175. @table @option
  14176. @item n
  14177. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14178. will pick one of them, and then handle the next batch of @var{n} frames until
  14179. the end. Default is @code{100}.
  14180. @end table
  14181. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14182. value will result in a higher memory usage, so a high value is not recommended.
  14183. @subsection Examples
  14184. @itemize
  14185. @item
  14186. Extract one picture each 50 frames:
  14187. @example
  14188. thumbnail=50
  14189. @end example
  14190. @item
  14191. Complete example of a thumbnail creation with @command{ffmpeg}:
  14192. @example
  14193. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14194. @end example
  14195. @end itemize
  14196. @anchor{tile}
  14197. @section tile
  14198. Tile several successive frames together.
  14199. The @ref{untile} filter can do the reverse.
  14200. The filter accepts the following options:
  14201. @table @option
  14202. @item layout
  14203. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14204. this option, check the
  14205. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14206. @item nb_frames
  14207. Set the maximum number of frames to render in the given area. It must be less
  14208. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14209. the area will be used.
  14210. @item margin
  14211. Set the outer border margin in pixels.
  14212. @item padding
  14213. Set the inner border thickness (i.e. the number of pixels between frames). For
  14214. more advanced padding options (such as having different values for the edges),
  14215. refer to the pad video filter.
  14216. @item color
  14217. Specify the color of the unused area. For the syntax of this option, check the
  14218. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14219. The default value of @var{color} is "black".
  14220. @item overlap
  14221. Set the number of frames to overlap when tiling several successive frames together.
  14222. The value must be between @code{0} and @var{nb_frames - 1}.
  14223. @item init_padding
  14224. Set the number of frames to initially be empty before displaying first output frame.
  14225. This controls how soon will one get first output frame.
  14226. The value must be between @code{0} and @var{nb_frames - 1}.
  14227. @end table
  14228. @subsection Examples
  14229. @itemize
  14230. @item
  14231. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14232. @example
  14233. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14234. @end example
  14235. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14236. duplicating each output frame to accommodate the originally detected frame
  14237. rate.
  14238. @item
  14239. Display @code{5} pictures in an area of @code{3x2} frames,
  14240. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14241. mixed flat and named options:
  14242. @example
  14243. tile=3x2:nb_frames=5:padding=7:margin=2
  14244. @end example
  14245. @end itemize
  14246. @section tinterlace
  14247. Perform various types of temporal field interlacing.
  14248. Frames are counted starting from 1, so the first input frame is
  14249. considered odd.
  14250. The filter accepts the following options:
  14251. @table @option
  14252. @item mode
  14253. Specify the mode of the interlacing. This option can also be specified
  14254. as a value alone. See below for a list of values for this option.
  14255. Available values are:
  14256. @table @samp
  14257. @item merge, 0
  14258. Move odd frames into the upper field, even into the lower field,
  14259. generating a double height frame at half frame rate.
  14260. @example
  14261. ------> time
  14262. Input:
  14263. Frame 1 Frame 2 Frame 3 Frame 4
  14264. 11111 22222 33333 44444
  14265. 11111 22222 33333 44444
  14266. 11111 22222 33333 44444
  14267. 11111 22222 33333 44444
  14268. Output:
  14269. 11111 33333
  14270. 22222 44444
  14271. 11111 33333
  14272. 22222 44444
  14273. 11111 33333
  14274. 22222 44444
  14275. 11111 33333
  14276. 22222 44444
  14277. @end example
  14278. @item drop_even, 1
  14279. Only output odd frames, even frames are dropped, generating a frame with
  14280. unchanged height at half frame rate.
  14281. @example
  14282. ------> time
  14283. Input:
  14284. Frame 1 Frame 2 Frame 3 Frame 4
  14285. 11111 22222 33333 44444
  14286. 11111 22222 33333 44444
  14287. 11111 22222 33333 44444
  14288. 11111 22222 33333 44444
  14289. Output:
  14290. 11111 33333
  14291. 11111 33333
  14292. 11111 33333
  14293. 11111 33333
  14294. @end example
  14295. @item drop_odd, 2
  14296. Only output even frames, odd frames are dropped, generating a frame with
  14297. unchanged height at half frame rate.
  14298. @example
  14299. ------> time
  14300. Input:
  14301. Frame 1 Frame 2 Frame 3 Frame 4
  14302. 11111 22222 33333 44444
  14303. 11111 22222 33333 44444
  14304. 11111 22222 33333 44444
  14305. 11111 22222 33333 44444
  14306. Output:
  14307. 22222 44444
  14308. 22222 44444
  14309. 22222 44444
  14310. 22222 44444
  14311. @end example
  14312. @item pad, 3
  14313. Expand each frame to full height, but pad alternate lines with black,
  14314. generating a frame with double height at the same input frame rate.
  14315. @example
  14316. ------> time
  14317. Input:
  14318. Frame 1 Frame 2 Frame 3 Frame 4
  14319. 11111 22222 33333 44444
  14320. 11111 22222 33333 44444
  14321. 11111 22222 33333 44444
  14322. 11111 22222 33333 44444
  14323. Output:
  14324. 11111 ..... 33333 .....
  14325. ..... 22222 ..... 44444
  14326. 11111 ..... 33333 .....
  14327. ..... 22222 ..... 44444
  14328. 11111 ..... 33333 .....
  14329. ..... 22222 ..... 44444
  14330. 11111 ..... 33333 .....
  14331. ..... 22222 ..... 44444
  14332. @end example
  14333. @item interleave_top, 4
  14334. Interleave the upper field from odd frames with the lower field from
  14335. even frames, generating a frame with unchanged height at half frame rate.
  14336. @example
  14337. ------> time
  14338. Input:
  14339. Frame 1 Frame 2 Frame 3 Frame 4
  14340. 11111<- 22222 33333<- 44444
  14341. 11111 22222<- 33333 44444<-
  14342. 11111<- 22222 33333<- 44444
  14343. 11111 22222<- 33333 44444<-
  14344. Output:
  14345. 11111 33333
  14346. 22222 44444
  14347. 11111 33333
  14348. 22222 44444
  14349. @end example
  14350. @item interleave_bottom, 5
  14351. Interleave the lower field from odd frames with the upper field from
  14352. even frames, generating a frame with unchanged height at half frame rate.
  14353. @example
  14354. ------> time
  14355. Input:
  14356. Frame 1 Frame 2 Frame 3 Frame 4
  14357. 11111 22222<- 33333 44444<-
  14358. 11111<- 22222 33333<- 44444
  14359. 11111 22222<- 33333 44444<-
  14360. 11111<- 22222 33333<- 44444
  14361. Output:
  14362. 22222 44444
  14363. 11111 33333
  14364. 22222 44444
  14365. 11111 33333
  14366. @end example
  14367. @item interlacex2, 6
  14368. Double frame rate with unchanged height. Frames are inserted each
  14369. containing the second temporal field from the previous input frame and
  14370. the first temporal field from the next input frame. This mode relies on
  14371. the top_field_first flag. Useful for interlaced video displays with no
  14372. field synchronisation.
  14373. @example
  14374. ------> time
  14375. Input:
  14376. Frame 1 Frame 2 Frame 3 Frame 4
  14377. 11111 22222 33333 44444
  14378. 11111 22222 33333 44444
  14379. 11111 22222 33333 44444
  14380. 11111 22222 33333 44444
  14381. Output:
  14382. 11111 22222 22222 33333 33333 44444 44444
  14383. 11111 11111 22222 22222 33333 33333 44444
  14384. 11111 22222 22222 33333 33333 44444 44444
  14385. 11111 11111 22222 22222 33333 33333 44444
  14386. @end example
  14387. @item mergex2, 7
  14388. Move odd frames into the upper field, even into the lower field,
  14389. generating a double height frame at same frame rate.
  14390. @example
  14391. ------> time
  14392. Input:
  14393. Frame 1 Frame 2 Frame 3 Frame 4
  14394. 11111 22222 33333 44444
  14395. 11111 22222 33333 44444
  14396. 11111 22222 33333 44444
  14397. 11111 22222 33333 44444
  14398. Output:
  14399. 11111 33333 33333 55555
  14400. 22222 22222 44444 44444
  14401. 11111 33333 33333 55555
  14402. 22222 22222 44444 44444
  14403. 11111 33333 33333 55555
  14404. 22222 22222 44444 44444
  14405. 11111 33333 33333 55555
  14406. 22222 22222 44444 44444
  14407. @end example
  14408. @end table
  14409. Numeric values are deprecated but are accepted for backward
  14410. compatibility reasons.
  14411. Default mode is @code{merge}.
  14412. @item flags
  14413. Specify flags influencing the filter process.
  14414. Available value for @var{flags} is:
  14415. @table @option
  14416. @item low_pass_filter, vlpf
  14417. Enable linear vertical low-pass filtering in the filter.
  14418. Vertical low-pass filtering is required when creating an interlaced
  14419. destination from a progressive source which contains high-frequency
  14420. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14421. patterning.
  14422. @item complex_filter, cvlpf
  14423. Enable complex vertical low-pass filtering.
  14424. This will slightly less reduce interlace 'twitter' and Moire
  14425. patterning but better retain detail and subjective sharpness impression.
  14426. @item bypass_il
  14427. Bypass already interlaced frames, only adjust the frame rate.
  14428. @end table
  14429. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14430. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14431. @end table
  14432. @section tmedian
  14433. Pick median pixels from several successive input video frames.
  14434. The filter accepts the following options:
  14435. @table @option
  14436. @item radius
  14437. Set radius of median filter.
  14438. Default is 1. Allowed range is from 1 to 127.
  14439. @item planes
  14440. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14441. @item percentile
  14442. Set median percentile. Default value is @code{0.5}.
  14443. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14444. minimum values, and @code{1} maximum values.
  14445. @end table
  14446. @section tmix
  14447. Mix successive video frames.
  14448. A description of the accepted options follows.
  14449. @table @option
  14450. @item frames
  14451. The number of successive frames to mix. If unspecified, it defaults to 3.
  14452. @item weights
  14453. Specify weight of each input video frame.
  14454. Each weight is separated by space. If number of weights is smaller than
  14455. number of @var{frames} last specified weight will be used for all remaining
  14456. unset weights.
  14457. @item scale
  14458. Specify scale, if it is set it will be multiplied with sum
  14459. of each weight multiplied with pixel values to give final destination
  14460. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14461. @end table
  14462. @subsection Examples
  14463. @itemize
  14464. @item
  14465. Average 7 successive frames:
  14466. @example
  14467. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14468. @end example
  14469. @item
  14470. Apply simple temporal convolution:
  14471. @example
  14472. tmix=frames=3:weights="-1 3 -1"
  14473. @end example
  14474. @item
  14475. Similar as above but only showing temporal differences:
  14476. @example
  14477. tmix=frames=3:weights="-1 2 -1":scale=1
  14478. @end example
  14479. @end itemize
  14480. @anchor{tonemap}
  14481. @section tonemap
  14482. Tone map colors from different dynamic ranges.
  14483. This filter expects data in single precision floating point, as it needs to
  14484. operate on (and can output) out-of-range values. Another filter, such as
  14485. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14486. The tonemapping algorithms implemented only work on linear light, so input
  14487. data should be linearized beforehand (and possibly correctly tagged).
  14488. @example
  14489. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14490. @end example
  14491. @subsection Options
  14492. The filter accepts the following options.
  14493. @table @option
  14494. @item tonemap
  14495. Set the tone map algorithm to use.
  14496. Possible values are:
  14497. @table @var
  14498. @item none
  14499. Do not apply any tone map, only desaturate overbright pixels.
  14500. @item clip
  14501. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14502. in-range values, while distorting out-of-range values.
  14503. @item linear
  14504. Stretch the entire reference gamut to a linear multiple of the display.
  14505. @item gamma
  14506. Fit a logarithmic transfer between the tone curves.
  14507. @item reinhard
  14508. Preserve overall image brightness with a simple curve, using nonlinear
  14509. contrast, which results in flattening details and degrading color accuracy.
  14510. @item hable
  14511. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14512. of slightly darkening everything. Use it when detail preservation is more
  14513. important than color and brightness accuracy.
  14514. @item mobius
  14515. Smoothly map out-of-range values, while retaining contrast and colors for
  14516. in-range material as much as possible. Use it when color accuracy is more
  14517. important than detail preservation.
  14518. @end table
  14519. Default is none.
  14520. @item param
  14521. Tune the tone mapping algorithm.
  14522. This affects the following algorithms:
  14523. @table @var
  14524. @item none
  14525. Ignored.
  14526. @item linear
  14527. Specifies the scale factor to use while stretching.
  14528. Default to 1.0.
  14529. @item gamma
  14530. Specifies the exponent of the function.
  14531. Default to 1.8.
  14532. @item clip
  14533. Specify an extra linear coefficient to multiply into the signal before clipping.
  14534. Default to 1.0.
  14535. @item reinhard
  14536. Specify the local contrast coefficient at the display peak.
  14537. Default to 0.5, which means that in-gamut values will be about half as bright
  14538. as when clipping.
  14539. @item hable
  14540. Ignored.
  14541. @item mobius
  14542. Specify the transition point from linear to mobius transform. Every value
  14543. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14544. more accurate the result will be, at the cost of losing bright details.
  14545. Default to 0.3, which due to the steep initial slope still preserves in-range
  14546. colors fairly accurately.
  14547. @end table
  14548. @item desat
  14549. Apply desaturation for highlights that exceed this level of brightness. The
  14550. higher the parameter, the more color information will be preserved. This
  14551. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14552. (smoothly) turning into white instead. This makes images feel more natural,
  14553. at the cost of reducing information about out-of-range colors.
  14554. The default of 2.0 is somewhat conservative and will mostly just apply to
  14555. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14556. This option works only if the input frame has a supported color tag.
  14557. @item peak
  14558. Override signal/nominal/reference peak with this value. Useful when the
  14559. embedded peak information in display metadata is not reliable or when tone
  14560. mapping from a lower range to a higher range.
  14561. @end table
  14562. @section tpad
  14563. Temporarily pad video frames.
  14564. The filter accepts the following options:
  14565. @table @option
  14566. @item start
  14567. Specify number of delay frames before input video stream. Default is 0.
  14568. @item stop
  14569. Specify number of padding frames after input video stream.
  14570. Set to -1 to pad indefinitely. Default is 0.
  14571. @item start_mode
  14572. Set kind of frames added to beginning of stream.
  14573. Can be either @var{add} or @var{clone}.
  14574. With @var{add} frames of solid-color are added.
  14575. With @var{clone} frames are clones of first frame.
  14576. Default is @var{add}.
  14577. @item stop_mode
  14578. Set kind of frames added to end of stream.
  14579. Can be either @var{add} or @var{clone}.
  14580. With @var{add} frames of solid-color are added.
  14581. With @var{clone} frames are clones of last frame.
  14582. Default is @var{add}.
  14583. @item start_duration, stop_duration
  14584. Specify the duration of the start/stop delay. See
  14585. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14586. for the accepted syntax.
  14587. These options override @var{start} and @var{stop}. Default is 0.
  14588. @item color
  14589. Specify the color of the padded area. For the syntax of this option,
  14590. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14591. manual,ffmpeg-utils}.
  14592. The default value of @var{color} is "black".
  14593. @end table
  14594. @anchor{transpose}
  14595. @section transpose
  14596. Transpose rows with columns in the input video and optionally flip it.
  14597. It accepts the following parameters:
  14598. @table @option
  14599. @item dir
  14600. Specify the transposition direction.
  14601. Can assume the following values:
  14602. @table @samp
  14603. @item 0, 4, cclock_flip
  14604. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14605. @example
  14606. L.R L.l
  14607. . . -> . .
  14608. l.r R.r
  14609. @end example
  14610. @item 1, 5, clock
  14611. Rotate by 90 degrees clockwise, that is:
  14612. @example
  14613. L.R l.L
  14614. . . -> . .
  14615. l.r r.R
  14616. @end example
  14617. @item 2, 6, cclock
  14618. Rotate by 90 degrees counterclockwise, that is:
  14619. @example
  14620. L.R R.r
  14621. . . -> . .
  14622. l.r L.l
  14623. @end example
  14624. @item 3, 7, clock_flip
  14625. Rotate by 90 degrees clockwise and vertically flip, that is:
  14626. @example
  14627. L.R r.R
  14628. . . -> . .
  14629. l.r l.L
  14630. @end example
  14631. @end table
  14632. For values between 4-7, the transposition is only done if the input
  14633. video geometry is portrait and not landscape. These values are
  14634. deprecated, the @code{passthrough} option should be used instead.
  14635. Numerical values are deprecated, and should be dropped in favor of
  14636. symbolic constants.
  14637. @item passthrough
  14638. Do not apply the transposition if the input geometry matches the one
  14639. specified by the specified value. It accepts the following values:
  14640. @table @samp
  14641. @item none
  14642. Always apply transposition.
  14643. @item portrait
  14644. Preserve portrait geometry (when @var{height} >= @var{width}).
  14645. @item landscape
  14646. Preserve landscape geometry (when @var{width} >= @var{height}).
  14647. @end table
  14648. Default value is @code{none}.
  14649. @end table
  14650. For example to rotate by 90 degrees clockwise and preserve portrait
  14651. layout:
  14652. @example
  14653. transpose=dir=1:passthrough=portrait
  14654. @end example
  14655. The command above can also be specified as:
  14656. @example
  14657. transpose=1:portrait
  14658. @end example
  14659. @section transpose_npp
  14660. Transpose rows with columns in the input video and optionally flip it.
  14661. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14662. It accepts the following parameters:
  14663. @table @option
  14664. @item dir
  14665. Specify the transposition direction.
  14666. Can assume the following values:
  14667. @table @samp
  14668. @item cclock_flip
  14669. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14670. @item clock
  14671. Rotate by 90 degrees clockwise.
  14672. @item cclock
  14673. Rotate by 90 degrees counterclockwise.
  14674. @item clock_flip
  14675. Rotate by 90 degrees clockwise and vertically flip.
  14676. @end table
  14677. @item passthrough
  14678. Do not apply the transposition if the input geometry matches the one
  14679. specified by the specified value. It accepts the following values:
  14680. @table @samp
  14681. @item none
  14682. Always apply transposition. (default)
  14683. @item portrait
  14684. Preserve portrait geometry (when @var{height} >= @var{width}).
  14685. @item landscape
  14686. Preserve landscape geometry (when @var{width} >= @var{height}).
  14687. @end table
  14688. @end table
  14689. @section trim
  14690. Trim the input so that the output contains one continuous subpart of the input.
  14691. It accepts the following parameters:
  14692. @table @option
  14693. @item start
  14694. Specify the time of the start of the kept section, i.e. the frame with the
  14695. timestamp @var{start} will be the first frame in the output.
  14696. @item end
  14697. Specify the time of the first frame that will be dropped, i.e. the frame
  14698. immediately preceding the one with the timestamp @var{end} will be the last
  14699. frame in the output.
  14700. @item start_pts
  14701. This is the same as @var{start}, except this option sets the start timestamp
  14702. in timebase units instead of seconds.
  14703. @item end_pts
  14704. This is the same as @var{end}, except this option sets the end timestamp
  14705. in timebase units instead of seconds.
  14706. @item duration
  14707. The maximum duration of the output in seconds.
  14708. @item start_frame
  14709. The number of the first frame that should be passed to the output.
  14710. @item end_frame
  14711. The number of the first frame that should be dropped.
  14712. @end table
  14713. @option{start}, @option{end}, and @option{duration} are expressed as time
  14714. duration specifications; see
  14715. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14716. for the accepted syntax.
  14717. Note that the first two sets of the start/end options and the @option{duration}
  14718. option look at the frame timestamp, while the _frame variants simply count the
  14719. frames that pass through the filter. Also note that this filter does not modify
  14720. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14721. setpts filter after the trim filter.
  14722. If multiple start or end options are set, this filter tries to be greedy and
  14723. keep all the frames that match at least one of the specified constraints. To keep
  14724. only the part that matches all the constraints at once, chain multiple trim
  14725. filters.
  14726. The defaults are such that all the input is kept. So it is possible to set e.g.
  14727. just the end values to keep everything before the specified time.
  14728. Examples:
  14729. @itemize
  14730. @item
  14731. Drop everything except the second minute of input:
  14732. @example
  14733. ffmpeg -i INPUT -vf trim=60:120
  14734. @end example
  14735. @item
  14736. Keep only the first second:
  14737. @example
  14738. ffmpeg -i INPUT -vf trim=duration=1
  14739. @end example
  14740. @end itemize
  14741. @section unpremultiply
  14742. Apply alpha unpremultiply effect to input video stream using first plane
  14743. of second stream as alpha.
  14744. Both streams must have same dimensions and same pixel format.
  14745. The filter accepts the following option:
  14746. @table @option
  14747. @item planes
  14748. Set which planes will be processed, unprocessed planes will be copied.
  14749. By default value 0xf, all planes will be processed.
  14750. If the format has 1 or 2 components, then luma is bit 0.
  14751. If the format has 3 or 4 components:
  14752. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14753. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14754. If present, the alpha channel is always the last bit.
  14755. @item inplace
  14756. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14757. @end table
  14758. @anchor{unsharp}
  14759. @section unsharp
  14760. Sharpen or blur the input video.
  14761. It accepts the following parameters:
  14762. @table @option
  14763. @item luma_msize_x, lx
  14764. Set the luma matrix horizontal size. It must be an odd integer between
  14765. 3 and 23. The default value is 5.
  14766. @item luma_msize_y, ly
  14767. Set the luma matrix vertical size. It must be an odd integer between 3
  14768. and 23. The default value is 5.
  14769. @item luma_amount, la
  14770. Set the luma effect strength. It must be a floating point number, reasonable
  14771. values lay between -1.5 and 1.5.
  14772. Negative values will blur the input video, while positive values will
  14773. sharpen it, a value of zero will disable the effect.
  14774. Default value is 1.0.
  14775. @item chroma_msize_x, cx
  14776. Set the chroma matrix horizontal size. It must be an odd integer
  14777. between 3 and 23. The default value is 5.
  14778. @item chroma_msize_y, cy
  14779. Set the chroma matrix vertical size. It must be an odd integer
  14780. between 3 and 23. The default value is 5.
  14781. @item chroma_amount, ca
  14782. Set the chroma effect strength. It must be a floating point number, reasonable
  14783. values lay between -1.5 and 1.5.
  14784. Negative values will blur the input video, while positive values will
  14785. sharpen it, a value of zero will disable the effect.
  14786. Default value is 0.0.
  14787. @end table
  14788. All parameters are optional and default to the equivalent of the
  14789. string '5:5:1.0:5:5:0.0'.
  14790. @subsection Examples
  14791. @itemize
  14792. @item
  14793. Apply strong luma sharpen effect:
  14794. @example
  14795. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14796. @end example
  14797. @item
  14798. Apply a strong blur of both luma and chroma parameters:
  14799. @example
  14800. unsharp=7:7:-2:7:7:-2
  14801. @end example
  14802. @end itemize
  14803. @anchor{untile}
  14804. @section untile
  14805. Decompose a video made of tiled images into the individual images.
  14806. The frame rate of the output video is the frame rate of the input video
  14807. multiplied by the number of tiles.
  14808. This filter does the reverse of @ref{tile}.
  14809. The filter accepts the following options:
  14810. @table @option
  14811. @item layout
  14812. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14813. this option, check the
  14814. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14815. @end table
  14816. @subsection Examples
  14817. @itemize
  14818. @item
  14819. Produce a 1-second video from a still image file made of 25 frames stacked
  14820. vertically, like an analogic film reel:
  14821. @example
  14822. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14823. @end example
  14824. @end itemize
  14825. @section uspp
  14826. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14827. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14828. shifts and average the results.
  14829. The way this differs from the behavior of spp is that uspp actually encodes &
  14830. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14831. DCT similar to MJPEG.
  14832. The filter accepts the following options:
  14833. @table @option
  14834. @item quality
  14835. Set quality. This option defines the number of levels for averaging. It accepts
  14836. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14837. effect. A value of @code{8} means the higher quality. For each increment of
  14838. that value the speed drops by a factor of approximately 2. Default value is
  14839. @code{3}.
  14840. @item qp
  14841. Force a constant quantization parameter. If not set, the filter will use the QP
  14842. from the video stream (if available).
  14843. @end table
  14844. @section v360
  14845. Convert 360 videos between various formats.
  14846. The filter accepts the following options:
  14847. @table @option
  14848. @item input
  14849. @item output
  14850. Set format of the input/output video.
  14851. Available formats:
  14852. @table @samp
  14853. @item e
  14854. @item equirect
  14855. Equirectangular projection.
  14856. @item c3x2
  14857. @item c6x1
  14858. @item c1x6
  14859. Cubemap with 3x2/6x1/1x6 layout.
  14860. Format specific options:
  14861. @table @option
  14862. @item in_pad
  14863. @item out_pad
  14864. Set padding proportion for the input/output cubemap. Values in decimals.
  14865. Example values:
  14866. @table @samp
  14867. @item 0
  14868. No padding.
  14869. @item 0.01
  14870. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  14871. @end table
  14872. Default value is @b{@samp{0}}.
  14873. Maximum value is @b{@samp{0.1}}.
  14874. @item fin_pad
  14875. @item fout_pad
  14876. Set fixed padding for the input/output cubemap. Values in pixels.
  14877. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14878. @item in_forder
  14879. @item out_forder
  14880. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14881. Designation of directions:
  14882. @table @samp
  14883. @item r
  14884. right
  14885. @item l
  14886. left
  14887. @item u
  14888. up
  14889. @item d
  14890. down
  14891. @item f
  14892. forward
  14893. @item b
  14894. back
  14895. @end table
  14896. Default value is @b{@samp{rludfb}}.
  14897. @item in_frot
  14898. @item out_frot
  14899. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14900. Designation of angles:
  14901. @table @samp
  14902. @item 0
  14903. 0 degrees clockwise
  14904. @item 1
  14905. 90 degrees clockwise
  14906. @item 2
  14907. 180 degrees clockwise
  14908. @item 3
  14909. 270 degrees clockwise
  14910. @end table
  14911. Default value is @b{@samp{000000}}.
  14912. @end table
  14913. @item eac
  14914. Equi-Angular Cubemap.
  14915. @item flat
  14916. @item gnomonic
  14917. @item rectilinear
  14918. Regular video.
  14919. Format specific options:
  14920. @table @option
  14921. @item h_fov
  14922. @item v_fov
  14923. @item d_fov
  14924. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14925. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14926. @item ih_fov
  14927. @item iv_fov
  14928. @item id_fov
  14929. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14930. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14931. @end table
  14932. @item dfisheye
  14933. Dual fisheye.
  14934. Format specific options:
  14935. @table @option
  14936. @item h_fov
  14937. @item v_fov
  14938. @item d_fov
  14939. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14940. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14941. @item ih_fov
  14942. @item iv_fov
  14943. @item id_fov
  14944. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14945. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14946. @end table
  14947. @item barrel
  14948. @item fb
  14949. @item barrelsplit
  14950. Facebook's 360 formats.
  14951. @item sg
  14952. Stereographic format.
  14953. Format specific options:
  14954. @table @option
  14955. @item h_fov
  14956. @item v_fov
  14957. @item d_fov
  14958. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14959. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14960. @item ih_fov
  14961. @item iv_fov
  14962. @item id_fov
  14963. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14964. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14965. @end table
  14966. @item mercator
  14967. Mercator format.
  14968. @item ball
  14969. Ball format, gives significant distortion toward the back.
  14970. @item hammer
  14971. Hammer-Aitoff map projection format.
  14972. @item sinusoidal
  14973. Sinusoidal map projection format.
  14974. @item fisheye
  14975. Fisheye projection.
  14976. Format specific options:
  14977. @table @option
  14978. @item h_fov
  14979. @item v_fov
  14980. @item d_fov
  14981. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14982. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14983. @item ih_fov
  14984. @item iv_fov
  14985. @item id_fov
  14986. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14987. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14988. @end table
  14989. @item pannini
  14990. Pannini projection.
  14991. Format specific options:
  14992. @table @option
  14993. @item h_fov
  14994. Set output pannini parameter.
  14995. @item ih_fov
  14996. Set input pannini parameter.
  14997. @end table
  14998. @item cylindrical
  14999. Cylindrical projection.
  15000. Format specific options:
  15001. @table @option
  15002. @item h_fov
  15003. @item v_fov
  15004. @item d_fov
  15005. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15006. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15007. @item ih_fov
  15008. @item iv_fov
  15009. @item id_fov
  15010. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15011. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15012. @end table
  15013. @item perspective
  15014. Perspective projection. @i{(output only)}
  15015. Format specific options:
  15016. @table @option
  15017. @item v_fov
  15018. Set perspective parameter.
  15019. @end table
  15020. @item tetrahedron
  15021. Tetrahedron projection.
  15022. @item tsp
  15023. Truncated square pyramid projection.
  15024. @item he
  15025. @item hequirect
  15026. Half equirectangular projection.
  15027. @item equisolid
  15028. Equisolid format.
  15029. Format specific options:
  15030. @table @option
  15031. @item h_fov
  15032. @item v_fov
  15033. @item d_fov
  15034. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15035. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15036. @item ih_fov
  15037. @item iv_fov
  15038. @item id_fov
  15039. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15040. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15041. @end table
  15042. @item og
  15043. Orthographic format.
  15044. Format specific options:
  15045. @table @option
  15046. @item h_fov
  15047. @item v_fov
  15048. @item d_fov
  15049. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15050. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15051. @item ih_fov
  15052. @item iv_fov
  15053. @item id_fov
  15054. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15055. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15056. @end table
  15057. @item octahedron
  15058. Octahedron projection.
  15059. @end table
  15060. @item interp
  15061. Set interpolation method.@*
  15062. @i{Note: more complex interpolation methods require much more memory to run.}
  15063. Available methods:
  15064. @table @samp
  15065. @item near
  15066. @item nearest
  15067. Nearest neighbour.
  15068. @item line
  15069. @item linear
  15070. Bilinear interpolation.
  15071. @item lagrange9
  15072. Lagrange9 interpolation.
  15073. @item cube
  15074. @item cubic
  15075. Bicubic interpolation.
  15076. @item lanc
  15077. @item lanczos
  15078. Lanczos interpolation.
  15079. @item sp16
  15080. @item spline16
  15081. Spline16 interpolation.
  15082. @item gauss
  15083. @item gaussian
  15084. Gaussian interpolation.
  15085. @item mitchell
  15086. Mitchell interpolation.
  15087. @end table
  15088. Default value is @b{@samp{line}}.
  15089. @item w
  15090. @item h
  15091. Set the output video resolution.
  15092. Default resolution depends on formats.
  15093. @item in_stereo
  15094. @item out_stereo
  15095. Set the input/output stereo format.
  15096. @table @samp
  15097. @item 2d
  15098. 2D mono
  15099. @item sbs
  15100. Side by side
  15101. @item tb
  15102. Top bottom
  15103. @end table
  15104. Default value is @b{@samp{2d}} for input and output format.
  15105. @item yaw
  15106. @item pitch
  15107. @item roll
  15108. Set rotation for the output video. Values in degrees.
  15109. @item rorder
  15110. Set rotation order for the output video. Choose one item for each position.
  15111. @table @samp
  15112. @item y, Y
  15113. yaw
  15114. @item p, P
  15115. pitch
  15116. @item r, R
  15117. roll
  15118. @end table
  15119. Default value is @b{@samp{ypr}}.
  15120. @item h_flip
  15121. @item v_flip
  15122. @item d_flip
  15123. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15124. @item ih_flip
  15125. @item iv_flip
  15126. Set if input video is flipped horizontally/vertically. Boolean values.
  15127. @item in_trans
  15128. Set if input video is transposed. Boolean value, by default disabled.
  15129. @item out_trans
  15130. Set if output video needs to be transposed. Boolean value, by default disabled.
  15131. @item alpha_mask
  15132. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15133. @end table
  15134. @subsection Examples
  15135. @itemize
  15136. @item
  15137. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15138. @example
  15139. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15140. @end example
  15141. @item
  15142. Extract back view of Equi-Angular Cubemap:
  15143. @example
  15144. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15145. @end example
  15146. @item
  15147. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15148. @example
  15149. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15150. @end example
  15151. @end itemize
  15152. @subsection Commands
  15153. This filter supports subset of above options as @ref{commands}.
  15154. @section vaguedenoiser
  15155. Apply a wavelet based denoiser.
  15156. It transforms each frame from the video input into the wavelet domain,
  15157. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15158. the obtained coefficients. It does an inverse wavelet transform after.
  15159. Due to wavelet properties, it should give a nice smoothed result, and
  15160. reduced noise, without blurring picture features.
  15161. This filter accepts the following options:
  15162. @table @option
  15163. @item threshold
  15164. The filtering strength. The higher, the more filtered the video will be.
  15165. Hard thresholding can use a higher threshold than soft thresholding
  15166. before the video looks overfiltered. Default value is 2.
  15167. @item method
  15168. The filtering method the filter will use.
  15169. It accepts the following values:
  15170. @table @samp
  15171. @item hard
  15172. All values under the threshold will be zeroed.
  15173. @item soft
  15174. All values under the threshold will be zeroed. All values above will be
  15175. reduced by the threshold.
  15176. @item garrote
  15177. Scales or nullifies coefficients - intermediary between (more) soft and
  15178. (less) hard thresholding.
  15179. @end table
  15180. Default is garrote.
  15181. @item nsteps
  15182. Number of times, the wavelet will decompose the picture. Picture can't
  15183. be decomposed beyond a particular point (typically, 8 for a 640x480
  15184. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15185. @item percent
  15186. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15187. @item planes
  15188. A list of the planes to process. By default all planes are processed.
  15189. @item type
  15190. The threshold type the filter will use.
  15191. It accepts the following values:
  15192. @table @samp
  15193. @item universal
  15194. Threshold used is same for all decompositions.
  15195. @item bayes
  15196. Threshold used depends also on each decomposition coefficients.
  15197. @end table
  15198. Default is universal.
  15199. @end table
  15200. @section vectorscope
  15201. Display 2 color component values in the two dimensional graph (which is called
  15202. a vectorscope).
  15203. This filter accepts the following options:
  15204. @table @option
  15205. @item mode, m
  15206. Set vectorscope mode.
  15207. It accepts the following values:
  15208. @table @samp
  15209. @item gray
  15210. @item tint
  15211. Gray values are displayed on graph, higher brightness means more pixels have
  15212. same component color value on location in graph. This is the default mode.
  15213. @item color
  15214. Gray values are displayed on graph. Surrounding pixels values which are not
  15215. present in video frame are drawn in gradient of 2 color components which are
  15216. set by option @code{x} and @code{y}. The 3rd color component is static.
  15217. @item color2
  15218. Actual color components values present in video frame are displayed on graph.
  15219. @item color3
  15220. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15221. on graph increases value of another color component, which is luminance by
  15222. default values of @code{x} and @code{y}.
  15223. @item color4
  15224. Actual colors present in video frame are displayed on graph. If two different
  15225. colors map to same position on graph then color with higher value of component
  15226. not present in graph is picked.
  15227. @item color5
  15228. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15229. component picked from radial gradient.
  15230. @end table
  15231. @item x
  15232. Set which color component will be represented on X-axis. Default is @code{1}.
  15233. @item y
  15234. Set which color component will be represented on Y-axis. Default is @code{2}.
  15235. @item intensity, i
  15236. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15237. of color component which represents frequency of (X, Y) location in graph.
  15238. @item envelope, e
  15239. @table @samp
  15240. @item none
  15241. No envelope, this is default.
  15242. @item instant
  15243. Instant envelope, even darkest single pixel will be clearly highlighted.
  15244. @item peak
  15245. Hold maximum and minimum values presented in graph over time. This way you
  15246. can still spot out of range values without constantly looking at vectorscope.
  15247. @item peak+instant
  15248. Peak and instant envelope combined together.
  15249. @end table
  15250. @item graticule, g
  15251. Set what kind of graticule to draw.
  15252. @table @samp
  15253. @item none
  15254. @item green
  15255. @item color
  15256. @item invert
  15257. @end table
  15258. @item opacity, o
  15259. Set graticule opacity.
  15260. @item flags, f
  15261. Set graticule flags.
  15262. @table @samp
  15263. @item white
  15264. Draw graticule for white point.
  15265. @item black
  15266. Draw graticule for black point.
  15267. @item name
  15268. Draw color points short names.
  15269. @end table
  15270. @item bgopacity, b
  15271. Set background opacity.
  15272. @item lthreshold, l
  15273. Set low threshold for color component not represented on X or Y axis.
  15274. Values lower than this value will be ignored. Default is 0.
  15275. Note this value is multiplied with actual max possible value one pixel component
  15276. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15277. is 0.1 * 255 = 25.
  15278. @item hthreshold, h
  15279. Set high threshold for color component not represented on X or Y axis.
  15280. Values higher than this value will be ignored. Default is 1.
  15281. Note this value is multiplied with actual max possible value one pixel component
  15282. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15283. is 0.9 * 255 = 230.
  15284. @item colorspace, c
  15285. Set what kind of colorspace to use when drawing graticule.
  15286. @table @samp
  15287. @item auto
  15288. @item 601
  15289. @item 709
  15290. @end table
  15291. Default is auto.
  15292. @item tint0, t0
  15293. @item tint1, t1
  15294. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15295. This means no tint, and output will remain gray.
  15296. @end table
  15297. @anchor{vidstabdetect}
  15298. @section vidstabdetect
  15299. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15300. @ref{vidstabtransform} for pass 2.
  15301. This filter generates a file with relative translation and rotation
  15302. transform information about subsequent frames, which is then used by
  15303. the @ref{vidstabtransform} filter.
  15304. To enable compilation of this filter you need to configure FFmpeg with
  15305. @code{--enable-libvidstab}.
  15306. This filter accepts the following options:
  15307. @table @option
  15308. @item result
  15309. Set the path to the file used to write the transforms information.
  15310. Default value is @file{transforms.trf}.
  15311. @item shakiness
  15312. Set how shaky the video is and how quick the camera is. It accepts an
  15313. integer in the range 1-10, a value of 1 means little shakiness, a
  15314. value of 10 means strong shakiness. Default value is 5.
  15315. @item accuracy
  15316. Set the accuracy of the detection process. It must be a value in the
  15317. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15318. accuracy. Default value is 15.
  15319. @item stepsize
  15320. Set stepsize of the search process. The region around minimum is
  15321. scanned with 1 pixel resolution. Default value is 6.
  15322. @item mincontrast
  15323. Set minimum contrast. Below this value a local measurement field is
  15324. discarded. Must be a floating point value in the range 0-1. Default
  15325. value is 0.3.
  15326. @item tripod
  15327. Set reference frame number for tripod mode.
  15328. If enabled, the motion of the frames is compared to a reference frame
  15329. in the filtered stream, identified by the specified number. The idea
  15330. is to compensate all movements in a more-or-less static scene and keep
  15331. the camera view absolutely still.
  15332. If set to 0, it is disabled. The frames are counted starting from 1.
  15333. @item show
  15334. Show fields and transforms in the resulting frames. It accepts an
  15335. integer in the range 0-2. Default value is 0, which disables any
  15336. visualization.
  15337. @end table
  15338. @subsection Examples
  15339. @itemize
  15340. @item
  15341. Use default values:
  15342. @example
  15343. vidstabdetect
  15344. @end example
  15345. @item
  15346. Analyze strongly shaky movie and put the results in file
  15347. @file{mytransforms.trf}:
  15348. @example
  15349. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15350. @end example
  15351. @item
  15352. Visualize the result of internal transformations in the resulting
  15353. video:
  15354. @example
  15355. vidstabdetect=show=1
  15356. @end example
  15357. @item
  15358. Analyze a video with medium shakiness using @command{ffmpeg}:
  15359. @example
  15360. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15361. @end example
  15362. @end itemize
  15363. @anchor{vidstabtransform}
  15364. @section vidstabtransform
  15365. Video stabilization/deshaking: pass 2 of 2,
  15366. see @ref{vidstabdetect} for pass 1.
  15367. Read a file with transform information for each frame and
  15368. apply/compensate them. Together with the @ref{vidstabdetect}
  15369. filter this can be used to deshake videos. See also
  15370. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15371. the @ref{unsharp} filter, see below.
  15372. To enable compilation of this filter you need to configure FFmpeg with
  15373. @code{--enable-libvidstab}.
  15374. @subsection Options
  15375. @table @option
  15376. @item input
  15377. Set path to the file used to read the transforms. Default value is
  15378. @file{transforms.trf}.
  15379. @item smoothing
  15380. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15381. camera movements. Default value is 10.
  15382. For example a number of 10 means that 21 frames are used (10 in the
  15383. past and 10 in the future) to smoothen the motion in the video. A
  15384. larger value leads to a smoother video, but limits the acceleration of
  15385. the camera (pan/tilt movements). 0 is a special case where a static
  15386. camera is simulated.
  15387. @item optalgo
  15388. Set the camera path optimization algorithm.
  15389. Accepted values are:
  15390. @table @samp
  15391. @item gauss
  15392. gaussian kernel low-pass filter on camera motion (default)
  15393. @item avg
  15394. averaging on transformations
  15395. @end table
  15396. @item maxshift
  15397. Set maximal number of pixels to translate frames. Default value is -1,
  15398. meaning no limit.
  15399. @item maxangle
  15400. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15401. value is -1, meaning no limit.
  15402. @item crop
  15403. Specify how to deal with borders that may be visible due to movement
  15404. compensation.
  15405. Available values are:
  15406. @table @samp
  15407. @item keep
  15408. keep image information from previous frame (default)
  15409. @item black
  15410. fill the border black
  15411. @end table
  15412. @item invert
  15413. Invert transforms if set to 1. Default value is 0.
  15414. @item relative
  15415. Consider transforms as relative to previous frame if set to 1,
  15416. absolute if set to 0. Default value is 0.
  15417. @item zoom
  15418. Set percentage to zoom. A positive value will result in a zoom-in
  15419. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15420. zoom).
  15421. @item optzoom
  15422. Set optimal zooming to avoid borders.
  15423. Accepted values are:
  15424. @table @samp
  15425. @item 0
  15426. disabled
  15427. @item 1
  15428. optimal static zoom value is determined (only very strong movements
  15429. will lead to visible borders) (default)
  15430. @item 2
  15431. optimal adaptive zoom value is determined (no borders will be
  15432. visible), see @option{zoomspeed}
  15433. @end table
  15434. Note that the value given at zoom is added to the one calculated here.
  15435. @item zoomspeed
  15436. Set percent to zoom maximally each frame (enabled when
  15437. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15438. 0.25.
  15439. @item interpol
  15440. Specify type of interpolation.
  15441. Available values are:
  15442. @table @samp
  15443. @item no
  15444. no interpolation
  15445. @item linear
  15446. linear only horizontal
  15447. @item bilinear
  15448. linear in both directions (default)
  15449. @item bicubic
  15450. cubic in both directions (slow)
  15451. @end table
  15452. @item tripod
  15453. Enable virtual tripod mode if set to 1, which is equivalent to
  15454. @code{relative=0:smoothing=0}. Default value is 0.
  15455. Use also @code{tripod} option of @ref{vidstabdetect}.
  15456. @item debug
  15457. Increase log verbosity if set to 1. Also the detected global motions
  15458. are written to the temporary file @file{global_motions.trf}. Default
  15459. value is 0.
  15460. @end table
  15461. @subsection Examples
  15462. @itemize
  15463. @item
  15464. Use @command{ffmpeg} for a typical stabilization with default values:
  15465. @example
  15466. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15467. @end example
  15468. Note the use of the @ref{unsharp} filter which is always recommended.
  15469. @item
  15470. Zoom in a bit more and load transform data from a given file:
  15471. @example
  15472. vidstabtransform=zoom=5:input="mytransforms.trf"
  15473. @end example
  15474. @item
  15475. Smoothen the video even more:
  15476. @example
  15477. vidstabtransform=smoothing=30
  15478. @end example
  15479. @end itemize
  15480. @section vflip
  15481. Flip the input video vertically.
  15482. For example, to vertically flip a video with @command{ffmpeg}:
  15483. @example
  15484. ffmpeg -i in.avi -vf "vflip" out.avi
  15485. @end example
  15486. @section vfrdet
  15487. Detect variable frame rate video.
  15488. This filter tries to detect if the input is variable or constant frame rate.
  15489. At end it will output number of frames detected as having variable delta pts,
  15490. and ones with constant delta pts.
  15491. If there was frames with variable delta, than it will also show min, max and
  15492. average delta encountered.
  15493. @section vibrance
  15494. Boost or alter saturation.
  15495. The filter accepts the following options:
  15496. @table @option
  15497. @item intensity
  15498. Set strength of boost if positive value or strength of alter if negative value.
  15499. Default is 0. Allowed range is from -2 to 2.
  15500. @item rbal
  15501. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15502. @item gbal
  15503. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15504. @item bbal
  15505. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15506. @item rlum
  15507. Set the red luma coefficient.
  15508. @item glum
  15509. Set the green luma coefficient.
  15510. @item blum
  15511. Set the blue luma coefficient.
  15512. @item alternate
  15513. If @code{intensity} is negative and this is set to 1, colors will change,
  15514. otherwise colors will be less saturated, more towards gray.
  15515. @end table
  15516. @subsection Commands
  15517. This filter supports the all above options as @ref{commands}.
  15518. @anchor{vignette}
  15519. @section vignette
  15520. Make or reverse a natural vignetting effect.
  15521. The filter accepts the following options:
  15522. @table @option
  15523. @item angle, a
  15524. Set lens angle expression as a number of radians.
  15525. The value is clipped in the @code{[0,PI/2]} range.
  15526. Default value: @code{"PI/5"}
  15527. @item x0
  15528. @item y0
  15529. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15530. by default.
  15531. @item mode
  15532. Set forward/backward mode.
  15533. Available modes are:
  15534. @table @samp
  15535. @item forward
  15536. The larger the distance from the central point, the darker the image becomes.
  15537. @item backward
  15538. The larger the distance from the central point, the brighter the image becomes.
  15539. This can be used to reverse a vignette effect, though there is no automatic
  15540. detection to extract the lens @option{angle} and other settings (yet). It can
  15541. also be used to create a burning effect.
  15542. @end table
  15543. Default value is @samp{forward}.
  15544. @item eval
  15545. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15546. It accepts the following values:
  15547. @table @samp
  15548. @item init
  15549. Evaluate expressions only once during the filter initialization.
  15550. @item frame
  15551. Evaluate expressions for each incoming frame. This is way slower than the
  15552. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15553. allows advanced dynamic expressions.
  15554. @end table
  15555. Default value is @samp{init}.
  15556. @item dither
  15557. Set dithering to reduce the circular banding effects. Default is @code{1}
  15558. (enabled).
  15559. @item aspect
  15560. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15561. Setting this value to the SAR of the input will make a rectangular vignetting
  15562. following the dimensions of the video.
  15563. Default is @code{1/1}.
  15564. @end table
  15565. @subsection Expressions
  15566. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15567. following parameters.
  15568. @table @option
  15569. @item w
  15570. @item h
  15571. input width and height
  15572. @item n
  15573. the number of input frame, starting from 0
  15574. @item pts
  15575. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15576. @var{TB} units, NAN if undefined
  15577. @item r
  15578. frame rate of the input video, NAN if the input frame rate is unknown
  15579. @item t
  15580. the PTS (Presentation TimeStamp) of the filtered video frame,
  15581. expressed in seconds, NAN if undefined
  15582. @item tb
  15583. time base of the input video
  15584. @end table
  15585. @subsection Examples
  15586. @itemize
  15587. @item
  15588. Apply simple strong vignetting effect:
  15589. @example
  15590. vignette=PI/4
  15591. @end example
  15592. @item
  15593. Make a flickering vignetting:
  15594. @example
  15595. vignette='PI/4+random(1)*PI/50':eval=frame
  15596. @end example
  15597. @end itemize
  15598. @section vmafmotion
  15599. Obtain the average VMAF motion score of a video.
  15600. It is one of the component metrics of VMAF.
  15601. The obtained average motion score is printed through the logging system.
  15602. The filter accepts the following options:
  15603. @table @option
  15604. @item stats_file
  15605. If specified, the filter will use the named file to save the motion score of
  15606. each frame with respect to the previous frame.
  15607. When filename equals "-" the data is sent to standard output.
  15608. @end table
  15609. Example:
  15610. @example
  15611. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15612. @end example
  15613. @section vstack
  15614. Stack input videos vertically.
  15615. All streams must be of same pixel format and of same width.
  15616. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15617. to create same output.
  15618. The filter accepts the following options:
  15619. @table @option
  15620. @item inputs
  15621. Set number of input streams. Default is 2.
  15622. @item shortest
  15623. If set to 1, force the output to terminate when the shortest input
  15624. terminates. Default value is 0.
  15625. @end table
  15626. @section w3fdif
  15627. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15628. Deinterlacing Filter").
  15629. Based on the process described by Martin Weston for BBC R&D, and
  15630. implemented based on the de-interlace algorithm written by Jim
  15631. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15632. uses filter coefficients calculated by BBC R&D.
  15633. This filter uses field-dominance information in frame to decide which
  15634. of each pair of fields to place first in the output.
  15635. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15636. There are two sets of filter coefficients, so called "simple"
  15637. and "complex". Which set of filter coefficients is used can
  15638. be set by passing an optional parameter:
  15639. @table @option
  15640. @item filter
  15641. Set the interlacing filter coefficients. Accepts one of the following values:
  15642. @table @samp
  15643. @item simple
  15644. Simple filter coefficient set.
  15645. @item complex
  15646. More-complex filter coefficient set.
  15647. @end table
  15648. Default value is @samp{complex}.
  15649. @item deint
  15650. Specify which frames to deinterlace. Accepts one of the following values:
  15651. @table @samp
  15652. @item all
  15653. Deinterlace all frames,
  15654. @item interlaced
  15655. Only deinterlace frames marked as interlaced.
  15656. @end table
  15657. Default value is @samp{all}.
  15658. @end table
  15659. @section waveform
  15660. Video waveform monitor.
  15661. The waveform monitor plots color component intensity. By default luminance
  15662. only. Each column of the waveform corresponds to a column of pixels in the
  15663. source video.
  15664. It accepts the following options:
  15665. @table @option
  15666. @item mode, m
  15667. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15668. In row mode, the graph on the left side represents color component value 0 and
  15669. the right side represents value = 255. In column mode, the top side represents
  15670. color component value = 0 and bottom side represents value = 255.
  15671. @item intensity, i
  15672. Set intensity. Smaller values are useful to find out how many values of the same
  15673. luminance are distributed across input rows/columns.
  15674. Default value is @code{0.04}. Allowed range is [0, 1].
  15675. @item mirror, r
  15676. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15677. In mirrored mode, higher values will be represented on the left
  15678. side for @code{row} mode and at the top for @code{column} mode. Default is
  15679. @code{1} (mirrored).
  15680. @item display, d
  15681. Set display mode.
  15682. It accepts the following values:
  15683. @table @samp
  15684. @item overlay
  15685. Presents information identical to that in the @code{parade}, except
  15686. that the graphs representing color components are superimposed directly
  15687. over one another.
  15688. This display mode makes it easier to spot relative differences or similarities
  15689. in overlapping areas of the color components that are supposed to be identical,
  15690. such as neutral whites, grays, or blacks.
  15691. @item stack
  15692. Display separate graph for the color components side by side in
  15693. @code{row} mode or one below the other in @code{column} mode.
  15694. @item parade
  15695. Display separate graph for the color components side by side in
  15696. @code{column} mode or one below the other in @code{row} mode.
  15697. Using this display mode makes it easy to spot color casts in the highlights
  15698. and shadows of an image, by comparing the contours of the top and the bottom
  15699. graphs of each waveform. Since whites, grays, and blacks are characterized
  15700. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15701. should display three waveforms of roughly equal width/height. If not, the
  15702. correction is easy to perform by making level adjustments the three waveforms.
  15703. @end table
  15704. Default is @code{stack}.
  15705. @item components, c
  15706. Set which color components to display. Default is 1, which means only luminance
  15707. or red color component if input is in RGB colorspace. If is set for example to
  15708. 7 it will display all 3 (if) available color components.
  15709. @item envelope, e
  15710. @table @samp
  15711. @item none
  15712. No envelope, this is default.
  15713. @item instant
  15714. Instant envelope, minimum and maximum values presented in graph will be easily
  15715. visible even with small @code{step} value.
  15716. @item peak
  15717. Hold minimum and maximum values presented in graph across time. This way you
  15718. can still spot out of range values without constantly looking at waveforms.
  15719. @item peak+instant
  15720. Peak and instant envelope combined together.
  15721. @end table
  15722. @item filter, f
  15723. @table @samp
  15724. @item lowpass
  15725. No filtering, this is default.
  15726. @item flat
  15727. Luma and chroma combined together.
  15728. @item aflat
  15729. Similar as above, but shows difference between blue and red chroma.
  15730. @item xflat
  15731. Similar as above, but use different colors.
  15732. @item yflat
  15733. Similar as above, but again with different colors.
  15734. @item chroma
  15735. Displays only chroma.
  15736. @item color
  15737. Displays actual color value on waveform.
  15738. @item acolor
  15739. Similar as above, but with luma showing frequency of chroma values.
  15740. @end table
  15741. @item graticule, g
  15742. Set which graticule to display.
  15743. @table @samp
  15744. @item none
  15745. Do not display graticule.
  15746. @item green
  15747. Display green graticule showing legal broadcast ranges.
  15748. @item orange
  15749. Display orange graticule showing legal broadcast ranges.
  15750. @item invert
  15751. Display invert graticule showing legal broadcast ranges.
  15752. @end table
  15753. @item opacity, o
  15754. Set graticule opacity.
  15755. @item flags, fl
  15756. Set graticule flags.
  15757. @table @samp
  15758. @item numbers
  15759. Draw numbers above lines. By default enabled.
  15760. @item dots
  15761. Draw dots instead of lines.
  15762. @end table
  15763. @item scale, s
  15764. Set scale used for displaying graticule.
  15765. @table @samp
  15766. @item digital
  15767. @item millivolts
  15768. @item ire
  15769. @end table
  15770. Default is digital.
  15771. @item bgopacity, b
  15772. Set background opacity.
  15773. @item tint0, t0
  15774. @item tint1, t1
  15775. Set tint for output.
  15776. Only used with lowpass filter and when display is not overlay and input
  15777. pixel formats are not RGB.
  15778. @end table
  15779. @section weave, doubleweave
  15780. The @code{weave} takes a field-based video input and join
  15781. each two sequential fields into single frame, producing a new double
  15782. height clip with half the frame rate and half the frame count.
  15783. The @code{doubleweave} works same as @code{weave} but without
  15784. halving frame rate and frame count.
  15785. It accepts the following option:
  15786. @table @option
  15787. @item first_field
  15788. Set first field. Available values are:
  15789. @table @samp
  15790. @item top, t
  15791. Set the frame as top-field-first.
  15792. @item bottom, b
  15793. Set the frame as bottom-field-first.
  15794. @end table
  15795. @end table
  15796. @subsection Examples
  15797. @itemize
  15798. @item
  15799. Interlace video using @ref{select} and @ref{separatefields} filter:
  15800. @example
  15801. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15802. @end example
  15803. @end itemize
  15804. @section xbr
  15805. Apply the xBR high-quality magnification filter which is designed for pixel
  15806. art. It follows a set of edge-detection rules, see
  15807. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15808. It accepts the following option:
  15809. @table @option
  15810. @item n
  15811. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15812. @code{3xBR} and @code{4} for @code{4xBR}.
  15813. Default is @code{3}.
  15814. @end table
  15815. @section xfade
  15816. Apply cross fade from one input video stream to another input video stream.
  15817. The cross fade is applied for specified duration.
  15818. The filter accepts the following options:
  15819. @table @option
  15820. @item transition
  15821. Set one of available transition effects:
  15822. @table @samp
  15823. @item custom
  15824. @item fade
  15825. @item wipeleft
  15826. @item wiperight
  15827. @item wipeup
  15828. @item wipedown
  15829. @item slideleft
  15830. @item slideright
  15831. @item slideup
  15832. @item slidedown
  15833. @item circlecrop
  15834. @item rectcrop
  15835. @item distance
  15836. @item fadeblack
  15837. @item fadewhite
  15838. @item radial
  15839. @item smoothleft
  15840. @item smoothright
  15841. @item smoothup
  15842. @item smoothdown
  15843. @item circleopen
  15844. @item circleclose
  15845. @item vertopen
  15846. @item vertclose
  15847. @item horzopen
  15848. @item horzclose
  15849. @item dissolve
  15850. @item pixelize
  15851. @item diagtl
  15852. @item diagtr
  15853. @item diagbl
  15854. @item diagbr
  15855. @item hlslice
  15856. @item hrslice
  15857. @item vuslice
  15858. @item vdslice
  15859. @item hblur
  15860. @item fadegrays
  15861. @item wipetl
  15862. @item wipetr
  15863. @item wipebl
  15864. @item wipebr
  15865. @item squeezeh
  15866. @item squeezev
  15867. @end table
  15868. Default transition effect is fade.
  15869. @item duration
  15870. Set cross fade duration in seconds.
  15871. Default duration is 1 second.
  15872. @item offset
  15873. Set cross fade start relative to first input stream in seconds.
  15874. Default offset is 0.
  15875. @item expr
  15876. Set expression for custom transition effect.
  15877. The expressions can use the following variables and functions:
  15878. @table @option
  15879. @item X
  15880. @item Y
  15881. The coordinates of the current sample.
  15882. @item W
  15883. @item H
  15884. The width and height of the image.
  15885. @item P
  15886. Progress of transition effect.
  15887. @item PLANE
  15888. Currently processed plane.
  15889. @item A
  15890. Return value of first input at current location and plane.
  15891. @item B
  15892. Return value of second input at current location and plane.
  15893. @item a0(x, y)
  15894. @item a1(x, y)
  15895. @item a2(x, y)
  15896. @item a3(x, y)
  15897. Return the value of the pixel at location (@var{x},@var{y}) of the
  15898. first/second/third/fourth component of first input.
  15899. @item b0(x, y)
  15900. @item b1(x, y)
  15901. @item b2(x, y)
  15902. @item b3(x, y)
  15903. Return the value of the pixel at location (@var{x},@var{y}) of the
  15904. first/second/third/fourth component of second input.
  15905. @end table
  15906. @end table
  15907. @subsection Examples
  15908. @itemize
  15909. @item
  15910. Cross fade from one input video to another input video, with fade transition and duration of transition
  15911. of 2 seconds starting at offset of 5 seconds:
  15912. @example
  15913. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15914. @end example
  15915. @end itemize
  15916. @section xmedian
  15917. Pick median pixels from several input videos.
  15918. The filter accepts the following options:
  15919. @table @option
  15920. @item inputs
  15921. Set number of inputs.
  15922. Default is 3. Allowed range is from 3 to 255.
  15923. If number of inputs is even number, than result will be mean value between two median values.
  15924. @item planes
  15925. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15926. @item percentile
  15927. Set median percentile. Default value is @code{0.5}.
  15928. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15929. minimum values, and @code{1} maximum values.
  15930. @end table
  15931. @section xstack
  15932. Stack video inputs into custom layout.
  15933. All streams must be of same pixel format.
  15934. The filter accepts the following options:
  15935. @table @option
  15936. @item inputs
  15937. Set number of input streams. Default is 2.
  15938. @item layout
  15939. Specify layout of inputs.
  15940. This option requires the desired layout configuration to be explicitly set by the user.
  15941. This sets position of each video input in output. Each input
  15942. is separated by '|'.
  15943. The first number represents the column, and the second number represents the row.
  15944. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15945. where X is video input from which to take width or height.
  15946. Multiple values can be used when separated by '+'. In such
  15947. case values are summed together.
  15948. Note that if inputs are of different sizes gaps may appear, as not all of
  15949. the output video frame will be filled. Similarly, videos can overlap each
  15950. other if their position doesn't leave enough space for the full frame of
  15951. adjoining videos.
  15952. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15953. a layout must be set by the user.
  15954. @item shortest
  15955. If set to 1, force the output to terminate when the shortest input
  15956. terminates. Default value is 0.
  15957. @item fill
  15958. If set to valid color, all unused pixels will be filled with that color.
  15959. By default fill is set to none, so it is disabled.
  15960. @end table
  15961. @subsection Examples
  15962. @itemize
  15963. @item
  15964. Display 4 inputs into 2x2 grid.
  15965. Layout:
  15966. @example
  15967. input1(0, 0) | input3(w0, 0)
  15968. input2(0, h0) | input4(w0, h0)
  15969. @end example
  15970. @example
  15971. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15972. @end example
  15973. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15974. @item
  15975. Display 4 inputs into 1x4 grid.
  15976. Layout:
  15977. @example
  15978. input1(0, 0)
  15979. input2(0, h0)
  15980. input3(0, h0+h1)
  15981. input4(0, h0+h1+h2)
  15982. @end example
  15983. @example
  15984. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15985. @end example
  15986. Note that if inputs are of different widths, unused space will appear.
  15987. @item
  15988. Display 9 inputs into 3x3 grid.
  15989. Layout:
  15990. @example
  15991. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15992. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15993. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15994. @end example
  15995. @example
  15996. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  15997. @end example
  15998. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15999. @item
  16000. Display 16 inputs into 4x4 grid.
  16001. Layout:
  16002. @example
  16003. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16004. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16005. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16006. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16007. @end example
  16008. @example
  16009. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  16010. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  16011. @end example
  16012. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16013. @end itemize
  16014. @anchor{yadif}
  16015. @section yadif
  16016. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16017. filter").
  16018. It accepts the following parameters:
  16019. @table @option
  16020. @item mode
  16021. The interlacing mode to adopt. It accepts one of the following values:
  16022. @table @option
  16023. @item 0, send_frame
  16024. Output one frame for each frame.
  16025. @item 1, send_field
  16026. Output one frame for each field.
  16027. @item 2, send_frame_nospatial
  16028. Like @code{send_frame}, but it skips the spatial interlacing check.
  16029. @item 3, send_field_nospatial
  16030. Like @code{send_field}, but it skips the spatial interlacing check.
  16031. @end table
  16032. The default value is @code{send_frame}.
  16033. @item parity
  16034. The picture field parity assumed for the input interlaced video. It accepts one
  16035. of the following values:
  16036. @table @option
  16037. @item 0, tff
  16038. Assume the top field is first.
  16039. @item 1, bff
  16040. Assume the bottom field is first.
  16041. @item -1, auto
  16042. Enable automatic detection of field parity.
  16043. @end table
  16044. The default value is @code{auto}.
  16045. If the interlacing is unknown or the decoder does not export this information,
  16046. top field first will be assumed.
  16047. @item deint
  16048. Specify which frames to deinterlace. Accepts one of the following
  16049. values:
  16050. @table @option
  16051. @item 0, all
  16052. Deinterlace all frames.
  16053. @item 1, interlaced
  16054. Only deinterlace frames marked as interlaced.
  16055. @end table
  16056. The default value is @code{all}.
  16057. @end table
  16058. @section yadif_cuda
  16059. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16060. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16061. and/or nvenc.
  16062. It accepts the following parameters:
  16063. @table @option
  16064. @item mode
  16065. The interlacing mode to adopt. It accepts one of the following values:
  16066. @table @option
  16067. @item 0, send_frame
  16068. Output one frame for each frame.
  16069. @item 1, send_field
  16070. Output one frame for each field.
  16071. @item 2, send_frame_nospatial
  16072. Like @code{send_frame}, but it skips the spatial interlacing check.
  16073. @item 3, send_field_nospatial
  16074. Like @code{send_field}, but it skips the spatial interlacing check.
  16075. @end table
  16076. The default value is @code{send_frame}.
  16077. @item parity
  16078. The picture field parity assumed for the input interlaced video. It accepts one
  16079. of the following values:
  16080. @table @option
  16081. @item 0, tff
  16082. Assume the top field is first.
  16083. @item 1, bff
  16084. Assume the bottom field is first.
  16085. @item -1, auto
  16086. Enable automatic detection of field parity.
  16087. @end table
  16088. The default value is @code{auto}.
  16089. If the interlacing is unknown or the decoder does not export this information,
  16090. top field first will be assumed.
  16091. @item deint
  16092. Specify which frames to deinterlace. Accepts one of the following
  16093. values:
  16094. @table @option
  16095. @item 0, all
  16096. Deinterlace all frames.
  16097. @item 1, interlaced
  16098. Only deinterlace frames marked as interlaced.
  16099. @end table
  16100. The default value is @code{all}.
  16101. @end table
  16102. @section yaepblur
  16103. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16104. The algorithm is described in
  16105. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16106. It accepts the following parameters:
  16107. @table @option
  16108. @item radius, r
  16109. Set the window radius. Default value is 3.
  16110. @item planes, p
  16111. Set which planes to filter. Default is only the first plane.
  16112. @item sigma, s
  16113. Set blur strength. Default value is 128.
  16114. @end table
  16115. @subsection Commands
  16116. This filter supports same @ref{commands} as options.
  16117. @section zoompan
  16118. Apply Zoom & Pan effect.
  16119. This filter accepts the following options:
  16120. @table @option
  16121. @item zoom, z
  16122. Set the zoom expression. Range is 1-10. Default is 1.
  16123. @item x
  16124. @item y
  16125. Set the x and y expression. Default is 0.
  16126. @item d
  16127. Set the duration expression in number of frames.
  16128. This sets for how many number of frames effect will last for
  16129. single input image.
  16130. @item s
  16131. Set the output image size, default is 'hd720'.
  16132. @item fps
  16133. Set the output frame rate, default is '25'.
  16134. @end table
  16135. Each expression can contain the following constants:
  16136. @table @option
  16137. @item in_w, iw
  16138. Input width.
  16139. @item in_h, ih
  16140. Input height.
  16141. @item out_w, ow
  16142. Output width.
  16143. @item out_h, oh
  16144. Output height.
  16145. @item in
  16146. Input frame count.
  16147. @item on
  16148. Output frame count.
  16149. @item in_time, it
  16150. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16151. @item out_time, time, ot
  16152. The output timestamp expressed in seconds.
  16153. @item x
  16154. @item y
  16155. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16156. for current input frame.
  16157. @item px
  16158. @item py
  16159. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16160. not yet such frame (first input frame).
  16161. @item zoom
  16162. Last calculated zoom from 'z' expression for current input frame.
  16163. @item pzoom
  16164. Last calculated zoom of last output frame of previous input frame.
  16165. @item duration
  16166. Number of output frames for current input frame. Calculated from 'd' expression
  16167. for each input frame.
  16168. @item pduration
  16169. number of output frames created for previous input frame
  16170. @item a
  16171. Rational number: input width / input height
  16172. @item sar
  16173. sample aspect ratio
  16174. @item dar
  16175. display aspect ratio
  16176. @end table
  16177. @subsection Examples
  16178. @itemize
  16179. @item
  16180. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16181. @example
  16182. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
  16183. @end example
  16184. @item
  16185. Zoom in up to 1.5x and pan always at center of picture:
  16186. @example
  16187. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16188. @end example
  16189. @item
  16190. Same as above but without pausing:
  16191. @example
  16192. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16193. @end example
  16194. @item
  16195. Zoom in 2x into center of picture only for the first second of the input video:
  16196. @example
  16197. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16198. @end example
  16199. @end itemize
  16200. @anchor{zscale}
  16201. @section zscale
  16202. Scale (resize) the input video, using the z.lib library:
  16203. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16204. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16205. The zscale filter forces the output display aspect ratio to be the same
  16206. as the input, by changing the output sample aspect ratio.
  16207. If the input image format is different from the format requested by
  16208. the next filter, the zscale filter will convert the input to the
  16209. requested format.
  16210. @subsection Options
  16211. The filter accepts the following options.
  16212. @table @option
  16213. @item width, w
  16214. @item height, h
  16215. Set the output video dimension expression. Default value is the input
  16216. dimension.
  16217. If the @var{width} or @var{w} value is 0, the input width is used for
  16218. the output. If the @var{height} or @var{h} value is 0, the input height
  16219. is used for the output.
  16220. If one and only one of the values is -n with n >= 1, the zscale filter
  16221. will use a value that maintains the aspect ratio of the input image,
  16222. calculated from the other specified dimension. After that it will,
  16223. however, make sure that the calculated dimension is divisible by n and
  16224. adjust the value if necessary.
  16225. If both values are -n with n >= 1, the behavior will be identical to
  16226. both values being set to 0 as previously detailed.
  16227. See below for the list of accepted constants for use in the dimension
  16228. expression.
  16229. @item size, s
  16230. Set the video size. For the syntax of this option, check the
  16231. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16232. @item dither, d
  16233. Set the dither type.
  16234. Possible values are:
  16235. @table @var
  16236. @item none
  16237. @item ordered
  16238. @item random
  16239. @item error_diffusion
  16240. @end table
  16241. Default is none.
  16242. @item filter, f
  16243. Set the resize filter type.
  16244. Possible values are:
  16245. @table @var
  16246. @item point
  16247. @item bilinear
  16248. @item bicubic
  16249. @item spline16
  16250. @item spline36
  16251. @item lanczos
  16252. @end table
  16253. Default is bilinear.
  16254. @item range, r
  16255. Set the color range.
  16256. Possible values are:
  16257. @table @var
  16258. @item input
  16259. @item limited
  16260. @item full
  16261. @end table
  16262. Default is same as input.
  16263. @item primaries, p
  16264. Set the color primaries.
  16265. Possible values are:
  16266. @table @var
  16267. @item input
  16268. @item 709
  16269. @item unspecified
  16270. @item 170m
  16271. @item 240m
  16272. @item 2020
  16273. @end table
  16274. Default is same as input.
  16275. @item transfer, t
  16276. Set the transfer characteristics.
  16277. Possible values are:
  16278. @table @var
  16279. @item input
  16280. @item 709
  16281. @item unspecified
  16282. @item 601
  16283. @item linear
  16284. @item 2020_10
  16285. @item 2020_12
  16286. @item smpte2084
  16287. @item iec61966-2-1
  16288. @item arib-std-b67
  16289. @end table
  16290. Default is same as input.
  16291. @item matrix, m
  16292. Set the colorspace matrix.
  16293. Possible value are:
  16294. @table @var
  16295. @item input
  16296. @item 709
  16297. @item unspecified
  16298. @item 470bg
  16299. @item 170m
  16300. @item 2020_ncl
  16301. @item 2020_cl
  16302. @end table
  16303. Default is same as input.
  16304. @item rangein, rin
  16305. Set the input color range.
  16306. Possible values are:
  16307. @table @var
  16308. @item input
  16309. @item limited
  16310. @item full
  16311. @end table
  16312. Default is same as input.
  16313. @item primariesin, pin
  16314. Set the input color primaries.
  16315. Possible values are:
  16316. @table @var
  16317. @item input
  16318. @item 709
  16319. @item unspecified
  16320. @item 170m
  16321. @item 240m
  16322. @item 2020
  16323. @end table
  16324. Default is same as input.
  16325. @item transferin, tin
  16326. Set the input transfer characteristics.
  16327. Possible values are:
  16328. @table @var
  16329. @item input
  16330. @item 709
  16331. @item unspecified
  16332. @item 601
  16333. @item linear
  16334. @item 2020_10
  16335. @item 2020_12
  16336. @end table
  16337. Default is same as input.
  16338. @item matrixin, min
  16339. Set the input colorspace matrix.
  16340. Possible value are:
  16341. @table @var
  16342. @item input
  16343. @item 709
  16344. @item unspecified
  16345. @item 470bg
  16346. @item 170m
  16347. @item 2020_ncl
  16348. @item 2020_cl
  16349. @end table
  16350. @item chromal, c
  16351. Set the output chroma location.
  16352. Possible values are:
  16353. @table @var
  16354. @item input
  16355. @item left
  16356. @item center
  16357. @item topleft
  16358. @item top
  16359. @item bottomleft
  16360. @item bottom
  16361. @end table
  16362. @item chromalin, cin
  16363. Set the input chroma location.
  16364. Possible values are:
  16365. @table @var
  16366. @item input
  16367. @item left
  16368. @item center
  16369. @item topleft
  16370. @item top
  16371. @item bottomleft
  16372. @item bottom
  16373. @end table
  16374. @item npl
  16375. Set the nominal peak luminance.
  16376. @end table
  16377. The values of the @option{w} and @option{h} options are expressions
  16378. containing the following constants:
  16379. @table @var
  16380. @item in_w
  16381. @item in_h
  16382. The input width and height
  16383. @item iw
  16384. @item ih
  16385. These are the same as @var{in_w} and @var{in_h}.
  16386. @item out_w
  16387. @item out_h
  16388. The output (scaled) width and height
  16389. @item ow
  16390. @item oh
  16391. These are the same as @var{out_w} and @var{out_h}
  16392. @item a
  16393. The same as @var{iw} / @var{ih}
  16394. @item sar
  16395. input sample aspect ratio
  16396. @item dar
  16397. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16398. @item hsub
  16399. @item vsub
  16400. horizontal and vertical input chroma subsample values. For example for the
  16401. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16402. @item ohsub
  16403. @item ovsub
  16404. horizontal and vertical output chroma subsample values. For example for the
  16405. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16406. @end table
  16407. @subsection Commands
  16408. This filter supports the following commands:
  16409. @table @option
  16410. @item width, w
  16411. @item height, h
  16412. Set the output video dimension expression.
  16413. The command accepts the same syntax of the corresponding option.
  16414. If the specified expression is not valid, it is kept at its current
  16415. value.
  16416. @end table
  16417. @c man end VIDEO FILTERS
  16418. @chapter OpenCL Video Filters
  16419. @c man begin OPENCL VIDEO FILTERS
  16420. Below is a description of the currently available OpenCL video filters.
  16421. To enable compilation of these filters you need to configure FFmpeg with
  16422. @code{--enable-opencl}.
  16423. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16424. @table @option
  16425. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16426. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16427. given device parameters.
  16428. @item -filter_hw_device @var{name}
  16429. Pass the hardware device called @var{name} to all filters in any filter graph.
  16430. @end table
  16431. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16432. @itemize
  16433. @item
  16434. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16435. @example
  16436. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16437. @end example
  16438. @end itemize
  16439. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  16440. @section avgblur_opencl
  16441. Apply average blur filter.
  16442. The filter accepts the following options:
  16443. @table @option
  16444. @item sizeX
  16445. Set horizontal radius size.
  16446. Range is @code{[1, 1024]} and default value is @code{1}.
  16447. @item planes
  16448. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16449. @item sizeY
  16450. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16451. @end table
  16452. @subsection Example
  16453. @itemize
  16454. @item
  16455. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  16456. @example
  16457. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16458. @end example
  16459. @end itemize
  16460. @section boxblur_opencl
  16461. Apply a boxblur algorithm to the input video.
  16462. It accepts the following parameters:
  16463. @table @option
  16464. @item luma_radius, lr
  16465. @item luma_power, lp
  16466. @item chroma_radius, cr
  16467. @item chroma_power, cp
  16468. @item alpha_radius, ar
  16469. @item alpha_power, ap
  16470. @end table
  16471. A description of the accepted options follows.
  16472. @table @option
  16473. @item luma_radius, lr
  16474. @item chroma_radius, cr
  16475. @item alpha_radius, ar
  16476. Set an expression for the box radius in pixels used for blurring the
  16477. corresponding input plane.
  16478. The radius value must be a non-negative number, and must not be
  16479. greater than the value of the expression @code{min(w,h)/2} for the
  16480. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16481. planes.
  16482. Default value for @option{luma_radius} is "2". If not specified,
  16483. @option{chroma_radius} and @option{alpha_radius} default to the
  16484. corresponding value set for @option{luma_radius}.
  16485. The expressions can contain the following constants:
  16486. @table @option
  16487. @item w
  16488. @item h
  16489. The input width and height in pixels.
  16490. @item cw
  16491. @item ch
  16492. The input chroma image width and height in pixels.
  16493. @item hsub
  16494. @item vsub
  16495. The horizontal and vertical chroma subsample values. For example, for the
  16496. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16497. @end table
  16498. @item luma_power, lp
  16499. @item chroma_power, cp
  16500. @item alpha_power, ap
  16501. Specify how many times the boxblur filter is applied to the
  16502. corresponding plane.
  16503. Default value for @option{luma_power} is 2. If not specified,
  16504. @option{chroma_power} and @option{alpha_power} default to the
  16505. corresponding value set for @option{luma_power}.
  16506. A value of 0 will disable the effect.
  16507. @end table
  16508. @subsection Examples
  16509. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  16510. @itemize
  16511. @item
  16512. Apply a boxblur filter with the luma, chroma, and alpha radius
  16513. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  16514. @example
  16515. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16516. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16517. @end example
  16518. @item
  16519. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  16520. For the luma plane, a 2x2 box radius will be run once.
  16521. For the chroma plane, a 4x4 box radius will be run 5 times.
  16522. For the alpha plane, a 3x3 box radius will be run 7 times.
  16523. @example
  16524. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16525. @end example
  16526. @end itemize
  16527. @section colorkey_opencl
  16528. RGB colorspace color keying.
  16529. The filter accepts the following options:
  16530. @table @option
  16531. @item color
  16532. The color which will be replaced with transparency.
  16533. @item similarity
  16534. Similarity percentage with the key color.
  16535. 0.01 matches only the exact key color, while 1.0 matches everything.
  16536. @item blend
  16537. Blend percentage.
  16538. 0.0 makes pixels either fully transparent, or not transparent at all.
  16539. Higher values result in semi-transparent pixels, with a higher transparency
  16540. the more similar the pixels color is to the key color.
  16541. @end table
  16542. @subsection Examples
  16543. @itemize
  16544. @item
  16545. Make every semi-green pixel in the input transparent with some slight blending:
  16546. @example
  16547. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16548. @end example
  16549. @end itemize
  16550. @section convolution_opencl
  16551. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16552. The filter accepts the following options:
  16553. @table @option
  16554. @item 0m
  16555. @item 1m
  16556. @item 2m
  16557. @item 3m
  16558. Set matrix for each plane.
  16559. Matrix is sequence of 9, 25 or 49 signed numbers.
  16560. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16561. @item 0rdiv
  16562. @item 1rdiv
  16563. @item 2rdiv
  16564. @item 3rdiv
  16565. Set multiplier for calculated value for each plane.
  16566. If unset or 0, it will be sum of all matrix elements.
  16567. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16568. @item 0bias
  16569. @item 1bias
  16570. @item 2bias
  16571. @item 3bias
  16572. Set bias for each plane. This value is added to the result of the multiplication.
  16573. Useful for making the overall image brighter or darker.
  16574. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16575. @end table
  16576. @subsection Examples
  16577. @itemize
  16578. @item
  16579. Apply sharpen:
  16580. @example
  16581. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  16582. @end example
  16583. @item
  16584. Apply blur:
  16585. @example
  16586. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  16587. @end example
  16588. @item
  16589. Apply edge enhance:
  16590. @example
  16591. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  16592. @end example
  16593. @item
  16594. Apply edge detect:
  16595. @example
  16596. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  16597. @end example
  16598. @item
  16599. Apply laplacian edge detector which includes diagonals:
  16600. @example
  16601. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  16602. @end example
  16603. @item
  16604. Apply emboss:
  16605. @example
  16606. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  16607. @end example
  16608. @end itemize
  16609. @section erosion_opencl
  16610. Apply erosion effect to the video.
  16611. This filter replaces the pixel by the local(3x3) minimum.
  16612. It accepts the following options:
  16613. @table @option
  16614. @item threshold0
  16615. @item threshold1
  16616. @item threshold2
  16617. @item threshold3
  16618. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16619. If @code{0}, plane will remain unchanged.
  16620. @item coordinates
  16621. Flag which specifies the pixel to refer to.
  16622. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16623. Flags to local 3x3 coordinates region centered on @code{x}:
  16624. 1 2 3
  16625. 4 x 5
  16626. 6 7 8
  16627. @end table
  16628. @subsection Example
  16629. @itemize
  16630. @item
  16631. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  16632. @example
  16633. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16634. @end example
  16635. @end itemize
  16636. @section deshake_opencl
  16637. Feature-point based video stabilization filter.
  16638. The filter accepts the following options:
  16639. @table @option
  16640. @item tripod
  16641. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16642. @item debug
  16643. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16644. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16645. Viewing point matches in the output video is only supported for RGB input.
  16646. Defaults to @code{0}.
  16647. @item adaptive_crop
  16648. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16649. Defaults to @code{1}.
  16650. @item refine_features
  16651. Whether or not feature points should be refined at a sub-pixel level.
  16652. This can be turned off for a slight performance gain at the cost of precision.
  16653. Defaults to @code{1}.
  16654. @item smooth_strength
  16655. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16656. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16657. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16658. Defaults to @code{0.0}.
  16659. @item smooth_window_multiplier
  16660. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16661. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16662. Acceptable values range from @code{0.1} to @code{10.0}.
  16663. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16664. potentially improving smoothness, but also increase latency and memory usage.
  16665. Defaults to @code{2.0}.
  16666. @end table
  16667. @subsection Examples
  16668. @itemize
  16669. @item
  16670. Stabilize a video with a fixed, medium smoothing strength:
  16671. @example
  16672. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16673. @end example
  16674. @item
  16675. Stabilize a video with debugging (both in console and in rendered video):
  16676. @example
  16677. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16678. @end example
  16679. @end itemize
  16680. @section dilation_opencl
  16681. Apply dilation effect to the video.
  16682. This filter replaces the pixel by the local(3x3) maximum.
  16683. It accepts the following options:
  16684. @table @option
  16685. @item threshold0
  16686. @item threshold1
  16687. @item threshold2
  16688. @item threshold3
  16689. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16690. If @code{0}, plane will remain unchanged.
  16691. @item coordinates
  16692. Flag which specifies the pixel to refer to.
  16693. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16694. Flags to local 3x3 coordinates region centered on @code{x}:
  16695. 1 2 3
  16696. 4 x 5
  16697. 6 7 8
  16698. @end table
  16699. @subsection Example
  16700. @itemize
  16701. @item
  16702. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  16703. @example
  16704. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16705. @end example
  16706. @end itemize
  16707. @section nlmeans_opencl
  16708. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16709. @section overlay_opencl
  16710. Overlay one video on top of another.
  16711. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16712. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16713. The filter accepts the following options:
  16714. @table @option
  16715. @item x
  16716. Set the x coordinate of the overlaid video on the main video.
  16717. Default value is @code{0}.
  16718. @item y
  16719. Set the y coordinate of the overlaid video on the main video.
  16720. Default value is @code{0}.
  16721. @end table
  16722. @subsection Examples
  16723. @itemize
  16724. @item
  16725. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16726. @example
  16727. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16728. @end example
  16729. @item
  16730. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16731. @example
  16732. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16733. @end example
  16734. @end itemize
  16735. @section pad_opencl
  16736. Add paddings to the input image, and place the original input at the
  16737. provided @var{x}, @var{y} coordinates.
  16738. It accepts the following options:
  16739. @table @option
  16740. @item width, w
  16741. @item height, h
  16742. Specify an expression for the size of the output image with the
  16743. paddings added. If the value for @var{width} or @var{height} is 0, the
  16744. corresponding input size is used for the output.
  16745. The @var{width} expression can reference the value set by the
  16746. @var{height} expression, and vice versa.
  16747. The default value of @var{width} and @var{height} is 0.
  16748. @item x
  16749. @item y
  16750. Specify the offsets to place the input image at within the padded area,
  16751. with respect to the top/left border of the output image.
  16752. The @var{x} expression can reference the value set by the @var{y}
  16753. expression, and vice versa.
  16754. The default value of @var{x} and @var{y} is 0.
  16755. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16756. so the input image is centered on the padded area.
  16757. @item color
  16758. Specify the color of the padded area. For the syntax of this option,
  16759. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16760. manual,ffmpeg-utils}.
  16761. @item aspect
  16762. Pad to an aspect instead to a resolution.
  16763. @end table
  16764. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16765. options are expressions containing the following constants:
  16766. @table @option
  16767. @item in_w
  16768. @item in_h
  16769. The input video width and height.
  16770. @item iw
  16771. @item ih
  16772. These are the same as @var{in_w} and @var{in_h}.
  16773. @item out_w
  16774. @item out_h
  16775. The output width and height (the size of the padded area), as
  16776. specified by the @var{width} and @var{height} expressions.
  16777. @item ow
  16778. @item oh
  16779. These are the same as @var{out_w} and @var{out_h}.
  16780. @item x
  16781. @item y
  16782. The x and y offsets as specified by the @var{x} and @var{y}
  16783. expressions, or NAN if not yet specified.
  16784. @item a
  16785. same as @var{iw} / @var{ih}
  16786. @item sar
  16787. input sample aspect ratio
  16788. @item dar
  16789. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16790. @end table
  16791. @section prewitt_opencl
  16792. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16793. The filter accepts the following option:
  16794. @table @option
  16795. @item planes
  16796. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16797. @item scale
  16798. Set value which will be multiplied with filtered result.
  16799. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16800. @item delta
  16801. Set value which will be added to filtered result.
  16802. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16803. @end table
  16804. @subsection Example
  16805. @itemize
  16806. @item
  16807. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16808. @example
  16809. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16810. @end example
  16811. @end itemize
  16812. @anchor{program_opencl}
  16813. @section program_opencl
  16814. Filter video using an OpenCL program.
  16815. @table @option
  16816. @item source
  16817. OpenCL program source file.
  16818. @item kernel
  16819. Kernel name in program.
  16820. @item inputs
  16821. Number of inputs to the filter. Defaults to 1.
  16822. @item size, s
  16823. Size of output frames. Defaults to the same as the first input.
  16824. @end table
  16825. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16826. The program source file must contain a kernel function with the given name,
  16827. which will be run once for each plane of the output. Each run on a plane
  16828. gets enqueued as a separate 2D global NDRange with one work-item for each
  16829. pixel to be generated. The global ID offset for each work-item is therefore
  16830. the coordinates of a pixel in the destination image.
  16831. The kernel function needs to take the following arguments:
  16832. @itemize
  16833. @item
  16834. Destination image, @var{__write_only image2d_t}.
  16835. This image will become the output; the kernel should write all of it.
  16836. @item
  16837. Frame index, @var{unsigned int}.
  16838. This is a counter starting from zero and increasing by one for each frame.
  16839. @item
  16840. Source images, @var{__read_only image2d_t}.
  16841. These are the most recent images on each input. The kernel may read from
  16842. them to generate the output, but they can't be written to.
  16843. @end itemize
  16844. Example programs:
  16845. @itemize
  16846. @item
  16847. Copy the input to the output (output must be the same size as the input).
  16848. @verbatim
  16849. __kernel void copy(__write_only image2d_t destination,
  16850. unsigned int index,
  16851. __read_only image2d_t source)
  16852. {
  16853. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16854. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16855. float4 value = read_imagef(source, sampler, location);
  16856. write_imagef(destination, location, value);
  16857. }
  16858. @end verbatim
  16859. @item
  16860. Apply a simple transformation, rotating the input by an amount increasing
  16861. with the index counter. Pixel values are linearly interpolated by the
  16862. sampler, and the output need not have the same dimensions as the input.
  16863. @verbatim
  16864. __kernel void rotate_image(__write_only image2d_t dst,
  16865. unsigned int index,
  16866. __read_only image2d_t src)
  16867. {
  16868. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16869. CLK_FILTER_LINEAR);
  16870. float angle = (float)index / 100.0f;
  16871. float2 dst_dim = convert_float2(get_image_dim(dst));
  16872. float2 src_dim = convert_float2(get_image_dim(src));
  16873. float2 dst_cen = dst_dim / 2.0f;
  16874. float2 src_cen = src_dim / 2.0f;
  16875. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16876. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16877. float2 src_pos = {
  16878. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16879. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16880. };
  16881. src_pos = src_pos * src_dim / dst_dim;
  16882. float2 src_loc = src_pos + src_cen;
  16883. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16884. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16885. write_imagef(dst, dst_loc, 0.5f);
  16886. else
  16887. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16888. }
  16889. @end verbatim
  16890. @item
  16891. Blend two inputs together, with the amount of each input used varying
  16892. with the index counter.
  16893. @verbatim
  16894. __kernel void blend_images(__write_only image2d_t dst,
  16895. unsigned int index,
  16896. __read_only image2d_t src1,
  16897. __read_only image2d_t src2)
  16898. {
  16899. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16900. CLK_FILTER_LINEAR);
  16901. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16902. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16903. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16904. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16905. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16906. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16907. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16908. }
  16909. @end verbatim
  16910. @end itemize
  16911. @section roberts_opencl
  16912. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16913. The filter accepts the following option:
  16914. @table @option
  16915. @item planes
  16916. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16917. @item scale
  16918. Set value which will be multiplied with filtered result.
  16919. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16920. @item delta
  16921. Set value which will be added to filtered result.
  16922. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16923. @end table
  16924. @subsection Example
  16925. @itemize
  16926. @item
  16927. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16928. @example
  16929. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16930. @end example
  16931. @end itemize
  16932. @section sobel_opencl
  16933. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16934. The filter accepts the following option:
  16935. @table @option
  16936. @item planes
  16937. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16938. @item scale
  16939. Set value which will be multiplied with filtered result.
  16940. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16941. @item delta
  16942. Set value which will be added to filtered result.
  16943. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16944. @end table
  16945. @subsection Example
  16946. @itemize
  16947. @item
  16948. Apply sobel operator with scale set to 2 and delta set to 10
  16949. @example
  16950. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16951. @end example
  16952. @end itemize
  16953. @section tonemap_opencl
  16954. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16955. It accepts the following parameters:
  16956. @table @option
  16957. @item tonemap
  16958. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16959. @item param
  16960. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16961. @item desat
  16962. Apply desaturation for highlights that exceed this level of brightness. The
  16963. higher the parameter, the more color information will be preserved. This
  16964. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16965. (smoothly) turning into white instead. This makes images feel more natural,
  16966. at the cost of reducing information about out-of-range colors.
  16967. The default value is 0.5, and the algorithm here is a little different from
  16968. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16969. @item threshold
  16970. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16971. is used to detect whether the scene has changed or not. If the distance between
  16972. the current frame average brightness and the current running average exceeds
  16973. a threshold value, we would re-calculate scene average and peak brightness.
  16974. The default value is 0.2.
  16975. @item format
  16976. Specify the output pixel format.
  16977. Currently supported formats are:
  16978. @table @var
  16979. @item p010
  16980. @item nv12
  16981. @end table
  16982. @item range, r
  16983. Set the output color range.
  16984. Possible values are:
  16985. @table @var
  16986. @item tv/mpeg
  16987. @item pc/jpeg
  16988. @end table
  16989. Default is same as input.
  16990. @item primaries, p
  16991. Set the output color primaries.
  16992. Possible values are:
  16993. @table @var
  16994. @item bt709
  16995. @item bt2020
  16996. @end table
  16997. Default is same as input.
  16998. @item transfer, t
  16999. Set the output transfer characteristics.
  17000. Possible values are:
  17001. @table @var
  17002. @item bt709
  17003. @item bt2020
  17004. @end table
  17005. Default is bt709.
  17006. @item matrix, m
  17007. Set the output colorspace matrix.
  17008. Possible value are:
  17009. @table @var
  17010. @item bt709
  17011. @item bt2020
  17012. @end table
  17013. Default is same as input.
  17014. @end table
  17015. @subsection Example
  17016. @itemize
  17017. @item
  17018. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17019. @example
  17020. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17021. @end example
  17022. @end itemize
  17023. @section unsharp_opencl
  17024. Sharpen or blur the input video.
  17025. It accepts the following parameters:
  17026. @table @option
  17027. @item luma_msize_x, lx
  17028. Set the luma matrix horizontal size.
  17029. Range is @code{[1, 23]} and default value is @code{5}.
  17030. @item luma_msize_y, ly
  17031. Set the luma matrix vertical size.
  17032. Range is @code{[1, 23]} and default value is @code{5}.
  17033. @item luma_amount, la
  17034. Set the luma effect strength.
  17035. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17036. Negative values will blur the input video, while positive values will
  17037. sharpen it, a value of zero will disable the effect.
  17038. @item chroma_msize_x, cx
  17039. Set the chroma matrix horizontal size.
  17040. Range is @code{[1, 23]} and default value is @code{5}.
  17041. @item chroma_msize_y, cy
  17042. Set the chroma matrix vertical size.
  17043. Range is @code{[1, 23]} and default value is @code{5}.
  17044. @item chroma_amount, ca
  17045. Set the chroma effect strength.
  17046. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17047. Negative values will blur the input video, while positive values will
  17048. sharpen it, a value of zero will disable the effect.
  17049. @end table
  17050. All parameters are optional and default to the equivalent of the
  17051. string '5:5:1.0:5:5:0.0'.
  17052. @subsection Examples
  17053. @itemize
  17054. @item
  17055. Apply strong luma sharpen effect:
  17056. @example
  17057. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17058. @end example
  17059. @item
  17060. Apply a strong blur of both luma and chroma parameters:
  17061. @example
  17062. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17063. @end example
  17064. @end itemize
  17065. @section xfade_opencl
  17066. Cross fade two videos with custom transition effect by using OpenCL.
  17067. It accepts the following options:
  17068. @table @option
  17069. @item transition
  17070. Set one of possible transition effects.
  17071. @table @option
  17072. @item custom
  17073. Select custom transition effect, the actual transition description
  17074. will be picked from source and kernel options.
  17075. @item fade
  17076. @item wipeleft
  17077. @item wiperight
  17078. @item wipeup
  17079. @item wipedown
  17080. @item slideleft
  17081. @item slideright
  17082. @item slideup
  17083. @item slidedown
  17084. Default transition is fade.
  17085. @end table
  17086. @item source
  17087. OpenCL program source file for custom transition.
  17088. @item kernel
  17089. Set name of kernel to use for custom transition from program source file.
  17090. @item duration
  17091. Set duration of video transition.
  17092. @item offset
  17093. Set time of start of transition relative to first video.
  17094. @end table
  17095. The program source file must contain a kernel function with the given name,
  17096. which will be run once for each plane of the output. Each run on a plane
  17097. gets enqueued as a separate 2D global NDRange with one work-item for each
  17098. pixel to be generated. The global ID offset for each work-item is therefore
  17099. the coordinates of a pixel in the destination image.
  17100. The kernel function needs to take the following arguments:
  17101. @itemize
  17102. @item
  17103. Destination image, @var{__write_only image2d_t}.
  17104. This image will become the output; the kernel should write all of it.
  17105. @item
  17106. First Source image, @var{__read_only image2d_t}.
  17107. Second Source image, @var{__read_only image2d_t}.
  17108. These are the most recent images on each input. The kernel may read from
  17109. them to generate the output, but they can't be written to.
  17110. @item
  17111. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17112. @end itemize
  17113. Example programs:
  17114. @itemize
  17115. @item
  17116. Apply dots curtain transition effect:
  17117. @verbatim
  17118. __kernel void blend_images(__write_only image2d_t dst,
  17119. __read_only image2d_t src1,
  17120. __read_only image2d_t src2,
  17121. float progress)
  17122. {
  17123. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17124. CLK_FILTER_LINEAR);
  17125. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17126. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17127. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17128. rp = rp / dim;
  17129. float2 dots = (float2)(20.0, 20.0);
  17130. float2 center = (float2)(0,0);
  17131. float2 unused;
  17132. float4 val1 = read_imagef(src1, sampler, p);
  17133. float4 val2 = read_imagef(src2, sampler, p);
  17134. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17135. write_imagef(dst, p, next ? val1 : val2);
  17136. }
  17137. @end verbatim
  17138. @end itemize
  17139. @c man end OPENCL VIDEO FILTERS
  17140. @chapter VAAPI Video Filters
  17141. @c man begin VAAPI VIDEO FILTERS
  17142. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17143. To enable compilation of these filters you need to configure FFmpeg with
  17144. @code{--enable-vaapi}.
  17145. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  17146. @section tonemap_vaapi
  17147. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17148. It maps the dynamic range of HDR10 content to the SDR content.
  17149. It currently only accepts HDR10 as input.
  17150. It accepts the following parameters:
  17151. @table @option
  17152. @item format
  17153. Specify the output pixel format.
  17154. Currently supported formats are:
  17155. @table @var
  17156. @item p010
  17157. @item nv12
  17158. @end table
  17159. Default is nv12.
  17160. @item primaries, p
  17161. Set the output color primaries.
  17162. Default is same as input.
  17163. @item transfer, t
  17164. Set the output transfer characteristics.
  17165. Default is bt709.
  17166. @item matrix, m
  17167. Set the output colorspace matrix.
  17168. Default is same as input.
  17169. @end table
  17170. @subsection Example
  17171. @itemize
  17172. @item
  17173. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17174. @example
  17175. tonemap_vaapi=format=p010:t=bt2020-10
  17176. @end example
  17177. @end itemize
  17178. @c man end VAAPI VIDEO FILTERS
  17179. @chapter Video Sources
  17180. @c man begin VIDEO SOURCES
  17181. Below is a description of the currently available video sources.
  17182. @section buffer
  17183. Buffer video frames, and make them available to the filter chain.
  17184. This source is mainly intended for a programmatic use, in particular
  17185. through the interface defined in @file{libavfilter/buffersrc.h}.
  17186. It accepts the following parameters:
  17187. @table @option
  17188. @item video_size
  17189. Specify the size (width and height) of the buffered video frames. For the
  17190. syntax of this option, check the
  17191. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17192. @item width
  17193. The input video width.
  17194. @item height
  17195. The input video height.
  17196. @item pix_fmt
  17197. A string representing the pixel format of the buffered video frames.
  17198. It may be a number corresponding to a pixel format, or a pixel format
  17199. name.
  17200. @item time_base
  17201. Specify the timebase assumed by the timestamps of the buffered frames.
  17202. @item frame_rate
  17203. Specify the frame rate expected for the video stream.
  17204. @item pixel_aspect, sar
  17205. The sample (pixel) aspect ratio of the input video.
  17206. @item sws_param
  17207. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17208. to the filtergraph description to specify swscale flags for automatically
  17209. inserted scalers. See @ref{Filtergraph syntax}.
  17210. @item hw_frames_ctx
  17211. When using a hardware pixel format, this should be a reference to an
  17212. AVHWFramesContext describing input frames.
  17213. @end table
  17214. For example:
  17215. @example
  17216. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17217. @end example
  17218. will instruct the source to accept video frames with size 320x240 and
  17219. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17220. square pixels (1:1 sample aspect ratio).
  17221. Since the pixel format with name "yuv410p" corresponds to the number 6
  17222. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17223. this example corresponds to:
  17224. @example
  17225. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17226. @end example
  17227. Alternatively, the options can be specified as a flat string, but this
  17228. syntax is deprecated:
  17229. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17230. @section cellauto
  17231. Create a pattern generated by an elementary cellular automaton.
  17232. The initial state of the cellular automaton can be defined through the
  17233. @option{filename} and @option{pattern} options. If such options are
  17234. not specified an initial state is created randomly.
  17235. At each new frame a new row in the video is filled with the result of
  17236. the cellular automaton next generation. The behavior when the whole
  17237. frame is filled is defined by the @option{scroll} option.
  17238. This source accepts the following options:
  17239. @table @option
  17240. @item filename, f
  17241. Read the initial cellular automaton state, i.e. the starting row, from
  17242. the specified file.
  17243. In the file, each non-whitespace character is considered an alive
  17244. cell, a newline will terminate the row, and further characters in the
  17245. file will be ignored.
  17246. @item pattern, p
  17247. Read the initial cellular automaton state, i.e. the starting row, from
  17248. the specified string.
  17249. Each non-whitespace character in the string is considered an alive
  17250. cell, a newline will terminate the row, and further characters in the
  17251. string will be ignored.
  17252. @item rate, r
  17253. Set the video rate, that is the number of frames generated per second.
  17254. Default is 25.
  17255. @item random_fill_ratio, ratio
  17256. Set the random fill ratio for the initial cellular automaton row. It
  17257. is a floating point number value ranging from 0 to 1, defaults to
  17258. 1/PHI.
  17259. This option is ignored when a file or a pattern is specified.
  17260. @item random_seed, seed
  17261. Set the seed for filling randomly the initial row, must be an integer
  17262. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17263. set to -1, the filter will try to use a good random seed on a best
  17264. effort basis.
  17265. @item rule
  17266. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17267. Default value is 110.
  17268. @item size, s
  17269. Set the size of the output video. For the syntax of this option, check the
  17270. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17271. If @option{filename} or @option{pattern} is specified, the size is set
  17272. by default to the width of the specified initial state row, and the
  17273. height is set to @var{width} * PHI.
  17274. If @option{size} is set, it must contain the width of the specified
  17275. pattern string, and the specified pattern will be centered in the
  17276. larger row.
  17277. If a filename or a pattern string is not specified, the size value
  17278. defaults to "320x518" (used for a randomly generated initial state).
  17279. @item scroll
  17280. If set to 1, scroll the output upward when all the rows in the output
  17281. have been already filled. If set to 0, the new generated row will be
  17282. written over the top row just after the bottom row is filled.
  17283. Defaults to 1.
  17284. @item start_full, full
  17285. If set to 1, completely fill the output with generated rows before
  17286. outputting the first frame.
  17287. This is the default behavior, for disabling set the value to 0.
  17288. @item stitch
  17289. If set to 1, stitch the left and right row edges together.
  17290. This is the default behavior, for disabling set the value to 0.
  17291. @end table
  17292. @subsection Examples
  17293. @itemize
  17294. @item
  17295. Read the initial state from @file{pattern}, and specify an output of
  17296. size 200x400.
  17297. @example
  17298. cellauto=f=pattern:s=200x400
  17299. @end example
  17300. @item
  17301. Generate a random initial row with a width of 200 cells, with a fill
  17302. ratio of 2/3:
  17303. @example
  17304. cellauto=ratio=2/3:s=200x200
  17305. @end example
  17306. @item
  17307. Create a pattern generated by rule 18 starting by a single alive cell
  17308. centered on an initial row with width 100:
  17309. @example
  17310. cellauto=p=@@:s=100x400:full=0:rule=18
  17311. @end example
  17312. @item
  17313. Specify a more elaborated initial pattern:
  17314. @example
  17315. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17316. @end example
  17317. @end itemize
  17318. @anchor{coreimagesrc}
  17319. @section coreimagesrc
  17320. Video source generated on GPU using Apple's CoreImage API on OSX.
  17321. This video source is a specialized version of the @ref{coreimage} video filter.
  17322. Use a core image generator at the beginning of the applied filterchain to
  17323. generate the content.
  17324. The coreimagesrc video source accepts the following options:
  17325. @table @option
  17326. @item list_generators
  17327. List all available generators along with all their respective options as well as
  17328. possible minimum and maximum values along with the default values.
  17329. @example
  17330. list_generators=true
  17331. @end example
  17332. @item size, s
  17333. Specify the size of the sourced video. For the syntax of this option, check the
  17334. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17335. The default value is @code{320x240}.
  17336. @item rate, r
  17337. Specify the frame rate of the sourced video, as the number of frames
  17338. generated per second. It has to be a string in the format
  17339. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17340. number or a valid video frame rate abbreviation. The default value is
  17341. "25".
  17342. @item sar
  17343. Set the sample aspect ratio of the sourced video.
  17344. @item duration, d
  17345. Set the duration of the sourced video. See
  17346. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17347. for the accepted syntax.
  17348. If not specified, or the expressed duration is negative, the video is
  17349. supposed to be generated forever.
  17350. @end table
  17351. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17352. A complete filterchain can be used for further processing of the
  17353. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17354. and examples for details.
  17355. @subsection Examples
  17356. @itemize
  17357. @item
  17358. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17359. given as complete and escaped command-line for Apple's standard bash shell:
  17360. @example
  17361. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17362. @end example
  17363. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17364. need for a nullsrc video source.
  17365. @end itemize
  17366. @section gradients
  17367. Generate several gradients.
  17368. @table @option
  17369. @item size, s
  17370. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17371. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17372. @item rate, r
  17373. Set frame rate, expressed as number of frames per second. Default
  17374. value is "25".
  17375. @item c0, c1, c2, c3, c4, c5, c6, c7
  17376. Set 8 colors. Default values for colors is to pick random one.
  17377. @item x0, y0, y0, y1
  17378. Set gradient line source and destination points. If negative or out of range, random ones
  17379. are picked.
  17380. @item nb_colors, n
  17381. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17382. @item seed
  17383. Set seed for picking gradient line points.
  17384. @item duration, d
  17385. Set the duration of the sourced video. See
  17386. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17387. for the accepted syntax.
  17388. If not specified, or the expressed duration is negative, the video is
  17389. supposed to be generated forever.
  17390. @item speed
  17391. Set speed of gradients rotation.
  17392. @end table
  17393. @section mandelbrot
  17394. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17395. point specified with @var{start_x} and @var{start_y}.
  17396. This source accepts the following options:
  17397. @table @option
  17398. @item end_pts
  17399. Set the terminal pts value. Default value is 400.
  17400. @item end_scale
  17401. Set the terminal scale value.
  17402. Must be a floating point value. Default value is 0.3.
  17403. @item inner
  17404. Set the inner coloring mode, that is the algorithm used to draw the
  17405. Mandelbrot fractal internal region.
  17406. It shall assume one of the following values:
  17407. @table @option
  17408. @item black
  17409. Set black mode.
  17410. @item convergence
  17411. Show time until convergence.
  17412. @item mincol
  17413. Set color based on point closest to the origin of the iterations.
  17414. @item period
  17415. Set period mode.
  17416. @end table
  17417. Default value is @var{mincol}.
  17418. @item bailout
  17419. Set the bailout value. Default value is 10.0.
  17420. @item maxiter
  17421. Set the maximum of iterations performed by the rendering
  17422. algorithm. Default value is 7189.
  17423. @item outer
  17424. Set outer coloring mode.
  17425. It shall assume one of following values:
  17426. @table @option
  17427. @item iteration_count
  17428. Set iteration count mode.
  17429. @item normalized_iteration_count
  17430. set normalized iteration count mode.
  17431. @end table
  17432. Default value is @var{normalized_iteration_count}.
  17433. @item rate, r
  17434. Set frame rate, expressed as number of frames per second. Default
  17435. value is "25".
  17436. @item size, s
  17437. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17438. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17439. @item start_scale
  17440. Set the initial scale value. Default value is 3.0.
  17441. @item start_x
  17442. Set the initial x position. Must be a floating point value between
  17443. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17444. @item start_y
  17445. Set the initial y position. Must be a floating point value between
  17446. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17447. @end table
  17448. @section mptestsrc
  17449. Generate various test patterns, as generated by the MPlayer test filter.
  17450. The size of the generated video is fixed, and is 256x256.
  17451. This source is useful in particular for testing encoding features.
  17452. This source accepts the following options:
  17453. @table @option
  17454. @item rate, r
  17455. Specify the frame rate of the sourced video, as the number of frames
  17456. generated per second. It has to be a string in the format
  17457. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17458. number or a valid video frame rate abbreviation. The default value is
  17459. "25".
  17460. @item duration, d
  17461. Set the duration of the sourced video. See
  17462. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17463. for the accepted syntax.
  17464. If not specified, or the expressed duration is negative, the video is
  17465. supposed to be generated forever.
  17466. @item test, t
  17467. Set the number or the name of the test to perform. Supported tests are:
  17468. @table @option
  17469. @item dc_luma
  17470. @item dc_chroma
  17471. @item freq_luma
  17472. @item freq_chroma
  17473. @item amp_luma
  17474. @item amp_chroma
  17475. @item cbp
  17476. @item mv
  17477. @item ring1
  17478. @item ring2
  17479. @item all
  17480. @item max_frames, m
  17481. Set the maximum number of frames generated for each test, default value is 30.
  17482. @end table
  17483. Default value is "all", which will cycle through the list of all tests.
  17484. @end table
  17485. Some examples:
  17486. @example
  17487. mptestsrc=t=dc_luma
  17488. @end example
  17489. will generate a "dc_luma" test pattern.
  17490. @section frei0r_src
  17491. Provide a frei0r source.
  17492. To enable compilation of this filter you need to install the frei0r
  17493. header and configure FFmpeg with @code{--enable-frei0r}.
  17494. This source accepts the following parameters:
  17495. @table @option
  17496. @item size
  17497. The size of the video to generate. For the syntax of this option, check the
  17498. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17499. @item framerate
  17500. The framerate of the generated video. It may be a string of the form
  17501. @var{num}/@var{den} or a frame rate abbreviation.
  17502. @item filter_name
  17503. The name to the frei0r source to load. For more information regarding frei0r and
  17504. how to set the parameters, read the @ref{frei0r} section in the video filters
  17505. documentation.
  17506. @item filter_params
  17507. A '|'-separated list of parameters to pass to the frei0r source.
  17508. @end table
  17509. For example, to generate a frei0r partik0l source with size 200x200
  17510. and frame rate 10 which is overlaid on the overlay filter main input:
  17511. @example
  17512. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17513. @end example
  17514. @section life
  17515. Generate a life pattern.
  17516. This source is based on a generalization of John Conway's life game.
  17517. The sourced input represents a life grid, each pixel represents a cell
  17518. which can be in one of two possible states, alive or dead. Every cell
  17519. interacts with its eight neighbours, which are the cells that are
  17520. horizontally, vertically, or diagonally adjacent.
  17521. At each interaction the grid evolves according to the adopted rule,
  17522. which specifies the number of neighbor alive cells which will make a
  17523. cell stay alive or born. The @option{rule} option allows one to specify
  17524. the rule to adopt.
  17525. This source accepts the following options:
  17526. @table @option
  17527. @item filename, f
  17528. Set the file from which to read the initial grid state. In the file,
  17529. each non-whitespace character is considered an alive cell, and newline
  17530. is used to delimit the end of each row.
  17531. If this option is not specified, the initial grid is generated
  17532. randomly.
  17533. @item rate, r
  17534. Set the video rate, that is the number of frames generated per second.
  17535. Default is 25.
  17536. @item random_fill_ratio, ratio
  17537. Set the random fill ratio for the initial random grid. It is a
  17538. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17539. It is ignored when a file is specified.
  17540. @item random_seed, seed
  17541. Set the seed for filling the initial random grid, must be an integer
  17542. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17543. set to -1, the filter will try to use a good random seed on a best
  17544. effort basis.
  17545. @item rule
  17546. Set the life rule.
  17547. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17548. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17549. @var{NS} specifies the number of alive neighbor cells which make a
  17550. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17551. which make a dead cell to become alive (i.e. to "born").
  17552. "s" and "b" can be used in place of "S" and "B", respectively.
  17553. Alternatively a rule can be specified by an 18-bits integer. The 9
  17554. high order bits are used to encode the next cell state if it is alive
  17555. for each number of neighbor alive cells, the low order bits specify
  17556. the rule for "borning" new cells. Higher order bits encode for an
  17557. higher number of neighbor cells.
  17558. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17559. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17560. Default value is "S23/B3", which is the original Conway's game of life
  17561. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17562. cells, and will born a new cell if there are three alive cells around
  17563. a dead cell.
  17564. @item size, s
  17565. Set the size of the output video. For the syntax of this option, check the
  17566. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17567. If @option{filename} is specified, the size is set by default to the
  17568. same size of the input file. If @option{size} is set, it must contain
  17569. the size specified in the input file, and the initial grid defined in
  17570. that file is centered in the larger resulting area.
  17571. If a filename is not specified, the size value defaults to "320x240"
  17572. (used for a randomly generated initial grid).
  17573. @item stitch
  17574. If set to 1, stitch the left and right grid edges together, and the
  17575. top and bottom edges also. Defaults to 1.
  17576. @item mold
  17577. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17578. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17579. value from 0 to 255.
  17580. @item life_color
  17581. Set the color of living (or new born) cells.
  17582. @item death_color
  17583. Set the color of dead cells. If @option{mold} is set, this is the first color
  17584. used to represent a dead cell.
  17585. @item mold_color
  17586. Set mold color, for definitely dead and moldy cells.
  17587. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17588. ffmpeg-utils manual,ffmpeg-utils}.
  17589. @end table
  17590. @subsection Examples
  17591. @itemize
  17592. @item
  17593. Read a grid from @file{pattern}, and center it on a grid of size
  17594. 300x300 pixels:
  17595. @example
  17596. life=f=pattern:s=300x300
  17597. @end example
  17598. @item
  17599. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17600. @example
  17601. life=ratio=2/3:s=200x200
  17602. @end example
  17603. @item
  17604. Specify a custom rule for evolving a randomly generated grid:
  17605. @example
  17606. life=rule=S14/B34
  17607. @end example
  17608. @item
  17609. Full example with slow death effect (mold) using @command{ffplay}:
  17610. @example
  17611. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17612. @end example
  17613. @end itemize
  17614. @anchor{allrgb}
  17615. @anchor{allyuv}
  17616. @anchor{color}
  17617. @anchor{haldclutsrc}
  17618. @anchor{nullsrc}
  17619. @anchor{pal75bars}
  17620. @anchor{pal100bars}
  17621. @anchor{rgbtestsrc}
  17622. @anchor{smptebars}
  17623. @anchor{smptehdbars}
  17624. @anchor{testsrc}
  17625. @anchor{testsrc2}
  17626. @anchor{yuvtestsrc}
  17627. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17628. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17629. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17630. The @code{color} source provides an uniformly colored input.
  17631. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17632. @ref{haldclut} filter.
  17633. The @code{nullsrc} source returns unprocessed video frames. It is
  17634. mainly useful to be employed in analysis / debugging tools, or as the
  17635. source for filters which ignore the input data.
  17636. The @code{pal75bars} source generates a color bars pattern, based on
  17637. EBU PAL recommendations with 75% color levels.
  17638. The @code{pal100bars} source generates a color bars pattern, based on
  17639. EBU PAL recommendations with 100% color levels.
  17640. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17641. detecting RGB vs BGR issues. You should see a red, green and blue
  17642. stripe from top to bottom.
  17643. The @code{smptebars} source generates a color bars pattern, based on
  17644. the SMPTE Engineering Guideline EG 1-1990.
  17645. The @code{smptehdbars} source generates a color bars pattern, based on
  17646. the SMPTE RP 219-2002.
  17647. The @code{testsrc} source generates a test video pattern, showing a
  17648. color pattern, a scrolling gradient and a timestamp. This is mainly
  17649. intended for testing purposes.
  17650. The @code{testsrc2} source is similar to testsrc, but supports more
  17651. pixel formats instead of just @code{rgb24}. This allows using it as an
  17652. input for other tests without requiring a format conversion.
  17653. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17654. see a y, cb and cr stripe from top to bottom.
  17655. The sources accept the following parameters:
  17656. @table @option
  17657. @item level
  17658. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17659. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17660. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17661. coded on a @code{1/(N*N)} scale.
  17662. @item color, c
  17663. Specify the color of the source, only available in the @code{color}
  17664. source. For the syntax of this option, check the
  17665. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17666. @item size, s
  17667. Specify the size of the sourced video. For the syntax of this option, check the
  17668. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17669. The default value is @code{320x240}.
  17670. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17671. @code{haldclutsrc} filters.
  17672. @item rate, r
  17673. Specify the frame rate of the sourced video, as the number of frames
  17674. generated per second. It has to be a string in the format
  17675. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17676. number or a valid video frame rate abbreviation. The default value is
  17677. "25".
  17678. @item duration, d
  17679. Set the duration of the sourced video. See
  17680. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17681. for the accepted syntax.
  17682. If not specified, or the expressed duration is negative, the video is
  17683. supposed to be generated forever.
  17684. Since the frame rate is used as time base, all frames including the last one
  17685. will have their full duration. If the specified duration is not a multiple
  17686. of the frame duration, it will be rounded up.
  17687. @item sar
  17688. Set the sample aspect ratio of the sourced video.
  17689. @item alpha
  17690. Specify the alpha (opacity) of the background, only available in the
  17691. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17692. 255 (fully opaque, the default).
  17693. @item decimals, n
  17694. Set the number of decimals to show in the timestamp, only available in the
  17695. @code{testsrc} source.
  17696. The displayed timestamp value will correspond to the original
  17697. timestamp value multiplied by the power of 10 of the specified
  17698. value. Default value is 0.
  17699. @end table
  17700. @subsection Examples
  17701. @itemize
  17702. @item
  17703. Generate a video with a duration of 5.3 seconds, with size
  17704. 176x144 and a frame rate of 10 frames per second:
  17705. @example
  17706. testsrc=duration=5.3:size=qcif:rate=10
  17707. @end example
  17708. @item
  17709. The following graph description will generate a red source
  17710. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17711. frames per second:
  17712. @example
  17713. color=c=red@@0.2:s=qcif:r=10
  17714. @end example
  17715. @item
  17716. If the input content is to be ignored, @code{nullsrc} can be used. The
  17717. following command generates noise in the luminance plane by employing
  17718. the @code{geq} filter:
  17719. @example
  17720. nullsrc=s=256x256, geq=random(1)*255:128:128
  17721. @end example
  17722. @end itemize
  17723. @subsection Commands
  17724. The @code{color} source supports the following commands:
  17725. @table @option
  17726. @item c, color
  17727. Set the color of the created image. Accepts the same syntax of the
  17728. corresponding @option{color} option.
  17729. @end table
  17730. @section openclsrc
  17731. Generate video using an OpenCL program.
  17732. @table @option
  17733. @item source
  17734. OpenCL program source file.
  17735. @item kernel
  17736. Kernel name in program.
  17737. @item size, s
  17738. Size of frames to generate. This must be set.
  17739. @item format
  17740. Pixel format to use for the generated frames. This must be set.
  17741. @item rate, r
  17742. Number of frames generated every second. Default value is '25'.
  17743. @end table
  17744. For details of how the program loading works, see the @ref{program_opencl}
  17745. filter.
  17746. Example programs:
  17747. @itemize
  17748. @item
  17749. Generate a colour ramp by setting pixel values from the position of the pixel
  17750. in the output image. (Note that this will work with all pixel formats, but
  17751. the generated output will not be the same.)
  17752. @verbatim
  17753. __kernel void ramp(__write_only image2d_t dst,
  17754. unsigned int index)
  17755. {
  17756. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17757. float4 val;
  17758. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17759. write_imagef(dst, loc, val);
  17760. }
  17761. @end verbatim
  17762. @item
  17763. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17764. @verbatim
  17765. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17766. unsigned int index)
  17767. {
  17768. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17769. float4 value = 0.0f;
  17770. int x = loc.x + index;
  17771. int y = loc.y + index;
  17772. while (x > 0 || y > 0) {
  17773. if (x % 3 == 1 && y % 3 == 1) {
  17774. value = 1.0f;
  17775. break;
  17776. }
  17777. x /= 3;
  17778. y /= 3;
  17779. }
  17780. write_imagef(dst, loc, value);
  17781. }
  17782. @end verbatim
  17783. @end itemize
  17784. @section sierpinski
  17785. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17786. This source accepts the following options:
  17787. @table @option
  17788. @item size, s
  17789. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17790. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17791. @item rate, r
  17792. Set frame rate, expressed as number of frames per second. Default
  17793. value is "25".
  17794. @item seed
  17795. Set seed which is used for random panning.
  17796. @item jump
  17797. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17798. @item type
  17799. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17800. @end table
  17801. @c man end VIDEO SOURCES
  17802. @chapter Video Sinks
  17803. @c man begin VIDEO SINKS
  17804. Below is a description of the currently available video sinks.
  17805. @section buffersink
  17806. Buffer video frames, and make them available to the end of the filter
  17807. graph.
  17808. This sink is mainly intended for programmatic use, in particular
  17809. through the interface defined in @file{libavfilter/buffersink.h}
  17810. or the options system.
  17811. It accepts a pointer to an AVBufferSinkContext structure, which
  17812. defines the incoming buffers' formats, to be passed as the opaque
  17813. parameter to @code{avfilter_init_filter} for initialization.
  17814. @section nullsink
  17815. Null video sink: do absolutely nothing with the input video. It is
  17816. mainly useful as a template and for use in analysis / debugging
  17817. tools.
  17818. @c man end VIDEO SINKS
  17819. @chapter Multimedia Filters
  17820. @c man begin MULTIMEDIA FILTERS
  17821. Below is a description of the currently available multimedia filters.
  17822. @section abitscope
  17823. Convert input audio to a video output, displaying the audio bit scope.
  17824. The filter accepts the following options:
  17825. @table @option
  17826. @item rate, r
  17827. Set frame rate, expressed as number of frames per second. Default
  17828. value is "25".
  17829. @item size, s
  17830. Specify the video size for the output. For the syntax of this option, check the
  17831. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17832. Default value is @code{1024x256}.
  17833. @item colors
  17834. Specify list of colors separated by space or by '|' which will be used to
  17835. draw channels. Unrecognized or missing colors will be replaced
  17836. by white color.
  17837. @end table
  17838. @section adrawgraph
  17839. Draw a graph using input audio metadata.
  17840. See @ref{drawgraph}
  17841. @section agraphmonitor
  17842. See @ref{graphmonitor}.
  17843. @section ahistogram
  17844. Convert input audio to a video output, displaying the volume histogram.
  17845. The filter accepts the following options:
  17846. @table @option
  17847. @item dmode
  17848. Specify how histogram is calculated.
  17849. It accepts the following values:
  17850. @table @samp
  17851. @item single
  17852. Use single histogram for all channels.
  17853. @item separate
  17854. Use separate histogram for each channel.
  17855. @end table
  17856. Default is @code{single}.
  17857. @item rate, r
  17858. Set frame rate, expressed as number of frames per second. Default
  17859. value is "25".
  17860. @item size, s
  17861. Specify the video size for the output. For the syntax of this option, check the
  17862. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17863. Default value is @code{hd720}.
  17864. @item scale
  17865. Set display scale.
  17866. It accepts the following values:
  17867. @table @samp
  17868. @item log
  17869. logarithmic
  17870. @item sqrt
  17871. square root
  17872. @item cbrt
  17873. cubic root
  17874. @item lin
  17875. linear
  17876. @item rlog
  17877. reverse logarithmic
  17878. @end table
  17879. Default is @code{log}.
  17880. @item ascale
  17881. Set amplitude scale.
  17882. It accepts the following values:
  17883. @table @samp
  17884. @item log
  17885. logarithmic
  17886. @item lin
  17887. linear
  17888. @end table
  17889. Default is @code{log}.
  17890. @item acount
  17891. Set how much frames to accumulate in histogram.
  17892. Default is 1. Setting this to -1 accumulates all frames.
  17893. @item rheight
  17894. Set histogram ratio of window height.
  17895. @item slide
  17896. Set sonogram sliding.
  17897. It accepts the following values:
  17898. @table @samp
  17899. @item replace
  17900. replace old rows with new ones.
  17901. @item scroll
  17902. scroll from top to bottom.
  17903. @end table
  17904. Default is @code{replace}.
  17905. @end table
  17906. @section aphasemeter
  17907. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17908. representing mean phase of current audio frame. A video output can also be produced and is
  17909. enabled by default. The audio is passed through as first output.
  17910. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17911. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17912. and @code{1} means channels are in phase.
  17913. The filter accepts the following options, all related to its video output:
  17914. @table @option
  17915. @item rate, r
  17916. Set the output frame rate. Default value is @code{25}.
  17917. @item size, s
  17918. Set the video size for the output. For the syntax of this option, check the
  17919. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17920. Default value is @code{800x400}.
  17921. @item rc
  17922. @item gc
  17923. @item bc
  17924. Specify the red, green, blue contrast. Default values are @code{2},
  17925. @code{7} and @code{1}.
  17926. Allowed range is @code{[0, 255]}.
  17927. @item mpc
  17928. Set color which will be used for drawing median phase. If color is
  17929. @code{none} which is default, no median phase value will be drawn.
  17930. @item video
  17931. Enable video output. Default is enabled.
  17932. @end table
  17933. @subsection phasing detection
  17934. The filter also detects out of phase and mono sequences in stereo streams.
  17935. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17936. The filter accepts the following options for this detection:
  17937. @table @option
  17938. @item phasing
  17939. Enable mono and out of phase detection. Default is disabled.
  17940. @item tolerance, t
  17941. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17942. Allowed range is @code{[0, 1]}.
  17943. @item angle, a
  17944. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17945. Allowed range is @code{[90, 180]}.
  17946. @item duration, d
  17947. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17948. @end table
  17949. @subsection Examples
  17950. @itemize
  17951. @item
  17952. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17953. @example
  17954. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17955. @end example
  17956. @end itemize
  17957. @section avectorscope
  17958. Convert input audio to a video output, representing the audio vector
  17959. scope.
  17960. The filter is used to measure the difference between channels of stereo
  17961. audio stream. A monaural signal, consisting of identical left and right
  17962. signal, results in straight vertical line. Any stereo separation is visible
  17963. as a deviation from this line, creating a Lissajous figure.
  17964. If the straight (or deviation from it) but horizontal line appears this
  17965. indicates that the left and right channels are out of phase.
  17966. The filter accepts the following options:
  17967. @table @option
  17968. @item mode, m
  17969. Set the vectorscope mode.
  17970. Available values are:
  17971. @table @samp
  17972. @item lissajous
  17973. Lissajous rotated by 45 degrees.
  17974. @item lissajous_xy
  17975. Same as above but not rotated.
  17976. @item polar
  17977. Shape resembling half of circle.
  17978. @end table
  17979. Default value is @samp{lissajous}.
  17980. @item size, s
  17981. Set the video size for the output. For the syntax of this option, check the
  17982. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17983. Default value is @code{400x400}.
  17984. @item rate, r
  17985. Set the output frame rate. Default value is @code{25}.
  17986. @item rc
  17987. @item gc
  17988. @item bc
  17989. @item ac
  17990. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17991. @code{160}, @code{80} and @code{255}.
  17992. Allowed range is @code{[0, 255]}.
  17993. @item rf
  17994. @item gf
  17995. @item bf
  17996. @item af
  17997. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17998. @code{10}, @code{5} and @code{5}.
  17999. Allowed range is @code{[0, 255]}.
  18000. @item zoom
  18001. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18002. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18003. @item draw
  18004. Set the vectorscope drawing mode.
  18005. Available values are:
  18006. @table @samp
  18007. @item dot
  18008. Draw dot for each sample.
  18009. @item line
  18010. Draw line between previous and current sample.
  18011. @end table
  18012. Default value is @samp{dot}.
  18013. @item scale
  18014. Specify amplitude scale of audio samples.
  18015. Available values are:
  18016. @table @samp
  18017. @item lin
  18018. Linear.
  18019. @item sqrt
  18020. Square root.
  18021. @item cbrt
  18022. Cubic root.
  18023. @item log
  18024. Logarithmic.
  18025. @end table
  18026. @item swap
  18027. Swap left channel axis with right channel axis.
  18028. @item mirror
  18029. Mirror axis.
  18030. @table @samp
  18031. @item none
  18032. No mirror.
  18033. @item x
  18034. Mirror only x axis.
  18035. @item y
  18036. Mirror only y axis.
  18037. @item xy
  18038. Mirror both axis.
  18039. @end table
  18040. @end table
  18041. @subsection Examples
  18042. @itemize
  18043. @item
  18044. Complete example using @command{ffplay}:
  18045. @example
  18046. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18047. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18048. @end example
  18049. @end itemize
  18050. @section bench, abench
  18051. Benchmark part of a filtergraph.
  18052. The filter accepts the following options:
  18053. @table @option
  18054. @item action
  18055. Start or stop a timer.
  18056. Available values are:
  18057. @table @samp
  18058. @item start
  18059. Get the current time, set it as frame metadata (using the key
  18060. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18061. @item stop
  18062. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18063. the input frame metadata to get the time difference. Time difference, average,
  18064. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18065. @code{min}) are then printed. The timestamps are expressed in seconds.
  18066. @end table
  18067. @end table
  18068. @subsection Examples
  18069. @itemize
  18070. @item
  18071. Benchmark @ref{selectivecolor} filter:
  18072. @example
  18073. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18074. @end example
  18075. @end itemize
  18076. @section concat
  18077. Concatenate audio and video streams, joining them together one after the
  18078. other.
  18079. The filter works on segments of synchronized video and audio streams. All
  18080. segments must have the same number of streams of each type, and that will
  18081. also be the number of streams at output.
  18082. The filter accepts the following options:
  18083. @table @option
  18084. @item n
  18085. Set the number of segments. Default is 2.
  18086. @item v
  18087. Set the number of output video streams, that is also the number of video
  18088. streams in each segment. Default is 1.
  18089. @item a
  18090. Set the number of output audio streams, that is also the number of audio
  18091. streams in each segment. Default is 0.
  18092. @item unsafe
  18093. Activate unsafe mode: do not fail if segments have a different format.
  18094. @end table
  18095. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18096. @var{a} audio outputs.
  18097. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18098. segment, in the same order as the outputs, then the inputs for the second
  18099. segment, etc.
  18100. Related streams do not always have exactly the same duration, for various
  18101. reasons including codec frame size or sloppy authoring. For that reason,
  18102. related synchronized streams (e.g. a video and its audio track) should be
  18103. concatenated at once. The concat filter will use the duration of the longest
  18104. stream in each segment (except the last one), and if necessary pad shorter
  18105. audio streams with silence.
  18106. For this filter to work correctly, all segments must start at timestamp 0.
  18107. All corresponding streams must have the same parameters in all segments; the
  18108. filtering system will automatically select a common pixel format for video
  18109. streams, and a common sample format, sample rate and channel layout for
  18110. audio streams, but other settings, such as resolution, must be converted
  18111. explicitly by the user.
  18112. Different frame rates are acceptable but will result in variable frame rate
  18113. at output; be sure to configure the output file to handle it.
  18114. @subsection Examples
  18115. @itemize
  18116. @item
  18117. Concatenate an opening, an episode and an ending, all in bilingual version
  18118. (video in stream 0, audio in streams 1 and 2):
  18119. @example
  18120. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18121. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18122. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18123. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18124. @end example
  18125. @item
  18126. Concatenate two parts, handling audio and video separately, using the
  18127. (a)movie sources, and adjusting the resolution:
  18128. @example
  18129. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18130. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18131. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18132. @end example
  18133. Note that a desync will happen at the stitch if the audio and video streams
  18134. do not have exactly the same duration in the first file.
  18135. @end itemize
  18136. @subsection Commands
  18137. This filter supports the following commands:
  18138. @table @option
  18139. @item next
  18140. Close the current segment and step to the next one
  18141. @end table
  18142. @anchor{ebur128}
  18143. @section ebur128
  18144. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18145. level. By default, it logs a message at a frequency of 10Hz with the
  18146. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18147. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18148. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18149. sample format is double-precision floating point. The input stream will be converted to
  18150. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18151. after this filter to obtain the original parameters.
  18152. The filter also has a video output (see the @var{video} option) with a real
  18153. time graph to observe the loudness evolution. The graphic contains the logged
  18154. message mentioned above, so it is not printed anymore when this option is set,
  18155. unless the verbose logging is set. The main graphing area contains the
  18156. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18157. the momentary loudness (400 milliseconds), but can optionally be configured
  18158. to instead display short-term loudness (see @var{gauge}).
  18159. The green area marks a +/- 1LU target range around the target loudness
  18160. (-23LUFS by default, unless modified through @var{target}).
  18161. More information about the Loudness Recommendation EBU R128 on
  18162. @url{http://tech.ebu.ch/loudness}.
  18163. The filter accepts the following options:
  18164. @table @option
  18165. @item video
  18166. Activate the video output. The audio stream is passed unchanged whether this
  18167. option is set or no. The video stream will be the first output stream if
  18168. activated. Default is @code{0}.
  18169. @item size
  18170. Set the video size. This option is for video only. For the syntax of this
  18171. option, check the
  18172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18173. Default and minimum resolution is @code{640x480}.
  18174. @item meter
  18175. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18176. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18177. other integer value between this range is allowed.
  18178. @item metadata
  18179. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18180. into 100ms output frames, each of them containing various loudness information
  18181. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18182. Default is @code{0}.
  18183. @item framelog
  18184. Force the frame logging level.
  18185. Available values are:
  18186. @table @samp
  18187. @item info
  18188. information logging level
  18189. @item verbose
  18190. verbose logging level
  18191. @end table
  18192. By default, the logging level is set to @var{info}. If the @option{video} or
  18193. the @option{metadata} options are set, it switches to @var{verbose}.
  18194. @item peak
  18195. Set peak mode(s).
  18196. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18197. values are:
  18198. @table @samp
  18199. @item none
  18200. Disable any peak mode (default).
  18201. @item sample
  18202. Enable sample-peak mode.
  18203. Simple peak mode looking for the higher sample value. It logs a message
  18204. for sample-peak (identified by @code{SPK}).
  18205. @item true
  18206. Enable true-peak mode.
  18207. If enabled, the peak lookup is done on an over-sampled version of the input
  18208. stream for better peak accuracy. It logs a message for true-peak.
  18209. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18210. This mode requires a build with @code{libswresample}.
  18211. @end table
  18212. @item dualmono
  18213. Treat mono input files as "dual mono". If a mono file is intended for playback
  18214. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18215. If set to @code{true}, this option will compensate for this effect.
  18216. Multi-channel input files are not affected by this option.
  18217. @item panlaw
  18218. Set a specific pan law to be used for the measurement of dual mono files.
  18219. This parameter is optional, and has a default value of -3.01dB.
  18220. @item target
  18221. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18222. This parameter is optional and has a default value of -23LUFS as specified
  18223. by EBU R128. However, material published online may prefer a level of -16LUFS
  18224. (e.g. for use with podcasts or video platforms).
  18225. @item gauge
  18226. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18227. @code{shortterm}. By default the momentary value will be used, but in certain
  18228. scenarios it may be more useful to observe the short term value instead (e.g.
  18229. live mixing).
  18230. @item scale
  18231. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18232. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18233. video output, not the summary or continuous log output.
  18234. @end table
  18235. @subsection Examples
  18236. @itemize
  18237. @item
  18238. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18239. @example
  18240. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18241. @end example
  18242. @item
  18243. Run an analysis with @command{ffmpeg}:
  18244. @example
  18245. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18246. @end example
  18247. @end itemize
  18248. @section interleave, ainterleave
  18249. Temporally interleave frames from several inputs.
  18250. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18251. These filters read frames from several inputs and send the oldest
  18252. queued frame to the output.
  18253. Input streams must have well defined, monotonically increasing frame
  18254. timestamp values.
  18255. In order to submit one frame to output, these filters need to enqueue
  18256. at least one frame for each input, so they cannot work in case one
  18257. input is not yet terminated and will not receive incoming frames.
  18258. For example consider the case when one input is a @code{select} filter
  18259. which always drops input frames. The @code{interleave} filter will keep
  18260. reading from that input, but it will never be able to send new frames
  18261. to output until the input sends an end-of-stream signal.
  18262. Also, depending on inputs synchronization, the filters will drop
  18263. frames in case one input receives more frames than the other ones, and
  18264. the queue is already filled.
  18265. These filters accept the following options:
  18266. @table @option
  18267. @item nb_inputs, n
  18268. Set the number of different inputs, it is 2 by default.
  18269. @item duration
  18270. How to determine the end-of-stream.
  18271. @table @option
  18272. @item longest
  18273. The duration of the longest input. (default)
  18274. @item shortest
  18275. The duration of the shortest input.
  18276. @item first
  18277. The duration of the first input.
  18278. @end table
  18279. @end table
  18280. @subsection Examples
  18281. @itemize
  18282. @item
  18283. Interleave frames belonging to different streams using @command{ffmpeg}:
  18284. @example
  18285. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18286. @end example
  18287. @item
  18288. Add flickering blur effect:
  18289. @example
  18290. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18291. @end example
  18292. @end itemize
  18293. @section metadata, ametadata
  18294. Manipulate frame metadata.
  18295. This filter accepts the following options:
  18296. @table @option
  18297. @item mode
  18298. Set mode of operation of the filter.
  18299. Can be one of the following:
  18300. @table @samp
  18301. @item select
  18302. If both @code{value} and @code{key} is set, select frames
  18303. which have such metadata. If only @code{key} is set, select
  18304. every frame that has such key in metadata.
  18305. @item add
  18306. Add new metadata @code{key} and @code{value}. If key is already available
  18307. do nothing.
  18308. @item modify
  18309. Modify value of already present key.
  18310. @item delete
  18311. If @code{value} is set, delete only keys that have such value.
  18312. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18313. the frame.
  18314. @item print
  18315. Print key and its value if metadata was found. If @code{key} is not set print all
  18316. metadata values available in frame.
  18317. @end table
  18318. @item key
  18319. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18320. @item value
  18321. Set metadata value which will be used. This option is mandatory for
  18322. @code{modify} and @code{add} mode.
  18323. @item function
  18324. Which function to use when comparing metadata value and @code{value}.
  18325. Can be one of following:
  18326. @table @samp
  18327. @item same_str
  18328. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18329. @item starts_with
  18330. Values are interpreted as strings, returns true if metadata value starts with
  18331. the @code{value} option string.
  18332. @item less
  18333. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18334. @item equal
  18335. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18336. @item greater
  18337. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18338. @item expr
  18339. Values are interpreted as floats, returns true if expression from option @code{expr}
  18340. evaluates to true.
  18341. @item ends_with
  18342. Values are interpreted as strings, returns true if metadata value ends with
  18343. the @code{value} option string.
  18344. @end table
  18345. @item expr
  18346. Set expression which is used when @code{function} is set to @code{expr}.
  18347. The expression is evaluated through the eval API and can contain the following
  18348. constants:
  18349. @table @option
  18350. @item VALUE1
  18351. Float representation of @code{value} from metadata key.
  18352. @item VALUE2
  18353. Float representation of @code{value} as supplied by user in @code{value} option.
  18354. @end table
  18355. @item file
  18356. If specified in @code{print} mode, output is written to the named file. Instead of
  18357. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18358. for standard output. If @code{file} option is not set, output is written to the log
  18359. with AV_LOG_INFO loglevel.
  18360. @item direct
  18361. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18362. @end table
  18363. @subsection Examples
  18364. @itemize
  18365. @item
  18366. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18367. between 0 and 1.
  18368. @example
  18369. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18370. @end example
  18371. @item
  18372. Print silencedetect output to file @file{metadata.txt}.
  18373. @example
  18374. silencedetect,ametadata=mode=print:file=metadata.txt
  18375. @end example
  18376. @item
  18377. Direct all metadata to a pipe with file descriptor 4.
  18378. @example
  18379. metadata=mode=print:file='pipe\:4'
  18380. @end example
  18381. @end itemize
  18382. @section perms, aperms
  18383. Set read/write permissions for the output frames.
  18384. These filters are mainly aimed at developers to test direct path in the
  18385. following filter in the filtergraph.
  18386. The filters accept the following options:
  18387. @table @option
  18388. @item mode
  18389. Select the permissions mode.
  18390. It accepts the following values:
  18391. @table @samp
  18392. @item none
  18393. Do nothing. This is the default.
  18394. @item ro
  18395. Set all the output frames read-only.
  18396. @item rw
  18397. Set all the output frames directly writable.
  18398. @item toggle
  18399. Make the frame read-only if writable, and writable if read-only.
  18400. @item random
  18401. Set each output frame read-only or writable randomly.
  18402. @end table
  18403. @item seed
  18404. Set the seed for the @var{random} mode, must be an integer included between
  18405. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18406. @code{-1}, the filter will try to use a good random seed on a best effort
  18407. basis.
  18408. @end table
  18409. Note: in case of auto-inserted filter between the permission filter and the
  18410. following one, the permission might not be received as expected in that
  18411. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18412. perms/aperms filter can avoid this problem.
  18413. @section realtime, arealtime
  18414. Slow down filtering to match real time approximately.
  18415. These filters will pause the filtering for a variable amount of time to
  18416. match the output rate with the input timestamps.
  18417. They are similar to the @option{re} option to @code{ffmpeg}.
  18418. They accept the following options:
  18419. @table @option
  18420. @item limit
  18421. Time limit for the pauses. Any pause longer than that will be considered
  18422. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18423. @item speed
  18424. Speed factor for processing. The value must be a float larger than zero.
  18425. Values larger than 1.0 will result in faster than realtime processing,
  18426. smaller will slow processing down. The @var{limit} is automatically adapted
  18427. accordingly. Default is 1.0.
  18428. A processing speed faster than what is possible without these filters cannot
  18429. be achieved.
  18430. @end table
  18431. @anchor{select}
  18432. @section select, aselect
  18433. Select frames to pass in output.
  18434. This filter accepts the following options:
  18435. @table @option
  18436. @item expr, e
  18437. Set expression, which is evaluated for each input frame.
  18438. If the expression is evaluated to zero, the frame is discarded.
  18439. If the evaluation result is negative or NaN, the frame is sent to the
  18440. first output; otherwise it is sent to the output with index
  18441. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18442. For example a value of @code{1.2} corresponds to the output with index
  18443. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18444. @item outputs, n
  18445. Set the number of outputs. The output to which to send the selected
  18446. frame is based on the result of the evaluation. Default value is 1.
  18447. @end table
  18448. The expression can contain the following constants:
  18449. @table @option
  18450. @item n
  18451. The (sequential) number of the filtered frame, starting from 0.
  18452. @item selected_n
  18453. The (sequential) number of the selected frame, starting from 0.
  18454. @item prev_selected_n
  18455. The sequential number of the last selected frame. It's NAN if undefined.
  18456. @item TB
  18457. The timebase of the input timestamps.
  18458. @item pts
  18459. The PTS (Presentation TimeStamp) of the filtered video frame,
  18460. expressed in @var{TB} units. It's NAN if undefined.
  18461. @item t
  18462. The PTS of the filtered video frame,
  18463. expressed in seconds. It's NAN if undefined.
  18464. @item prev_pts
  18465. The PTS of the previously filtered video frame. It's NAN if undefined.
  18466. @item prev_selected_pts
  18467. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18468. @item prev_selected_t
  18469. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18470. @item start_pts
  18471. The PTS of the first video frame in the video. It's NAN if undefined.
  18472. @item start_t
  18473. The time of the first video frame in the video. It's NAN if undefined.
  18474. @item pict_type @emph{(video only)}
  18475. The type of the filtered frame. It can assume one of the following
  18476. values:
  18477. @table @option
  18478. @item I
  18479. @item P
  18480. @item B
  18481. @item S
  18482. @item SI
  18483. @item SP
  18484. @item BI
  18485. @end table
  18486. @item interlace_type @emph{(video only)}
  18487. The frame interlace type. It can assume one of the following values:
  18488. @table @option
  18489. @item PROGRESSIVE
  18490. The frame is progressive (not interlaced).
  18491. @item TOPFIRST
  18492. The frame is top-field-first.
  18493. @item BOTTOMFIRST
  18494. The frame is bottom-field-first.
  18495. @end table
  18496. @item consumed_sample_n @emph{(audio only)}
  18497. the number of selected samples before the current frame
  18498. @item samples_n @emph{(audio only)}
  18499. the number of samples in the current frame
  18500. @item sample_rate @emph{(audio only)}
  18501. the input sample rate
  18502. @item key
  18503. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18504. @item pos
  18505. the position in the file of the filtered frame, -1 if the information
  18506. is not available (e.g. for synthetic video)
  18507. @item scene @emph{(video only)}
  18508. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18509. probability for the current frame to introduce a new scene, while a higher
  18510. value means the current frame is more likely to be one (see the example below)
  18511. @item concatdec_select
  18512. The concat demuxer can select only part of a concat input file by setting an
  18513. inpoint and an outpoint, but the output packets may not be entirely contained
  18514. in the selected interval. By using this variable, it is possible to skip frames
  18515. generated by the concat demuxer which are not exactly contained in the selected
  18516. interval.
  18517. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18518. and the @var{lavf.concat.duration} packet metadata values which are also
  18519. present in the decoded frames.
  18520. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18521. start_time and either the duration metadata is missing or the frame pts is less
  18522. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18523. missing.
  18524. That basically means that an input frame is selected if its pts is within the
  18525. interval set by the concat demuxer.
  18526. @end table
  18527. The default value of the select expression is "1".
  18528. @subsection Examples
  18529. @itemize
  18530. @item
  18531. Select all frames in input:
  18532. @example
  18533. select
  18534. @end example
  18535. The example above is the same as:
  18536. @example
  18537. select=1
  18538. @end example
  18539. @item
  18540. Skip all frames:
  18541. @example
  18542. select=0
  18543. @end example
  18544. @item
  18545. Select only I-frames:
  18546. @example
  18547. select='eq(pict_type\,I)'
  18548. @end example
  18549. @item
  18550. Select one frame every 100:
  18551. @example
  18552. select='not(mod(n\,100))'
  18553. @end example
  18554. @item
  18555. Select only frames contained in the 10-20 time interval:
  18556. @example
  18557. select=between(t\,10\,20)
  18558. @end example
  18559. @item
  18560. Select only I-frames contained in the 10-20 time interval:
  18561. @example
  18562. select=between(t\,10\,20)*eq(pict_type\,I)
  18563. @end example
  18564. @item
  18565. Select frames with a minimum distance of 10 seconds:
  18566. @example
  18567. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18568. @end example
  18569. @item
  18570. Use aselect to select only audio frames with samples number > 100:
  18571. @example
  18572. aselect='gt(samples_n\,100)'
  18573. @end example
  18574. @item
  18575. Create a mosaic of the first scenes:
  18576. @example
  18577. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18578. @end example
  18579. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18580. choice.
  18581. @item
  18582. Send even and odd frames to separate outputs, and compose them:
  18583. @example
  18584. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18585. @end example
  18586. @item
  18587. Select useful frames from an ffconcat file which is using inpoints and
  18588. outpoints but where the source files are not intra frame only.
  18589. @example
  18590. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18591. @end example
  18592. @end itemize
  18593. @section sendcmd, asendcmd
  18594. Send commands to filters in the filtergraph.
  18595. These filters read commands to be sent to other filters in the
  18596. filtergraph.
  18597. @code{sendcmd} must be inserted between two video filters,
  18598. @code{asendcmd} must be inserted between two audio filters, but apart
  18599. from that they act the same way.
  18600. The specification of commands can be provided in the filter arguments
  18601. with the @var{commands} option, or in a file specified by the
  18602. @var{filename} option.
  18603. These filters accept the following options:
  18604. @table @option
  18605. @item commands, c
  18606. Set the commands to be read and sent to the other filters.
  18607. @item filename, f
  18608. Set the filename of the commands to be read and sent to the other
  18609. filters.
  18610. @end table
  18611. @subsection Commands syntax
  18612. A commands description consists of a sequence of interval
  18613. specifications, comprising a list of commands to be executed when a
  18614. particular event related to that interval occurs. The occurring event
  18615. is typically the current frame time entering or leaving a given time
  18616. interval.
  18617. An interval is specified by the following syntax:
  18618. @example
  18619. @var{START}[-@var{END}] @var{COMMANDS};
  18620. @end example
  18621. The time interval is specified by the @var{START} and @var{END} times.
  18622. @var{END} is optional and defaults to the maximum time.
  18623. The current frame time is considered within the specified interval if
  18624. it is included in the interval [@var{START}, @var{END}), that is when
  18625. the time is greater or equal to @var{START} and is lesser than
  18626. @var{END}.
  18627. @var{COMMANDS} consists of a sequence of one or more command
  18628. specifications, separated by ",", relating to that interval. The
  18629. syntax of a command specification is given by:
  18630. @example
  18631. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18632. @end example
  18633. @var{FLAGS} is optional and specifies the type of events relating to
  18634. the time interval which enable sending the specified command, and must
  18635. be a non-null sequence of identifier flags separated by "+" or "|" and
  18636. enclosed between "[" and "]".
  18637. The following flags are recognized:
  18638. @table @option
  18639. @item enter
  18640. The command is sent when the current frame timestamp enters the
  18641. specified interval. In other words, the command is sent when the
  18642. previous frame timestamp was not in the given interval, and the
  18643. current is.
  18644. @item leave
  18645. The command is sent when the current frame timestamp leaves the
  18646. specified interval. In other words, the command is sent when the
  18647. previous frame timestamp was in the given interval, and the
  18648. current is not.
  18649. @item expr
  18650. The command @var{ARG} is interpreted as expression and result of
  18651. expression is passed as @var{ARG}.
  18652. The expression is evaluated through the eval API and can contain the following
  18653. constants:
  18654. @table @option
  18655. @item POS
  18656. Original position in the file of the frame, or undefined if undefined
  18657. for the current frame.
  18658. @item PTS
  18659. The presentation timestamp in input.
  18660. @item N
  18661. The count of the input frame for video or audio, starting from 0.
  18662. @item T
  18663. The time in seconds of the current frame.
  18664. @item TS
  18665. The start time in seconds of the current command interval.
  18666. @item TE
  18667. The end time in seconds of the current command interval.
  18668. @item TI
  18669. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18670. @end table
  18671. @end table
  18672. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18673. assumed.
  18674. @var{TARGET} specifies the target of the command, usually the name of
  18675. the filter class or a specific filter instance name.
  18676. @var{COMMAND} specifies the name of the command for the target filter.
  18677. @var{ARG} is optional and specifies the optional list of argument for
  18678. the given @var{COMMAND}.
  18679. Between one interval specification and another, whitespaces, or
  18680. sequences of characters starting with @code{#} until the end of line,
  18681. are ignored and can be used to annotate comments.
  18682. A simplified BNF description of the commands specification syntax
  18683. follows:
  18684. @example
  18685. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18686. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18687. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18688. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18689. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18690. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18691. @end example
  18692. @subsection Examples
  18693. @itemize
  18694. @item
  18695. Specify audio tempo change at second 4:
  18696. @example
  18697. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18698. @end example
  18699. @item
  18700. Target a specific filter instance:
  18701. @example
  18702. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18703. @end example
  18704. @item
  18705. Specify a list of drawtext and hue commands in a file.
  18706. @example
  18707. # show text in the interval 5-10
  18708. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18709. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18710. # desaturate the image in the interval 15-20
  18711. 15.0-20.0 [enter] hue s 0,
  18712. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18713. [leave] hue s 1,
  18714. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18715. # apply an exponential saturation fade-out effect, starting from time 25
  18716. 25 [enter] hue s exp(25-t)
  18717. @end example
  18718. A filtergraph allowing to read and process the above command list
  18719. stored in a file @file{test.cmd}, can be specified with:
  18720. @example
  18721. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18722. @end example
  18723. @end itemize
  18724. @anchor{setpts}
  18725. @section setpts, asetpts
  18726. Change the PTS (presentation timestamp) of the input frames.
  18727. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18728. This filter accepts the following options:
  18729. @table @option
  18730. @item expr
  18731. The expression which is evaluated for each frame to construct its timestamp.
  18732. @end table
  18733. The expression is evaluated through the eval API and can contain the following
  18734. constants:
  18735. @table @option
  18736. @item FRAME_RATE, FR
  18737. frame rate, only defined for constant frame-rate video
  18738. @item PTS
  18739. The presentation timestamp in input
  18740. @item N
  18741. The count of the input frame for video or the number of consumed samples,
  18742. not including the current frame for audio, starting from 0.
  18743. @item NB_CONSUMED_SAMPLES
  18744. The number of consumed samples, not including the current frame (only
  18745. audio)
  18746. @item NB_SAMPLES, S
  18747. The number of samples in the current frame (only audio)
  18748. @item SAMPLE_RATE, SR
  18749. The audio sample rate.
  18750. @item STARTPTS
  18751. The PTS of the first frame.
  18752. @item STARTT
  18753. the time in seconds of the first frame
  18754. @item INTERLACED
  18755. State whether the current frame is interlaced.
  18756. @item T
  18757. the time in seconds of the current frame
  18758. @item POS
  18759. original position in the file of the frame, or undefined if undefined
  18760. for the current frame
  18761. @item PREV_INPTS
  18762. The previous input PTS.
  18763. @item PREV_INT
  18764. previous input time in seconds
  18765. @item PREV_OUTPTS
  18766. The previous output PTS.
  18767. @item PREV_OUTT
  18768. previous output time in seconds
  18769. @item RTCTIME
  18770. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18771. instead.
  18772. @item RTCSTART
  18773. The wallclock (RTC) time at the start of the movie in microseconds.
  18774. @item TB
  18775. The timebase of the input timestamps.
  18776. @end table
  18777. @subsection Examples
  18778. @itemize
  18779. @item
  18780. Start counting PTS from zero
  18781. @example
  18782. setpts=PTS-STARTPTS
  18783. @end example
  18784. @item
  18785. Apply fast motion effect:
  18786. @example
  18787. setpts=0.5*PTS
  18788. @end example
  18789. @item
  18790. Apply slow motion effect:
  18791. @example
  18792. setpts=2.0*PTS
  18793. @end example
  18794. @item
  18795. Set fixed rate of 25 frames per second:
  18796. @example
  18797. setpts=N/(25*TB)
  18798. @end example
  18799. @item
  18800. Set fixed rate 25 fps with some jitter:
  18801. @example
  18802. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18803. @end example
  18804. @item
  18805. Apply an offset of 10 seconds to the input PTS:
  18806. @example
  18807. setpts=PTS+10/TB
  18808. @end example
  18809. @item
  18810. Generate timestamps from a "live source" and rebase onto the current timebase:
  18811. @example
  18812. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18813. @end example
  18814. @item
  18815. Generate timestamps by counting samples:
  18816. @example
  18817. asetpts=N/SR/TB
  18818. @end example
  18819. @end itemize
  18820. @section setrange
  18821. Force color range for the output video frame.
  18822. The @code{setrange} filter marks the color range property for the
  18823. output frames. It does not change the input frame, but only sets the
  18824. corresponding property, which affects how the frame is treated by
  18825. following filters.
  18826. The filter accepts the following options:
  18827. @table @option
  18828. @item range
  18829. Available values are:
  18830. @table @samp
  18831. @item auto
  18832. Keep the same color range property.
  18833. @item unspecified, unknown
  18834. Set the color range as unspecified.
  18835. @item limited, tv, mpeg
  18836. Set the color range as limited.
  18837. @item full, pc, jpeg
  18838. Set the color range as full.
  18839. @end table
  18840. @end table
  18841. @section settb, asettb
  18842. Set the timebase to use for the output frames timestamps.
  18843. It is mainly useful for testing timebase configuration.
  18844. It accepts the following parameters:
  18845. @table @option
  18846. @item expr, tb
  18847. The expression which is evaluated into the output timebase.
  18848. @end table
  18849. The value for @option{tb} is an arithmetic expression representing a
  18850. rational. The expression can contain the constants "AVTB" (the default
  18851. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18852. audio only). Default value is "intb".
  18853. @subsection Examples
  18854. @itemize
  18855. @item
  18856. Set the timebase to 1/25:
  18857. @example
  18858. settb=expr=1/25
  18859. @end example
  18860. @item
  18861. Set the timebase to 1/10:
  18862. @example
  18863. settb=expr=0.1
  18864. @end example
  18865. @item
  18866. Set the timebase to 1001/1000:
  18867. @example
  18868. settb=1+0.001
  18869. @end example
  18870. @item
  18871. Set the timebase to 2*intb:
  18872. @example
  18873. settb=2*intb
  18874. @end example
  18875. @item
  18876. Set the default timebase value:
  18877. @example
  18878. settb=AVTB
  18879. @end example
  18880. @end itemize
  18881. @section showcqt
  18882. Convert input audio to a video output representing frequency spectrum
  18883. logarithmically using Brown-Puckette constant Q transform algorithm with
  18884. direct frequency domain coefficient calculation (but the transform itself
  18885. is not really constant Q, instead the Q factor is actually variable/clamped),
  18886. with musical tone scale, from E0 to D#10.
  18887. The filter accepts the following options:
  18888. @table @option
  18889. @item size, s
  18890. Specify the video size for the output. It must be even. For the syntax of this option,
  18891. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18892. Default value is @code{1920x1080}.
  18893. @item fps, rate, r
  18894. Set the output frame rate. Default value is @code{25}.
  18895. @item bar_h
  18896. Set the bargraph height. It must be even. Default value is @code{-1} which
  18897. computes the bargraph height automatically.
  18898. @item axis_h
  18899. Set the axis height. It must be even. Default value is @code{-1} which computes
  18900. the axis height automatically.
  18901. @item sono_h
  18902. Set the sonogram height. It must be even. Default value is @code{-1} which
  18903. computes the sonogram height automatically.
  18904. @item fullhd
  18905. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18906. instead. Default value is @code{1}.
  18907. @item sono_v, volume
  18908. Specify the sonogram volume expression. It can contain variables:
  18909. @table @option
  18910. @item bar_v
  18911. the @var{bar_v} evaluated expression
  18912. @item frequency, freq, f
  18913. the frequency where it is evaluated
  18914. @item timeclamp, tc
  18915. the value of @var{timeclamp} option
  18916. @end table
  18917. and functions:
  18918. @table @option
  18919. @item a_weighting(f)
  18920. A-weighting of equal loudness
  18921. @item b_weighting(f)
  18922. B-weighting of equal loudness
  18923. @item c_weighting(f)
  18924. C-weighting of equal loudness.
  18925. @end table
  18926. Default value is @code{16}.
  18927. @item bar_v, volume2
  18928. Specify the bargraph volume expression. It can contain variables:
  18929. @table @option
  18930. @item sono_v
  18931. the @var{sono_v} evaluated expression
  18932. @item frequency, freq, f
  18933. the frequency where it is evaluated
  18934. @item timeclamp, tc
  18935. the value of @var{timeclamp} option
  18936. @end table
  18937. and functions:
  18938. @table @option
  18939. @item a_weighting(f)
  18940. A-weighting of equal loudness
  18941. @item b_weighting(f)
  18942. B-weighting of equal loudness
  18943. @item c_weighting(f)
  18944. C-weighting of equal loudness.
  18945. @end table
  18946. Default value is @code{sono_v}.
  18947. @item sono_g, gamma
  18948. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18949. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18950. Acceptable range is @code{[1, 7]}.
  18951. @item bar_g, gamma2
  18952. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18953. @code{[1, 7]}.
  18954. @item bar_t
  18955. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18956. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18957. @item timeclamp, tc
  18958. Specify the transform timeclamp. At low frequency, there is trade-off between
  18959. accuracy in time domain and frequency domain. If timeclamp is lower,
  18960. event in time domain is represented more accurately (such as fast bass drum),
  18961. otherwise event in frequency domain is represented more accurately
  18962. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18963. @item attack
  18964. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18965. limits future samples by applying asymmetric windowing in time domain, useful
  18966. when low latency is required. Accepted range is @code{[0, 1]}.
  18967. @item basefreq
  18968. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18969. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18970. @item endfreq
  18971. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18972. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18973. @item coeffclamp
  18974. This option is deprecated and ignored.
  18975. @item tlength
  18976. Specify the transform length in time domain. Use this option to control accuracy
  18977. trade-off between time domain and frequency domain at every frequency sample.
  18978. It can contain variables:
  18979. @table @option
  18980. @item frequency, freq, f
  18981. the frequency where it is evaluated
  18982. @item timeclamp, tc
  18983. the value of @var{timeclamp} option.
  18984. @end table
  18985. Default value is @code{384*tc/(384+tc*f)}.
  18986. @item count
  18987. Specify the transform count for every video frame. Default value is @code{6}.
  18988. Acceptable range is @code{[1, 30]}.
  18989. @item fcount
  18990. Specify the transform count for every single pixel. Default value is @code{0},
  18991. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18992. @item fontfile
  18993. Specify font file for use with freetype to draw the axis. If not specified,
  18994. use embedded font. Note that drawing with font file or embedded font is not
  18995. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18996. option instead.
  18997. @item font
  18998. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18999. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19000. escaping.
  19001. @item fontcolor
  19002. Specify font color expression. This is arithmetic expression that should return
  19003. integer value 0xRRGGBB. It can contain variables:
  19004. @table @option
  19005. @item frequency, freq, f
  19006. the frequency where it is evaluated
  19007. @item timeclamp, tc
  19008. the value of @var{timeclamp} option
  19009. @end table
  19010. and functions:
  19011. @table @option
  19012. @item midi(f)
  19013. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19014. @item r(x), g(x), b(x)
  19015. red, green, and blue value of intensity x.
  19016. @end table
  19017. Default value is @code{st(0, (midi(f)-59.5)/12);
  19018. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19019. r(1-ld(1)) + b(ld(1))}.
  19020. @item axisfile
  19021. Specify image file to draw the axis. This option override @var{fontfile} and
  19022. @var{fontcolor} option.
  19023. @item axis, text
  19024. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19025. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19026. Default value is @code{1}.
  19027. @item csp
  19028. Set colorspace. The accepted values are:
  19029. @table @samp
  19030. @item unspecified
  19031. Unspecified (default)
  19032. @item bt709
  19033. BT.709
  19034. @item fcc
  19035. FCC
  19036. @item bt470bg
  19037. BT.470BG or BT.601-6 625
  19038. @item smpte170m
  19039. SMPTE-170M or BT.601-6 525
  19040. @item smpte240m
  19041. SMPTE-240M
  19042. @item bt2020ncl
  19043. BT.2020 with non-constant luminance
  19044. @end table
  19045. @item cscheme
  19046. Set spectrogram color scheme. This is list of floating point values with format
  19047. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19048. The default is @code{1|0.5|0|0|0.5|1}.
  19049. @end table
  19050. @subsection Examples
  19051. @itemize
  19052. @item
  19053. Playing audio while showing the spectrum:
  19054. @example
  19055. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19056. @end example
  19057. @item
  19058. Same as above, but with frame rate 30 fps:
  19059. @example
  19060. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19061. @end example
  19062. @item
  19063. Playing at 1280x720:
  19064. @example
  19065. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19066. @end example
  19067. @item
  19068. Disable sonogram display:
  19069. @example
  19070. sono_h=0
  19071. @end example
  19072. @item
  19073. A1 and its harmonics: A1, A2, (near)E3, A3:
  19074. @example
  19075. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  19076. asplit[a][out1]; [a] showcqt [out0]'
  19077. @end example
  19078. @item
  19079. Same as above, but with more accuracy in frequency domain:
  19080. @example
  19081. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  19082. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19083. @end example
  19084. @item
  19085. Custom volume:
  19086. @example
  19087. bar_v=10:sono_v=bar_v*a_weighting(f)
  19088. @end example
  19089. @item
  19090. Custom gamma, now spectrum is linear to the amplitude.
  19091. @example
  19092. bar_g=2:sono_g=2
  19093. @end example
  19094. @item
  19095. Custom tlength equation:
  19096. @example
  19097. tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
  19098. @end example
  19099. @item
  19100. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19101. @example
  19102. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19103. @end example
  19104. @item
  19105. Custom font using fontconfig:
  19106. @example
  19107. font='Courier New,Monospace,mono|bold'
  19108. @end example
  19109. @item
  19110. Custom frequency range with custom axis using image file:
  19111. @example
  19112. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19113. @end example
  19114. @end itemize
  19115. @section showfreqs
  19116. Convert input audio to video output representing the audio power spectrum.
  19117. Audio amplitude is on Y-axis while frequency is on X-axis.
  19118. The filter accepts the following options:
  19119. @table @option
  19120. @item size, s
  19121. Specify size of video. For the syntax of this option, check the
  19122. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19123. Default is @code{1024x512}.
  19124. @item mode
  19125. Set display mode.
  19126. This set how each frequency bin will be represented.
  19127. It accepts the following values:
  19128. @table @samp
  19129. @item line
  19130. @item bar
  19131. @item dot
  19132. @end table
  19133. Default is @code{bar}.
  19134. @item ascale
  19135. Set amplitude scale.
  19136. It accepts the following values:
  19137. @table @samp
  19138. @item lin
  19139. Linear scale.
  19140. @item sqrt
  19141. Square root scale.
  19142. @item cbrt
  19143. Cubic root scale.
  19144. @item log
  19145. Logarithmic scale.
  19146. @end table
  19147. Default is @code{log}.
  19148. @item fscale
  19149. Set frequency scale.
  19150. It accepts the following values:
  19151. @table @samp
  19152. @item lin
  19153. Linear scale.
  19154. @item log
  19155. Logarithmic scale.
  19156. @item rlog
  19157. Reverse logarithmic scale.
  19158. @end table
  19159. Default is @code{lin}.
  19160. @item win_size
  19161. Set window size. Allowed range is from 16 to 65536.
  19162. Default is @code{2048}
  19163. @item win_func
  19164. Set windowing function.
  19165. It accepts the following values:
  19166. @table @samp
  19167. @item rect
  19168. @item bartlett
  19169. @item hanning
  19170. @item hamming
  19171. @item blackman
  19172. @item welch
  19173. @item flattop
  19174. @item bharris
  19175. @item bnuttall
  19176. @item bhann
  19177. @item sine
  19178. @item nuttall
  19179. @item lanczos
  19180. @item gauss
  19181. @item tukey
  19182. @item dolph
  19183. @item cauchy
  19184. @item parzen
  19185. @item poisson
  19186. @item bohman
  19187. @end table
  19188. Default is @code{hanning}.
  19189. @item overlap
  19190. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19191. which means optimal overlap for selected window function will be picked.
  19192. @item averaging
  19193. Set time averaging. Setting this to 0 will display current maximal peaks.
  19194. Default is @code{1}, which means time averaging is disabled.
  19195. @item colors
  19196. Specify list of colors separated by space or by '|' which will be used to
  19197. draw channel frequencies. Unrecognized or missing colors will be replaced
  19198. by white color.
  19199. @item cmode
  19200. Set channel display mode.
  19201. It accepts the following values:
  19202. @table @samp
  19203. @item combined
  19204. @item separate
  19205. @end table
  19206. Default is @code{combined}.
  19207. @item minamp
  19208. Set minimum amplitude used in @code{log} amplitude scaler.
  19209. @item data
  19210. Set data display mode.
  19211. It accepts the following values:
  19212. @table @samp
  19213. @item magnitude
  19214. @item phase
  19215. @item delay
  19216. @end table
  19217. Default is @code{magnitude}.
  19218. @end table
  19219. @section showspatial
  19220. Convert stereo input audio to a video output, representing the spatial relationship
  19221. between two channels.
  19222. The filter accepts the following options:
  19223. @table @option
  19224. @item size, s
  19225. Specify the video size for the output. For the syntax of this option, check the
  19226. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19227. Default value is @code{512x512}.
  19228. @item win_size
  19229. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19230. @item win_func
  19231. Set window function.
  19232. It accepts the following values:
  19233. @table @samp
  19234. @item rect
  19235. @item bartlett
  19236. @item hann
  19237. @item hanning
  19238. @item hamming
  19239. @item blackman
  19240. @item welch
  19241. @item flattop
  19242. @item bharris
  19243. @item bnuttall
  19244. @item bhann
  19245. @item sine
  19246. @item nuttall
  19247. @item lanczos
  19248. @item gauss
  19249. @item tukey
  19250. @item dolph
  19251. @item cauchy
  19252. @item parzen
  19253. @item poisson
  19254. @item bohman
  19255. @end table
  19256. Default value is @code{hann}.
  19257. @item overlap
  19258. Set ratio of overlap window. Default value is @code{0.5}.
  19259. When value is @code{1} overlap is set to recommended size for specific
  19260. window function currently used.
  19261. @end table
  19262. @anchor{showspectrum}
  19263. @section showspectrum
  19264. Convert input audio to a video output, representing the audio frequency
  19265. spectrum.
  19266. The filter accepts the following options:
  19267. @table @option
  19268. @item size, s
  19269. Specify the video size for the output. For the syntax of this option, check the
  19270. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19271. Default value is @code{640x512}.
  19272. @item slide
  19273. Specify how the spectrum should slide along the window.
  19274. It accepts the following values:
  19275. @table @samp
  19276. @item replace
  19277. the samples start again on the left when they reach the right
  19278. @item scroll
  19279. the samples scroll from right to left
  19280. @item fullframe
  19281. frames are only produced when the samples reach the right
  19282. @item rscroll
  19283. the samples scroll from left to right
  19284. @end table
  19285. Default value is @code{replace}.
  19286. @item mode
  19287. Specify display mode.
  19288. It accepts the following values:
  19289. @table @samp
  19290. @item combined
  19291. all channels are displayed in the same row
  19292. @item separate
  19293. all channels are displayed in separate rows
  19294. @end table
  19295. Default value is @samp{combined}.
  19296. @item color
  19297. Specify display color mode.
  19298. It accepts the following values:
  19299. @table @samp
  19300. @item channel
  19301. each channel is displayed in a separate color
  19302. @item intensity
  19303. each channel is displayed using the same color scheme
  19304. @item rainbow
  19305. each channel is displayed using the rainbow color scheme
  19306. @item moreland
  19307. each channel is displayed using the moreland color scheme
  19308. @item nebulae
  19309. each channel is displayed using the nebulae color scheme
  19310. @item fire
  19311. each channel is displayed using the fire color scheme
  19312. @item fiery
  19313. each channel is displayed using the fiery color scheme
  19314. @item fruit
  19315. each channel is displayed using the fruit color scheme
  19316. @item cool
  19317. each channel is displayed using the cool color scheme
  19318. @item magma
  19319. each channel is displayed using the magma color scheme
  19320. @item green
  19321. each channel is displayed using the green color scheme
  19322. @item viridis
  19323. each channel is displayed using the viridis color scheme
  19324. @item plasma
  19325. each channel is displayed using the plasma color scheme
  19326. @item cividis
  19327. each channel is displayed using the cividis color scheme
  19328. @item terrain
  19329. each channel is displayed using the terrain color scheme
  19330. @end table
  19331. Default value is @samp{channel}.
  19332. @item scale
  19333. Specify scale used for calculating intensity color values.
  19334. It accepts the following values:
  19335. @table @samp
  19336. @item lin
  19337. linear
  19338. @item sqrt
  19339. square root, default
  19340. @item cbrt
  19341. cubic root
  19342. @item log
  19343. logarithmic
  19344. @item 4thrt
  19345. 4th root
  19346. @item 5thrt
  19347. 5th root
  19348. @end table
  19349. Default value is @samp{sqrt}.
  19350. @item fscale
  19351. Specify frequency scale.
  19352. It accepts the following values:
  19353. @table @samp
  19354. @item lin
  19355. linear
  19356. @item log
  19357. logarithmic
  19358. @end table
  19359. Default value is @samp{lin}.
  19360. @item saturation
  19361. Set saturation modifier for displayed colors. Negative values provide
  19362. alternative color scheme. @code{0} is no saturation at all.
  19363. Saturation must be in [-10.0, 10.0] range.
  19364. Default value is @code{1}.
  19365. @item win_func
  19366. Set window function.
  19367. It accepts the following values:
  19368. @table @samp
  19369. @item rect
  19370. @item bartlett
  19371. @item hann
  19372. @item hanning
  19373. @item hamming
  19374. @item blackman
  19375. @item welch
  19376. @item flattop
  19377. @item bharris
  19378. @item bnuttall
  19379. @item bhann
  19380. @item sine
  19381. @item nuttall
  19382. @item lanczos
  19383. @item gauss
  19384. @item tukey
  19385. @item dolph
  19386. @item cauchy
  19387. @item parzen
  19388. @item poisson
  19389. @item bohman
  19390. @end table
  19391. Default value is @code{hann}.
  19392. @item orientation
  19393. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19394. @code{horizontal}. Default is @code{vertical}.
  19395. @item overlap
  19396. Set ratio of overlap window. Default value is @code{0}.
  19397. When value is @code{1} overlap is set to recommended size for specific
  19398. window function currently used.
  19399. @item gain
  19400. Set scale gain for calculating intensity color values.
  19401. Default value is @code{1}.
  19402. @item data
  19403. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19404. @item rotation
  19405. Set color rotation, must be in [-1.0, 1.0] range.
  19406. Default value is @code{0}.
  19407. @item start
  19408. Set start frequency from which to display spectrogram. Default is @code{0}.
  19409. @item stop
  19410. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19411. @item fps
  19412. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19413. @item legend
  19414. Draw time and frequency axes and legends. Default is disabled.
  19415. @end table
  19416. The usage is very similar to the showwaves filter; see the examples in that
  19417. section.
  19418. @subsection Examples
  19419. @itemize
  19420. @item
  19421. Large window with logarithmic color scaling:
  19422. @example
  19423. showspectrum=s=1280x480:scale=log
  19424. @end example
  19425. @item
  19426. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19427. @example
  19428. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19429. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19430. @end example
  19431. @end itemize
  19432. @section showspectrumpic
  19433. Convert input audio to a single video frame, representing the audio frequency
  19434. spectrum.
  19435. The filter accepts the following options:
  19436. @table @option
  19437. @item size, s
  19438. Specify the video size for the output. For the syntax of this option, check the
  19439. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19440. Default value is @code{4096x2048}.
  19441. @item mode
  19442. Specify display mode.
  19443. It accepts the following values:
  19444. @table @samp
  19445. @item combined
  19446. all channels are displayed in the same row
  19447. @item separate
  19448. all channels are displayed in separate rows
  19449. @end table
  19450. Default value is @samp{combined}.
  19451. @item color
  19452. Specify display color mode.
  19453. It accepts the following values:
  19454. @table @samp
  19455. @item channel
  19456. each channel is displayed in a separate color
  19457. @item intensity
  19458. each channel is displayed using the same color scheme
  19459. @item rainbow
  19460. each channel is displayed using the rainbow color scheme
  19461. @item moreland
  19462. each channel is displayed using the moreland color scheme
  19463. @item nebulae
  19464. each channel is displayed using the nebulae color scheme
  19465. @item fire
  19466. each channel is displayed using the fire color scheme
  19467. @item fiery
  19468. each channel is displayed using the fiery color scheme
  19469. @item fruit
  19470. each channel is displayed using the fruit color scheme
  19471. @item cool
  19472. each channel is displayed using the cool color scheme
  19473. @item magma
  19474. each channel is displayed using the magma color scheme
  19475. @item green
  19476. each channel is displayed using the green color scheme
  19477. @item viridis
  19478. each channel is displayed using the viridis color scheme
  19479. @item plasma
  19480. each channel is displayed using the plasma color scheme
  19481. @item cividis
  19482. each channel is displayed using the cividis color scheme
  19483. @item terrain
  19484. each channel is displayed using the terrain color scheme
  19485. @end table
  19486. Default value is @samp{intensity}.
  19487. @item scale
  19488. Specify scale used for calculating intensity color values.
  19489. It accepts the following values:
  19490. @table @samp
  19491. @item lin
  19492. linear
  19493. @item sqrt
  19494. square root, default
  19495. @item cbrt
  19496. cubic root
  19497. @item log
  19498. logarithmic
  19499. @item 4thrt
  19500. 4th root
  19501. @item 5thrt
  19502. 5th root
  19503. @end table
  19504. Default value is @samp{log}.
  19505. @item fscale
  19506. Specify frequency scale.
  19507. It accepts the following values:
  19508. @table @samp
  19509. @item lin
  19510. linear
  19511. @item log
  19512. logarithmic
  19513. @end table
  19514. Default value is @samp{lin}.
  19515. @item saturation
  19516. Set saturation modifier for displayed colors. Negative values provide
  19517. alternative color scheme. @code{0} is no saturation at all.
  19518. Saturation must be in [-10.0, 10.0] range.
  19519. Default value is @code{1}.
  19520. @item win_func
  19521. Set window function.
  19522. It accepts the following values:
  19523. @table @samp
  19524. @item rect
  19525. @item bartlett
  19526. @item hann
  19527. @item hanning
  19528. @item hamming
  19529. @item blackman
  19530. @item welch
  19531. @item flattop
  19532. @item bharris
  19533. @item bnuttall
  19534. @item bhann
  19535. @item sine
  19536. @item nuttall
  19537. @item lanczos
  19538. @item gauss
  19539. @item tukey
  19540. @item dolph
  19541. @item cauchy
  19542. @item parzen
  19543. @item poisson
  19544. @item bohman
  19545. @end table
  19546. Default value is @code{hann}.
  19547. @item orientation
  19548. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19549. @code{horizontal}. Default is @code{vertical}.
  19550. @item gain
  19551. Set scale gain for calculating intensity color values.
  19552. Default value is @code{1}.
  19553. @item legend
  19554. Draw time and frequency axes and legends. Default is enabled.
  19555. @item rotation
  19556. Set color rotation, must be in [-1.0, 1.0] range.
  19557. Default value is @code{0}.
  19558. @item start
  19559. Set start frequency from which to display spectrogram. Default is @code{0}.
  19560. @item stop
  19561. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19562. @end table
  19563. @subsection Examples
  19564. @itemize
  19565. @item
  19566. Extract an audio spectrogram of a whole audio track
  19567. in a 1024x1024 picture using @command{ffmpeg}:
  19568. @example
  19569. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19570. @end example
  19571. @end itemize
  19572. @section showvolume
  19573. Convert input audio volume to a video output.
  19574. The filter accepts the following options:
  19575. @table @option
  19576. @item rate, r
  19577. Set video rate.
  19578. @item b
  19579. Set border width, allowed range is [0, 5]. Default is 1.
  19580. @item w
  19581. Set channel width, allowed range is [80, 8192]. Default is 400.
  19582. @item h
  19583. Set channel height, allowed range is [1, 900]. Default is 20.
  19584. @item f
  19585. Set fade, allowed range is [0, 1]. Default is 0.95.
  19586. @item c
  19587. Set volume color expression.
  19588. The expression can use the following variables:
  19589. @table @option
  19590. @item VOLUME
  19591. Current max volume of channel in dB.
  19592. @item PEAK
  19593. Current peak.
  19594. @item CHANNEL
  19595. Current channel number, starting from 0.
  19596. @end table
  19597. @item t
  19598. If set, displays channel names. Default is enabled.
  19599. @item v
  19600. If set, displays volume values. Default is enabled.
  19601. @item o
  19602. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19603. default is @code{h}.
  19604. @item s
  19605. Set step size, allowed range is [0, 5]. Default is 0, which means
  19606. step is disabled.
  19607. @item p
  19608. Set background opacity, allowed range is [0, 1]. Default is 0.
  19609. @item m
  19610. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19611. default is @code{p}.
  19612. @item ds
  19613. Set display scale, can be linear: @code{lin} or log: @code{log},
  19614. default is @code{lin}.
  19615. @item dm
  19616. In second.
  19617. If set to > 0., display a line for the max level
  19618. in the previous seconds.
  19619. default is disabled: @code{0.}
  19620. @item dmc
  19621. The color of the max line. Use when @code{dm} option is set to > 0.
  19622. default is: @code{orange}
  19623. @end table
  19624. @section showwaves
  19625. Convert input audio to a video output, representing the samples waves.
  19626. The filter accepts the following options:
  19627. @table @option
  19628. @item size, s
  19629. Specify the video size for the output. For the syntax of this option, check the
  19630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19631. Default value is @code{600x240}.
  19632. @item mode
  19633. Set display mode.
  19634. Available values are:
  19635. @table @samp
  19636. @item point
  19637. Draw a point for each sample.
  19638. @item line
  19639. Draw a vertical line for each sample.
  19640. @item p2p
  19641. Draw a point for each sample and a line between them.
  19642. @item cline
  19643. Draw a centered vertical line for each sample.
  19644. @end table
  19645. Default value is @code{point}.
  19646. @item n
  19647. Set the number of samples which are printed on the same column. A
  19648. larger value will decrease the frame rate. Must be a positive
  19649. integer. This option can be set only if the value for @var{rate}
  19650. is not explicitly specified.
  19651. @item rate, r
  19652. Set the (approximate) output frame rate. This is done by setting the
  19653. option @var{n}. Default value is "25".
  19654. @item split_channels
  19655. Set if channels should be drawn separately or overlap. Default value is 0.
  19656. @item colors
  19657. Set colors separated by '|' which are going to be used for drawing of each channel.
  19658. @item scale
  19659. Set amplitude scale.
  19660. Available values are:
  19661. @table @samp
  19662. @item lin
  19663. Linear.
  19664. @item log
  19665. Logarithmic.
  19666. @item sqrt
  19667. Square root.
  19668. @item cbrt
  19669. Cubic root.
  19670. @end table
  19671. Default is linear.
  19672. @item draw
  19673. Set the draw mode. This is mostly useful to set for high @var{n}.
  19674. Available values are:
  19675. @table @samp
  19676. @item scale
  19677. Scale pixel values for each drawn sample.
  19678. @item full
  19679. Draw every sample directly.
  19680. @end table
  19681. Default value is @code{scale}.
  19682. @end table
  19683. @subsection Examples
  19684. @itemize
  19685. @item
  19686. Output the input file audio and the corresponding video representation
  19687. at the same time:
  19688. @example
  19689. amovie=a.mp3,asplit[out0],showwaves[out1]
  19690. @end example
  19691. @item
  19692. Create a synthetic signal and show it with showwaves, forcing a
  19693. frame rate of 30 frames per second:
  19694. @example
  19695. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19696. @end example
  19697. @end itemize
  19698. @section showwavespic
  19699. Convert input audio to a single video frame, representing the samples waves.
  19700. The filter accepts the following options:
  19701. @table @option
  19702. @item size, s
  19703. Specify the video size for the output. For the syntax of this option, check the
  19704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19705. Default value is @code{600x240}.
  19706. @item split_channels
  19707. Set if channels should be drawn separately or overlap. Default value is 0.
  19708. @item colors
  19709. Set colors separated by '|' which are going to be used for drawing of each channel.
  19710. @item scale
  19711. Set amplitude scale.
  19712. Available values are:
  19713. @table @samp
  19714. @item lin
  19715. Linear.
  19716. @item log
  19717. Logarithmic.
  19718. @item sqrt
  19719. Square root.
  19720. @item cbrt
  19721. Cubic root.
  19722. @end table
  19723. Default is linear.
  19724. @item draw
  19725. Set the draw mode.
  19726. Available values are:
  19727. @table @samp
  19728. @item scale
  19729. Scale pixel values for each drawn sample.
  19730. @item full
  19731. Draw every sample directly.
  19732. @end table
  19733. Default value is @code{scale}.
  19734. @item filter
  19735. Set the filter mode.
  19736. Available values are:
  19737. @table @samp
  19738. @item average
  19739. Use average samples values for each drawn sample.
  19740. @item peak
  19741. Use peak samples values for each drawn sample.
  19742. @end table
  19743. Default value is @code{average}.
  19744. @end table
  19745. @subsection Examples
  19746. @itemize
  19747. @item
  19748. Extract a channel split representation of the wave form of a whole audio track
  19749. in a 1024x800 picture using @command{ffmpeg}:
  19750. @example
  19751. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19752. @end example
  19753. @end itemize
  19754. @section sidedata, asidedata
  19755. Delete frame side data, or select frames based on it.
  19756. This filter accepts the following options:
  19757. @table @option
  19758. @item mode
  19759. Set mode of operation of the filter.
  19760. Can be one of the following:
  19761. @table @samp
  19762. @item select
  19763. Select every frame with side data of @code{type}.
  19764. @item delete
  19765. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19766. data in the frame.
  19767. @end table
  19768. @item type
  19769. Set side data type used with all modes. Must be set for @code{select} mode. For
  19770. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19771. in @file{libavutil/frame.h}. For example, to choose
  19772. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19773. @end table
  19774. @section spectrumsynth
  19775. Synthesize audio from 2 input video spectrums, first input stream represents
  19776. magnitude across time and second represents phase across time.
  19777. The filter will transform from frequency domain as displayed in videos back
  19778. to time domain as presented in audio output.
  19779. This filter is primarily created for reversing processed @ref{showspectrum}
  19780. filter outputs, but can synthesize sound from other spectrograms too.
  19781. But in such case results are going to be poor if the phase data is not
  19782. available, because in such cases phase data need to be recreated, usually
  19783. it's just recreated from random noise.
  19784. For best results use gray only output (@code{channel} color mode in
  19785. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19786. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19787. @code{data} option. Inputs videos should generally use @code{fullframe}
  19788. slide mode as that saves resources needed for decoding video.
  19789. The filter accepts the following options:
  19790. @table @option
  19791. @item sample_rate
  19792. Specify sample rate of output audio, the sample rate of audio from which
  19793. spectrum was generated may differ.
  19794. @item channels
  19795. Set number of channels represented in input video spectrums.
  19796. @item scale
  19797. Set scale which was used when generating magnitude input spectrum.
  19798. Can be @code{lin} or @code{log}. Default is @code{log}.
  19799. @item slide
  19800. Set slide which was used when generating inputs spectrums.
  19801. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19802. Default is @code{fullframe}.
  19803. @item win_func
  19804. Set window function used for resynthesis.
  19805. @item overlap
  19806. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19807. which means optimal overlap for selected window function will be picked.
  19808. @item orientation
  19809. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19810. Default is @code{vertical}.
  19811. @end table
  19812. @subsection Examples
  19813. @itemize
  19814. @item
  19815. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19816. then resynthesize videos back to audio with spectrumsynth:
  19817. @example
  19818. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  19819. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  19820. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19821. @end example
  19822. @end itemize
  19823. @section split, asplit
  19824. Split input into several identical outputs.
  19825. @code{asplit} works with audio input, @code{split} with video.
  19826. The filter accepts a single parameter which specifies the number of outputs. If
  19827. unspecified, it defaults to 2.
  19828. @subsection Examples
  19829. @itemize
  19830. @item
  19831. Create two separate outputs from the same input:
  19832. @example
  19833. [in] split [out0][out1]
  19834. @end example
  19835. @item
  19836. To create 3 or more outputs, you need to specify the number of
  19837. outputs, like in:
  19838. @example
  19839. [in] asplit=3 [out0][out1][out2]
  19840. @end example
  19841. @item
  19842. Create two separate outputs from the same input, one cropped and
  19843. one padded:
  19844. @example
  19845. [in] split [splitout1][splitout2];
  19846. [splitout1] crop=100:100:0:0 [cropout];
  19847. [splitout2] pad=200:200:100:100 [padout];
  19848. @end example
  19849. @item
  19850. Create 5 copies of the input audio with @command{ffmpeg}:
  19851. @example
  19852. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19853. @end example
  19854. @end itemize
  19855. @section zmq, azmq
  19856. Receive commands sent through a libzmq client, and forward them to
  19857. filters in the filtergraph.
  19858. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19859. must be inserted between two video filters, @code{azmq} between two
  19860. audio filters. Both are capable to send messages to any filter type.
  19861. To enable these filters you need to install the libzmq library and
  19862. headers and configure FFmpeg with @code{--enable-libzmq}.
  19863. For more information about libzmq see:
  19864. @url{http://www.zeromq.org/}
  19865. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19866. receives messages sent through a network interface defined by the
  19867. @option{bind_address} (or the abbreviation "@option{b}") option.
  19868. Default value of this option is @file{tcp://localhost:5555}. You may
  19869. want to alter this value to your needs, but do not forget to escape any
  19870. ':' signs (see @ref{filtergraph escaping}).
  19871. The received message must be in the form:
  19872. @example
  19873. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19874. @end example
  19875. @var{TARGET} specifies the target of the command, usually the name of
  19876. the filter class or a specific filter instance name. The default
  19877. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19878. but you can override this by using the @samp{filter_name@@id} syntax
  19879. (see @ref{Filtergraph syntax}).
  19880. @var{COMMAND} specifies the name of the command for the target filter.
  19881. @var{ARG} is optional and specifies the optional argument list for the
  19882. given @var{COMMAND}.
  19883. Upon reception, the message is processed and the corresponding command
  19884. is injected into the filtergraph. Depending on the result, the filter
  19885. will send a reply to the client, adopting the format:
  19886. @example
  19887. @var{ERROR_CODE} @var{ERROR_REASON}
  19888. @var{MESSAGE}
  19889. @end example
  19890. @var{MESSAGE} is optional.
  19891. @subsection Examples
  19892. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19893. be used to send commands processed by these filters.
  19894. Consider the following filtergraph generated by @command{ffplay}.
  19895. In this example the last overlay filter has an instance name. All other
  19896. filters will have default instance names.
  19897. @example
  19898. ffplay -dumpgraph 1 -f lavfi "
  19899. color=s=100x100:c=red [l];
  19900. color=s=100x100:c=blue [r];
  19901. nullsrc=s=200x100, zmq [bg];
  19902. [bg][l] overlay [bg+l];
  19903. [bg+l][r] overlay@@my=x=100 "
  19904. @end example
  19905. To change the color of the left side of the video, the following
  19906. command can be used:
  19907. @example
  19908. echo Parsed_color_0 c yellow | tools/zmqsend
  19909. @end example
  19910. To change the right side:
  19911. @example
  19912. echo Parsed_color_1 c pink | tools/zmqsend
  19913. @end example
  19914. To change the position of the right side:
  19915. @example
  19916. echo overlay@@my x 150 | tools/zmqsend
  19917. @end example
  19918. @c man end MULTIMEDIA FILTERS
  19919. @chapter Multimedia Sources
  19920. @c man begin MULTIMEDIA SOURCES
  19921. Below is a description of the currently available multimedia sources.
  19922. @section amovie
  19923. This is the same as @ref{movie} source, except it selects an audio
  19924. stream by default.
  19925. @anchor{movie}
  19926. @section movie
  19927. Read audio and/or video stream(s) from a movie container.
  19928. It accepts the following parameters:
  19929. @table @option
  19930. @item filename
  19931. The name of the resource to read (not necessarily a file; it can also be a
  19932. device or a stream accessed through some protocol).
  19933. @item format_name, f
  19934. Specifies the format assumed for the movie to read, and can be either
  19935. the name of a container or an input device. If not specified, the
  19936. format is guessed from @var{movie_name} or by probing.
  19937. @item seek_point, sp
  19938. Specifies the seek point in seconds. The frames will be output
  19939. starting from this seek point. The parameter is evaluated with
  19940. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19941. postfix. The default value is "0".
  19942. @item streams, s
  19943. Specifies the streams to read. Several streams can be specified,
  19944. separated by "+". The source will then have as many outputs, in the
  19945. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19946. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19947. respectively the default (best suited) video and audio stream. Default
  19948. is "dv", or "da" if the filter is called as "amovie".
  19949. @item stream_index, si
  19950. Specifies the index of the video stream to read. If the value is -1,
  19951. the most suitable video stream will be automatically selected. The default
  19952. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19953. audio instead of video.
  19954. @item loop
  19955. Specifies how many times to read the stream in sequence.
  19956. If the value is 0, the stream will be looped infinitely.
  19957. Default value is "1".
  19958. Note that when the movie is looped the source timestamps are not
  19959. changed, so it will generate non monotonically increasing timestamps.
  19960. @item discontinuity
  19961. Specifies the time difference between frames above which the point is
  19962. considered a timestamp discontinuity which is removed by adjusting the later
  19963. timestamps.
  19964. @end table
  19965. It allows overlaying a second video on top of the main input of
  19966. a filtergraph, as shown in this graph:
  19967. @example
  19968. input -----------> deltapts0 --> overlay --> output
  19969. ^
  19970. |
  19971. movie --> scale--> deltapts1 -------+
  19972. @end example
  19973. @subsection Examples
  19974. @itemize
  19975. @item
  19976. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19977. on top of the input labelled "in":
  19978. @example
  19979. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19980. [in] setpts=PTS-STARTPTS [main];
  19981. [main][over] overlay=16:16 [out]
  19982. @end example
  19983. @item
  19984. Read from a video4linux2 device, and overlay it on top of the input
  19985. labelled "in":
  19986. @example
  19987. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19988. [in] setpts=PTS-STARTPTS [main];
  19989. [main][over] overlay=16:16 [out]
  19990. @end example
  19991. @item
  19992. Read the first video stream and the audio stream with id 0x81 from
  19993. dvd.vob; the video is connected to the pad named "video" and the audio is
  19994. connected to the pad named "audio":
  19995. @example
  19996. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19997. @end example
  19998. @end itemize
  19999. @subsection Commands
  20000. Both movie and amovie support the following commands:
  20001. @table @option
  20002. @item seek
  20003. Perform seek using "av_seek_frame".
  20004. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20005. @itemize
  20006. @item
  20007. @var{stream_index}: If stream_index is -1, a default
  20008. stream is selected, and @var{timestamp} is automatically converted
  20009. from AV_TIME_BASE units to the stream specific time_base.
  20010. @item
  20011. @var{timestamp}: Timestamp in AVStream.time_base units
  20012. or, if no stream is specified, in AV_TIME_BASE units.
  20013. @item
  20014. @var{flags}: Flags which select direction and seeking mode.
  20015. @end itemize
  20016. @item get_duration
  20017. Get movie duration in AV_TIME_BASE units.
  20018. @end table
  20019. @c man end MULTIMEDIA SOURCES