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.

26292 lines
698KB

  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. @end table
  1764. @section asetnsamples
  1765. Set the number of samples per each output audio frame.
  1766. The last output packet may contain a different number of samples, as
  1767. the filter will flush all the remaining samples when the input audio
  1768. signals its end.
  1769. The filter accepts the following options:
  1770. @table @option
  1771. @item nb_out_samples, n
  1772. Set the number of frames per each output audio frame. The number is
  1773. intended as the number of samples @emph{per each channel}.
  1774. Default value is 1024.
  1775. @item pad, p
  1776. If set to 1, the filter will pad the last audio frame with zeroes, so
  1777. that the last frame will contain the same number of samples as the
  1778. previous ones. Default value is 1.
  1779. @end table
  1780. For example, to set the number of per-frame samples to 1234 and
  1781. disable padding for the last frame, use:
  1782. @example
  1783. asetnsamples=n=1234:p=0
  1784. @end example
  1785. @section asetrate
  1786. Set the sample rate without altering the PCM data.
  1787. This will result in a change of speed and pitch.
  1788. The filter accepts the following options:
  1789. @table @option
  1790. @item sample_rate, r
  1791. Set the output sample rate. Default is 44100 Hz.
  1792. @end table
  1793. @section ashowinfo
  1794. Show a line containing various information for each input audio frame.
  1795. The input audio is not modified.
  1796. The shown line contains a sequence of key/value pairs of the form
  1797. @var{key}:@var{value}.
  1798. The following values are shown in the output:
  1799. @table @option
  1800. @item n
  1801. The (sequential) number of the input frame, starting from 0.
  1802. @item pts
  1803. The presentation timestamp of the input frame, in time base units; the time base
  1804. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1805. @item pts_time
  1806. The presentation timestamp of the input frame in seconds.
  1807. @item pos
  1808. position of the frame in the input stream, -1 if this information in
  1809. unavailable and/or meaningless (for example in case of synthetic audio)
  1810. @item fmt
  1811. The sample format.
  1812. @item chlayout
  1813. The channel layout.
  1814. @item rate
  1815. The sample rate for the audio frame.
  1816. @item nb_samples
  1817. The number of samples (per channel) in the frame.
  1818. @item checksum
  1819. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1820. audio, the data is treated as if all the planes were concatenated.
  1821. @item plane_checksums
  1822. A list of Adler-32 checksums for each data plane.
  1823. @end table
  1824. @section asoftclip
  1825. Apply audio soft clipping.
  1826. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1827. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1828. This filter accepts the following options:
  1829. @table @option
  1830. @item type
  1831. Set type of soft-clipping.
  1832. It accepts the following values:
  1833. @table @option
  1834. @item hard
  1835. @item tanh
  1836. @item atan
  1837. @item cubic
  1838. @item exp
  1839. @item alg
  1840. @item quintic
  1841. @item sin
  1842. @item erf
  1843. @end table
  1844. @item param
  1845. Set additional parameter which controls sigmoid function.
  1846. @item oversample
  1847. Set oversampling factor.
  1848. @end table
  1849. @subsection Commands
  1850. This filter supports the all above options as @ref{commands}.
  1851. @section asr
  1852. Automatic Speech Recognition
  1853. This filter uses PocketSphinx for speech recognition. To enable
  1854. compilation of this filter, you need to configure FFmpeg with
  1855. @code{--enable-pocketsphinx}.
  1856. It accepts the following options:
  1857. @table @option
  1858. @item rate
  1859. Set sampling rate of input audio. Defaults is @code{16000}.
  1860. This need to match speech models, otherwise one will get poor results.
  1861. @item hmm
  1862. Set dictionary containing acoustic model files.
  1863. @item dict
  1864. Set pronunciation dictionary.
  1865. @item lm
  1866. Set language model file.
  1867. @item lmctl
  1868. Set language model set.
  1869. @item lmname
  1870. Set which language model to use.
  1871. @item logfn
  1872. Set output for log messages.
  1873. @end table
  1874. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1875. @anchor{astats}
  1876. @section astats
  1877. Display time domain statistical information about the audio channels.
  1878. Statistics are calculated and displayed for each audio channel and,
  1879. where applicable, an overall figure is also given.
  1880. It accepts the following option:
  1881. @table @option
  1882. @item length
  1883. Short window length in seconds, used for peak and trough RMS measurement.
  1884. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1885. @item metadata
  1886. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1887. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1888. disabled.
  1889. Available keys for each channel are:
  1890. DC_offset
  1891. Min_level
  1892. Max_level
  1893. Min_difference
  1894. Max_difference
  1895. Mean_difference
  1896. RMS_difference
  1897. Peak_level
  1898. RMS_peak
  1899. RMS_trough
  1900. Crest_factor
  1901. Flat_factor
  1902. Peak_count
  1903. Noise_floor
  1904. Noise_floor_count
  1905. Bit_depth
  1906. Dynamic_range
  1907. Zero_crossings
  1908. Zero_crossings_rate
  1909. Number_of_NaNs
  1910. Number_of_Infs
  1911. Number_of_denormals
  1912. and for Overall:
  1913. DC_offset
  1914. Min_level
  1915. Max_level
  1916. Min_difference
  1917. Max_difference
  1918. Mean_difference
  1919. RMS_difference
  1920. Peak_level
  1921. RMS_level
  1922. RMS_peak
  1923. RMS_trough
  1924. Flat_factor
  1925. Peak_count
  1926. Noise_floor
  1927. Noise_floor_count
  1928. Bit_depth
  1929. Number_of_samples
  1930. Number_of_NaNs
  1931. Number_of_Infs
  1932. Number_of_denormals
  1933. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1934. this @code{lavfi.astats.Overall.Peak_count}.
  1935. For description what each key means read below.
  1936. @item reset
  1937. Set number of frame after which stats are going to be recalculated.
  1938. Default is disabled.
  1939. @item measure_perchannel
  1940. Select the entries which need to be measured per channel. The metadata keys can
  1941. be used as flags, default is @option{all} which measures everything.
  1942. @option{none} disables all per channel measurement.
  1943. @item measure_overall
  1944. Select the entries which need to be measured overall. The metadata keys can
  1945. be used as flags, default is @option{all} which measures everything.
  1946. @option{none} disables all overall measurement.
  1947. @end table
  1948. A description of each shown parameter follows:
  1949. @table @option
  1950. @item DC offset
  1951. Mean amplitude displacement from zero.
  1952. @item Min level
  1953. Minimal sample level.
  1954. @item Max level
  1955. Maximal sample level.
  1956. @item Min difference
  1957. Minimal difference between two consecutive samples.
  1958. @item Max difference
  1959. Maximal difference between two consecutive samples.
  1960. @item Mean difference
  1961. Mean difference between two consecutive samples.
  1962. The average of each difference between two consecutive samples.
  1963. @item RMS difference
  1964. Root Mean Square difference between two consecutive samples.
  1965. @item Peak level dB
  1966. @item RMS level dB
  1967. Standard peak and RMS level measured in dBFS.
  1968. @item RMS peak dB
  1969. @item RMS trough dB
  1970. Peak and trough values for RMS level measured over a short window.
  1971. @item Crest factor
  1972. Standard ratio of peak to RMS level (note: not in dB).
  1973. @item Flat factor
  1974. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1975. (i.e. either @var{Min level} or @var{Max level}).
  1976. @item Peak count
  1977. Number of occasions (not the number of samples) that the signal attained either
  1978. @var{Min level} or @var{Max level}.
  1979. @item Noise floor dB
  1980. Minimum local peak measured in dBFS over a short window.
  1981. @item Noise floor count
  1982. Number of occasions (not the number of samples) that the signal attained
  1983. @var{Noise floor}.
  1984. @item Bit depth
  1985. Overall bit depth of audio. Number of bits used for each sample.
  1986. @item Dynamic range
  1987. Measured dynamic range of audio in dB.
  1988. @item Zero crossings
  1989. Number of points where the waveform crosses the zero level axis.
  1990. @item Zero crossings rate
  1991. Rate of Zero crossings and number of audio samples.
  1992. @end table
  1993. @section asubboost
  1994. Boost subwoofer frequencies.
  1995. The filter accepts the following options:
  1996. @table @option
  1997. @item dry
  1998. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  1999. Default value is 0.7.
  2000. @item wet
  2001. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2002. Default value is 0.7.
  2003. @item decay
  2004. Set delay line decay gain value. Allowed range is from 0 to 1.
  2005. Default value is 0.7.
  2006. @item feedback
  2007. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2008. Default value is 0.9.
  2009. @item cutoff
  2010. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2011. Default value is 100.
  2012. @item slope
  2013. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2014. Default value is 0.5.
  2015. @item delay
  2016. Set delay. Allowed range is from 1 to 100.
  2017. Default value is 20.
  2018. @end table
  2019. @subsection Commands
  2020. This filter supports the all above options as @ref{commands}.
  2021. @section asupercut
  2022. Cut super frequencies.
  2023. The filter accepts the following options:
  2024. @table @option
  2025. @item cutoff
  2026. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2027. Default value is 20000.
  2028. @item order
  2029. Set filter order. Available values are from 3 to 20.
  2030. Default value is 10.
  2031. @end table
  2032. @subsection Commands
  2033. This filter supports the all above options as @ref{commands}.
  2034. @section atempo
  2035. Adjust audio tempo.
  2036. The filter accepts exactly one parameter, the audio tempo. If not
  2037. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2038. be in the [0.5, 100.0] range.
  2039. Note that tempo greater than 2 will skip some samples rather than
  2040. blend them in. If for any reason this is a concern it is always
  2041. possible to daisy-chain several instances of atempo to achieve the
  2042. desired product tempo.
  2043. @subsection Examples
  2044. @itemize
  2045. @item
  2046. Slow down audio to 80% tempo:
  2047. @example
  2048. atempo=0.8
  2049. @end example
  2050. @item
  2051. To speed up audio to 300% tempo:
  2052. @example
  2053. atempo=3
  2054. @end example
  2055. @item
  2056. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2057. @example
  2058. atempo=sqrt(3),atempo=sqrt(3)
  2059. @end example
  2060. @end itemize
  2061. @subsection Commands
  2062. This filter supports the following commands:
  2063. @table @option
  2064. @item tempo
  2065. Change filter tempo scale factor.
  2066. Syntax for the command is : "@var{tempo}"
  2067. @end table
  2068. @section atrim
  2069. Trim the input so that the output contains one continuous subpart of the input.
  2070. It accepts the following parameters:
  2071. @table @option
  2072. @item start
  2073. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2074. sample with the timestamp @var{start} will be the first sample in the output.
  2075. @item end
  2076. Specify time of the first audio sample that will be dropped, i.e. the
  2077. audio sample immediately preceding the one with the timestamp @var{end} will be
  2078. the last sample in the output.
  2079. @item start_pts
  2080. Same as @var{start}, except this option sets the start timestamp in samples
  2081. instead of seconds.
  2082. @item end_pts
  2083. Same as @var{end}, except this option sets the end timestamp in samples instead
  2084. of seconds.
  2085. @item duration
  2086. The maximum duration of the output in seconds.
  2087. @item start_sample
  2088. The number of the first sample that should be output.
  2089. @item end_sample
  2090. The number of the first sample that should be dropped.
  2091. @end table
  2092. @option{start}, @option{end}, and @option{duration} are expressed as time
  2093. duration specifications; see
  2094. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2095. Note that the first two sets of the start/end options and the @option{duration}
  2096. option look at the frame timestamp, while the _sample options simply count the
  2097. samples that pass through the filter. So start/end_pts and start/end_sample will
  2098. give different results when the timestamps are wrong, inexact or do not start at
  2099. zero. Also note that this filter does not modify the timestamps. If you wish
  2100. to have the output timestamps start at zero, insert the asetpts filter after the
  2101. atrim filter.
  2102. If multiple start or end options are set, this filter tries to be greedy and
  2103. keep all samples that match at least one of the specified constraints. To keep
  2104. only the part that matches all the constraints at once, chain multiple atrim
  2105. filters.
  2106. The defaults are such that all the input is kept. So it is possible to set e.g.
  2107. just the end values to keep everything before the specified time.
  2108. Examples:
  2109. @itemize
  2110. @item
  2111. Drop everything except the second minute of input:
  2112. @example
  2113. ffmpeg -i INPUT -af atrim=60:120
  2114. @end example
  2115. @item
  2116. Keep only the first 1000 samples:
  2117. @example
  2118. ffmpeg -i INPUT -af atrim=end_sample=1000
  2119. @end example
  2120. @end itemize
  2121. @section axcorrelate
  2122. Calculate normalized cross-correlation between two input audio streams.
  2123. Resulted samples are always between -1 and 1 inclusive.
  2124. If result is 1 it means two input samples are highly correlated in that selected segment.
  2125. Result 0 means they are not correlated at all.
  2126. If result is -1 it means two input samples are out of phase, which means they cancel each
  2127. other.
  2128. The filter accepts the following options:
  2129. @table @option
  2130. @item size
  2131. Set size of segment over which cross-correlation is calculated.
  2132. Default is 256. Allowed range is from 2 to 131072.
  2133. @item algo
  2134. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2135. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2136. are always zero and thus need much less calculations to make.
  2137. This is generally not true, but is valid for typical audio streams.
  2138. @end table
  2139. @subsection Examples
  2140. @itemize
  2141. @item
  2142. Calculate correlation between channels in stereo audio stream:
  2143. @example
  2144. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2145. @end example
  2146. @end itemize
  2147. @section bandpass
  2148. Apply a two-pole Butterworth band-pass filter with central
  2149. frequency @var{frequency}, and (3dB-point) band-width width.
  2150. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2151. instead of the default: constant 0dB peak gain.
  2152. The filter roll off at 6dB per octave (20dB per decade).
  2153. The filter accepts the following options:
  2154. @table @option
  2155. @item frequency, f
  2156. Set the filter's central frequency. Default is @code{3000}.
  2157. @item csg
  2158. Constant skirt gain if set to 1. Defaults to 0.
  2159. @item width_type, t
  2160. Set method to specify band-width of filter.
  2161. @table @option
  2162. @item h
  2163. Hz
  2164. @item q
  2165. Q-Factor
  2166. @item o
  2167. octave
  2168. @item s
  2169. slope
  2170. @item k
  2171. kHz
  2172. @end table
  2173. @item width, w
  2174. Specify the band-width of a filter in width_type units.
  2175. @item mix, m
  2176. How much to use filtered signal in output. Default is 1.
  2177. Range is between 0 and 1.
  2178. @item channels, c
  2179. Specify which channels to filter, by default all available are filtered.
  2180. @item normalize, n
  2181. Normalize biquad coefficients, by default is disabled.
  2182. Enabling it will normalize magnitude response at DC to 0dB.
  2183. @item transform, a
  2184. Set transform type of IIR filter.
  2185. @table @option
  2186. @item di
  2187. @item dii
  2188. @item tdii
  2189. @item latt
  2190. @end table
  2191. @end table
  2192. @subsection Commands
  2193. This filter supports the following commands:
  2194. @table @option
  2195. @item frequency, f
  2196. Change bandpass frequency.
  2197. Syntax for the command is : "@var{frequency}"
  2198. @item width_type, t
  2199. Change bandpass width_type.
  2200. Syntax for the command is : "@var{width_type}"
  2201. @item width, w
  2202. Change bandpass width.
  2203. Syntax for the command is : "@var{width}"
  2204. @item mix, m
  2205. Change bandpass mix.
  2206. Syntax for the command is : "@var{mix}"
  2207. @end table
  2208. @section bandreject
  2209. Apply a two-pole Butterworth band-reject filter with central
  2210. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2211. The filter roll off at 6dB per octave (20dB per decade).
  2212. The filter accepts the following options:
  2213. @table @option
  2214. @item frequency, f
  2215. Set the filter's central frequency. Default is @code{3000}.
  2216. @item width_type, t
  2217. Set method to specify band-width of filter.
  2218. @table @option
  2219. @item h
  2220. Hz
  2221. @item q
  2222. Q-Factor
  2223. @item o
  2224. octave
  2225. @item s
  2226. slope
  2227. @item k
  2228. kHz
  2229. @end table
  2230. @item width, w
  2231. Specify the band-width of a filter in width_type units.
  2232. @item mix, m
  2233. How much to use filtered signal in output. Default is 1.
  2234. Range is between 0 and 1.
  2235. @item channels, c
  2236. Specify which channels to filter, by default all available are filtered.
  2237. @item normalize, n
  2238. Normalize biquad coefficients, by default is disabled.
  2239. Enabling it will normalize magnitude response at DC to 0dB.
  2240. @item transform, a
  2241. Set transform type of IIR filter.
  2242. @table @option
  2243. @item di
  2244. @item dii
  2245. @item tdii
  2246. @item latt
  2247. @end table
  2248. @end table
  2249. @subsection Commands
  2250. This filter supports the following commands:
  2251. @table @option
  2252. @item frequency, f
  2253. Change bandreject frequency.
  2254. Syntax for the command is : "@var{frequency}"
  2255. @item width_type, t
  2256. Change bandreject width_type.
  2257. Syntax for the command is : "@var{width_type}"
  2258. @item width, w
  2259. Change bandreject width.
  2260. Syntax for the command is : "@var{width}"
  2261. @item mix, m
  2262. Change bandreject mix.
  2263. Syntax for the command is : "@var{mix}"
  2264. @end table
  2265. @section bass, lowshelf
  2266. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2267. shelving filter with a response similar to that of a standard
  2268. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2269. The filter accepts the following options:
  2270. @table @option
  2271. @item gain, g
  2272. Give the gain at 0 Hz. Its useful range is about -20
  2273. (for a large cut) to +20 (for a large boost).
  2274. Beware of clipping when using a positive gain.
  2275. @item frequency, f
  2276. Set the filter's central frequency and so can be used
  2277. to extend or reduce the frequency range to be boosted or cut.
  2278. The default value is @code{100} Hz.
  2279. @item width_type, t
  2280. Set method to specify band-width of filter.
  2281. @table @option
  2282. @item h
  2283. Hz
  2284. @item q
  2285. Q-Factor
  2286. @item o
  2287. octave
  2288. @item s
  2289. slope
  2290. @item k
  2291. kHz
  2292. @end table
  2293. @item width, w
  2294. Determine how steep is the filter's shelf transition.
  2295. @item mix, m
  2296. How much to use filtered signal in output. Default is 1.
  2297. Range is between 0 and 1.
  2298. @item channels, c
  2299. Specify which channels to filter, by default all available are filtered.
  2300. @item normalize, n
  2301. Normalize biquad coefficients, by default is disabled.
  2302. Enabling it will normalize magnitude response at DC to 0dB.
  2303. @item transform, a
  2304. Set transform type of IIR filter.
  2305. @table @option
  2306. @item di
  2307. @item dii
  2308. @item tdii
  2309. @item latt
  2310. @end table
  2311. @end table
  2312. @subsection Commands
  2313. This filter supports the following commands:
  2314. @table @option
  2315. @item frequency, f
  2316. Change bass frequency.
  2317. Syntax for the command is : "@var{frequency}"
  2318. @item width_type, t
  2319. Change bass width_type.
  2320. Syntax for the command is : "@var{width_type}"
  2321. @item width, w
  2322. Change bass width.
  2323. Syntax for the command is : "@var{width}"
  2324. @item gain, g
  2325. Change bass gain.
  2326. Syntax for the command is : "@var{gain}"
  2327. @item mix, m
  2328. Change bass mix.
  2329. Syntax for the command is : "@var{mix}"
  2330. @end table
  2331. @section biquad
  2332. Apply a biquad IIR filter with the given coefficients.
  2333. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2334. are the numerator and denominator coefficients respectively.
  2335. and @var{channels}, @var{c} specify which channels to filter, by default all
  2336. available are filtered.
  2337. @subsection Commands
  2338. This filter supports the following commands:
  2339. @table @option
  2340. @item a0
  2341. @item a1
  2342. @item a2
  2343. @item b0
  2344. @item b1
  2345. @item b2
  2346. Change biquad parameter.
  2347. Syntax for the command is : "@var{value}"
  2348. @item mix, m
  2349. How much to use filtered signal in output. Default is 1.
  2350. Range is between 0 and 1.
  2351. @item channels, c
  2352. Specify which channels to filter, by default all available are filtered.
  2353. @item normalize, n
  2354. Normalize biquad coefficients, by default is disabled.
  2355. Enabling it will normalize magnitude response at DC to 0dB.
  2356. @item transform, a
  2357. Set transform type of IIR filter.
  2358. @table @option
  2359. @item di
  2360. @item dii
  2361. @item tdii
  2362. @item latt
  2363. @end table
  2364. @end table
  2365. @section bs2b
  2366. Bauer stereo to binaural transformation, which improves headphone listening of
  2367. stereo audio records.
  2368. To enable compilation of this filter you need to configure FFmpeg with
  2369. @code{--enable-libbs2b}.
  2370. It accepts the following parameters:
  2371. @table @option
  2372. @item profile
  2373. Pre-defined crossfeed level.
  2374. @table @option
  2375. @item default
  2376. Default level (fcut=700, feed=50).
  2377. @item cmoy
  2378. Chu Moy circuit (fcut=700, feed=60).
  2379. @item jmeier
  2380. Jan Meier circuit (fcut=650, feed=95).
  2381. @end table
  2382. @item fcut
  2383. Cut frequency (in Hz).
  2384. @item feed
  2385. Feed level (in Hz).
  2386. @end table
  2387. @section channelmap
  2388. Remap input channels to new locations.
  2389. It accepts the following parameters:
  2390. @table @option
  2391. @item map
  2392. Map channels from input to output. The argument is a '|'-separated list of
  2393. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2394. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2395. channel (e.g. FL for front left) or its index in the input channel layout.
  2396. @var{out_channel} is the name of the output channel or its index in the output
  2397. channel layout. If @var{out_channel} is not given then it is implicitly an
  2398. index, starting with zero and increasing by one for each mapping.
  2399. @item channel_layout
  2400. The channel layout of the output stream.
  2401. @end table
  2402. If no mapping is present, the filter will implicitly map input channels to
  2403. output channels, preserving indices.
  2404. @subsection Examples
  2405. @itemize
  2406. @item
  2407. For example, assuming a 5.1+downmix input MOV file,
  2408. @example
  2409. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2410. @end example
  2411. will create an output WAV file tagged as stereo from the downmix channels of
  2412. the input.
  2413. @item
  2414. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2415. @example
  2416. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2417. @end example
  2418. @end itemize
  2419. @section channelsplit
  2420. Split each channel from an input audio stream into a separate output stream.
  2421. It accepts the following parameters:
  2422. @table @option
  2423. @item channel_layout
  2424. The channel layout of the input stream. The default is "stereo".
  2425. @item channels
  2426. A channel layout describing the channels to be extracted as separate output streams
  2427. or "all" to extract each input channel as a separate stream. The default is "all".
  2428. Choosing channels not present in channel layout in the input will result in an error.
  2429. @end table
  2430. @subsection Examples
  2431. @itemize
  2432. @item
  2433. For example, assuming a stereo input MP3 file,
  2434. @example
  2435. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2436. @end example
  2437. will create an output Matroska file with two audio streams, one containing only
  2438. the left channel and the other the right channel.
  2439. @item
  2440. Split a 5.1 WAV file into per-channel files:
  2441. @example
  2442. ffmpeg -i in.wav -filter_complex
  2443. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2444. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2445. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2446. side_right.wav
  2447. @end example
  2448. @item
  2449. Extract only LFE from a 5.1 WAV file:
  2450. @example
  2451. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2452. -map '[LFE]' lfe.wav
  2453. @end example
  2454. @end itemize
  2455. @section chorus
  2456. Add a chorus effect to the audio.
  2457. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2458. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2459. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2460. The modulation depth defines the range the modulated delay is played before or after
  2461. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2462. sound tuned around the original one, like in a chorus where some vocals are slightly
  2463. off key.
  2464. It accepts the following parameters:
  2465. @table @option
  2466. @item in_gain
  2467. Set input gain. Default is 0.4.
  2468. @item out_gain
  2469. Set output gain. Default is 0.4.
  2470. @item delays
  2471. Set delays. A typical delay is around 40ms to 60ms.
  2472. @item decays
  2473. Set decays.
  2474. @item speeds
  2475. Set speeds.
  2476. @item depths
  2477. Set depths.
  2478. @end table
  2479. @subsection Examples
  2480. @itemize
  2481. @item
  2482. A single delay:
  2483. @example
  2484. chorus=0.7:0.9:55:0.4:0.25:2
  2485. @end example
  2486. @item
  2487. Two delays:
  2488. @example
  2489. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2490. @end example
  2491. @item
  2492. Fuller sounding chorus with three delays:
  2493. @example
  2494. 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
  2495. @end example
  2496. @end itemize
  2497. @section compand
  2498. Compress or expand the audio's dynamic range.
  2499. It accepts the following parameters:
  2500. @table @option
  2501. @item attacks
  2502. @item decays
  2503. A list of times in seconds for each channel over which the instantaneous level
  2504. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2505. increase of volume and @var{decays} refers to decrease of volume. For most
  2506. situations, the attack time (response to the audio getting louder) should be
  2507. shorter than the decay time, because the human ear is more sensitive to sudden
  2508. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2509. a typical value for decay is 0.8 seconds.
  2510. If specified number of attacks & decays is lower than number of channels, the last
  2511. set attack/decay will be used for all remaining channels.
  2512. @item points
  2513. A list of points for the transfer function, specified in dB relative to the
  2514. maximum possible signal amplitude. Each key points list must be defined using
  2515. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2516. @code{x0/y0 x1/y1 x2/y2 ....}
  2517. The input values must be in strictly increasing order but the transfer function
  2518. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2519. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2520. function are @code{-70/-70|-60/-20|1/0}.
  2521. @item soft-knee
  2522. Set the curve radius in dB for all joints. It defaults to 0.01.
  2523. @item gain
  2524. Set the additional gain in dB to be applied at all points on the transfer
  2525. function. This allows for easy adjustment of the overall gain.
  2526. It defaults to 0.
  2527. @item volume
  2528. Set an initial volume, in dB, to be assumed for each channel when filtering
  2529. starts. This permits the user to supply a nominal level initially, so that, for
  2530. example, a very large gain is not applied to initial signal levels before the
  2531. companding has begun to operate. A typical value for audio which is initially
  2532. quiet is -90 dB. It defaults to 0.
  2533. @item delay
  2534. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2535. delayed before being fed to the volume adjuster. Specifying a delay
  2536. approximately equal to the attack/decay times allows the filter to effectively
  2537. operate in predictive rather than reactive mode. It defaults to 0.
  2538. @end table
  2539. @subsection Examples
  2540. @itemize
  2541. @item
  2542. Make music with both quiet and loud passages suitable for listening to in a
  2543. noisy environment:
  2544. @example
  2545. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2546. @end example
  2547. Another example for audio with whisper and explosion parts:
  2548. @example
  2549. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2550. @end example
  2551. @item
  2552. A noise gate for when the noise is at a lower level than the signal:
  2553. @example
  2554. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2555. @end example
  2556. @item
  2557. Here is another noise gate, this time for when the noise is at a higher level
  2558. than the signal (making it, in some ways, similar to squelch):
  2559. @example
  2560. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2561. @end example
  2562. @item
  2563. 2:1 compression starting at -6dB:
  2564. @example
  2565. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2566. @end example
  2567. @item
  2568. 2:1 compression starting at -9dB:
  2569. @example
  2570. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2571. @end example
  2572. @item
  2573. 2:1 compression starting at -12dB:
  2574. @example
  2575. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2576. @end example
  2577. @item
  2578. 2:1 compression starting at -18dB:
  2579. @example
  2580. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2581. @end example
  2582. @item
  2583. 3:1 compression starting at -15dB:
  2584. @example
  2585. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2586. @end example
  2587. @item
  2588. Compressor/Gate:
  2589. @example
  2590. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2591. @end example
  2592. @item
  2593. Expander:
  2594. @example
  2595. 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
  2596. @end example
  2597. @item
  2598. Hard limiter at -6dB:
  2599. @example
  2600. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2601. @end example
  2602. @item
  2603. Hard limiter at -12dB:
  2604. @example
  2605. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2606. @end example
  2607. @item
  2608. Hard noise gate at -35 dB:
  2609. @example
  2610. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2611. @end example
  2612. @item
  2613. Soft limiter:
  2614. @example
  2615. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2616. @end example
  2617. @end itemize
  2618. @section compensationdelay
  2619. Compensation Delay Line is a metric based delay to compensate differing
  2620. positions of microphones or speakers.
  2621. For example, you have recorded guitar with two microphones placed in
  2622. different locations. Because the front of sound wave has fixed speed in
  2623. normal conditions, the phasing of microphones can vary and depends on
  2624. their location and interposition. The best sound mix can be achieved when
  2625. these microphones are in phase (synchronized). Note that a distance of
  2626. ~30 cm between microphones makes one microphone capture the signal in
  2627. antiphase to the other microphone. That makes the final mix sound moody.
  2628. This filter helps to solve phasing problems by adding different delays
  2629. to each microphone track and make them synchronized.
  2630. The best result can be reached when you take one track as base and
  2631. synchronize other tracks one by one with it.
  2632. Remember that synchronization/delay tolerance depends on sample rate, too.
  2633. Higher sample rates will give more tolerance.
  2634. The filter accepts the following parameters:
  2635. @table @option
  2636. @item mm
  2637. Set millimeters distance. This is compensation distance for fine tuning.
  2638. Default is 0.
  2639. @item cm
  2640. Set cm distance. This is compensation distance for tightening distance setup.
  2641. Default is 0.
  2642. @item m
  2643. Set meters distance. This is compensation distance for hard distance setup.
  2644. Default is 0.
  2645. @item dry
  2646. Set dry amount. Amount of unprocessed (dry) signal.
  2647. Default is 0.
  2648. @item wet
  2649. Set wet amount. Amount of processed (wet) signal.
  2650. Default is 1.
  2651. @item temp
  2652. Set temperature in degrees Celsius. This is the temperature of the environment.
  2653. Default is 20.
  2654. @end table
  2655. @section crossfeed
  2656. Apply headphone crossfeed filter.
  2657. Crossfeed is the process of blending the left and right channels of stereo
  2658. audio recording.
  2659. It is mainly used to reduce extreme stereo separation of low frequencies.
  2660. The intent is to produce more speaker like sound to the listener.
  2661. The filter accepts the following options:
  2662. @table @option
  2663. @item strength
  2664. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2665. This sets gain of low shelf filter for side part of stereo image.
  2666. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2667. @item range
  2668. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2669. This sets cut off frequency of low shelf filter. Default is cut off near
  2670. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2671. @item slope
  2672. Set curve slope of low shelf filter. Default is 0.5.
  2673. Allowed range is from 0.01 to 1.
  2674. @item level_in
  2675. Set input gain. Default is 0.9.
  2676. @item level_out
  2677. Set output gain. Default is 1.
  2678. @end table
  2679. @subsection Commands
  2680. This filter supports the all above options as @ref{commands}.
  2681. @section crystalizer
  2682. Simple algorithm to expand audio dynamic range.
  2683. The filter accepts the following options:
  2684. @table @option
  2685. @item i
  2686. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2687. (unchanged sound) to 10.0 (maximum effect).
  2688. @item c
  2689. Enable clipping. By default is enabled.
  2690. @end table
  2691. @subsection Commands
  2692. This filter supports the all above options as @ref{commands}.
  2693. @section dcshift
  2694. Apply a DC shift to the audio.
  2695. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2696. in the recording chain) from the audio. The effect of a DC offset is reduced
  2697. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2698. a signal has a DC offset.
  2699. @table @option
  2700. @item shift
  2701. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2702. the audio.
  2703. @item limitergain
  2704. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2705. used to prevent clipping.
  2706. @end table
  2707. @section deesser
  2708. Apply de-essing to the audio samples.
  2709. @table @option
  2710. @item i
  2711. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2712. Default is 0.
  2713. @item m
  2714. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2715. Default is 0.5.
  2716. @item f
  2717. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2718. Default is 0.5.
  2719. @item s
  2720. Set the output mode.
  2721. It accepts the following values:
  2722. @table @option
  2723. @item i
  2724. Pass input unchanged.
  2725. @item o
  2726. Pass ess filtered out.
  2727. @item e
  2728. Pass only ess.
  2729. Default value is @var{o}.
  2730. @end table
  2731. @end table
  2732. @section drmeter
  2733. Measure audio dynamic range.
  2734. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2735. is found in transition material. And anything less that 8 have very poor dynamics
  2736. and is very compressed.
  2737. The filter accepts the following options:
  2738. @table @option
  2739. @item length
  2740. Set window length in seconds used to split audio into segments of equal length.
  2741. Default is 3 seconds.
  2742. @end table
  2743. @section dynaudnorm
  2744. Dynamic Audio Normalizer.
  2745. This filter applies a certain amount of gain to the input audio in order
  2746. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2747. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2748. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2749. This allows for applying extra gain to the "quiet" sections of the audio
  2750. while avoiding distortions or clipping the "loud" sections. In other words:
  2751. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2752. sections, in the sense that the volume of each section is brought to the
  2753. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2754. this goal *without* applying "dynamic range compressing". It will retain 100%
  2755. of the dynamic range *within* each section of the audio file.
  2756. @table @option
  2757. @item framelen, f
  2758. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2759. Default is 500 milliseconds.
  2760. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2761. referred to as frames. This is required, because a peak magnitude has no
  2762. meaning for just a single sample value. Instead, we need to determine the
  2763. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2764. normalizer would simply use the peak magnitude of the complete file, the
  2765. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2766. frame. The length of a frame is specified in milliseconds. By default, the
  2767. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2768. been found to give good results with most files.
  2769. Note that the exact frame length, in number of samples, will be determined
  2770. automatically, based on the sampling rate of the individual input audio file.
  2771. @item gausssize, g
  2772. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2773. number. Default is 31.
  2774. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2775. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2776. is specified in frames, centered around the current frame. For the sake of
  2777. simplicity, this must be an odd number. Consequently, the default value of 31
  2778. takes into account the current frame, as well as the 15 preceding frames and
  2779. the 15 subsequent frames. Using a larger window results in a stronger
  2780. smoothing effect and thus in less gain variation, i.e. slower gain
  2781. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2782. effect and thus in more gain variation, i.e. faster gain adaptation.
  2783. In other words, the more you increase this value, the more the Dynamic Audio
  2784. Normalizer will behave like a "traditional" normalization filter. On the
  2785. contrary, the more you decrease this value, the more the Dynamic Audio
  2786. Normalizer will behave like a dynamic range compressor.
  2787. @item peak, p
  2788. Set the target peak value. This specifies the highest permissible magnitude
  2789. level for the normalized audio input. This filter will try to approach the
  2790. target peak magnitude as closely as possible, but at the same time it also
  2791. makes sure that the normalized signal will never exceed the peak magnitude.
  2792. A frame's maximum local gain factor is imposed directly by the target peak
  2793. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2794. It is not recommended to go above this value.
  2795. @item maxgain, m
  2796. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2797. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2798. factor for each input frame, i.e. the maximum gain factor that does not
  2799. result in clipping or distortion. The maximum gain factor is determined by
  2800. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2801. additionally bounds the frame's maximum gain factor by a predetermined
  2802. (global) maximum gain factor. This is done in order to avoid excessive gain
  2803. factors in "silent" or almost silent frames. By default, the maximum gain
  2804. factor is 10.0, For most inputs the default value should be sufficient and
  2805. it usually is not recommended to increase this value. Though, for input
  2806. with an extremely low overall volume level, it may be necessary to allow even
  2807. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2808. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2809. Instead, a "sigmoid" threshold function will be applied. This way, the
  2810. gain factors will smoothly approach the threshold value, but never exceed that
  2811. value.
  2812. @item targetrms, r
  2813. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2814. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2815. This means that the maximum local gain factor for each frame is defined
  2816. (only) by the frame's highest magnitude sample. This way, the samples can
  2817. be amplified as much as possible without exceeding the maximum signal
  2818. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2819. Normalizer can also take into account the frame's root mean square,
  2820. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2821. determine the power of a time-varying signal. It is therefore considered
  2822. that the RMS is a better approximation of the "perceived loudness" than
  2823. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2824. frames to a constant RMS value, a uniform "perceived loudness" can be
  2825. established. If a target RMS value has been specified, a frame's local gain
  2826. factor is defined as the factor that would result in exactly that RMS value.
  2827. Note, however, that the maximum local gain factor is still restricted by the
  2828. frame's highest magnitude sample, in order to prevent clipping.
  2829. @item coupling, n
  2830. Enable channels coupling. By default is enabled.
  2831. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2832. amount. This means the same gain factor will be applied to all channels, i.e.
  2833. the maximum possible gain factor is determined by the "loudest" channel.
  2834. However, in some recordings, it may happen that the volume of the different
  2835. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2836. In this case, this option can be used to disable the channel coupling. This way,
  2837. the gain factor will be determined independently for each channel, depending
  2838. only on the individual channel's highest magnitude sample. This allows for
  2839. harmonizing the volume of the different channels.
  2840. @item correctdc, c
  2841. Enable DC bias correction. By default is disabled.
  2842. An audio signal (in the time domain) is a sequence of sample values.
  2843. In the Dynamic Audio Normalizer these sample values are represented in the
  2844. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2845. audio signal, or "waveform", should be centered around the zero point.
  2846. That means if we calculate the mean value of all samples in a file, or in a
  2847. single frame, then the result should be 0.0 or at least very close to that
  2848. value. If, however, there is a significant deviation of the mean value from
  2849. 0.0, in either positive or negative direction, this is referred to as a
  2850. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2851. Audio Normalizer provides optional DC bias correction.
  2852. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2853. the mean value, or "DC correction" offset, of each input frame and subtract
  2854. that value from all of the frame's sample values which ensures those samples
  2855. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2856. boundaries, the DC correction offset values will be interpolated smoothly
  2857. between neighbouring frames.
  2858. @item altboundary, b
  2859. Enable alternative boundary mode. By default is disabled.
  2860. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2861. around each frame. This includes the preceding frames as well as the
  2862. subsequent frames. However, for the "boundary" frames, located at the very
  2863. beginning and at the very end of the audio file, not all neighbouring
  2864. frames are available. In particular, for the first few frames in the audio
  2865. file, the preceding frames are not known. And, similarly, for the last few
  2866. frames in the audio file, the subsequent frames are not known. Thus, the
  2867. question arises which gain factors should be assumed for the missing frames
  2868. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2869. to deal with this situation. The default boundary mode assumes a gain factor
  2870. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2871. "fade out" at the beginning and at the end of the input, respectively.
  2872. @item compress, s
  2873. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2874. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2875. compression. This means that signal peaks will not be pruned and thus the
  2876. full dynamic range will be retained within each local neighbourhood. However,
  2877. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2878. normalization algorithm with a more "traditional" compression.
  2879. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2880. (thresholding) function. If (and only if) the compression feature is enabled,
  2881. all input frames will be processed by a soft knee thresholding function prior
  2882. to the actual normalization process. Put simply, the thresholding function is
  2883. going to prune all samples whose magnitude exceeds a certain threshold value.
  2884. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2885. value. Instead, the threshold value will be adjusted for each individual
  2886. frame.
  2887. In general, smaller parameters result in stronger compression, and vice versa.
  2888. Values below 3.0 are not recommended, because audible distortion may appear.
  2889. @item threshold, t
  2890. Set the target threshold value. This specifies the lowest permissible
  2891. magnitude level for the audio input which will be normalized.
  2892. If input frame volume is above this value frame will be normalized.
  2893. Otherwise frame may not be normalized at all. The default value is set
  2894. to 0, which means all input frames will be normalized.
  2895. This option is mostly useful if digital noise is not wanted to be amplified.
  2896. @end table
  2897. @subsection Commands
  2898. This filter supports the all above options as @ref{commands}.
  2899. @section earwax
  2900. Make audio easier to listen to on headphones.
  2901. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2902. so that when listened to on headphones the stereo image is moved from
  2903. inside your head (standard for headphones) to outside and in front of
  2904. the listener (standard for speakers).
  2905. Ported from SoX.
  2906. @section equalizer
  2907. Apply a two-pole peaking equalisation (EQ) filter. With this
  2908. filter, the signal-level at and around a selected frequency can
  2909. be increased or decreased, whilst (unlike bandpass and bandreject
  2910. filters) that at all other frequencies is unchanged.
  2911. In order to produce complex equalisation curves, this filter can
  2912. be given several times, each with a different central frequency.
  2913. The filter accepts the following options:
  2914. @table @option
  2915. @item frequency, f
  2916. Set the filter's central frequency in Hz.
  2917. @item width_type, t
  2918. Set method to specify band-width of filter.
  2919. @table @option
  2920. @item h
  2921. Hz
  2922. @item q
  2923. Q-Factor
  2924. @item o
  2925. octave
  2926. @item s
  2927. slope
  2928. @item k
  2929. kHz
  2930. @end table
  2931. @item width, w
  2932. Specify the band-width of a filter in width_type units.
  2933. @item gain, g
  2934. Set the required gain or attenuation in dB.
  2935. Beware of clipping when using a positive gain.
  2936. @item mix, m
  2937. How much to use filtered signal in output. Default is 1.
  2938. Range is between 0 and 1.
  2939. @item channels, c
  2940. Specify which channels to filter, by default all available are filtered.
  2941. @item normalize, n
  2942. Normalize biquad coefficients, by default is disabled.
  2943. Enabling it will normalize magnitude response at DC to 0dB.
  2944. @item transform, a
  2945. Set transform type of IIR filter.
  2946. @table @option
  2947. @item di
  2948. @item dii
  2949. @item tdii
  2950. @item latt
  2951. @end table
  2952. @end table
  2953. @subsection Examples
  2954. @itemize
  2955. @item
  2956. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2957. @example
  2958. equalizer=f=1000:t=h:width=200:g=-10
  2959. @end example
  2960. @item
  2961. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2962. @example
  2963. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2964. @end example
  2965. @end itemize
  2966. @subsection Commands
  2967. This filter supports the following commands:
  2968. @table @option
  2969. @item frequency, f
  2970. Change equalizer frequency.
  2971. Syntax for the command is : "@var{frequency}"
  2972. @item width_type, t
  2973. Change equalizer width_type.
  2974. Syntax for the command is : "@var{width_type}"
  2975. @item width, w
  2976. Change equalizer width.
  2977. Syntax for the command is : "@var{width}"
  2978. @item gain, g
  2979. Change equalizer gain.
  2980. Syntax for the command is : "@var{gain}"
  2981. @item mix, m
  2982. Change equalizer mix.
  2983. Syntax for the command is : "@var{mix}"
  2984. @end table
  2985. @section extrastereo
  2986. Linearly increases the difference between left and right channels which
  2987. adds some sort of "live" effect to playback.
  2988. The filter accepts the following options:
  2989. @table @option
  2990. @item m
  2991. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2992. (average of both channels), with 1.0 sound will be unchanged, with
  2993. -1.0 left and right channels will be swapped.
  2994. @item c
  2995. Enable clipping. By default is enabled.
  2996. @end table
  2997. @subsection Commands
  2998. This filter supports the all above options as @ref{commands}.
  2999. @section firequalizer
  3000. Apply FIR Equalization using arbitrary frequency response.
  3001. The filter accepts the following option:
  3002. @table @option
  3003. @item gain
  3004. Set gain curve equation (in dB). The expression can contain variables:
  3005. @table @option
  3006. @item f
  3007. the evaluated frequency
  3008. @item sr
  3009. sample rate
  3010. @item ch
  3011. channel number, set to 0 when multichannels evaluation is disabled
  3012. @item chid
  3013. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3014. multichannels evaluation is disabled
  3015. @item chs
  3016. number of channels
  3017. @item chlayout
  3018. channel_layout, see libavutil/channel_layout.h
  3019. @end table
  3020. and functions:
  3021. @table @option
  3022. @item gain_interpolate(f)
  3023. interpolate gain on frequency f based on gain_entry
  3024. @item cubic_interpolate(f)
  3025. same as gain_interpolate, but smoother
  3026. @end table
  3027. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3028. @item gain_entry
  3029. Set gain entry for gain_interpolate function. The expression can
  3030. contain functions:
  3031. @table @option
  3032. @item entry(f, g)
  3033. store gain entry at frequency f with value g
  3034. @end table
  3035. This option is also available as command.
  3036. @item delay
  3037. Set filter delay in seconds. Higher value means more accurate.
  3038. Default is @code{0.01}.
  3039. @item accuracy
  3040. Set filter accuracy in Hz. Lower value means more accurate.
  3041. Default is @code{5}.
  3042. @item wfunc
  3043. Set window function. Acceptable values are:
  3044. @table @option
  3045. @item rectangular
  3046. rectangular window, useful when gain curve is already smooth
  3047. @item hann
  3048. hann window (default)
  3049. @item hamming
  3050. hamming window
  3051. @item blackman
  3052. blackman window
  3053. @item nuttall3
  3054. 3-terms continuous 1st derivative nuttall window
  3055. @item mnuttall3
  3056. minimum 3-terms discontinuous nuttall window
  3057. @item nuttall
  3058. 4-terms continuous 1st derivative nuttall window
  3059. @item bnuttall
  3060. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3061. @item bharris
  3062. blackman-harris window
  3063. @item tukey
  3064. tukey window
  3065. @end table
  3066. @item fixed
  3067. If enabled, use fixed number of audio samples. This improves speed when
  3068. filtering with large delay. Default is disabled.
  3069. @item multi
  3070. Enable multichannels evaluation on gain. Default is disabled.
  3071. @item zero_phase
  3072. Enable zero phase mode by subtracting timestamp to compensate delay.
  3073. Default is disabled.
  3074. @item scale
  3075. Set scale used by gain. Acceptable values are:
  3076. @table @option
  3077. @item linlin
  3078. linear frequency, linear gain
  3079. @item linlog
  3080. linear frequency, logarithmic (in dB) gain (default)
  3081. @item loglin
  3082. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3083. @item loglog
  3084. logarithmic frequency, logarithmic gain
  3085. @end table
  3086. @item dumpfile
  3087. Set file for dumping, suitable for gnuplot.
  3088. @item dumpscale
  3089. Set scale for dumpfile. Acceptable values are same with scale option.
  3090. Default is linlog.
  3091. @item fft2
  3092. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3093. Default is disabled.
  3094. @item min_phase
  3095. Enable minimum phase impulse response. Default is disabled.
  3096. @end table
  3097. @subsection Examples
  3098. @itemize
  3099. @item
  3100. lowpass at 1000 Hz:
  3101. @example
  3102. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3103. @end example
  3104. @item
  3105. lowpass at 1000 Hz with gain_entry:
  3106. @example
  3107. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3108. @end example
  3109. @item
  3110. custom equalization:
  3111. @example
  3112. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3113. @end example
  3114. @item
  3115. higher delay with zero phase to compensate delay:
  3116. @example
  3117. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3118. @end example
  3119. @item
  3120. lowpass on left channel, highpass on right channel:
  3121. @example
  3122. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3123. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3124. @end example
  3125. @end itemize
  3126. @section flanger
  3127. Apply a flanging effect to the audio.
  3128. The filter accepts the following options:
  3129. @table @option
  3130. @item delay
  3131. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3132. @item depth
  3133. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3134. @item regen
  3135. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3136. Default value is 0.
  3137. @item width
  3138. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3139. Default value is 71.
  3140. @item speed
  3141. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3142. @item shape
  3143. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3144. Default value is @var{sinusoidal}.
  3145. @item phase
  3146. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3147. Default value is 25.
  3148. @item interp
  3149. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3150. Default is @var{linear}.
  3151. @end table
  3152. @section haas
  3153. Apply Haas effect to audio.
  3154. Note that this makes most sense to apply on mono signals.
  3155. With this filter applied to mono signals it give some directionality and
  3156. stretches its stereo image.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item level_in
  3160. Set input level. By default is @var{1}, or 0dB
  3161. @item level_out
  3162. Set output level. By default is @var{1}, or 0dB.
  3163. @item side_gain
  3164. Set gain applied to side part of signal. By default is @var{1}.
  3165. @item middle_source
  3166. Set kind of middle source. Can be one of the following:
  3167. @table @samp
  3168. @item left
  3169. Pick left channel.
  3170. @item right
  3171. Pick right channel.
  3172. @item mid
  3173. Pick middle part signal of stereo image.
  3174. @item side
  3175. Pick side part signal of stereo image.
  3176. @end table
  3177. @item middle_phase
  3178. Change middle phase. By default is disabled.
  3179. @item left_delay
  3180. Set left channel delay. By default is @var{2.05} milliseconds.
  3181. @item left_balance
  3182. Set left channel balance. By default is @var{-1}.
  3183. @item left_gain
  3184. Set left channel gain. By default is @var{1}.
  3185. @item left_phase
  3186. Change left phase. By default is disabled.
  3187. @item right_delay
  3188. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3189. @item right_balance
  3190. Set right channel balance. By default is @var{1}.
  3191. @item right_gain
  3192. Set right channel gain. By default is @var{1}.
  3193. @item right_phase
  3194. Change right phase. By default is enabled.
  3195. @end table
  3196. @section hdcd
  3197. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3198. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3199. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3200. of HDCD, and detects the Transient Filter flag.
  3201. @example
  3202. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3203. @end example
  3204. When using the filter with wav, note the default encoding for wav is 16-bit,
  3205. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3206. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3207. @example
  3208. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3209. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3210. @end example
  3211. The filter accepts the following options:
  3212. @table @option
  3213. @item disable_autoconvert
  3214. Disable any automatic format conversion or resampling in the filter graph.
  3215. @item process_stereo
  3216. Process the stereo channels together. If target_gain does not match between
  3217. channels, consider it invalid and use the last valid target_gain.
  3218. @item cdt_ms
  3219. Set the code detect timer period in ms.
  3220. @item force_pe
  3221. Always extend peaks above -3dBFS even if PE isn't signaled.
  3222. @item analyze_mode
  3223. Replace audio with a solid tone and adjust the amplitude to signal some
  3224. specific aspect of the decoding process. The output file can be loaded in
  3225. an audio editor alongside the original to aid analysis.
  3226. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3227. Modes are:
  3228. @table @samp
  3229. @item 0, off
  3230. Disabled
  3231. @item 1, lle
  3232. Gain adjustment level at each sample
  3233. @item 2, pe
  3234. Samples where peak extend occurs
  3235. @item 3, cdt
  3236. Samples where the code detect timer is active
  3237. @item 4, tgm
  3238. Samples where the target gain does not match between channels
  3239. @end table
  3240. @end table
  3241. @section headphone
  3242. Apply head-related transfer functions (HRTFs) to create virtual
  3243. loudspeakers around the user for binaural listening via headphones.
  3244. The HRIRs are provided via additional streams, for each channel
  3245. one stereo input stream is needed.
  3246. The filter accepts the following options:
  3247. @table @option
  3248. @item map
  3249. Set mapping of input streams for convolution.
  3250. The argument is a '|'-separated list of channel names in order as they
  3251. are given as additional stream inputs for filter.
  3252. This also specify number of input streams. Number of input streams
  3253. must be not less than number of channels in first stream plus one.
  3254. @item gain
  3255. Set gain applied to audio. Value is in dB. Default is 0.
  3256. @item type
  3257. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3258. processing audio in time domain which is slow.
  3259. @var{freq} is processing audio in frequency domain which is fast.
  3260. Default is @var{freq}.
  3261. @item lfe
  3262. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3263. @item size
  3264. Set size of frame in number of samples which will be processed at once.
  3265. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3266. @item hrir
  3267. Set format of hrir stream.
  3268. Default value is @var{stereo}. Alternative value is @var{multich}.
  3269. If value is set to @var{stereo}, number of additional streams should
  3270. be greater or equal to number of input channels in first input stream.
  3271. Also each additional stream should have stereo number of channels.
  3272. If value is set to @var{multich}, number of additional streams should
  3273. be exactly one. Also number of input channels of additional stream
  3274. should be equal or greater than twice number of channels of first input
  3275. stream.
  3276. @end table
  3277. @subsection Examples
  3278. @itemize
  3279. @item
  3280. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3281. each amovie filter use stereo file with IR coefficients as input.
  3282. The files give coefficients for each position of virtual loudspeaker:
  3283. @example
  3284. ffmpeg -i input.wav
  3285. -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"
  3286. output.wav
  3287. @end example
  3288. @item
  3289. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3290. but now in @var{multich} @var{hrir} format.
  3291. @example
  3292. 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"
  3293. output.wav
  3294. @end example
  3295. @end itemize
  3296. @section highpass
  3297. Apply a high-pass filter with 3dB point frequency.
  3298. The filter can be either single-pole, or double-pole (the default).
  3299. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3300. The filter accepts the following options:
  3301. @table @option
  3302. @item frequency, f
  3303. Set frequency in Hz. Default is 3000.
  3304. @item poles, p
  3305. Set number of poles. Default is 2.
  3306. @item width_type, t
  3307. Set method to specify band-width of filter.
  3308. @table @option
  3309. @item h
  3310. Hz
  3311. @item q
  3312. Q-Factor
  3313. @item o
  3314. octave
  3315. @item s
  3316. slope
  3317. @item k
  3318. kHz
  3319. @end table
  3320. @item width, w
  3321. Specify the band-width of a filter in width_type units.
  3322. Applies only to double-pole filter.
  3323. The default is 0.707q and gives a Butterworth response.
  3324. @item mix, m
  3325. How much to use filtered signal in output. Default is 1.
  3326. Range is between 0 and 1.
  3327. @item channels, c
  3328. Specify which channels to filter, by default all available are filtered.
  3329. @item normalize, n
  3330. Normalize biquad coefficients, by default is disabled.
  3331. Enabling it will normalize magnitude response at DC to 0dB.
  3332. @item transform, a
  3333. Set transform type of IIR filter.
  3334. @table @option
  3335. @item di
  3336. @item dii
  3337. @item tdii
  3338. @item latt
  3339. @end table
  3340. @end table
  3341. @subsection Commands
  3342. This filter supports the following commands:
  3343. @table @option
  3344. @item frequency, f
  3345. Change highpass frequency.
  3346. Syntax for the command is : "@var{frequency}"
  3347. @item width_type, t
  3348. Change highpass width_type.
  3349. Syntax for the command is : "@var{width_type}"
  3350. @item width, w
  3351. Change highpass width.
  3352. Syntax for the command is : "@var{width}"
  3353. @item mix, m
  3354. Change highpass mix.
  3355. Syntax for the command is : "@var{mix}"
  3356. @end table
  3357. @section join
  3358. Join multiple input streams into one multi-channel stream.
  3359. It accepts the following parameters:
  3360. @table @option
  3361. @item inputs
  3362. The number of input streams. It defaults to 2.
  3363. @item channel_layout
  3364. The desired output channel layout. It defaults to stereo.
  3365. @item map
  3366. Map channels from inputs to output. The argument is a '|'-separated list of
  3367. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3368. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3369. can be either the name of the input channel (e.g. FL for front left) or its
  3370. index in the specified input stream. @var{out_channel} is the name of the output
  3371. channel.
  3372. @end table
  3373. The filter will attempt to guess the mappings when they are not specified
  3374. explicitly. It does so by first trying to find an unused matching input channel
  3375. and if that fails it picks the first unused input channel.
  3376. Join 3 inputs (with properly set channel layouts):
  3377. @example
  3378. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3379. @end example
  3380. Build a 5.1 output from 6 single-channel streams:
  3381. @example
  3382. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3383. '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'
  3384. out
  3385. @end example
  3386. @section ladspa
  3387. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3388. To enable compilation of this filter you need to configure FFmpeg with
  3389. @code{--enable-ladspa}.
  3390. @table @option
  3391. @item file, f
  3392. Specifies the name of LADSPA plugin library to load. If the environment
  3393. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3394. each one of the directories specified by the colon separated list in
  3395. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3396. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3397. @file{/usr/lib/ladspa/}.
  3398. @item plugin, p
  3399. Specifies the plugin within the library. Some libraries contain only
  3400. one plugin, but others contain many of them. If this is not set filter
  3401. will list all available plugins within the specified library.
  3402. @item controls, c
  3403. Set the '|' separated list of controls which are zero or more floating point
  3404. values that determine the behavior of the loaded plugin (for example delay,
  3405. threshold or gain).
  3406. Controls need to be defined using the following syntax:
  3407. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3408. @var{valuei} is the value set on the @var{i}-th control.
  3409. Alternatively they can be also defined using the following syntax:
  3410. @var{value0}|@var{value1}|@var{value2}|..., where
  3411. @var{valuei} is the value set on the @var{i}-th control.
  3412. If @option{controls} is set to @code{help}, all available controls and
  3413. their valid ranges are printed.
  3414. @item sample_rate, s
  3415. Specify the sample rate, default to 44100. Only used if plugin have
  3416. zero inputs.
  3417. @item nb_samples, n
  3418. Set the number of samples per channel per each output frame, default
  3419. is 1024. Only used if plugin have zero inputs.
  3420. @item duration, d
  3421. Set the minimum duration of the sourced audio. See
  3422. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3423. for the accepted syntax.
  3424. Note that the resulting duration may be greater than the specified duration,
  3425. as the generated audio is always cut at the end of a complete frame.
  3426. If not specified, or the expressed duration is negative, the audio is
  3427. supposed to be generated forever.
  3428. Only used if plugin have zero inputs.
  3429. @item latency, l
  3430. Enable latency compensation, by default is disabled.
  3431. Only used if plugin have inputs.
  3432. @end table
  3433. @subsection Examples
  3434. @itemize
  3435. @item
  3436. List all available plugins within amp (LADSPA example plugin) library:
  3437. @example
  3438. ladspa=file=amp
  3439. @end example
  3440. @item
  3441. List all available controls and their valid ranges for @code{vcf_notch}
  3442. plugin from @code{VCF} library:
  3443. @example
  3444. ladspa=f=vcf:p=vcf_notch:c=help
  3445. @end example
  3446. @item
  3447. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3448. plugin library:
  3449. @example
  3450. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3451. @end example
  3452. @item
  3453. Add reverberation to the audio using TAP-plugins
  3454. (Tom's Audio Processing plugins):
  3455. @example
  3456. ladspa=file=tap_reverb:tap_reverb
  3457. @end example
  3458. @item
  3459. Generate white noise, with 0.2 amplitude:
  3460. @example
  3461. ladspa=file=cmt:noise_source_white:c=c0=.2
  3462. @end example
  3463. @item
  3464. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3465. @code{C* Audio Plugin Suite} (CAPS) library:
  3466. @example
  3467. ladspa=file=caps:Click:c=c1=20'
  3468. @end example
  3469. @item
  3470. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3471. @example
  3472. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3473. @end example
  3474. @item
  3475. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3476. @code{SWH Plugins} collection:
  3477. @example
  3478. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3479. @end example
  3480. @item
  3481. Attenuate low frequencies using Multiband EQ from Steve Harris
  3482. @code{SWH Plugins} collection:
  3483. @example
  3484. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3485. @end example
  3486. @item
  3487. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3488. (CAPS) library:
  3489. @example
  3490. ladspa=caps:Narrower
  3491. @end example
  3492. @item
  3493. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3494. @example
  3495. ladspa=caps:White:.2
  3496. @end example
  3497. @item
  3498. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3499. @example
  3500. ladspa=caps:Fractal:c=c1=1
  3501. @end example
  3502. @item
  3503. Dynamic volume normalization using @code{VLevel} plugin:
  3504. @example
  3505. ladspa=vlevel-ladspa:vlevel_mono
  3506. @end example
  3507. @end itemize
  3508. @subsection Commands
  3509. This filter supports the following commands:
  3510. @table @option
  3511. @item cN
  3512. Modify the @var{N}-th control value.
  3513. If the specified value is not valid, it is ignored and prior one is kept.
  3514. @end table
  3515. @section loudnorm
  3516. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3517. Support for both single pass (livestreams, files) and double pass (files) modes.
  3518. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3519. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3520. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3521. The filter accepts the following options:
  3522. @table @option
  3523. @item I, i
  3524. Set integrated loudness target.
  3525. Range is -70.0 - -5.0. Default value is -24.0.
  3526. @item LRA, lra
  3527. Set loudness range target.
  3528. Range is 1.0 - 20.0. Default value is 7.0.
  3529. @item TP, tp
  3530. Set maximum true peak.
  3531. Range is -9.0 - +0.0. Default value is -2.0.
  3532. @item measured_I, measured_i
  3533. Measured IL of input file.
  3534. Range is -99.0 - +0.0.
  3535. @item measured_LRA, measured_lra
  3536. Measured LRA of input file.
  3537. Range is 0.0 - 99.0.
  3538. @item measured_TP, measured_tp
  3539. Measured true peak of input file.
  3540. Range is -99.0 - +99.0.
  3541. @item measured_thresh
  3542. Measured threshold of input file.
  3543. Range is -99.0 - +0.0.
  3544. @item offset
  3545. Set offset gain. Gain is applied before the true-peak limiter.
  3546. Range is -99.0 - +99.0. Default is +0.0.
  3547. @item linear
  3548. Normalize by linearly scaling the source audio.
  3549. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3550. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3551. be lower than source LRA and the change in integrated loudness shouldn't
  3552. result in a true peak which exceeds the target TP. If any of these
  3553. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3554. Options are @code{true} or @code{false}. Default is @code{true}.
  3555. @item dual_mono
  3556. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3557. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3558. If set to @code{true}, this option will compensate for this effect.
  3559. Multi-channel input files are not affected by this option.
  3560. Options are true or false. Default is false.
  3561. @item print_format
  3562. Set print format for stats. Options are summary, json, or none.
  3563. Default value is none.
  3564. @end table
  3565. @section lowpass
  3566. Apply a low-pass filter with 3dB point frequency.
  3567. The filter can be either single-pole or double-pole (the default).
  3568. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3569. The filter accepts the following options:
  3570. @table @option
  3571. @item frequency, f
  3572. Set frequency in Hz. Default is 500.
  3573. @item poles, p
  3574. Set number of poles. Default is 2.
  3575. @item width_type, t
  3576. Set method to specify band-width of filter.
  3577. @table @option
  3578. @item h
  3579. Hz
  3580. @item q
  3581. Q-Factor
  3582. @item o
  3583. octave
  3584. @item s
  3585. slope
  3586. @item k
  3587. kHz
  3588. @end table
  3589. @item width, w
  3590. Specify the band-width of a filter in width_type units.
  3591. Applies only to double-pole filter.
  3592. The default is 0.707q and gives a Butterworth response.
  3593. @item mix, m
  3594. How much to use filtered signal in output. Default is 1.
  3595. Range is between 0 and 1.
  3596. @item channels, c
  3597. Specify which channels to filter, by default all available are filtered.
  3598. @item normalize, n
  3599. Normalize biquad coefficients, by default is disabled.
  3600. Enabling it will normalize magnitude response at DC to 0dB.
  3601. @item transform, a
  3602. Set transform type of IIR filter.
  3603. @table @option
  3604. @item di
  3605. @item dii
  3606. @item tdii
  3607. @item latt
  3608. @end table
  3609. @end table
  3610. @subsection Examples
  3611. @itemize
  3612. @item
  3613. Lowpass only LFE channel, it LFE is not present it does nothing:
  3614. @example
  3615. lowpass=c=LFE
  3616. @end example
  3617. @end itemize
  3618. @subsection Commands
  3619. This filter supports the following commands:
  3620. @table @option
  3621. @item frequency, f
  3622. Change lowpass frequency.
  3623. Syntax for the command is : "@var{frequency}"
  3624. @item width_type, t
  3625. Change lowpass width_type.
  3626. Syntax for the command is : "@var{width_type}"
  3627. @item width, w
  3628. Change lowpass width.
  3629. Syntax for the command is : "@var{width}"
  3630. @item mix, m
  3631. Change lowpass mix.
  3632. Syntax for the command is : "@var{mix}"
  3633. @end table
  3634. @section lv2
  3635. Load a LV2 (LADSPA Version 2) plugin.
  3636. To enable compilation of this filter you need to configure FFmpeg with
  3637. @code{--enable-lv2}.
  3638. @table @option
  3639. @item plugin, p
  3640. Specifies the plugin URI. You may need to escape ':'.
  3641. @item controls, c
  3642. Set the '|' separated list of controls which are zero or more floating point
  3643. values that determine the behavior of the loaded plugin (for example delay,
  3644. threshold or gain).
  3645. If @option{controls} is set to @code{help}, all available controls and
  3646. their valid ranges are printed.
  3647. @item sample_rate, s
  3648. Specify the sample rate, default to 44100. Only used if plugin have
  3649. zero inputs.
  3650. @item nb_samples, n
  3651. Set the number of samples per channel per each output frame, default
  3652. is 1024. Only used if plugin have zero inputs.
  3653. @item duration, d
  3654. Set the minimum duration of the sourced audio. See
  3655. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3656. for the accepted syntax.
  3657. Note that the resulting duration may be greater than the specified duration,
  3658. as the generated audio is always cut at the end of a complete frame.
  3659. If not specified, or the expressed duration is negative, the audio is
  3660. supposed to be generated forever.
  3661. Only used if plugin have zero inputs.
  3662. @end table
  3663. @subsection Examples
  3664. @itemize
  3665. @item
  3666. Apply bass enhancer plugin from Calf:
  3667. @example
  3668. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3669. @end example
  3670. @item
  3671. Apply vinyl plugin from Calf:
  3672. @example
  3673. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3674. @end example
  3675. @item
  3676. Apply bit crusher plugin from ArtyFX:
  3677. @example
  3678. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3679. @end example
  3680. @end itemize
  3681. @section mcompand
  3682. Multiband Compress or expand the audio's dynamic range.
  3683. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3684. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3685. response when absent compander action.
  3686. It accepts the following parameters:
  3687. @table @option
  3688. @item args
  3689. This option syntax is:
  3690. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3691. For explanation of each item refer to compand filter documentation.
  3692. @end table
  3693. @anchor{pan}
  3694. @section pan
  3695. Mix channels with specific gain levels. The filter accepts the output
  3696. channel layout followed by a set of channels definitions.
  3697. This filter is also designed to efficiently remap the channels of an audio
  3698. stream.
  3699. The filter accepts parameters of the form:
  3700. "@var{l}|@var{outdef}|@var{outdef}|..."
  3701. @table @option
  3702. @item l
  3703. output channel layout or number of channels
  3704. @item outdef
  3705. output channel specification, of the form:
  3706. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3707. @item out_name
  3708. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3709. number (c0, c1, etc.)
  3710. @item gain
  3711. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3712. @item in_name
  3713. input channel to use, see out_name for details; it is not possible to mix
  3714. named and numbered input channels
  3715. @end table
  3716. If the `=' in a channel specification is replaced by `<', then the gains for
  3717. that specification will be renormalized so that the total is 1, thus
  3718. avoiding clipping noise.
  3719. @subsection Mixing examples
  3720. For example, if you want to down-mix from stereo to mono, but with a bigger
  3721. factor for the left channel:
  3722. @example
  3723. pan=1c|c0=0.9*c0+0.1*c1
  3724. @end example
  3725. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3726. 7-channels surround:
  3727. @example
  3728. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3729. @end example
  3730. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3731. that should be preferred (see "-ac" option) unless you have very specific
  3732. needs.
  3733. @subsection Remapping examples
  3734. The channel remapping will be effective if, and only if:
  3735. @itemize
  3736. @item gain coefficients are zeroes or ones,
  3737. @item only one input per channel output,
  3738. @end itemize
  3739. If all these conditions are satisfied, the filter will notify the user ("Pure
  3740. channel mapping detected"), and use an optimized and lossless method to do the
  3741. remapping.
  3742. For example, if you have a 5.1 source and want a stereo audio stream by
  3743. dropping the extra channels:
  3744. @example
  3745. pan="stereo| c0=FL | c1=FR"
  3746. @end example
  3747. Given the same source, you can also switch front left and front right channels
  3748. and keep the input channel layout:
  3749. @example
  3750. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3751. @end example
  3752. If the input is a stereo audio stream, you can mute the front left channel (and
  3753. still keep the stereo channel layout) with:
  3754. @example
  3755. pan="stereo|c1=c1"
  3756. @end example
  3757. Still with a stereo audio stream input, you can copy the right channel in both
  3758. front left and right:
  3759. @example
  3760. pan="stereo| c0=FR | c1=FR"
  3761. @end example
  3762. @section replaygain
  3763. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3764. outputs it unchanged.
  3765. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3766. @section resample
  3767. Convert the audio sample format, sample rate and channel layout. It is
  3768. not meant to be used directly.
  3769. @section rubberband
  3770. Apply time-stretching and pitch-shifting with librubberband.
  3771. To enable compilation of this filter, you need to configure FFmpeg with
  3772. @code{--enable-librubberband}.
  3773. The filter accepts the following options:
  3774. @table @option
  3775. @item tempo
  3776. Set tempo scale factor.
  3777. @item pitch
  3778. Set pitch scale factor.
  3779. @item transients
  3780. Set transients detector.
  3781. Possible values are:
  3782. @table @var
  3783. @item crisp
  3784. @item mixed
  3785. @item smooth
  3786. @end table
  3787. @item detector
  3788. Set detector.
  3789. Possible values are:
  3790. @table @var
  3791. @item compound
  3792. @item percussive
  3793. @item soft
  3794. @end table
  3795. @item phase
  3796. Set phase.
  3797. Possible values are:
  3798. @table @var
  3799. @item laminar
  3800. @item independent
  3801. @end table
  3802. @item window
  3803. Set processing window size.
  3804. Possible values are:
  3805. @table @var
  3806. @item standard
  3807. @item short
  3808. @item long
  3809. @end table
  3810. @item smoothing
  3811. Set smoothing.
  3812. Possible values are:
  3813. @table @var
  3814. @item off
  3815. @item on
  3816. @end table
  3817. @item formant
  3818. Enable formant preservation when shift pitching.
  3819. Possible values are:
  3820. @table @var
  3821. @item shifted
  3822. @item preserved
  3823. @end table
  3824. @item pitchq
  3825. Set pitch quality.
  3826. Possible values are:
  3827. @table @var
  3828. @item quality
  3829. @item speed
  3830. @item consistency
  3831. @end table
  3832. @item channels
  3833. Set channels.
  3834. Possible values are:
  3835. @table @var
  3836. @item apart
  3837. @item together
  3838. @end table
  3839. @end table
  3840. @subsection Commands
  3841. This filter supports the following commands:
  3842. @table @option
  3843. @item tempo
  3844. Change filter tempo scale factor.
  3845. Syntax for the command is : "@var{tempo}"
  3846. @item pitch
  3847. Change filter pitch scale factor.
  3848. Syntax for the command is : "@var{pitch}"
  3849. @end table
  3850. @section sidechaincompress
  3851. This filter acts like normal compressor but has the ability to compress
  3852. detected signal using second input signal.
  3853. It needs two input streams and returns one output stream.
  3854. First input stream will be processed depending on second stream signal.
  3855. The filtered signal then can be filtered with other filters in later stages of
  3856. processing. See @ref{pan} and @ref{amerge} filter.
  3857. The filter accepts the following options:
  3858. @table @option
  3859. @item level_in
  3860. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3861. @item mode
  3862. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3863. Default is @code{downward}.
  3864. @item threshold
  3865. If a signal of second stream raises above this level it will affect the gain
  3866. reduction of first stream.
  3867. By default is 0.125. Range is between 0.00097563 and 1.
  3868. @item ratio
  3869. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3870. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3871. Default is 2. Range is between 1 and 20.
  3872. @item attack
  3873. Amount of milliseconds the signal has to rise above the threshold before gain
  3874. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3875. @item release
  3876. Amount of milliseconds the signal has to fall below the threshold before
  3877. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3878. @item makeup
  3879. Set the amount by how much signal will be amplified after processing.
  3880. Default is 1. Range is from 1 to 64.
  3881. @item knee
  3882. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3883. Default is 2.82843. Range is between 1 and 8.
  3884. @item link
  3885. Choose if the @code{average} level between all channels of side-chain stream
  3886. or the louder(@code{maximum}) channel of side-chain stream affects the
  3887. reduction. Default is @code{average}.
  3888. @item detection
  3889. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3890. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3891. @item level_sc
  3892. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3893. @item mix
  3894. How much to use compressed signal in output. Default is 1.
  3895. Range is between 0 and 1.
  3896. @end table
  3897. @subsection Commands
  3898. This filter supports the all above options as @ref{commands}.
  3899. @subsection Examples
  3900. @itemize
  3901. @item
  3902. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3903. depending on the signal of 2nd input and later compressed signal to be
  3904. merged with 2nd input:
  3905. @example
  3906. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3907. @end example
  3908. @end itemize
  3909. @section sidechaingate
  3910. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3911. filter the detected signal before sending it to the gain reduction stage.
  3912. Normally a gate uses the full range signal to detect a level above the
  3913. threshold.
  3914. For example: If you cut all lower frequencies from your sidechain signal
  3915. the gate will decrease the volume of your track only if not enough highs
  3916. appear. With this technique you are able to reduce the resonation of a
  3917. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3918. guitar.
  3919. It needs two input streams and returns one output stream.
  3920. First input stream will be processed depending on second stream signal.
  3921. The filter accepts the following options:
  3922. @table @option
  3923. @item level_in
  3924. Set input level before filtering.
  3925. Default is 1. Allowed range is from 0.015625 to 64.
  3926. @item mode
  3927. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3928. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3929. will be amplified, expanding dynamic range in upward direction.
  3930. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3931. @item range
  3932. Set the level of gain reduction when the signal is below the threshold.
  3933. Default is 0.06125. Allowed range is from 0 to 1.
  3934. Setting this to 0 disables reduction and then filter behaves like expander.
  3935. @item threshold
  3936. If a signal rises above this level the gain reduction is released.
  3937. Default is 0.125. Allowed range is from 0 to 1.
  3938. @item ratio
  3939. Set a ratio about which the signal is reduced.
  3940. Default is 2. Allowed range is from 1 to 9000.
  3941. @item attack
  3942. Amount of milliseconds the signal has to rise above the threshold before gain
  3943. reduction stops.
  3944. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3945. @item release
  3946. Amount of milliseconds the signal has to fall below the threshold before the
  3947. reduction is increased again. Default is 250 milliseconds.
  3948. Allowed range is from 0.01 to 9000.
  3949. @item makeup
  3950. Set amount of amplification of signal after processing.
  3951. Default is 1. Allowed range is from 1 to 64.
  3952. @item knee
  3953. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3954. Default is 2.828427125. Allowed range is from 1 to 8.
  3955. @item detection
  3956. Choose if exact signal should be taken for detection or an RMS like one.
  3957. Default is rms. Can be peak or rms.
  3958. @item link
  3959. Choose if the average level between all channels or the louder channel affects
  3960. the reduction.
  3961. Default is average. Can be average or maximum.
  3962. @item level_sc
  3963. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3964. @end table
  3965. @subsection Commands
  3966. This filter supports the all above options as @ref{commands}.
  3967. @section silencedetect
  3968. Detect silence in an audio stream.
  3969. This filter logs a message when it detects that the input audio volume is less
  3970. or equal to a noise tolerance value for a duration greater or equal to the
  3971. minimum detected noise duration.
  3972. The printed times and duration are expressed in seconds. The
  3973. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3974. is set on the first frame whose timestamp equals or exceeds the detection
  3975. duration and it contains the timestamp of the first frame of the silence.
  3976. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3977. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3978. keys are set on the first frame after the silence. If @option{mono} is
  3979. enabled, and each channel is evaluated separately, the @code{.X}
  3980. suffixed keys are used, and @code{X} corresponds to the channel number.
  3981. The filter accepts the following options:
  3982. @table @option
  3983. @item noise, n
  3984. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3985. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3986. @item duration, d
  3987. Set silence duration until notification (default is 2 seconds). See
  3988. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3989. for the accepted syntax.
  3990. @item mono, m
  3991. Process each channel separately, instead of combined. By default is disabled.
  3992. @end table
  3993. @subsection Examples
  3994. @itemize
  3995. @item
  3996. Detect 5 seconds of silence with -50dB noise tolerance:
  3997. @example
  3998. silencedetect=n=-50dB:d=5
  3999. @end example
  4000. @item
  4001. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4002. tolerance in @file{silence.mp3}:
  4003. @example
  4004. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4005. @end example
  4006. @end itemize
  4007. @section silenceremove
  4008. Remove silence from the beginning, middle or end of the audio.
  4009. The filter accepts the following options:
  4010. @table @option
  4011. @item start_periods
  4012. This value is used to indicate if audio should be trimmed at beginning of
  4013. the audio. A value of zero indicates no silence should be trimmed from the
  4014. beginning. When specifying a non-zero value, it trims audio up until it
  4015. finds non-silence. Normally, when trimming silence from beginning of audio
  4016. the @var{start_periods} will be @code{1} but it can be increased to higher
  4017. values to trim all audio up to specific count of non-silence periods.
  4018. Default value is @code{0}.
  4019. @item start_duration
  4020. Specify the amount of time that non-silence must be detected before it stops
  4021. trimming audio. By increasing the duration, bursts of noises can be treated
  4022. as silence and trimmed off. Default value is @code{0}.
  4023. @item start_threshold
  4024. This indicates what sample value should be treated as silence. For digital
  4025. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4026. you may wish to increase the value to account for background noise.
  4027. Can be specified in dB (in case "dB" is appended to the specified value)
  4028. or amplitude ratio. Default value is @code{0}.
  4029. @item start_silence
  4030. Specify max duration of silence at beginning that will be kept after
  4031. trimming. Default is 0, which is equal to trimming all samples detected
  4032. as silence.
  4033. @item start_mode
  4034. Specify mode of detection of silence end in start of multi-channel audio.
  4035. Can be @var{any} or @var{all}. Default is @var{any}.
  4036. With @var{any}, any sample that is detected as non-silence will cause
  4037. stopped trimming of silence.
  4038. With @var{all}, only if all channels are detected as non-silence will cause
  4039. stopped trimming of silence.
  4040. @item stop_periods
  4041. Set the count for trimming silence from the end of audio.
  4042. To remove silence from the middle of a file, specify a @var{stop_periods}
  4043. that is negative. This value is then treated as a positive value and is
  4044. used to indicate the effect should restart processing as specified by
  4045. @var{start_periods}, making it suitable for removing periods of silence
  4046. in the middle of the audio.
  4047. Default value is @code{0}.
  4048. @item stop_duration
  4049. Specify a duration of silence that must exist before audio is not copied any
  4050. more. By specifying a higher duration, silence that is wanted can be left in
  4051. the audio.
  4052. Default value is @code{0}.
  4053. @item stop_threshold
  4054. This is the same as @option{start_threshold} but for trimming silence from
  4055. the end of audio.
  4056. Can be specified in dB (in case "dB" is appended to the specified value)
  4057. or amplitude ratio. Default value is @code{0}.
  4058. @item stop_silence
  4059. Specify max duration of silence at end that will be kept after
  4060. trimming. Default is 0, which is equal to trimming all samples detected
  4061. as silence.
  4062. @item stop_mode
  4063. Specify mode of detection of silence start in end of multi-channel audio.
  4064. Can be @var{any} or @var{all}. Default is @var{any}.
  4065. With @var{any}, any sample that is detected as non-silence will cause
  4066. stopped trimming of silence.
  4067. With @var{all}, only if all channels are detected as non-silence will cause
  4068. stopped trimming of silence.
  4069. @item detection
  4070. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4071. and works better with digital silence which is exactly 0.
  4072. Default value is @code{rms}.
  4073. @item window
  4074. Set duration in number of seconds used to calculate size of window in number
  4075. of samples for detecting silence.
  4076. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4077. @end table
  4078. @subsection Examples
  4079. @itemize
  4080. @item
  4081. The following example shows how this filter can be used to start a recording
  4082. that does not contain the delay at the start which usually occurs between
  4083. pressing the record button and the start of the performance:
  4084. @example
  4085. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4086. @end example
  4087. @item
  4088. Trim all silence encountered from beginning to end where there is more than 1
  4089. second of silence in audio:
  4090. @example
  4091. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4092. @end example
  4093. @item
  4094. Trim all digital silence samples, using peak detection, from beginning to end
  4095. where there is more than 0 samples of digital silence in audio and digital
  4096. silence is detected in all channels at same positions in stream:
  4097. @example
  4098. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4099. @end example
  4100. @end itemize
  4101. @section sofalizer
  4102. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4103. loudspeakers around the user for binaural listening via headphones (audio
  4104. formats up to 9 channels supported).
  4105. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4106. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4107. Austrian Academy of Sciences.
  4108. To enable compilation of this filter you need to configure FFmpeg with
  4109. @code{--enable-libmysofa}.
  4110. The filter accepts the following options:
  4111. @table @option
  4112. @item sofa
  4113. Set the SOFA file used for rendering.
  4114. @item gain
  4115. Set gain applied to audio. Value is in dB. Default is 0.
  4116. @item rotation
  4117. Set rotation of virtual loudspeakers in deg. Default is 0.
  4118. @item elevation
  4119. Set elevation of virtual speakers in deg. Default is 0.
  4120. @item radius
  4121. Set distance in meters between loudspeakers and the listener with near-field
  4122. HRTFs. Default is 1.
  4123. @item type
  4124. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4125. processing audio in time domain which is slow.
  4126. @var{freq} is processing audio in frequency domain which is fast.
  4127. Default is @var{freq}.
  4128. @item speakers
  4129. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4130. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4131. Each virtual loudspeaker is described with short channel name following with
  4132. azimuth and elevation in degrees.
  4133. Each virtual loudspeaker description is separated by '|'.
  4134. For example to override front left and front right channel positions use:
  4135. 'speakers=FL 45 15|FR 345 15'.
  4136. Descriptions with unrecognised channel names are ignored.
  4137. @item lfegain
  4138. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4139. @item framesize
  4140. Set custom frame size in number of samples. Default is 1024.
  4141. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4142. is set to @var{freq}.
  4143. @item normalize
  4144. Should all IRs be normalized upon importing SOFA file.
  4145. By default is enabled.
  4146. @item interpolate
  4147. Should nearest IRs be interpolated with neighbor IRs if exact position
  4148. does not match. By default is disabled.
  4149. @item minphase
  4150. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4151. @item anglestep
  4152. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4153. @item radstep
  4154. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4155. @end table
  4156. @subsection Examples
  4157. @itemize
  4158. @item
  4159. Using ClubFritz6 sofa file:
  4160. @example
  4161. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4162. @end example
  4163. @item
  4164. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4165. @example
  4166. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4167. @end example
  4168. @item
  4169. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4170. and also with custom gain:
  4171. @example
  4172. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4173. @end example
  4174. @end itemize
  4175. @section speechnorm
  4176. Speech Normalizer.
  4177. This filter expands or compresses each half-cycle of audio samples
  4178. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4179. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item peak, p
  4183. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4184. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4185. @item expansion, e
  4186. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4187. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4188. would be such that local peak value reaches target peak value but never to surpass it and that
  4189. ratio between new and previous peak value does not surpass this option value.
  4190. @item compression, c
  4191. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4192. This option controls maximum local half-cycle of samples compression. This option is used
  4193. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4194. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4195. that peak's half-cycle will be compressed by current compression factor.
  4196. @item threshold, t
  4197. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4198. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4199. Any half-cycle samples with their local peak value below or same as this option value will be
  4200. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4201. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4202. @item raise, r
  4203. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4204. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4205. each new half-cycle until it reaches @option{expansion} value.
  4206. Setting this options too high may lead to distortions.
  4207. @item fall, f
  4208. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4209. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4210. each new half-cycle until it reaches @option{compression} value.
  4211. @item channels, h
  4212. Specify which channels to filter, by default all available channels are filtered.
  4213. @item invert, i
  4214. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4215. option. When enabled any half-cycle of samples with their local peak value below or same as
  4216. @option{threshold} option will be expanded otherwise it will be compressed.
  4217. @item link, l
  4218. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4219. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4220. is enabled the minimum of all possible gains for each filtered channel is used.
  4221. @end table
  4222. @subsection Commands
  4223. This filter supports the all above options as @ref{commands}.
  4224. @section stereotools
  4225. This filter has some handy utilities to manage stereo signals, for converting
  4226. M/S stereo recordings to L/R signal while having control over the parameters
  4227. or spreading the stereo image of master track.
  4228. The filter accepts the following options:
  4229. @table @option
  4230. @item level_in
  4231. Set input level before filtering for both channels. Defaults is 1.
  4232. Allowed range is from 0.015625 to 64.
  4233. @item level_out
  4234. Set output level after filtering for both channels. Defaults is 1.
  4235. Allowed range is from 0.015625 to 64.
  4236. @item balance_in
  4237. Set input balance between both channels. Default is 0.
  4238. Allowed range is from -1 to 1.
  4239. @item balance_out
  4240. Set output balance between both channels. Default is 0.
  4241. Allowed range is from -1 to 1.
  4242. @item softclip
  4243. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4244. clipping. Disabled by default.
  4245. @item mutel
  4246. Mute the left channel. Disabled by default.
  4247. @item muter
  4248. Mute the right channel. Disabled by default.
  4249. @item phasel
  4250. Change the phase of the left channel. Disabled by default.
  4251. @item phaser
  4252. Change the phase of the right channel. Disabled by default.
  4253. @item mode
  4254. Set stereo mode. Available values are:
  4255. @table @samp
  4256. @item lr>lr
  4257. Left/Right to Left/Right, this is default.
  4258. @item lr>ms
  4259. Left/Right to Mid/Side.
  4260. @item ms>lr
  4261. Mid/Side to Left/Right.
  4262. @item lr>ll
  4263. Left/Right to Left/Left.
  4264. @item lr>rr
  4265. Left/Right to Right/Right.
  4266. @item lr>l+r
  4267. Left/Right to Left + Right.
  4268. @item lr>rl
  4269. Left/Right to Right/Left.
  4270. @item ms>ll
  4271. Mid/Side to Left/Left.
  4272. @item ms>rr
  4273. Mid/Side to Right/Right.
  4274. @item ms>rl
  4275. Mid/Side to Right/Left.
  4276. @item lr>l-r
  4277. Left/Right to Left - Right.
  4278. @end table
  4279. @item slev
  4280. Set level of side signal. Default is 1.
  4281. Allowed range is from 0.015625 to 64.
  4282. @item sbal
  4283. Set balance of side signal. Default is 0.
  4284. Allowed range is from -1 to 1.
  4285. @item mlev
  4286. Set level of the middle signal. Default is 1.
  4287. Allowed range is from 0.015625 to 64.
  4288. @item mpan
  4289. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4290. @item base
  4291. Set stereo base between mono and inversed channels. Default is 0.
  4292. Allowed range is from -1 to 1.
  4293. @item delay
  4294. Set delay in milliseconds how much to delay left from right channel and
  4295. vice versa. Default is 0. Allowed range is from -20 to 20.
  4296. @item sclevel
  4297. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4298. @item phase
  4299. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4300. @item bmode_in, bmode_out
  4301. Set balance mode for balance_in/balance_out option.
  4302. Can be one of the following:
  4303. @table @samp
  4304. @item balance
  4305. Classic balance mode. Attenuate one channel at time.
  4306. Gain is raised up to 1.
  4307. @item amplitude
  4308. Similar as classic mode above but gain is raised up to 2.
  4309. @item power
  4310. Equal power distribution, from -6dB to +6dB range.
  4311. @end table
  4312. @end table
  4313. @subsection Commands
  4314. This filter supports the all above options as @ref{commands}.
  4315. @subsection Examples
  4316. @itemize
  4317. @item
  4318. Apply karaoke like effect:
  4319. @example
  4320. stereotools=mlev=0.015625
  4321. @end example
  4322. @item
  4323. Convert M/S signal to L/R:
  4324. @example
  4325. "stereotools=mode=ms>lr"
  4326. @end example
  4327. @end itemize
  4328. @section stereowiden
  4329. This filter enhance the stereo effect by suppressing signal common to both
  4330. channels and by delaying the signal of left into right and vice versa,
  4331. thereby widening the stereo effect.
  4332. The filter accepts the following options:
  4333. @table @option
  4334. @item delay
  4335. Time in milliseconds of the delay of left signal into right and vice versa.
  4336. Default is 20 milliseconds.
  4337. @item feedback
  4338. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4339. effect of left signal in right output and vice versa which gives widening
  4340. effect. Default is 0.3.
  4341. @item crossfeed
  4342. Cross feed of left into right with inverted phase. This helps in suppressing
  4343. the mono. If the value is 1 it will cancel all the signal common to both
  4344. channels. Default is 0.3.
  4345. @item drymix
  4346. Set level of input signal of original channel. Default is 0.8.
  4347. @end table
  4348. @subsection Commands
  4349. This filter supports the all above options except @code{delay} as @ref{commands}.
  4350. @section superequalizer
  4351. Apply 18 band equalizer.
  4352. The filter accepts the following options:
  4353. @table @option
  4354. @item 1b
  4355. Set 65Hz band gain.
  4356. @item 2b
  4357. Set 92Hz band gain.
  4358. @item 3b
  4359. Set 131Hz band gain.
  4360. @item 4b
  4361. Set 185Hz band gain.
  4362. @item 5b
  4363. Set 262Hz band gain.
  4364. @item 6b
  4365. Set 370Hz band gain.
  4366. @item 7b
  4367. Set 523Hz band gain.
  4368. @item 8b
  4369. Set 740Hz band gain.
  4370. @item 9b
  4371. Set 1047Hz band gain.
  4372. @item 10b
  4373. Set 1480Hz band gain.
  4374. @item 11b
  4375. Set 2093Hz band gain.
  4376. @item 12b
  4377. Set 2960Hz band gain.
  4378. @item 13b
  4379. Set 4186Hz band gain.
  4380. @item 14b
  4381. Set 5920Hz band gain.
  4382. @item 15b
  4383. Set 8372Hz band gain.
  4384. @item 16b
  4385. Set 11840Hz band gain.
  4386. @item 17b
  4387. Set 16744Hz band gain.
  4388. @item 18b
  4389. Set 20000Hz band gain.
  4390. @end table
  4391. @section surround
  4392. Apply audio surround upmix filter.
  4393. This filter allows to produce multichannel output from audio stream.
  4394. The filter accepts the following options:
  4395. @table @option
  4396. @item chl_out
  4397. Set output channel layout. By default, this is @var{5.1}.
  4398. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4399. for the required syntax.
  4400. @item chl_in
  4401. Set input channel layout. By default, this is @var{stereo}.
  4402. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4403. for the required syntax.
  4404. @item level_in
  4405. Set input volume level. By default, this is @var{1}.
  4406. @item level_out
  4407. Set output volume level. By default, this is @var{1}.
  4408. @item lfe
  4409. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4410. @item lfe_low
  4411. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4412. @item lfe_high
  4413. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4414. @item lfe_mode
  4415. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4416. In @var{add} mode, LFE channel is created from input audio and added to output.
  4417. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4418. also all non-LFE output channels are subtracted with output LFE channel.
  4419. @item angle
  4420. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4421. Default is @var{90}.
  4422. @item fc_in
  4423. Set front center input volume. By default, this is @var{1}.
  4424. @item fc_out
  4425. Set front center output volume. By default, this is @var{1}.
  4426. @item fl_in
  4427. Set front left input volume. By default, this is @var{1}.
  4428. @item fl_out
  4429. Set front left output volume. By default, this is @var{1}.
  4430. @item fr_in
  4431. Set front right input volume. By default, this is @var{1}.
  4432. @item fr_out
  4433. Set front right output volume. By default, this is @var{1}.
  4434. @item sl_in
  4435. Set side left input volume. By default, this is @var{1}.
  4436. @item sl_out
  4437. Set side left output volume. By default, this is @var{1}.
  4438. @item sr_in
  4439. Set side right input volume. By default, this is @var{1}.
  4440. @item sr_out
  4441. Set side right output volume. By default, this is @var{1}.
  4442. @item bl_in
  4443. Set back left input volume. By default, this is @var{1}.
  4444. @item bl_out
  4445. Set back left output volume. By default, this is @var{1}.
  4446. @item br_in
  4447. Set back right input volume. By default, this is @var{1}.
  4448. @item br_out
  4449. Set back right output volume. By default, this is @var{1}.
  4450. @item bc_in
  4451. Set back center input volume. By default, this is @var{1}.
  4452. @item bc_out
  4453. Set back center output volume. By default, this is @var{1}.
  4454. @item lfe_in
  4455. Set LFE input volume. By default, this is @var{1}.
  4456. @item lfe_out
  4457. Set LFE output volume. By default, this is @var{1}.
  4458. @item allx
  4459. Set spread usage of stereo image across X axis for all channels.
  4460. @item ally
  4461. Set spread usage of stereo image across Y axis for all channels.
  4462. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4463. Set spread usage of stereo image across X axis for each channel.
  4464. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4465. Set spread usage of stereo image across Y axis for each channel.
  4466. @item win_size
  4467. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4468. @item win_func
  4469. Set window function.
  4470. It accepts the following values:
  4471. @table @samp
  4472. @item rect
  4473. @item bartlett
  4474. @item hann, hanning
  4475. @item hamming
  4476. @item blackman
  4477. @item welch
  4478. @item flattop
  4479. @item bharris
  4480. @item bnuttall
  4481. @item bhann
  4482. @item sine
  4483. @item nuttall
  4484. @item lanczos
  4485. @item gauss
  4486. @item tukey
  4487. @item dolph
  4488. @item cauchy
  4489. @item parzen
  4490. @item poisson
  4491. @item bohman
  4492. @end table
  4493. Default is @code{hann}.
  4494. @item overlap
  4495. Set window overlap. If set to 1, the recommended overlap for selected
  4496. window function will be picked. Default is @code{0.5}.
  4497. @end table
  4498. @section treble, highshelf
  4499. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4500. shelving filter with a response similar to that of a standard
  4501. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4502. The filter accepts the following options:
  4503. @table @option
  4504. @item gain, g
  4505. Give the gain at whichever is the lower of ~22 kHz and the
  4506. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4507. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4508. @item frequency, f
  4509. Set the filter's central frequency and so can be used
  4510. to extend or reduce the frequency range to be boosted or cut.
  4511. The default value is @code{3000} Hz.
  4512. @item width_type, t
  4513. Set method to specify band-width of filter.
  4514. @table @option
  4515. @item h
  4516. Hz
  4517. @item q
  4518. Q-Factor
  4519. @item o
  4520. octave
  4521. @item s
  4522. slope
  4523. @item k
  4524. kHz
  4525. @end table
  4526. @item width, w
  4527. Determine how steep is the filter's shelf transition.
  4528. @item mix, m
  4529. How much to use filtered signal in output. Default is 1.
  4530. Range is between 0 and 1.
  4531. @item channels, c
  4532. Specify which channels to filter, by default all available are filtered.
  4533. @item normalize, n
  4534. Normalize biquad coefficients, by default is disabled.
  4535. Enabling it will normalize magnitude response at DC to 0dB.
  4536. @item transform, a
  4537. Set transform type of IIR filter.
  4538. @table @option
  4539. @item di
  4540. @item dii
  4541. @item tdii
  4542. @item latt
  4543. @end table
  4544. @end table
  4545. @subsection Commands
  4546. This filter supports the following commands:
  4547. @table @option
  4548. @item frequency, f
  4549. Change treble frequency.
  4550. Syntax for the command is : "@var{frequency}"
  4551. @item width_type, t
  4552. Change treble width_type.
  4553. Syntax for the command is : "@var{width_type}"
  4554. @item width, w
  4555. Change treble width.
  4556. Syntax for the command is : "@var{width}"
  4557. @item gain, g
  4558. Change treble gain.
  4559. Syntax for the command is : "@var{gain}"
  4560. @item mix, m
  4561. Change treble mix.
  4562. Syntax for the command is : "@var{mix}"
  4563. @end table
  4564. @section tremolo
  4565. Sinusoidal amplitude modulation.
  4566. The filter accepts the following options:
  4567. @table @option
  4568. @item f
  4569. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4570. (20 Hz or lower) will result in a tremolo effect.
  4571. This filter may also be used as a ring modulator by specifying
  4572. a modulation frequency higher than 20 Hz.
  4573. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4574. @item d
  4575. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4576. Default value is 0.5.
  4577. @end table
  4578. @section vibrato
  4579. Sinusoidal phase modulation.
  4580. The filter accepts the following options:
  4581. @table @option
  4582. @item f
  4583. Modulation frequency in Hertz.
  4584. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4585. @item d
  4586. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4587. Default value is 0.5.
  4588. @end table
  4589. @section volume
  4590. Adjust the input audio volume.
  4591. It accepts the following parameters:
  4592. @table @option
  4593. @item volume
  4594. Set audio volume expression.
  4595. Output values are clipped to the maximum value.
  4596. The output audio volume is given by the relation:
  4597. @example
  4598. @var{output_volume} = @var{volume} * @var{input_volume}
  4599. @end example
  4600. The default value for @var{volume} is "1.0".
  4601. @item precision
  4602. This parameter represents the mathematical precision.
  4603. It determines which input sample formats will be allowed, which affects the
  4604. precision of the volume scaling.
  4605. @table @option
  4606. @item fixed
  4607. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4608. @item float
  4609. 32-bit floating-point; this limits input sample format to FLT. (default)
  4610. @item double
  4611. 64-bit floating-point; this limits input sample format to DBL.
  4612. @end table
  4613. @item replaygain
  4614. Choose the behaviour on encountering ReplayGain side data in input frames.
  4615. @table @option
  4616. @item drop
  4617. Remove ReplayGain side data, ignoring its contents (the default).
  4618. @item ignore
  4619. Ignore ReplayGain side data, but leave it in the frame.
  4620. @item track
  4621. Prefer the track gain, if present.
  4622. @item album
  4623. Prefer the album gain, if present.
  4624. @end table
  4625. @item replaygain_preamp
  4626. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4627. Default value for @var{replaygain_preamp} is 0.0.
  4628. @item replaygain_noclip
  4629. Prevent clipping by limiting the gain applied.
  4630. Default value for @var{replaygain_noclip} is 1.
  4631. @item eval
  4632. Set when the volume expression is evaluated.
  4633. It accepts the following values:
  4634. @table @samp
  4635. @item once
  4636. only evaluate expression once during the filter initialization, or
  4637. when the @samp{volume} command is sent
  4638. @item frame
  4639. evaluate expression for each incoming frame
  4640. @end table
  4641. Default value is @samp{once}.
  4642. @end table
  4643. The volume expression can contain the following parameters.
  4644. @table @option
  4645. @item n
  4646. frame number (starting at zero)
  4647. @item nb_channels
  4648. number of channels
  4649. @item nb_consumed_samples
  4650. number of samples consumed by the filter
  4651. @item nb_samples
  4652. number of samples in the current frame
  4653. @item pos
  4654. original frame position in the file
  4655. @item pts
  4656. frame PTS
  4657. @item sample_rate
  4658. sample rate
  4659. @item startpts
  4660. PTS at start of stream
  4661. @item startt
  4662. time at start of stream
  4663. @item t
  4664. frame time
  4665. @item tb
  4666. timestamp timebase
  4667. @item volume
  4668. last set volume value
  4669. @end table
  4670. Note that when @option{eval} is set to @samp{once} only the
  4671. @var{sample_rate} and @var{tb} variables are available, all other
  4672. variables will evaluate to NAN.
  4673. @subsection Commands
  4674. This filter supports the following commands:
  4675. @table @option
  4676. @item volume
  4677. Modify the volume expression.
  4678. The command accepts the same syntax of the corresponding option.
  4679. If the specified expression is not valid, it is kept at its current
  4680. value.
  4681. @end table
  4682. @subsection Examples
  4683. @itemize
  4684. @item
  4685. Halve the input audio volume:
  4686. @example
  4687. volume=volume=0.5
  4688. volume=volume=1/2
  4689. volume=volume=-6.0206dB
  4690. @end example
  4691. In all the above example the named key for @option{volume} can be
  4692. omitted, for example like in:
  4693. @example
  4694. volume=0.5
  4695. @end example
  4696. @item
  4697. Increase input audio power by 6 decibels using fixed-point precision:
  4698. @example
  4699. volume=volume=6dB:precision=fixed
  4700. @end example
  4701. @item
  4702. Fade volume after time 10 with an annihilation period of 5 seconds:
  4703. @example
  4704. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4705. @end example
  4706. @end itemize
  4707. @section volumedetect
  4708. Detect the volume of the input video.
  4709. The filter has no parameters. The input is not modified. Statistics about
  4710. the volume will be printed in the log when the input stream end is reached.
  4711. In particular it will show the mean volume (root mean square), maximum
  4712. volume (on a per-sample basis), and the beginning of a histogram of the
  4713. registered volume values (from the maximum value to a cumulated 1/1000 of
  4714. the samples).
  4715. All volumes are in decibels relative to the maximum PCM value.
  4716. @subsection Examples
  4717. Here is an excerpt of the output:
  4718. @example
  4719. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4720. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4721. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4722. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4723. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4724. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4725. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4726. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4727. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4728. @end example
  4729. It means that:
  4730. @itemize
  4731. @item
  4732. The mean square energy is approximately -27 dB, or 10^-2.7.
  4733. @item
  4734. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4735. @item
  4736. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4737. @end itemize
  4738. In other words, raising the volume by +4 dB does not cause any clipping,
  4739. raising it by +5 dB causes clipping for 6 samples, etc.
  4740. @c man end AUDIO FILTERS
  4741. @chapter Audio Sources
  4742. @c man begin AUDIO SOURCES
  4743. Below is a description of the currently available audio sources.
  4744. @section abuffer
  4745. Buffer audio frames, and make them available to the filter chain.
  4746. This source is mainly intended for a programmatic use, in particular
  4747. through the interface defined in @file{libavfilter/buffersrc.h}.
  4748. It accepts the following parameters:
  4749. @table @option
  4750. @item time_base
  4751. The timebase which will be used for timestamps of submitted frames. It must be
  4752. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4753. @item sample_rate
  4754. The sample rate of the incoming audio buffers.
  4755. @item sample_fmt
  4756. The sample format of the incoming audio buffers.
  4757. Either a sample format name or its corresponding integer representation from
  4758. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4759. @item channel_layout
  4760. The channel layout of the incoming audio buffers.
  4761. Either a channel layout name from channel_layout_map in
  4762. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4763. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4764. @item channels
  4765. The number of channels of the incoming audio buffers.
  4766. If both @var{channels} and @var{channel_layout} are specified, then they
  4767. must be consistent.
  4768. @end table
  4769. @subsection Examples
  4770. @example
  4771. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4772. @end example
  4773. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4774. Since the sample format with name "s16p" corresponds to the number
  4775. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4776. equivalent to:
  4777. @example
  4778. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4779. @end example
  4780. @section aevalsrc
  4781. Generate an audio signal specified by an expression.
  4782. This source accepts in input one or more expressions (one for each
  4783. channel), which are evaluated and used to generate a corresponding
  4784. audio signal.
  4785. This source accepts the following options:
  4786. @table @option
  4787. @item exprs
  4788. Set the '|'-separated expressions list for each separate channel. In case the
  4789. @option{channel_layout} option is not specified, the selected channel layout
  4790. depends on the number of provided expressions. Otherwise the last
  4791. specified expression is applied to the remaining output channels.
  4792. @item channel_layout, c
  4793. Set the channel layout. The number of channels in the specified layout
  4794. must be equal to the number of specified expressions.
  4795. @item duration, d
  4796. Set the minimum duration of the sourced audio. See
  4797. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4798. for the accepted syntax.
  4799. Note that the resulting duration may be greater than the specified
  4800. duration, as the generated audio is always cut at the end of a
  4801. complete frame.
  4802. If not specified, or the expressed duration is negative, the audio is
  4803. supposed to be generated forever.
  4804. @item nb_samples, n
  4805. Set the number of samples per channel per each output frame,
  4806. default to 1024.
  4807. @item sample_rate, s
  4808. Specify the sample rate, default to 44100.
  4809. @end table
  4810. Each expression in @var{exprs} can contain the following constants:
  4811. @table @option
  4812. @item n
  4813. number of the evaluated sample, starting from 0
  4814. @item t
  4815. time of the evaluated sample expressed in seconds, starting from 0
  4816. @item s
  4817. sample rate
  4818. @end table
  4819. @subsection Examples
  4820. @itemize
  4821. @item
  4822. Generate silence:
  4823. @example
  4824. aevalsrc=0
  4825. @end example
  4826. @item
  4827. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4828. 8000 Hz:
  4829. @example
  4830. aevalsrc="sin(440*2*PI*t):s=8000"
  4831. @end example
  4832. @item
  4833. Generate a two channels signal, specify the channel layout (Front
  4834. Center + Back Center) explicitly:
  4835. @example
  4836. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4837. @end example
  4838. @item
  4839. Generate white noise:
  4840. @example
  4841. aevalsrc="-2+random(0)"
  4842. @end example
  4843. @item
  4844. Generate an amplitude modulated signal:
  4845. @example
  4846. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4847. @end example
  4848. @item
  4849. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4850. @example
  4851. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4852. @end example
  4853. @end itemize
  4854. @section afirsrc
  4855. Generate a FIR coefficients using frequency sampling method.
  4856. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4857. The filter accepts the following options:
  4858. @table @option
  4859. @item taps, t
  4860. Set number of filter coefficents in output audio stream.
  4861. Default value is 1025.
  4862. @item frequency, f
  4863. Set frequency points from where magnitude and phase are set.
  4864. This must be in non decreasing order, and first element must be 0, while last element
  4865. must be 1. Elements are separated by white spaces.
  4866. @item magnitude, m
  4867. Set magnitude value for every frequency point set by @option{frequency}.
  4868. Number of values must be same as number of frequency points.
  4869. Values are separated by white spaces.
  4870. @item phase, p
  4871. Set phase value for every frequency point set by @option{frequency}.
  4872. Number of values must be same as number of frequency points.
  4873. Values are separated by white spaces.
  4874. @item sample_rate, r
  4875. Set sample rate, default is 44100.
  4876. @item nb_samples, n
  4877. Set number of samples per each frame. Default is 1024.
  4878. @item win_func, w
  4879. Set window function. Default is blackman.
  4880. @end table
  4881. @section anullsrc
  4882. The null audio source, return unprocessed audio frames. It is mainly useful
  4883. as a template and to be employed in analysis / debugging tools, or as
  4884. the source for filters which ignore the input data (for example the sox
  4885. synth filter).
  4886. This source accepts the following options:
  4887. @table @option
  4888. @item channel_layout, cl
  4889. Specifies the channel layout, and can be either an integer or a string
  4890. representing a channel layout. The default value of @var{channel_layout}
  4891. is "stereo".
  4892. Check the channel_layout_map definition in
  4893. @file{libavutil/channel_layout.c} for the mapping between strings and
  4894. channel layout values.
  4895. @item sample_rate, r
  4896. Specifies the sample rate, and defaults to 44100.
  4897. @item nb_samples, n
  4898. Set the number of samples per requested frames.
  4899. @item duration, d
  4900. Set the duration of the sourced audio. See
  4901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4902. for the accepted syntax.
  4903. If not specified, or the expressed duration is negative, the audio is
  4904. supposed to be generated forever.
  4905. @end table
  4906. @subsection Examples
  4907. @itemize
  4908. @item
  4909. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4910. @example
  4911. anullsrc=r=48000:cl=4
  4912. @end example
  4913. @item
  4914. Do the same operation with a more obvious syntax:
  4915. @example
  4916. anullsrc=r=48000:cl=mono
  4917. @end example
  4918. @end itemize
  4919. All the parameters need to be explicitly defined.
  4920. @section flite
  4921. Synthesize a voice utterance using the libflite library.
  4922. To enable compilation of this filter you need to configure FFmpeg with
  4923. @code{--enable-libflite}.
  4924. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4925. The filter accepts the following options:
  4926. @table @option
  4927. @item list_voices
  4928. If set to 1, list the names of the available voices and exit
  4929. immediately. Default value is 0.
  4930. @item nb_samples, n
  4931. Set the maximum number of samples per frame. Default value is 512.
  4932. @item textfile
  4933. Set the filename containing the text to speak.
  4934. @item text
  4935. Set the text to speak.
  4936. @item voice, v
  4937. Set the voice to use for the speech synthesis. Default value is
  4938. @code{kal}. See also the @var{list_voices} option.
  4939. @end table
  4940. @subsection Examples
  4941. @itemize
  4942. @item
  4943. Read from file @file{speech.txt}, and synthesize the text using the
  4944. standard flite voice:
  4945. @example
  4946. flite=textfile=speech.txt
  4947. @end example
  4948. @item
  4949. Read the specified text selecting the @code{slt} voice:
  4950. @example
  4951. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4952. @end example
  4953. @item
  4954. Input text to ffmpeg:
  4955. @example
  4956. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4957. @end example
  4958. @item
  4959. Make @file{ffplay} speak the specified text, using @code{flite} and
  4960. the @code{lavfi} device:
  4961. @example
  4962. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4963. @end example
  4964. @end itemize
  4965. For more information about libflite, check:
  4966. @url{http://www.festvox.org/flite/}
  4967. @section anoisesrc
  4968. Generate a noise audio signal.
  4969. The filter accepts the following options:
  4970. @table @option
  4971. @item sample_rate, r
  4972. Specify the sample rate. Default value is 48000 Hz.
  4973. @item amplitude, a
  4974. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4975. is 1.0.
  4976. @item duration, d
  4977. Specify the duration of the generated audio stream. Not specifying this option
  4978. results in noise with an infinite length.
  4979. @item color, colour, c
  4980. Specify the color of noise. Available noise colors are white, pink, brown,
  4981. blue, violet and velvet. Default color is white.
  4982. @item seed, s
  4983. Specify a value used to seed the PRNG.
  4984. @item nb_samples, n
  4985. Set the number of samples per each output frame, default is 1024.
  4986. @end table
  4987. @subsection Examples
  4988. @itemize
  4989. @item
  4990. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4991. @example
  4992. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4993. @end example
  4994. @end itemize
  4995. @section hilbert
  4996. Generate odd-tap Hilbert transform FIR coefficients.
  4997. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4998. the signal by 90 degrees.
  4999. This is used in many matrix coding schemes and for analytic signal generation.
  5000. The process is often written as a multiplication by i (or j), the imaginary unit.
  5001. The filter accepts the following options:
  5002. @table @option
  5003. @item sample_rate, s
  5004. Set sample rate, default is 44100.
  5005. @item taps, t
  5006. Set length of FIR filter, default is 22051.
  5007. @item nb_samples, n
  5008. Set number of samples per each frame.
  5009. @item win_func, w
  5010. Set window function to be used when generating FIR coefficients.
  5011. @end table
  5012. @section sinc
  5013. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5014. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5015. The filter accepts the following options:
  5016. @table @option
  5017. @item sample_rate, r
  5018. Set sample rate, default is 44100.
  5019. @item nb_samples, n
  5020. Set number of samples per each frame. Default is 1024.
  5021. @item hp
  5022. Set high-pass frequency. Default is 0.
  5023. @item lp
  5024. Set low-pass frequency. Default is 0.
  5025. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5026. is higher than 0 then filter will create band-pass filter coefficients,
  5027. otherwise band-reject filter coefficients.
  5028. @item phase
  5029. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5030. @item beta
  5031. Set Kaiser window beta.
  5032. @item att
  5033. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5034. @item round
  5035. Enable rounding, by default is disabled.
  5036. @item hptaps
  5037. Set number of taps for high-pass filter.
  5038. @item lptaps
  5039. Set number of taps for low-pass filter.
  5040. @end table
  5041. @section sine
  5042. Generate an audio signal made of a sine wave with amplitude 1/8.
  5043. The audio signal is bit-exact.
  5044. The filter accepts the following options:
  5045. @table @option
  5046. @item frequency, f
  5047. Set the carrier frequency. Default is 440 Hz.
  5048. @item beep_factor, b
  5049. Enable a periodic beep every second with frequency @var{beep_factor} times
  5050. the carrier frequency. Default is 0, meaning the beep is disabled.
  5051. @item sample_rate, r
  5052. Specify the sample rate, default is 44100.
  5053. @item duration, d
  5054. Specify the duration of the generated audio stream.
  5055. @item samples_per_frame
  5056. Set the number of samples per output frame.
  5057. The expression can contain the following constants:
  5058. @table @option
  5059. @item n
  5060. The (sequential) number of the output audio frame, starting from 0.
  5061. @item pts
  5062. The PTS (Presentation TimeStamp) of the output audio frame,
  5063. expressed in @var{TB} units.
  5064. @item t
  5065. The PTS of the output audio frame, expressed in seconds.
  5066. @item TB
  5067. The timebase of the output audio frames.
  5068. @end table
  5069. Default is @code{1024}.
  5070. @end table
  5071. @subsection Examples
  5072. @itemize
  5073. @item
  5074. Generate a simple 440 Hz sine wave:
  5075. @example
  5076. sine
  5077. @end example
  5078. @item
  5079. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5080. @example
  5081. sine=220:4:d=5
  5082. sine=f=220:b=4:d=5
  5083. sine=frequency=220:beep_factor=4:duration=5
  5084. @end example
  5085. @item
  5086. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5087. pattern:
  5088. @example
  5089. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5090. @end example
  5091. @end itemize
  5092. @c man end AUDIO SOURCES
  5093. @chapter Audio Sinks
  5094. @c man begin AUDIO SINKS
  5095. Below is a description of the currently available audio sinks.
  5096. @section abuffersink
  5097. Buffer audio frames, and make them available to the end of filter chain.
  5098. This sink is mainly intended for programmatic use, in particular
  5099. through the interface defined in @file{libavfilter/buffersink.h}
  5100. or the options system.
  5101. It accepts a pointer to an AVABufferSinkContext structure, which
  5102. defines the incoming buffers' formats, to be passed as the opaque
  5103. parameter to @code{avfilter_init_filter} for initialization.
  5104. @section anullsink
  5105. Null audio sink; do absolutely nothing with the input audio. It is
  5106. mainly useful as a template and for use in analysis / debugging
  5107. tools.
  5108. @c man end AUDIO SINKS
  5109. @chapter Video Filters
  5110. @c man begin VIDEO FILTERS
  5111. When you configure your FFmpeg build, you can disable any of the
  5112. existing filters using @code{--disable-filters}.
  5113. The configure output will show the video filters included in your
  5114. build.
  5115. Below is a description of the currently available video filters.
  5116. @section addroi
  5117. Mark a region of interest in a video frame.
  5118. The frame data is passed through unchanged, but metadata is attached
  5119. to the frame indicating regions of interest which can affect the
  5120. behaviour of later encoding. Multiple regions can be marked by
  5121. applying the filter multiple times.
  5122. @table @option
  5123. @item x
  5124. Region distance in pixels from the left edge of the frame.
  5125. @item y
  5126. Region distance in pixels from the top edge of the frame.
  5127. @item w
  5128. Region width in pixels.
  5129. @item h
  5130. Region height in pixels.
  5131. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5132. and may contain the following variables:
  5133. @table @option
  5134. @item iw
  5135. Width of the input frame.
  5136. @item ih
  5137. Height of the input frame.
  5138. @end table
  5139. @item qoffset
  5140. Quantisation offset to apply within the region.
  5141. This must be a real value in the range -1 to +1. A value of zero
  5142. indicates no quality change. A negative value asks for better quality
  5143. (less quantisation), while a positive value asks for worse quality
  5144. (greater quantisation).
  5145. The range is calibrated so that the extreme values indicate the
  5146. largest possible offset - if the rest of the frame is encoded with the
  5147. worst possible quality, an offset of -1 indicates that this region
  5148. should be encoded with the best possible quality anyway. Intermediate
  5149. values are then interpolated in some codec-dependent way.
  5150. For example, in 10-bit H.264 the quantisation parameter varies between
  5151. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5152. this region should be encoded with a QP around one-tenth of the full
  5153. range better than the rest of the frame. So, if most of the frame
  5154. were to be encoded with a QP of around 30, this region would get a QP
  5155. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5156. An extreme value of -1 would indicate that this region should be
  5157. encoded with the best possible quality regardless of the treatment of
  5158. the rest of the frame - that is, should be encoded at a QP of -12.
  5159. @item clear
  5160. If set to true, remove any existing regions of interest marked on the
  5161. frame before adding the new one.
  5162. @end table
  5163. @subsection Examples
  5164. @itemize
  5165. @item
  5166. Mark the centre quarter of the frame as interesting.
  5167. @example
  5168. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5169. @end example
  5170. @item
  5171. Mark the 100-pixel-wide region on the left edge of the frame as very
  5172. uninteresting (to be encoded at much lower quality than the rest of
  5173. the frame).
  5174. @example
  5175. addroi=0:0:100:ih:+1/5
  5176. @end example
  5177. @end itemize
  5178. @section alphaextract
  5179. Extract the alpha component from the input as a grayscale video. This
  5180. is especially useful with the @var{alphamerge} filter.
  5181. @section alphamerge
  5182. Add or replace the alpha component of the primary input with the
  5183. grayscale value of a second input. This is intended for use with
  5184. @var{alphaextract} to allow the transmission or storage of frame
  5185. sequences that have alpha in a format that doesn't support an alpha
  5186. channel.
  5187. For example, to reconstruct full frames from a normal YUV-encoded video
  5188. and a separate video created with @var{alphaextract}, you might use:
  5189. @example
  5190. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5191. @end example
  5192. @section amplify
  5193. Amplify differences between current pixel and pixels of adjacent frames in
  5194. same pixel location.
  5195. This filter accepts the following options:
  5196. @table @option
  5197. @item radius
  5198. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5199. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5200. @item factor
  5201. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5202. @item threshold
  5203. Set threshold for difference amplification. Any difference greater or equal to
  5204. this value will not alter source pixel. Default is 10.
  5205. Allowed range is from 0 to 65535.
  5206. @item tolerance
  5207. Set tolerance for difference amplification. Any difference lower to
  5208. this value will not alter source pixel. Default is 0.
  5209. Allowed range is from 0 to 65535.
  5210. @item low
  5211. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5212. This option controls maximum possible value that will decrease source pixel value.
  5213. @item high
  5214. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5215. This option controls maximum possible value that will increase source pixel value.
  5216. @item planes
  5217. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5218. @end table
  5219. @subsection Commands
  5220. This filter supports the following @ref{commands} that corresponds to option of same name:
  5221. @table @option
  5222. @item factor
  5223. @item threshold
  5224. @item tolerance
  5225. @item low
  5226. @item high
  5227. @item planes
  5228. @end table
  5229. @section ass
  5230. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5231. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5232. Substation Alpha) subtitles files.
  5233. This filter accepts the following option in addition to the common options from
  5234. the @ref{subtitles} filter:
  5235. @table @option
  5236. @item shaping
  5237. Set the shaping engine
  5238. Available values are:
  5239. @table @samp
  5240. @item auto
  5241. The default libass shaping engine, which is the best available.
  5242. @item simple
  5243. Fast, font-agnostic shaper that can do only substitutions
  5244. @item complex
  5245. Slower shaper using OpenType for substitutions and positioning
  5246. @end table
  5247. The default is @code{auto}.
  5248. @end table
  5249. @section atadenoise
  5250. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5251. The filter accepts the following options:
  5252. @table @option
  5253. @item 0a
  5254. Set threshold A for 1st plane. Default is 0.02.
  5255. Valid range is 0 to 0.3.
  5256. @item 0b
  5257. Set threshold B for 1st plane. Default is 0.04.
  5258. Valid range is 0 to 5.
  5259. @item 1a
  5260. Set threshold A for 2nd plane. Default is 0.02.
  5261. Valid range is 0 to 0.3.
  5262. @item 1b
  5263. Set threshold B for 2nd plane. Default is 0.04.
  5264. Valid range is 0 to 5.
  5265. @item 2a
  5266. Set threshold A for 3rd plane. Default is 0.02.
  5267. Valid range is 0 to 0.3.
  5268. @item 2b
  5269. Set threshold B for 3rd plane. Default is 0.04.
  5270. Valid range is 0 to 5.
  5271. Threshold A is designed to react on abrupt changes in the input signal and
  5272. threshold B is designed to react on continuous changes in the input signal.
  5273. @item s
  5274. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5275. number in range [5, 129].
  5276. @item p
  5277. Set what planes of frame filter will use for averaging. Default is all.
  5278. @item a
  5279. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5280. Alternatively can be set to @code{s} serial.
  5281. Parallel can be faster then serial, while other way around is never true.
  5282. Parallel will abort early on first change being greater then thresholds, while serial
  5283. will continue processing other side of frames if they are equal or below thresholds.
  5284. @end table
  5285. @subsection Commands
  5286. This filter supports same @ref{commands} as options except option @code{s}.
  5287. The command accepts the same syntax of the corresponding option.
  5288. @section avgblur
  5289. Apply average blur filter.
  5290. The filter accepts the following options:
  5291. @table @option
  5292. @item sizeX
  5293. Set horizontal radius size.
  5294. @item planes
  5295. Set which planes to filter. By default all planes are filtered.
  5296. @item sizeY
  5297. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5298. Default is @code{0}.
  5299. @end table
  5300. @subsection Commands
  5301. This filter supports same commands as options.
  5302. The command accepts the same syntax of the corresponding option.
  5303. If the specified expression is not valid, it is kept at its current
  5304. value.
  5305. @section bbox
  5306. Compute the bounding box for the non-black pixels in the input frame
  5307. luminance plane.
  5308. This filter computes the bounding box containing all the pixels with a
  5309. luminance value greater than the minimum allowed value.
  5310. The parameters describing the bounding box are printed on the filter
  5311. log.
  5312. The filter accepts the following option:
  5313. @table @option
  5314. @item min_val
  5315. Set the minimal luminance value. Default is @code{16}.
  5316. @end table
  5317. @section bilateral
  5318. Apply bilateral filter, spatial smoothing while preserving edges.
  5319. The filter accepts the following options:
  5320. @table @option
  5321. @item sigmaS
  5322. Set sigma of gaussian function to calculate spatial weight.
  5323. Allowed range is 0 to 512. Default is 0.1.
  5324. @item sigmaR
  5325. Set sigma of gaussian function to calculate range weight.
  5326. Allowed range is 0 to 1. Default is 0.1.
  5327. @item planes
  5328. Set planes to filter. Default is first only.
  5329. @end table
  5330. @section bitplanenoise
  5331. Show and measure bit plane noise.
  5332. The filter accepts the following options:
  5333. @table @option
  5334. @item bitplane
  5335. Set which plane to analyze. Default is @code{1}.
  5336. @item filter
  5337. Filter out noisy pixels from @code{bitplane} set above.
  5338. Default is disabled.
  5339. @end table
  5340. @section blackdetect
  5341. Detect video intervals that are (almost) completely black. Can be
  5342. useful to detect chapter transitions, commercials, or invalid
  5343. recordings.
  5344. The filter outputs its detection analysis to both the log as well as
  5345. frame metadata. If a black segment of at least the specified minimum
  5346. duration is found, a line with the start and end timestamps as well
  5347. as duration is printed to the log with level @code{info}. In addition,
  5348. a log line with level @code{debug} is printed per frame showing the
  5349. black amount detected for that frame.
  5350. The filter also attaches metadata to the first frame of a black
  5351. segment with key @code{lavfi.black_start} and to the first frame
  5352. after the black segment ends with key @code{lavfi.black_end}. The
  5353. value is the frame's timestamp. This metadata is added regardless
  5354. of the minimum duration specified.
  5355. The filter accepts the following options:
  5356. @table @option
  5357. @item black_min_duration, d
  5358. Set the minimum detected black duration expressed in seconds. It must
  5359. be a non-negative floating point number.
  5360. Default value is 2.0.
  5361. @item picture_black_ratio_th, pic_th
  5362. Set the threshold for considering a picture "black".
  5363. Express the minimum value for the ratio:
  5364. @example
  5365. @var{nb_black_pixels} / @var{nb_pixels}
  5366. @end example
  5367. for which a picture is considered black.
  5368. Default value is 0.98.
  5369. @item pixel_black_th, pix_th
  5370. Set the threshold for considering a pixel "black".
  5371. The threshold expresses the maximum pixel luminance value for which a
  5372. pixel is considered "black". The provided value is scaled according to
  5373. the following equation:
  5374. @example
  5375. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5376. @end example
  5377. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5378. the input video format, the range is [0-255] for YUV full-range
  5379. formats and [16-235] for YUV non full-range formats.
  5380. Default value is 0.10.
  5381. @end table
  5382. The following example sets the maximum pixel threshold to the minimum
  5383. value, and detects only black intervals of 2 or more seconds:
  5384. @example
  5385. blackdetect=d=2:pix_th=0.00
  5386. @end example
  5387. @section blackframe
  5388. Detect frames that are (almost) completely black. Can be useful to
  5389. detect chapter transitions or commercials. Output lines consist of
  5390. the frame number of the detected frame, the percentage of blackness,
  5391. the position in the file if known or -1 and the timestamp in seconds.
  5392. In order to display the output lines, you need to set the loglevel at
  5393. least to the AV_LOG_INFO value.
  5394. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5395. The value represents the percentage of pixels in the picture that
  5396. are below the threshold value.
  5397. It accepts the following parameters:
  5398. @table @option
  5399. @item amount
  5400. The percentage of the pixels that have to be below the threshold; it defaults to
  5401. @code{98}.
  5402. @item threshold, thresh
  5403. The threshold below which a pixel value is considered black; it defaults to
  5404. @code{32}.
  5405. @end table
  5406. @anchor{blend}
  5407. @section blend
  5408. Blend two video frames into each other.
  5409. The @code{blend} filter takes two input streams and outputs one
  5410. stream, the first input is the "top" layer and second input is
  5411. "bottom" layer. By default, the output terminates when the longest input terminates.
  5412. The @code{tblend} (time blend) filter takes two consecutive frames
  5413. from one single stream, and outputs the result obtained by blending
  5414. the new frame on top of the old frame.
  5415. A description of the accepted options follows.
  5416. @table @option
  5417. @item c0_mode
  5418. @item c1_mode
  5419. @item c2_mode
  5420. @item c3_mode
  5421. @item all_mode
  5422. Set blend mode for specific pixel component or all pixel components in case
  5423. of @var{all_mode}. Default value is @code{normal}.
  5424. Available values for component modes are:
  5425. @table @samp
  5426. @item addition
  5427. @item grainmerge
  5428. @item and
  5429. @item average
  5430. @item burn
  5431. @item darken
  5432. @item difference
  5433. @item grainextract
  5434. @item divide
  5435. @item dodge
  5436. @item freeze
  5437. @item exclusion
  5438. @item extremity
  5439. @item glow
  5440. @item hardlight
  5441. @item hardmix
  5442. @item heat
  5443. @item lighten
  5444. @item linearlight
  5445. @item multiply
  5446. @item multiply128
  5447. @item negation
  5448. @item normal
  5449. @item or
  5450. @item overlay
  5451. @item phoenix
  5452. @item pinlight
  5453. @item reflect
  5454. @item screen
  5455. @item softlight
  5456. @item subtract
  5457. @item vividlight
  5458. @item xor
  5459. @end table
  5460. @item c0_opacity
  5461. @item c1_opacity
  5462. @item c2_opacity
  5463. @item c3_opacity
  5464. @item all_opacity
  5465. Set blend opacity for specific pixel component or all pixel components in case
  5466. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5467. @item c0_expr
  5468. @item c1_expr
  5469. @item c2_expr
  5470. @item c3_expr
  5471. @item all_expr
  5472. Set blend expression for specific pixel component or all pixel components in case
  5473. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5474. The expressions can use the following variables:
  5475. @table @option
  5476. @item N
  5477. The sequential number of the filtered frame, starting from @code{0}.
  5478. @item X
  5479. @item Y
  5480. the coordinates of the current sample
  5481. @item W
  5482. @item H
  5483. the width and height of currently filtered plane
  5484. @item SW
  5485. @item SH
  5486. Width and height scale for the plane being filtered. It is the
  5487. ratio between the dimensions of the current plane to the luma plane,
  5488. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5489. the luma plane and @code{0.5,0.5} for the chroma planes.
  5490. @item T
  5491. Time of the current frame, expressed in seconds.
  5492. @item TOP, A
  5493. Value of pixel component at current location for first video frame (top layer).
  5494. @item BOTTOM, B
  5495. Value of pixel component at current location for second video frame (bottom layer).
  5496. @end table
  5497. @end table
  5498. The @code{blend} filter also supports the @ref{framesync} options.
  5499. @subsection Examples
  5500. @itemize
  5501. @item
  5502. Apply transition from bottom layer to top layer in first 10 seconds:
  5503. @example
  5504. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5505. @end example
  5506. @item
  5507. Apply linear horizontal transition from top layer to bottom layer:
  5508. @example
  5509. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5510. @end example
  5511. @item
  5512. Apply 1x1 checkerboard effect:
  5513. @example
  5514. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5515. @end example
  5516. @item
  5517. Apply uncover left effect:
  5518. @example
  5519. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5520. @end example
  5521. @item
  5522. Apply uncover down effect:
  5523. @example
  5524. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5525. @end example
  5526. @item
  5527. Apply uncover up-left effect:
  5528. @example
  5529. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5530. @end example
  5531. @item
  5532. Split diagonally video and shows top and bottom layer on each side:
  5533. @example
  5534. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5535. @end example
  5536. @item
  5537. Display differences between the current and the previous frame:
  5538. @example
  5539. tblend=all_mode=grainextract
  5540. @end example
  5541. @end itemize
  5542. @section bm3d
  5543. Denoise frames using Block-Matching 3D algorithm.
  5544. The filter accepts the following options.
  5545. @table @option
  5546. @item sigma
  5547. Set denoising strength. Default value is 1.
  5548. Allowed range is from 0 to 999.9.
  5549. The denoising algorithm is very sensitive to sigma, so adjust it
  5550. according to the source.
  5551. @item block
  5552. Set local patch size. This sets dimensions in 2D.
  5553. @item bstep
  5554. Set sliding step for processing blocks. Default value is 4.
  5555. Allowed range is from 1 to 64.
  5556. Smaller values allows processing more reference blocks and is slower.
  5557. @item group
  5558. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5559. When set to 1, no block matching is done. Larger values allows more blocks
  5560. in single group.
  5561. Allowed range is from 1 to 256.
  5562. @item range
  5563. Set radius for search block matching. Default is 9.
  5564. Allowed range is from 1 to INT32_MAX.
  5565. @item mstep
  5566. Set step between two search locations for block matching. Default is 1.
  5567. Allowed range is from 1 to 64. Smaller is slower.
  5568. @item thmse
  5569. Set threshold of mean square error for block matching. Valid range is 0 to
  5570. INT32_MAX.
  5571. @item hdthr
  5572. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5573. Larger values results in stronger hard-thresholding filtering in frequency
  5574. domain.
  5575. @item estim
  5576. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5577. Default is @code{basic}.
  5578. @item ref
  5579. If enabled, filter will use 2nd stream for block matching.
  5580. Default is disabled for @code{basic} value of @var{estim} option,
  5581. and always enabled if value of @var{estim} is @code{final}.
  5582. @item planes
  5583. Set planes to filter. Default is all available except alpha.
  5584. @end table
  5585. @subsection Examples
  5586. @itemize
  5587. @item
  5588. Basic filtering with bm3d:
  5589. @example
  5590. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5591. @end example
  5592. @item
  5593. Same as above, but filtering only luma:
  5594. @example
  5595. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5596. @end example
  5597. @item
  5598. Same as above, but with both estimation modes:
  5599. @example
  5600. 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
  5601. @end example
  5602. @item
  5603. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5604. @example
  5605. 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
  5606. @end example
  5607. @end itemize
  5608. @section boxblur
  5609. Apply a boxblur algorithm to the input video.
  5610. It accepts the following parameters:
  5611. @table @option
  5612. @item luma_radius, lr
  5613. @item luma_power, lp
  5614. @item chroma_radius, cr
  5615. @item chroma_power, cp
  5616. @item alpha_radius, ar
  5617. @item alpha_power, ap
  5618. @end table
  5619. A description of the accepted options follows.
  5620. @table @option
  5621. @item luma_radius, lr
  5622. @item chroma_radius, cr
  5623. @item alpha_radius, ar
  5624. Set an expression for the box radius in pixels used for blurring the
  5625. corresponding input plane.
  5626. The radius value must be a non-negative number, and must not be
  5627. greater than the value of the expression @code{min(w,h)/2} for the
  5628. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5629. planes.
  5630. Default value for @option{luma_radius} is "2". If not specified,
  5631. @option{chroma_radius} and @option{alpha_radius} default to the
  5632. corresponding value set for @option{luma_radius}.
  5633. The expressions can contain the following constants:
  5634. @table @option
  5635. @item w
  5636. @item h
  5637. The input width and height in pixels.
  5638. @item cw
  5639. @item ch
  5640. The input chroma image width and height in pixels.
  5641. @item hsub
  5642. @item vsub
  5643. The horizontal and vertical chroma subsample values. For example, for the
  5644. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5645. @end table
  5646. @item luma_power, lp
  5647. @item chroma_power, cp
  5648. @item alpha_power, ap
  5649. Specify how many times the boxblur filter is applied to the
  5650. corresponding plane.
  5651. Default value for @option{luma_power} is 2. If not specified,
  5652. @option{chroma_power} and @option{alpha_power} default to the
  5653. corresponding value set for @option{luma_power}.
  5654. A value of 0 will disable the effect.
  5655. @end table
  5656. @subsection Examples
  5657. @itemize
  5658. @item
  5659. Apply a boxblur filter with the luma, chroma, and alpha radii
  5660. set to 2:
  5661. @example
  5662. boxblur=luma_radius=2:luma_power=1
  5663. boxblur=2:1
  5664. @end example
  5665. @item
  5666. Set the luma radius to 2, and alpha and chroma radius to 0:
  5667. @example
  5668. boxblur=2:1:cr=0:ar=0
  5669. @end example
  5670. @item
  5671. Set the luma and chroma radii to a fraction of the video dimension:
  5672. @example
  5673. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5674. @end example
  5675. @end itemize
  5676. @section bwdif
  5677. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5678. Deinterlacing Filter").
  5679. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5680. interpolation algorithms.
  5681. It accepts the following parameters:
  5682. @table @option
  5683. @item mode
  5684. The interlacing mode to adopt. It accepts one of the following values:
  5685. @table @option
  5686. @item 0, send_frame
  5687. Output one frame for each frame.
  5688. @item 1, send_field
  5689. Output one frame for each field.
  5690. @end table
  5691. The default value is @code{send_field}.
  5692. @item parity
  5693. The picture field parity assumed for the input interlaced video. It accepts one
  5694. of the following values:
  5695. @table @option
  5696. @item 0, tff
  5697. Assume the top field is first.
  5698. @item 1, bff
  5699. Assume the bottom field is first.
  5700. @item -1, auto
  5701. Enable automatic detection of field parity.
  5702. @end table
  5703. The default value is @code{auto}.
  5704. If the interlacing is unknown or the decoder does not export this information,
  5705. top field first will be assumed.
  5706. @item deint
  5707. Specify which frames to deinterlace. Accepts one of the following
  5708. values:
  5709. @table @option
  5710. @item 0, all
  5711. Deinterlace all frames.
  5712. @item 1, interlaced
  5713. Only deinterlace frames marked as interlaced.
  5714. @end table
  5715. The default value is @code{all}.
  5716. @end table
  5717. @section cas
  5718. Apply Contrast Adaptive Sharpen filter to video stream.
  5719. The filter accepts the following options:
  5720. @table @option
  5721. @item strength
  5722. Set the sharpening strength. Default value is 0.
  5723. @item planes
  5724. Set planes to filter. Default value is to filter all
  5725. planes except alpha plane.
  5726. @end table
  5727. @section chromahold
  5728. Remove all color information for all colors except for certain one.
  5729. The filter accepts the following options:
  5730. @table @option
  5731. @item color
  5732. The color which will not be replaced with neutral chroma.
  5733. @item similarity
  5734. Similarity percentage with the above color.
  5735. 0.01 matches only the exact key color, while 1.0 matches everything.
  5736. @item blend
  5737. Blend percentage.
  5738. 0.0 makes pixels either fully gray, or not gray at all.
  5739. Higher values result in more preserved color.
  5740. @item yuv
  5741. Signals that the color passed is already in YUV instead of RGB.
  5742. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5743. This can be used to pass exact YUV values as hexadecimal numbers.
  5744. @end table
  5745. @subsection Commands
  5746. This filter supports same @ref{commands} as options.
  5747. The command accepts the same syntax of the corresponding option.
  5748. If the specified expression is not valid, it is kept at its current
  5749. value.
  5750. @section chromakey
  5751. YUV colorspace color/chroma keying.
  5752. The filter accepts the following options:
  5753. @table @option
  5754. @item color
  5755. The color which will be replaced with transparency.
  5756. @item similarity
  5757. Similarity percentage with the key color.
  5758. 0.01 matches only the exact key color, while 1.0 matches everything.
  5759. @item blend
  5760. Blend percentage.
  5761. 0.0 makes pixels either fully transparent, or not transparent at all.
  5762. Higher values result in semi-transparent pixels, with a higher transparency
  5763. the more similar the pixels color is to the key color.
  5764. @item yuv
  5765. Signals that the color passed is already in YUV instead of RGB.
  5766. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5767. This can be used to pass exact YUV values as hexadecimal numbers.
  5768. @end table
  5769. @subsection Commands
  5770. This filter supports same @ref{commands} as options.
  5771. The command accepts the same syntax of the corresponding option.
  5772. If the specified expression is not valid, it is kept at its current
  5773. value.
  5774. @subsection Examples
  5775. @itemize
  5776. @item
  5777. Make every green pixel in the input image transparent:
  5778. @example
  5779. ffmpeg -i input.png -vf chromakey=green out.png
  5780. @end example
  5781. @item
  5782. Overlay a greenscreen-video on top of a static black background.
  5783. @example
  5784. 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
  5785. @end example
  5786. @end itemize
  5787. @section chromanr
  5788. Reduce chrominance noise.
  5789. The filter accepts the following options:
  5790. @table @option
  5791. @item thres
  5792. Set threshold for averaging chrominance values.
  5793. Sum of absolute difference of U and V pixel components or current
  5794. pixel and neighbour pixels lower than this threshold will be used in
  5795. averaging. Luma component is left unchanged and is copied to output.
  5796. Default value is 30. Allowed range is from 1 to 200.
  5797. @item sizew
  5798. Set horizontal radius of rectangle used for averaging.
  5799. Allowed range is from 1 to 100. Default value is 5.
  5800. @item sizeh
  5801. Set vertical radius of rectangle used for averaging.
  5802. Allowed range is from 1 to 100. Default value is 5.
  5803. @item stepw
  5804. Set horizontal step when averaging. Default value is 1.
  5805. Allowed range is from 1 to 50.
  5806. Mostly useful to speed-up filtering.
  5807. @item steph
  5808. Set vertical step when averaging. Default value is 1.
  5809. Allowed range is from 1 to 50.
  5810. Mostly useful to speed-up filtering.
  5811. @end table
  5812. @subsection Commands
  5813. This filter supports same @ref{commands} as options.
  5814. The command accepts the same syntax of the corresponding option.
  5815. @section chromashift
  5816. Shift chroma pixels horizontally and/or vertically.
  5817. The filter accepts the following options:
  5818. @table @option
  5819. @item cbh
  5820. Set amount to shift chroma-blue horizontally.
  5821. @item cbv
  5822. Set amount to shift chroma-blue vertically.
  5823. @item crh
  5824. Set amount to shift chroma-red horizontally.
  5825. @item crv
  5826. Set amount to shift chroma-red vertically.
  5827. @item edge
  5828. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5829. @end table
  5830. @subsection Commands
  5831. This filter supports the all above options as @ref{commands}.
  5832. @section ciescope
  5833. Display CIE color diagram with pixels overlaid onto it.
  5834. The filter accepts the following options:
  5835. @table @option
  5836. @item system
  5837. Set color system.
  5838. @table @samp
  5839. @item ntsc, 470m
  5840. @item ebu, 470bg
  5841. @item smpte
  5842. @item 240m
  5843. @item apple
  5844. @item widergb
  5845. @item cie1931
  5846. @item rec709, hdtv
  5847. @item uhdtv, rec2020
  5848. @item dcip3
  5849. @end table
  5850. @item cie
  5851. Set CIE system.
  5852. @table @samp
  5853. @item xyy
  5854. @item ucs
  5855. @item luv
  5856. @end table
  5857. @item gamuts
  5858. Set what gamuts to draw.
  5859. See @code{system} option for available values.
  5860. @item size, s
  5861. Set ciescope size, by default set to 512.
  5862. @item intensity, i
  5863. Set intensity used to map input pixel values to CIE diagram.
  5864. @item contrast
  5865. Set contrast used to draw tongue colors that are out of active color system gamut.
  5866. @item corrgamma
  5867. Correct gamma displayed on scope, by default enabled.
  5868. @item showwhite
  5869. Show white point on CIE diagram, by default disabled.
  5870. @item gamma
  5871. Set input gamma. Used only with XYZ input color space.
  5872. @end table
  5873. @section codecview
  5874. Visualize information exported by some codecs.
  5875. Some codecs can export information through frames using side-data or other
  5876. means. For example, some MPEG based codecs export motion vectors through the
  5877. @var{export_mvs} flag in the codec @option{flags2} option.
  5878. The filter accepts the following option:
  5879. @table @option
  5880. @item mv
  5881. Set motion vectors to visualize.
  5882. Available flags for @var{mv} are:
  5883. @table @samp
  5884. @item pf
  5885. forward predicted MVs of P-frames
  5886. @item bf
  5887. forward predicted MVs of B-frames
  5888. @item bb
  5889. backward predicted MVs of B-frames
  5890. @end table
  5891. @item qp
  5892. Display quantization parameters using the chroma planes.
  5893. @item mv_type, mvt
  5894. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5895. Available flags for @var{mv_type} are:
  5896. @table @samp
  5897. @item fp
  5898. forward predicted MVs
  5899. @item bp
  5900. backward predicted MVs
  5901. @end table
  5902. @item frame_type, ft
  5903. Set frame type to visualize motion vectors of.
  5904. Available flags for @var{frame_type} are:
  5905. @table @samp
  5906. @item if
  5907. intra-coded frames (I-frames)
  5908. @item pf
  5909. predicted frames (P-frames)
  5910. @item bf
  5911. bi-directionally predicted frames (B-frames)
  5912. @end table
  5913. @end table
  5914. @subsection Examples
  5915. @itemize
  5916. @item
  5917. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5918. @example
  5919. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5920. @end example
  5921. @item
  5922. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5923. @example
  5924. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5925. @end example
  5926. @end itemize
  5927. @section colorbalance
  5928. Modify intensity of primary colors (red, green and blue) of input frames.
  5929. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5930. regions for the red-cyan, green-magenta or blue-yellow balance.
  5931. A positive adjustment value shifts the balance towards the primary color, a negative
  5932. value towards the complementary color.
  5933. The filter accepts the following options:
  5934. @table @option
  5935. @item rs
  5936. @item gs
  5937. @item bs
  5938. Adjust red, green and blue shadows (darkest pixels).
  5939. @item rm
  5940. @item gm
  5941. @item bm
  5942. Adjust red, green and blue midtones (medium pixels).
  5943. @item rh
  5944. @item gh
  5945. @item bh
  5946. Adjust red, green and blue highlights (brightest pixels).
  5947. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5948. @item pl
  5949. Preserve lightness when changing color balance. Default is disabled.
  5950. @end table
  5951. @subsection Examples
  5952. @itemize
  5953. @item
  5954. Add red color cast to shadows:
  5955. @example
  5956. colorbalance=rs=.3
  5957. @end example
  5958. @end itemize
  5959. @subsection Commands
  5960. This filter supports the all above options as @ref{commands}.
  5961. @section colorchannelmixer
  5962. Adjust video input frames by re-mixing color channels.
  5963. This filter modifies a color channel by adding the values associated to
  5964. the other channels of the same pixels. For example if the value to
  5965. modify is red, the output value will be:
  5966. @example
  5967. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5968. @end example
  5969. The filter accepts the following options:
  5970. @table @option
  5971. @item rr
  5972. @item rg
  5973. @item rb
  5974. @item ra
  5975. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5976. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5977. @item gr
  5978. @item gg
  5979. @item gb
  5980. @item ga
  5981. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5982. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5983. @item br
  5984. @item bg
  5985. @item bb
  5986. @item ba
  5987. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5988. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5989. @item ar
  5990. @item ag
  5991. @item ab
  5992. @item aa
  5993. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5994. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5995. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5996. @end table
  5997. @subsection Examples
  5998. @itemize
  5999. @item
  6000. Convert source to grayscale:
  6001. @example
  6002. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6003. @end example
  6004. @item
  6005. Simulate sepia tones:
  6006. @example
  6007. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6008. @end example
  6009. @end itemize
  6010. @subsection Commands
  6011. This filter supports the all above options as @ref{commands}.
  6012. @section colorkey
  6013. RGB colorspace color keying.
  6014. The filter accepts the following options:
  6015. @table @option
  6016. @item color
  6017. The color which will be replaced with transparency.
  6018. @item similarity
  6019. Similarity percentage with the key color.
  6020. 0.01 matches only the exact key color, while 1.0 matches everything.
  6021. @item blend
  6022. Blend percentage.
  6023. 0.0 makes pixels either fully transparent, or not transparent at all.
  6024. Higher values result in semi-transparent pixels, with a higher transparency
  6025. the more similar the pixels color is to the key color.
  6026. @end table
  6027. @subsection Examples
  6028. @itemize
  6029. @item
  6030. Make every green pixel in the input image transparent:
  6031. @example
  6032. ffmpeg -i input.png -vf colorkey=green out.png
  6033. @end example
  6034. @item
  6035. Overlay a greenscreen-video on top of a static background image.
  6036. @example
  6037. 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
  6038. @end example
  6039. @end itemize
  6040. @subsection Commands
  6041. This filter supports same @ref{commands} as options.
  6042. The command accepts the same syntax of the corresponding option.
  6043. If the specified expression is not valid, it is kept at its current
  6044. value.
  6045. @section colorhold
  6046. Remove all color information for all RGB colors except for certain one.
  6047. The filter accepts the following options:
  6048. @table @option
  6049. @item color
  6050. The color which will not be replaced with neutral gray.
  6051. @item similarity
  6052. Similarity percentage with the above color.
  6053. 0.01 matches only the exact key color, while 1.0 matches everything.
  6054. @item blend
  6055. Blend percentage. 0.0 makes pixels fully gray.
  6056. Higher values result in more preserved color.
  6057. @end table
  6058. @subsection Commands
  6059. This filter supports same @ref{commands} as options.
  6060. The command accepts the same syntax of the corresponding option.
  6061. If the specified expression is not valid, it is kept at its current
  6062. value.
  6063. @section colorlevels
  6064. Adjust video input frames using levels.
  6065. The filter accepts the following options:
  6066. @table @option
  6067. @item rimin
  6068. @item gimin
  6069. @item bimin
  6070. @item aimin
  6071. Adjust red, green, blue and alpha input black point.
  6072. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6073. @item rimax
  6074. @item gimax
  6075. @item bimax
  6076. @item aimax
  6077. Adjust red, green, blue and alpha input white point.
  6078. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6079. Input levels are used to lighten highlights (bright tones), darken shadows
  6080. (dark tones), change the balance of bright and dark tones.
  6081. @item romin
  6082. @item gomin
  6083. @item bomin
  6084. @item aomin
  6085. Adjust red, green, blue and alpha output black point.
  6086. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6087. @item romax
  6088. @item gomax
  6089. @item bomax
  6090. @item aomax
  6091. Adjust red, green, blue and alpha output white point.
  6092. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6093. Output levels allows manual selection of a constrained output level range.
  6094. @end table
  6095. @subsection Examples
  6096. @itemize
  6097. @item
  6098. Make video output darker:
  6099. @example
  6100. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6101. @end example
  6102. @item
  6103. Increase contrast:
  6104. @example
  6105. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6106. @end example
  6107. @item
  6108. Make video output lighter:
  6109. @example
  6110. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6111. @end example
  6112. @item
  6113. Increase brightness:
  6114. @example
  6115. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6116. @end example
  6117. @end itemize
  6118. @subsection Commands
  6119. This filter supports the all above options as @ref{commands}.
  6120. @section colormatrix
  6121. Convert color matrix.
  6122. The filter accepts the following options:
  6123. @table @option
  6124. @item src
  6125. @item dst
  6126. Specify the source and destination color matrix. Both values must be
  6127. specified.
  6128. The accepted values are:
  6129. @table @samp
  6130. @item bt709
  6131. BT.709
  6132. @item fcc
  6133. FCC
  6134. @item bt601
  6135. BT.601
  6136. @item bt470
  6137. BT.470
  6138. @item bt470bg
  6139. BT.470BG
  6140. @item smpte170m
  6141. SMPTE-170M
  6142. @item smpte240m
  6143. SMPTE-240M
  6144. @item bt2020
  6145. BT.2020
  6146. @end table
  6147. @end table
  6148. For example to convert from BT.601 to SMPTE-240M, use the command:
  6149. @example
  6150. colormatrix=bt601:smpte240m
  6151. @end example
  6152. @section colorspace
  6153. Convert colorspace, transfer characteristics or color primaries.
  6154. Input video needs to have an even size.
  6155. The filter accepts the following options:
  6156. @table @option
  6157. @anchor{all}
  6158. @item all
  6159. Specify all color properties at once.
  6160. The accepted values are:
  6161. @table @samp
  6162. @item bt470m
  6163. BT.470M
  6164. @item bt470bg
  6165. BT.470BG
  6166. @item bt601-6-525
  6167. BT.601-6 525
  6168. @item bt601-6-625
  6169. BT.601-6 625
  6170. @item bt709
  6171. BT.709
  6172. @item smpte170m
  6173. SMPTE-170M
  6174. @item smpte240m
  6175. SMPTE-240M
  6176. @item bt2020
  6177. BT.2020
  6178. @end table
  6179. @anchor{space}
  6180. @item space
  6181. Specify output colorspace.
  6182. The accepted values are:
  6183. @table @samp
  6184. @item bt709
  6185. BT.709
  6186. @item fcc
  6187. FCC
  6188. @item bt470bg
  6189. BT.470BG or BT.601-6 625
  6190. @item smpte170m
  6191. SMPTE-170M or BT.601-6 525
  6192. @item smpte240m
  6193. SMPTE-240M
  6194. @item ycgco
  6195. YCgCo
  6196. @item bt2020ncl
  6197. BT.2020 with non-constant luminance
  6198. @end table
  6199. @anchor{trc}
  6200. @item trc
  6201. Specify output transfer characteristics.
  6202. The accepted values are:
  6203. @table @samp
  6204. @item bt709
  6205. BT.709
  6206. @item bt470m
  6207. BT.470M
  6208. @item bt470bg
  6209. BT.470BG
  6210. @item gamma22
  6211. Constant gamma of 2.2
  6212. @item gamma28
  6213. Constant gamma of 2.8
  6214. @item smpte170m
  6215. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6216. @item smpte240m
  6217. SMPTE-240M
  6218. @item srgb
  6219. SRGB
  6220. @item iec61966-2-1
  6221. iec61966-2-1
  6222. @item iec61966-2-4
  6223. iec61966-2-4
  6224. @item xvycc
  6225. xvycc
  6226. @item bt2020-10
  6227. BT.2020 for 10-bits content
  6228. @item bt2020-12
  6229. BT.2020 for 12-bits content
  6230. @end table
  6231. @anchor{primaries}
  6232. @item primaries
  6233. Specify output color primaries.
  6234. The accepted values are:
  6235. @table @samp
  6236. @item bt709
  6237. BT.709
  6238. @item bt470m
  6239. BT.470M
  6240. @item bt470bg
  6241. BT.470BG or BT.601-6 625
  6242. @item smpte170m
  6243. SMPTE-170M or BT.601-6 525
  6244. @item smpte240m
  6245. SMPTE-240M
  6246. @item film
  6247. film
  6248. @item smpte431
  6249. SMPTE-431
  6250. @item smpte432
  6251. SMPTE-432
  6252. @item bt2020
  6253. BT.2020
  6254. @item jedec-p22
  6255. JEDEC P22 phosphors
  6256. @end table
  6257. @anchor{range}
  6258. @item range
  6259. Specify output color range.
  6260. The accepted values are:
  6261. @table @samp
  6262. @item tv
  6263. TV (restricted) range
  6264. @item mpeg
  6265. MPEG (restricted) range
  6266. @item pc
  6267. PC (full) range
  6268. @item jpeg
  6269. JPEG (full) range
  6270. @end table
  6271. @item format
  6272. Specify output color format.
  6273. The accepted values are:
  6274. @table @samp
  6275. @item yuv420p
  6276. YUV 4:2:0 planar 8-bits
  6277. @item yuv420p10
  6278. YUV 4:2:0 planar 10-bits
  6279. @item yuv420p12
  6280. YUV 4:2:0 planar 12-bits
  6281. @item yuv422p
  6282. YUV 4:2:2 planar 8-bits
  6283. @item yuv422p10
  6284. YUV 4:2:2 planar 10-bits
  6285. @item yuv422p12
  6286. YUV 4:2:2 planar 12-bits
  6287. @item yuv444p
  6288. YUV 4:4:4 planar 8-bits
  6289. @item yuv444p10
  6290. YUV 4:4:4 planar 10-bits
  6291. @item yuv444p12
  6292. YUV 4:4:4 planar 12-bits
  6293. @end table
  6294. @item fast
  6295. Do a fast conversion, which skips gamma/primary correction. This will take
  6296. significantly less CPU, but will be mathematically incorrect. To get output
  6297. compatible with that produced by the colormatrix filter, use fast=1.
  6298. @item dither
  6299. Specify dithering mode.
  6300. The accepted values are:
  6301. @table @samp
  6302. @item none
  6303. No dithering
  6304. @item fsb
  6305. Floyd-Steinberg dithering
  6306. @end table
  6307. @item wpadapt
  6308. Whitepoint adaptation mode.
  6309. The accepted values are:
  6310. @table @samp
  6311. @item bradford
  6312. Bradford whitepoint adaptation
  6313. @item vonkries
  6314. von Kries whitepoint adaptation
  6315. @item identity
  6316. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6317. @end table
  6318. @item iall
  6319. Override all input properties at once. Same accepted values as @ref{all}.
  6320. @item ispace
  6321. Override input colorspace. Same accepted values as @ref{space}.
  6322. @item iprimaries
  6323. Override input color primaries. Same accepted values as @ref{primaries}.
  6324. @item itrc
  6325. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6326. @item irange
  6327. Override input color range. Same accepted values as @ref{range}.
  6328. @end table
  6329. The filter converts the transfer characteristics, color space and color
  6330. primaries to the specified user values. The output value, if not specified,
  6331. is set to a default value based on the "all" property. If that property is
  6332. also not specified, the filter will log an error. The output color range and
  6333. format default to the same value as the input color range and format. The
  6334. input transfer characteristics, color space, color primaries and color range
  6335. should be set on the input data. If any of these are missing, the filter will
  6336. log an error and no conversion will take place.
  6337. For example to convert the input to SMPTE-240M, use the command:
  6338. @example
  6339. colorspace=smpte240m
  6340. @end example
  6341. @section convolution
  6342. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6343. The filter accepts the following options:
  6344. @table @option
  6345. @item 0m
  6346. @item 1m
  6347. @item 2m
  6348. @item 3m
  6349. Set matrix for each plane.
  6350. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6351. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6352. @item 0rdiv
  6353. @item 1rdiv
  6354. @item 2rdiv
  6355. @item 3rdiv
  6356. Set multiplier for calculated value for each plane.
  6357. If unset or 0, it will be sum of all matrix elements.
  6358. @item 0bias
  6359. @item 1bias
  6360. @item 2bias
  6361. @item 3bias
  6362. Set bias for each plane. This value is added to the result of the multiplication.
  6363. Useful for making the overall image brighter or darker. Default is 0.0.
  6364. @item 0mode
  6365. @item 1mode
  6366. @item 2mode
  6367. @item 3mode
  6368. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6369. Default is @var{square}.
  6370. @end table
  6371. @subsection Examples
  6372. @itemize
  6373. @item
  6374. Apply sharpen:
  6375. @example
  6376. 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"
  6377. @end example
  6378. @item
  6379. Apply blur:
  6380. @example
  6381. 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"
  6382. @end example
  6383. @item
  6384. Apply edge enhance:
  6385. @example
  6386. 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"
  6387. @end example
  6388. @item
  6389. Apply edge detect:
  6390. @example
  6391. 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"
  6392. @end example
  6393. @item
  6394. Apply laplacian edge detector which includes diagonals:
  6395. @example
  6396. 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"
  6397. @end example
  6398. @item
  6399. Apply emboss:
  6400. @example
  6401. 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"
  6402. @end example
  6403. @end itemize
  6404. @section convolve
  6405. Apply 2D convolution of video stream in frequency domain using second stream
  6406. as impulse.
  6407. The filter accepts the following options:
  6408. @table @option
  6409. @item planes
  6410. Set which planes to process.
  6411. @item impulse
  6412. Set which impulse video frames will be processed, can be @var{first}
  6413. or @var{all}. Default is @var{all}.
  6414. @end table
  6415. The @code{convolve} filter also supports the @ref{framesync} options.
  6416. @section copy
  6417. Copy the input video source unchanged to the output. This is mainly useful for
  6418. testing purposes.
  6419. @anchor{coreimage}
  6420. @section coreimage
  6421. Video filtering on GPU using Apple's CoreImage API on OSX.
  6422. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6423. processed by video hardware. However, software-based OpenGL implementations
  6424. exist which means there is no guarantee for hardware processing. It depends on
  6425. the respective OSX.
  6426. There are many filters and image generators provided by Apple that come with a
  6427. large variety of options. The filter has to be referenced by its name along
  6428. with its options.
  6429. The coreimage filter accepts the following options:
  6430. @table @option
  6431. @item list_filters
  6432. List all available filters and generators along with all their respective
  6433. options as well as possible minimum and maximum values along with the default
  6434. values.
  6435. @example
  6436. list_filters=true
  6437. @end example
  6438. @item filter
  6439. Specify all filters by their respective name and options.
  6440. Use @var{list_filters} to determine all valid filter names and options.
  6441. Numerical options are specified by a float value and are automatically clamped
  6442. to their respective value range. Vector and color options have to be specified
  6443. by a list of space separated float values. Character escaping has to be done.
  6444. A special option name @code{default} is available to use default options for a
  6445. filter.
  6446. It is required to specify either @code{default} or at least one of the filter options.
  6447. All omitted options are used with their default values.
  6448. The syntax of the filter string is as follows:
  6449. @example
  6450. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6451. @end example
  6452. @item output_rect
  6453. Specify a rectangle where the output of the filter chain is copied into the
  6454. input image. It is given by a list of space separated float values:
  6455. @example
  6456. output_rect=x\ y\ width\ height
  6457. @end example
  6458. If not given, the output rectangle equals the dimensions of the input image.
  6459. The output rectangle is automatically cropped at the borders of the input
  6460. image. Negative values are valid for each component.
  6461. @example
  6462. output_rect=25\ 25\ 100\ 100
  6463. @end example
  6464. @end table
  6465. Several filters can be chained for successive processing without GPU-HOST
  6466. transfers allowing for fast processing of complex filter chains.
  6467. Currently, only filters with zero (generators) or exactly one (filters) input
  6468. image and one output image are supported. Also, transition filters are not yet
  6469. usable as intended.
  6470. Some filters generate output images with additional padding depending on the
  6471. respective filter kernel. The padding is automatically removed to ensure the
  6472. filter output has the same size as the input image.
  6473. For image generators, the size of the output image is determined by the
  6474. previous output image of the filter chain or the input image of the whole
  6475. filterchain, respectively. The generators do not use the pixel information of
  6476. this image to generate their output. However, the generated output is
  6477. blended onto this image, resulting in partial or complete coverage of the
  6478. output image.
  6479. The @ref{coreimagesrc} video source can be used for generating input images
  6480. which are directly fed into the filter chain. By using it, providing input
  6481. images by another video source or an input video is not required.
  6482. @subsection Examples
  6483. @itemize
  6484. @item
  6485. List all filters available:
  6486. @example
  6487. coreimage=list_filters=true
  6488. @end example
  6489. @item
  6490. Use the CIBoxBlur filter with default options to blur an image:
  6491. @example
  6492. coreimage=filter=CIBoxBlur@@default
  6493. @end example
  6494. @item
  6495. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6496. its center at 100x100 and a radius of 50 pixels:
  6497. @example
  6498. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6499. @end example
  6500. @item
  6501. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6502. given as complete and escaped command-line for Apple's standard bash shell:
  6503. @example
  6504. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6505. @end example
  6506. @end itemize
  6507. @section cover_rect
  6508. Cover a rectangular object
  6509. It accepts the following options:
  6510. @table @option
  6511. @item cover
  6512. Filepath of the optional cover image, needs to be in yuv420.
  6513. @item mode
  6514. Set covering mode.
  6515. It accepts the following values:
  6516. @table @samp
  6517. @item cover
  6518. cover it by the supplied image
  6519. @item blur
  6520. cover it by interpolating the surrounding pixels
  6521. @end table
  6522. Default value is @var{blur}.
  6523. @end table
  6524. @subsection Examples
  6525. @itemize
  6526. @item
  6527. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6528. @example
  6529. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6530. @end example
  6531. @end itemize
  6532. @section crop
  6533. Crop the input video to given dimensions.
  6534. It accepts the following parameters:
  6535. @table @option
  6536. @item w, out_w
  6537. The width of the output video. It defaults to @code{iw}.
  6538. This expression is evaluated only once during the filter
  6539. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6540. @item h, out_h
  6541. The height of the output video. It defaults to @code{ih}.
  6542. This expression is evaluated only once during the filter
  6543. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6544. @item x
  6545. The horizontal position, in the input video, of the left edge of the output
  6546. video. It defaults to @code{(in_w-out_w)/2}.
  6547. This expression is evaluated per-frame.
  6548. @item y
  6549. The vertical position, in the input video, of the top edge of the output video.
  6550. It defaults to @code{(in_h-out_h)/2}.
  6551. This expression is evaluated per-frame.
  6552. @item keep_aspect
  6553. If set to 1 will force the output display aspect ratio
  6554. to be the same of the input, by changing the output sample aspect
  6555. ratio. It defaults to 0.
  6556. @item exact
  6557. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6558. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6559. It defaults to 0.
  6560. @end table
  6561. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6562. expressions containing the following constants:
  6563. @table @option
  6564. @item x
  6565. @item y
  6566. The computed values for @var{x} and @var{y}. They are evaluated for
  6567. each new frame.
  6568. @item in_w
  6569. @item in_h
  6570. The input width and height.
  6571. @item iw
  6572. @item ih
  6573. These are the same as @var{in_w} and @var{in_h}.
  6574. @item out_w
  6575. @item out_h
  6576. The output (cropped) width and height.
  6577. @item ow
  6578. @item oh
  6579. These are the same as @var{out_w} and @var{out_h}.
  6580. @item a
  6581. same as @var{iw} / @var{ih}
  6582. @item sar
  6583. input sample aspect ratio
  6584. @item dar
  6585. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6586. @item hsub
  6587. @item vsub
  6588. horizontal and vertical chroma subsample values. For example for the
  6589. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6590. @item n
  6591. The number of the input frame, starting from 0.
  6592. @item pos
  6593. the position in the file of the input frame, NAN if unknown
  6594. @item t
  6595. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6596. @end table
  6597. The expression for @var{out_w} may depend on the value of @var{out_h},
  6598. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6599. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6600. evaluated after @var{out_w} and @var{out_h}.
  6601. The @var{x} and @var{y} parameters specify the expressions for the
  6602. position of the top-left corner of the output (non-cropped) area. They
  6603. are evaluated for each frame. If the evaluated value is not valid, it
  6604. is approximated to the nearest valid value.
  6605. The expression for @var{x} may depend on @var{y}, and the expression
  6606. for @var{y} may depend on @var{x}.
  6607. @subsection Examples
  6608. @itemize
  6609. @item
  6610. Crop area with size 100x100 at position (12,34).
  6611. @example
  6612. crop=100:100:12:34
  6613. @end example
  6614. Using named options, the example above becomes:
  6615. @example
  6616. crop=w=100:h=100:x=12:y=34
  6617. @end example
  6618. @item
  6619. Crop the central input area with size 100x100:
  6620. @example
  6621. crop=100:100
  6622. @end example
  6623. @item
  6624. Crop the central input area with size 2/3 of the input video:
  6625. @example
  6626. crop=2/3*in_w:2/3*in_h
  6627. @end example
  6628. @item
  6629. Crop the input video central square:
  6630. @example
  6631. crop=out_w=in_h
  6632. crop=in_h
  6633. @end example
  6634. @item
  6635. Delimit the rectangle with the top-left corner placed at position
  6636. 100:100 and the right-bottom corner corresponding to the right-bottom
  6637. corner of the input image.
  6638. @example
  6639. crop=in_w-100:in_h-100:100:100
  6640. @end example
  6641. @item
  6642. Crop 10 pixels from the left and right borders, and 20 pixels from
  6643. the top and bottom borders
  6644. @example
  6645. crop=in_w-2*10:in_h-2*20
  6646. @end example
  6647. @item
  6648. Keep only the bottom right quarter of the input image:
  6649. @example
  6650. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6651. @end example
  6652. @item
  6653. Crop height for getting Greek harmony:
  6654. @example
  6655. crop=in_w:1/PHI*in_w
  6656. @end example
  6657. @item
  6658. Apply trembling effect:
  6659. @example
  6660. 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)
  6661. @end example
  6662. @item
  6663. Apply erratic camera effect depending on timestamp:
  6664. @example
  6665. 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)"
  6666. @end example
  6667. @item
  6668. Set x depending on the value of y:
  6669. @example
  6670. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6671. @end example
  6672. @end itemize
  6673. @subsection Commands
  6674. This filter supports the following commands:
  6675. @table @option
  6676. @item w, out_w
  6677. @item h, out_h
  6678. @item x
  6679. @item y
  6680. Set width/height of the output video and the horizontal/vertical position
  6681. in the input video.
  6682. The command accepts the same syntax of the corresponding option.
  6683. If the specified expression is not valid, it is kept at its current
  6684. value.
  6685. @end table
  6686. @section cropdetect
  6687. Auto-detect the crop size.
  6688. It calculates the necessary cropping parameters and prints the
  6689. recommended parameters via the logging system. The detected dimensions
  6690. correspond to the non-black area of the input video.
  6691. It accepts the following parameters:
  6692. @table @option
  6693. @item limit
  6694. Set higher black value threshold, which can be optionally specified
  6695. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6696. value greater to the set value is considered non-black. It defaults to 24.
  6697. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6698. on the bitdepth of the pixel format.
  6699. @item round
  6700. The value which the width/height should be divisible by. It defaults to
  6701. 16. The offset is automatically adjusted to center the video. Use 2 to
  6702. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6703. encoding to most video codecs.
  6704. @item reset_count, reset
  6705. Set the counter that determines after how many frames cropdetect will
  6706. reset the previously detected largest video area and start over to
  6707. detect the current optimal crop area. Default value is 0.
  6708. This can be useful when channel logos distort the video area. 0
  6709. indicates 'never reset', and returns the largest area encountered during
  6710. playback.
  6711. @end table
  6712. @anchor{cue}
  6713. @section cue
  6714. Delay video filtering until a given wallclock timestamp. The filter first
  6715. passes on @option{preroll} amount of frames, then it buffers at most
  6716. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6717. it forwards the buffered frames and also any subsequent frames coming in its
  6718. input.
  6719. The filter can be used synchronize the output of multiple ffmpeg processes for
  6720. realtime output devices like decklink. By putting the delay in the filtering
  6721. chain and pre-buffering frames the process can pass on data to output almost
  6722. immediately after the target wallclock timestamp is reached.
  6723. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6724. some use cases.
  6725. @table @option
  6726. @item cue
  6727. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6728. @item preroll
  6729. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6730. @item buffer
  6731. The maximum duration of content to buffer before waiting for the cue expressed
  6732. in seconds. Default is 0.
  6733. @end table
  6734. @anchor{curves}
  6735. @section curves
  6736. Apply color adjustments using curves.
  6737. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6738. component (red, green and blue) has its values defined by @var{N} key points
  6739. tied from each other using a smooth curve. The x-axis represents the pixel
  6740. values from the input frame, and the y-axis the new pixel values to be set for
  6741. the output frame.
  6742. By default, a component curve is defined by the two points @var{(0;0)} and
  6743. @var{(1;1)}. This creates a straight line where each original pixel value is
  6744. "adjusted" to its own value, which means no change to the image.
  6745. The filter allows you to redefine these two points and add some more. A new
  6746. curve (using a natural cubic spline interpolation) will be define to pass
  6747. smoothly through all these new coordinates. The new defined points needs to be
  6748. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6749. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6750. the vector spaces, the values will be clipped accordingly.
  6751. The filter accepts the following options:
  6752. @table @option
  6753. @item preset
  6754. Select one of the available color presets. This option can be used in addition
  6755. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6756. options takes priority on the preset values.
  6757. Available presets are:
  6758. @table @samp
  6759. @item none
  6760. @item color_negative
  6761. @item cross_process
  6762. @item darker
  6763. @item increase_contrast
  6764. @item lighter
  6765. @item linear_contrast
  6766. @item medium_contrast
  6767. @item negative
  6768. @item strong_contrast
  6769. @item vintage
  6770. @end table
  6771. Default is @code{none}.
  6772. @item master, m
  6773. Set the master key points. These points will define a second pass mapping. It
  6774. is sometimes called a "luminance" or "value" mapping. It can be used with
  6775. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6776. post-processing LUT.
  6777. @item red, r
  6778. Set the key points for the red component.
  6779. @item green, g
  6780. Set the key points for the green component.
  6781. @item blue, b
  6782. Set the key points for the blue component.
  6783. @item all
  6784. Set the key points for all components (not including master).
  6785. Can be used in addition to the other key points component
  6786. options. In this case, the unset component(s) will fallback on this
  6787. @option{all} setting.
  6788. @item psfile
  6789. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6790. @item plot
  6791. Save Gnuplot script of the curves in specified file.
  6792. @end table
  6793. To avoid some filtergraph syntax conflicts, each key points list need to be
  6794. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6795. @subsection Examples
  6796. @itemize
  6797. @item
  6798. Increase slightly the middle level of blue:
  6799. @example
  6800. curves=blue='0/0 0.5/0.58 1/1'
  6801. @end example
  6802. @item
  6803. Vintage effect:
  6804. @example
  6805. 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'
  6806. @end example
  6807. Here we obtain the following coordinates for each components:
  6808. @table @var
  6809. @item red
  6810. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6811. @item green
  6812. @code{(0;0) (0.50;0.48) (1;1)}
  6813. @item blue
  6814. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6815. @end table
  6816. @item
  6817. The previous example can also be achieved with the associated built-in preset:
  6818. @example
  6819. curves=preset=vintage
  6820. @end example
  6821. @item
  6822. Or simply:
  6823. @example
  6824. curves=vintage
  6825. @end example
  6826. @item
  6827. Use a Photoshop preset and redefine the points of the green component:
  6828. @example
  6829. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6830. @end example
  6831. @item
  6832. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6833. and @command{gnuplot}:
  6834. @example
  6835. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6836. gnuplot -p /tmp/curves.plt
  6837. @end example
  6838. @end itemize
  6839. @section datascope
  6840. Video data analysis filter.
  6841. This filter shows hexadecimal pixel values of part of video.
  6842. The filter accepts the following options:
  6843. @table @option
  6844. @item size, s
  6845. Set output video size.
  6846. @item x
  6847. Set x offset from where to pick pixels.
  6848. @item y
  6849. Set y offset from where to pick pixels.
  6850. @item mode
  6851. Set scope mode, can be one of the following:
  6852. @table @samp
  6853. @item mono
  6854. Draw hexadecimal pixel values with white color on black background.
  6855. @item color
  6856. Draw hexadecimal pixel values with input video pixel color on black
  6857. background.
  6858. @item color2
  6859. Draw hexadecimal pixel values on color background picked from input video,
  6860. the text color is picked in such way so its always visible.
  6861. @end table
  6862. @item axis
  6863. Draw rows and columns numbers on left and top of video.
  6864. @item opacity
  6865. Set background opacity.
  6866. @item format
  6867. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6868. @end table
  6869. @section dblur
  6870. Apply Directional blur filter.
  6871. The filter accepts the following options:
  6872. @table @option
  6873. @item angle
  6874. Set angle of directional blur. Default is @code{45}.
  6875. @item radius
  6876. Set radius of directional blur. Default is @code{5}.
  6877. @item planes
  6878. Set which planes to filter. By default all planes are filtered.
  6879. @end table
  6880. @subsection Commands
  6881. This filter supports same @ref{commands} as options.
  6882. The command accepts the same syntax of the corresponding option.
  6883. If the specified expression is not valid, it is kept at its current
  6884. value.
  6885. @section dctdnoiz
  6886. Denoise frames using 2D DCT (frequency domain filtering).
  6887. This filter is not designed for real time.
  6888. The filter accepts the following options:
  6889. @table @option
  6890. @item sigma, s
  6891. Set the noise sigma constant.
  6892. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6893. coefficient (absolute value) below this threshold with be dropped.
  6894. If you need a more advanced filtering, see @option{expr}.
  6895. Default is @code{0}.
  6896. @item overlap
  6897. Set number overlapping pixels for each block. Since the filter can be slow, you
  6898. may want to reduce this value, at the cost of a less effective filter and the
  6899. risk of various artefacts.
  6900. If the overlapping value doesn't permit processing the whole input width or
  6901. height, a warning will be displayed and according borders won't be denoised.
  6902. Default value is @var{blocksize}-1, which is the best possible setting.
  6903. @item expr, e
  6904. Set the coefficient factor expression.
  6905. For each coefficient of a DCT block, this expression will be evaluated as a
  6906. multiplier value for the coefficient.
  6907. If this is option is set, the @option{sigma} option will be ignored.
  6908. The absolute value of the coefficient can be accessed through the @var{c}
  6909. variable.
  6910. @item n
  6911. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6912. @var{blocksize}, which is the width and height of the processed blocks.
  6913. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6914. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6915. on the speed processing. Also, a larger block size does not necessarily means a
  6916. better de-noising.
  6917. @end table
  6918. @subsection Examples
  6919. Apply a denoise with a @option{sigma} of @code{4.5}:
  6920. @example
  6921. dctdnoiz=4.5
  6922. @end example
  6923. The same operation can be achieved using the expression system:
  6924. @example
  6925. dctdnoiz=e='gte(c, 4.5*3)'
  6926. @end example
  6927. Violent denoise using a block size of @code{16x16}:
  6928. @example
  6929. dctdnoiz=15:n=4
  6930. @end example
  6931. @section deband
  6932. Remove banding artifacts from input video.
  6933. It works by replacing banded pixels with average value of referenced pixels.
  6934. The filter accepts the following options:
  6935. @table @option
  6936. @item 1thr
  6937. @item 2thr
  6938. @item 3thr
  6939. @item 4thr
  6940. Set banding detection threshold for each plane. Default is 0.02.
  6941. Valid range is 0.00003 to 0.5.
  6942. If difference between current pixel and reference pixel is less than threshold,
  6943. it will be considered as banded.
  6944. @item range, r
  6945. Banding detection range in pixels. Default is 16. If positive, random number
  6946. in range 0 to set value will be used. If negative, exact absolute value
  6947. will be used.
  6948. The range defines square of four pixels around current pixel.
  6949. @item direction, d
  6950. Set direction in radians from which four pixel will be compared. If positive,
  6951. random direction from 0 to set direction will be picked. If negative, exact of
  6952. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6953. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6954. column.
  6955. @item blur, b
  6956. If enabled, current pixel is compared with average value of all four
  6957. surrounding pixels. The default is enabled. If disabled current pixel is
  6958. compared with all four surrounding pixels. The pixel is considered banded
  6959. if only all four differences with surrounding pixels are less than threshold.
  6960. @item coupling, c
  6961. If enabled, current pixel is changed if and only if all pixel components are banded,
  6962. e.g. banding detection threshold is triggered for all color components.
  6963. The default is disabled.
  6964. @end table
  6965. @section deblock
  6966. Remove blocking artifacts from input video.
  6967. The filter accepts the following options:
  6968. @table @option
  6969. @item filter
  6970. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6971. This controls what kind of deblocking is applied.
  6972. @item block
  6973. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6974. @item alpha
  6975. @item beta
  6976. @item gamma
  6977. @item delta
  6978. Set blocking detection thresholds. Allowed range is 0 to 1.
  6979. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6980. Using higher threshold gives more deblocking strength.
  6981. Setting @var{alpha} controls threshold detection at exact edge of block.
  6982. Remaining options controls threshold detection near the edge. Each one for
  6983. below/above or left/right. Setting any of those to @var{0} disables
  6984. deblocking.
  6985. @item planes
  6986. Set planes to filter. Default is to filter all available planes.
  6987. @end table
  6988. @subsection Examples
  6989. @itemize
  6990. @item
  6991. Deblock using weak filter and block size of 4 pixels.
  6992. @example
  6993. deblock=filter=weak:block=4
  6994. @end example
  6995. @item
  6996. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6997. deblocking more edges.
  6998. @example
  6999. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7000. @end example
  7001. @item
  7002. Similar as above, but filter only first plane.
  7003. @example
  7004. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7005. @end example
  7006. @item
  7007. Similar as above, but filter only second and third plane.
  7008. @example
  7009. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7010. @end example
  7011. @end itemize
  7012. @anchor{decimate}
  7013. @section decimate
  7014. Drop duplicated frames at regular intervals.
  7015. The filter accepts the following options:
  7016. @table @option
  7017. @item cycle
  7018. Set the number of frames from which one will be dropped. Setting this to
  7019. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7020. Default is @code{5}.
  7021. @item dupthresh
  7022. Set the threshold for duplicate detection. If the difference metric for a frame
  7023. is less than or equal to this value, then it is declared as duplicate. Default
  7024. is @code{1.1}
  7025. @item scthresh
  7026. Set scene change threshold. Default is @code{15}.
  7027. @item blockx
  7028. @item blocky
  7029. Set the size of the x and y-axis blocks used during metric calculations.
  7030. Larger blocks give better noise suppression, but also give worse detection of
  7031. small movements. Must be a power of two. Default is @code{32}.
  7032. @item ppsrc
  7033. Mark main input as a pre-processed input and activate clean source input
  7034. stream. This allows the input to be pre-processed with various filters to help
  7035. the metrics calculation while keeping the frame selection lossless. When set to
  7036. @code{1}, the first stream is for the pre-processed input, and the second
  7037. stream is the clean source from where the kept frames are chosen. Default is
  7038. @code{0}.
  7039. @item chroma
  7040. Set whether or not chroma is considered in the metric calculations. Default is
  7041. @code{1}.
  7042. @end table
  7043. @section deconvolve
  7044. Apply 2D deconvolution of video stream in frequency domain using second stream
  7045. as impulse.
  7046. The filter accepts the following options:
  7047. @table @option
  7048. @item planes
  7049. Set which planes to process.
  7050. @item impulse
  7051. Set which impulse video frames will be processed, can be @var{first}
  7052. or @var{all}. Default is @var{all}.
  7053. @item noise
  7054. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7055. and height are not same and not power of 2 or if stream prior to convolving
  7056. had noise.
  7057. @end table
  7058. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7059. @section dedot
  7060. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7061. It accepts the following options:
  7062. @table @option
  7063. @item m
  7064. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7065. @var{rainbows} for cross-color reduction.
  7066. @item lt
  7067. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7068. @item tl
  7069. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7070. @item tc
  7071. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7072. @item ct
  7073. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7074. @end table
  7075. @section deflate
  7076. Apply deflate effect to the video.
  7077. This filter replaces the pixel by the local(3x3) average by taking into account
  7078. only values lower than the pixel.
  7079. It accepts the following options:
  7080. @table @option
  7081. @item threshold0
  7082. @item threshold1
  7083. @item threshold2
  7084. @item threshold3
  7085. Limit the maximum change for each plane, default is 65535.
  7086. If 0, plane will remain unchanged.
  7087. @end table
  7088. @subsection Commands
  7089. This filter supports the all above options as @ref{commands}.
  7090. @section deflicker
  7091. Remove temporal frame luminance variations.
  7092. It accepts the following options:
  7093. @table @option
  7094. @item size, s
  7095. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7096. @item mode, m
  7097. Set averaging mode to smooth temporal luminance variations.
  7098. Available values are:
  7099. @table @samp
  7100. @item am
  7101. Arithmetic mean
  7102. @item gm
  7103. Geometric mean
  7104. @item hm
  7105. Harmonic mean
  7106. @item qm
  7107. Quadratic mean
  7108. @item cm
  7109. Cubic mean
  7110. @item pm
  7111. Power mean
  7112. @item median
  7113. Median
  7114. @end table
  7115. @item bypass
  7116. Do not actually modify frame. Useful when one only wants metadata.
  7117. @end table
  7118. @section dejudder
  7119. Remove judder produced by partially interlaced telecined content.
  7120. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7121. source was partially telecined content then the output of @code{pullup,dejudder}
  7122. will have a variable frame rate. May change the recorded frame rate of the
  7123. container. Aside from that change, this filter will not affect constant frame
  7124. rate video.
  7125. The option available in this filter is:
  7126. @table @option
  7127. @item cycle
  7128. Specify the length of the window over which the judder repeats.
  7129. Accepts any integer greater than 1. Useful values are:
  7130. @table @samp
  7131. @item 4
  7132. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7133. @item 5
  7134. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7135. @item 20
  7136. If a mixture of the two.
  7137. @end table
  7138. The default is @samp{4}.
  7139. @end table
  7140. @section delogo
  7141. Suppress a TV station logo by a simple interpolation of the surrounding
  7142. pixels. Just set a rectangle covering the logo and watch it disappear
  7143. (and sometimes something even uglier appear - your mileage may vary).
  7144. It accepts the following parameters:
  7145. @table @option
  7146. @item x
  7147. @item y
  7148. Specify the top left corner coordinates of the logo. They must be
  7149. specified.
  7150. @item w
  7151. @item h
  7152. Specify the width and height of the logo to clear. They must be
  7153. specified.
  7154. @item band, t
  7155. Specify the thickness of the fuzzy edge of the rectangle (added to
  7156. @var{w} and @var{h}). The default value is 1. This option is
  7157. deprecated, setting higher values should no longer be necessary and
  7158. is not recommended.
  7159. @item show
  7160. When set to 1, a green rectangle is drawn on the screen to simplify
  7161. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7162. The default value is 0.
  7163. The rectangle is drawn on the outermost pixels which will be (partly)
  7164. replaced with interpolated values. The values of the next pixels
  7165. immediately outside this rectangle in each direction will be used to
  7166. compute the interpolated pixel values inside the rectangle.
  7167. @end table
  7168. @subsection Examples
  7169. @itemize
  7170. @item
  7171. Set a rectangle covering the area with top left corner coordinates 0,0
  7172. and size 100x77, and a band of size 10:
  7173. @example
  7174. delogo=x=0:y=0:w=100:h=77:band=10
  7175. @end example
  7176. @end itemize
  7177. @anchor{derain}
  7178. @section derain
  7179. Remove the rain in the input image/video by applying the derain methods based on
  7180. convolutional neural networks. Supported models:
  7181. @itemize
  7182. @item
  7183. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7184. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7185. @end itemize
  7186. Training as well as model generation scripts are provided in
  7187. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7188. Native model files (.model) can be generated from TensorFlow model
  7189. files (.pb) by using tools/python/convert.py
  7190. The filter accepts the following options:
  7191. @table @option
  7192. @item filter_type
  7193. Specify which filter to use. This option accepts the following values:
  7194. @table @samp
  7195. @item derain
  7196. Derain filter. To conduct derain filter, you need to use a derain model.
  7197. @item dehaze
  7198. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7199. @end table
  7200. Default value is @samp{derain}.
  7201. @item dnn_backend
  7202. Specify which DNN backend to use for model loading and execution. This option accepts
  7203. the following values:
  7204. @table @samp
  7205. @item native
  7206. Native implementation of DNN loading and execution.
  7207. @item tensorflow
  7208. TensorFlow backend. To enable this backend you
  7209. need to install the TensorFlow for C library (see
  7210. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7211. @code{--enable-libtensorflow}
  7212. @end table
  7213. Default value is @samp{native}.
  7214. @item model
  7215. Set path to model file specifying network architecture and its parameters.
  7216. Note that different backends use different file formats. TensorFlow and native
  7217. backend can load files for only its format.
  7218. @end table
  7219. It can also be finished with @ref{dnn_processing} filter.
  7220. @section deshake
  7221. Attempt to fix small changes in horizontal and/or vertical shift. This
  7222. filter helps remove camera shake from hand-holding a camera, bumping a
  7223. tripod, moving on a vehicle, etc.
  7224. The filter accepts the following options:
  7225. @table @option
  7226. @item x
  7227. @item y
  7228. @item w
  7229. @item h
  7230. Specify a rectangular area where to limit the search for motion
  7231. vectors.
  7232. If desired the search for motion vectors can be limited to a
  7233. rectangular area of the frame defined by its top left corner, width
  7234. and height. These parameters have the same meaning as the drawbox
  7235. filter which can be used to visualise the position of the bounding
  7236. box.
  7237. This is useful when simultaneous movement of subjects within the frame
  7238. might be confused for camera motion by the motion vector search.
  7239. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7240. then the full frame is used. This allows later options to be set
  7241. without specifying the bounding box for the motion vector search.
  7242. Default - search the whole frame.
  7243. @item rx
  7244. @item ry
  7245. Specify the maximum extent of movement in x and y directions in the
  7246. range 0-64 pixels. Default 16.
  7247. @item edge
  7248. Specify how to generate pixels to fill blanks at the edge of the
  7249. frame. Available values are:
  7250. @table @samp
  7251. @item blank, 0
  7252. Fill zeroes at blank locations
  7253. @item original, 1
  7254. Original image at blank locations
  7255. @item clamp, 2
  7256. Extruded edge value at blank locations
  7257. @item mirror, 3
  7258. Mirrored edge at blank locations
  7259. @end table
  7260. Default value is @samp{mirror}.
  7261. @item blocksize
  7262. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7263. default 8.
  7264. @item contrast
  7265. Specify the contrast threshold for blocks. Only blocks with more than
  7266. the specified contrast (difference between darkest and lightest
  7267. pixels) will be considered. Range 1-255, default 125.
  7268. @item search
  7269. Specify the search strategy. Available values are:
  7270. @table @samp
  7271. @item exhaustive, 0
  7272. Set exhaustive search
  7273. @item less, 1
  7274. Set less exhaustive search.
  7275. @end table
  7276. Default value is @samp{exhaustive}.
  7277. @item filename
  7278. If set then a detailed log of the motion search is written to the
  7279. specified file.
  7280. @end table
  7281. @section despill
  7282. Remove unwanted contamination of foreground colors, caused by reflected color of
  7283. greenscreen or bluescreen.
  7284. This filter accepts the following options:
  7285. @table @option
  7286. @item type
  7287. Set what type of despill to use.
  7288. @item mix
  7289. Set how spillmap will be generated.
  7290. @item expand
  7291. Set how much to get rid of still remaining spill.
  7292. @item red
  7293. Controls amount of red in spill area.
  7294. @item green
  7295. Controls amount of green in spill area.
  7296. Should be -1 for greenscreen.
  7297. @item blue
  7298. Controls amount of blue in spill area.
  7299. Should be -1 for bluescreen.
  7300. @item brightness
  7301. Controls brightness of spill area, preserving colors.
  7302. @item alpha
  7303. Modify alpha from generated spillmap.
  7304. @end table
  7305. @subsection Commands
  7306. This filter supports the all above options as @ref{commands}.
  7307. @section detelecine
  7308. Apply an exact inverse of the telecine operation. It requires a predefined
  7309. pattern specified using the pattern option which must be the same as that passed
  7310. to the telecine filter.
  7311. This filter accepts the following options:
  7312. @table @option
  7313. @item first_field
  7314. @table @samp
  7315. @item top, t
  7316. top field first
  7317. @item bottom, b
  7318. bottom field first
  7319. The default value is @code{top}.
  7320. @end table
  7321. @item pattern
  7322. A string of numbers representing the pulldown pattern you wish to apply.
  7323. The default value is @code{23}.
  7324. @item start_frame
  7325. A number representing position of the first frame with respect to the telecine
  7326. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7327. @end table
  7328. @section dilation
  7329. Apply dilation effect to the video.
  7330. This filter replaces the pixel by the local(3x3) maximum.
  7331. It accepts the following options:
  7332. @table @option
  7333. @item threshold0
  7334. @item threshold1
  7335. @item threshold2
  7336. @item threshold3
  7337. Limit the maximum change for each plane, default is 65535.
  7338. If 0, plane will remain unchanged.
  7339. @item coordinates
  7340. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7341. pixels are used.
  7342. Flags to local 3x3 coordinates maps like this:
  7343. 1 2 3
  7344. 4 5
  7345. 6 7 8
  7346. @end table
  7347. @subsection Commands
  7348. This filter supports the all above options as @ref{commands}.
  7349. @section displace
  7350. Displace pixels as indicated by second and third input stream.
  7351. It takes three input streams and outputs one stream, the first input is the
  7352. source, and second and third input are displacement maps.
  7353. The second input specifies how much to displace pixels along the
  7354. x-axis, while the third input specifies how much to displace pixels
  7355. along the y-axis.
  7356. If one of displacement map streams terminates, last frame from that
  7357. displacement map will be used.
  7358. Note that once generated, displacements maps can be reused over and over again.
  7359. A description of the accepted options follows.
  7360. @table @option
  7361. @item edge
  7362. Set displace behavior for pixels that are out of range.
  7363. Available values are:
  7364. @table @samp
  7365. @item blank
  7366. Missing pixels are replaced by black pixels.
  7367. @item smear
  7368. Adjacent pixels will spread out to replace missing pixels.
  7369. @item wrap
  7370. Out of range pixels are wrapped so they point to pixels of other side.
  7371. @item mirror
  7372. Out of range pixels will be replaced with mirrored pixels.
  7373. @end table
  7374. Default is @samp{smear}.
  7375. @end table
  7376. @subsection Examples
  7377. @itemize
  7378. @item
  7379. Add ripple effect to rgb input of video size hd720:
  7380. @example
  7381. 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
  7382. @end example
  7383. @item
  7384. Add wave effect to rgb input of video size hd720:
  7385. @example
  7386. 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
  7387. @end example
  7388. @end itemize
  7389. @anchor{dnn_processing}
  7390. @section dnn_processing
  7391. Do image processing with deep neural networks. It works together with another filter
  7392. which converts the pixel format of the Frame to what the dnn network requires.
  7393. The filter accepts the following options:
  7394. @table @option
  7395. @item dnn_backend
  7396. Specify which DNN backend to use for model loading and execution. This option accepts
  7397. the following values:
  7398. @table @samp
  7399. @item native
  7400. Native implementation of DNN loading and execution.
  7401. @item tensorflow
  7402. TensorFlow backend. To enable this backend you
  7403. need to install the TensorFlow for C library (see
  7404. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7405. @code{--enable-libtensorflow}
  7406. @item openvino
  7407. OpenVINO backend. To enable this backend you
  7408. need to build and install the OpenVINO for C library (see
  7409. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7410. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7411. be needed if the header files and libraries are not installed into system path)
  7412. @end table
  7413. Default value is @samp{native}.
  7414. @item model
  7415. Set path to model file specifying network architecture and its parameters.
  7416. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7417. backend can load files for only its format.
  7418. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7419. @item input
  7420. Set the input name of the dnn network.
  7421. @item output
  7422. Set the output name of the dnn network.
  7423. @end table
  7424. @subsection Examples
  7425. @itemize
  7426. @item
  7427. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7428. @example
  7429. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7430. @end example
  7431. @item
  7432. Halve the pixel value of the frame with format gray32f:
  7433. @example
  7434. 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
  7435. @end example
  7436. @item
  7437. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7438. @example
  7439. ./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
  7440. @end example
  7441. @item
  7442. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7443. @example
  7444. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7445. @end example
  7446. @end itemize
  7447. @section drawbox
  7448. Draw a colored box on the input image.
  7449. It accepts the following parameters:
  7450. @table @option
  7451. @item x
  7452. @item y
  7453. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7454. @item width, w
  7455. @item height, h
  7456. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7457. the input width and height. It defaults to 0.
  7458. @item color, c
  7459. Specify the color of the box to write. For the general syntax of this option,
  7460. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7461. value @code{invert} is used, the box edge color is the same as the
  7462. video with inverted luma.
  7463. @item thickness, t
  7464. The expression which sets the thickness of the box edge.
  7465. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7466. See below for the list of accepted constants.
  7467. @item replace
  7468. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7469. will overwrite the video's color and alpha pixels.
  7470. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7471. @end table
  7472. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7473. following constants:
  7474. @table @option
  7475. @item dar
  7476. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7477. @item hsub
  7478. @item vsub
  7479. horizontal and vertical chroma subsample values. For example for the
  7480. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7481. @item in_h, ih
  7482. @item in_w, iw
  7483. The input width and height.
  7484. @item sar
  7485. The input sample aspect ratio.
  7486. @item x
  7487. @item y
  7488. The x and y offset coordinates where the box is drawn.
  7489. @item w
  7490. @item h
  7491. The width and height of the drawn box.
  7492. @item t
  7493. The thickness of the drawn box.
  7494. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7495. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7496. @end table
  7497. @subsection Examples
  7498. @itemize
  7499. @item
  7500. Draw a black box around the edge of the input image:
  7501. @example
  7502. drawbox
  7503. @end example
  7504. @item
  7505. Draw a box with color red and an opacity of 50%:
  7506. @example
  7507. drawbox=10:20:200:60:red@@0.5
  7508. @end example
  7509. The previous example can be specified as:
  7510. @example
  7511. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7512. @end example
  7513. @item
  7514. Fill the box with pink color:
  7515. @example
  7516. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7517. @end example
  7518. @item
  7519. Draw a 2-pixel red 2.40:1 mask:
  7520. @example
  7521. 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
  7522. @end example
  7523. @end itemize
  7524. @subsection Commands
  7525. This filter supports same commands as options.
  7526. The command accepts the same syntax of the corresponding option.
  7527. If the specified expression is not valid, it is kept at its current
  7528. value.
  7529. @anchor{drawgraph}
  7530. @section drawgraph
  7531. Draw a graph using input video metadata.
  7532. It accepts the following parameters:
  7533. @table @option
  7534. @item m1
  7535. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7536. @item fg1
  7537. Set 1st foreground color expression.
  7538. @item m2
  7539. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7540. @item fg2
  7541. Set 2nd foreground color expression.
  7542. @item m3
  7543. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7544. @item fg3
  7545. Set 3rd foreground color expression.
  7546. @item m4
  7547. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7548. @item fg4
  7549. Set 4th foreground color expression.
  7550. @item min
  7551. Set minimal value of metadata value.
  7552. @item max
  7553. Set maximal value of metadata value.
  7554. @item bg
  7555. Set graph background color. Default is white.
  7556. @item mode
  7557. Set graph mode.
  7558. Available values for mode is:
  7559. @table @samp
  7560. @item bar
  7561. @item dot
  7562. @item line
  7563. @end table
  7564. Default is @code{line}.
  7565. @item slide
  7566. Set slide mode.
  7567. Available values for slide is:
  7568. @table @samp
  7569. @item frame
  7570. Draw new frame when right border is reached.
  7571. @item replace
  7572. Replace old columns with new ones.
  7573. @item scroll
  7574. Scroll from right to left.
  7575. @item rscroll
  7576. Scroll from left to right.
  7577. @item picture
  7578. Draw single picture.
  7579. @end table
  7580. Default is @code{frame}.
  7581. @item size
  7582. Set size of graph video. For the syntax of this option, check the
  7583. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7584. The default value is @code{900x256}.
  7585. @item rate, r
  7586. Set the output frame rate. Default value is @code{25}.
  7587. The foreground color expressions can use the following variables:
  7588. @table @option
  7589. @item MIN
  7590. Minimal value of metadata value.
  7591. @item MAX
  7592. Maximal value of metadata value.
  7593. @item VAL
  7594. Current metadata key value.
  7595. @end table
  7596. The color is defined as 0xAABBGGRR.
  7597. @end table
  7598. Example using metadata from @ref{signalstats} filter:
  7599. @example
  7600. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7601. @end example
  7602. Example using metadata from @ref{ebur128} filter:
  7603. @example
  7604. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7605. @end example
  7606. @section drawgrid
  7607. Draw a grid on the input image.
  7608. It accepts the following parameters:
  7609. @table @option
  7610. @item x
  7611. @item y
  7612. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7613. @item width, w
  7614. @item height, h
  7615. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7616. input width and height, respectively, minus @code{thickness}, so image gets
  7617. framed. Default to 0.
  7618. @item color, c
  7619. Specify the color of the grid. For the general syntax of this option,
  7620. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7621. value @code{invert} is used, the grid color is the same as the
  7622. video with inverted luma.
  7623. @item thickness, t
  7624. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7625. See below for the list of accepted constants.
  7626. @item replace
  7627. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7628. will overwrite the video's color and alpha pixels.
  7629. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7630. @end table
  7631. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7632. following constants:
  7633. @table @option
  7634. @item dar
  7635. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7636. @item hsub
  7637. @item vsub
  7638. horizontal and vertical chroma subsample values. For example for the
  7639. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7640. @item in_h, ih
  7641. @item in_w, iw
  7642. The input grid cell width and height.
  7643. @item sar
  7644. The input sample aspect ratio.
  7645. @item x
  7646. @item y
  7647. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7648. @item w
  7649. @item h
  7650. The width and height of the drawn cell.
  7651. @item t
  7652. The thickness of the drawn cell.
  7653. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7654. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7655. @end table
  7656. @subsection Examples
  7657. @itemize
  7658. @item
  7659. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7660. @example
  7661. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7662. @end example
  7663. @item
  7664. Draw a white 3x3 grid with an opacity of 50%:
  7665. @example
  7666. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7667. @end example
  7668. @end itemize
  7669. @subsection Commands
  7670. This filter supports same commands as options.
  7671. The command accepts the same syntax of the corresponding option.
  7672. If the specified expression is not valid, it is kept at its current
  7673. value.
  7674. @anchor{drawtext}
  7675. @section drawtext
  7676. Draw a text string or text from a specified file on top of a video, using the
  7677. libfreetype library.
  7678. To enable compilation of this filter, you need to configure FFmpeg with
  7679. @code{--enable-libfreetype}.
  7680. To enable default font fallback and the @var{font} option you need to
  7681. configure FFmpeg with @code{--enable-libfontconfig}.
  7682. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7683. @code{--enable-libfribidi}.
  7684. @subsection Syntax
  7685. It accepts the following parameters:
  7686. @table @option
  7687. @item box
  7688. Used to draw a box around text using the background color.
  7689. The value must be either 1 (enable) or 0 (disable).
  7690. The default value of @var{box} is 0.
  7691. @item boxborderw
  7692. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7693. The default value of @var{boxborderw} is 0.
  7694. @item boxcolor
  7695. The color to be used for drawing box around text. For the syntax of this
  7696. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7697. The default value of @var{boxcolor} is "white".
  7698. @item line_spacing
  7699. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7700. The default value of @var{line_spacing} is 0.
  7701. @item borderw
  7702. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7703. The default value of @var{borderw} is 0.
  7704. @item bordercolor
  7705. Set the color to be used for drawing border around text. For the syntax of this
  7706. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7707. The default value of @var{bordercolor} is "black".
  7708. @item expansion
  7709. Select how the @var{text} is expanded. Can be either @code{none},
  7710. @code{strftime} (deprecated) or
  7711. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7712. below for details.
  7713. @item basetime
  7714. Set a start time for the count. Value is in microseconds. Only applied
  7715. in the deprecated strftime expansion mode. To emulate in normal expansion
  7716. mode use the @code{pts} function, supplying the start time (in seconds)
  7717. as the second argument.
  7718. @item fix_bounds
  7719. If true, check and fix text coords to avoid clipping.
  7720. @item fontcolor
  7721. The color to be used for drawing fonts. For the syntax of this option, check
  7722. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7723. The default value of @var{fontcolor} is "black".
  7724. @item fontcolor_expr
  7725. String which is expanded the same way as @var{text} to obtain dynamic
  7726. @var{fontcolor} value. By default this option has empty value and is not
  7727. processed. When this option is set, it overrides @var{fontcolor} option.
  7728. @item font
  7729. The font family to be used for drawing text. By default Sans.
  7730. @item fontfile
  7731. The font file to be used for drawing text. The path must be included.
  7732. This parameter is mandatory if the fontconfig support is disabled.
  7733. @item alpha
  7734. Draw the text applying alpha blending. The value can
  7735. be a number between 0.0 and 1.0.
  7736. The expression accepts the same variables @var{x, y} as well.
  7737. The default value is 1.
  7738. Please see @var{fontcolor_expr}.
  7739. @item fontsize
  7740. The font size to be used for drawing text.
  7741. The default value of @var{fontsize} is 16.
  7742. @item text_shaping
  7743. If set to 1, attempt to shape the text (for example, reverse the order of
  7744. right-to-left text and join Arabic characters) before drawing it.
  7745. Otherwise, just draw the text exactly as given.
  7746. By default 1 (if supported).
  7747. @item ft_load_flags
  7748. The flags to be used for loading the fonts.
  7749. The flags map the corresponding flags supported by libfreetype, and are
  7750. a combination of the following values:
  7751. @table @var
  7752. @item default
  7753. @item no_scale
  7754. @item no_hinting
  7755. @item render
  7756. @item no_bitmap
  7757. @item vertical_layout
  7758. @item force_autohint
  7759. @item crop_bitmap
  7760. @item pedantic
  7761. @item ignore_global_advance_width
  7762. @item no_recurse
  7763. @item ignore_transform
  7764. @item monochrome
  7765. @item linear_design
  7766. @item no_autohint
  7767. @end table
  7768. Default value is "default".
  7769. For more information consult the documentation for the FT_LOAD_*
  7770. libfreetype flags.
  7771. @item shadowcolor
  7772. The color to be used for drawing a shadow behind the drawn text. For the
  7773. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7774. ffmpeg-utils manual,ffmpeg-utils}.
  7775. The default value of @var{shadowcolor} is "black".
  7776. @item shadowx
  7777. @item shadowy
  7778. The x and y offsets for the text shadow position with respect to the
  7779. position of the text. They can be either positive or negative
  7780. values. The default value for both is "0".
  7781. @item start_number
  7782. The starting frame number for the n/frame_num variable. The default value
  7783. is "0".
  7784. @item tabsize
  7785. The size in number of spaces to use for rendering the tab.
  7786. Default value is 4.
  7787. @item timecode
  7788. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7789. format. It can be used with or without text parameter. @var{timecode_rate}
  7790. option must be specified.
  7791. @item timecode_rate, rate, r
  7792. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7793. integer. Minimum value is "1".
  7794. Drop-frame timecode is supported for frame rates 30 & 60.
  7795. @item tc24hmax
  7796. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7797. Default is 0 (disabled).
  7798. @item text
  7799. The text string to be drawn. The text must be a sequence of UTF-8
  7800. encoded characters.
  7801. This parameter is mandatory if no file is specified with the parameter
  7802. @var{textfile}.
  7803. @item textfile
  7804. A text file containing text to be drawn. The text must be a sequence
  7805. of UTF-8 encoded characters.
  7806. This parameter is mandatory if no text string is specified with the
  7807. parameter @var{text}.
  7808. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7809. @item reload
  7810. If set to 1, the @var{textfile} will be reloaded before each frame.
  7811. Be sure to update it atomically, or it may be read partially, or even fail.
  7812. @item x
  7813. @item y
  7814. The expressions which specify the offsets where text will be drawn
  7815. within the video frame. They are relative to the top/left border of the
  7816. output image.
  7817. The default value of @var{x} and @var{y} is "0".
  7818. See below for the list of accepted constants and functions.
  7819. @end table
  7820. The parameters for @var{x} and @var{y} are expressions containing the
  7821. following constants and functions:
  7822. @table @option
  7823. @item dar
  7824. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7825. @item hsub
  7826. @item vsub
  7827. horizontal and vertical chroma subsample values. For example for the
  7828. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7829. @item line_h, lh
  7830. the height of each text line
  7831. @item main_h, h, H
  7832. the input height
  7833. @item main_w, w, W
  7834. the input width
  7835. @item max_glyph_a, ascent
  7836. the maximum distance from the baseline to the highest/upper grid
  7837. coordinate used to place a glyph outline point, for all the rendered
  7838. glyphs.
  7839. It is a positive value, due to the grid's orientation with the Y axis
  7840. upwards.
  7841. @item max_glyph_d, descent
  7842. the maximum distance from the baseline to the lowest grid coordinate
  7843. used to place a glyph outline point, for all the rendered glyphs.
  7844. This is a negative value, due to the grid's orientation, with the Y axis
  7845. upwards.
  7846. @item max_glyph_h
  7847. maximum glyph height, that is the maximum height for all the glyphs
  7848. contained in the rendered text, it is equivalent to @var{ascent} -
  7849. @var{descent}.
  7850. @item max_glyph_w
  7851. maximum glyph width, that is the maximum width for all the glyphs
  7852. contained in the rendered text
  7853. @item n
  7854. the number of input frame, starting from 0
  7855. @item rand(min, max)
  7856. return a random number included between @var{min} and @var{max}
  7857. @item sar
  7858. The input sample aspect ratio.
  7859. @item t
  7860. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7861. @item text_h, th
  7862. the height of the rendered text
  7863. @item text_w, tw
  7864. the width of the rendered text
  7865. @item x
  7866. @item y
  7867. the x and y offset coordinates where the text is drawn.
  7868. These parameters allow the @var{x} and @var{y} expressions to refer
  7869. to each other, so you can for example specify @code{y=x/dar}.
  7870. @item pict_type
  7871. A one character description of the current frame's picture type.
  7872. @item pkt_pos
  7873. The current packet's position in the input file or stream
  7874. (in bytes, from the start of the input). A value of -1 indicates
  7875. this info is not available.
  7876. @item pkt_duration
  7877. The current packet's duration, in seconds.
  7878. @item pkt_size
  7879. The current packet's size (in bytes).
  7880. @end table
  7881. @anchor{drawtext_expansion}
  7882. @subsection Text expansion
  7883. If @option{expansion} is set to @code{strftime},
  7884. the filter recognizes strftime() sequences in the provided text and
  7885. expands them accordingly. Check the documentation of strftime(). This
  7886. feature is deprecated.
  7887. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7888. If @option{expansion} is set to @code{normal} (which is the default),
  7889. the following expansion mechanism is used.
  7890. The backslash character @samp{\}, followed by any character, always expands to
  7891. the second character.
  7892. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7893. braces is a function name, possibly followed by arguments separated by ':'.
  7894. If the arguments contain special characters or delimiters (':' or '@}'),
  7895. they should be escaped.
  7896. Note that they probably must also be escaped as the value for the
  7897. @option{text} option in the filter argument string and as the filter
  7898. argument in the filtergraph description, and possibly also for the shell,
  7899. that makes up to four levels of escaping; using a text file avoids these
  7900. problems.
  7901. The following functions are available:
  7902. @table @command
  7903. @item expr, e
  7904. The expression evaluation result.
  7905. It must take one argument specifying the expression to be evaluated,
  7906. which accepts the same constants and functions as the @var{x} and
  7907. @var{y} values. Note that not all constants should be used, for
  7908. example the text size is not known when evaluating the expression, so
  7909. the constants @var{text_w} and @var{text_h} will have an undefined
  7910. value.
  7911. @item expr_int_format, eif
  7912. Evaluate the expression's value and output as formatted integer.
  7913. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7914. The second argument specifies the output format. Allowed values are @samp{x},
  7915. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7916. @code{printf} function.
  7917. The third parameter is optional and sets the number of positions taken by the output.
  7918. It can be used to add padding with zeros from the left.
  7919. @item gmtime
  7920. The time at which the filter is running, expressed in UTC.
  7921. It can accept an argument: a strftime() format string.
  7922. @item localtime
  7923. The time at which the filter is running, expressed in the local time zone.
  7924. It can accept an argument: a strftime() format string.
  7925. @item metadata
  7926. Frame metadata. Takes one or two arguments.
  7927. The first argument is mandatory and specifies the metadata key.
  7928. The second argument is optional and specifies a default value, used when the
  7929. metadata key is not found or empty.
  7930. Available metadata can be identified by inspecting entries
  7931. starting with TAG included within each frame section
  7932. printed by running @code{ffprobe -show_frames}.
  7933. String metadata generated in filters leading to
  7934. the drawtext filter are also available.
  7935. @item n, frame_num
  7936. The frame number, starting from 0.
  7937. @item pict_type
  7938. A one character description of the current picture type.
  7939. @item pts
  7940. The timestamp of the current frame.
  7941. It can take up to three arguments.
  7942. The first argument is the format of the timestamp; it defaults to @code{flt}
  7943. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7944. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7945. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7946. @code{localtime} stands for the timestamp of the frame formatted as
  7947. local time zone time.
  7948. The second argument is an offset added to the timestamp.
  7949. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7950. supplied to present the hour part of the formatted timestamp in 24h format
  7951. (00-23).
  7952. If the format is set to @code{localtime} or @code{gmtime},
  7953. a third argument may be supplied: a strftime() format string.
  7954. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7955. @end table
  7956. @subsection Commands
  7957. This filter supports altering parameters via commands:
  7958. @table @option
  7959. @item reinit
  7960. Alter existing filter parameters.
  7961. Syntax for the argument is the same as for filter invocation, e.g.
  7962. @example
  7963. fontsize=56:fontcolor=green:text='Hello World'
  7964. @end example
  7965. Full filter invocation with sendcmd would look like this:
  7966. @example
  7967. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7968. @end example
  7969. @end table
  7970. If the entire argument can't be parsed or applied as valid values then the filter will
  7971. continue with its existing parameters.
  7972. @subsection Examples
  7973. @itemize
  7974. @item
  7975. Draw "Test Text" with font FreeSerif, using the default values for the
  7976. optional parameters.
  7977. @example
  7978. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7979. @end example
  7980. @item
  7981. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7982. and y=50 (counting from the top-left corner of the screen), text is
  7983. yellow with a red box around it. Both the text and the box have an
  7984. opacity of 20%.
  7985. @example
  7986. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7987. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7988. @end example
  7989. Note that the double quotes are not necessary if spaces are not used
  7990. within the parameter list.
  7991. @item
  7992. Show the text at the center of the video frame:
  7993. @example
  7994. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7995. @end example
  7996. @item
  7997. Show the text at a random position, switching to a new position every 30 seconds:
  7998. @example
  7999. 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)"
  8000. @end example
  8001. @item
  8002. Show a text line sliding from right to left in the last row of the video
  8003. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8004. with no newlines.
  8005. @example
  8006. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8007. @end example
  8008. @item
  8009. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8010. @example
  8011. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8012. @end example
  8013. @item
  8014. Draw a single green letter "g", at the center of the input video.
  8015. The glyph baseline is placed at half screen height.
  8016. @example
  8017. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8018. @end example
  8019. @item
  8020. Show text for 1 second every 3 seconds:
  8021. @example
  8022. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8023. @end example
  8024. @item
  8025. Use fontconfig to set the font. Note that the colons need to be escaped.
  8026. @example
  8027. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8028. @end example
  8029. @item
  8030. Draw "Test Text" with font size dependent on height of the video.
  8031. @example
  8032. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8033. @end example
  8034. @item
  8035. Print the date of a real-time encoding (see strftime(3)):
  8036. @example
  8037. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8038. @end example
  8039. @item
  8040. Show text fading in and out (appearing/disappearing):
  8041. @example
  8042. #!/bin/sh
  8043. DS=1.0 # display start
  8044. DE=10.0 # display end
  8045. FID=1.5 # fade in duration
  8046. FOD=5 # fade out duration
  8047. 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 @}"
  8048. @end example
  8049. @item
  8050. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8051. and the @option{fontsize} value are included in the @option{y} offset.
  8052. @example
  8053. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8054. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8055. @end example
  8056. @item
  8057. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8058. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8059. must have option @option{-export_path_metadata 1} for the special metadata fields
  8060. to be available for filters.
  8061. @example
  8062. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8063. @end example
  8064. @end itemize
  8065. For more information about libfreetype, check:
  8066. @url{http://www.freetype.org/}.
  8067. For more information about fontconfig, check:
  8068. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8069. For more information about libfribidi, check:
  8070. @url{http://fribidi.org/}.
  8071. @section edgedetect
  8072. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8073. The filter accepts the following options:
  8074. @table @option
  8075. @item low
  8076. @item high
  8077. Set low and high threshold values used by the Canny thresholding
  8078. algorithm.
  8079. The high threshold selects the "strong" edge pixels, which are then
  8080. connected through 8-connectivity with the "weak" edge pixels selected
  8081. by the low threshold.
  8082. @var{low} and @var{high} threshold values must be chosen in the range
  8083. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8084. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8085. is @code{50/255}.
  8086. @item mode
  8087. Define the drawing mode.
  8088. @table @samp
  8089. @item wires
  8090. Draw white/gray wires on black background.
  8091. @item colormix
  8092. Mix the colors to create a paint/cartoon effect.
  8093. @item canny
  8094. Apply Canny edge detector on all selected planes.
  8095. @end table
  8096. Default value is @var{wires}.
  8097. @item planes
  8098. Select planes for filtering. By default all available planes are filtered.
  8099. @end table
  8100. @subsection Examples
  8101. @itemize
  8102. @item
  8103. Standard edge detection with custom values for the hysteresis thresholding:
  8104. @example
  8105. edgedetect=low=0.1:high=0.4
  8106. @end example
  8107. @item
  8108. Painting effect without thresholding:
  8109. @example
  8110. edgedetect=mode=colormix:high=0
  8111. @end example
  8112. @end itemize
  8113. @section elbg
  8114. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8115. For each input image, the filter will compute the optimal mapping from
  8116. the input to the output given the codebook length, that is the number
  8117. of distinct output colors.
  8118. This filter accepts the following options.
  8119. @table @option
  8120. @item codebook_length, l
  8121. Set codebook length. The value must be a positive integer, and
  8122. represents the number of distinct output colors. Default value is 256.
  8123. @item nb_steps, n
  8124. Set the maximum number of iterations to apply for computing the optimal
  8125. mapping. The higher the value the better the result and the higher the
  8126. computation time. Default value is 1.
  8127. @item seed, s
  8128. Set a random seed, must be an integer included between 0 and
  8129. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8130. will try to use a good random seed on a best effort basis.
  8131. @item pal8
  8132. Set pal8 output pixel format. This option does not work with codebook
  8133. length greater than 256.
  8134. @end table
  8135. @section entropy
  8136. Measure graylevel entropy in histogram of color channels of video frames.
  8137. It accepts the following parameters:
  8138. @table @option
  8139. @item mode
  8140. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8141. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8142. between neighbour histogram values.
  8143. @end table
  8144. @section eq
  8145. Set brightness, contrast, saturation and approximate gamma adjustment.
  8146. The filter accepts the following options:
  8147. @table @option
  8148. @item contrast
  8149. Set the contrast expression. The value must be a float value in range
  8150. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8151. @item brightness
  8152. Set the brightness expression. The value must be a float value in
  8153. range @code{-1.0} to @code{1.0}. The default value is "0".
  8154. @item saturation
  8155. Set the saturation expression. The value must be a float in
  8156. range @code{0.0} to @code{3.0}. The default value is "1".
  8157. @item gamma
  8158. Set the gamma expression. The value must be a float in range
  8159. @code{0.1} to @code{10.0}. The default value is "1".
  8160. @item gamma_r
  8161. Set the gamma expression for red. The value must be a float in
  8162. range @code{0.1} to @code{10.0}. The default value is "1".
  8163. @item gamma_g
  8164. Set the gamma expression for green. The value must be a float in range
  8165. @code{0.1} to @code{10.0}. The default value is "1".
  8166. @item gamma_b
  8167. Set the gamma expression for blue. The value must be a float in range
  8168. @code{0.1} to @code{10.0}. The default value is "1".
  8169. @item gamma_weight
  8170. Set the gamma weight expression. It can be used to reduce the effect
  8171. of a high gamma value on bright image areas, e.g. keep them from
  8172. getting overamplified and just plain white. The value must be a float
  8173. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8174. gamma correction all the way down while @code{1.0} leaves it at its
  8175. full strength. Default is "1".
  8176. @item eval
  8177. Set when the expressions for brightness, contrast, saturation and
  8178. gamma expressions are evaluated.
  8179. It accepts the following values:
  8180. @table @samp
  8181. @item init
  8182. only evaluate expressions once during the filter initialization or
  8183. when a command is processed
  8184. @item frame
  8185. evaluate expressions for each incoming frame
  8186. @end table
  8187. Default value is @samp{init}.
  8188. @end table
  8189. The expressions accept the following parameters:
  8190. @table @option
  8191. @item n
  8192. frame count of the input frame starting from 0
  8193. @item pos
  8194. byte position of the corresponding packet in the input file, NAN if
  8195. unspecified
  8196. @item r
  8197. frame rate of the input video, NAN if the input frame rate is unknown
  8198. @item t
  8199. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8200. @end table
  8201. @subsection Commands
  8202. The filter supports the following commands:
  8203. @table @option
  8204. @item contrast
  8205. Set the contrast expression.
  8206. @item brightness
  8207. Set the brightness expression.
  8208. @item saturation
  8209. Set the saturation expression.
  8210. @item gamma
  8211. Set the gamma expression.
  8212. @item gamma_r
  8213. Set the gamma_r expression.
  8214. @item gamma_g
  8215. Set gamma_g expression.
  8216. @item gamma_b
  8217. Set gamma_b expression.
  8218. @item gamma_weight
  8219. Set gamma_weight expression.
  8220. The command accepts the same syntax of the corresponding option.
  8221. If the specified expression is not valid, it is kept at its current
  8222. value.
  8223. @end table
  8224. @section erosion
  8225. Apply erosion effect to the video.
  8226. This filter replaces the pixel by the local(3x3) minimum.
  8227. It accepts the following options:
  8228. @table @option
  8229. @item threshold0
  8230. @item threshold1
  8231. @item threshold2
  8232. @item threshold3
  8233. Limit the maximum change for each plane, default is 65535.
  8234. If 0, plane will remain unchanged.
  8235. @item coordinates
  8236. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8237. pixels are used.
  8238. Flags to local 3x3 coordinates maps like this:
  8239. 1 2 3
  8240. 4 5
  8241. 6 7 8
  8242. @end table
  8243. @subsection Commands
  8244. This filter supports the all above options as @ref{commands}.
  8245. @section extractplanes
  8246. Extract color channel components from input video stream into
  8247. separate grayscale video streams.
  8248. The filter accepts the following option:
  8249. @table @option
  8250. @item planes
  8251. Set plane(s) to extract.
  8252. Available values for planes are:
  8253. @table @samp
  8254. @item y
  8255. @item u
  8256. @item v
  8257. @item a
  8258. @item r
  8259. @item g
  8260. @item b
  8261. @end table
  8262. Choosing planes not available in the input will result in an error.
  8263. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8264. with @code{y}, @code{u}, @code{v} planes at same time.
  8265. @end table
  8266. @subsection Examples
  8267. @itemize
  8268. @item
  8269. Extract luma, u and v color channel component from input video frame
  8270. into 3 grayscale outputs:
  8271. @example
  8272. 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
  8273. @end example
  8274. @end itemize
  8275. @section fade
  8276. Apply a fade-in/out effect to the input video.
  8277. It accepts the following parameters:
  8278. @table @option
  8279. @item type, t
  8280. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8281. effect.
  8282. Default is @code{in}.
  8283. @item start_frame, s
  8284. Specify the number of the frame to start applying the fade
  8285. effect at. Default is 0.
  8286. @item nb_frames, n
  8287. The number of frames that the fade effect lasts. At the end of the
  8288. fade-in effect, the output video will have the same intensity as the input video.
  8289. At the end of the fade-out transition, the output video will be filled with the
  8290. selected @option{color}.
  8291. Default is 25.
  8292. @item alpha
  8293. If set to 1, fade only alpha channel, if one exists on the input.
  8294. Default value is 0.
  8295. @item start_time, st
  8296. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8297. effect. If both start_frame and start_time are specified, the fade will start at
  8298. whichever comes last. Default is 0.
  8299. @item duration, d
  8300. The number of seconds for which the fade effect has to last. At the end of the
  8301. fade-in effect the output video will have the same intensity as the input video,
  8302. at the end of the fade-out transition the output video will be filled with the
  8303. selected @option{color}.
  8304. If both duration and nb_frames are specified, duration is used. Default is 0
  8305. (nb_frames is used by default).
  8306. @item color, c
  8307. Specify the color of the fade. Default is "black".
  8308. @end table
  8309. @subsection Examples
  8310. @itemize
  8311. @item
  8312. Fade in the first 30 frames of video:
  8313. @example
  8314. fade=in:0:30
  8315. @end example
  8316. The command above is equivalent to:
  8317. @example
  8318. fade=t=in:s=0:n=30
  8319. @end example
  8320. @item
  8321. Fade out the last 45 frames of a 200-frame video:
  8322. @example
  8323. fade=out:155:45
  8324. fade=type=out:start_frame=155:nb_frames=45
  8325. @end example
  8326. @item
  8327. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8328. @example
  8329. fade=in:0:25, fade=out:975:25
  8330. @end example
  8331. @item
  8332. Make the first 5 frames yellow, then fade in from frame 5-24:
  8333. @example
  8334. fade=in:5:20:color=yellow
  8335. @end example
  8336. @item
  8337. Fade in alpha over first 25 frames of video:
  8338. @example
  8339. fade=in:0:25:alpha=1
  8340. @end example
  8341. @item
  8342. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8343. @example
  8344. fade=t=in:st=5.5:d=0.5
  8345. @end example
  8346. @end itemize
  8347. @section fftdnoiz
  8348. Denoise frames using 3D FFT (frequency domain filtering).
  8349. The filter accepts the following options:
  8350. @table @option
  8351. @item sigma
  8352. Set the noise sigma constant. This sets denoising strength.
  8353. Default value is 1. Allowed range is from 0 to 30.
  8354. Using very high sigma with low overlap may give blocking artifacts.
  8355. @item amount
  8356. Set amount of denoising. By default all detected noise is reduced.
  8357. Default value is 1. Allowed range is from 0 to 1.
  8358. @item block
  8359. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8360. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8361. block size in pixels is 2^4 which is 16.
  8362. @item overlap
  8363. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8364. @item prev
  8365. Set number of previous frames to use for denoising. By default is set to 0.
  8366. @item next
  8367. Set number of next frames to to use for denoising. By default is set to 0.
  8368. @item planes
  8369. Set planes which will be filtered, by default are all available filtered
  8370. except alpha.
  8371. @end table
  8372. @section fftfilt
  8373. Apply arbitrary expressions to samples in frequency domain
  8374. @table @option
  8375. @item dc_Y
  8376. Adjust the dc value (gain) of the luma plane of the image. The filter
  8377. accepts an integer value in range @code{0} to @code{1000}. The default
  8378. value is set to @code{0}.
  8379. @item dc_U
  8380. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8381. filter accepts an integer value in range @code{0} to @code{1000}. The
  8382. default value is set to @code{0}.
  8383. @item dc_V
  8384. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8385. filter accepts an integer value in range @code{0} to @code{1000}. The
  8386. default value is set to @code{0}.
  8387. @item weight_Y
  8388. Set the frequency domain weight expression for the luma plane.
  8389. @item weight_U
  8390. Set the frequency domain weight expression for the 1st chroma plane.
  8391. @item weight_V
  8392. Set the frequency domain weight expression for the 2nd chroma plane.
  8393. @item eval
  8394. Set when the expressions are evaluated.
  8395. It accepts the following values:
  8396. @table @samp
  8397. @item init
  8398. Only evaluate expressions once during the filter initialization.
  8399. @item frame
  8400. Evaluate expressions for each incoming frame.
  8401. @end table
  8402. Default value is @samp{init}.
  8403. The filter accepts the following variables:
  8404. @item X
  8405. @item Y
  8406. The coordinates of the current sample.
  8407. @item W
  8408. @item H
  8409. The width and height of the image.
  8410. @item N
  8411. The number of input frame, starting from 0.
  8412. @end table
  8413. @subsection Examples
  8414. @itemize
  8415. @item
  8416. High-pass:
  8417. @example
  8418. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8419. @end example
  8420. @item
  8421. Low-pass:
  8422. @example
  8423. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8424. @end example
  8425. @item
  8426. Sharpen:
  8427. @example
  8428. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8429. @end example
  8430. @item
  8431. Blur:
  8432. @example
  8433. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8434. @end example
  8435. @end itemize
  8436. @section field
  8437. Extract a single field from an interlaced image using stride
  8438. arithmetic to avoid wasting CPU time. The output frames are marked as
  8439. non-interlaced.
  8440. The filter accepts the following options:
  8441. @table @option
  8442. @item type
  8443. Specify whether to extract the top (if the value is @code{0} or
  8444. @code{top}) or the bottom field (if the value is @code{1} or
  8445. @code{bottom}).
  8446. @end table
  8447. @section fieldhint
  8448. Create new frames by copying the top and bottom fields from surrounding frames
  8449. supplied as numbers by the hint file.
  8450. @table @option
  8451. @item hint
  8452. Set file containing hints: absolute/relative frame numbers.
  8453. There must be one line for each frame in a clip. Each line must contain two
  8454. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8455. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8456. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8457. for @code{relative} mode. First number tells from which frame to pick up top
  8458. field and second number tells from which frame to pick up bottom field.
  8459. If optionally followed by @code{+} output frame will be marked as interlaced,
  8460. else if followed by @code{-} output frame will be marked as progressive, else
  8461. it will be marked same as input frame.
  8462. If optionally followed by @code{t} output frame will use only top field, or in
  8463. case of @code{b} it will use only bottom field.
  8464. If line starts with @code{#} or @code{;} that line is skipped.
  8465. @item mode
  8466. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8467. @end table
  8468. Example of first several lines of @code{hint} file for @code{relative} mode:
  8469. @example
  8470. 0,0 - # first frame
  8471. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8472. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8473. 1,0 -
  8474. 0,0 -
  8475. 0,0 -
  8476. 1,0 -
  8477. 1,0 -
  8478. 1,0 -
  8479. 0,0 -
  8480. 0,0 -
  8481. 1,0 -
  8482. 1,0 -
  8483. 1,0 -
  8484. 0,0 -
  8485. @end example
  8486. @section fieldmatch
  8487. Field matching filter for inverse telecine. It is meant to reconstruct the
  8488. progressive frames from a telecined stream. The filter does not drop duplicated
  8489. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8490. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8491. The separation of the field matching and the decimation is notably motivated by
  8492. the possibility of inserting a de-interlacing filter fallback between the two.
  8493. If the source has mixed telecined and real interlaced content,
  8494. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8495. But these remaining combed frames will be marked as interlaced, and thus can be
  8496. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8497. In addition to the various configuration options, @code{fieldmatch} can take an
  8498. optional second stream, activated through the @option{ppsrc} option. If
  8499. enabled, the frames reconstruction will be based on the fields and frames from
  8500. this second stream. This allows the first input to be pre-processed in order to
  8501. help the various algorithms of the filter, while keeping the output lossless
  8502. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8503. or brightness/contrast adjustments can help.
  8504. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8505. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8506. which @code{fieldmatch} is based on. While the semantic and usage are very
  8507. close, some behaviour and options names can differ.
  8508. The @ref{decimate} filter currently only works for constant frame rate input.
  8509. If your input has mixed telecined (30fps) and progressive content with a lower
  8510. framerate like 24fps use the following filterchain to produce the necessary cfr
  8511. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8512. The filter accepts the following options:
  8513. @table @option
  8514. @item order
  8515. Specify the assumed field order of the input stream. Available values are:
  8516. @table @samp
  8517. @item auto
  8518. Auto detect parity (use FFmpeg's internal parity value).
  8519. @item bff
  8520. Assume bottom field first.
  8521. @item tff
  8522. Assume top field first.
  8523. @end table
  8524. Note that it is sometimes recommended not to trust the parity announced by the
  8525. stream.
  8526. Default value is @var{auto}.
  8527. @item mode
  8528. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8529. sense that it won't risk creating jerkiness due to duplicate frames when
  8530. possible, but if there are bad edits or blended fields it will end up
  8531. outputting combed frames when a good match might actually exist. On the other
  8532. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8533. but will almost always find a good frame if there is one. The other values are
  8534. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8535. jerkiness and creating duplicate frames versus finding good matches in sections
  8536. with bad edits, orphaned fields, blended fields, etc.
  8537. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8538. Available values are:
  8539. @table @samp
  8540. @item pc
  8541. 2-way matching (p/c)
  8542. @item pc_n
  8543. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8544. @item pc_u
  8545. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8546. @item pc_n_ub
  8547. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8548. still combed (p/c + n + u/b)
  8549. @item pcn
  8550. 3-way matching (p/c/n)
  8551. @item pcn_ub
  8552. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8553. detected as combed (p/c/n + u/b)
  8554. @end table
  8555. The parenthesis at the end indicate the matches that would be used for that
  8556. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8557. @var{top}).
  8558. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8559. the slowest.
  8560. Default value is @var{pc_n}.
  8561. @item ppsrc
  8562. Mark the main input stream as a pre-processed input, and enable the secondary
  8563. input stream as the clean source to pick the fields from. See the filter
  8564. introduction for more details. It is similar to the @option{clip2} feature from
  8565. VFM/TFM.
  8566. Default value is @code{0} (disabled).
  8567. @item field
  8568. Set the field to match from. It is recommended to set this to the same value as
  8569. @option{order} unless you experience matching failures with that setting. In
  8570. certain circumstances changing the field that is used to match from can have a
  8571. large impact on matching performance. Available values are:
  8572. @table @samp
  8573. @item auto
  8574. Automatic (same value as @option{order}).
  8575. @item bottom
  8576. Match from the bottom field.
  8577. @item top
  8578. Match from the top field.
  8579. @end table
  8580. Default value is @var{auto}.
  8581. @item mchroma
  8582. Set whether or not chroma is included during the match comparisons. In most
  8583. cases it is recommended to leave this enabled. You should set this to @code{0}
  8584. only if your clip has bad chroma problems such as heavy rainbowing or other
  8585. artifacts. Setting this to @code{0} could also be used to speed things up at
  8586. the cost of some accuracy.
  8587. Default value is @code{1}.
  8588. @item y0
  8589. @item y1
  8590. These define an exclusion band which excludes the lines between @option{y0} and
  8591. @option{y1} from being included in the field matching decision. An exclusion
  8592. band can be used to ignore subtitles, a logo, or other things that may
  8593. interfere with the matching. @option{y0} sets the starting scan line and
  8594. @option{y1} sets the ending line; all lines in between @option{y0} and
  8595. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8596. @option{y0} and @option{y1} to the same value will disable the feature.
  8597. @option{y0} and @option{y1} defaults to @code{0}.
  8598. @item scthresh
  8599. Set the scene change detection threshold as a percentage of maximum change on
  8600. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8601. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8602. @option{scthresh} is @code{[0.0, 100.0]}.
  8603. Default value is @code{12.0}.
  8604. @item combmatch
  8605. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8606. account the combed scores of matches when deciding what match to use as the
  8607. final match. Available values are:
  8608. @table @samp
  8609. @item none
  8610. No final matching based on combed scores.
  8611. @item sc
  8612. Combed scores are only used when a scene change is detected.
  8613. @item full
  8614. Use combed scores all the time.
  8615. @end table
  8616. Default is @var{sc}.
  8617. @item combdbg
  8618. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8619. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8620. Available values are:
  8621. @table @samp
  8622. @item none
  8623. No forced calculation.
  8624. @item pcn
  8625. Force p/c/n calculations.
  8626. @item pcnub
  8627. Force p/c/n/u/b calculations.
  8628. @end table
  8629. Default value is @var{none}.
  8630. @item cthresh
  8631. This is the area combing threshold used for combed frame detection. This
  8632. essentially controls how "strong" or "visible" combing must be to be detected.
  8633. Larger values mean combing must be more visible and smaller values mean combing
  8634. can be less visible or strong and still be detected. Valid settings are from
  8635. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8636. be detected as combed). This is basically a pixel difference value. A good
  8637. range is @code{[8, 12]}.
  8638. Default value is @code{9}.
  8639. @item chroma
  8640. Sets whether or not chroma is considered in the combed frame decision. Only
  8641. disable this if your source has chroma problems (rainbowing, etc.) that are
  8642. causing problems for the combed frame detection with chroma enabled. Actually,
  8643. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8644. where there is chroma only combing in the source.
  8645. Default value is @code{0}.
  8646. @item blockx
  8647. @item blocky
  8648. Respectively set the x-axis and y-axis size of the window used during combed
  8649. frame detection. This has to do with the size of the area in which
  8650. @option{combpel} pixels are required to be detected as combed for a frame to be
  8651. declared combed. See the @option{combpel} parameter description for more info.
  8652. Possible values are any number that is a power of 2 starting at 4 and going up
  8653. to 512.
  8654. Default value is @code{16}.
  8655. @item combpel
  8656. The number of combed pixels inside any of the @option{blocky} by
  8657. @option{blockx} size blocks on the frame for the frame to be detected as
  8658. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8659. setting controls "how much" combing there must be in any localized area (a
  8660. window defined by the @option{blockx} and @option{blocky} settings) on the
  8661. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8662. which point no frames will ever be detected as combed). This setting is known
  8663. as @option{MI} in TFM/VFM vocabulary.
  8664. Default value is @code{80}.
  8665. @end table
  8666. @anchor{p/c/n/u/b meaning}
  8667. @subsection p/c/n/u/b meaning
  8668. @subsubsection p/c/n
  8669. We assume the following telecined stream:
  8670. @example
  8671. Top fields: 1 2 2 3 4
  8672. Bottom fields: 1 2 3 4 4
  8673. @end example
  8674. The numbers correspond to the progressive frame the fields relate to. Here, the
  8675. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8676. When @code{fieldmatch} is configured to run a matching from bottom
  8677. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8678. @example
  8679. Input stream:
  8680. T 1 2 2 3 4
  8681. B 1 2 3 4 4 <-- matching reference
  8682. Matches: c c n n c
  8683. Output stream:
  8684. T 1 2 3 4 4
  8685. B 1 2 3 4 4
  8686. @end example
  8687. As a result of the field matching, we can see that some frames get duplicated.
  8688. To perform a complete inverse telecine, you need to rely on a decimation filter
  8689. after this operation. See for instance the @ref{decimate} filter.
  8690. The same operation now matching from top fields (@option{field}=@var{top})
  8691. looks like this:
  8692. @example
  8693. Input stream:
  8694. T 1 2 2 3 4 <-- matching reference
  8695. B 1 2 3 4 4
  8696. Matches: c c p p c
  8697. Output stream:
  8698. T 1 2 2 3 4
  8699. B 1 2 2 3 4
  8700. @end example
  8701. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8702. basically, they refer to the frame and field of the opposite parity:
  8703. @itemize
  8704. @item @var{p} matches the field of the opposite parity in the previous frame
  8705. @item @var{c} matches the field of the opposite parity in the current frame
  8706. @item @var{n} matches the field of the opposite parity in the next frame
  8707. @end itemize
  8708. @subsubsection u/b
  8709. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8710. from the opposite parity flag. In the following examples, we assume that we are
  8711. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8712. 'x' is placed above and below each matched fields.
  8713. With bottom matching (@option{field}=@var{bottom}):
  8714. @example
  8715. Match: c p n b u
  8716. x x x x x
  8717. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8718. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8719. x x x x x
  8720. Output frames:
  8721. 2 1 2 2 2
  8722. 2 2 2 1 3
  8723. @end example
  8724. With top matching (@option{field}=@var{top}):
  8725. @example
  8726. Match: c p n b u
  8727. x x x x x
  8728. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8729. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8730. x x x x x
  8731. Output frames:
  8732. 2 2 2 1 2
  8733. 2 1 3 2 2
  8734. @end example
  8735. @subsection Examples
  8736. Simple IVTC of a top field first telecined stream:
  8737. @example
  8738. fieldmatch=order=tff:combmatch=none, decimate
  8739. @end example
  8740. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8741. @example
  8742. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8743. @end example
  8744. @section fieldorder
  8745. Transform the field order of the input video.
  8746. It accepts the following parameters:
  8747. @table @option
  8748. @item order
  8749. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8750. for bottom field first.
  8751. @end table
  8752. The default value is @samp{tff}.
  8753. The transformation is done by shifting the picture content up or down
  8754. by one line, and filling the remaining line with appropriate picture content.
  8755. This method is consistent with most broadcast field order converters.
  8756. If the input video is not flagged as being interlaced, or it is already
  8757. flagged as being of the required output field order, then this filter does
  8758. not alter the incoming video.
  8759. It is very useful when converting to or from PAL DV material,
  8760. which is bottom field first.
  8761. For example:
  8762. @example
  8763. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8764. @end example
  8765. @section fifo, afifo
  8766. Buffer input images and send them when they are requested.
  8767. It is mainly useful when auto-inserted by the libavfilter
  8768. framework.
  8769. It does not take parameters.
  8770. @section fillborders
  8771. Fill borders of the input video, without changing video stream dimensions.
  8772. Sometimes video can have garbage at the four edges and you may not want to
  8773. crop video input to keep size multiple of some number.
  8774. This filter accepts the following options:
  8775. @table @option
  8776. @item left
  8777. Number of pixels to fill from left border.
  8778. @item right
  8779. Number of pixels to fill from right border.
  8780. @item top
  8781. Number of pixels to fill from top border.
  8782. @item bottom
  8783. Number of pixels to fill from bottom border.
  8784. @item mode
  8785. Set fill mode.
  8786. It accepts the following values:
  8787. @table @samp
  8788. @item smear
  8789. fill pixels using outermost pixels
  8790. @item mirror
  8791. fill pixels using mirroring
  8792. @item fixed
  8793. fill pixels with constant value
  8794. @end table
  8795. Default is @var{smear}.
  8796. @item color
  8797. Set color for pixels in fixed mode. Default is @var{black}.
  8798. @end table
  8799. @subsection Commands
  8800. This filter supports same @ref{commands} as options.
  8801. The command accepts the same syntax of the corresponding option.
  8802. If the specified expression is not valid, it is kept at its current
  8803. value.
  8804. @section find_rect
  8805. Find a rectangular object
  8806. It accepts the following options:
  8807. @table @option
  8808. @item object
  8809. Filepath of the object image, needs to be in gray8.
  8810. @item threshold
  8811. Detection threshold, default is 0.5.
  8812. @item mipmaps
  8813. Number of mipmaps, default is 3.
  8814. @item xmin, ymin, xmax, ymax
  8815. Specifies the rectangle in which to search.
  8816. @end table
  8817. @subsection Examples
  8818. @itemize
  8819. @item
  8820. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8821. @example
  8822. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8823. @end example
  8824. @end itemize
  8825. @section floodfill
  8826. Flood area with values of same pixel components with another values.
  8827. It accepts the following options:
  8828. @table @option
  8829. @item x
  8830. Set pixel x coordinate.
  8831. @item y
  8832. Set pixel y coordinate.
  8833. @item s0
  8834. Set source #0 component value.
  8835. @item s1
  8836. Set source #1 component value.
  8837. @item s2
  8838. Set source #2 component value.
  8839. @item s3
  8840. Set source #3 component value.
  8841. @item d0
  8842. Set destination #0 component value.
  8843. @item d1
  8844. Set destination #1 component value.
  8845. @item d2
  8846. Set destination #2 component value.
  8847. @item d3
  8848. Set destination #3 component value.
  8849. @end table
  8850. @anchor{format}
  8851. @section format
  8852. Convert the input video to one of the specified pixel formats.
  8853. Libavfilter will try to pick one that is suitable as input to
  8854. the next filter.
  8855. It accepts the following parameters:
  8856. @table @option
  8857. @item pix_fmts
  8858. A '|'-separated list of pixel format names, such as
  8859. "pix_fmts=yuv420p|monow|rgb24".
  8860. @end table
  8861. @subsection Examples
  8862. @itemize
  8863. @item
  8864. Convert the input video to the @var{yuv420p} format
  8865. @example
  8866. format=pix_fmts=yuv420p
  8867. @end example
  8868. Convert the input video to any of the formats in the list
  8869. @example
  8870. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8871. @end example
  8872. @end itemize
  8873. @anchor{fps}
  8874. @section fps
  8875. Convert the video to specified constant frame rate by duplicating or dropping
  8876. frames as necessary.
  8877. It accepts the following parameters:
  8878. @table @option
  8879. @item fps
  8880. The desired output frame rate. The default is @code{25}.
  8881. @item start_time
  8882. Assume the first PTS should be the given value, in seconds. This allows for
  8883. padding/trimming at the start of stream. By default, no assumption is made
  8884. about the first frame's expected PTS, so no padding or trimming is done.
  8885. For example, this could be set to 0 to pad the beginning with duplicates of
  8886. the first frame if a video stream starts after the audio stream or to trim any
  8887. frames with a negative PTS.
  8888. @item round
  8889. Timestamp (PTS) rounding method.
  8890. Possible values are:
  8891. @table @option
  8892. @item zero
  8893. round towards 0
  8894. @item inf
  8895. round away from 0
  8896. @item down
  8897. round towards -infinity
  8898. @item up
  8899. round towards +infinity
  8900. @item near
  8901. round to nearest
  8902. @end table
  8903. The default is @code{near}.
  8904. @item eof_action
  8905. Action performed when reading the last frame.
  8906. Possible values are:
  8907. @table @option
  8908. @item round
  8909. Use same timestamp rounding method as used for other frames.
  8910. @item pass
  8911. Pass through last frame if input duration has not been reached yet.
  8912. @end table
  8913. The default is @code{round}.
  8914. @end table
  8915. Alternatively, the options can be specified as a flat string:
  8916. @var{fps}[:@var{start_time}[:@var{round}]].
  8917. See also the @ref{setpts} filter.
  8918. @subsection Examples
  8919. @itemize
  8920. @item
  8921. A typical usage in order to set the fps to 25:
  8922. @example
  8923. fps=fps=25
  8924. @end example
  8925. @item
  8926. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8927. @example
  8928. fps=fps=film:round=near
  8929. @end example
  8930. @end itemize
  8931. @section framepack
  8932. Pack two different video streams into a stereoscopic video, setting proper
  8933. metadata on supported codecs. The two views should have the same size and
  8934. framerate and processing will stop when the shorter video ends. Please note
  8935. that you may conveniently adjust view properties with the @ref{scale} and
  8936. @ref{fps} filters.
  8937. It accepts the following parameters:
  8938. @table @option
  8939. @item format
  8940. The desired packing format. Supported values are:
  8941. @table @option
  8942. @item sbs
  8943. The views are next to each other (default).
  8944. @item tab
  8945. The views are on top of each other.
  8946. @item lines
  8947. The views are packed by line.
  8948. @item columns
  8949. The views are packed by column.
  8950. @item frameseq
  8951. The views are temporally interleaved.
  8952. @end table
  8953. @end table
  8954. Some examples:
  8955. @example
  8956. # Convert left and right views into a frame-sequential video
  8957. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8958. # Convert views into a side-by-side video with the same output resolution as the input
  8959. 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
  8960. @end example
  8961. @section framerate
  8962. Change the frame rate by interpolating new video output frames from the source
  8963. frames.
  8964. This filter is not designed to function correctly with interlaced media. If
  8965. you wish to change the frame rate of interlaced media then you are required
  8966. to deinterlace before this filter and re-interlace after this filter.
  8967. A description of the accepted options follows.
  8968. @table @option
  8969. @item fps
  8970. Specify the output frames per second. This option can also be specified
  8971. as a value alone. The default is @code{50}.
  8972. @item interp_start
  8973. Specify the start of a range where the output frame will be created as a
  8974. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8975. the default is @code{15}.
  8976. @item interp_end
  8977. Specify the end of a range where the output frame will be created as a
  8978. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8979. the default is @code{240}.
  8980. @item scene
  8981. Specify the level at which a scene change is detected as a value between
  8982. 0 and 100 to indicate a new scene; a low value reflects a low
  8983. probability for the current frame to introduce a new scene, while a higher
  8984. value means the current frame is more likely to be one.
  8985. The default is @code{8.2}.
  8986. @item flags
  8987. Specify flags influencing the filter process.
  8988. Available value for @var{flags} is:
  8989. @table @option
  8990. @item scene_change_detect, scd
  8991. Enable scene change detection using the value of the option @var{scene}.
  8992. This flag is enabled by default.
  8993. @end table
  8994. @end table
  8995. @section framestep
  8996. Select one frame every N-th frame.
  8997. This filter accepts the following option:
  8998. @table @option
  8999. @item step
  9000. Select frame after every @code{step} frames.
  9001. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9002. @end table
  9003. @section freezedetect
  9004. Detect frozen video.
  9005. This filter logs a message and sets frame metadata when it detects that the
  9006. input video has no significant change in content during a specified duration.
  9007. Video freeze detection calculates the mean average absolute difference of all
  9008. the components of video frames and compares it to a noise floor.
  9009. The printed times and duration are expressed in seconds. The
  9010. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9011. whose timestamp equals or exceeds the detection duration and it contains the
  9012. timestamp of the first frame of the freeze. The
  9013. @code{lavfi.freezedetect.freeze_duration} and
  9014. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9015. after the freeze.
  9016. The filter accepts the following options:
  9017. @table @option
  9018. @item noise, n
  9019. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9020. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9021. 0.001.
  9022. @item duration, d
  9023. Set freeze duration until notification (default is 2 seconds).
  9024. @end table
  9025. @section freezeframes
  9026. Freeze video frames.
  9027. This filter freezes video frames using frame from 2nd input.
  9028. The filter accepts the following options:
  9029. @table @option
  9030. @item first
  9031. Set number of first frame from which to start freeze.
  9032. @item last
  9033. Set number of last frame from which to end freeze.
  9034. @item replace
  9035. Set number of frame from 2nd input which will be used instead of replaced frames.
  9036. @end table
  9037. @anchor{frei0r}
  9038. @section frei0r
  9039. Apply a frei0r effect to the input video.
  9040. To enable the compilation of this filter, you need to install the frei0r
  9041. header and configure FFmpeg with @code{--enable-frei0r}.
  9042. It accepts the following parameters:
  9043. @table @option
  9044. @item filter_name
  9045. The name of the frei0r effect to load. If the environment variable
  9046. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9047. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9048. Otherwise, the standard frei0r paths are searched, in this order:
  9049. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9050. @file{/usr/lib/frei0r-1/}.
  9051. @item filter_params
  9052. A '|'-separated list of parameters to pass to the frei0r effect.
  9053. @end table
  9054. A frei0r effect parameter can be a boolean (its value is either
  9055. "y" or "n"), a double, a color (specified as
  9056. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9057. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9058. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9059. a position (specified as @var{X}/@var{Y}, where
  9060. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9061. The number and types of parameters depend on the loaded effect. If an
  9062. effect parameter is not specified, the default value is set.
  9063. @subsection Examples
  9064. @itemize
  9065. @item
  9066. Apply the distort0r effect, setting the first two double parameters:
  9067. @example
  9068. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9069. @end example
  9070. @item
  9071. Apply the colordistance effect, taking a color as the first parameter:
  9072. @example
  9073. frei0r=colordistance:0.2/0.3/0.4
  9074. frei0r=colordistance:violet
  9075. frei0r=colordistance:0x112233
  9076. @end example
  9077. @item
  9078. Apply the perspective effect, specifying the top left and top right image
  9079. positions:
  9080. @example
  9081. frei0r=perspective:0.2/0.2|0.8/0.2
  9082. @end example
  9083. @end itemize
  9084. For more information, see
  9085. @url{http://frei0r.dyne.org}
  9086. @subsection Commands
  9087. This filter supports the @option{filter_params} option as @ref{commands}.
  9088. @section fspp
  9089. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9090. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9091. processing filter, one of them is performed once per block, not per pixel.
  9092. This allows for much higher speed.
  9093. The filter accepts the following options:
  9094. @table @option
  9095. @item quality
  9096. Set quality. This option defines the number of levels for averaging. It accepts
  9097. an integer in the range 4-5. Default value is @code{4}.
  9098. @item qp
  9099. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9100. If not set, the filter will use the QP from the video stream (if available).
  9101. @item strength
  9102. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9103. more details but also more artifacts, while higher values make the image smoother
  9104. but also blurrier. Default value is @code{0} − PSNR optimal.
  9105. @item use_bframe_qp
  9106. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9107. option may cause flicker since the B-Frames have often larger QP. Default is
  9108. @code{0} (not enabled).
  9109. @end table
  9110. @section gblur
  9111. Apply Gaussian blur filter.
  9112. The filter accepts the following options:
  9113. @table @option
  9114. @item sigma
  9115. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9116. @item steps
  9117. Set number of steps for Gaussian approximation. Default is @code{1}.
  9118. @item planes
  9119. Set which planes to filter. By default all planes are filtered.
  9120. @item sigmaV
  9121. Set vertical sigma, if negative it will be same as @code{sigma}.
  9122. Default is @code{-1}.
  9123. @end table
  9124. @subsection Commands
  9125. This filter supports same commands as options.
  9126. The command accepts the same syntax of the corresponding option.
  9127. If the specified expression is not valid, it is kept at its current
  9128. value.
  9129. @section geq
  9130. Apply generic equation to each pixel.
  9131. The filter accepts the following options:
  9132. @table @option
  9133. @item lum_expr, lum
  9134. Set the luminance expression.
  9135. @item cb_expr, cb
  9136. Set the chrominance blue expression.
  9137. @item cr_expr, cr
  9138. Set the chrominance red expression.
  9139. @item alpha_expr, a
  9140. Set the alpha expression.
  9141. @item red_expr, r
  9142. Set the red expression.
  9143. @item green_expr, g
  9144. Set the green expression.
  9145. @item blue_expr, b
  9146. Set the blue expression.
  9147. @end table
  9148. The colorspace is selected according to the specified options. If one
  9149. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9150. options is specified, the filter will automatically select a YCbCr
  9151. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9152. @option{blue_expr} options is specified, it will select an RGB
  9153. colorspace.
  9154. If one of the chrominance expression is not defined, it falls back on the other
  9155. one. If no alpha expression is specified it will evaluate to opaque value.
  9156. If none of chrominance expressions are specified, they will evaluate
  9157. to the luminance expression.
  9158. The expressions can use the following variables and functions:
  9159. @table @option
  9160. @item N
  9161. The sequential number of the filtered frame, starting from @code{0}.
  9162. @item X
  9163. @item Y
  9164. The coordinates of the current sample.
  9165. @item W
  9166. @item H
  9167. The width and height of the image.
  9168. @item SW
  9169. @item SH
  9170. Width and height scale depending on the currently filtered plane. It is the
  9171. ratio between the corresponding luma plane number of pixels and the current
  9172. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9173. @code{0.5,0.5} for chroma planes.
  9174. @item T
  9175. Time of the current frame, expressed in seconds.
  9176. @item p(x, y)
  9177. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9178. plane.
  9179. @item lum(x, y)
  9180. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9181. plane.
  9182. @item cb(x, y)
  9183. Return the value of the pixel at location (@var{x},@var{y}) of the
  9184. blue-difference chroma plane. Return 0 if there is no such plane.
  9185. @item cr(x, y)
  9186. Return the value of the pixel at location (@var{x},@var{y}) of the
  9187. red-difference chroma plane. Return 0 if there is no such plane.
  9188. @item r(x, y)
  9189. @item g(x, y)
  9190. @item b(x, y)
  9191. Return the value of the pixel at location (@var{x},@var{y}) of the
  9192. red/green/blue component. Return 0 if there is no such component.
  9193. @item alpha(x, y)
  9194. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9195. plane. Return 0 if there is no such plane.
  9196. @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)
  9197. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9198. sums of samples within a rectangle. See the functions without the sum postfix.
  9199. @item interpolation
  9200. Set one of interpolation methods:
  9201. @table @option
  9202. @item nearest, n
  9203. @item bilinear, b
  9204. @end table
  9205. Default is bilinear.
  9206. @end table
  9207. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9208. automatically clipped to the closer edge.
  9209. Please note that this filter can use multiple threads in which case each slice
  9210. will have its own expression state. If you want to use only a single expression
  9211. state because your expressions depend on previous state then you should limit
  9212. the number of filter threads to 1.
  9213. @subsection Examples
  9214. @itemize
  9215. @item
  9216. Flip the image horizontally:
  9217. @example
  9218. geq=p(W-X\,Y)
  9219. @end example
  9220. @item
  9221. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9222. wavelength of 100 pixels:
  9223. @example
  9224. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9225. @end example
  9226. @item
  9227. Generate a fancy enigmatic moving light:
  9228. @example
  9229. 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
  9230. @end example
  9231. @item
  9232. Generate a quick emboss effect:
  9233. @example
  9234. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9235. @end example
  9236. @item
  9237. Modify RGB components depending on pixel position:
  9238. @example
  9239. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9240. @end example
  9241. @item
  9242. Create a radial gradient that is the same size as the input (also see
  9243. the @ref{vignette} filter):
  9244. @example
  9245. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9246. @end example
  9247. @end itemize
  9248. @section gradfun
  9249. Fix the banding artifacts that are sometimes introduced into nearly flat
  9250. regions by truncation to 8-bit color depth.
  9251. Interpolate the gradients that should go where the bands are, and
  9252. dither them.
  9253. It is designed for playback only. Do not use it prior to
  9254. lossy compression, because compression tends to lose the dither and
  9255. bring back the bands.
  9256. It accepts the following parameters:
  9257. @table @option
  9258. @item strength
  9259. The maximum amount by which the filter will change any one pixel. This is also
  9260. the threshold for detecting nearly flat regions. Acceptable values range from
  9261. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9262. valid range.
  9263. @item radius
  9264. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9265. gradients, but also prevents the filter from modifying the pixels near detailed
  9266. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9267. values will be clipped to the valid range.
  9268. @end table
  9269. Alternatively, the options can be specified as a flat string:
  9270. @var{strength}[:@var{radius}]
  9271. @subsection Examples
  9272. @itemize
  9273. @item
  9274. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9275. @example
  9276. gradfun=3.5:8
  9277. @end example
  9278. @item
  9279. Specify radius, omitting the strength (which will fall-back to the default
  9280. value):
  9281. @example
  9282. gradfun=radius=8
  9283. @end example
  9284. @end itemize
  9285. @anchor{graphmonitor}
  9286. @section graphmonitor
  9287. Show various filtergraph stats.
  9288. With this filter one can debug complete filtergraph.
  9289. Especially issues with links filling with queued frames.
  9290. The filter accepts the following options:
  9291. @table @option
  9292. @item size, s
  9293. Set video output size. Default is @var{hd720}.
  9294. @item opacity, o
  9295. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9296. @item mode, m
  9297. Set output mode, can be @var{fulll} or @var{compact}.
  9298. In @var{compact} mode only filters with some queued frames have displayed stats.
  9299. @item flags, f
  9300. Set flags which enable which stats are shown in video.
  9301. Available values for flags are:
  9302. @table @samp
  9303. @item queue
  9304. Display number of queued frames in each link.
  9305. @item frame_count_in
  9306. Display number of frames taken from filter.
  9307. @item frame_count_out
  9308. Display number of frames given out from filter.
  9309. @item pts
  9310. Display current filtered frame pts.
  9311. @item time
  9312. Display current filtered frame time.
  9313. @item timebase
  9314. Display time base for filter link.
  9315. @item format
  9316. Display used format for filter link.
  9317. @item size
  9318. Display video size or number of audio channels in case of audio used by filter link.
  9319. @item rate
  9320. Display video frame rate or sample rate in case of audio used by filter link.
  9321. @item eof
  9322. Display link output status.
  9323. @end table
  9324. @item rate, r
  9325. Set upper limit for video rate of output stream, Default value is @var{25}.
  9326. This guarantee that output video frame rate will not be higher than this value.
  9327. @end table
  9328. @section greyedge
  9329. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9330. and corrects the scene colors accordingly.
  9331. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9332. The filter accepts the following options:
  9333. @table @option
  9334. @item difford
  9335. The order of differentiation to be applied on the scene. Must be chosen in the range
  9336. [0,2] and default value is 1.
  9337. @item minknorm
  9338. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9339. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9340. max value instead of calculating Minkowski distance.
  9341. @item sigma
  9342. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9343. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9344. can't be equal to 0 if @var{difford} is greater than 0.
  9345. @end table
  9346. @subsection Examples
  9347. @itemize
  9348. @item
  9349. Grey Edge:
  9350. @example
  9351. greyedge=difford=1:minknorm=5:sigma=2
  9352. @end example
  9353. @item
  9354. Max Edge:
  9355. @example
  9356. greyedge=difford=1:minknorm=0:sigma=2
  9357. @end example
  9358. @end itemize
  9359. @anchor{haldclut}
  9360. @section haldclut
  9361. Apply a Hald CLUT to a video stream.
  9362. First input is the video stream to process, and second one is the Hald CLUT.
  9363. The Hald CLUT input can be a simple picture or a complete video stream.
  9364. The filter accepts the following options:
  9365. @table @option
  9366. @item shortest
  9367. Force termination when the shortest input terminates. Default is @code{0}.
  9368. @item repeatlast
  9369. Continue applying the last CLUT after the end of the stream. A value of
  9370. @code{0} disable the filter after the last frame of the CLUT is reached.
  9371. Default is @code{1}.
  9372. @end table
  9373. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9374. filters share the same internals).
  9375. This filter also supports the @ref{framesync} options.
  9376. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9377. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9378. @subsection Workflow examples
  9379. @subsubsection Hald CLUT video stream
  9380. Generate an identity Hald CLUT stream altered with various effects:
  9381. @example
  9382. 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
  9383. @end example
  9384. Note: make sure you use a lossless codec.
  9385. Then use it with @code{haldclut} to apply it on some random stream:
  9386. @example
  9387. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9388. @end example
  9389. The Hald CLUT will be applied to the 10 first seconds (duration of
  9390. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9391. to the remaining frames of the @code{mandelbrot} stream.
  9392. @subsubsection Hald CLUT with preview
  9393. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9394. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9395. biggest possible square starting at the top left of the picture. The remaining
  9396. padding pixels (bottom or right) will be ignored. This area can be used to add
  9397. a preview of the Hald CLUT.
  9398. Typically, the following generated Hald CLUT will be supported by the
  9399. @code{haldclut} filter:
  9400. @example
  9401. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9402. pad=iw+320 [padded_clut];
  9403. smptebars=s=320x256, split [a][b];
  9404. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9405. [main][b] overlay=W-320" -frames:v 1 clut.png
  9406. @end example
  9407. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9408. bars are displayed on the right-top, and below the same color bars processed by
  9409. the color changes.
  9410. Then, the effect of this Hald CLUT can be visualized with:
  9411. @example
  9412. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9413. @end example
  9414. @section hflip
  9415. Flip the input video horizontally.
  9416. For example, to horizontally flip the input video with @command{ffmpeg}:
  9417. @example
  9418. ffmpeg -i in.avi -vf "hflip" out.avi
  9419. @end example
  9420. @section histeq
  9421. This filter applies a global color histogram equalization on a
  9422. per-frame basis.
  9423. It can be used to correct video that has a compressed range of pixel
  9424. intensities. The filter redistributes the pixel intensities to
  9425. equalize their distribution across the intensity range. It may be
  9426. viewed as an "automatically adjusting contrast filter". This filter is
  9427. useful only for correcting degraded or poorly captured source
  9428. video.
  9429. The filter accepts the following options:
  9430. @table @option
  9431. @item strength
  9432. Determine the amount of equalization to be applied. As the strength
  9433. is reduced, the distribution of pixel intensities more-and-more
  9434. approaches that of the input frame. The value must be a float number
  9435. in the range [0,1] and defaults to 0.200.
  9436. @item intensity
  9437. Set the maximum intensity that can generated and scale the output
  9438. values appropriately. The strength should be set as desired and then
  9439. the intensity can be limited if needed to avoid washing-out. The value
  9440. must be a float number in the range [0,1] and defaults to 0.210.
  9441. @item antibanding
  9442. Set the antibanding level. If enabled the filter will randomly vary
  9443. the luminance of output pixels by a small amount to avoid banding of
  9444. the histogram. Possible values are @code{none}, @code{weak} or
  9445. @code{strong}. It defaults to @code{none}.
  9446. @end table
  9447. @anchor{histogram}
  9448. @section histogram
  9449. Compute and draw a color distribution histogram for the input video.
  9450. The computed histogram is a representation of the color component
  9451. distribution in an image.
  9452. Standard histogram displays the color components distribution in an image.
  9453. Displays color graph for each color component. Shows distribution of
  9454. the Y, U, V, A or R, G, B components, depending on input format, in the
  9455. current frame. Below each graph a color component scale meter is shown.
  9456. The filter accepts the following options:
  9457. @table @option
  9458. @item level_height
  9459. Set height of level. Default value is @code{200}.
  9460. Allowed range is [50, 2048].
  9461. @item scale_height
  9462. Set height of color scale. Default value is @code{12}.
  9463. Allowed range is [0, 40].
  9464. @item display_mode
  9465. Set display mode.
  9466. It accepts the following values:
  9467. @table @samp
  9468. @item stack
  9469. Per color component graphs are placed below each other.
  9470. @item parade
  9471. Per color component graphs are placed side by side.
  9472. @item overlay
  9473. Presents information identical to that in the @code{parade}, except
  9474. that the graphs representing color components are superimposed directly
  9475. over one another.
  9476. @end table
  9477. Default is @code{stack}.
  9478. @item levels_mode
  9479. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9480. Default is @code{linear}.
  9481. @item components
  9482. Set what color components to display.
  9483. Default is @code{7}.
  9484. @item fgopacity
  9485. Set foreground opacity. Default is @code{0.7}.
  9486. @item bgopacity
  9487. Set background opacity. Default is @code{0.5}.
  9488. @end table
  9489. @subsection Examples
  9490. @itemize
  9491. @item
  9492. Calculate and draw histogram:
  9493. @example
  9494. ffplay -i input -vf histogram
  9495. @end example
  9496. @end itemize
  9497. @anchor{hqdn3d}
  9498. @section hqdn3d
  9499. This is a high precision/quality 3d denoise filter. It aims to reduce
  9500. image noise, producing smooth images and making still images really
  9501. still. It should enhance compressibility.
  9502. It accepts the following optional parameters:
  9503. @table @option
  9504. @item luma_spatial
  9505. A non-negative floating point number which specifies spatial luma strength.
  9506. It defaults to 4.0.
  9507. @item chroma_spatial
  9508. A non-negative floating point number which specifies spatial chroma strength.
  9509. It defaults to 3.0*@var{luma_spatial}/4.0.
  9510. @item luma_tmp
  9511. A floating point number which specifies luma temporal strength. It defaults to
  9512. 6.0*@var{luma_spatial}/4.0.
  9513. @item chroma_tmp
  9514. A floating point number which specifies chroma temporal strength. It defaults to
  9515. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9516. @end table
  9517. @subsection Commands
  9518. This filter supports same @ref{commands} as options.
  9519. The command accepts the same syntax of the corresponding option.
  9520. If the specified expression is not valid, it is kept at its current
  9521. value.
  9522. @anchor{hwdownload}
  9523. @section hwdownload
  9524. Download hardware frames to system memory.
  9525. The input must be in hardware frames, and the output a non-hardware format.
  9526. Not all formats will be supported on the output - it may be necessary to insert
  9527. an additional @option{format} filter immediately following in the graph to get
  9528. the output in a supported format.
  9529. @section hwmap
  9530. Map hardware frames to system memory or to another device.
  9531. This filter has several different modes of operation; which one is used depends
  9532. on the input and output formats:
  9533. @itemize
  9534. @item
  9535. Hardware frame input, normal frame output
  9536. Map the input frames to system memory and pass them to the output. If the
  9537. original hardware frame is later required (for example, after overlaying
  9538. something else on part of it), the @option{hwmap} filter can be used again
  9539. in the next mode to retrieve it.
  9540. @item
  9541. Normal frame input, hardware frame output
  9542. If the input is actually a software-mapped hardware frame, then unmap it -
  9543. that is, return the original hardware frame.
  9544. Otherwise, a device must be provided. Create new hardware surfaces on that
  9545. device for the output, then map them back to the software format at the input
  9546. and give those frames to the preceding filter. This will then act like the
  9547. @option{hwupload} filter, but may be able to avoid an additional copy when
  9548. the input is already in a compatible format.
  9549. @item
  9550. Hardware frame input and output
  9551. A device must be supplied for the output, either directly or with the
  9552. @option{derive_device} option. The input and output devices must be of
  9553. different types and compatible - the exact meaning of this is
  9554. system-dependent, but typically it means that they must refer to the same
  9555. underlying hardware context (for example, refer to the same graphics card).
  9556. If the input frames were originally created on the output device, then unmap
  9557. to retrieve the original frames.
  9558. Otherwise, map the frames to the output device - create new hardware frames
  9559. on the output corresponding to the frames on the input.
  9560. @end itemize
  9561. The following additional parameters are accepted:
  9562. @table @option
  9563. @item mode
  9564. Set the frame mapping mode. Some combination of:
  9565. @table @var
  9566. @item read
  9567. The mapped frame should be readable.
  9568. @item write
  9569. The mapped frame should be writeable.
  9570. @item overwrite
  9571. The mapping will always overwrite the entire frame.
  9572. This may improve performance in some cases, as the original contents of the
  9573. frame need not be loaded.
  9574. @item direct
  9575. The mapping must not involve any copying.
  9576. Indirect mappings to copies of frames are created in some cases where either
  9577. direct mapping is not possible or it would have unexpected properties.
  9578. Setting this flag ensures that the mapping is direct and will fail if that is
  9579. not possible.
  9580. @end table
  9581. Defaults to @var{read+write} if not specified.
  9582. @item derive_device @var{type}
  9583. Rather than using the device supplied at initialisation, instead derive a new
  9584. device of type @var{type} from the device the input frames exist on.
  9585. @item reverse
  9586. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9587. and map them back to the source. This may be necessary in some cases where
  9588. a mapping in one direction is required but only the opposite direction is
  9589. supported by the devices being used.
  9590. This option is dangerous - it may break the preceding filter in undefined
  9591. ways if there are any additional constraints on that filter's output.
  9592. Do not use it without fully understanding the implications of its use.
  9593. @end table
  9594. @anchor{hwupload}
  9595. @section hwupload
  9596. Upload system memory frames to hardware surfaces.
  9597. The device to upload to must be supplied when the filter is initialised. If
  9598. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9599. option or with the @option{derive_device} option. The input and output devices
  9600. must be of different types and compatible - the exact meaning of this is
  9601. system-dependent, but typically it means that they must refer to the same
  9602. underlying hardware context (for example, refer to the same graphics card).
  9603. The following additional parameters are accepted:
  9604. @table @option
  9605. @item derive_device @var{type}
  9606. Rather than using the device supplied at initialisation, instead derive a new
  9607. device of type @var{type} from the device the input frames exist on.
  9608. @end table
  9609. @anchor{hwupload_cuda}
  9610. @section hwupload_cuda
  9611. Upload system memory frames to a CUDA device.
  9612. It accepts the following optional parameters:
  9613. @table @option
  9614. @item device
  9615. The number of the CUDA device to use
  9616. @end table
  9617. @section hqx
  9618. Apply a high-quality magnification filter designed for pixel art. This filter
  9619. was originally created by Maxim Stepin.
  9620. It accepts the following option:
  9621. @table @option
  9622. @item n
  9623. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9624. @code{hq3x} and @code{4} for @code{hq4x}.
  9625. Default is @code{3}.
  9626. @end table
  9627. @section hstack
  9628. Stack input videos horizontally.
  9629. All streams must be of same pixel format and of same height.
  9630. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9631. to create same output.
  9632. The filter accepts the following option:
  9633. @table @option
  9634. @item inputs
  9635. Set number of input streams. Default is 2.
  9636. @item shortest
  9637. If set to 1, force the output to terminate when the shortest input
  9638. terminates. Default value is 0.
  9639. @end table
  9640. @section hue
  9641. Modify the hue and/or the saturation of the input.
  9642. It accepts the following parameters:
  9643. @table @option
  9644. @item h
  9645. Specify the hue angle as a number of degrees. It accepts an expression,
  9646. and defaults to "0".
  9647. @item s
  9648. Specify the saturation in the [-10,10] range. It accepts an expression and
  9649. defaults to "1".
  9650. @item H
  9651. Specify the hue angle as a number of radians. It accepts an
  9652. expression, and defaults to "0".
  9653. @item b
  9654. Specify the brightness in the [-10,10] range. It accepts an expression and
  9655. defaults to "0".
  9656. @end table
  9657. @option{h} and @option{H} are mutually exclusive, and can't be
  9658. specified at the same time.
  9659. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9660. expressions containing the following constants:
  9661. @table @option
  9662. @item n
  9663. frame count of the input frame starting from 0
  9664. @item pts
  9665. presentation timestamp of the input frame expressed in time base units
  9666. @item r
  9667. frame rate of the input video, NAN if the input frame rate is unknown
  9668. @item t
  9669. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9670. @item tb
  9671. time base of the input video
  9672. @end table
  9673. @subsection Examples
  9674. @itemize
  9675. @item
  9676. Set the hue to 90 degrees and the saturation to 1.0:
  9677. @example
  9678. hue=h=90:s=1
  9679. @end example
  9680. @item
  9681. Same command but expressing the hue in radians:
  9682. @example
  9683. hue=H=PI/2:s=1
  9684. @end example
  9685. @item
  9686. Rotate hue and make the saturation swing between 0
  9687. and 2 over a period of 1 second:
  9688. @example
  9689. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9690. @end example
  9691. @item
  9692. Apply a 3 seconds saturation fade-in effect starting at 0:
  9693. @example
  9694. hue="s=min(t/3\,1)"
  9695. @end example
  9696. The general fade-in expression can be written as:
  9697. @example
  9698. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9699. @end example
  9700. @item
  9701. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9702. @example
  9703. hue="s=max(0\, min(1\, (8-t)/3))"
  9704. @end example
  9705. The general fade-out expression can be written as:
  9706. @example
  9707. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9708. @end example
  9709. @end itemize
  9710. @subsection Commands
  9711. This filter supports the following commands:
  9712. @table @option
  9713. @item b
  9714. @item s
  9715. @item h
  9716. @item H
  9717. Modify the hue and/or the saturation and/or brightness of the input video.
  9718. The command accepts the same syntax of the corresponding option.
  9719. If the specified expression is not valid, it is kept at its current
  9720. value.
  9721. @end table
  9722. @section hysteresis
  9723. Grow first stream into second stream by connecting components.
  9724. This makes it possible to build more robust edge masks.
  9725. This filter accepts the following options:
  9726. @table @option
  9727. @item planes
  9728. Set which planes will be processed as bitmap, unprocessed planes will be
  9729. copied from first stream.
  9730. By default value 0xf, all planes will be processed.
  9731. @item threshold
  9732. Set threshold which is used in filtering. If pixel component value is higher than
  9733. this value filter algorithm for connecting components is activated.
  9734. By default value is 0.
  9735. @end table
  9736. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9737. @section idet
  9738. Detect video interlacing type.
  9739. This filter tries to detect if the input frames are interlaced, progressive,
  9740. top or bottom field first. It will also try to detect fields that are
  9741. repeated between adjacent frames (a sign of telecine).
  9742. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9743. Multiple frame detection incorporates the classification history of previous frames.
  9744. The filter will log these metadata values:
  9745. @table @option
  9746. @item single.current_frame
  9747. Detected type of current frame using single-frame detection. One of:
  9748. ``tff'' (top field first), ``bff'' (bottom field first),
  9749. ``progressive'', or ``undetermined''
  9750. @item single.tff
  9751. Cumulative number of frames detected as top field first using single-frame detection.
  9752. @item multiple.tff
  9753. Cumulative number of frames detected as top field first using multiple-frame detection.
  9754. @item single.bff
  9755. Cumulative number of frames detected as bottom field first using single-frame detection.
  9756. @item multiple.current_frame
  9757. Detected type of current frame using multiple-frame detection. One of:
  9758. ``tff'' (top field first), ``bff'' (bottom field first),
  9759. ``progressive'', or ``undetermined''
  9760. @item multiple.bff
  9761. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9762. @item single.progressive
  9763. Cumulative number of frames detected as progressive using single-frame detection.
  9764. @item multiple.progressive
  9765. Cumulative number of frames detected as progressive using multiple-frame detection.
  9766. @item single.undetermined
  9767. Cumulative number of frames that could not be classified using single-frame detection.
  9768. @item multiple.undetermined
  9769. Cumulative number of frames that could not be classified using multiple-frame detection.
  9770. @item repeated.current_frame
  9771. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9772. @item repeated.neither
  9773. Cumulative number of frames with no repeated field.
  9774. @item repeated.top
  9775. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9776. @item repeated.bottom
  9777. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9778. @end table
  9779. The filter accepts the following options:
  9780. @table @option
  9781. @item intl_thres
  9782. Set interlacing threshold.
  9783. @item prog_thres
  9784. Set progressive threshold.
  9785. @item rep_thres
  9786. Threshold for repeated field detection.
  9787. @item half_life
  9788. Number of frames after which a given frame's contribution to the
  9789. statistics is halved (i.e., it contributes only 0.5 to its
  9790. classification). The default of 0 means that all frames seen are given
  9791. full weight of 1.0 forever.
  9792. @item analyze_interlaced_flag
  9793. When this is not 0 then idet will use the specified number of frames to determine
  9794. if the interlaced flag is accurate, it will not count undetermined frames.
  9795. If the flag is found to be accurate it will be used without any further
  9796. computations, if it is found to be inaccurate it will be cleared without any
  9797. further computations. This allows inserting the idet filter as a low computational
  9798. method to clean up the interlaced flag
  9799. @end table
  9800. @section il
  9801. Deinterleave or interleave fields.
  9802. This filter allows one to process interlaced images fields without
  9803. deinterlacing them. Deinterleaving splits the input frame into 2
  9804. fields (so called half pictures). Odd lines are moved to the top
  9805. half of the output image, even lines to the bottom half.
  9806. You can process (filter) them independently and then re-interleave them.
  9807. The filter accepts the following options:
  9808. @table @option
  9809. @item luma_mode, l
  9810. @item chroma_mode, c
  9811. @item alpha_mode, a
  9812. Available values for @var{luma_mode}, @var{chroma_mode} and
  9813. @var{alpha_mode} are:
  9814. @table @samp
  9815. @item none
  9816. Do nothing.
  9817. @item deinterleave, d
  9818. Deinterleave fields, placing one above the other.
  9819. @item interleave, i
  9820. Interleave fields. Reverse the effect of deinterleaving.
  9821. @end table
  9822. Default value is @code{none}.
  9823. @item luma_swap, ls
  9824. @item chroma_swap, cs
  9825. @item alpha_swap, as
  9826. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9827. @end table
  9828. @subsection Commands
  9829. This filter supports the all above options as @ref{commands}.
  9830. @section inflate
  9831. Apply inflate effect to the video.
  9832. This filter replaces the pixel by the local(3x3) average by taking into account
  9833. only values higher than the pixel.
  9834. It accepts the following options:
  9835. @table @option
  9836. @item threshold0
  9837. @item threshold1
  9838. @item threshold2
  9839. @item threshold3
  9840. Limit the maximum change for each plane, default is 65535.
  9841. If 0, plane will remain unchanged.
  9842. @end table
  9843. @subsection Commands
  9844. This filter supports the all above options as @ref{commands}.
  9845. @section interlace
  9846. Simple interlacing filter from progressive contents. This interleaves upper (or
  9847. lower) lines from odd frames with lower (or upper) lines from even frames,
  9848. halving the frame rate and preserving image height.
  9849. @example
  9850. Original Original New Frame
  9851. Frame 'j' Frame 'j+1' (tff)
  9852. ========== =========== ==================
  9853. Line 0 --------------------> Frame 'j' Line 0
  9854. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9855. Line 2 ---------------------> Frame 'j' Line 2
  9856. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9857. ... ... ...
  9858. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9859. @end example
  9860. It accepts the following optional parameters:
  9861. @table @option
  9862. @item scan
  9863. This determines whether the interlaced frame is taken from the even
  9864. (tff - default) or odd (bff) lines of the progressive frame.
  9865. @item lowpass
  9866. Vertical lowpass filter to avoid twitter interlacing and
  9867. reduce moire patterns.
  9868. @table @samp
  9869. @item 0, off
  9870. Disable vertical lowpass filter
  9871. @item 1, linear
  9872. Enable linear filter (default)
  9873. @item 2, complex
  9874. Enable complex filter. This will slightly less reduce twitter and moire
  9875. but better retain detail and subjective sharpness impression.
  9876. @end table
  9877. @end table
  9878. @section kerndeint
  9879. Deinterlace input video by applying Donald Graft's adaptive kernel
  9880. deinterling. Work on interlaced parts of a video to produce
  9881. progressive frames.
  9882. The description of the accepted parameters follows.
  9883. @table @option
  9884. @item thresh
  9885. Set the threshold which affects the filter's tolerance when
  9886. determining if a pixel line must be processed. It must be an integer
  9887. in the range [0,255] and defaults to 10. A value of 0 will result in
  9888. applying the process on every pixels.
  9889. @item map
  9890. Paint pixels exceeding the threshold value to white if set to 1.
  9891. Default is 0.
  9892. @item order
  9893. Set the fields order. Swap fields if set to 1, leave fields alone if
  9894. 0. Default is 0.
  9895. @item sharp
  9896. Enable additional sharpening if set to 1. Default is 0.
  9897. @item twoway
  9898. Enable twoway sharpening if set to 1. Default is 0.
  9899. @end table
  9900. @subsection Examples
  9901. @itemize
  9902. @item
  9903. Apply default values:
  9904. @example
  9905. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9906. @end example
  9907. @item
  9908. Enable additional sharpening:
  9909. @example
  9910. kerndeint=sharp=1
  9911. @end example
  9912. @item
  9913. Paint processed pixels in white:
  9914. @example
  9915. kerndeint=map=1
  9916. @end example
  9917. @end itemize
  9918. @section lagfun
  9919. Slowly update darker pixels.
  9920. This filter makes short flashes of light appear longer.
  9921. This filter accepts the following options:
  9922. @table @option
  9923. @item decay
  9924. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9925. @item planes
  9926. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9927. @end table
  9928. @section lenscorrection
  9929. Correct radial lens distortion
  9930. This filter can be used to correct for radial distortion as can result from the use
  9931. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9932. one can use tools available for example as part of opencv or simply trial-and-error.
  9933. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9934. and extract the k1 and k2 coefficients from the resulting matrix.
  9935. Note that effectively the same filter is available in the open-source tools Krita and
  9936. Digikam from the KDE project.
  9937. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9938. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9939. brightness distribution, so you may want to use both filters together in certain
  9940. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9941. be applied before or after lens correction.
  9942. @subsection Options
  9943. The filter accepts the following options:
  9944. @table @option
  9945. @item cx
  9946. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9947. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9948. width. Default is 0.5.
  9949. @item cy
  9950. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9951. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9952. height. Default is 0.5.
  9953. @item k1
  9954. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9955. no correction. Default is 0.
  9956. @item k2
  9957. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9958. 0 means no correction. Default is 0.
  9959. @end table
  9960. The formula that generates the correction is:
  9961. @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)
  9962. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9963. distances from the focal point in the source and target images, respectively.
  9964. @section lensfun
  9965. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9966. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9967. to apply the lens correction. The filter will load the lensfun database and
  9968. query it to find the corresponding camera and lens entries in the database. As
  9969. long as these entries can be found with the given options, the filter can
  9970. perform corrections on frames. Note that incomplete strings will result in the
  9971. filter choosing the best match with the given options, and the filter will
  9972. output the chosen camera and lens models (logged with level "info"). You must
  9973. provide the make, camera model, and lens model as they are required.
  9974. The filter accepts the following options:
  9975. @table @option
  9976. @item make
  9977. The make of the camera (for example, "Canon"). This option is required.
  9978. @item model
  9979. The model of the camera (for example, "Canon EOS 100D"). This option is
  9980. required.
  9981. @item lens_model
  9982. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9983. option is required.
  9984. @item mode
  9985. The type of correction to apply. The following values are valid options:
  9986. @table @samp
  9987. @item vignetting
  9988. Enables fixing lens vignetting.
  9989. @item geometry
  9990. Enables fixing lens geometry. This is the default.
  9991. @item subpixel
  9992. Enables fixing chromatic aberrations.
  9993. @item vig_geo
  9994. Enables fixing lens vignetting and lens geometry.
  9995. @item vig_subpixel
  9996. Enables fixing lens vignetting and chromatic aberrations.
  9997. @item distortion
  9998. Enables fixing both lens geometry and chromatic aberrations.
  9999. @item all
  10000. Enables all possible corrections.
  10001. @end table
  10002. @item focal_length
  10003. The focal length of the image/video (zoom; expected constant for video). For
  10004. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10005. range should be chosen when using that lens. Default 18.
  10006. @item aperture
  10007. The aperture of the image/video (expected constant for video). Note that
  10008. aperture is only used for vignetting correction. Default 3.5.
  10009. @item focus_distance
  10010. The focus distance of the image/video (expected constant for video). Note that
  10011. focus distance is only used for vignetting and only slightly affects the
  10012. vignetting correction process. If unknown, leave it at the default value (which
  10013. is 1000).
  10014. @item scale
  10015. The scale factor which is applied after transformation. After correction the
  10016. video is no longer necessarily rectangular. This parameter controls how much of
  10017. the resulting image is visible. The value 0 means that a value will be chosen
  10018. automatically such that there is little or no unmapped area in the output
  10019. image. 1.0 means that no additional scaling is done. Lower values may result
  10020. in more of the corrected image being visible, while higher values may avoid
  10021. unmapped areas in the output.
  10022. @item target_geometry
  10023. The target geometry of the output image/video. The following values are valid
  10024. options:
  10025. @table @samp
  10026. @item rectilinear (default)
  10027. @item fisheye
  10028. @item panoramic
  10029. @item equirectangular
  10030. @item fisheye_orthographic
  10031. @item fisheye_stereographic
  10032. @item fisheye_equisolid
  10033. @item fisheye_thoby
  10034. @end table
  10035. @item reverse
  10036. Apply the reverse of image correction (instead of correcting distortion, apply
  10037. it).
  10038. @item interpolation
  10039. The type of interpolation used when correcting distortion. The following values
  10040. are valid options:
  10041. @table @samp
  10042. @item nearest
  10043. @item linear (default)
  10044. @item lanczos
  10045. @end table
  10046. @end table
  10047. @subsection Examples
  10048. @itemize
  10049. @item
  10050. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10051. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10052. aperture of "8.0".
  10053. @example
  10054. 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
  10055. @end example
  10056. @item
  10057. Apply the same as before, but only for the first 5 seconds of video.
  10058. @example
  10059. 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
  10060. @end example
  10061. @end itemize
  10062. @section libvmaf
  10063. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10064. score between two input videos.
  10065. The obtained VMAF score is printed through the logging system.
  10066. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10067. After installing the library it can be enabled using:
  10068. @code{./configure --enable-libvmaf}.
  10069. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10070. The filter has following options:
  10071. @table @option
  10072. @item model_path
  10073. Set the model path which is to be used for SVM.
  10074. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10075. @item log_path
  10076. Set the file path to be used to store logs.
  10077. @item log_fmt
  10078. Set the format of the log file (csv, json or xml).
  10079. @item enable_transform
  10080. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10081. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10082. Default value: @code{false}
  10083. @item phone_model
  10084. Invokes the phone model which will generate VMAF scores higher than in the
  10085. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10086. Default value: @code{false}
  10087. @item psnr
  10088. Enables computing psnr along with vmaf.
  10089. Default value: @code{false}
  10090. @item ssim
  10091. Enables computing ssim along with vmaf.
  10092. Default value: @code{false}
  10093. @item ms_ssim
  10094. Enables computing ms_ssim along with vmaf.
  10095. Default value: @code{false}
  10096. @item pool
  10097. Set the pool method to be used for computing vmaf.
  10098. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10099. @item n_threads
  10100. Set number of threads to be used when computing vmaf.
  10101. Default value: @code{0}, which makes use of all available logical processors.
  10102. @item n_subsample
  10103. Set interval for frame subsampling used when computing vmaf.
  10104. Default value: @code{1}
  10105. @item enable_conf_interval
  10106. Enables confidence interval.
  10107. Default value: @code{false}
  10108. @end table
  10109. This filter also supports the @ref{framesync} options.
  10110. @subsection Examples
  10111. @itemize
  10112. @item
  10113. On the below examples the input file @file{main.mpg} being processed is
  10114. compared with the reference file @file{ref.mpg}.
  10115. @example
  10116. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10117. @end example
  10118. @item
  10119. Example with options:
  10120. @example
  10121. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10122. @end example
  10123. @item
  10124. Example with options and different containers:
  10125. @example
  10126. 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 -
  10127. @end example
  10128. @end itemize
  10129. @section limiter
  10130. Limits the pixel components values to the specified range [min, max].
  10131. The filter accepts the following options:
  10132. @table @option
  10133. @item min
  10134. Lower bound. Defaults to the lowest allowed value for the input.
  10135. @item max
  10136. Upper bound. Defaults to the highest allowed value for the input.
  10137. @item planes
  10138. Specify which planes will be processed. Defaults to all available.
  10139. @end table
  10140. @section loop
  10141. Loop video frames.
  10142. The filter accepts the following options:
  10143. @table @option
  10144. @item loop
  10145. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10146. Default is 0.
  10147. @item size
  10148. Set maximal size in number of frames. Default is 0.
  10149. @item start
  10150. Set first frame of loop. Default is 0.
  10151. @end table
  10152. @subsection Examples
  10153. @itemize
  10154. @item
  10155. Loop single first frame infinitely:
  10156. @example
  10157. loop=loop=-1:size=1:start=0
  10158. @end example
  10159. @item
  10160. Loop single first frame 10 times:
  10161. @example
  10162. loop=loop=10:size=1:start=0
  10163. @end example
  10164. @item
  10165. Loop 10 first frames 5 times:
  10166. @example
  10167. loop=loop=5:size=10:start=0
  10168. @end example
  10169. @end itemize
  10170. @section lut1d
  10171. Apply a 1D LUT to an input video.
  10172. The filter accepts the following options:
  10173. @table @option
  10174. @item file
  10175. Set the 1D LUT file name.
  10176. Currently supported formats:
  10177. @table @samp
  10178. @item cube
  10179. Iridas
  10180. @item csp
  10181. cineSpace
  10182. @end table
  10183. @item interp
  10184. Select interpolation mode.
  10185. Available values are:
  10186. @table @samp
  10187. @item nearest
  10188. Use values from the nearest defined point.
  10189. @item linear
  10190. Interpolate values using the linear interpolation.
  10191. @item cosine
  10192. Interpolate values using the cosine interpolation.
  10193. @item cubic
  10194. Interpolate values using the cubic interpolation.
  10195. @item spline
  10196. Interpolate values using the spline interpolation.
  10197. @end table
  10198. @end table
  10199. @anchor{lut3d}
  10200. @section lut3d
  10201. Apply a 3D LUT to an input video.
  10202. The filter accepts the following options:
  10203. @table @option
  10204. @item file
  10205. Set the 3D LUT file name.
  10206. Currently supported formats:
  10207. @table @samp
  10208. @item 3dl
  10209. AfterEffects
  10210. @item cube
  10211. Iridas
  10212. @item dat
  10213. DaVinci
  10214. @item m3d
  10215. Pandora
  10216. @item csp
  10217. cineSpace
  10218. @end table
  10219. @item interp
  10220. Select interpolation mode.
  10221. Available values are:
  10222. @table @samp
  10223. @item nearest
  10224. Use values from the nearest defined point.
  10225. @item trilinear
  10226. Interpolate values using the 8 points defining a cube.
  10227. @item tetrahedral
  10228. Interpolate values using a tetrahedron.
  10229. @end table
  10230. @end table
  10231. @section lumakey
  10232. Turn certain luma values into transparency.
  10233. The filter accepts the following options:
  10234. @table @option
  10235. @item threshold
  10236. Set the luma which will be used as base for transparency.
  10237. Default value is @code{0}.
  10238. @item tolerance
  10239. Set the range of luma values to be keyed out.
  10240. Default value is @code{0.01}.
  10241. @item softness
  10242. Set the range of softness. Default value is @code{0}.
  10243. Use this to control gradual transition from zero to full transparency.
  10244. @end table
  10245. @subsection Commands
  10246. This filter supports same @ref{commands} as options.
  10247. The command accepts the same syntax of the corresponding option.
  10248. If the specified expression is not valid, it is kept at its current
  10249. value.
  10250. @section lut, lutrgb, lutyuv
  10251. Compute a look-up table for binding each pixel component input value
  10252. to an output value, and apply it to the input video.
  10253. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10254. to an RGB input video.
  10255. These filters accept the following parameters:
  10256. @table @option
  10257. @item c0
  10258. set first pixel component expression
  10259. @item c1
  10260. set second pixel component expression
  10261. @item c2
  10262. set third pixel component expression
  10263. @item c3
  10264. set fourth pixel component expression, corresponds to the alpha component
  10265. @item r
  10266. set red component expression
  10267. @item g
  10268. set green component expression
  10269. @item b
  10270. set blue component expression
  10271. @item a
  10272. alpha component expression
  10273. @item y
  10274. set Y/luminance component expression
  10275. @item u
  10276. set U/Cb component expression
  10277. @item v
  10278. set V/Cr component expression
  10279. @end table
  10280. Each of them specifies the expression to use for computing the lookup table for
  10281. the corresponding pixel component values.
  10282. The exact component associated to each of the @var{c*} options depends on the
  10283. format in input.
  10284. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10285. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10286. The expressions can contain the following constants and functions:
  10287. @table @option
  10288. @item w
  10289. @item h
  10290. The input width and height.
  10291. @item val
  10292. The input value for the pixel component.
  10293. @item clipval
  10294. The input value, clipped to the @var{minval}-@var{maxval} range.
  10295. @item maxval
  10296. The maximum value for the pixel component.
  10297. @item minval
  10298. The minimum value for the pixel component.
  10299. @item negval
  10300. The negated value for the pixel component value, clipped to the
  10301. @var{minval}-@var{maxval} range; it corresponds to the expression
  10302. "maxval-clipval+minval".
  10303. @item clip(val)
  10304. The computed value in @var{val}, clipped to the
  10305. @var{minval}-@var{maxval} range.
  10306. @item gammaval(gamma)
  10307. The computed gamma correction value of the pixel component value,
  10308. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10309. expression
  10310. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10311. @end table
  10312. All expressions default to "val".
  10313. @subsection Examples
  10314. @itemize
  10315. @item
  10316. Negate input video:
  10317. @example
  10318. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10319. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10320. @end example
  10321. The above is the same as:
  10322. @example
  10323. lutrgb="r=negval:g=negval:b=negval"
  10324. lutyuv="y=negval:u=negval:v=negval"
  10325. @end example
  10326. @item
  10327. Negate luminance:
  10328. @example
  10329. lutyuv=y=negval
  10330. @end example
  10331. @item
  10332. Remove chroma components, turning the video into a graytone image:
  10333. @example
  10334. lutyuv="u=128:v=128"
  10335. @end example
  10336. @item
  10337. Apply a luma burning effect:
  10338. @example
  10339. lutyuv="y=2*val"
  10340. @end example
  10341. @item
  10342. Remove green and blue components:
  10343. @example
  10344. lutrgb="g=0:b=0"
  10345. @end example
  10346. @item
  10347. Set a constant alpha channel value on input:
  10348. @example
  10349. format=rgba,lutrgb=a="maxval-minval/2"
  10350. @end example
  10351. @item
  10352. Correct luminance gamma by a factor of 0.5:
  10353. @example
  10354. lutyuv=y=gammaval(0.5)
  10355. @end example
  10356. @item
  10357. Discard least significant bits of luma:
  10358. @example
  10359. lutyuv=y='bitand(val, 128+64+32)'
  10360. @end example
  10361. @item
  10362. Technicolor like effect:
  10363. @example
  10364. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10365. @end example
  10366. @end itemize
  10367. @section lut2, tlut2
  10368. The @code{lut2} filter takes two input streams and outputs one
  10369. stream.
  10370. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10371. from one single stream.
  10372. This filter accepts the following parameters:
  10373. @table @option
  10374. @item c0
  10375. set first pixel component expression
  10376. @item c1
  10377. set second pixel component expression
  10378. @item c2
  10379. set third pixel component expression
  10380. @item c3
  10381. set fourth pixel component expression, corresponds to the alpha component
  10382. @item d
  10383. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10384. which means bit depth is automatically picked from first input format.
  10385. @end table
  10386. The @code{lut2} filter also supports the @ref{framesync} options.
  10387. Each of them specifies the expression to use for computing the lookup table for
  10388. the corresponding pixel component values.
  10389. The exact component associated to each of the @var{c*} options depends on the
  10390. format in inputs.
  10391. The expressions can contain the following constants:
  10392. @table @option
  10393. @item w
  10394. @item h
  10395. The input width and height.
  10396. @item x
  10397. The first input value for the pixel component.
  10398. @item y
  10399. The second input value for the pixel component.
  10400. @item bdx
  10401. The first input video bit depth.
  10402. @item bdy
  10403. The second input video bit depth.
  10404. @end table
  10405. All expressions default to "x".
  10406. @subsection Examples
  10407. @itemize
  10408. @item
  10409. Highlight differences between two RGB video streams:
  10410. @example
  10411. 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)'
  10412. @end example
  10413. @item
  10414. Highlight differences between two YUV video streams:
  10415. @example
  10416. 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)'
  10417. @end example
  10418. @item
  10419. Show max difference between two video streams:
  10420. @example
  10421. 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)))'
  10422. @end example
  10423. @end itemize
  10424. @section maskedclamp
  10425. Clamp the first input stream with the second input and third input stream.
  10426. Returns the value of first stream to be between second input
  10427. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10428. This filter accepts the following options:
  10429. @table @option
  10430. @item undershoot
  10431. Default value is @code{0}.
  10432. @item overshoot
  10433. Default value is @code{0}.
  10434. @item planes
  10435. Set which planes will be processed as bitmap, unprocessed planes will be
  10436. copied from first stream.
  10437. By default value 0xf, all planes will be processed.
  10438. @end table
  10439. @section maskedmax
  10440. Merge the second and third input stream into output stream using absolute differences
  10441. between second input stream and first input stream and absolute difference between
  10442. third input stream and first input stream. The picked value will be from second input
  10443. stream if second absolute difference is greater than first one or from third input stream
  10444. otherwise.
  10445. This filter accepts the following options:
  10446. @table @option
  10447. @item planes
  10448. Set which planes will be processed as bitmap, unprocessed planes will be
  10449. copied from first stream.
  10450. By default value 0xf, all planes will be processed.
  10451. @end table
  10452. @section maskedmerge
  10453. Merge the first input stream with the second input stream using per pixel
  10454. weights in the third input stream.
  10455. A value of 0 in the third stream pixel component means that pixel component
  10456. from first stream is returned unchanged, while maximum value (eg. 255 for
  10457. 8-bit videos) means that pixel component from second stream is returned
  10458. unchanged. Intermediate values define the amount of merging between both
  10459. input stream's pixel components.
  10460. This filter accepts the following options:
  10461. @table @option
  10462. @item planes
  10463. Set which planes will be processed as bitmap, unprocessed planes will be
  10464. copied from first stream.
  10465. By default value 0xf, all planes will be processed.
  10466. @end table
  10467. @section maskedmin
  10468. Merge the second and third input stream into output stream using absolute differences
  10469. between second input stream and first input stream and absolute difference between
  10470. third input stream and first input stream. The picked value will be from second input
  10471. stream if second absolute difference is less than first one or from third input stream
  10472. otherwise.
  10473. This filter accepts the following options:
  10474. @table @option
  10475. @item planes
  10476. Set which planes will be processed as bitmap, unprocessed planes will be
  10477. copied from first stream.
  10478. By default value 0xf, all planes will be processed.
  10479. @end table
  10480. @section maskedthreshold
  10481. Pick pixels comparing absolute difference of two video streams with fixed
  10482. threshold.
  10483. If absolute difference between pixel component of first and second video
  10484. stream is equal or lower than user supplied threshold than pixel component
  10485. from first video stream is picked, otherwise pixel component from second
  10486. video stream is picked.
  10487. This filter accepts the following options:
  10488. @table @option
  10489. @item threshold
  10490. Set threshold used when picking pixels from absolute difference from two input
  10491. video streams.
  10492. @item planes
  10493. Set which planes will be processed as bitmap, unprocessed planes will be
  10494. copied from second stream.
  10495. By default value 0xf, all planes will be processed.
  10496. @end table
  10497. @section maskfun
  10498. Create mask from input video.
  10499. For example it is useful to create motion masks after @code{tblend} filter.
  10500. This filter accepts the following options:
  10501. @table @option
  10502. @item low
  10503. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10504. @item high
  10505. Set high threshold. Any pixel component higher than this value will be set to max value
  10506. allowed for current pixel format.
  10507. @item planes
  10508. Set planes to filter, by default all available planes are filtered.
  10509. @item fill
  10510. Fill all frame pixels with this value.
  10511. @item sum
  10512. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10513. average, output frame will be completely filled with value set by @var{fill} option.
  10514. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10515. @end table
  10516. @section mcdeint
  10517. Apply motion-compensation deinterlacing.
  10518. It needs one field per frame as input and must thus be used together
  10519. with yadif=1/3 or equivalent.
  10520. This filter accepts the following options:
  10521. @table @option
  10522. @item mode
  10523. Set the deinterlacing mode.
  10524. It accepts one of the following values:
  10525. @table @samp
  10526. @item fast
  10527. @item medium
  10528. @item slow
  10529. use iterative motion estimation
  10530. @item extra_slow
  10531. like @samp{slow}, but use multiple reference frames.
  10532. @end table
  10533. Default value is @samp{fast}.
  10534. @item parity
  10535. Set the picture field parity assumed for the input video. It must be
  10536. one of the following values:
  10537. @table @samp
  10538. @item 0, tff
  10539. assume top field first
  10540. @item 1, bff
  10541. assume bottom field first
  10542. @end table
  10543. Default value is @samp{bff}.
  10544. @item qp
  10545. Set per-block quantization parameter (QP) used by the internal
  10546. encoder.
  10547. Higher values should result in a smoother motion vector field but less
  10548. optimal individual vectors. Default value is 1.
  10549. @end table
  10550. @section median
  10551. Pick median pixel from certain rectangle defined by radius.
  10552. This filter accepts the following options:
  10553. @table @option
  10554. @item radius
  10555. Set horizontal radius size. Default value is @code{1}.
  10556. Allowed range is integer from 1 to 127.
  10557. @item planes
  10558. Set which planes to process. Default is @code{15}, which is all available planes.
  10559. @item radiusV
  10560. Set vertical radius size. Default value is @code{0}.
  10561. Allowed range is integer from 0 to 127.
  10562. If it is 0, value will be picked from horizontal @code{radius} option.
  10563. @item percentile
  10564. Set median percentile. Default value is @code{0.5}.
  10565. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10566. minimum values, and @code{1} maximum values.
  10567. @end table
  10568. @subsection Commands
  10569. This filter supports same @ref{commands} as options.
  10570. The command accepts the same syntax of the corresponding option.
  10571. If the specified expression is not valid, it is kept at its current
  10572. value.
  10573. @section mergeplanes
  10574. Merge color channel components from several video streams.
  10575. The filter accepts up to 4 input streams, and merge selected input
  10576. planes to the output video.
  10577. This filter accepts the following options:
  10578. @table @option
  10579. @item mapping
  10580. Set input to output plane mapping. Default is @code{0}.
  10581. The mappings is specified as a bitmap. It should be specified as a
  10582. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10583. mapping for the first plane of the output stream. 'A' sets the number of
  10584. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10585. corresponding input to use (from 0 to 3). The rest of the mappings is
  10586. similar, 'Bb' describes the mapping for the output stream second
  10587. plane, 'Cc' describes the mapping for the output stream third plane and
  10588. 'Dd' describes the mapping for the output stream fourth plane.
  10589. @item format
  10590. Set output pixel format. Default is @code{yuva444p}.
  10591. @end table
  10592. @subsection Examples
  10593. @itemize
  10594. @item
  10595. Merge three gray video streams of same width and height into single video stream:
  10596. @example
  10597. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10598. @end example
  10599. @item
  10600. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10601. @example
  10602. [a0][a1]mergeplanes=0x00010210:yuva444p
  10603. @end example
  10604. @item
  10605. Swap Y and A plane in yuva444p stream:
  10606. @example
  10607. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10608. @end example
  10609. @item
  10610. Swap U and V plane in yuv420p stream:
  10611. @example
  10612. format=yuv420p,mergeplanes=0x000201:yuv420p
  10613. @end example
  10614. @item
  10615. Cast a rgb24 clip to yuv444p:
  10616. @example
  10617. format=rgb24,mergeplanes=0x000102:yuv444p
  10618. @end example
  10619. @end itemize
  10620. @section mestimate
  10621. Estimate and export motion vectors using block matching algorithms.
  10622. Motion vectors are stored in frame side data to be used by other filters.
  10623. This filter accepts the following options:
  10624. @table @option
  10625. @item method
  10626. Specify the motion estimation method. Accepts one of the following values:
  10627. @table @samp
  10628. @item esa
  10629. Exhaustive search algorithm.
  10630. @item tss
  10631. Three step search algorithm.
  10632. @item tdls
  10633. Two dimensional logarithmic search algorithm.
  10634. @item ntss
  10635. New three step search algorithm.
  10636. @item fss
  10637. Four step search algorithm.
  10638. @item ds
  10639. Diamond search algorithm.
  10640. @item hexbs
  10641. Hexagon-based search algorithm.
  10642. @item epzs
  10643. Enhanced predictive zonal search algorithm.
  10644. @item umh
  10645. Uneven multi-hexagon search algorithm.
  10646. @end table
  10647. Default value is @samp{esa}.
  10648. @item mb_size
  10649. Macroblock size. Default @code{16}.
  10650. @item search_param
  10651. Search parameter. Default @code{7}.
  10652. @end table
  10653. @section midequalizer
  10654. Apply Midway Image Equalization effect using two video streams.
  10655. Midway Image Equalization adjusts a pair of images to have the same
  10656. histogram, while maintaining their dynamics as much as possible. It's
  10657. useful for e.g. matching exposures from a pair of stereo cameras.
  10658. This filter has two inputs and one output, which must be of same pixel format, but
  10659. may be of different sizes. The output of filter is first input adjusted with
  10660. midway histogram of both inputs.
  10661. This filter accepts the following option:
  10662. @table @option
  10663. @item planes
  10664. Set which planes to process. Default is @code{15}, which is all available planes.
  10665. @end table
  10666. @section minterpolate
  10667. Convert the video to specified frame rate using motion interpolation.
  10668. This filter accepts the following options:
  10669. @table @option
  10670. @item fps
  10671. 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}.
  10672. @item mi_mode
  10673. Motion interpolation mode. Following values are accepted:
  10674. @table @samp
  10675. @item dup
  10676. Duplicate previous or next frame for interpolating new ones.
  10677. @item blend
  10678. Blend source frames. Interpolated frame is mean of previous and next frames.
  10679. @item mci
  10680. Motion compensated interpolation. Following options are effective when this mode is selected:
  10681. @table @samp
  10682. @item mc_mode
  10683. Motion compensation mode. Following values are accepted:
  10684. @table @samp
  10685. @item obmc
  10686. Overlapped block motion compensation.
  10687. @item aobmc
  10688. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10689. @end table
  10690. Default mode is @samp{obmc}.
  10691. @item me_mode
  10692. Motion estimation mode. Following values are accepted:
  10693. @table @samp
  10694. @item bidir
  10695. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10696. @item bilat
  10697. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10698. @end table
  10699. Default mode is @samp{bilat}.
  10700. @item me
  10701. The algorithm to be used for motion estimation. Following values are accepted:
  10702. @table @samp
  10703. @item esa
  10704. Exhaustive search algorithm.
  10705. @item tss
  10706. Three step search algorithm.
  10707. @item tdls
  10708. Two dimensional logarithmic search algorithm.
  10709. @item ntss
  10710. New three step search algorithm.
  10711. @item fss
  10712. Four step search algorithm.
  10713. @item ds
  10714. Diamond search algorithm.
  10715. @item hexbs
  10716. Hexagon-based search algorithm.
  10717. @item epzs
  10718. Enhanced predictive zonal search algorithm.
  10719. @item umh
  10720. Uneven multi-hexagon search algorithm.
  10721. @end table
  10722. Default algorithm is @samp{epzs}.
  10723. @item mb_size
  10724. Macroblock size. Default @code{16}.
  10725. @item search_param
  10726. Motion estimation search parameter. Default @code{32}.
  10727. @item vsbmc
  10728. 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).
  10729. @end table
  10730. @end table
  10731. @item scd
  10732. 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:
  10733. @table @samp
  10734. @item none
  10735. Disable scene change detection.
  10736. @item fdiff
  10737. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10738. @end table
  10739. Default method is @samp{fdiff}.
  10740. @item scd_threshold
  10741. Scene change detection threshold. Default is @code{10.}.
  10742. @end table
  10743. @section mix
  10744. Mix several video input streams into one video stream.
  10745. A description of the accepted options follows.
  10746. @table @option
  10747. @item nb_inputs
  10748. The number of inputs. If unspecified, it defaults to 2.
  10749. @item weights
  10750. Specify weight of each input video stream as sequence.
  10751. Each weight is separated by space. If number of weights
  10752. is smaller than number of @var{frames} last specified
  10753. weight will be used for all remaining unset weights.
  10754. @item scale
  10755. Specify scale, if it is set it will be multiplied with sum
  10756. of each weight multiplied with pixel values to give final destination
  10757. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10758. @item duration
  10759. Specify how end of stream is determined.
  10760. @table @samp
  10761. @item longest
  10762. The duration of the longest input. (default)
  10763. @item shortest
  10764. The duration of the shortest input.
  10765. @item first
  10766. The duration of the first input.
  10767. @end table
  10768. @end table
  10769. @section mpdecimate
  10770. Drop frames that do not differ greatly from the previous frame in
  10771. order to reduce frame rate.
  10772. The main use of this filter is for very-low-bitrate encoding
  10773. (e.g. streaming over dialup modem), but it could in theory be used for
  10774. fixing movies that were inverse-telecined incorrectly.
  10775. A description of the accepted options follows.
  10776. @table @option
  10777. @item max
  10778. Set the maximum number of consecutive frames which can be dropped (if
  10779. positive), or the minimum interval between dropped frames (if
  10780. negative). If the value is 0, the frame is dropped disregarding the
  10781. number of previous sequentially dropped frames.
  10782. Default value is 0.
  10783. @item hi
  10784. @item lo
  10785. @item frac
  10786. Set the dropping threshold values.
  10787. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10788. represent actual pixel value differences, so a threshold of 64
  10789. corresponds to 1 unit of difference for each pixel, or the same spread
  10790. out differently over the block.
  10791. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10792. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10793. meaning the whole image) differ by more than a threshold of @option{lo}.
  10794. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10795. 64*5, and default value for @option{frac} is 0.33.
  10796. @end table
  10797. @section negate
  10798. Negate (invert) the input video.
  10799. It accepts the following option:
  10800. @table @option
  10801. @item negate_alpha
  10802. With value 1, it negates the alpha component, if present. Default value is 0.
  10803. @end table
  10804. @anchor{nlmeans}
  10805. @section nlmeans
  10806. Denoise frames using Non-Local Means algorithm.
  10807. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10808. context similarity is defined by comparing their surrounding patches of size
  10809. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10810. around the pixel.
  10811. Note that the research area defines centers for patches, which means some
  10812. patches will be made of pixels outside that research area.
  10813. The filter accepts the following options.
  10814. @table @option
  10815. @item s
  10816. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10817. @item p
  10818. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10819. @item pc
  10820. Same as @option{p} but for chroma planes.
  10821. The default value is @var{0} and means automatic.
  10822. @item r
  10823. Set research size. Default is 15. Must be odd number in range [0, 99].
  10824. @item rc
  10825. Same as @option{r} but for chroma planes.
  10826. The default value is @var{0} and means automatic.
  10827. @end table
  10828. @section nnedi
  10829. Deinterlace video using neural network edge directed interpolation.
  10830. This filter accepts the following options:
  10831. @table @option
  10832. @item weights
  10833. Mandatory option, without binary file filter can not work.
  10834. Currently file can be found here:
  10835. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10836. @item deint
  10837. Set which frames to deinterlace, by default it is @code{all}.
  10838. Can be @code{all} or @code{interlaced}.
  10839. @item field
  10840. Set mode of operation.
  10841. Can be one of the following:
  10842. @table @samp
  10843. @item af
  10844. Use frame flags, both fields.
  10845. @item a
  10846. Use frame flags, single field.
  10847. @item t
  10848. Use top field only.
  10849. @item b
  10850. Use bottom field only.
  10851. @item tf
  10852. Use both fields, top first.
  10853. @item bf
  10854. Use both fields, bottom first.
  10855. @end table
  10856. @item planes
  10857. Set which planes to process, by default filter process all frames.
  10858. @item nsize
  10859. Set size of local neighborhood around each pixel, used by the predictor neural
  10860. network.
  10861. Can be one of the following:
  10862. @table @samp
  10863. @item s8x6
  10864. @item s16x6
  10865. @item s32x6
  10866. @item s48x6
  10867. @item s8x4
  10868. @item s16x4
  10869. @item s32x4
  10870. @end table
  10871. @item nns
  10872. Set the number of neurons in predictor neural network.
  10873. Can be one of the following:
  10874. @table @samp
  10875. @item n16
  10876. @item n32
  10877. @item n64
  10878. @item n128
  10879. @item n256
  10880. @end table
  10881. @item qual
  10882. Controls the number of different neural network predictions that are blended
  10883. together to compute the final output value. Can be @code{fast}, default or
  10884. @code{slow}.
  10885. @item etype
  10886. Set which set of weights to use in the predictor.
  10887. Can be one of the following:
  10888. @table @samp
  10889. @item a
  10890. weights trained to minimize absolute error
  10891. @item s
  10892. weights trained to minimize squared error
  10893. @end table
  10894. @item pscrn
  10895. Controls whether or not the prescreener neural network is used to decide
  10896. which pixels should be processed by the predictor neural network and which
  10897. can be handled by simple cubic interpolation.
  10898. The prescreener is trained to know whether cubic interpolation will be
  10899. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10900. The computational complexity of the prescreener nn is much less than that of
  10901. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10902. using the prescreener generally results in much faster processing.
  10903. The prescreener is pretty accurate, so the difference between using it and not
  10904. using it is almost always unnoticeable.
  10905. Can be one of the following:
  10906. @table @samp
  10907. @item none
  10908. @item original
  10909. @item new
  10910. @end table
  10911. Default is @code{new}.
  10912. @item fapprox
  10913. Set various debugging flags.
  10914. @end table
  10915. @section noformat
  10916. Force libavfilter not to use any of the specified pixel formats for the
  10917. input to the next filter.
  10918. It accepts the following parameters:
  10919. @table @option
  10920. @item pix_fmts
  10921. A '|'-separated list of pixel format names, such as
  10922. pix_fmts=yuv420p|monow|rgb24".
  10923. @end table
  10924. @subsection Examples
  10925. @itemize
  10926. @item
  10927. Force libavfilter to use a format different from @var{yuv420p} for the
  10928. input to the vflip filter:
  10929. @example
  10930. noformat=pix_fmts=yuv420p,vflip
  10931. @end example
  10932. @item
  10933. Convert the input video to any of the formats not contained in the list:
  10934. @example
  10935. noformat=yuv420p|yuv444p|yuv410p
  10936. @end example
  10937. @end itemize
  10938. @section noise
  10939. Add noise on video input frame.
  10940. The filter accepts the following options:
  10941. @table @option
  10942. @item all_seed
  10943. @item c0_seed
  10944. @item c1_seed
  10945. @item c2_seed
  10946. @item c3_seed
  10947. Set noise seed for specific pixel component or all pixel components in case
  10948. of @var{all_seed}. Default value is @code{123457}.
  10949. @item all_strength, alls
  10950. @item c0_strength, c0s
  10951. @item c1_strength, c1s
  10952. @item c2_strength, c2s
  10953. @item c3_strength, c3s
  10954. Set noise strength for specific pixel component or all pixel components in case
  10955. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10956. @item all_flags, allf
  10957. @item c0_flags, c0f
  10958. @item c1_flags, c1f
  10959. @item c2_flags, c2f
  10960. @item c3_flags, c3f
  10961. Set pixel component flags or set flags for all components if @var{all_flags}.
  10962. Available values for component flags are:
  10963. @table @samp
  10964. @item a
  10965. averaged temporal noise (smoother)
  10966. @item p
  10967. mix random noise with a (semi)regular pattern
  10968. @item t
  10969. temporal noise (noise pattern changes between frames)
  10970. @item u
  10971. uniform noise (gaussian otherwise)
  10972. @end table
  10973. @end table
  10974. @subsection Examples
  10975. Add temporal and uniform noise to input video:
  10976. @example
  10977. noise=alls=20:allf=t+u
  10978. @end example
  10979. @section normalize
  10980. Normalize RGB video (aka histogram stretching, contrast stretching).
  10981. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10982. For each channel of each frame, the filter computes the input range and maps
  10983. it linearly to the user-specified output range. The output range defaults
  10984. to the full dynamic range from pure black to pure white.
  10985. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10986. changes in brightness) caused when small dark or bright objects enter or leave
  10987. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10988. video camera, and, like a video camera, it may cause a period of over- or
  10989. under-exposure of the video.
  10990. The R,G,B channels can be normalized independently, which may cause some
  10991. color shifting, or linked together as a single channel, which prevents
  10992. color shifting. Linked normalization preserves hue. Independent normalization
  10993. does not, so it can be used to remove some color casts. Independent and linked
  10994. normalization can be combined in any ratio.
  10995. The normalize filter accepts the following options:
  10996. @table @option
  10997. @item blackpt
  10998. @item whitept
  10999. Colors which define the output range. The minimum input value is mapped to
  11000. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11001. The defaults are black and white respectively. Specifying white for
  11002. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11003. normalized video. Shades of grey can be used to reduce the dynamic range
  11004. (contrast). Specifying saturated colors here can create some interesting
  11005. effects.
  11006. @item smoothing
  11007. The number of previous frames to use for temporal smoothing. The input range
  11008. of each channel is smoothed using a rolling average over the current frame
  11009. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11010. smoothing).
  11011. @item independence
  11012. Controls the ratio of independent (color shifting) channel normalization to
  11013. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11014. independent. Defaults to 1.0 (fully independent).
  11015. @item strength
  11016. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11017. expensive no-op. Defaults to 1.0 (full strength).
  11018. @end table
  11019. @subsection Commands
  11020. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11021. The command accepts the same syntax of the corresponding option.
  11022. If the specified expression is not valid, it is kept at its current
  11023. value.
  11024. @subsection Examples
  11025. Stretch video contrast to use the full dynamic range, with no temporal
  11026. smoothing; may flicker depending on the source content:
  11027. @example
  11028. normalize=blackpt=black:whitept=white:smoothing=0
  11029. @end example
  11030. As above, but with 50 frames of temporal smoothing; flicker should be
  11031. reduced, depending on the source content:
  11032. @example
  11033. normalize=blackpt=black:whitept=white:smoothing=50
  11034. @end example
  11035. As above, but with hue-preserving linked channel normalization:
  11036. @example
  11037. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11038. @end example
  11039. As above, but with half strength:
  11040. @example
  11041. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11042. @end example
  11043. Map the darkest input color to red, the brightest input color to cyan:
  11044. @example
  11045. normalize=blackpt=red:whitept=cyan
  11046. @end example
  11047. @section null
  11048. Pass the video source unchanged to the output.
  11049. @section ocr
  11050. Optical Character Recognition
  11051. This filter uses Tesseract for optical character recognition. To enable
  11052. compilation of this filter, you need to configure FFmpeg with
  11053. @code{--enable-libtesseract}.
  11054. It accepts the following options:
  11055. @table @option
  11056. @item datapath
  11057. Set datapath to tesseract data. Default is to use whatever was
  11058. set at installation.
  11059. @item language
  11060. Set language, default is "eng".
  11061. @item whitelist
  11062. Set character whitelist.
  11063. @item blacklist
  11064. Set character blacklist.
  11065. @end table
  11066. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11067. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11068. @section ocv
  11069. Apply a video transform using libopencv.
  11070. To enable this filter, install the libopencv library and headers and
  11071. configure FFmpeg with @code{--enable-libopencv}.
  11072. It accepts the following parameters:
  11073. @table @option
  11074. @item filter_name
  11075. The name of the libopencv filter to apply.
  11076. @item filter_params
  11077. The parameters to pass to the libopencv filter. If not specified, the default
  11078. values are assumed.
  11079. @end table
  11080. Refer to the official libopencv documentation for more precise
  11081. information:
  11082. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11083. Several libopencv filters are supported; see the following subsections.
  11084. @anchor{dilate}
  11085. @subsection dilate
  11086. Dilate an image by using a specific structuring element.
  11087. It corresponds to the libopencv function @code{cvDilate}.
  11088. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11089. @var{struct_el} represents a structuring element, and has the syntax:
  11090. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11091. @var{cols} and @var{rows} represent the number of columns and rows of
  11092. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11093. point, and @var{shape} the shape for the structuring element. @var{shape}
  11094. must be "rect", "cross", "ellipse", or "custom".
  11095. If the value for @var{shape} is "custom", it must be followed by a
  11096. string of the form "=@var{filename}". The file with name
  11097. @var{filename} is assumed to represent a binary image, with each
  11098. printable character corresponding to a bright pixel. When a custom
  11099. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11100. or columns and rows of the read file are assumed instead.
  11101. The default value for @var{struct_el} is "3x3+0x0/rect".
  11102. @var{nb_iterations} specifies the number of times the transform is
  11103. applied to the image, and defaults to 1.
  11104. Some examples:
  11105. @example
  11106. # Use the default values
  11107. ocv=dilate
  11108. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11109. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11110. # Read the shape from the file diamond.shape, iterating two times.
  11111. # The file diamond.shape may contain a pattern of characters like this
  11112. # *
  11113. # ***
  11114. # *****
  11115. # ***
  11116. # *
  11117. # The specified columns and rows are ignored
  11118. # but the anchor point coordinates are not
  11119. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11120. @end example
  11121. @subsection erode
  11122. Erode an image by using a specific structuring element.
  11123. It corresponds to the libopencv function @code{cvErode}.
  11124. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11125. with the same syntax and semantics as the @ref{dilate} filter.
  11126. @subsection smooth
  11127. Smooth the input video.
  11128. The filter takes the following parameters:
  11129. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11130. @var{type} is the type of smooth filter to apply, and must be one of
  11131. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11132. or "bilateral". The default value is "gaussian".
  11133. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11134. depends on the smooth type. @var{param1} and
  11135. @var{param2} accept integer positive values or 0. @var{param3} and
  11136. @var{param4} accept floating point values.
  11137. The default value for @var{param1} is 3. The default value for the
  11138. other parameters is 0.
  11139. These parameters correspond to the parameters assigned to the
  11140. libopencv function @code{cvSmooth}.
  11141. @section oscilloscope
  11142. 2D Video Oscilloscope.
  11143. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11144. It accepts the following parameters:
  11145. @table @option
  11146. @item x
  11147. Set scope center x position.
  11148. @item y
  11149. Set scope center y position.
  11150. @item s
  11151. Set scope size, relative to frame diagonal.
  11152. @item t
  11153. Set scope tilt/rotation.
  11154. @item o
  11155. Set trace opacity.
  11156. @item tx
  11157. Set trace center x position.
  11158. @item ty
  11159. Set trace center y position.
  11160. @item tw
  11161. Set trace width, relative to width of frame.
  11162. @item th
  11163. Set trace height, relative to height of frame.
  11164. @item c
  11165. Set which components to trace. By default it traces first three components.
  11166. @item g
  11167. Draw trace grid. By default is enabled.
  11168. @item st
  11169. Draw some statistics. By default is enabled.
  11170. @item sc
  11171. Draw scope. By default is enabled.
  11172. @end table
  11173. @subsection Commands
  11174. This filter supports same @ref{commands} as options.
  11175. The command accepts the same syntax of the corresponding option.
  11176. If the specified expression is not valid, it is kept at its current
  11177. value.
  11178. @subsection Examples
  11179. @itemize
  11180. @item
  11181. Inspect full first row of video frame.
  11182. @example
  11183. oscilloscope=x=0.5:y=0:s=1
  11184. @end example
  11185. @item
  11186. Inspect full last row of video frame.
  11187. @example
  11188. oscilloscope=x=0.5:y=1:s=1
  11189. @end example
  11190. @item
  11191. Inspect full 5th line of video frame of height 1080.
  11192. @example
  11193. oscilloscope=x=0.5:y=5/1080:s=1
  11194. @end example
  11195. @item
  11196. Inspect full last column of video frame.
  11197. @example
  11198. oscilloscope=x=1:y=0.5:s=1:t=1
  11199. @end example
  11200. @end itemize
  11201. @anchor{overlay}
  11202. @section overlay
  11203. Overlay one video on top of another.
  11204. It takes two inputs and has one output. The first input is the "main"
  11205. video on which the second input is overlaid.
  11206. It accepts the following parameters:
  11207. A description of the accepted options follows.
  11208. @table @option
  11209. @item x
  11210. @item y
  11211. Set the expression for the x and y coordinates of the overlaid video
  11212. on the main video. Default value is "0" for both expressions. In case
  11213. the expression is invalid, it is set to a huge value (meaning that the
  11214. overlay will not be displayed within the output visible area).
  11215. @item eof_action
  11216. See @ref{framesync}.
  11217. @item eval
  11218. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11219. It accepts the following values:
  11220. @table @samp
  11221. @item init
  11222. only evaluate expressions once during the filter initialization or
  11223. when a command is processed
  11224. @item frame
  11225. evaluate expressions for each incoming frame
  11226. @end table
  11227. Default value is @samp{frame}.
  11228. @item shortest
  11229. See @ref{framesync}.
  11230. @item format
  11231. Set the format for the output video.
  11232. It accepts the following values:
  11233. @table @samp
  11234. @item yuv420
  11235. force YUV420 output
  11236. @item yuv420p10
  11237. force YUV420p10 output
  11238. @item yuv422
  11239. force YUV422 output
  11240. @item yuv422p10
  11241. force YUV422p10 output
  11242. @item yuv444
  11243. force YUV444 output
  11244. @item rgb
  11245. force packed RGB output
  11246. @item gbrp
  11247. force planar RGB output
  11248. @item auto
  11249. automatically pick format
  11250. @end table
  11251. Default value is @samp{yuv420}.
  11252. @item repeatlast
  11253. See @ref{framesync}.
  11254. @item alpha
  11255. Set format of alpha of the overlaid video, it can be @var{straight} or
  11256. @var{premultiplied}. Default is @var{straight}.
  11257. @end table
  11258. The @option{x}, and @option{y} expressions can contain the following
  11259. parameters.
  11260. @table @option
  11261. @item main_w, W
  11262. @item main_h, H
  11263. The main input width and height.
  11264. @item overlay_w, w
  11265. @item overlay_h, h
  11266. The overlay input width and height.
  11267. @item x
  11268. @item y
  11269. The computed values for @var{x} and @var{y}. They are evaluated for
  11270. each new frame.
  11271. @item hsub
  11272. @item vsub
  11273. horizontal and vertical chroma subsample values of the output
  11274. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11275. @var{vsub} is 1.
  11276. @item n
  11277. the number of input frame, starting from 0
  11278. @item pos
  11279. the position in the file of the input frame, NAN if unknown
  11280. @item t
  11281. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11282. @end table
  11283. This filter also supports the @ref{framesync} options.
  11284. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11285. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11286. when @option{eval} is set to @samp{init}.
  11287. Be aware that frames are taken from each input video in timestamp
  11288. order, hence, if their initial timestamps differ, it is a good idea
  11289. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11290. have them begin in the same zero timestamp, as the example for
  11291. the @var{movie} filter does.
  11292. You can chain together more overlays but you should test the
  11293. efficiency of such approach.
  11294. @subsection Commands
  11295. This filter supports the following commands:
  11296. @table @option
  11297. @item x
  11298. @item y
  11299. Modify the x and y of the overlay input.
  11300. The command accepts the same syntax of the corresponding option.
  11301. If the specified expression is not valid, it is kept at its current
  11302. value.
  11303. @end table
  11304. @subsection Examples
  11305. @itemize
  11306. @item
  11307. Draw the overlay at 10 pixels from the bottom right corner of the main
  11308. video:
  11309. @example
  11310. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11311. @end example
  11312. Using named options the example above becomes:
  11313. @example
  11314. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11315. @end example
  11316. @item
  11317. Insert a transparent PNG logo in the bottom left corner of the input,
  11318. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11319. @example
  11320. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11321. @end example
  11322. @item
  11323. Insert 2 different transparent PNG logos (second logo on bottom
  11324. right corner) using the @command{ffmpeg} tool:
  11325. @example
  11326. 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
  11327. @end example
  11328. @item
  11329. Add a transparent color layer on top of the main video; @code{WxH}
  11330. must specify the size of the main input to the overlay filter:
  11331. @example
  11332. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11333. @end example
  11334. @item
  11335. Play an original video and a filtered version (here with the deshake
  11336. filter) side by side using the @command{ffplay} tool:
  11337. @example
  11338. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11339. @end example
  11340. The above command is the same as:
  11341. @example
  11342. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11343. @end example
  11344. @item
  11345. Make a sliding overlay appearing from the left to the right top part of the
  11346. screen starting since time 2:
  11347. @example
  11348. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11349. @end example
  11350. @item
  11351. Compose output by putting two input videos side to side:
  11352. @example
  11353. ffmpeg -i left.avi -i right.avi -filter_complex "
  11354. nullsrc=size=200x100 [background];
  11355. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11356. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11357. [background][left] overlay=shortest=1 [background+left];
  11358. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11359. "
  11360. @end example
  11361. @item
  11362. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11363. @example
  11364. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11365. -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]'
  11366. masked.avi
  11367. @end example
  11368. @item
  11369. Chain several overlays in cascade:
  11370. @example
  11371. nullsrc=s=200x200 [bg];
  11372. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11373. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11374. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11375. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11376. [in3] null, [mid2] overlay=100:100 [out0]
  11377. @end example
  11378. @end itemize
  11379. @anchor{overlay_cuda}
  11380. @section overlay_cuda
  11381. Overlay one video on top of another.
  11382. This is the CUDA variant of the @ref{overlay} filter.
  11383. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11384. It takes two inputs and has one output. The first input is the "main"
  11385. video on which the second input is overlaid.
  11386. It accepts the following parameters:
  11387. @table @option
  11388. @item x
  11389. @item y
  11390. Set the x and y coordinates of the overlaid video on the main video.
  11391. Default value is "0" for both expressions.
  11392. @item eof_action
  11393. See @ref{framesync}.
  11394. @item shortest
  11395. See @ref{framesync}.
  11396. @item repeatlast
  11397. See @ref{framesync}.
  11398. @end table
  11399. This filter also supports the @ref{framesync} options.
  11400. @section owdenoise
  11401. Apply Overcomplete Wavelet denoiser.
  11402. The filter accepts the following options:
  11403. @table @option
  11404. @item depth
  11405. Set depth.
  11406. Larger depth values will denoise lower frequency components more, but
  11407. slow down filtering.
  11408. Must be an int in the range 8-16, default is @code{8}.
  11409. @item luma_strength, ls
  11410. Set luma strength.
  11411. Must be a double value in the range 0-1000, default is @code{1.0}.
  11412. @item chroma_strength, cs
  11413. Set chroma strength.
  11414. Must be a double value in the range 0-1000, default is @code{1.0}.
  11415. @end table
  11416. @anchor{pad}
  11417. @section pad
  11418. Add paddings to the input image, and place the original input at the
  11419. provided @var{x}, @var{y} coordinates.
  11420. It accepts the following parameters:
  11421. @table @option
  11422. @item width, w
  11423. @item height, h
  11424. Specify an expression for the size of the output image with the
  11425. paddings added. If the value for @var{width} or @var{height} is 0, the
  11426. corresponding input size is used for the output.
  11427. The @var{width} expression can reference the value set by the
  11428. @var{height} expression, and vice versa.
  11429. The default value of @var{width} and @var{height} is 0.
  11430. @item x
  11431. @item y
  11432. Specify the offsets to place the input image at within the padded area,
  11433. with respect to the top/left border of the output image.
  11434. The @var{x} expression can reference the value set by the @var{y}
  11435. expression, and vice versa.
  11436. The default value of @var{x} and @var{y} is 0.
  11437. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11438. so the input image is centered on the padded area.
  11439. @item color
  11440. Specify the color of the padded area. For the syntax of this option,
  11441. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11442. manual,ffmpeg-utils}.
  11443. The default value of @var{color} is "black".
  11444. @item eval
  11445. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11446. It accepts the following values:
  11447. @table @samp
  11448. @item init
  11449. Only evaluate expressions once during the filter initialization or when
  11450. a command is processed.
  11451. @item frame
  11452. Evaluate expressions for each incoming frame.
  11453. @end table
  11454. Default value is @samp{init}.
  11455. @item aspect
  11456. Pad to aspect instead to a resolution.
  11457. @end table
  11458. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11459. options are expressions containing the following constants:
  11460. @table @option
  11461. @item in_w
  11462. @item in_h
  11463. The input video width and height.
  11464. @item iw
  11465. @item ih
  11466. These are the same as @var{in_w} and @var{in_h}.
  11467. @item out_w
  11468. @item out_h
  11469. The output width and height (the size of the padded area), as
  11470. specified by the @var{width} and @var{height} expressions.
  11471. @item ow
  11472. @item oh
  11473. These are the same as @var{out_w} and @var{out_h}.
  11474. @item x
  11475. @item y
  11476. The x and y offsets as specified by the @var{x} and @var{y}
  11477. expressions, or NAN if not yet specified.
  11478. @item a
  11479. same as @var{iw} / @var{ih}
  11480. @item sar
  11481. input sample aspect ratio
  11482. @item dar
  11483. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11484. @item hsub
  11485. @item vsub
  11486. The horizontal and vertical chroma subsample values. For example for the
  11487. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11488. @end table
  11489. @subsection Examples
  11490. @itemize
  11491. @item
  11492. Add paddings with the color "violet" to the input video. The output video
  11493. size is 640x480, and the top-left corner of the input video is placed at
  11494. column 0, row 40
  11495. @example
  11496. pad=640:480:0:40:violet
  11497. @end example
  11498. The example above is equivalent to the following command:
  11499. @example
  11500. pad=width=640:height=480:x=0:y=40:color=violet
  11501. @end example
  11502. @item
  11503. Pad the input to get an output with dimensions increased by 3/2,
  11504. and put the input video at the center of the padded area:
  11505. @example
  11506. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11507. @end example
  11508. @item
  11509. Pad the input to get a squared output with size equal to the maximum
  11510. value between the input width and height, and put the input video at
  11511. the center of the padded area:
  11512. @example
  11513. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11514. @end example
  11515. @item
  11516. Pad the input to get a final w/h ratio of 16:9:
  11517. @example
  11518. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11519. @end example
  11520. @item
  11521. In case of anamorphic video, in order to set the output display aspect
  11522. correctly, it is necessary to use @var{sar} in the expression,
  11523. according to the relation:
  11524. @example
  11525. (ih * X / ih) * sar = output_dar
  11526. X = output_dar / sar
  11527. @end example
  11528. Thus the previous example needs to be modified to:
  11529. @example
  11530. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11531. @end example
  11532. @item
  11533. Double the output size and put the input video in the bottom-right
  11534. corner of the output padded area:
  11535. @example
  11536. pad="2*iw:2*ih:ow-iw:oh-ih"
  11537. @end example
  11538. @end itemize
  11539. @anchor{palettegen}
  11540. @section palettegen
  11541. Generate one palette for a whole video stream.
  11542. It accepts the following options:
  11543. @table @option
  11544. @item max_colors
  11545. Set the maximum number of colors to quantize in the palette.
  11546. Note: the palette will still contain 256 colors; the unused palette entries
  11547. will be black.
  11548. @item reserve_transparent
  11549. Create a palette of 255 colors maximum and reserve the last one for
  11550. transparency. Reserving the transparency color is useful for GIF optimization.
  11551. If not set, the maximum of colors in the palette will be 256. You probably want
  11552. to disable this option for a standalone image.
  11553. Set by default.
  11554. @item transparency_color
  11555. Set the color that will be used as background for transparency.
  11556. @item stats_mode
  11557. Set statistics mode.
  11558. It accepts the following values:
  11559. @table @samp
  11560. @item full
  11561. Compute full frame histograms.
  11562. @item diff
  11563. Compute histograms only for the part that differs from previous frame. This
  11564. might be relevant to give more importance to the moving part of your input if
  11565. the background is static.
  11566. @item single
  11567. Compute new histogram for each frame.
  11568. @end table
  11569. Default value is @var{full}.
  11570. @end table
  11571. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11572. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11573. color quantization of the palette. This information is also visible at
  11574. @var{info} logging level.
  11575. @subsection Examples
  11576. @itemize
  11577. @item
  11578. Generate a representative palette of a given video using @command{ffmpeg}:
  11579. @example
  11580. ffmpeg -i input.mkv -vf palettegen palette.png
  11581. @end example
  11582. @end itemize
  11583. @section paletteuse
  11584. Use a palette to downsample an input video stream.
  11585. The filter takes two inputs: one video stream and a palette. The palette must
  11586. be a 256 pixels image.
  11587. It accepts the following options:
  11588. @table @option
  11589. @item dither
  11590. Select dithering mode. Available algorithms are:
  11591. @table @samp
  11592. @item bayer
  11593. Ordered 8x8 bayer dithering (deterministic)
  11594. @item heckbert
  11595. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11596. Note: this dithering is sometimes considered "wrong" and is included as a
  11597. reference.
  11598. @item floyd_steinberg
  11599. Floyd and Steingberg dithering (error diffusion)
  11600. @item sierra2
  11601. Frankie Sierra dithering v2 (error diffusion)
  11602. @item sierra2_4a
  11603. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11604. @end table
  11605. Default is @var{sierra2_4a}.
  11606. @item bayer_scale
  11607. When @var{bayer} dithering is selected, this option defines the scale of the
  11608. pattern (how much the crosshatch pattern is visible). A low value means more
  11609. visible pattern for less banding, and higher value means less visible pattern
  11610. at the cost of more banding.
  11611. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11612. @item diff_mode
  11613. If set, define the zone to process
  11614. @table @samp
  11615. @item rectangle
  11616. Only the changing rectangle will be reprocessed. This is similar to GIF
  11617. cropping/offsetting compression mechanism. This option can be useful for speed
  11618. if only a part of the image is changing, and has use cases such as limiting the
  11619. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11620. moving scene (it leads to more deterministic output if the scene doesn't change
  11621. much, and as a result less moving noise and better GIF compression).
  11622. @end table
  11623. Default is @var{none}.
  11624. @item new
  11625. Take new palette for each output frame.
  11626. @item alpha_threshold
  11627. Sets the alpha threshold for transparency. Alpha values above this threshold
  11628. will be treated as completely opaque, and values below this threshold will be
  11629. treated as completely transparent.
  11630. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11631. @end table
  11632. @subsection Examples
  11633. @itemize
  11634. @item
  11635. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11636. using @command{ffmpeg}:
  11637. @example
  11638. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11639. @end example
  11640. @end itemize
  11641. @section perspective
  11642. Correct perspective of video not recorded perpendicular to the screen.
  11643. A description of the accepted parameters follows.
  11644. @table @option
  11645. @item x0
  11646. @item y0
  11647. @item x1
  11648. @item y1
  11649. @item x2
  11650. @item y2
  11651. @item x3
  11652. @item y3
  11653. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11654. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11655. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11656. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11657. then the corners of the source will be sent to the specified coordinates.
  11658. The expressions can use the following variables:
  11659. @table @option
  11660. @item W
  11661. @item H
  11662. the width and height of video frame.
  11663. @item in
  11664. Input frame count.
  11665. @item on
  11666. Output frame count.
  11667. @end table
  11668. @item interpolation
  11669. Set interpolation for perspective correction.
  11670. It accepts the following values:
  11671. @table @samp
  11672. @item linear
  11673. @item cubic
  11674. @end table
  11675. Default value is @samp{linear}.
  11676. @item sense
  11677. Set interpretation of coordinate options.
  11678. It accepts the following values:
  11679. @table @samp
  11680. @item 0, source
  11681. Send point in the source specified by the given coordinates to
  11682. the corners of the destination.
  11683. @item 1, destination
  11684. Send the corners of the source to the point in the destination specified
  11685. by the given coordinates.
  11686. Default value is @samp{source}.
  11687. @end table
  11688. @item eval
  11689. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11690. It accepts the following values:
  11691. @table @samp
  11692. @item init
  11693. only evaluate expressions once during the filter initialization or
  11694. when a command is processed
  11695. @item frame
  11696. evaluate expressions for each incoming frame
  11697. @end table
  11698. Default value is @samp{init}.
  11699. @end table
  11700. @section phase
  11701. Delay interlaced video by one field time so that the field order changes.
  11702. The intended use is to fix PAL movies that have been captured with the
  11703. opposite field order to the film-to-video transfer.
  11704. A description of the accepted parameters follows.
  11705. @table @option
  11706. @item mode
  11707. Set phase mode.
  11708. It accepts the following values:
  11709. @table @samp
  11710. @item t
  11711. Capture field order top-first, transfer bottom-first.
  11712. Filter will delay the bottom field.
  11713. @item b
  11714. Capture field order bottom-first, transfer top-first.
  11715. Filter will delay the top field.
  11716. @item p
  11717. Capture and transfer with the same field order. This mode only exists
  11718. for the documentation of the other options to refer to, but if you
  11719. actually select it, the filter will faithfully do nothing.
  11720. @item a
  11721. Capture field order determined automatically by field flags, transfer
  11722. opposite.
  11723. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11724. basis using field flags. If no field information is available,
  11725. then this works just like @samp{u}.
  11726. @item u
  11727. Capture unknown or varying, transfer opposite.
  11728. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11729. analyzing the images and selecting the alternative that produces best
  11730. match between the fields.
  11731. @item T
  11732. Capture top-first, transfer unknown or varying.
  11733. Filter selects among @samp{t} and @samp{p} using image analysis.
  11734. @item B
  11735. Capture bottom-first, transfer unknown or varying.
  11736. Filter selects among @samp{b} and @samp{p} using image analysis.
  11737. @item A
  11738. Capture determined by field flags, transfer unknown or varying.
  11739. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11740. image analysis. If no field information is available, then this works just
  11741. like @samp{U}. This is the default mode.
  11742. @item U
  11743. Both capture and transfer unknown or varying.
  11744. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11745. @end table
  11746. @end table
  11747. @section photosensitivity
  11748. Reduce various flashes in video, so to help users with epilepsy.
  11749. It accepts the following options:
  11750. @table @option
  11751. @item frames, f
  11752. Set how many frames to use when filtering. Default is 30.
  11753. @item threshold, t
  11754. Set detection threshold factor. Default is 1.
  11755. Lower is stricter.
  11756. @item skip
  11757. Set how many pixels to skip when sampling frames. Default is 1.
  11758. Allowed range is from 1 to 1024.
  11759. @item bypass
  11760. Leave frames unchanged. Default is disabled.
  11761. @end table
  11762. @section pixdesctest
  11763. Pixel format descriptor test filter, mainly useful for internal
  11764. testing. The output video should be equal to the input video.
  11765. For example:
  11766. @example
  11767. format=monow, pixdesctest
  11768. @end example
  11769. can be used to test the monowhite pixel format descriptor definition.
  11770. @section pixscope
  11771. Display sample values of color channels. Mainly useful for checking color
  11772. and levels. Minimum supported resolution is 640x480.
  11773. The filters accept the following options:
  11774. @table @option
  11775. @item x
  11776. Set scope X position, relative offset on X axis.
  11777. @item y
  11778. Set scope Y position, relative offset on Y axis.
  11779. @item w
  11780. Set scope width.
  11781. @item h
  11782. Set scope height.
  11783. @item o
  11784. Set window opacity. This window also holds statistics about pixel area.
  11785. @item wx
  11786. Set window X position, relative offset on X axis.
  11787. @item wy
  11788. Set window Y position, relative offset on Y axis.
  11789. @end table
  11790. @section pp
  11791. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11792. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11793. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11794. Each subfilter and some options have a short and a long name that can be used
  11795. interchangeably, i.e. dr/dering are the same.
  11796. The filters accept the following options:
  11797. @table @option
  11798. @item subfilters
  11799. Set postprocessing subfilters string.
  11800. @end table
  11801. All subfilters share common options to determine their scope:
  11802. @table @option
  11803. @item a/autoq
  11804. Honor the quality commands for this subfilter.
  11805. @item c/chrom
  11806. Do chrominance filtering, too (default).
  11807. @item y/nochrom
  11808. Do luminance filtering only (no chrominance).
  11809. @item n/noluma
  11810. Do chrominance filtering only (no luminance).
  11811. @end table
  11812. These options can be appended after the subfilter name, separated by a '|'.
  11813. Available subfilters are:
  11814. @table @option
  11815. @item hb/hdeblock[|difference[|flatness]]
  11816. Horizontal deblocking filter
  11817. @table @option
  11818. @item difference
  11819. Difference factor where higher values mean more deblocking (default: @code{32}).
  11820. @item flatness
  11821. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11822. @end table
  11823. @item vb/vdeblock[|difference[|flatness]]
  11824. Vertical deblocking filter
  11825. @table @option
  11826. @item difference
  11827. Difference factor where higher values mean more deblocking (default: @code{32}).
  11828. @item flatness
  11829. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11830. @end table
  11831. @item ha/hadeblock[|difference[|flatness]]
  11832. Accurate horizontal deblocking filter
  11833. @table @option
  11834. @item difference
  11835. Difference factor where higher values mean more deblocking (default: @code{32}).
  11836. @item flatness
  11837. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11838. @end table
  11839. @item va/vadeblock[|difference[|flatness]]
  11840. Accurate vertical deblocking filter
  11841. @table @option
  11842. @item difference
  11843. Difference factor where higher values mean more deblocking (default: @code{32}).
  11844. @item flatness
  11845. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11846. @end table
  11847. @end table
  11848. The horizontal and vertical deblocking filters share the difference and
  11849. flatness values so you cannot set different horizontal and vertical
  11850. thresholds.
  11851. @table @option
  11852. @item h1/x1hdeblock
  11853. Experimental horizontal deblocking filter
  11854. @item v1/x1vdeblock
  11855. Experimental vertical deblocking filter
  11856. @item dr/dering
  11857. Deringing filter
  11858. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11859. @table @option
  11860. @item threshold1
  11861. larger -> stronger filtering
  11862. @item threshold2
  11863. larger -> stronger filtering
  11864. @item threshold3
  11865. larger -> stronger filtering
  11866. @end table
  11867. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11868. @table @option
  11869. @item f/fullyrange
  11870. Stretch luminance to @code{0-255}.
  11871. @end table
  11872. @item lb/linblenddeint
  11873. Linear blend deinterlacing filter that deinterlaces the given block by
  11874. filtering all lines with a @code{(1 2 1)} filter.
  11875. @item li/linipoldeint
  11876. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11877. linearly interpolating every second line.
  11878. @item ci/cubicipoldeint
  11879. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11880. cubically interpolating every second line.
  11881. @item md/mediandeint
  11882. Median deinterlacing filter that deinterlaces the given block by applying a
  11883. median filter to every second line.
  11884. @item fd/ffmpegdeint
  11885. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11886. second line with a @code{(-1 4 2 4 -1)} filter.
  11887. @item l5/lowpass5
  11888. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11889. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11890. @item fq/forceQuant[|quantizer]
  11891. Overrides the quantizer table from the input with the constant quantizer you
  11892. specify.
  11893. @table @option
  11894. @item quantizer
  11895. Quantizer to use
  11896. @end table
  11897. @item de/default
  11898. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11899. @item fa/fast
  11900. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11901. @item ac
  11902. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11903. @end table
  11904. @subsection Examples
  11905. @itemize
  11906. @item
  11907. Apply horizontal and vertical deblocking, deringing and automatic
  11908. brightness/contrast:
  11909. @example
  11910. pp=hb/vb/dr/al
  11911. @end example
  11912. @item
  11913. Apply default filters without brightness/contrast correction:
  11914. @example
  11915. pp=de/-al
  11916. @end example
  11917. @item
  11918. Apply default filters and temporal denoiser:
  11919. @example
  11920. pp=default/tmpnoise|1|2|3
  11921. @end example
  11922. @item
  11923. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11924. automatically depending on available CPU time:
  11925. @example
  11926. pp=hb|y/vb|a
  11927. @end example
  11928. @end itemize
  11929. @section pp7
  11930. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11931. similar to spp = 6 with 7 point DCT, where only the center sample is
  11932. used after IDCT.
  11933. The filter accepts the following options:
  11934. @table @option
  11935. @item qp
  11936. Force a constant quantization parameter. It accepts an integer in range
  11937. 0 to 63. If not set, the filter will use the QP from the video stream
  11938. (if available).
  11939. @item mode
  11940. Set thresholding mode. Available modes are:
  11941. @table @samp
  11942. @item hard
  11943. Set hard thresholding.
  11944. @item soft
  11945. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11946. @item medium
  11947. Set medium thresholding (good results, default).
  11948. @end table
  11949. @end table
  11950. @section premultiply
  11951. Apply alpha premultiply effect to input video stream using first plane
  11952. of second stream as alpha.
  11953. Both streams must have same dimensions and same pixel format.
  11954. The filter accepts the following option:
  11955. @table @option
  11956. @item planes
  11957. Set which planes will be processed, unprocessed planes will be copied.
  11958. By default value 0xf, all planes will be processed.
  11959. @item inplace
  11960. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11961. @end table
  11962. @section prewitt
  11963. Apply prewitt operator to input video stream.
  11964. The filter accepts the following option:
  11965. @table @option
  11966. @item planes
  11967. Set which planes will be processed, unprocessed planes will be copied.
  11968. By default value 0xf, all planes will be processed.
  11969. @item scale
  11970. Set value which will be multiplied with filtered result.
  11971. @item delta
  11972. Set value which will be added to filtered result.
  11973. @end table
  11974. @section pseudocolor
  11975. Alter frame colors in video with pseudocolors.
  11976. This filter accepts the following options:
  11977. @table @option
  11978. @item c0
  11979. set pixel first component expression
  11980. @item c1
  11981. set pixel second component expression
  11982. @item c2
  11983. set pixel third component expression
  11984. @item c3
  11985. set pixel fourth component expression, corresponds to the alpha component
  11986. @item i
  11987. set component to use as base for altering colors
  11988. @end table
  11989. Each of them specifies the expression to use for computing the lookup table for
  11990. the corresponding pixel component values.
  11991. The expressions can contain the following constants and functions:
  11992. @table @option
  11993. @item w
  11994. @item h
  11995. The input width and height.
  11996. @item val
  11997. The input value for the pixel component.
  11998. @item ymin, umin, vmin, amin
  11999. The minimum allowed component value.
  12000. @item ymax, umax, vmax, amax
  12001. The maximum allowed component value.
  12002. @end table
  12003. All expressions default to "val".
  12004. @subsection Examples
  12005. @itemize
  12006. @item
  12007. Change too high luma values to gradient:
  12008. @example
  12009. 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'"
  12010. @end example
  12011. @end itemize
  12012. @section psnr
  12013. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12014. Ratio) between two input videos.
  12015. This filter takes in input two input videos, the first input is
  12016. considered the "main" source and is passed unchanged to the
  12017. output. The second input is used as a "reference" video for computing
  12018. the PSNR.
  12019. Both video inputs must have the same resolution and pixel format for
  12020. this filter to work correctly. Also it assumes that both inputs
  12021. have the same number of frames, which are compared one by one.
  12022. The obtained average PSNR is printed through the logging system.
  12023. The filter stores the accumulated MSE (mean squared error) of each
  12024. frame, and at the end of the processing it is averaged across all frames
  12025. equally, and the following formula is applied to obtain the PSNR:
  12026. @example
  12027. PSNR = 10*log10(MAX^2/MSE)
  12028. @end example
  12029. Where MAX is the average of the maximum values of each component of the
  12030. image.
  12031. The description of the accepted parameters follows.
  12032. @table @option
  12033. @item stats_file, f
  12034. If specified the filter will use the named file to save the PSNR of
  12035. each individual frame. When filename equals "-" the data is sent to
  12036. standard output.
  12037. @item stats_version
  12038. Specifies which version of the stats file format to use. Details of
  12039. each format are written below.
  12040. Default value is 1.
  12041. @item stats_add_max
  12042. Determines whether the max value is output to the stats log.
  12043. Default value is 0.
  12044. Requires stats_version >= 2. If this is set and stats_version < 2,
  12045. the filter will return an error.
  12046. @end table
  12047. This filter also supports the @ref{framesync} options.
  12048. The file printed if @var{stats_file} is selected, contains a sequence of
  12049. key/value pairs of the form @var{key}:@var{value} for each compared
  12050. couple of frames.
  12051. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12052. the list of per-frame-pair stats, with key value pairs following the frame
  12053. format with the following parameters:
  12054. @table @option
  12055. @item psnr_log_version
  12056. The version of the log file format. Will match @var{stats_version}.
  12057. @item fields
  12058. A comma separated list of the per-frame-pair parameters included in
  12059. the log.
  12060. @end table
  12061. A description of each shown per-frame-pair parameter follows:
  12062. @table @option
  12063. @item n
  12064. sequential number of the input frame, starting from 1
  12065. @item mse_avg
  12066. Mean Square Error pixel-by-pixel average difference of the compared
  12067. frames, averaged over all the image components.
  12068. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12069. Mean Square Error pixel-by-pixel average difference of the compared
  12070. frames for the component specified by the suffix.
  12071. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12072. Peak Signal to Noise ratio of the compared frames for the component
  12073. specified by the suffix.
  12074. @item max_avg, max_y, max_u, max_v
  12075. Maximum allowed value for each channel, and average over all
  12076. channels.
  12077. @end table
  12078. @subsection Examples
  12079. @itemize
  12080. @item
  12081. For example:
  12082. @example
  12083. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12084. [main][ref] psnr="stats_file=stats.log" [out]
  12085. @end example
  12086. On this example the input file being processed is compared with the
  12087. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12088. is stored in @file{stats.log}.
  12089. @item
  12090. Another example with different containers:
  12091. @example
  12092. 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 -
  12093. @end example
  12094. @end itemize
  12095. @anchor{pullup}
  12096. @section pullup
  12097. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12098. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12099. content.
  12100. The pullup filter is designed to take advantage of future context in making
  12101. its decisions. This filter is stateless in the sense that it does not lock
  12102. onto a pattern to follow, but it instead looks forward to the following
  12103. fields in order to identify matches and rebuild progressive frames.
  12104. To produce content with an even framerate, insert the fps filter after
  12105. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12106. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12107. The filter accepts the following options:
  12108. @table @option
  12109. @item jl
  12110. @item jr
  12111. @item jt
  12112. @item jb
  12113. These options set the amount of "junk" to ignore at the left, right, top, and
  12114. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12115. while top and bottom are in units of 2 lines.
  12116. The default is 8 pixels on each side.
  12117. @item sb
  12118. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12119. filter generating an occasional mismatched frame, but it may also cause an
  12120. excessive number of frames to be dropped during high motion sequences.
  12121. Conversely, setting it to -1 will make filter match fields more easily.
  12122. This may help processing of video where there is slight blurring between
  12123. the fields, but may also cause there to be interlaced frames in the output.
  12124. Default value is @code{0}.
  12125. @item mp
  12126. Set the metric plane to use. It accepts the following values:
  12127. @table @samp
  12128. @item l
  12129. Use luma plane.
  12130. @item u
  12131. Use chroma blue plane.
  12132. @item v
  12133. Use chroma red plane.
  12134. @end table
  12135. This option may be set to use chroma plane instead of the default luma plane
  12136. for doing filter's computations. This may improve accuracy on very clean
  12137. source material, but more likely will decrease accuracy, especially if there
  12138. is chroma noise (rainbow effect) or any grayscale video.
  12139. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12140. load and make pullup usable in realtime on slow machines.
  12141. @end table
  12142. For best results (without duplicated frames in the output file) it is
  12143. necessary to change the output frame rate. For example, to inverse
  12144. telecine NTSC input:
  12145. @example
  12146. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12147. @end example
  12148. @section qp
  12149. Change video quantization parameters (QP).
  12150. The filter accepts the following option:
  12151. @table @option
  12152. @item qp
  12153. Set expression for quantization parameter.
  12154. @end table
  12155. The expression is evaluated through the eval API and can contain, among others,
  12156. the following constants:
  12157. @table @var
  12158. @item known
  12159. 1 if index is not 129, 0 otherwise.
  12160. @item qp
  12161. Sequential index starting from -129 to 128.
  12162. @end table
  12163. @subsection Examples
  12164. @itemize
  12165. @item
  12166. Some equation like:
  12167. @example
  12168. qp=2+2*sin(PI*qp)
  12169. @end example
  12170. @end itemize
  12171. @section random
  12172. Flush video frames from internal cache of frames into a random order.
  12173. No frame is discarded.
  12174. Inspired by @ref{frei0r} nervous filter.
  12175. @table @option
  12176. @item frames
  12177. Set size in number of frames of internal cache, in range from @code{2} to
  12178. @code{512}. Default is @code{30}.
  12179. @item seed
  12180. Set seed for random number generator, must be an integer included between
  12181. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12182. less than @code{0}, the filter will try to use a good random seed on a
  12183. best effort basis.
  12184. @end table
  12185. @section readeia608
  12186. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12187. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12188. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12189. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12190. @table @option
  12191. @item lavfi.readeia608.X.cc
  12192. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12193. @item lavfi.readeia608.X.line
  12194. The number of the line on which the EIA-608 data was identified and read.
  12195. @end table
  12196. This filter accepts the following options:
  12197. @table @option
  12198. @item scan_min
  12199. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12200. @item scan_max
  12201. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12202. @item spw
  12203. Set the ratio of width reserved for sync code detection.
  12204. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12205. @item chp
  12206. Enable checking the parity bit. In the event of a parity error, the filter will output
  12207. @code{0x00} for that character. Default is false.
  12208. @item lp
  12209. Lowpass lines prior to further processing. Default is enabled.
  12210. @end table
  12211. @subsection Commands
  12212. This filter supports the all above options as @ref{commands}.
  12213. @subsection Examples
  12214. @itemize
  12215. @item
  12216. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12217. @example
  12218. 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
  12219. @end example
  12220. @end itemize
  12221. @section readvitc
  12222. Read vertical interval timecode (VITC) information from the top lines of a
  12223. video frame.
  12224. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12225. timecode value, if a valid timecode has been detected. Further metadata key
  12226. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12227. timecode data has been found or not.
  12228. This filter accepts the following options:
  12229. @table @option
  12230. @item scan_max
  12231. Set the maximum number of lines to scan for VITC data. If the value is set to
  12232. @code{-1} the full video frame is scanned. Default is @code{45}.
  12233. @item thr_b
  12234. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12235. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12236. @item thr_w
  12237. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12238. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12239. @end table
  12240. @subsection Examples
  12241. @itemize
  12242. @item
  12243. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12244. draw @code{--:--:--:--} as a placeholder:
  12245. @example
  12246. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12247. @end example
  12248. @end itemize
  12249. @section remap
  12250. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12251. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12252. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12253. value for pixel will be used for destination pixel.
  12254. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12255. will have Xmap/Ymap video stream dimensions.
  12256. Xmap and Ymap input video streams are 16bit depth, single channel.
  12257. @table @option
  12258. @item format
  12259. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12260. Default is @code{color}.
  12261. @item fill
  12262. Specify the color of the unmapped pixels. For the syntax of this option,
  12263. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12264. manual,ffmpeg-utils}. Default color is @code{black}.
  12265. @end table
  12266. @section removegrain
  12267. The removegrain filter is a spatial denoiser for progressive video.
  12268. @table @option
  12269. @item m0
  12270. Set mode for the first plane.
  12271. @item m1
  12272. Set mode for the second plane.
  12273. @item m2
  12274. Set mode for the third plane.
  12275. @item m3
  12276. Set mode for the fourth plane.
  12277. @end table
  12278. Range of mode is from 0 to 24. Description of each mode follows:
  12279. @table @var
  12280. @item 0
  12281. Leave input plane unchanged. Default.
  12282. @item 1
  12283. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12284. @item 2
  12285. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12286. @item 3
  12287. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12288. @item 4
  12289. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12290. This is equivalent to a median filter.
  12291. @item 5
  12292. Line-sensitive clipping giving the minimal change.
  12293. @item 6
  12294. Line-sensitive clipping, intermediate.
  12295. @item 7
  12296. Line-sensitive clipping, intermediate.
  12297. @item 8
  12298. Line-sensitive clipping, intermediate.
  12299. @item 9
  12300. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12301. @item 10
  12302. Replaces the target pixel with the closest neighbour.
  12303. @item 11
  12304. [1 2 1] horizontal and vertical kernel blur.
  12305. @item 12
  12306. Same as mode 11.
  12307. @item 13
  12308. Bob mode, interpolates top field from the line where the neighbours
  12309. pixels are the closest.
  12310. @item 14
  12311. Bob mode, interpolates bottom field from the line where the neighbours
  12312. pixels are the closest.
  12313. @item 15
  12314. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12315. interpolation formula.
  12316. @item 16
  12317. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12318. interpolation formula.
  12319. @item 17
  12320. Clips the pixel with the minimum and maximum of respectively the maximum and
  12321. minimum of each pair of opposite neighbour pixels.
  12322. @item 18
  12323. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12324. the current pixel is minimal.
  12325. @item 19
  12326. Replaces the pixel with the average of its 8 neighbours.
  12327. @item 20
  12328. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12329. @item 21
  12330. Clips pixels using the averages of opposite neighbour.
  12331. @item 22
  12332. Same as mode 21 but simpler and faster.
  12333. @item 23
  12334. Small edge and halo removal, but reputed useless.
  12335. @item 24
  12336. Similar as 23.
  12337. @end table
  12338. @section removelogo
  12339. Suppress a TV station logo, using an image file to determine which
  12340. pixels comprise the logo. It works by filling in the pixels that
  12341. comprise the logo with neighboring pixels.
  12342. The filter accepts the following options:
  12343. @table @option
  12344. @item filename, f
  12345. Set the filter bitmap file, which can be any image format supported by
  12346. libavformat. The width and height of the image file must match those of the
  12347. video stream being processed.
  12348. @end table
  12349. Pixels in the provided bitmap image with a value of zero are not
  12350. considered part of the logo, non-zero pixels are considered part of
  12351. the logo. If you use white (255) for the logo and black (0) for the
  12352. rest, you will be safe. For making the filter bitmap, it is
  12353. recommended to take a screen capture of a black frame with the logo
  12354. visible, and then using a threshold filter followed by the erode
  12355. filter once or twice.
  12356. If needed, little splotches can be fixed manually. Remember that if
  12357. logo pixels are not covered, the filter quality will be much
  12358. reduced. Marking too many pixels as part of the logo does not hurt as
  12359. much, but it will increase the amount of blurring needed to cover over
  12360. the image and will destroy more information than necessary, and extra
  12361. pixels will slow things down on a large logo.
  12362. @section repeatfields
  12363. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12364. fields based on its value.
  12365. @section reverse
  12366. Reverse a video clip.
  12367. Warning: This filter requires memory to buffer the entire clip, so trimming
  12368. is suggested.
  12369. @subsection Examples
  12370. @itemize
  12371. @item
  12372. Take the first 5 seconds of a clip, and reverse it.
  12373. @example
  12374. trim=end=5,reverse
  12375. @end example
  12376. @end itemize
  12377. @section rgbashift
  12378. Shift R/G/B/A pixels horizontally and/or vertically.
  12379. The filter accepts the following options:
  12380. @table @option
  12381. @item rh
  12382. Set amount to shift red horizontally.
  12383. @item rv
  12384. Set amount to shift red vertically.
  12385. @item gh
  12386. Set amount to shift green horizontally.
  12387. @item gv
  12388. Set amount to shift green vertically.
  12389. @item bh
  12390. Set amount to shift blue horizontally.
  12391. @item bv
  12392. Set amount to shift blue vertically.
  12393. @item ah
  12394. Set amount to shift alpha horizontally.
  12395. @item av
  12396. Set amount to shift alpha vertically.
  12397. @item edge
  12398. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12399. @end table
  12400. @subsection Commands
  12401. This filter supports the all above options as @ref{commands}.
  12402. @section roberts
  12403. Apply roberts cross operator to input video stream.
  12404. The filter accepts the following option:
  12405. @table @option
  12406. @item planes
  12407. Set which planes will be processed, unprocessed planes will be copied.
  12408. By default value 0xf, all planes will be processed.
  12409. @item scale
  12410. Set value which will be multiplied with filtered result.
  12411. @item delta
  12412. Set value which will be added to filtered result.
  12413. @end table
  12414. @section rotate
  12415. Rotate video by an arbitrary angle expressed in radians.
  12416. The filter accepts the following options:
  12417. A description of the optional parameters follows.
  12418. @table @option
  12419. @item angle, a
  12420. Set an expression for the angle by which to rotate the input video
  12421. clockwise, expressed as a number of radians. A negative value will
  12422. result in a counter-clockwise rotation. By default it is set to "0".
  12423. This expression is evaluated for each frame.
  12424. @item out_w, ow
  12425. Set the output width expression, default value is "iw".
  12426. This expression is evaluated just once during configuration.
  12427. @item out_h, oh
  12428. Set the output height expression, default value is "ih".
  12429. This expression is evaluated just once during configuration.
  12430. @item bilinear
  12431. Enable bilinear interpolation if set to 1, a value of 0 disables
  12432. it. Default value is 1.
  12433. @item fillcolor, c
  12434. Set the color used to fill the output area not covered by the rotated
  12435. image. For the general syntax of this option, check the
  12436. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12437. If the special value "none" is selected then no
  12438. background is printed (useful for example if the background is never shown).
  12439. Default value is "black".
  12440. @end table
  12441. The expressions for the angle and the output size can contain the
  12442. following constants and functions:
  12443. @table @option
  12444. @item n
  12445. sequential number of the input frame, starting from 0. It is always NAN
  12446. before the first frame is filtered.
  12447. @item t
  12448. time in seconds of the input frame, it is set to 0 when the filter is
  12449. configured. It is always NAN before the first frame is filtered.
  12450. @item hsub
  12451. @item vsub
  12452. horizontal and vertical chroma subsample values. For example for the
  12453. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12454. @item in_w, iw
  12455. @item in_h, ih
  12456. the input video width and height
  12457. @item out_w, ow
  12458. @item out_h, oh
  12459. the output width and height, that is the size of the padded area as
  12460. specified by the @var{width} and @var{height} expressions
  12461. @item rotw(a)
  12462. @item roth(a)
  12463. the minimal width/height required for completely containing the input
  12464. video rotated by @var{a} radians.
  12465. These are only available when computing the @option{out_w} and
  12466. @option{out_h} expressions.
  12467. @end table
  12468. @subsection Examples
  12469. @itemize
  12470. @item
  12471. Rotate the input by PI/6 radians clockwise:
  12472. @example
  12473. rotate=PI/6
  12474. @end example
  12475. @item
  12476. Rotate the input by PI/6 radians counter-clockwise:
  12477. @example
  12478. rotate=-PI/6
  12479. @end example
  12480. @item
  12481. Rotate the input by 45 degrees clockwise:
  12482. @example
  12483. rotate=45*PI/180
  12484. @end example
  12485. @item
  12486. Apply a constant rotation with period T, starting from an angle of PI/3:
  12487. @example
  12488. rotate=PI/3+2*PI*t/T
  12489. @end example
  12490. @item
  12491. Make the input video rotation oscillating with a period of T
  12492. seconds and an amplitude of A radians:
  12493. @example
  12494. rotate=A*sin(2*PI/T*t)
  12495. @end example
  12496. @item
  12497. Rotate the video, output size is chosen so that the whole rotating
  12498. input video is always completely contained in the output:
  12499. @example
  12500. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12501. @end example
  12502. @item
  12503. Rotate the video, reduce the output size so that no background is ever
  12504. shown:
  12505. @example
  12506. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12507. @end example
  12508. @end itemize
  12509. @subsection Commands
  12510. The filter supports the following commands:
  12511. @table @option
  12512. @item a, angle
  12513. Set the angle expression.
  12514. The command accepts the same syntax of the corresponding option.
  12515. If the specified expression is not valid, it is kept at its current
  12516. value.
  12517. @end table
  12518. @section sab
  12519. Apply Shape Adaptive Blur.
  12520. The filter accepts the following options:
  12521. @table @option
  12522. @item luma_radius, lr
  12523. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12524. value is 1.0. A greater value will result in a more blurred image, and
  12525. in slower processing.
  12526. @item luma_pre_filter_radius, lpfr
  12527. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12528. value is 1.0.
  12529. @item luma_strength, ls
  12530. Set luma maximum difference between pixels to still be considered, must
  12531. be a value in the 0.1-100.0 range, default value is 1.0.
  12532. @item chroma_radius, cr
  12533. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12534. greater value will result in a more blurred image, and in slower
  12535. processing.
  12536. @item chroma_pre_filter_radius, cpfr
  12537. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12538. @item chroma_strength, cs
  12539. Set chroma maximum difference between pixels to still be considered,
  12540. must be a value in the -0.9-100.0 range.
  12541. @end table
  12542. Each chroma option value, if not explicitly specified, is set to the
  12543. corresponding luma option value.
  12544. @anchor{scale}
  12545. @section scale
  12546. Scale (resize) the input video, using the libswscale library.
  12547. The scale filter forces the output display aspect ratio to be the same
  12548. of the input, by changing the output sample aspect ratio.
  12549. If the input image format is different from the format requested by
  12550. the next filter, the scale filter will convert the input to the
  12551. requested format.
  12552. @subsection Options
  12553. The filter accepts the following options, or any of the options
  12554. supported by the libswscale scaler.
  12555. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12556. the complete list of scaler options.
  12557. @table @option
  12558. @item width, w
  12559. @item height, h
  12560. Set the output video dimension expression. Default value is the input
  12561. dimension.
  12562. If the @var{width} or @var{w} value is 0, the input width is used for
  12563. the output. If the @var{height} or @var{h} value is 0, the input height
  12564. is used for the output.
  12565. If one and only one of the values is -n with n >= 1, the scale filter
  12566. will use a value that maintains the aspect ratio of the input image,
  12567. calculated from the other specified dimension. After that it will,
  12568. however, make sure that the calculated dimension is divisible by n and
  12569. adjust the value if necessary.
  12570. If both values are -n with n >= 1, the behavior will be identical to
  12571. both values being set to 0 as previously detailed.
  12572. See below for the list of accepted constants for use in the dimension
  12573. expression.
  12574. @item eval
  12575. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12576. @table @samp
  12577. @item init
  12578. Only evaluate expressions once during the filter initialization or when a command is processed.
  12579. @item frame
  12580. Evaluate expressions for each incoming frame.
  12581. @end table
  12582. Default value is @samp{init}.
  12583. @item interl
  12584. Set the interlacing mode. It accepts the following values:
  12585. @table @samp
  12586. @item 1
  12587. Force interlaced aware scaling.
  12588. @item 0
  12589. Do not apply interlaced scaling.
  12590. @item -1
  12591. Select interlaced aware scaling depending on whether the source frames
  12592. are flagged as interlaced or not.
  12593. @end table
  12594. Default value is @samp{0}.
  12595. @item flags
  12596. Set libswscale scaling flags. See
  12597. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12598. complete list of values. If not explicitly specified the filter applies
  12599. the default flags.
  12600. @item param0, param1
  12601. Set libswscale input parameters for scaling algorithms that need them. See
  12602. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12603. complete documentation. If not explicitly specified the filter applies
  12604. empty parameters.
  12605. @item size, s
  12606. Set the video size. For the syntax of this option, check the
  12607. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12608. @item in_color_matrix
  12609. @item out_color_matrix
  12610. Set in/output YCbCr color space type.
  12611. This allows the autodetected value to be overridden as well as allows forcing
  12612. a specific value used for the output and encoder.
  12613. If not specified, the color space type depends on the pixel format.
  12614. Possible values:
  12615. @table @samp
  12616. @item auto
  12617. Choose automatically.
  12618. @item bt709
  12619. Format conforming to International Telecommunication Union (ITU)
  12620. Recommendation BT.709.
  12621. @item fcc
  12622. Set color space conforming to the United States Federal Communications
  12623. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12624. @item bt601
  12625. @item bt470
  12626. @item smpte170m
  12627. Set color space conforming to:
  12628. @itemize
  12629. @item
  12630. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12631. @item
  12632. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12633. @item
  12634. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12635. @end itemize
  12636. @item smpte240m
  12637. Set color space conforming to SMPTE ST 240:1999.
  12638. @item bt2020
  12639. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12640. @end table
  12641. @item in_range
  12642. @item out_range
  12643. Set in/output YCbCr sample range.
  12644. This allows the autodetected value to be overridden as well as allows forcing
  12645. a specific value used for the output and encoder. If not specified, the
  12646. range depends on the pixel format. Possible values:
  12647. @table @samp
  12648. @item auto/unknown
  12649. Choose automatically.
  12650. @item jpeg/full/pc
  12651. Set full range (0-255 in case of 8-bit luma).
  12652. @item mpeg/limited/tv
  12653. Set "MPEG" range (16-235 in case of 8-bit luma).
  12654. @end table
  12655. @item force_original_aspect_ratio
  12656. Enable decreasing or increasing output video width or height if necessary to
  12657. keep the original aspect ratio. Possible values:
  12658. @table @samp
  12659. @item disable
  12660. Scale the video as specified and disable this feature.
  12661. @item decrease
  12662. The output video dimensions will automatically be decreased if needed.
  12663. @item increase
  12664. The output video dimensions will automatically be increased if needed.
  12665. @end table
  12666. One useful instance of this option is that when you know a specific device's
  12667. maximum allowed resolution, you can use this to limit the output video to
  12668. that, while retaining the aspect ratio. For example, device A allows
  12669. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12670. decrease) and specifying 1280x720 to the command line makes the output
  12671. 1280x533.
  12672. Please note that this is a different thing than specifying -1 for @option{w}
  12673. or @option{h}, you still need to specify the output resolution for this option
  12674. to work.
  12675. @item force_divisible_by
  12676. Ensures that both the output dimensions, width and height, are divisible by the
  12677. given integer when used together with @option{force_original_aspect_ratio}. This
  12678. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12679. This option respects the value set for @option{force_original_aspect_ratio},
  12680. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12681. may be slightly modified.
  12682. This option can be handy if you need to have a video fit within or exceed
  12683. a defined resolution using @option{force_original_aspect_ratio} but also have
  12684. encoder restrictions on width or height divisibility.
  12685. @end table
  12686. The values of the @option{w} and @option{h} options are expressions
  12687. containing the following constants:
  12688. @table @var
  12689. @item in_w
  12690. @item in_h
  12691. The input width and height
  12692. @item iw
  12693. @item ih
  12694. These are the same as @var{in_w} and @var{in_h}.
  12695. @item out_w
  12696. @item out_h
  12697. The output (scaled) width and height
  12698. @item ow
  12699. @item oh
  12700. These are the same as @var{out_w} and @var{out_h}
  12701. @item a
  12702. The same as @var{iw} / @var{ih}
  12703. @item sar
  12704. input sample aspect ratio
  12705. @item dar
  12706. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12707. @item hsub
  12708. @item vsub
  12709. horizontal and vertical input chroma subsample values. For example for the
  12710. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12711. @item ohsub
  12712. @item ovsub
  12713. horizontal and vertical output chroma subsample values. For example for the
  12714. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12715. @item n
  12716. The (sequential) number of the input frame, starting from 0.
  12717. Only available with @code{eval=frame}.
  12718. @item t
  12719. The presentation timestamp of the input frame, expressed as a number of
  12720. seconds. Only available with @code{eval=frame}.
  12721. @item pos
  12722. The position (byte offset) of the frame in the input stream, or NaN if
  12723. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12724. Only available with @code{eval=frame}.
  12725. @end table
  12726. @subsection Examples
  12727. @itemize
  12728. @item
  12729. Scale the input video to a size of 200x100
  12730. @example
  12731. scale=w=200:h=100
  12732. @end example
  12733. This is equivalent to:
  12734. @example
  12735. scale=200:100
  12736. @end example
  12737. or:
  12738. @example
  12739. scale=200x100
  12740. @end example
  12741. @item
  12742. Specify a size abbreviation for the output size:
  12743. @example
  12744. scale=qcif
  12745. @end example
  12746. which can also be written as:
  12747. @example
  12748. scale=size=qcif
  12749. @end example
  12750. @item
  12751. Scale the input to 2x:
  12752. @example
  12753. scale=w=2*iw:h=2*ih
  12754. @end example
  12755. @item
  12756. The above is the same as:
  12757. @example
  12758. scale=2*in_w:2*in_h
  12759. @end example
  12760. @item
  12761. Scale the input to 2x with forced interlaced scaling:
  12762. @example
  12763. scale=2*iw:2*ih:interl=1
  12764. @end example
  12765. @item
  12766. Scale the input to half size:
  12767. @example
  12768. scale=w=iw/2:h=ih/2
  12769. @end example
  12770. @item
  12771. Increase the width, and set the height to the same size:
  12772. @example
  12773. scale=3/2*iw:ow
  12774. @end example
  12775. @item
  12776. Seek Greek harmony:
  12777. @example
  12778. scale=iw:1/PHI*iw
  12779. scale=ih*PHI:ih
  12780. @end example
  12781. @item
  12782. Increase the height, and set the width to 3/2 of the height:
  12783. @example
  12784. scale=w=3/2*oh:h=3/5*ih
  12785. @end example
  12786. @item
  12787. Increase the size, making the size a multiple of the chroma
  12788. subsample values:
  12789. @example
  12790. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12791. @end example
  12792. @item
  12793. Increase the width to a maximum of 500 pixels,
  12794. keeping the same aspect ratio as the input:
  12795. @example
  12796. scale=w='min(500\, iw*3/2):h=-1'
  12797. @end example
  12798. @item
  12799. Make pixels square by combining scale and setsar:
  12800. @example
  12801. scale='trunc(ih*dar):ih',setsar=1/1
  12802. @end example
  12803. @item
  12804. Make pixels square by combining scale and setsar,
  12805. making sure the resulting resolution is even (required by some codecs):
  12806. @example
  12807. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12808. @end example
  12809. @end itemize
  12810. @subsection Commands
  12811. This filter supports the following commands:
  12812. @table @option
  12813. @item width, w
  12814. @item height, h
  12815. Set the output video dimension expression.
  12816. The command accepts the same syntax of the corresponding option.
  12817. If the specified expression is not valid, it is kept at its current
  12818. value.
  12819. @end table
  12820. @section scale_npp
  12821. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12822. format conversion on CUDA video frames. Setting the output width and height
  12823. works in the same way as for the @var{scale} filter.
  12824. The following additional options are accepted:
  12825. @table @option
  12826. @item format
  12827. The pixel format of the output CUDA frames. If set to the string "same" (the
  12828. default), the input format will be kept. Note that automatic format negotiation
  12829. and conversion is not yet supported for hardware frames
  12830. @item interp_algo
  12831. The interpolation algorithm used for resizing. One of the following:
  12832. @table @option
  12833. @item nn
  12834. Nearest neighbour.
  12835. @item linear
  12836. @item cubic
  12837. @item cubic2p_bspline
  12838. 2-parameter cubic (B=1, C=0)
  12839. @item cubic2p_catmullrom
  12840. 2-parameter cubic (B=0, C=1/2)
  12841. @item cubic2p_b05c03
  12842. 2-parameter cubic (B=1/2, C=3/10)
  12843. @item super
  12844. Supersampling
  12845. @item lanczos
  12846. @end table
  12847. @item force_original_aspect_ratio
  12848. Enable decreasing or increasing output video width or height if necessary to
  12849. keep the original aspect ratio. Possible values:
  12850. @table @samp
  12851. @item disable
  12852. Scale the video as specified and disable this feature.
  12853. @item decrease
  12854. The output video dimensions will automatically be decreased if needed.
  12855. @item increase
  12856. The output video dimensions will automatically be increased if needed.
  12857. @end table
  12858. One useful instance of this option is that when you know a specific device's
  12859. maximum allowed resolution, you can use this to limit the output video to
  12860. that, while retaining the aspect ratio. For example, device A allows
  12861. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12862. decrease) and specifying 1280x720 to the command line makes the output
  12863. 1280x533.
  12864. Please note that this is a different thing than specifying -1 for @option{w}
  12865. or @option{h}, you still need to specify the output resolution for this option
  12866. to work.
  12867. @item force_divisible_by
  12868. Ensures that both the output dimensions, width and height, are divisible by the
  12869. given integer when used together with @option{force_original_aspect_ratio}. This
  12870. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12871. This option respects the value set for @option{force_original_aspect_ratio},
  12872. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12873. may be slightly modified.
  12874. This option can be handy if you need to have a video fit within or exceed
  12875. a defined resolution using @option{force_original_aspect_ratio} but also have
  12876. encoder restrictions on width or height divisibility.
  12877. @end table
  12878. @section scale2ref
  12879. Scale (resize) the input video, based on a reference video.
  12880. See the scale filter for available options, scale2ref supports the same but
  12881. uses the reference video instead of the main input as basis. scale2ref also
  12882. supports the following additional constants for the @option{w} and
  12883. @option{h} options:
  12884. @table @var
  12885. @item main_w
  12886. @item main_h
  12887. The main input video's width and height
  12888. @item main_a
  12889. The same as @var{main_w} / @var{main_h}
  12890. @item main_sar
  12891. The main input video's sample aspect ratio
  12892. @item main_dar, mdar
  12893. The main input video's display aspect ratio. Calculated from
  12894. @code{(main_w / main_h) * main_sar}.
  12895. @item main_hsub
  12896. @item main_vsub
  12897. The main input video's horizontal and vertical chroma subsample values.
  12898. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12899. is 1.
  12900. @item main_n
  12901. The (sequential) number of the main input frame, starting from 0.
  12902. Only available with @code{eval=frame}.
  12903. @item main_t
  12904. The presentation timestamp of the main input frame, expressed as a number of
  12905. seconds. Only available with @code{eval=frame}.
  12906. @item main_pos
  12907. The position (byte offset) of the frame in the main input stream, or NaN if
  12908. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12909. Only available with @code{eval=frame}.
  12910. @end table
  12911. @subsection Examples
  12912. @itemize
  12913. @item
  12914. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12915. @example
  12916. 'scale2ref[b][a];[a][b]overlay'
  12917. @end example
  12918. @item
  12919. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12920. @example
  12921. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12922. @end example
  12923. @end itemize
  12924. @subsection Commands
  12925. This filter supports the following commands:
  12926. @table @option
  12927. @item width, w
  12928. @item height, h
  12929. Set the output video dimension expression.
  12930. The command accepts the same syntax of the corresponding option.
  12931. If the specified expression is not valid, it is kept at its current
  12932. value.
  12933. @end table
  12934. @section scroll
  12935. Scroll input video horizontally and/or vertically by constant speed.
  12936. The filter accepts the following options:
  12937. @table @option
  12938. @item horizontal, h
  12939. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12940. Negative values changes scrolling direction.
  12941. @item vertical, v
  12942. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12943. Negative values changes scrolling direction.
  12944. @item hpos
  12945. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12946. @item vpos
  12947. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12948. @end table
  12949. @subsection Commands
  12950. This filter supports the following @ref{commands}:
  12951. @table @option
  12952. @item horizontal, h
  12953. Set the horizontal scrolling speed.
  12954. @item vertical, v
  12955. Set the vertical scrolling speed.
  12956. @end table
  12957. @anchor{scdet}
  12958. @section scdet
  12959. Detect video scene change.
  12960. This filter sets frame metadata with mafd between frame, the scene score, and
  12961. forward the frame to the next filter, so they can use these metadata to detect
  12962. scene change or others.
  12963. In addition, this filter logs a message and sets frame metadata when it detects
  12964. a scene change by @option{threshold}.
  12965. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  12966. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  12967. to detect scene change.
  12968. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  12969. detect scene change with @option{threshold}.
  12970. The filter accepts the following options:
  12971. @table @option
  12972. @item threshold, t
  12973. Set the scene change detection threshold as a percentage of maximum change. Good
  12974. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  12975. @code{[0., 100.]}.
  12976. Default value is @code{10.}.
  12977. @item sc_pass, s
  12978. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  12979. You can enable it if you want to get snapshot of scene change frames only.
  12980. @end table
  12981. @anchor{selectivecolor}
  12982. @section selectivecolor
  12983. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12984. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12985. by the "purity" of the color (that is, how saturated it already is).
  12986. This filter is similar to the Adobe Photoshop Selective Color tool.
  12987. The filter accepts the following options:
  12988. @table @option
  12989. @item correction_method
  12990. Select color correction method.
  12991. Available values are:
  12992. @table @samp
  12993. @item absolute
  12994. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12995. component value).
  12996. @item relative
  12997. Specified adjustments are relative to the original component value.
  12998. @end table
  12999. Default is @code{absolute}.
  13000. @item reds
  13001. Adjustments for red pixels (pixels where the red component is the maximum)
  13002. @item yellows
  13003. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13004. @item greens
  13005. Adjustments for green pixels (pixels where the green component is the maximum)
  13006. @item cyans
  13007. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13008. @item blues
  13009. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13010. @item magentas
  13011. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13012. @item whites
  13013. Adjustments for white pixels (pixels where all components are greater than 128)
  13014. @item neutrals
  13015. Adjustments for all pixels except pure black and pure white
  13016. @item blacks
  13017. Adjustments for black pixels (pixels where all components are lesser than 128)
  13018. @item psfile
  13019. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13020. @end table
  13021. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13022. 4 space separated floating point adjustment values in the [-1,1] range,
  13023. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13024. pixels of its range.
  13025. @subsection Examples
  13026. @itemize
  13027. @item
  13028. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13029. increase magenta by 27% in blue areas:
  13030. @example
  13031. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13032. @end example
  13033. @item
  13034. Use a Photoshop selective color preset:
  13035. @example
  13036. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13037. @end example
  13038. @end itemize
  13039. @anchor{separatefields}
  13040. @section separatefields
  13041. The @code{separatefields} takes a frame-based video input and splits
  13042. each frame into its components fields, producing a new half height clip
  13043. with twice the frame rate and twice the frame count.
  13044. This filter use field-dominance information in frame to decide which
  13045. of each pair of fields to place first in the output.
  13046. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13047. @section setdar, setsar
  13048. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13049. output video.
  13050. This is done by changing the specified Sample (aka Pixel) Aspect
  13051. Ratio, according to the following equation:
  13052. @example
  13053. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13054. @end example
  13055. Keep in mind that the @code{setdar} filter does not modify the pixel
  13056. dimensions of the video frame. Also, the display aspect ratio set by
  13057. this filter may be changed by later filters in the filterchain,
  13058. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13059. applied.
  13060. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13061. the filter output video.
  13062. Note that as a consequence of the application of this filter, the
  13063. output display aspect ratio will change according to the equation
  13064. above.
  13065. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13066. filter may be changed by later filters in the filterchain, e.g. if
  13067. another "setsar" or a "setdar" filter is applied.
  13068. It accepts the following parameters:
  13069. @table @option
  13070. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13071. Set the aspect ratio used by the filter.
  13072. The parameter can be a floating point number string, an expression, or
  13073. a string of the form @var{num}:@var{den}, where @var{num} and
  13074. @var{den} are the numerator and denominator of the aspect ratio. If
  13075. the parameter is not specified, it is assumed the value "0".
  13076. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13077. should be escaped.
  13078. @item max
  13079. Set the maximum integer value to use for expressing numerator and
  13080. denominator when reducing the expressed aspect ratio to a rational.
  13081. Default value is @code{100}.
  13082. @end table
  13083. The parameter @var{sar} is an expression containing
  13084. the following constants:
  13085. @table @option
  13086. @item E, PI, PHI
  13087. These are approximated values for the mathematical constants e
  13088. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13089. @item w, h
  13090. The input width and height.
  13091. @item a
  13092. These are the same as @var{w} / @var{h}.
  13093. @item sar
  13094. The input sample aspect ratio.
  13095. @item dar
  13096. The input display aspect ratio. It is the same as
  13097. (@var{w} / @var{h}) * @var{sar}.
  13098. @item hsub, vsub
  13099. Horizontal and vertical chroma subsample values. For example, for the
  13100. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13101. @end table
  13102. @subsection Examples
  13103. @itemize
  13104. @item
  13105. To change the display aspect ratio to 16:9, specify one of the following:
  13106. @example
  13107. setdar=dar=1.77777
  13108. setdar=dar=16/9
  13109. @end example
  13110. @item
  13111. To change the sample aspect ratio to 10:11, specify:
  13112. @example
  13113. setsar=sar=10/11
  13114. @end example
  13115. @item
  13116. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13117. 1000 in the aspect ratio reduction, use the command:
  13118. @example
  13119. setdar=ratio=16/9:max=1000
  13120. @end example
  13121. @end itemize
  13122. @anchor{setfield}
  13123. @section setfield
  13124. Force field for the output video frame.
  13125. The @code{setfield} filter marks the interlace type field for the
  13126. output frames. It does not change the input frame, but only sets the
  13127. corresponding property, which affects how the frame is treated by
  13128. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13129. The filter accepts the following options:
  13130. @table @option
  13131. @item mode
  13132. Available values are:
  13133. @table @samp
  13134. @item auto
  13135. Keep the same field property.
  13136. @item bff
  13137. Mark the frame as bottom-field-first.
  13138. @item tff
  13139. Mark the frame as top-field-first.
  13140. @item prog
  13141. Mark the frame as progressive.
  13142. @end table
  13143. @end table
  13144. @anchor{setparams}
  13145. @section setparams
  13146. Force frame parameter for the output video frame.
  13147. The @code{setparams} filter marks interlace and color range for the
  13148. output frames. It does not change the input frame, but only sets the
  13149. corresponding property, which affects how the frame is treated by
  13150. filters/encoders.
  13151. @table @option
  13152. @item field_mode
  13153. Available values are:
  13154. @table @samp
  13155. @item auto
  13156. Keep the same field property (default).
  13157. @item bff
  13158. Mark the frame as bottom-field-first.
  13159. @item tff
  13160. Mark the frame as top-field-first.
  13161. @item prog
  13162. Mark the frame as progressive.
  13163. @end table
  13164. @item range
  13165. Available values are:
  13166. @table @samp
  13167. @item auto
  13168. Keep the same color range property (default).
  13169. @item unspecified, unknown
  13170. Mark the frame as unspecified color range.
  13171. @item limited, tv, mpeg
  13172. Mark the frame as limited range.
  13173. @item full, pc, jpeg
  13174. Mark the frame as full range.
  13175. @end table
  13176. @item color_primaries
  13177. Set the color primaries.
  13178. Available values are:
  13179. @table @samp
  13180. @item auto
  13181. Keep the same color primaries property (default).
  13182. @item bt709
  13183. @item unknown
  13184. @item bt470m
  13185. @item bt470bg
  13186. @item smpte170m
  13187. @item smpte240m
  13188. @item film
  13189. @item bt2020
  13190. @item smpte428
  13191. @item smpte431
  13192. @item smpte432
  13193. @item jedec-p22
  13194. @end table
  13195. @item color_trc
  13196. Set the color transfer.
  13197. Available values are:
  13198. @table @samp
  13199. @item auto
  13200. Keep the same color trc property (default).
  13201. @item bt709
  13202. @item unknown
  13203. @item bt470m
  13204. @item bt470bg
  13205. @item smpte170m
  13206. @item smpte240m
  13207. @item linear
  13208. @item log100
  13209. @item log316
  13210. @item iec61966-2-4
  13211. @item bt1361e
  13212. @item iec61966-2-1
  13213. @item bt2020-10
  13214. @item bt2020-12
  13215. @item smpte2084
  13216. @item smpte428
  13217. @item arib-std-b67
  13218. @end table
  13219. @item colorspace
  13220. Set the colorspace.
  13221. Available values are:
  13222. @table @samp
  13223. @item auto
  13224. Keep the same colorspace property (default).
  13225. @item gbr
  13226. @item bt709
  13227. @item unknown
  13228. @item fcc
  13229. @item bt470bg
  13230. @item smpte170m
  13231. @item smpte240m
  13232. @item ycgco
  13233. @item bt2020nc
  13234. @item bt2020c
  13235. @item smpte2085
  13236. @item chroma-derived-nc
  13237. @item chroma-derived-c
  13238. @item ictcp
  13239. @end table
  13240. @end table
  13241. @section showinfo
  13242. Show a line containing various information for each input video frame.
  13243. The input video is not modified.
  13244. This filter supports the following options:
  13245. @table @option
  13246. @item checksum
  13247. Calculate checksums of each plane. By default enabled.
  13248. @end table
  13249. The shown line contains a sequence of key/value pairs of the form
  13250. @var{key}:@var{value}.
  13251. The following values are shown in the output:
  13252. @table @option
  13253. @item n
  13254. The (sequential) number of the input frame, starting from 0.
  13255. @item pts
  13256. The Presentation TimeStamp of the input frame, expressed as a number of
  13257. time base units. The time base unit depends on the filter input pad.
  13258. @item pts_time
  13259. The Presentation TimeStamp of the input frame, expressed as a number of
  13260. seconds.
  13261. @item pos
  13262. The position of the frame in the input stream, or -1 if this information is
  13263. unavailable and/or meaningless (for example in case of synthetic video).
  13264. @item fmt
  13265. The pixel format name.
  13266. @item sar
  13267. The sample aspect ratio of the input frame, expressed in the form
  13268. @var{num}/@var{den}.
  13269. @item s
  13270. The size of the input frame. For the syntax of this option, check the
  13271. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13272. @item i
  13273. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13274. for bottom field first).
  13275. @item iskey
  13276. This is 1 if the frame is a key frame, 0 otherwise.
  13277. @item type
  13278. The picture type of the input frame ("I" for an I-frame, "P" for a
  13279. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13280. Also refer to the documentation of the @code{AVPictureType} enum and of
  13281. the @code{av_get_picture_type_char} function defined in
  13282. @file{libavutil/avutil.h}.
  13283. @item checksum
  13284. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13285. @item plane_checksum
  13286. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13287. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13288. @item mean
  13289. The mean value of pixels in each plane of the input frame, expressed in the form
  13290. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13291. @item stdev
  13292. The standard deviation of pixel values in each plane of the input frame, expressed
  13293. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13294. @end table
  13295. @section showpalette
  13296. Displays the 256 colors palette of each frame. This filter is only relevant for
  13297. @var{pal8} pixel format frames.
  13298. It accepts the following option:
  13299. @table @option
  13300. @item s
  13301. Set the size of the box used to represent one palette color entry. Default is
  13302. @code{30} (for a @code{30x30} pixel box).
  13303. @end table
  13304. @section shuffleframes
  13305. Reorder and/or duplicate and/or drop video frames.
  13306. It accepts the following parameters:
  13307. @table @option
  13308. @item mapping
  13309. Set the destination indexes of input frames.
  13310. This is space or '|' separated list of indexes that maps input frames to output
  13311. frames. Number of indexes also sets maximal value that each index may have.
  13312. '-1' index have special meaning and that is to drop frame.
  13313. @end table
  13314. The first frame has the index 0. The default is to keep the input unchanged.
  13315. @subsection Examples
  13316. @itemize
  13317. @item
  13318. Swap second and third frame of every three frames of the input:
  13319. @example
  13320. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13321. @end example
  13322. @item
  13323. Swap 10th and 1st frame of every ten frames of the input:
  13324. @example
  13325. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13326. @end example
  13327. @end itemize
  13328. @section shuffleplanes
  13329. Reorder and/or duplicate video planes.
  13330. It accepts the following parameters:
  13331. @table @option
  13332. @item map0
  13333. The index of the input plane to be used as the first output plane.
  13334. @item map1
  13335. The index of the input plane to be used as the second output plane.
  13336. @item map2
  13337. The index of the input plane to be used as the third output plane.
  13338. @item map3
  13339. The index of the input plane to be used as the fourth output plane.
  13340. @end table
  13341. The first plane has the index 0. The default is to keep the input unchanged.
  13342. @subsection Examples
  13343. @itemize
  13344. @item
  13345. Swap the second and third planes of the input:
  13346. @example
  13347. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13348. @end example
  13349. @end itemize
  13350. @anchor{signalstats}
  13351. @section signalstats
  13352. Evaluate various visual metrics that assist in determining issues associated
  13353. with the digitization of analog video media.
  13354. By default the filter will log these metadata values:
  13355. @table @option
  13356. @item YMIN
  13357. Display the minimal Y value contained within the input frame. Expressed in
  13358. range of [0-255].
  13359. @item YLOW
  13360. Display the Y value at the 10% percentile within the input frame. Expressed in
  13361. range of [0-255].
  13362. @item YAVG
  13363. Display the average Y value within the input frame. Expressed in range of
  13364. [0-255].
  13365. @item YHIGH
  13366. Display the Y value at the 90% percentile within the input frame. Expressed in
  13367. range of [0-255].
  13368. @item YMAX
  13369. Display the maximum Y value contained within the input frame. Expressed in
  13370. range of [0-255].
  13371. @item UMIN
  13372. Display the minimal U value contained within the input frame. Expressed in
  13373. range of [0-255].
  13374. @item ULOW
  13375. Display the U value at the 10% percentile within the input frame. Expressed in
  13376. range of [0-255].
  13377. @item UAVG
  13378. Display the average U value within the input frame. Expressed in range of
  13379. [0-255].
  13380. @item UHIGH
  13381. Display the U value at the 90% percentile within the input frame. Expressed in
  13382. range of [0-255].
  13383. @item UMAX
  13384. Display the maximum U value contained within the input frame. Expressed in
  13385. range of [0-255].
  13386. @item VMIN
  13387. Display the minimal V value contained within the input frame. Expressed in
  13388. range of [0-255].
  13389. @item VLOW
  13390. Display the V value at the 10% percentile within the input frame. Expressed in
  13391. range of [0-255].
  13392. @item VAVG
  13393. Display the average V value within the input frame. Expressed in range of
  13394. [0-255].
  13395. @item VHIGH
  13396. Display the V value at the 90% percentile within the input frame. Expressed in
  13397. range of [0-255].
  13398. @item VMAX
  13399. Display the maximum V value contained within the input frame. Expressed in
  13400. range of [0-255].
  13401. @item SATMIN
  13402. Display the minimal saturation value contained within the input frame.
  13403. Expressed in range of [0-~181.02].
  13404. @item SATLOW
  13405. Display the saturation value at the 10% percentile within the input frame.
  13406. Expressed in range of [0-~181.02].
  13407. @item SATAVG
  13408. Display the average saturation value within the input frame. Expressed in range
  13409. of [0-~181.02].
  13410. @item SATHIGH
  13411. Display the saturation value at the 90% percentile within the input frame.
  13412. Expressed in range of [0-~181.02].
  13413. @item SATMAX
  13414. Display the maximum saturation value contained within the input frame.
  13415. Expressed in range of [0-~181.02].
  13416. @item HUEMED
  13417. Display the median value for hue within the input frame. Expressed in range of
  13418. [0-360].
  13419. @item HUEAVG
  13420. Display the average value for hue within the input frame. Expressed in range of
  13421. [0-360].
  13422. @item YDIF
  13423. Display the average of sample value difference between all values of the Y
  13424. plane in the current frame and corresponding values of the previous input frame.
  13425. Expressed in range of [0-255].
  13426. @item UDIF
  13427. Display the average of sample value difference between all values of the U
  13428. plane in the current frame and corresponding values of the previous input frame.
  13429. Expressed in range of [0-255].
  13430. @item VDIF
  13431. Display the average of sample value difference between all values of the V
  13432. plane in the current frame and corresponding values of the previous input frame.
  13433. Expressed in range of [0-255].
  13434. @item YBITDEPTH
  13435. Display bit depth of Y plane in current frame.
  13436. Expressed in range of [0-16].
  13437. @item UBITDEPTH
  13438. Display bit depth of U plane in current frame.
  13439. Expressed in range of [0-16].
  13440. @item VBITDEPTH
  13441. Display bit depth of V plane in current frame.
  13442. Expressed in range of [0-16].
  13443. @end table
  13444. The filter accepts the following options:
  13445. @table @option
  13446. @item stat
  13447. @item out
  13448. @option{stat} specify an additional form of image analysis.
  13449. @option{out} output video with the specified type of pixel highlighted.
  13450. Both options accept the following values:
  13451. @table @samp
  13452. @item tout
  13453. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13454. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13455. include the results of video dropouts, head clogs, or tape tracking issues.
  13456. @item vrep
  13457. Identify @var{vertical line repetition}. Vertical line repetition includes
  13458. similar rows of pixels within a frame. In born-digital video vertical line
  13459. repetition is common, but this pattern is uncommon in video digitized from an
  13460. analog source. When it occurs in video that results from the digitization of an
  13461. analog source it can indicate concealment from a dropout compensator.
  13462. @item brng
  13463. Identify pixels that fall outside of legal broadcast range.
  13464. @end table
  13465. @item color, c
  13466. Set the highlight color for the @option{out} option. The default color is
  13467. yellow.
  13468. @end table
  13469. @subsection Examples
  13470. @itemize
  13471. @item
  13472. Output data of various video metrics:
  13473. @example
  13474. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13475. @end example
  13476. @item
  13477. Output specific data about the minimum and maximum values of the Y plane per frame:
  13478. @example
  13479. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13480. @end example
  13481. @item
  13482. Playback video while highlighting pixels that are outside of broadcast range in red.
  13483. @example
  13484. ffplay example.mov -vf signalstats="out=brng:color=red"
  13485. @end example
  13486. @item
  13487. Playback video with signalstats metadata drawn over the frame.
  13488. @example
  13489. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13490. @end example
  13491. The contents of signalstat_drawtext.txt used in the command are:
  13492. @example
  13493. time %@{pts:hms@}
  13494. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13495. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13496. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13497. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13498. @end example
  13499. @end itemize
  13500. @anchor{signature}
  13501. @section signature
  13502. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13503. input. In this case the matching between the inputs can be calculated additionally.
  13504. The filter always passes through the first input. The signature of each stream can
  13505. be written into a file.
  13506. It accepts the following options:
  13507. @table @option
  13508. @item detectmode
  13509. Enable or disable the matching process.
  13510. Available values are:
  13511. @table @samp
  13512. @item off
  13513. Disable the calculation of a matching (default).
  13514. @item full
  13515. Calculate the matching for the whole video and output whether the whole video
  13516. matches or only parts.
  13517. @item fast
  13518. Calculate only until a matching is found or the video ends. Should be faster in
  13519. some cases.
  13520. @end table
  13521. @item nb_inputs
  13522. Set the number of inputs. The option value must be a non negative integer.
  13523. Default value is 1.
  13524. @item filename
  13525. Set the path to which the output is written. If there is more than one input,
  13526. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13527. integer), that will be replaced with the input number. If no filename is
  13528. specified, no output will be written. This is the default.
  13529. @item format
  13530. Choose the output format.
  13531. Available values are:
  13532. @table @samp
  13533. @item binary
  13534. Use the specified binary representation (default).
  13535. @item xml
  13536. Use the specified xml representation.
  13537. @end table
  13538. @item th_d
  13539. Set threshold to detect one word as similar. The option value must be an integer
  13540. greater than zero. The default value is 9000.
  13541. @item th_dc
  13542. Set threshold to detect all words as similar. The option value must be an integer
  13543. greater than zero. The default value is 60000.
  13544. @item th_xh
  13545. Set threshold to detect frames as similar. The option value must be an integer
  13546. greater than zero. The default value is 116.
  13547. @item th_di
  13548. Set the minimum length of a sequence in frames to recognize it as matching
  13549. sequence. The option value must be a non negative integer value.
  13550. The default value is 0.
  13551. @item th_it
  13552. Set the minimum relation, that matching frames to all frames must have.
  13553. The option value must be a double value between 0 and 1. The default value is 0.5.
  13554. @end table
  13555. @subsection Examples
  13556. @itemize
  13557. @item
  13558. To calculate the signature of an input video and store it in signature.bin:
  13559. @example
  13560. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13561. @end example
  13562. @item
  13563. To detect whether two videos match and store the signatures in XML format in
  13564. signature0.xml and signature1.xml:
  13565. @example
  13566. 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 -
  13567. @end example
  13568. @end itemize
  13569. @anchor{smartblur}
  13570. @section smartblur
  13571. Blur the input video without impacting the outlines.
  13572. It accepts the following options:
  13573. @table @option
  13574. @item luma_radius, lr
  13575. Set the luma radius. The option value must be a float number in
  13576. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13577. used to blur the image (slower if larger). Default value is 1.0.
  13578. @item luma_strength, ls
  13579. Set the luma strength. The option value must be a float number
  13580. in the range [-1.0,1.0] that configures the blurring. A value included
  13581. in [0.0,1.0] will blur the image whereas a value included in
  13582. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13583. @item luma_threshold, lt
  13584. Set the luma threshold used as a coefficient to determine
  13585. whether a pixel should be blurred or not. The option value must be an
  13586. integer in the range [-30,30]. A value of 0 will filter all the image,
  13587. a value included in [0,30] will filter flat areas and a value included
  13588. in [-30,0] will filter edges. Default value is 0.
  13589. @item chroma_radius, cr
  13590. Set the chroma radius. The option value must be a float number in
  13591. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13592. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13593. @item chroma_strength, cs
  13594. Set the chroma strength. The option value must be a float number
  13595. in the range [-1.0,1.0] that configures the blurring. A value included
  13596. in [0.0,1.0] will blur the image whereas a value included in
  13597. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13598. @item chroma_threshold, ct
  13599. Set the chroma threshold used as a coefficient to determine
  13600. whether a pixel should be blurred or not. The option value must be an
  13601. integer in the range [-30,30]. A value of 0 will filter all the image,
  13602. a value included in [0,30] will filter flat areas and a value included
  13603. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13604. @end table
  13605. If a chroma option is not explicitly set, the corresponding luma value
  13606. is set.
  13607. @section sobel
  13608. Apply sobel operator to input video stream.
  13609. The filter accepts the following option:
  13610. @table @option
  13611. @item planes
  13612. Set which planes will be processed, unprocessed planes will be copied.
  13613. By default value 0xf, all planes will be processed.
  13614. @item scale
  13615. Set value which will be multiplied with filtered result.
  13616. @item delta
  13617. Set value which will be added to filtered result.
  13618. @end table
  13619. @anchor{spp}
  13620. @section spp
  13621. Apply a simple postprocessing filter that compresses and decompresses the image
  13622. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13623. and average the results.
  13624. The filter accepts the following options:
  13625. @table @option
  13626. @item quality
  13627. Set quality. This option defines the number of levels for averaging. It accepts
  13628. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13629. effect. A value of @code{6} means the higher quality. For each increment of
  13630. that value the speed drops by a factor of approximately 2. Default value is
  13631. @code{3}.
  13632. @item qp
  13633. Force a constant quantization parameter. If not set, the filter will use the QP
  13634. from the video stream (if available).
  13635. @item mode
  13636. Set thresholding mode. Available modes are:
  13637. @table @samp
  13638. @item hard
  13639. Set hard thresholding (default).
  13640. @item soft
  13641. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13642. @end table
  13643. @item use_bframe_qp
  13644. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13645. option may cause flicker since the B-Frames have often larger QP. Default is
  13646. @code{0} (not enabled).
  13647. @end table
  13648. @subsection Commands
  13649. This filter supports the following commands:
  13650. @table @option
  13651. @item quality, level
  13652. Set quality level. The value @code{max} can be used to set the maximum level,
  13653. currently @code{6}.
  13654. @end table
  13655. @anchor{sr}
  13656. @section sr
  13657. Scale the input by applying one of the super-resolution methods based on
  13658. convolutional neural networks. Supported models:
  13659. @itemize
  13660. @item
  13661. Super-Resolution Convolutional Neural Network model (SRCNN).
  13662. See @url{https://arxiv.org/abs/1501.00092}.
  13663. @item
  13664. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13665. See @url{https://arxiv.org/abs/1609.05158}.
  13666. @end itemize
  13667. Training scripts as well as scripts for model file (.pb) saving can be found at
  13668. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13669. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13670. Native model files (.model) can be generated from TensorFlow model
  13671. files (.pb) by using tools/python/convert.py
  13672. The filter accepts the following options:
  13673. @table @option
  13674. @item dnn_backend
  13675. Specify which DNN backend to use for model loading and execution. This option accepts
  13676. the following values:
  13677. @table @samp
  13678. @item native
  13679. Native implementation of DNN loading and execution.
  13680. @item tensorflow
  13681. TensorFlow backend. To enable this backend you
  13682. need to install the TensorFlow for C library (see
  13683. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13684. @code{--enable-libtensorflow}
  13685. @end table
  13686. Default value is @samp{native}.
  13687. @item model
  13688. Set path to model file specifying network architecture and its parameters.
  13689. Note that different backends use different file formats. TensorFlow backend
  13690. can load files for both formats, while native backend can load files for only
  13691. its format.
  13692. @item scale_factor
  13693. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13694. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13695. input upscaled using bicubic upscaling with proper scale factor.
  13696. @end table
  13697. This feature can also be finished with @ref{dnn_processing} filter.
  13698. @section ssim
  13699. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13700. This filter takes in input two input videos, the first input is
  13701. considered the "main" source and is passed unchanged to the
  13702. output. The second input is used as a "reference" video for computing
  13703. the SSIM.
  13704. Both video inputs must have the same resolution and pixel format for
  13705. this filter to work correctly. Also it assumes that both inputs
  13706. have the same number of frames, which are compared one by one.
  13707. The filter stores the calculated SSIM of each frame.
  13708. The description of the accepted parameters follows.
  13709. @table @option
  13710. @item stats_file, f
  13711. If specified the filter will use the named file to save the SSIM of
  13712. each individual frame. When filename equals "-" the data is sent to
  13713. standard output.
  13714. @end table
  13715. The file printed if @var{stats_file} is selected, contains a sequence of
  13716. key/value pairs of the form @var{key}:@var{value} for each compared
  13717. couple of frames.
  13718. A description of each shown parameter follows:
  13719. @table @option
  13720. @item n
  13721. sequential number of the input frame, starting from 1
  13722. @item Y, U, V, R, G, B
  13723. SSIM of the compared frames for the component specified by the suffix.
  13724. @item All
  13725. SSIM of the compared frames for the whole frame.
  13726. @item dB
  13727. Same as above but in dB representation.
  13728. @end table
  13729. This filter also supports the @ref{framesync} options.
  13730. @subsection Examples
  13731. @itemize
  13732. @item
  13733. For example:
  13734. @example
  13735. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13736. [main][ref] ssim="stats_file=stats.log" [out]
  13737. @end example
  13738. On this example the input file being processed is compared with the
  13739. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13740. is stored in @file{stats.log}.
  13741. @item
  13742. Another example with both psnr and ssim at same time:
  13743. @example
  13744. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13745. @end example
  13746. @item
  13747. Another example with different containers:
  13748. @example
  13749. 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 -
  13750. @end example
  13751. @end itemize
  13752. @section stereo3d
  13753. Convert between different stereoscopic image formats.
  13754. The filters accept the following options:
  13755. @table @option
  13756. @item in
  13757. Set stereoscopic image format of input.
  13758. Available values for input image formats are:
  13759. @table @samp
  13760. @item sbsl
  13761. side by side parallel (left eye left, right eye right)
  13762. @item sbsr
  13763. side by side crosseye (right eye left, left eye right)
  13764. @item sbs2l
  13765. side by side parallel with half width resolution
  13766. (left eye left, right eye right)
  13767. @item sbs2r
  13768. side by side crosseye with half width resolution
  13769. (right eye left, left eye right)
  13770. @item abl
  13771. @item tbl
  13772. above-below (left eye above, right eye below)
  13773. @item abr
  13774. @item tbr
  13775. above-below (right eye above, left eye below)
  13776. @item ab2l
  13777. @item tb2l
  13778. above-below with half height resolution
  13779. (left eye above, right eye below)
  13780. @item ab2r
  13781. @item tb2r
  13782. above-below with half height resolution
  13783. (right eye above, left eye below)
  13784. @item al
  13785. alternating frames (left eye first, right eye second)
  13786. @item ar
  13787. alternating frames (right eye first, left eye second)
  13788. @item irl
  13789. interleaved rows (left eye has top row, right eye starts on next row)
  13790. @item irr
  13791. interleaved rows (right eye has top row, left eye starts on next row)
  13792. @item icl
  13793. interleaved columns, left eye first
  13794. @item icr
  13795. interleaved columns, right eye first
  13796. Default value is @samp{sbsl}.
  13797. @end table
  13798. @item out
  13799. Set stereoscopic image format of output.
  13800. @table @samp
  13801. @item sbsl
  13802. side by side parallel (left eye left, right eye right)
  13803. @item sbsr
  13804. side by side crosseye (right eye left, left eye right)
  13805. @item sbs2l
  13806. side by side parallel with half width resolution
  13807. (left eye left, right eye right)
  13808. @item sbs2r
  13809. side by side crosseye with half width resolution
  13810. (right eye left, left eye right)
  13811. @item abl
  13812. @item tbl
  13813. above-below (left eye above, right eye below)
  13814. @item abr
  13815. @item tbr
  13816. above-below (right eye above, left eye below)
  13817. @item ab2l
  13818. @item tb2l
  13819. above-below with half height resolution
  13820. (left eye above, right eye below)
  13821. @item ab2r
  13822. @item tb2r
  13823. above-below with half height resolution
  13824. (right eye above, left eye below)
  13825. @item al
  13826. alternating frames (left eye first, right eye second)
  13827. @item ar
  13828. alternating frames (right eye first, left eye second)
  13829. @item irl
  13830. interleaved rows (left eye has top row, right eye starts on next row)
  13831. @item irr
  13832. interleaved rows (right eye has top row, left eye starts on next row)
  13833. @item arbg
  13834. anaglyph red/blue gray
  13835. (red filter on left eye, blue filter on right eye)
  13836. @item argg
  13837. anaglyph red/green gray
  13838. (red filter on left eye, green filter on right eye)
  13839. @item arcg
  13840. anaglyph red/cyan gray
  13841. (red filter on left eye, cyan filter on right eye)
  13842. @item arch
  13843. anaglyph red/cyan half colored
  13844. (red filter on left eye, cyan filter on right eye)
  13845. @item arcc
  13846. anaglyph red/cyan color
  13847. (red filter on left eye, cyan filter on right eye)
  13848. @item arcd
  13849. anaglyph red/cyan color optimized with the least squares projection of dubois
  13850. (red filter on left eye, cyan filter on right eye)
  13851. @item agmg
  13852. anaglyph green/magenta gray
  13853. (green filter on left eye, magenta filter on right eye)
  13854. @item agmh
  13855. anaglyph green/magenta half colored
  13856. (green filter on left eye, magenta filter on right eye)
  13857. @item agmc
  13858. anaglyph green/magenta colored
  13859. (green filter on left eye, magenta filter on right eye)
  13860. @item agmd
  13861. anaglyph green/magenta color optimized with the least squares projection of dubois
  13862. (green filter on left eye, magenta filter on right eye)
  13863. @item aybg
  13864. anaglyph yellow/blue gray
  13865. (yellow filter on left eye, blue filter on right eye)
  13866. @item aybh
  13867. anaglyph yellow/blue half colored
  13868. (yellow filter on left eye, blue filter on right eye)
  13869. @item aybc
  13870. anaglyph yellow/blue colored
  13871. (yellow filter on left eye, blue filter on right eye)
  13872. @item aybd
  13873. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13874. (yellow filter on left eye, blue filter on right eye)
  13875. @item ml
  13876. mono output (left eye only)
  13877. @item mr
  13878. mono output (right eye only)
  13879. @item chl
  13880. checkerboard, left eye first
  13881. @item chr
  13882. checkerboard, right eye first
  13883. @item icl
  13884. interleaved columns, left eye first
  13885. @item icr
  13886. interleaved columns, right eye first
  13887. @item hdmi
  13888. HDMI frame pack
  13889. @end table
  13890. Default value is @samp{arcd}.
  13891. @end table
  13892. @subsection Examples
  13893. @itemize
  13894. @item
  13895. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13896. @example
  13897. stereo3d=sbsl:aybd
  13898. @end example
  13899. @item
  13900. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13901. @example
  13902. stereo3d=abl:sbsr
  13903. @end example
  13904. @end itemize
  13905. @section streamselect, astreamselect
  13906. Select video or audio streams.
  13907. The filter accepts the following options:
  13908. @table @option
  13909. @item inputs
  13910. Set number of inputs. Default is 2.
  13911. @item map
  13912. Set input indexes to remap to outputs.
  13913. @end table
  13914. @subsection Commands
  13915. The @code{streamselect} and @code{astreamselect} filter supports the following
  13916. commands:
  13917. @table @option
  13918. @item map
  13919. Set input indexes to remap to outputs.
  13920. @end table
  13921. @subsection Examples
  13922. @itemize
  13923. @item
  13924. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13925. @example
  13926. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13927. @end example
  13928. @item
  13929. Same as above, but for audio:
  13930. @example
  13931. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13932. @end example
  13933. @end itemize
  13934. @anchor{subtitles}
  13935. @section subtitles
  13936. Draw subtitles on top of input video using the libass library.
  13937. To enable compilation of this filter you need to configure FFmpeg with
  13938. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13939. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13940. Alpha) subtitles format.
  13941. The filter accepts the following options:
  13942. @table @option
  13943. @item filename, f
  13944. Set the filename of the subtitle file to read. It must be specified.
  13945. @item original_size
  13946. Specify the size of the original video, the video for which the ASS file
  13947. was composed. For the syntax of this option, check the
  13948. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13949. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13950. correctly scale the fonts if the aspect ratio has been changed.
  13951. @item fontsdir
  13952. Set a directory path containing fonts that can be used by the filter.
  13953. These fonts will be used in addition to whatever the font provider uses.
  13954. @item alpha
  13955. Process alpha channel, by default alpha channel is untouched.
  13956. @item charenc
  13957. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13958. useful if not UTF-8.
  13959. @item stream_index, si
  13960. Set subtitles stream index. @code{subtitles} filter only.
  13961. @item force_style
  13962. Override default style or script info parameters of the subtitles. It accepts a
  13963. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13964. @end table
  13965. If the first key is not specified, it is assumed that the first value
  13966. specifies the @option{filename}.
  13967. For example, to render the file @file{sub.srt} on top of the input
  13968. video, use the command:
  13969. @example
  13970. subtitles=sub.srt
  13971. @end example
  13972. which is equivalent to:
  13973. @example
  13974. subtitles=filename=sub.srt
  13975. @end example
  13976. To render the default subtitles stream from file @file{video.mkv}, use:
  13977. @example
  13978. subtitles=video.mkv
  13979. @end example
  13980. To render the second subtitles stream from that file, use:
  13981. @example
  13982. subtitles=video.mkv:si=1
  13983. @end example
  13984. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13985. @code{DejaVu Serif}, use:
  13986. @example
  13987. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13988. @end example
  13989. @section super2xsai
  13990. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13991. Interpolate) pixel art scaling algorithm.
  13992. Useful for enlarging pixel art images without reducing sharpness.
  13993. @section swaprect
  13994. Swap two rectangular objects in video.
  13995. This filter accepts the following options:
  13996. @table @option
  13997. @item w
  13998. Set object width.
  13999. @item h
  14000. Set object height.
  14001. @item x1
  14002. Set 1st rect x coordinate.
  14003. @item y1
  14004. Set 1st rect y coordinate.
  14005. @item x2
  14006. Set 2nd rect x coordinate.
  14007. @item y2
  14008. Set 2nd rect y coordinate.
  14009. All expressions are evaluated once for each frame.
  14010. @end table
  14011. The all options are expressions containing the following constants:
  14012. @table @option
  14013. @item w
  14014. @item h
  14015. The input width and height.
  14016. @item a
  14017. same as @var{w} / @var{h}
  14018. @item sar
  14019. input sample aspect ratio
  14020. @item dar
  14021. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14022. @item n
  14023. The number of the input frame, starting from 0.
  14024. @item t
  14025. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14026. @item pos
  14027. the position in the file of the input frame, NAN if unknown
  14028. @end table
  14029. @section swapuv
  14030. Swap U & V plane.
  14031. @section tblend
  14032. Blend successive video frames.
  14033. See @ref{blend}
  14034. @section telecine
  14035. Apply telecine process to the video.
  14036. This filter accepts the following options:
  14037. @table @option
  14038. @item first_field
  14039. @table @samp
  14040. @item top, t
  14041. top field first
  14042. @item bottom, b
  14043. bottom field first
  14044. The default value is @code{top}.
  14045. @end table
  14046. @item pattern
  14047. A string of numbers representing the pulldown pattern you wish to apply.
  14048. The default value is @code{23}.
  14049. @end table
  14050. @example
  14051. Some typical patterns:
  14052. NTSC output (30i):
  14053. 27.5p: 32222
  14054. 24p: 23 (classic)
  14055. 24p: 2332 (preferred)
  14056. 20p: 33
  14057. 18p: 334
  14058. 16p: 3444
  14059. PAL output (25i):
  14060. 27.5p: 12222
  14061. 24p: 222222222223 ("Euro pulldown")
  14062. 16.67p: 33
  14063. 16p: 33333334
  14064. @end example
  14065. @section thistogram
  14066. Compute and draw a color distribution histogram for the input video across time.
  14067. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14068. at certain time, this filter shows also past histograms of number of frames defined
  14069. by @code{width} option.
  14070. The computed histogram is a representation of the color component
  14071. distribution in an image.
  14072. The filter accepts the following options:
  14073. @table @option
  14074. @item width, w
  14075. Set width of single color component output. Default value is @code{0}.
  14076. Value of @code{0} means width will be picked from input video.
  14077. This also set number of passed histograms to keep.
  14078. Allowed range is [0, 8192].
  14079. @item display_mode, d
  14080. Set display mode.
  14081. It accepts the following values:
  14082. @table @samp
  14083. @item stack
  14084. Per color component graphs are placed below each other.
  14085. @item parade
  14086. Per color component graphs are placed side by side.
  14087. @item overlay
  14088. Presents information identical to that in the @code{parade}, except
  14089. that the graphs representing color components are superimposed directly
  14090. over one another.
  14091. @end table
  14092. Default is @code{stack}.
  14093. @item levels_mode, m
  14094. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14095. Default is @code{linear}.
  14096. @item components, c
  14097. Set what color components to display.
  14098. Default is @code{7}.
  14099. @item bgopacity, b
  14100. Set background opacity. Default is @code{0.9}.
  14101. @item envelope, e
  14102. Show envelope. Default is disabled.
  14103. @item ecolor, ec
  14104. Set envelope color. Default is @code{gold}.
  14105. @item slide
  14106. Set slide mode.
  14107. Available values for slide is:
  14108. @table @samp
  14109. @item frame
  14110. Draw new frame when right border is reached.
  14111. @item replace
  14112. Replace old columns with new ones.
  14113. @item scroll
  14114. Scroll from right to left.
  14115. @item rscroll
  14116. Scroll from left to right.
  14117. @item picture
  14118. Draw single picture.
  14119. @end table
  14120. Default is @code{replace}.
  14121. @end table
  14122. @section threshold
  14123. Apply threshold effect to video stream.
  14124. This filter needs four video streams to perform thresholding.
  14125. First stream is stream we are filtering.
  14126. Second stream is holding threshold values, third stream is holding min values,
  14127. and last, fourth stream is holding max values.
  14128. The filter accepts the following option:
  14129. @table @option
  14130. @item planes
  14131. Set which planes will be processed, unprocessed planes will be copied.
  14132. By default value 0xf, all planes will be processed.
  14133. @end table
  14134. For example if first stream pixel's component value is less then threshold value
  14135. of pixel component from 2nd threshold stream, third stream value will picked,
  14136. otherwise fourth stream pixel component value will be picked.
  14137. Using color source filter one can perform various types of thresholding:
  14138. @subsection Examples
  14139. @itemize
  14140. @item
  14141. Binary threshold, using gray color as threshold:
  14142. @example
  14143. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14144. @end example
  14145. @item
  14146. Inverted binary threshold, using gray color as threshold:
  14147. @example
  14148. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14149. @end example
  14150. @item
  14151. Truncate binary threshold, using gray color as threshold:
  14152. @example
  14153. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14154. @end example
  14155. @item
  14156. Threshold to zero, using gray color as threshold:
  14157. @example
  14158. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14159. @end example
  14160. @item
  14161. Inverted threshold to zero, using gray color as threshold:
  14162. @example
  14163. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14164. @end example
  14165. @end itemize
  14166. @section thumbnail
  14167. Select the most representative frame in a given sequence of consecutive frames.
  14168. The filter accepts the following options:
  14169. @table @option
  14170. @item n
  14171. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14172. will pick one of them, and then handle the next batch of @var{n} frames until
  14173. the end. Default is @code{100}.
  14174. @end table
  14175. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14176. value will result in a higher memory usage, so a high value is not recommended.
  14177. @subsection Examples
  14178. @itemize
  14179. @item
  14180. Extract one picture each 50 frames:
  14181. @example
  14182. thumbnail=50
  14183. @end example
  14184. @item
  14185. Complete example of a thumbnail creation with @command{ffmpeg}:
  14186. @example
  14187. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14188. @end example
  14189. @end itemize
  14190. @anchor{tile}
  14191. @section tile
  14192. Tile several successive frames together.
  14193. The @ref{untile} filter can do the reverse.
  14194. The filter accepts the following options:
  14195. @table @option
  14196. @item layout
  14197. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14198. this option, check the
  14199. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14200. @item nb_frames
  14201. Set the maximum number of frames to render in the given area. It must be less
  14202. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14203. the area will be used.
  14204. @item margin
  14205. Set the outer border margin in pixels.
  14206. @item padding
  14207. Set the inner border thickness (i.e. the number of pixels between frames). For
  14208. more advanced padding options (such as having different values for the edges),
  14209. refer to the pad video filter.
  14210. @item color
  14211. Specify the color of the unused area. For the syntax of this option, check the
  14212. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14213. The default value of @var{color} is "black".
  14214. @item overlap
  14215. Set the number of frames to overlap when tiling several successive frames together.
  14216. The value must be between @code{0} and @var{nb_frames - 1}.
  14217. @item init_padding
  14218. Set the number of frames to initially be empty before displaying first output frame.
  14219. This controls how soon will one get first output frame.
  14220. The value must be between @code{0} and @var{nb_frames - 1}.
  14221. @end table
  14222. @subsection Examples
  14223. @itemize
  14224. @item
  14225. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14226. @example
  14227. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14228. @end example
  14229. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14230. duplicating each output frame to accommodate the originally detected frame
  14231. rate.
  14232. @item
  14233. Display @code{5} pictures in an area of @code{3x2} frames,
  14234. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14235. mixed flat and named options:
  14236. @example
  14237. tile=3x2:nb_frames=5:padding=7:margin=2
  14238. @end example
  14239. @end itemize
  14240. @section tinterlace
  14241. Perform various types of temporal field interlacing.
  14242. Frames are counted starting from 1, so the first input frame is
  14243. considered odd.
  14244. The filter accepts the following options:
  14245. @table @option
  14246. @item mode
  14247. Specify the mode of the interlacing. This option can also be specified
  14248. as a value alone. See below for a list of values for this option.
  14249. Available values are:
  14250. @table @samp
  14251. @item merge, 0
  14252. Move odd frames into the upper field, even into the lower field,
  14253. generating a double height frame at half frame rate.
  14254. @example
  14255. ------> time
  14256. Input:
  14257. Frame 1 Frame 2 Frame 3 Frame 4
  14258. 11111 22222 33333 44444
  14259. 11111 22222 33333 44444
  14260. 11111 22222 33333 44444
  14261. 11111 22222 33333 44444
  14262. Output:
  14263. 11111 33333
  14264. 22222 44444
  14265. 11111 33333
  14266. 22222 44444
  14267. 11111 33333
  14268. 22222 44444
  14269. 11111 33333
  14270. 22222 44444
  14271. @end example
  14272. @item drop_even, 1
  14273. Only output odd frames, even frames are dropped, generating a frame with
  14274. unchanged height at half frame rate.
  14275. @example
  14276. ------> time
  14277. Input:
  14278. Frame 1 Frame 2 Frame 3 Frame 4
  14279. 11111 22222 33333 44444
  14280. 11111 22222 33333 44444
  14281. 11111 22222 33333 44444
  14282. 11111 22222 33333 44444
  14283. Output:
  14284. 11111 33333
  14285. 11111 33333
  14286. 11111 33333
  14287. 11111 33333
  14288. @end example
  14289. @item drop_odd, 2
  14290. Only output even frames, odd frames are dropped, generating a frame with
  14291. unchanged height at half frame rate.
  14292. @example
  14293. ------> time
  14294. Input:
  14295. Frame 1 Frame 2 Frame 3 Frame 4
  14296. 11111 22222 33333 44444
  14297. 11111 22222 33333 44444
  14298. 11111 22222 33333 44444
  14299. 11111 22222 33333 44444
  14300. Output:
  14301. 22222 44444
  14302. 22222 44444
  14303. 22222 44444
  14304. 22222 44444
  14305. @end example
  14306. @item pad, 3
  14307. Expand each frame to full height, but pad alternate lines with black,
  14308. generating a frame with double height at the same input frame rate.
  14309. @example
  14310. ------> time
  14311. Input:
  14312. Frame 1 Frame 2 Frame 3 Frame 4
  14313. 11111 22222 33333 44444
  14314. 11111 22222 33333 44444
  14315. 11111 22222 33333 44444
  14316. 11111 22222 33333 44444
  14317. Output:
  14318. 11111 ..... 33333 .....
  14319. ..... 22222 ..... 44444
  14320. 11111 ..... 33333 .....
  14321. ..... 22222 ..... 44444
  14322. 11111 ..... 33333 .....
  14323. ..... 22222 ..... 44444
  14324. 11111 ..... 33333 .....
  14325. ..... 22222 ..... 44444
  14326. @end example
  14327. @item interleave_top, 4
  14328. Interleave the upper field from odd frames with the lower field from
  14329. even frames, generating a frame with unchanged height at half frame rate.
  14330. @example
  14331. ------> time
  14332. Input:
  14333. Frame 1 Frame 2 Frame 3 Frame 4
  14334. 11111<- 22222 33333<- 44444
  14335. 11111 22222<- 33333 44444<-
  14336. 11111<- 22222 33333<- 44444
  14337. 11111 22222<- 33333 44444<-
  14338. Output:
  14339. 11111 33333
  14340. 22222 44444
  14341. 11111 33333
  14342. 22222 44444
  14343. @end example
  14344. @item interleave_bottom, 5
  14345. Interleave the lower field from odd frames with the upper field from
  14346. even frames, generating a frame with unchanged height at half frame rate.
  14347. @example
  14348. ------> time
  14349. Input:
  14350. Frame 1 Frame 2 Frame 3 Frame 4
  14351. 11111 22222<- 33333 44444<-
  14352. 11111<- 22222 33333<- 44444
  14353. 11111 22222<- 33333 44444<-
  14354. 11111<- 22222 33333<- 44444
  14355. Output:
  14356. 22222 44444
  14357. 11111 33333
  14358. 22222 44444
  14359. 11111 33333
  14360. @end example
  14361. @item interlacex2, 6
  14362. Double frame rate with unchanged height. Frames are inserted each
  14363. containing the second temporal field from the previous input frame and
  14364. the first temporal field from the next input frame. This mode relies on
  14365. the top_field_first flag. Useful for interlaced video displays with no
  14366. field synchronisation.
  14367. @example
  14368. ------> time
  14369. Input:
  14370. Frame 1 Frame 2 Frame 3 Frame 4
  14371. 11111 22222 33333 44444
  14372. 11111 22222 33333 44444
  14373. 11111 22222 33333 44444
  14374. 11111 22222 33333 44444
  14375. Output:
  14376. 11111 22222 22222 33333 33333 44444 44444
  14377. 11111 11111 22222 22222 33333 33333 44444
  14378. 11111 22222 22222 33333 33333 44444 44444
  14379. 11111 11111 22222 22222 33333 33333 44444
  14380. @end example
  14381. @item mergex2, 7
  14382. Move odd frames into the upper field, even into the lower field,
  14383. generating a double height frame at same frame rate.
  14384. @example
  14385. ------> time
  14386. Input:
  14387. Frame 1 Frame 2 Frame 3 Frame 4
  14388. 11111 22222 33333 44444
  14389. 11111 22222 33333 44444
  14390. 11111 22222 33333 44444
  14391. 11111 22222 33333 44444
  14392. Output:
  14393. 11111 33333 33333 55555
  14394. 22222 22222 44444 44444
  14395. 11111 33333 33333 55555
  14396. 22222 22222 44444 44444
  14397. 11111 33333 33333 55555
  14398. 22222 22222 44444 44444
  14399. 11111 33333 33333 55555
  14400. 22222 22222 44444 44444
  14401. @end example
  14402. @end table
  14403. Numeric values are deprecated but are accepted for backward
  14404. compatibility reasons.
  14405. Default mode is @code{merge}.
  14406. @item flags
  14407. Specify flags influencing the filter process.
  14408. Available value for @var{flags} is:
  14409. @table @option
  14410. @item low_pass_filter, vlpf
  14411. Enable linear vertical low-pass filtering in the filter.
  14412. Vertical low-pass filtering is required when creating an interlaced
  14413. destination from a progressive source which contains high-frequency
  14414. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14415. patterning.
  14416. @item complex_filter, cvlpf
  14417. Enable complex vertical low-pass filtering.
  14418. This will slightly less reduce interlace 'twitter' and Moire
  14419. patterning but better retain detail and subjective sharpness impression.
  14420. @item bypass_il
  14421. Bypass already interlaced frames, only adjust the frame rate.
  14422. @end table
  14423. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14424. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14425. @end table
  14426. @section tmedian
  14427. Pick median pixels from several successive input video frames.
  14428. The filter accepts the following options:
  14429. @table @option
  14430. @item radius
  14431. Set radius of median filter.
  14432. Default is 1. Allowed range is from 1 to 127.
  14433. @item planes
  14434. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14435. @item percentile
  14436. Set median percentile. Default value is @code{0.5}.
  14437. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14438. minimum values, and @code{1} maximum values.
  14439. @end table
  14440. @section tmix
  14441. Mix successive video frames.
  14442. A description of the accepted options follows.
  14443. @table @option
  14444. @item frames
  14445. The number of successive frames to mix. If unspecified, it defaults to 3.
  14446. @item weights
  14447. Specify weight of each input video frame.
  14448. Each weight is separated by space. If number of weights is smaller than
  14449. number of @var{frames} last specified weight will be used for all remaining
  14450. unset weights.
  14451. @item scale
  14452. Specify scale, if it is set it will be multiplied with sum
  14453. of each weight multiplied with pixel values to give final destination
  14454. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14455. @end table
  14456. @subsection Examples
  14457. @itemize
  14458. @item
  14459. Average 7 successive frames:
  14460. @example
  14461. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14462. @end example
  14463. @item
  14464. Apply simple temporal convolution:
  14465. @example
  14466. tmix=frames=3:weights="-1 3 -1"
  14467. @end example
  14468. @item
  14469. Similar as above but only showing temporal differences:
  14470. @example
  14471. tmix=frames=3:weights="-1 2 -1":scale=1
  14472. @end example
  14473. @end itemize
  14474. @anchor{tonemap}
  14475. @section tonemap
  14476. Tone map colors from different dynamic ranges.
  14477. This filter expects data in single precision floating point, as it needs to
  14478. operate on (and can output) out-of-range values. Another filter, such as
  14479. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14480. The tonemapping algorithms implemented only work on linear light, so input
  14481. data should be linearized beforehand (and possibly correctly tagged).
  14482. @example
  14483. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14484. @end example
  14485. @subsection Options
  14486. The filter accepts the following options.
  14487. @table @option
  14488. @item tonemap
  14489. Set the tone map algorithm to use.
  14490. Possible values are:
  14491. @table @var
  14492. @item none
  14493. Do not apply any tone map, only desaturate overbright pixels.
  14494. @item clip
  14495. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14496. in-range values, while distorting out-of-range values.
  14497. @item linear
  14498. Stretch the entire reference gamut to a linear multiple of the display.
  14499. @item gamma
  14500. Fit a logarithmic transfer between the tone curves.
  14501. @item reinhard
  14502. Preserve overall image brightness with a simple curve, using nonlinear
  14503. contrast, which results in flattening details and degrading color accuracy.
  14504. @item hable
  14505. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14506. of slightly darkening everything. Use it when detail preservation is more
  14507. important than color and brightness accuracy.
  14508. @item mobius
  14509. Smoothly map out-of-range values, while retaining contrast and colors for
  14510. in-range material as much as possible. Use it when color accuracy is more
  14511. important than detail preservation.
  14512. @end table
  14513. Default is none.
  14514. @item param
  14515. Tune the tone mapping algorithm.
  14516. This affects the following algorithms:
  14517. @table @var
  14518. @item none
  14519. Ignored.
  14520. @item linear
  14521. Specifies the scale factor to use while stretching.
  14522. Default to 1.0.
  14523. @item gamma
  14524. Specifies the exponent of the function.
  14525. Default to 1.8.
  14526. @item clip
  14527. Specify an extra linear coefficient to multiply into the signal before clipping.
  14528. Default to 1.0.
  14529. @item reinhard
  14530. Specify the local contrast coefficient at the display peak.
  14531. Default to 0.5, which means that in-gamut values will be about half as bright
  14532. as when clipping.
  14533. @item hable
  14534. Ignored.
  14535. @item mobius
  14536. Specify the transition point from linear to mobius transform. Every value
  14537. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14538. more accurate the result will be, at the cost of losing bright details.
  14539. Default to 0.3, which due to the steep initial slope still preserves in-range
  14540. colors fairly accurately.
  14541. @end table
  14542. @item desat
  14543. Apply desaturation for highlights that exceed this level of brightness. The
  14544. higher the parameter, the more color information will be preserved. This
  14545. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14546. (smoothly) turning into white instead. This makes images feel more natural,
  14547. at the cost of reducing information about out-of-range colors.
  14548. The default of 2.0 is somewhat conservative and will mostly just apply to
  14549. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14550. This option works only if the input frame has a supported color tag.
  14551. @item peak
  14552. Override signal/nominal/reference peak with this value. Useful when the
  14553. embedded peak information in display metadata is not reliable or when tone
  14554. mapping from a lower range to a higher range.
  14555. @end table
  14556. @section tpad
  14557. Temporarily pad video frames.
  14558. The filter accepts the following options:
  14559. @table @option
  14560. @item start
  14561. Specify number of delay frames before input video stream. Default is 0.
  14562. @item stop
  14563. Specify number of padding frames after input video stream.
  14564. Set to -1 to pad indefinitely. Default is 0.
  14565. @item start_mode
  14566. Set kind of frames added to beginning of stream.
  14567. Can be either @var{add} or @var{clone}.
  14568. With @var{add} frames of solid-color are added.
  14569. With @var{clone} frames are clones of first frame.
  14570. Default is @var{add}.
  14571. @item stop_mode
  14572. Set kind of frames added to end 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 last frame.
  14576. Default is @var{add}.
  14577. @item start_duration, stop_duration
  14578. Specify the duration of the start/stop delay. See
  14579. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14580. for the accepted syntax.
  14581. These options override @var{start} and @var{stop}. Default is 0.
  14582. @item color
  14583. Specify the color of the padded area. For the syntax of this option,
  14584. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14585. manual,ffmpeg-utils}.
  14586. The default value of @var{color} is "black".
  14587. @end table
  14588. @anchor{transpose}
  14589. @section transpose
  14590. Transpose rows with columns in the input video and optionally flip it.
  14591. It accepts the following parameters:
  14592. @table @option
  14593. @item dir
  14594. Specify the transposition direction.
  14595. Can assume the following values:
  14596. @table @samp
  14597. @item 0, 4, cclock_flip
  14598. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14599. @example
  14600. L.R L.l
  14601. . . -> . .
  14602. l.r R.r
  14603. @end example
  14604. @item 1, 5, clock
  14605. Rotate by 90 degrees clockwise, that is:
  14606. @example
  14607. L.R l.L
  14608. . . -> . .
  14609. l.r r.R
  14610. @end example
  14611. @item 2, 6, cclock
  14612. Rotate by 90 degrees counterclockwise, that is:
  14613. @example
  14614. L.R R.r
  14615. . . -> . .
  14616. l.r L.l
  14617. @end example
  14618. @item 3, 7, clock_flip
  14619. Rotate by 90 degrees clockwise and vertically flip, that is:
  14620. @example
  14621. L.R r.R
  14622. . . -> . .
  14623. l.r l.L
  14624. @end example
  14625. @end table
  14626. For values between 4-7, the transposition is only done if the input
  14627. video geometry is portrait and not landscape. These values are
  14628. deprecated, the @code{passthrough} option should be used instead.
  14629. Numerical values are deprecated, and should be dropped in favor of
  14630. symbolic constants.
  14631. @item passthrough
  14632. Do not apply the transposition if the input geometry matches the one
  14633. specified by the specified value. It accepts the following values:
  14634. @table @samp
  14635. @item none
  14636. Always apply transposition.
  14637. @item portrait
  14638. Preserve portrait geometry (when @var{height} >= @var{width}).
  14639. @item landscape
  14640. Preserve landscape geometry (when @var{width} >= @var{height}).
  14641. @end table
  14642. Default value is @code{none}.
  14643. @end table
  14644. For example to rotate by 90 degrees clockwise and preserve portrait
  14645. layout:
  14646. @example
  14647. transpose=dir=1:passthrough=portrait
  14648. @end example
  14649. The command above can also be specified as:
  14650. @example
  14651. transpose=1:portrait
  14652. @end example
  14653. @section transpose_npp
  14654. Transpose rows with columns in the input video and optionally flip it.
  14655. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14656. It accepts the following parameters:
  14657. @table @option
  14658. @item dir
  14659. Specify the transposition direction.
  14660. Can assume the following values:
  14661. @table @samp
  14662. @item cclock_flip
  14663. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14664. @item clock
  14665. Rotate by 90 degrees clockwise.
  14666. @item cclock
  14667. Rotate by 90 degrees counterclockwise.
  14668. @item clock_flip
  14669. Rotate by 90 degrees clockwise and vertically flip.
  14670. @end table
  14671. @item passthrough
  14672. Do not apply the transposition if the input geometry matches the one
  14673. specified by the specified value. It accepts the following values:
  14674. @table @samp
  14675. @item none
  14676. Always apply transposition. (default)
  14677. @item portrait
  14678. Preserve portrait geometry (when @var{height} >= @var{width}).
  14679. @item landscape
  14680. Preserve landscape geometry (when @var{width} >= @var{height}).
  14681. @end table
  14682. @end table
  14683. @section trim
  14684. Trim the input so that the output contains one continuous subpart of the input.
  14685. It accepts the following parameters:
  14686. @table @option
  14687. @item start
  14688. Specify the time of the start of the kept section, i.e. the frame with the
  14689. timestamp @var{start} will be the first frame in the output.
  14690. @item end
  14691. Specify the time of the first frame that will be dropped, i.e. the frame
  14692. immediately preceding the one with the timestamp @var{end} will be the last
  14693. frame in the output.
  14694. @item start_pts
  14695. This is the same as @var{start}, except this option sets the start timestamp
  14696. in timebase units instead of seconds.
  14697. @item end_pts
  14698. This is the same as @var{end}, except this option sets the end timestamp
  14699. in timebase units instead of seconds.
  14700. @item duration
  14701. The maximum duration of the output in seconds.
  14702. @item start_frame
  14703. The number of the first frame that should be passed to the output.
  14704. @item end_frame
  14705. The number of the first frame that should be dropped.
  14706. @end table
  14707. @option{start}, @option{end}, and @option{duration} are expressed as time
  14708. duration specifications; see
  14709. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14710. for the accepted syntax.
  14711. Note that the first two sets of the start/end options and the @option{duration}
  14712. option look at the frame timestamp, while the _frame variants simply count the
  14713. frames that pass through the filter. Also note that this filter does not modify
  14714. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14715. setpts filter after the trim filter.
  14716. If multiple start or end options are set, this filter tries to be greedy and
  14717. keep all the frames that match at least one of the specified constraints. To keep
  14718. only the part that matches all the constraints at once, chain multiple trim
  14719. filters.
  14720. The defaults are such that all the input is kept. So it is possible to set e.g.
  14721. just the end values to keep everything before the specified time.
  14722. Examples:
  14723. @itemize
  14724. @item
  14725. Drop everything except the second minute of input:
  14726. @example
  14727. ffmpeg -i INPUT -vf trim=60:120
  14728. @end example
  14729. @item
  14730. Keep only the first second:
  14731. @example
  14732. ffmpeg -i INPUT -vf trim=duration=1
  14733. @end example
  14734. @end itemize
  14735. @section unpremultiply
  14736. Apply alpha unpremultiply effect to input video stream using first plane
  14737. of second stream as alpha.
  14738. Both streams must have same dimensions and same pixel format.
  14739. The filter accepts the following option:
  14740. @table @option
  14741. @item planes
  14742. Set which planes will be processed, unprocessed planes will be copied.
  14743. By default value 0xf, all planes will be processed.
  14744. If the format has 1 or 2 components, then luma is bit 0.
  14745. If the format has 3 or 4 components:
  14746. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14747. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14748. If present, the alpha channel is always the last bit.
  14749. @item inplace
  14750. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14751. @end table
  14752. @anchor{unsharp}
  14753. @section unsharp
  14754. Sharpen or blur the input video.
  14755. It accepts the following parameters:
  14756. @table @option
  14757. @item luma_msize_x, lx
  14758. Set the luma matrix horizontal size. It must be an odd integer between
  14759. 3 and 23. The default value is 5.
  14760. @item luma_msize_y, ly
  14761. Set the luma matrix vertical size. It must be an odd integer between 3
  14762. and 23. The default value is 5.
  14763. @item luma_amount, la
  14764. Set the luma effect strength. It must be a floating point number, reasonable
  14765. values lay between -1.5 and 1.5.
  14766. Negative values will blur the input video, while positive values will
  14767. sharpen it, a value of zero will disable the effect.
  14768. Default value is 1.0.
  14769. @item chroma_msize_x, cx
  14770. Set the chroma matrix horizontal size. It must be an odd integer
  14771. between 3 and 23. The default value is 5.
  14772. @item chroma_msize_y, cy
  14773. Set the chroma matrix vertical size. It must be an odd integer
  14774. between 3 and 23. The default value is 5.
  14775. @item chroma_amount, ca
  14776. Set the chroma effect strength. It must be a floating point number, reasonable
  14777. values lay between -1.5 and 1.5.
  14778. Negative values will blur the input video, while positive values will
  14779. sharpen it, a value of zero will disable the effect.
  14780. Default value is 0.0.
  14781. @end table
  14782. All parameters are optional and default to the equivalent of the
  14783. string '5:5:1.0:5:5:0.0'.
  14784. @subsection Examples
  14785. @itemize
  14786. @item
  14787. Apply strong luma sharpen effect:
  14788. @example
  14789. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14790. @end example
  14791. @item
  14792. Apply a strong blur of both luma and chroma parameters:
  14793. @example
  14794. unsharp=7:7:-2:7:7:-2
  14795. @end example
  14796. @end itemize
  14797. @anchor{untile}
  14798. @section untile
  14799. Decompose a video made of tiled images into the individual images.
  14800. The frame rate of the output video is the frame rate of the input video
  14801. multiplied by the number of tiles.
  14802. This filter does the reverse of @ref{tile}.
  14803. The filter accepts the following options:
  14804. @table @option
  14805. @item layout
  14806. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14807. this option, check the
  14808. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14809. @end table
  14810. @subsection Examples
  14811. @itemize
  14812. @item
  14813. Produce a 1-second video from a still image file made of 25 frames stacked
  14814. vertically, like an analogic film reel:
  14815. @example
  14816. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14817. @end example
  14818. @end itemize
  14819. @section uspp
  14820. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14821. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14822. shifts and average the results.
  14823. The way this differs from the behavior of spp is that uspp actually encodes &
  14824. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14825. DCT similar to MJPEG.
  14826. The filter accepts the following options:
  14827. @table @option
  14828. @item quality
  14829. Set quality. This option defines the number of levels for averaging. It accepts
  14830. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14831. effect. A value of @code{8} means the higher quality. For each increment of
  14832. that value the speed drops by a factor of approximately 2. Default value is
  14833. @code{3}.
  14834. @item qp
  14835. Force a constant quantization parameter. If not set, the filter will use the QP
  14836. from the video stream (if available).
  14837. @end table
  14838. @section v360
  14839. Convert 360 videos between various formats.
  14840. The filter accepts the following options:
  14841. @table @option
  14842. @item input
  14843. @item output
  14844. Set format of the input/output video.
  14845. Available formats:
  14846. @table @samp
  14847. @item e
  14848. @item equirect
  14849. Equirectangular projection.
  14850. @item c3x2
  14851. @item c6x1
  14852. @item c1x6
  14853. Cubemap with 3x2/6x1/1x6 layout.
  14854. Format specific options:
  14855. @table @option
  14856. @item in_pad
  14857. @item out_pad
  14858. Set padding proportion for the input/output cubemap. Values in decimals.
  14859. Example values:
  14860. @table @samp
  14861. @item 0
  14862. No padding.
  14863. @item 0.01
  14864. 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)
  14865. @end table
  14866. Default value is @b{@samp{0}}.
  14867. Maximum value is @b{@samp{0.1}}.
  14868. @item fin_pad
  14869. @item fout_pad
  14870. Set fixed padding for the input/output cubemap. Values in pixels.
  14871. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14872. @item in_forder
  14873. @item out_forder
  14874. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14875. Designation of directions:
  14876. @table @samp
  14877. @item r
  14878. right
  14879. @item l
  14880. left
  14881. @item u
  14882. up
  14883. @item d
  14884. down
  14885. @item f
  14886. forward
  14887. @item b
  14888. back
  14889. @end table
  14890. Default value is @b{@samp{rludfb}}.
  14891. @item in_frot
  14892. @item out_frot
  14893. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14894. Designation of angles:
  14895. @table @samp
  14896. @item 0
  14897. 0 degrees clockwise
  14898. @item 1
  14899. 90 degrees clockwise
  14900. @item 2
  14901. 180 degrees clockwise
  14902. @item 3
  14903. 270 degrees clockwise
  14904. @end table
  14905. Default value is @b{@samp{000000}}.
  14906. @end table
  14907. @item eac
  14908. Equi-Angular Cubemap.
  14909. @item flat
  14910. @item gnomonic
  14911. @item rectilinear
  14912. Regular video.
  14913. Format specific options:
  14914. @table @option
  14915. @item h_fov
  14916. @item v_fov
  14917. @item d_fov
  14918. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14919. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14920. @item ih_fov
  14921. @item iv_fov
  14922. @item id_fov
  14923. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14924. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14925. @end table
  14926. @item dfisheye
  14927. Dual fisheye.
  14928. Format specific options:
  14929. @table @option
  14930. @item h_fov
  14931. @item v_fov
  14932. @item d_fov
  14933. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14934. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14935. @item ih_fov
  14936. @item iv_fov
  14937. @item id_fov
  14938. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14939. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14940. @end table
  14941. @item barrel
  14942. @item fb
  14943. @item barrelsplit
  14944. Facebook's 360 formats.
  14945. @item sg
  14946. Stereographic format.
  14947. Format specific options:
  14948. @table @option
  14949. @item h_fov
  14950. @item v_fov
  14951. @item d_fov
  14952. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14953. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14954. @item ih_fov
  14955. @item iv_fov
  14956. @item id_fov
  14957. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14958. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14959. @end table
  14960. @item mercator
  14961. Mercator format.
  14962. @item ball
  14963. Ball format, gives significant distortion toward the back.
  14964. @item hammer
  14965. Hammer-Aitoff map projection format.
  14966. @item sinusoidal
  14967. Sinusoidal map projection format.
  14968. @item fisheye
  14969. Fisheye projection.
  14970. Format specific options:
  14971. @table @option
  14972. @item h_fov
  14973. @item v_fov
  14974. @item d_fov
  14975. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  14976. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14977. @item ih_fov
  14978. @item iv_fov
  14979. @item id_fov
  14980. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  14981. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14982. @end table
  14983. @item pannini
  14984. Pannini projection.
  14985. Format specific options:
  14986. @table @option
  14987. @item h_fov
  14988. Set output pannini parameter.
  14989. @item ih_fov
  14990. Set input pannini parameter.
  14991. @end table
  14992. @item cylindrical
  14993. Cylindrical projection.
  14994. Format specific options:
  14995. @table @option
  14996. @item h_fov
  14997. @item v_fov
  14998. @item d_fov
  14999. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15000. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15001. @item ih_fov
  15002. @item iv_fov
  15003. @item id_fov
  15004. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15005. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15006. @end table
  15007. @item perspective
  15008. Perspective projection. @i{(output only)}
  15009. Format specific options:
  15010. @table @option
  15011. @item v_fov
  15012. Set perspective parameter.
  15013. @end table
  15014. @item tetrahedron
  15015. Tetrahedron projection.
  15016. @item tsp
  15017. Truncated square pyramid projection.
  15018. @item he
  15019. @item hequirect
  15020. Half equirectangular projection.
  15021. @item equisolid
  15022. Equisolid format.
  15023. Format specific options:
  15024. @table @option
  15025. @item h_fov
  15026. @item v_fov
  15027. @item d_fov
  15028. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15029. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15030. @item ih_fov
  15031. @item iv_fov
  15032. @item id_fov
  15033. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15034. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15035. @end table
  15036. @item og
  15037. Orthographic format.
  15038. Format specific options:
  15039. @table @option
  15040. @item h_fov
  15041. @item v_fov
  15042. @item d_fov
  15043. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15044. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15045. @item ih_fov
  15046. @item iv_fov
  15047. @item id_fov
  15048. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15049. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15050. @end table
  15051. @item octahedron
  15052. Octahedron projection.
  15053. @end table
  15054. @item interp
  15055. Set interpolation method.@*
  15056. @i{Note: more complex interpolation methods require much more memory to run.}
  15057. Available methods:
  15058. @table @samp
  15059. @item near
  15060. @item nearest
  15061. Nearest neighbour.
  15062. @item line
  15063. @item linear
  15064. Bilinear interpolation.
  15065. @item lagrange9
  15066. Lagrange9 interpolation.
  15067. @item cube
  15068. @item cubic
  15069. Bicubic interpolation.
  15070. @item lanc
  15071. @item lanczos
  15072. Lanczos interpolation.
  15073. @item sp16
  15074. @item spline16
  15075. Spline16 interpolation.
  15076. @item gauss
  15077. @item gaussian
  15078. Gaussian interpolation.
  15079. @item mitchell
  15080. Mitchell interpolation.
  15081. @end table
  15082. Default value is @b{@samp{line}}.
  15083. @item w
  15084. @item h
  15085. Set the output video resolution.
  15086. Default resolution depends on formats.
  15087. @item in_stereo
  15088. @item out_stereo
  15089. Set the input/output stereo format.
  15090. @table @samp
  15091. @item 2d
  15092. 2D mono
  15093. @item sbs
  15094. Side by side
  15095. @item tb
  15096. Top bottom
  15097. @end table
  15098. Default value is @b{@samp{2d}} for input and output format.
  15099. @item yaw
  15100. @item pitch
  15101. @item roll
  15102. Set rotation for the output video. Values in degrees.
  15103. @item rorder
  15104. Set rotation order for the output video. Choose one item for each position.
  15105. @table @samp
  15106. @item y, Y
  15107. yaw
  15108. @item p, P
  15109. pitch
  15110. @item r, R
  15111. roll
  15112. @end table
  15113. Default value is @b{@samp{ypr}}.
  15114. @item h_flip
  15115. @item v_flip
  15116. @item d_flip
  15117. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15118. @item ih_flip
  15119. @item iv_flip
  15120. Set if input video is flipped horizontally/vertically. Boolean values.
  15121. @item in_trans
  15122. Set if input video is transposed. Boolean value, by default disabled.
  15123. @item out_trans
  15124. Set if output video needs to be transposed. Boolean value, by default disabled.
  15125. @item alpha_mask
  15126. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15127. @end table
  15128. @subsection Examples
  15129. @itemize
  15130. @item
  15131. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15132. @example
  15133. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15134. @end example
  15135. @item
  15136. Extract back view of Equi-Angular Cubemap:
  15137. @example
  15138. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15139. @end example
  15140. @item
  15141. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15142. @example
  15143. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15144. @end example
  15145. @end itemize
  15146. @subsection Commands
  15147. This filter supports subset of above options as @ref{commands}.
  15148. @section vaguedenoiser
  15149. Apply a wavelet based denoiser.
  15150. It transforms each frame from the video input into the wavelet domain,
  15151. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15152. the obtained coefficients. It does an inverse wavelet transform after.
  15153. Due to wavelet properties, it should give a nice smoothed result, and
  15154. reduced noise, without blurring picture features.
  15155. This filter accepts the following options:
  15156. @table @option
  15157. @item threshold
  15158. The filtering strength. The higher, the more filtered the video will be.
  15159. Hard thresholding can use a higher threshold than soft thresholding
  15160. before the video looks overfiltered. Default value is 2.
  15161. @item method
  15162. The filtering method the filter will use.
  15163. It accepts the following values:
  15164. @table @samp
  15165. @item hard
  15166. All values under the threshold will be zeroed.
  15167. @item soft
  15168. All values under the threshold will be zeroed. All values above will be
  15169. reduced by the threshold.
  15170. @item garrote
  15171. Scales or nullifies coefficients - intermediary between (more) soft and
  15172. (less) hard thresholding.
  15173. @end table
  15174. Default is garrote.
  15175. @item nsteps
  15176. Number of times, the wavelet will decompose the picture. Picture can't
  15177. be decomposed beyond a particular point (typically, 8 for a 640x480
  15178. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15179. @item percent
  15180. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15181. @item planes
  15182. A list of the planes to process. By default all planes are processed.
  15183. @item type
  15184. The threshold type the filter will use.
  15185. It accepts the following values:
  15186. @table @samp
  15187. @item universal
  15188. Threshold used is same for all decompositions.
  15189. @item bayes
  15190. Threshold used depends also on each decomposition coefficients.
  15191. @end table
  15192. Default is universal.
  15193. @end table
  15194. @section vectorscope
  15195. Display 2 color component values in the two dimensional graph (which is called
  15196. a vectorscope).
  15197. This filter accepts the following options:
  15198. @table @option
  15199. @item mode, m
  15200. Set vectorscope mode.
  15201. It accepts the following values:
  15202. @table @samp
  15203. @item gray
  15204. @item tint
  15205. Gray values are displayed on graph, higher brightness means more pixels have
  15206. same component color value on location in graph. This is the default mode.
  15207. @item color
  15208. Gray values are displayed on graph. Surrounding pixels values which are not
  15209. present in video frame are drawn in gradient of 2 color components which are
  15210. set by option @code{x} and @code{y}. The 3rd color component is static.
  15211. @item color2
  15212. Actual color components values present in video frame are displayed on graph.
  15213. @item color3
  15214. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15215. on graph increases value of another color component, which is luminance by
  15216. default values of @code{x} and @code{y}.
  15217. @item color4
  15218. Actual colors present in video frame are displayed on graph. If two different
  15219. colors map to same position on graph then color with higher value of component
  15220. not present in graph is picked.
  15221. @item color5
  15222. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15223. component picked from radial gradient.
  15224. @end table
  15225. @item x
  15226. Set which color component will be represented on X-axis. Default is @code{1}.
  15227. @item y
  15228. Set which color component will be represented on Y-axis. Default is @code{2}.
  15229. @item intensity, i
  15230. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15231. of color component which represents frequency of (X, Y) location in graph.
  15232. @item envelope, e
  15233. @table @samp
  15234. @item none
  15235. No envelope, this is default.
  15236. @item instant
  15237. Instant envelope, even darkest single pixel will be clearly highlighted.
  15238. @item peak
  15239. Hold maximum and minimum values presented in graph over time. This way you
  15240. can still spot out of range values without constantly looking at vectorscope.
  15241. @item peak+instant
  15242. Peak and instant envelope combined together.
  15243. @end table
  15244. @item graticule, g
  15245. Set what kind of graticule to draw.
  15246. @table @samp
  15247. @item none
  15248. @item green
  15249. @item color
  15250. @item invert
  15251. @end table
  15252. @item opacity, o
  15253. Set graticule opacity.
  15254. @item flags, f
  15255. Set graticule flags.
  15256. @table @samp
  15257. @item white
  15258. Draw graticule for white point.
  15259. @item black
  15260. Draw graticule for black point.
  15261. @item name
  15262. Draw color points short names.
  15263. @end table
  15264. @item bgopacity, b
  15265. Set background opacity.
  15266. @item lthreshold, l
  15267. Set low threshold for color component not represented on X or Y axis.
  15268. Values lower than this value will be ignored. Default is 0.
  15269. Note this value is multiplied with actual max possible value one pixel component
  15270. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15271. is 0.1 * 255 = 25.
  15272. @item hthreshold, h
  15273. Set high threshold for color component not represented on X or Y axis.
  15274. Values higher than this value will be ignored. Default is 1.
  15275. Note this value is multiplied with actual max possible value one pixel component
  15276. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15277. is 0.9 * 255 = 230.
  15278. @item colorspace, c
  15279. Set what kind of colorspace to use when drawing graticule.
  15280. @table @samp
  15281. @item auto
  15282. @item 601
  15283. @item 709
  15284. @end table
  15285. Default is auto.
  15286. @item tint0, t0
  15287. @item tint1, t1
  15288. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15289. This means no tint, and output will remain gray.
  15290. @end table
  15291. @anchor{vidstabdetect}
  15292. @section vidstabdetect
  15293. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15294. @ref{vidstabtransform} for pass 2.
  15295. This filter generates a file with relative translation and rotation
  15296. transform information about subsequent frames, which is then used by
  15297. the @ref{vidstabtransform} filter.
  15298. To enable compilation of this filter you need to configure FFmpeg with
  15299. @code{--enable-libvidstab}.
  15300. This filter accepts the following options:
  15301. @table @option
  15302. @item result
  15303. Set the path to the file used to write the transforms information.
  15304. Default value is @file{transforms.trf}.
  15305. @item shakiness
  15306. Set how shaky the video is and how quick the camera is. It accepts an
  15307. integer in the range 1-10, a value of 1 means little shakiness, a
  15308. value of 10 means strong shakiness. Default value is 5.
  15309. @item accuracy
  15310. Set the accuracy of the detection process. It must be a value in the
  15311. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15312. accuracy. Default value is 15.
  15313. @item stepsize
  15314. Set stepsize of the search process. The region around minimum is
  15315. scanned with 1 pixel resolution. Default value is 6.
  15316. @item mincontrast
  15317. Set minimum contrast. Below this value a local measurement field is
  15318. discarded. Must be a floating point value in the range 0-1. Default
  15319. value is 0.3.
  15320. @item tripod
  15321. Set reference frame number for tripod mode.
  15322. If enabled, the motion of the frames is compared to a reference frame
  15323. in the filtered stream, identified by the specified number. The idea
  15324. is to compensate all movements in a more-or-less static scene and keep
  15325. the camera view absolutely still.
  15326. If set to 0, it is disabled. The frames are counted starting from 1.
  15327. @item show
  15328. Show fields and transforms in the resulting frames. It accepts an
  15329. integer in the range 0-2. Default value is 0, which disables any
  15330. visualization.
  15331. @end table
  15332. @subsection Examples
  15333. @itemize
  15334. @item
  15335. Use default values:
  15336. @example
  15337. vidstabdetect
  15338. @end example
  15339. @item
  15340. Analyze strongly shaky movie and put the results in file
  15341. @file{mytransforms.trf}:
  15342. @example
  15343. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15344. @end example
  15345. @item
  15346. Visualize the result of internal transformations in the resulting
  15347. video:
  15348. @example
  15349. vidstabdetect=show=1
  15350. @end example
  15351. @item
  15352. Analyze a video with medium shakiness using @command{ffmpeg}:
  15353. @example
  15354. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15355. @end example
  15356. @end itemize
  15357. @anchor{vidstabtransform}
  15358. @section vidstabtransform
  15359. Video stabilization/deshaking: pass 2 of 2,
  15360. see @ref{vidstabdetect} for pass 1.
  15361. Read a file with transform information for each frame and
  15362. apply/compensate them. Together with the @ref{vidstabdetect}
  15363. filter this can be used to deshake videos. See also
  15364. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15365. the @ref{unsharp} filter, see below.
  15366. To enable compilation of this filter you need to configure FFmpeg with
  15367. @code{--enable-libvidstab}.
  15368. @subsection Options
  15369. @table @option
  15370. @item input
  15371. Set path to the file used to read the transforms. Default value is
  15372. @file{transforms.trf}.
  15373. @item smoothing
  15374. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15375. camera movements. Default value is 10.
  15376. For example a number of 10 means that 21 frames are used (10 in the
  15377. past and 10 in the future) to smoothen the motion in the video. A
  15378. larger value leads to a smoother video, but limits the acceleration of
  15379. the camera (pan/tilt movements). 0 is a special case where a static
  15380. camera is simulated.
  15381. @item optalgo
  15382. Set the camera path optimization algorithm.
  15383. Accepted values are:
  15384. @table @samp
  15385. @item gauss
  15386. gaussian kernel low-pass filter on camera motion (default)
  15387. @item avg
  15388. averaging on transformations
  15389. @end table
  15390. @item maxshift
  15391. Set maximal number of pixels to translate frames. Default value is -1,
  15392. meaning no limit.
  15393. @item maxangle
  15394. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15395. value is -1, meaning no limit.
  15396. @item crop
  15397. Specify how to deal with borders that may be visible due to movement
  15398. compensation.
  15399. Available values are:
  15400. @table @samp
  15401. @item keep
  15402. keep image information from previous frame (default)
  15403. @item black
  15404. fill the border black
  15405. @end table
  15406. @item invert
  15407. Invert transforms if set to 1. Default value is 0.
  15408. @item relative
  15409. Consider transforms as relative to previous frame if set to 1,
  15410. absolute if set to 0. Default value is 0.
  15411. @item zoom
  15412. Set percentage to zoom. A positive value will result in a zoom-in
  15413. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15414. zoom).
  15415. @item optzoom
  15416. Set optimal zooming to avoid borders.
  15417. Accepted values are:
  15418. @table @samp
  15419. @item 0
  15420. disabled
  15421. @item 1
  15422. optimal static zoom value is determined (only very strong movements
  15423. will lead to visible borders) (default)
  15424. @item 2
  15425. optimal adaptive zoom value is determined (no borders will be
  15426. visible), see @option{zoomspeed}
  15427. @end table
  15428. Note that the value given at zoom is added to the one calculated here.
  15429. @item zoomspeed
  15430. Set percent to zoom maximally each frame (enabled when
  15431. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15432. 0.25.
  15433. @item interpol
  15434. Specify type of interpolation.
  15435. Available values are:
  15436. @table @samp
  15437. @item no
  15438. no interpolation
  15439. @item linear
  15440. linear only horizontal
  15441. @item bilinear
  15442. linear in both directions (default)
  15443. @item bicubic
  15444. cubic in both directions (slow)
  15445. @end table
  15446. @item tripod
  15447. Enable virtual tripod mode if set to 1, which is equivalent to
  15448. @code{relative=0:smoothing=0}. Default value is 0.
  15449. Use also @code{tripod} option of @ref{vidstabdetect}.
  15450. @item debug
  15451. Increase log verbosity if set to 1. Also the detected global motions
  15452. are written to the temporary file @file{global_motions.trf}. Default
  15453. value is 0.
  15454. @end table
  15455. @subsection Examples
  15456. @itemize
  15457. @item
  15458. Use @command{ffmpeg} for a typical stabilization with default values:
  15459. @example
  15460. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15461. @end example
  15462. Note the use of the @ref{unsharp} filter which is always recommended.
  15463. @item
  15464. Zoom in a bit more and load transform data from a given file:
  15465. @example
  15466. vidstabtransform=zoom=5:input="mytransforms.trf"
  15467. @end example
  15468. @item
  15469. Smoothen the video even more:
  15470. @example
  15471. vidstabtransform=smoothing=30
  15472. @end example
  15473. @end itemize
  15474. @section vflip
  15475. Flip the input video vertically.
  15476. For example, to vertically flip a video with @command{ffmpeg}:
  15477. @example
  15478. ffmpeg -i in.avi -vf "vflip" out.avi
  15479. @end example
  15480. @section vfrdet
  15481. Detect variable frame rate video.
  15482. This filter tries to detect if the input is variable or constant frame rate.
  15483. At end it will output number of frames detected as having variable delta pts,
  15484. and ones with constant delta pts.
  15485. If there was frames with variable delta, than it will also show min, max and
  15486. average delta encountered.
  15487. @section vibrance
  15488. Boost or alter saturation.
  15489. The filter accepts the following options:
  15490. @table @option
  15491. @item intensity
  15492. Set strength of boost if positive value or strength of alter if negative value.
  15493. Default is 0. Allowed range is from -2 to 2.
  15494. @item rbal
  15495. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15496. @item gbal
  15497. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15498. @item bbal
  15499. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15500. @item rlum
  15501. Set the red luma coefficient.
  15502. @item glum
  15503. Set the green luma coefficient.
  15504. @item blum
  15505. Set the blue luma coefficient.
  15506. @item alternate
  15507. If @code{intensity} is negative and this is set to 1, colors will change,
  15508. otherwise colors will be less saturated, more towards gray.
  15509. @end table
  15510. @subsection Commands
  15511. This filter supports the all above options as @ref{commands}.
  15512. @anchor{vignette}
  15513. @section vignette
  15514. Make or reverse a natural vignetting effect.
  15515. The filter accepts the following options:
  15516. @table @option
  15517. @item angle, a
  15518. Set lens angle expression as a number of radians.
  15519. The value is clipped in the @code{[0,PI/2]} range.
  15520. Default value: @code{"PI/5"}
  15521. @item x0
  15522. @item y0
  15523. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15524. by default.
  15525. @item mode
  15526. Set forward/backward mode.
  15527. Available modes are:
  15528. @table @samp
  15529. @item forward
  15530. The larger the distance from the central point, the darker the image becomes.
  15531. @item backward
  15532. The larger the distance from the central point, the brighter the image becomes.
  15533. This can be used to reverse a vignette effect, though there is no automatic
  15534. detection to extract the lens @option{angle} and other settings (yet). It can
  15535. also be used to create a burning effect.
  15536. @end table
  15537. Default value is @samp{forward}.
  15538. @item eval
  15539. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15540. It accepts the following values:
  15541. @table @samp
  15542. @item init
  15543. Evaluate expressions only once during the filter initialization.
  15544. @item frame
  15545. Evaluate expressions for each incoming frame. This is way slower than the
  15546. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15547. allows advanced dynamic expressions.
  15548. @end table
  15549. Default value is @samp{init}.
  15550. @item dither
  15551. Set dithering to reduce the circular banding effects. Default is @code{1}
  15552. (enabled).
  15553. @item aspect
  15554. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15555. Setting this value to the SAR of the input will make a rectangular vignetting
  15556. following the dimensions of the video.
  15557. Default is @code{1/1}.
  15558. @end table
  15559. @subsection Expressions
  15560. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15561. following parameters.
  15562. @table @option
  15563. @item w
  15564. @item h
  15565. input width and height
  15566. @item n
  15567. the number of input frame, starting from 0
  15568. @item pts
  15569. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15570. @var{TB} units, NAN if undefined
  15571. @item r
  15572. frame rate of the input video, NAN if the input frame rate is unknown
  15573. @item t
  15574. the PTS (Presentation TimeStamp) of the filtered video frame,
  15575. expressed in seconds, NAN if undefined
  15576. @item tb
  15577. time base of the input video
  15578. @end table
  15579. @subsection Examples
  15580. @itemize
  15581. @item
  15582. Apply simple strong vignetting effect:
  15583. @example
  15584. vignette=PI/4
  15585. @end example
  15586. @item
  15587. Make a flickering vignetting:
  15588. @example
  15589. vignette='PI/4+random(1)*PI/50':eval=frame
  15590. @end example
  15591. @end itemize
  15592. @section vmafmotion
  15593. Obtain the average VMAF motion score of a video.
  15594. It is one of the component metrics of VMAF.
  15595. The obtained average motion score is printed through the logging system.
  15596. The filter accepts the following options:
  15597. @table @option
  15598. @item stats_file
  15599. If specified, the filter will use the named file to save the motion score of
  15600. each frame with respect to the previous frame.
  15601. When filename equals "-" the data is sent to standard output.
  15602. @end table
  15603. Example:
  15604. @example
  15605. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15606. @end example
  15607. @section vstack
  15608. Stack input videos vertically.
  15609. All streams must be of same pixel format and of same width.
  15610. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15611. to create same output.
  15612. The filter accepts the following options:
  15613. @table @option
  15614. @item inputs
  15615. Set number of input streams. Default is 2.
  15616. @item shortest
  15617. If set to 1, force the output to terminate when the shortest input
  15618. terminates. Default value is 0.
  15619. @end table
  15620. @section w3fdif
  15621. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15622. Deinterlacing Filter").
  15623. Based on the process described by Martin Weston for BBC R&D, and
  15624. implemented based on the de-interlace algorithm written by Jim
  15625. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15626. uses filter coefficients calculated by BBC R&D.
  15627. This filter uses field-dominance information in frame to decide which
  15628. of each pair of fields to place first in the output.
  15629. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15630. There are two sets of filter coefficients, so called "simple"
  15631. and "complex". Which set of filter coefficients is used can
  15632. be set by passing an optional parameter:
  15633. @table @option
  15634. @item filter
  15635. Set the interlacing filter coefficients. Accepts one of the following values:
  15636. @table @samp
  15637. @item simple
  15638. Simple filter coefficient set.
  15639. @item complex
  15640. More-complex filter coefficient set.
  15641. @end table
  15642. Default value is @samp{complex}.
  15643. @item deint
  15644. Specify which frames to deinterlace. Accepts one of the following values:
  15645. @table @samp
  15646. @item all
  15647. Deinterlace all frames,
  15648. @item interlaced
  15649. Only deinterlace frames marked as interlaced.
  15650. @end table
  15651. Default value is @samp{all}.
  15652. @end table
  15653. @section waveform
  15654. Video waveform monitor.
  15655. The waveform monitor plots color component intensity. By default luminance
  15656. only. Each column of the waveform corresponds to a column of pixels in the
  15657. source video.
  15658. It accepts the following options:
  15659. @table @option
  15660. @item mode, m
  15661. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15662. In row mode, the graph on the left side represents color component value 0 and
  15663. the right side represents value = 255. In column mode, the top side represents
  15664. color component value = 0 and bottom side represents value = 255.
  15665. @item intensity, i
  15666. Set intensity. Smaller values are useful to find out how many values of the same
  15667. luminance are distributed across input rows/columns.
  15668. Default value is @code{0.04}. Allowed range is [0, 1].
  15669. @item mirror, r
  15670. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15671. In mirrored mode, higher values will be represented on the left
  15672. side for @code{row} mode and at the top for @code{column} mode. Default is
  15673. @code{1} (mirrored).
  15674. @item display, d
  15675. Set display mode.
  15676. It accepts the following values:
  15677. @table @samp
  15678. @item overlay
  15679. Presents information identical to that in the @code{parade}, except
  15680. that the graphs representing color components are superimposed directly
  15681. over one another.
  15682. This display mode makes it easier to spot relative differences or similarities
  15683. in overlapping areas of the color components that are supposed to be identical,
  15684. such as neutral whites, grays, or blacks.
  15685. @item stack
  15686. Display separate graph for the color components side by side in
  15687. @code{row} mode or one below the other in @code{column} mode.
  15688. @item parade
  15689. Display separate graph for the color components side by side in
  15690. @code{column} mode or one below the other in @code{row} mode.
  15691. Using this display mode makes it easy to spot color casts in the highlights
  15692. and shadows of an image, by comparing the contours of the top and the bottom
  15693. graphs of each waveform. Since whites, grays, and blacks are characterized
  15694. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15695. should display three waveforms of roughly equal width/height. If not, the
  15696. correction is easy to perform by making level adjustments the three waveforms.
  15697. @end table
  15698. Default is @code{stack}.
  15699. @item components, c
  15700. Set which color components to display. Default is 1, which means only luminance
  15701. or red color component if input is in RGB colorspace. If is set for example to
  15702. 7 it will display all 3 (if) available color components.
  15703. @item envelope, e
  15704. @table @samp
  15705. @item none
  15706. No envelope, this is default.
  15707. @item instant
  15708. Instant envelope, minimum and maximum values presented in graph will be easily
  15709. visible even with small @code{step} value.
  15710. @item peak
  15711. Hold minimum and maximum values presented in graph across time. This way you
  15712. can still spot out of range values without constantly looking at waveforms.
  15713. @item peak+instant
  15714. Peak and instant envelope combined together.
  15715. @end table
  15716. @item filter, f
  15717. @table @samp
  15718. @item lowpass
  15719. No filtering, this is default.
  15720. @item flat
  15721. Luma and chroma combined together.
  15722. @item aflat
  15723. Similar as above, but shows difference between blue and red chroma.
  15724. @item xflat
  15725. Similar as above, but use different colors.
  15726. @item yflat
  15727. Similar as above, but again with different colors.
  15728. @item chroma
  15729. Displays only chroma.
  15730. @item color
  15731. Displays actual color value on waveform.
  15732. @item acolor
  15733. Similar as above, but with luma showing frequency of chroma values.
  15734. @end table
  15735. @item graticule, g
  15736. Set which graticule to display.
  15737. @table @samp
  15738. @item none
  15739. Do not display graticule.
  15740. @item green
  15741. Display green graticule showing legal broadcast ranges.
  15742. @item orange
  15743. Display orange graticule showing legal broadcast ranges.
  15744. @item invert
  15745. Display invert graticule showing legal broadcast ranges.
  15746. @end table
  15747. @item opacity, o
  15748. Set graticule opacity.
  15749. @item flags, fl
  15750. Set graticule flags.
  15751. @table @samp
  15752. @item numbers
  15753. Draw numbers above lines. By default enabled.
  15754. @item dots
  15755. Draw dots instead of lines.
  15756. @end table
  15757. @item scale, s
  15758. Set scale used for displaying graticule.
  15759. @table @samp
  15760. @item digital
  15761. @item millivolts
  15762. @item ire
  15763. @end table
  15764. Default is digital.
  15765. @item bgopacity, b
  15766. Set background opacity.
  15767. @item tint0, t0
  15768. @item tint1, t1
  15769. Set tint for output.
  15770. Only used with lowpass filter and when display is not overlay and input
  15771. pixel formats are not RGB.
  15772. @end table
  15773. @section weave, doubleweave
  15774. The @code{weave} takes a field-based video input and join
  15775. each two sequential fields into single frame, producing a new double
  15776. height clip with half the frame rate and half the frame count.
  15777. The @code{doubleweave} works same as @code{weave} but without
  15778. halving frame rate and frame count.
  15779. It accepts the following option:
  15780. @table @option
  15781. @item first_field
  15782. Set first field. Available values are:
  15783. @table @samp
  15784. @item top, t
  15785. Set the frame as top-field-first.
  15786. @item bottom, b
  15787. Set the frame as bottom-field-first.
  15788. @end table
  15789. @end table
  15790. @subsection Examples
  15791. @itemize
  15792. @item
  15793. Interlace video using @ref{select} and @ref{separatefields} filter:
  15794. @example
  15795. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15796. @end example
  15797. @end itemize
  15798. @section xbr
  15799. Apply the xBR high-quality magnification filter which is designed for pixel
  15800. art. It follows a set of edge-detection rules, see
  15801. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15802. It accepts the following option:
  15803. @table @option
  15804. @item n
  15805. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15806. @code{3xBR} and @code{4} for @code{4xBR}.
  15807. Default is @code{3}.
  15808. @end table
  15809. @section xfade
  15810. Apply cross fade from one input video stream to another input video stream.
  15811. The cross fade is applied for specified duration.
  15812. The filter accepts the following options:
  15813. @table @option
  15814. @item transition
  15815. Set one of available transition effects:
  15816. @table @samp
  15817. @item custom
  15818. @item fade
  15819. @item wipeleft
  15820. @item wiperight
  15821. @item wipeup
  15822. @item wipedown
  15823. @item slideleft
  15824. @item slideright
  15825. @item slideup
  15826. @item slidedown
  15827. @item circlecrop
  15828. @item rectcrop
  15829. @item distance
  15830. @item fadeblack
  15831. @item fadewhite
  15832. @item radial
  15833. @item smoothleft
  15834. @item smoothright
  15835. @item smoothup
  15836. @item smoothdown
  15837. @item circleopen
  15838. @item circleclose
  15839. @item vertopen
  15840. @item vertclose
  15841. @item horzopen
  15842. @item horzclose
  15843. @item dissolve
  15844. @item pixelize
  15845. @item diagtl
  15846. @item diagtr
  15847. @item diagbl
  15848. @item diagbr
  15849. @item hlslice
  15850. @item hrslice
  15851. @item vuslice
  15852. @item vdslice
  15853. @item hblur
  15854. @item fadegrays
  15855. @item wipetl
  15856. @item wipetr
  15857. @item wipebl
  15858. @item wipebr
  15859. @item squeezeh
  15860. @item squeezev
  15861. @end table
  15862. Default transition effect is fade.
  15863. @item duration
  15864. Set cross fade duration in seconds.
  15865. Default duration is 1 second.
  15866. @item offset
  15867. Set cross fade start relative to first input stream in seconds.
  15868. Default offset is 0.
  15869. @item expr
  15870. Set expression for custom transition effect.
  15871. The expressions can use the following variables and functions:
  15872. @table @option
  15873. @item X
  15874. @item Y
  15875. The coordinates of the current sample.
  15876. @item W
  15877. @item H
  15878. The width and height of the image.
  15879. @item P
  15880. Progress of transition effect.
  15881. @item PLANE
  15882. Currently processed plane.
  15883. @item A
  15884. Return value of first input at current location and plane.
  15885. @item B
  15886. Return value of second input at current location and plane.
  15887. @item a0(x, y)
  15888. @item a1(x, y)
  15889. @item a2(x, y)
  15890. @item a3(x, y)
  15891. Return the value of the pixel at location (@var{x},@var{y}) of the
  15892. first/second/third/fourth component of first input.
  15893. @item b0(x, y)
  15894. @item b1(x, y)
  15895. @item b2(x, y)
  15896. @item b3(x, y)
  15897. Return the value of the pixel at location (@var{x},@var{y}) of the
  15898. first/second/third/fourth component of second input.
  15899. @end table
  15900. @end table
  15901. @subsection Examples
  15902. @itemize
  15903. @item
  15904. Cross fade from one input video to another input video, with fade transition and duration of transition
  15905. of 2 seconds starting at offset of 5 seconds:
  15906. @example
  15907. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  15908. @end example
  15909. @end itemize
  15910. @section xmedian
  15911. Pick median pixels from several input videos.
  15912. The filter accepts the following options:
  15913. @table @option
  15914. @item inputs
  15915. Set number of inputs.
  15916. Default is 3. Allowed range is from 3 to 255.
  15917. If number of inputs is even number, than result will be mean value between two median values.
  15918. @item planes
  15919. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15920. @item percentile
  15921. Set median percentile. Default value is @code{0.5}.
  15922. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15923. minimum values, and @code{1} maximum values.
  15924. @end table
  15925. @section xstack
  15926. Stack video inputs into custom layout.
  15927. All streams must be of same pixel format.
  15928. The filter accepts the following options:
  15929. @table @option
  15930. @item inputs
  15931. Set number of input streams. Default is 2.
  15932. @item layout
  15933. Specify layout of inputs.
  15934. This option requires the desired layout configuration to be explicitly set by the user.
  15935. This sets position of each video input in output. Each input
  15936. is separated by '|'.
  15937. The first number represents the column, and the second number represents the row.
  15938. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15939. where X is video input from which to take width or height.
  15940. Multiple values can be used when separated by '+'. In such
  15941. case values are summed together.
  15942. Note that if inputs are of different sizes gaps may appear, as not all of
  15943. the output video frame will be filled. Similarly, videos can overlap each
  15944. other if their position doesn't leave enough space for the full frame of
  15945. adjoining videos.
  15946. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15947. a layout must be set by the user.
  15948. @item shortest
  15949. If set to 1, force the output to terminate when the shortest input
  15950. terminates. Default value is 0.
  15951. @item fill
  15952. If set to valid color, all unused pixels will be filled with that color.
  15953. By default fill is set to none, so it is disabled.
  15954. @end table
  15955. @subsection Examples
  15956. @itemize
  15957. @item
  15958. Display 4 inputs into 2x2 grid.
  15959. Layout:
  15960. @example
  15961. input1(0, 0) | input3(w0, 0)
  15962. input2(0, h0) | input4(w0, h0)
  15963. @end example
  15964. @example
  15965. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15966. @end example
  15967. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15968. @item
  15969. Display 4 inputs into 1x4 grid.
  15970. Layout:
  15971. @example
  15972. input1(0, 0)
  15973. input2(0, h0)
  15974. input3(0, h0+h1)
  15975. input4(0, h0+h1+h2)
  15976. @end example
  15977. @example
  15978. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15979. @end example
  15980. Note that if inputs are of different widths, unused space will appear.
  15981. @item
  15982. Display 9 inputs into 3x3 grid.
  15983. Layout:
  15984. @example
  15985. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15986. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15987. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15988. @end example
  15989. @example
  15990. 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
  15991. @end example
  15992. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15993. @item
  15994. Display 16 inputs into 4x4 grid.
  15995. Layout:
  15996. @example
  15997. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15998. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15999. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16000. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16001. @end example
  16002. @example
  16003. 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|
  16004. 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
  16005. @end example
  16006. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16007. @end itemize
  16008. @anchor{yadif}
  16009. @section yadif
  16010. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16011. filter").
  16012. It accepts the following parameters:
  16013. @table @option
  16014. @item mode
  16015. The interlacing mode to adopt. It accepts one of the following values:
  16016. @table @option
  16017. @item 0, send_frame
  16018. Output one frame for each frame.
  16019. @item 1, send_field
  16020. Output one frame for each field.
  16021. @item 2, send_frame_nospatial
  16022. Like @code{send_frame}, but it skips the spatial interlacing check.
  16023. @item 3, send_field_nospatial
  16024. Like @code{send_field}, but it skips the spatial interlacing check.
  16025. @end table
  16026. The default value is @code{send_frame}.
  16027. @item parity
  16028. The picture field parity assumed for the input interlaced video. It accepts one
  16029. of the following values:
  16030. @table @option
  16031. @item 0, tff
  16032. Assume the top field is first.
  16033. @item 1, bff
  16034. Assume the bottom field is first.
  16035. @item -1, auto
  16036. Enable automatic detection of field parity.
  16037. @end table
  16038. The default value is @code{auto}.
  16039. If the interlacing is unknown or the decoder does not export this information,
  16040. top field first will be assumed.
  16041. @item deint
  16042. Specify which frames to deinterlace. Accepts one of the following
  16043. values:
  16044. @table @option
  16045. @item 0, all
  16046. Deinterlace all frames.
  16047. @item 1, interlaced
  16048. Only deinterlace frames marked as interlaced.
  16049. @end table
  16050. The default value is @code{all}.
  16051. @end table
  16052. @section yadif_cuda
  16053. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16054. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16055. and/or nvenc.
  16056. It accepts the following parameters:
  16057. @table @option
  16058. @item mode
  16059. The interlacing mode to adopt. It accepts one of the following values:
  16060. @table @option
  16061. @item 0, send_frame
  16062. Output one frame for each frame.
  16063. @item 1, send_field
  16064. Output one frame for each field.
  16065. @item 2, send_frame_nospatial
  16066. Like @code{send_frame}, but it skips the spatial interlacing check.
  16067. @item 3, send_field_nospatial
  16068. Like @code{send_field}, but it skips the spatial interlacing check.
  16069. @end table
  16070. The default value is @code{send_frame}.
  16071. @item parity
  16072. The picture field parity assumed for the input interlaced video. It accepts one
  16073. of the following values:
  16074. @table @option
  16075. @item 0, tff
  16076. Assume the top field is first.
  16077. @item 1, bff
  16078. Assume the bottom field is first.
  16079. @item -1, auto
  16080. Enable automatic detection of field parity.
  16081. @end table
  16082. The default value is @code{auto}.
  16083. If the interlacing is unknown or the decoder does not export this information,
  16084. top field first will be assumed.
  16085. @item deint
  16086. Specify which frames to deinterlace. Accepts one of the following
  16087. values:
  16088. @table @option
  16089. @item 0, all
  16090. Deinterlace all frames.
  16091. @item 1, interlaced
  16092. Only deinterlace frames marked as interlaced.
  16093. @end table
  16094. The default value is @code{all}.
  16095. @end table
  16096. @section yaepblur
  16097. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16098. The algorithm is described in
  16099. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16100. It accepts the following parameters:
  16101. @table @option
  16102. @item radius, r
  16103. Set the window radius. Default value is 3.
  16104. @item planes, p
  16105. Set which planes to filter. Default is only the first plane.
  16106. @item sigma, s
  16107. Set blur strength. Default value is 128.
  16108. @end table
  16109. @subsection Commands
  16110. This filter supports same @ref{commands} as options.
  16111. @section zoompan
  16112. Apply Zoom & Pan effect.
  16113. This filter accepts the following options:
  16114. @table @option
  16115. @item zoom, z
  16116. Set the zoom expression. Range is 1-10. Default is 1.
  16117. @item x
  16118. @item y
  16119. Set the x and y expression. Default is 0.
  16120. @item d
  16121. Set the duration expression in number of frames.
  16122. This sets for how many number of frames effect will last for
  16123. single input image.
  16124. @item s
  16125. Set the output image size, default is 'hd720'.
  16126. @item fps
  16127. Set the output frame rate, default is '25'.
  16128. @end table
  16129. Each expression can contain the following constants:
  16130. @table @option
  16131. @item in_w, iw
  16132. Input width.
  16133. @item in_h, ih
  16134. Input height.
  16135. @item out_w, ow
  16136. Output width.
  16137. @item out_h, oh
  16138. Output height.
  16139. @item in
  16140. Input frame count.
  16141. @item on
  16142. Output frame count.
  16143. @item in_time, it
  16144. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16145. @item out_time, time, ot
  16146. The output timestamp expressed in seconds.
  16147. @item x
  16148. @item y
  16149. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16150. for current input frame.
  16151. @item px
  16152. @item py
  16153. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16154. not yet such frame (first input frame).
  16155. @item zoom
  16156. Last calculated zoom from 'z' expression for current input frame.
  16157. @item pzoom
  16158. Last calculated zoom of last output frame of previous input frame.
  16159. @item duration
  16160. Number of output frames for current input frame. Calculated from 'd' expression
  16161. for each input frame.
  16162. @item pduration
  16163. number of output frames created for previous input frame
  16164. @item a
  16165. Rational number: input width / input height
  16166. @item sar
  16167. sample aspect ratio
  16168. @item dar
  16169. display aspect ratio
  16170. @end table
  16171. @subsection Examples
  16172. @itemize
  16173. @item
  16174. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16175. @example
  16176. 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
  16177. @end example
  16178. @item
  16179. Zoom in up to 1.5x and pan always at center of picture:
  16180. @example
  16181. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16182. @end example
  16183. @item
  16184. Same as above but without pausing:
  16185. @example
  16186. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16187. @end example
  16188. @item
  16189. Zoom in 2x into center of picture only for the first second of the input video:
  16190. @example
  16191. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16192. @end example
  16193. @end itemize
  16194. @anchor{zscale}
  16195. @section zscale
  16196. Scale (resize) the input video, using the z.lib library:
  16197. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16198. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16199. The zscale filter forces the output display aspect ratio to be the same
  16200. as the input, by changing the output sample aspect ratio.
  16201. If the input image format is different from the format requested by
  16202. the next filter, the zscale filter will convert the input to the
  16203. requested format.
  16204. @subsection Options
  16205. The filter accepts the following options.
  16206. @table @option
  16207. @item width, w
  16208. @item height, h
  16209. Set the output video dimension expression. Default value is the input
  16210. dimension.
  16211. If the @var{width} or @var{w} value is 0, the input width is used for
  16212. the output. If the @var{height} or @var{h} value is 0, the input height
  16213. is used for the output.
  16214. If one and only one of the values is -n with n >= 1, the zscale filter
  16215. will use a value that maintains the aspect ratio of the input image,
  16216. calculated from the other specified dimension. After that it will,
  16217. however, make sure that the calculated dimension is divisible by n and
  16218. adjust the value if necessary.
  16219. If both values are -n with n >= 1, the behavior will be identical to
  16220. both values being set to 0 as previously detailed.
  16221. See below for the list of accepted constants for use in the dimension
  16222. expression.
  16223. @item size, s
  16224. Set the video size. For the syntax of this option, check the
  16225. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16226. @item dither, d
  16227. Set the dither type.
  16228. Possible values are:
  16229. @table @var
  16230. @item none
  16231. @item ordered
  16232. @item random
  16233. @item error_diffusion
  16234. @end table
  16235. Default is none.
  16236. @item filter, f
  16237. Set the resize filter type.
  16238. Possible values are:
  16239. @table @var
  16240. @item point
  16241. @item bilinear
  16242. @item bicubic
  16243. @item spline16
  16244. @item spline36
  16245. @item lanczos
  16246. @end table
  16247. Default is bilinear.
  16248. @item range, r
  16249. Set the color range.
  16250. Possible values are:
  16251. @table @var
  16252. @item input
  16253. @item limited
  16254. @item full
  16255. @end table
  16256. Default is same as input.
  16257. @item primaries, p
  16258. Set the color primaries.
  16259. Possible values are:
  16260. @table @var
  16261. @item input
  16262. @item 709
  16263. @item unspecified
  16264. @item 170m
  16265. @item 240m
  16266. @item 2020
  16267. @end table
  16268. Default is same as input.
  16269. @item transfer, t
  16270. Set the transfer characteristics.
  16271. Possible values are:
  16272. @table @var
  16273. @item input
  16274. @item 709
  16275. @item unspecified
  16276. @item 601
  16277. @item linear
  16278. @item 2020_10
  16279. @item 2020_12
  16280. @item smpte2084
  16281. @item iec61966-2-1
  16282. @item arib-std-b67
  16283. @end table
  16284. Default is same as input.
  16285. @item matrix, m
  16286. Set the colorspace matrix.
  16287. Possible value are:
  16288. @table @var
  16289. @item input
  16290. @item 709
  16291. @item unspecified
  16292. @item 470bg
  16293. @item 170m
  16294. @item 2020_ncl
  16295. @item 2020_cl
  16296. @end table
  16297. Default is same as input.
  16298. @item rangein, rin
  16299. Set the input color range.
  16300. Possible values are:
  16301. @table @var
  16302. @item input
  16303. @item limited
  16304. @item full
  16305. @end table
  16306. Default is same as input.
  16307. @item primariesin, pin
  16308. Set the input color primaries.
  16309. Possible values are:
  16310. @table @var
  16311. @item input
  16312. @item 709
  16313. @item unspecified
  16314. @item 170m
  16315. @item 240m
  16316. @item 2020
  16317. @end table
  16318. Default is same as input.
  16319. @item transferin, tin
  16320. Set the input transfer characteristics.
  16321. Possible values are:
  16322. @table @var
  16323. @item input
  16324. @item 709
  16325. @item unspecified
  16326. @item 601
  16327. @item linear
  16328. @item 2020_10
  16329. @item 2020_12
  16330. @end table
  16331. Default is same as input.
  16332. @item matrixin, min
  16333. Set the input colorspace matrix.
  16334. Possible value are:
  16335. @table @var
  16336. @item input
  16337. @item 709
  16338. @item unspecified
  16339. @item 470bg
  16340. @item 170m
  16341. @item 2020_ncl
  16342. @item 2020_cl
  16343. @end table
  16344. @item chromal, c
  16345. Set the output chroma location.
  16346. Possible values are:
  16347. @table @var
  16348. @item input
  16349. @item left
  16350. @item center
  16351. @item topleft
  16352. @item top
  16353. @item bottomleft
  16354. @item bottom
  16355. @end table
  16356. @item chromalin, cin
  16357. Set the input chroma location.
  16358. Possible values are:
  16359. @table @var
  16360. @item input
  16361. @item left
  16362. @item center
  16363. @item topleft
  16364. @item top
  16365. @item bottomleft
  16366. @item bottom
  16367. @end table
  16368. @item npl
  16369. Set the nominal peak luminance.
  16370. @end table
  16371. The values of the @option{w} and @option{h} options are expressions
  16372. containing the following constants:
  16373. @table @var
  16374. @item in_w
  16375. @item in_h
  16376. The input width and height
  16377. @item iw
  16378. @item ih
  16379. These are the same as @var{in_w} and @var{in_h}.
  16380. @item out_w
  16381. @item out_h
  16382. The output (scaled) width and height
  16383. @item ow
  16384. @item oh
  16385. These are the same as @var{out_w} and @var{out_h}
  16386. @item a
  16387. The same as @var{iw} / @var{ih}
  16388. @item sar
  16389. input sample aspect ratio
  16390. @item dar
  16391. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16392. @item hsub
  16393. @item vsub
  16394. horizontal and vertical input chroma subsample values. For example for the
  16395. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16396. @item ohsub
  16397. @item ovsub
  16398. horizontal and vertical output chroma subsample values. For example for the
  16399. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16400. @end table
  16401. @subsection Commands
  16402. This filter supports the following commands:
  16403. @table @option
  16404. @item width, w
  16405. @item height, h
  16406. Set the output video dimension expression.
  16407. The command accepts the same syntax of the corresponding option.
  16408. If the specified expression is not valid, it is kept at its current
  16409. value.
  16410. @end table
  16411. @c man end VIDEO FILTERS
  16412. @chapter OpenCL Video Filters
  16413. @c man begin OPENCL VIDEO FILTERS
  16414. Below is a description of the currently available OpenCL video filters.
  16415. To enable compilation of these filters you need to configure FFmpeg with
  16416. @code{--enable-opencl}.
  16417. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16418. @table @option
  16419. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16420. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16421. given device parameters.
  16422. @item -filter_hw_device @var{name}
  16423. Pass the hardware device called @var{name} to all filters in any filter graph.
  16424. @end table
  16425. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16426. @itemize
  16427. @item
  16428. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16429. @example
  16430. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16431. @end example
  16432. @end itemize
  16433. 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.
  16434. @section avgblur_opencl
  16435. Apply average blur filter.
  16436. The filter accepts the following options:
  16437. @table @option
  16438. @item sizeX
  16439. Set horizontal radius size.
  16440. Range is @code{[1, 1024]} and default value is @code{1}.
  16441. @item planes
  16442. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16443. @item sizeY
  16444. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16445. @end table
  16446. @subsection Example
  16447. @itemize
  16448. @item
  16449. 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.
  16450. @example
  16451. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16452. @end example
  16453. @end itemize
  16454. @section boxblur_opencl
  16455. Apply a boxblur algorithm to the input video.
  16456. It accepts the following parameters:
  16457. @table @option
  16458. @item luma_radius, lr
  16459. @item luma_power, lp
  16460. @item chroma_radius, cr
  16461. @item chroma_power, cp
  16462. @item alpha_radius, ar
  16463. @item alpha_power, ap
  16464. @end table
  16465. A description of the accepted options follows.
  16466. @table @option
  16467. @item luma_radius, lr
  16468. @item chroma_radius, cr
  16469. @item alpha_radius, ar
  16470. Set an expression for the box radius in pixels used for blurring the
  16471. corresponding input plane.
  16472. The radius value must be a non-negative number, and must not be
  16473. greater than the value of the expression @code{min(w,h)/2} for the
  16474. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16475. planes.
  16476. Default value for @option{luma_radius} is "2". If not specified,
  16477. @option{chroma_radius} and @option{alpha_radius} default to the
  16478. corresponding value set for @option{luma_radius}.
  16479. The expressions can contain the following constants:
  16480. @table @option
  16481. @item w
  16482. @item h
  16483. The input width and height in pixels.
  16484. @item cw
  16485. @item ch
  16486. The input chroma image width and height in pixels.
  16487. @item hsub
  16488. @item vsub
  16489. The horizontal and vertical chroma subsample values. For example, for the
  16490. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16491. @end table
  16492. @item luma_power, lp
  16493. @item chroma_power, cp
  16494. @item alpha_power, ap
  16495. Specify how many times the boxblur filter is applied to the
  16496. corresponding plane.
  16497. Default value for @option{luma_power} is 2. If not specified,
  16498. @option{chroma_power} and @option{alpha_power} default to the
  16499. corresponding value set for @option{luma_power}.
  16500. A value of 0 will disable the effect.
  16501. @end table
  16502. @subsection Examples
  16503. 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.
  16504. @itemize
  16505. @item
  16506. Apply a boxblur filter with the luma, chroma, and alpha radius
  16507. 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.
  16508. @example
  16509. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16510. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16511. @end example
  16512. @item
  16513. 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.
  16514. For the luma plane, a 2x2 box radius will be run once.
  16515. For the chroma plane, a 4x4 box radius will be run 5 times.
  16516. For the alpha plane, a 3x3 box radius will be run 7 times.
  16517. @example
  16518. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16519. @end example
  16520. @end itemize
  16521. @section colorkey_opencl
  16522. RGB colorspace color keying.
  16523. The filter accepts the following options:
  16524. @table @option
  16525. @item color
  16526. The color which will be replaced with transparency.
  16527. @item similarity
  16528. Similarity percentage with the key color.
  16529. 0.01 matches only the exact key color, while 1.0 matches everything.
  16530. @item blend
  16531. Blend percentage.
  16532. 0.0 makes pixels either fully transparent, or not transparent at all.
  16533. Higher values result in semi-transparent pixels, with a higher transparency
  16534. the more similar the pixels color is to the key color.
  16535. @end table
  16536. @subsection Examples
  16537. @itemize
  16538. @item
  16539. Make every semi-green pixel in the input transparent with some slight blending:
  16540. @example
  16541. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16542. @end example
  16543. @end itemize
  16544. @section convolution_opencl
  16545. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16546. The filter accepts the following options:
  16547. @table @option
  16548. @item 0m
  16549. @item 1m
  16550. @item 2m
  16551. @item 3m
  16552. Set matrix for each plane.
  16553. Matrix is sequence of 9, 25 or 49 signed numbers.
  16554. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16555. @item 0rdiv
  16556. @item 1rdiv
  16557. @item 2rdiv
  16558. @item 3rdiv
  16559. Set multiplier for calculated value for each plane.
  16560. If unset or 0, it will be sum of all matrix elements.
  16561. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16562. @item 0bias
  16563. @item 1bias
  16564. @item 2bias
  16565. @item 3bias
  16566. Set bias for each plane. This value is added to the result of the multiplication.
  16567. Useful for making the overall image brighter or darker.
  16568. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16569. @end table
  16570. @subsection Examples
  16571. @itemize
  16572. @item
  16573. Apply sharpen:
  16574. @example
  16575. -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
  16576. @end example
  16577. @item
  16578. Apply blur:
  16579. @example
  16580. -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
  16581. @end example
  16582. @item
  16583. Apply edge enhance:
  16584. @example
  16585. -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
  16586. @end example
  16587. @item
  16588. Apply edge detect:
  16589. @example
  16590. -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
  16591. @end example
  16592. @item
  16593. Apply laplacian edge detector which includes diagonals:
  16594. @example
  16595. -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
  16596. @end example
  16597. @item
  16598. Apply emboss:
  16599. @example
  16600. -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
  16601. @end example
  16602. @end itemize
  16603. @section erosion_opencl
  16604. Apply erosion effect to the video.
  16605. This filter replaces the pixel by the local(3x3) minimum.
  16606. It accepts the following options:
  16607. @table @option
  16608. @item threshold0
  16609. @item threshold1
  16610. @item threshold2
  16611. @item threshold3
  16612. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16613. If @code{0}, plane will remain unchanged.
  16614. @item coordinates
  16615. Flag which specifies the pixel to refer to.
  16616. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16617. Flags to local 3x3 coordinates region centered on @code{x}:
  16618. 1 2 3
  16619. 4 x 5
  16620. 6 7 8
  16621. @end table
  16622. @subsection Example
  16623. @itemize
  16624. @item
  16625. 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.
  16626. @example
  16627. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16628. @end example
  16629. @end itemize
  16630. @section deshake_opencl
  16631. Feature-point based video stabilization filter.
  16632. The filter accepts the following options:
  16633. @table @option
  16634. @item tripod
  16635. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16636. @item debug
  16637. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16638. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16639. Viewing point matches in the output video is only supported for RGB input.
  16640. Defaults to @code{0}.
  16641. @item adaptive_crop
  16642. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16643. Defaults to @code{1}.
  16644. @item refine_features
  16645. Whether or not feature points should be refined at a sub-pixel level.
  16646. This can be turned off for a slight performance gain at the cost of precision.
  16647. Defaults to @code{1}.
  16648. @item smooth_strength
  16649. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16650. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16651. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16652. Defaults to @code{0.0}.
  16653. @item smooth_window_multiplier
  16654. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16655. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16656. Acceptable values range from @code{0.1} to @code{10.0}.
  16657. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16658. potentially improving smoothness, but also increase latency and memory usage.
  16659. Defaults to @code{2.0}.
  16660. @end table
  16661. @subsection Examples
  16662. @itemize
  16663. @item
  16664. Stabilize a video with a fixed, medium smoothing strength:
  16665. @example
  16666. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16667. @end example
  16668. @item
  16669. Stabilize a video with debugging (both in console and in rendered video):
  16670. @example
  16671. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16672. @end example
  16673. @end itemize
  16674. @section dilation_opencl
  16675. Apply dilation effect to the video.
  16676. This filter replaces the pixel by the local(3x3) maximum.
  16677. It accepts the following options:
  16678. @table @option
  16679. @item threshold0
  16680. @item threshold1
  16681. @item threshold2
  16682. @item threshold3
  16683. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16684. If @code{0}, plane will remain unchanged.
  16685. @item coordinates
  16686. Flag which specifies the pixel to refer to.
  16687. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16688. Flags to local 3x3 coordinates region centered on @code{x}:
  16689. 1 2 3
  16690. 4 x 5
  16691. 6 7 8
  16692. @end table
  16693. @subsection Example
  16694. @itemize
  16695. @item
  16696. 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.
  16697. @example
  16698. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16699. @end example
  16700. @end itemize
  16701. @section nlmeans_opencl
  16702. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16703. @section overlay_opencl
  16704. Overlay one video on top of another.
  16705. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16706. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16707. The filter accepts the following options:
  16708. @table @option
  16709. @item x
  16710. Set the x coordinate of the overlaid video on the main video.
  16711. Default value is @code{0}.
  16712. @item y
  16713. Set the y coordinate of the overlaid video on the main video.
  16714. Default value is @code{0}.
  16715. @end table
  16716. @subsection Examples
  16717. @itemize
  16718. @item
  16719. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16720. @example
  16721. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16722. @end example
  16723. @item
  16724. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16725. @example
  16726. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16727. @end example
  16728. @end itemize
  16729. @section pad_opencl
  16730. Add paddings to the input image, and place the original input at the
  16731. provided @var{x}, @var{y} coordinates.
  16732. It accepts the following options:
  16733. @table @option
  16734. @item width, w
  16735. @item height, h
  16736. Specify an expression for the size of the output image with the
  16737. paddings added. If the value for @var{width} or @var{height} is 0, the
  16738. corresponding input size is used for the output.
  16739. The @var{width} expression can reference the value set by the
  16740. @var{height} expression, and vice versa.
  16741. The default value of @var{width} and @var{height} is 0.
  16742. @item x
  16743. @item y
  16744. Specify the offsets to place the input image at within the padded area,
  16745. with respect to the top/left border of the output image.
  16746. The @var{x} expression can reference the value set by the @var{y}
  16747. expression, and vice versa.
  16748. The default value of @var{x} and @var{y} is 0.
  16749. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16750. so the input image is centered on the padded area.
  16751. @item color
  16752. Specify the color of the padded area. For the syntax of this option,
  16753. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16754. manual,ffmpeg-utils}.
  16755. @item aspect
  16756. Pad to an aspect instead to a resolution.
  16757. @end table
  16758. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16759. options are expressions containing the following constants:
  16760. @table @option
  16761. @item in_w
  16762. @item in_h
  16763. The input video width and height.
  16764. @item iw
  16765. @item ih
  16766. These are the same as @var{in_w} and @var{in_h}.
  16767. @item out_w
  16768. @item out_h
  16769. The output width and height (the size of the padded area), as
  16770. specified by the @var{width} and @var{height} expressions.
  16771. @item ow
  16772. @item oh
  16773. These are the same as @var{out_w} and @var{out_h}.
  16774. @item x
  16775. @item y
  16776. The x and y offsets as specified by the @var{x} and @var{y}
  16777. expressions, or NAN if not yet specified.
  16778. @item a
  16779. same as @var{iw} / @var{ih}
  16780. @item sar
  16781. input sample aspect ratio
  16782. @item dar
  16783. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16784. @end table
  16785. @section prewitt_opencl
  16786. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16787. The filter accepts the following option:
  16788. @table @option
  16789. @item planes
  16790. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16791. @item scale
  16792. Set value which will be multiplied with filtered result.
  16793. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16794. @item delta
  16795. Set value which will be added to filtered result.
  16796. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16797. @end table
  16798. @subsection Example
  16799. @itemize
  16800. @item
  16801. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16802. @example
  16803. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16804. @end example
  16805. @end itemize
  16806. @anchor{program_opencl}
  16807. @section program_opencl
  16808. Filter video using an OpenCL program.
  16809. @table @option
  16810. @item source
  16811. OpenCL program source file.
  16812. @item kernel
  16813. Kernel name in program.
  16814. @item inputs
  16815. Number of inputs to the filter. Defaults to 1.
  16816. @item size, s
  16817. Size of output frames. Defaults to the same as the first input.
  16818. @end table
  16819. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16820. The program source file must contain a kernel function with the given name,
  16821. which will be run once for each plane of the output. Each run on a plane
  16822. gets enqueued as a separate 2D global NDRange with one work-item for each
  16823. pixel to be generated. The global ID offset for each work-item is therefore
  16824. the coordinates of a pixel in the destination image.
  16825. The kernel function needs to take the following arguments:
  16826. @itemize
  16827. @item
  16828. Destination image, @var{__write_only image2d_t}.
  16829. This image will become the output; the kernel should write all of it.
  16830. @item
  16831. Frame index, @var{unsigned int}.
  16832. This is a counter starting from zero and increasing by one for each frame.
  16833. @item
  16834. Source images, @var{__read_only image2d_t}.
  16835. These are the most recent images on each input. The kernel may read from
  16836. them to generate the output, but they can't be written to.
  16837. @end itemize
  16838. Example programs:
  16839. @itemize
  16840. @item
  16841. Copy the input to the output (output must be the same size as the input).
  16842. @verbatim
  16843. __kernel void copy(__write_only image2d_t destination,
  16844. unsigned int index,
  16845. __read_only image2d_t source)
  16846. {
  16847. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  16848. int2 location = (int2)(get_global_id(0), get_global_id(1));
  16849. float4 value = read_imagef(source, sampler, location);
  16850. write_imagef(destination, location, value);
  16851. }
  16852. @end verbatim
  16853. @item
  16854. Apply a simple transformation, rotating the input by an amount increasing
  16855. with the index counter. Pixel values are linearly interpolated by the
  16856. sampler, and the output need not have the same dimensions as the input.
  16857. @verbatim
  16858. __kernel void rotate_image(__write_only image2d_t dst,
  16859. unsigned int index,
  16860. __read_only image2d_t src)
  16861. {
  16862. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16863. CLK_FILTER_LINEAR);
  16864. float angle = (float)index / 100.0f;
  16865. float2 dst_dim = convert_float2(get_image_dim(dst));
  16866. float2 src_dim = convert_float2(get_image_dim(src));
  16867. float2 dst_cen = dst_dim / 2.0f;
  16868. float2 src_cen = src_dim / 2.0f;
  16869. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16870. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  16871. float2 src_pos = {
  16872. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  16873. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  16874. };
  16875. src_pos = src_pos * src_dim / dst_dim;
  16876. float2 src_loc = src_pos + src_cen;
  16877. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  16878. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  16879. write_imagef(dst, dst_loc, 0.5f);
  16880. else
  16881. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  16882. }
  16883. @end verbatim
  16884. @item
  16885. Blend two inputs together, with the amount of each input used varying
  16886. with the index counter.
  16887. @verbatim
  16888. __kernel void blend_images(__write_only image2d_t dst,
  16889. unsigned int index,
  16890. __read_only image2d_t src1,
  16891. __read_only image2d_t src2)
  16892. {
  16893. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  16894. CLK_FILTER_LINEAR);
  16895. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  16896. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  16897. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  16898. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  16899. float4 val1 = read_imagef(src1, sampler, src1_loc);
  16900. float4 val2 = read_imagef(src2, sampler, src2_loc);
  16901. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  16902. }
  16903. @end verbatim
  16904. @end itemize
  16905. @section roberts_opencl
  16906. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  16907. The filter accepts the following option:
  16908. @table @option
  16909. @item planes
  16910. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16911. @item scale
  16912. Set value which will be multiplied with filtered result.
  16913. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16914. @item delta
  16915. Set value which will be added to filtered result.
  16916. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16917. @end table
  16918. @subsection Example
  16919. @itemize
  16920. @item
  16921. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  16922. @example
  16923. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16924. @end example
  16925. @end itemize
  16926. @section sobel_opencl
  16927. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  16928. The filter accepts the following option:
  16929. @table @option
  16930. @item planes
  16931. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16932. @item scale
  16933. Set value which will be multiplied with filtered result.
  16934. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16935. @item delta
  16936. Set value which will be added to filtered result.
  16937. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16938. @end table
  16939. @subsection Example
  16940. @itemize
  16941. @item
  16942. Apply sobel operator with scale set to 2 and delta set to 10
  16943. @example
  16944. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16945. @end example
  16946. @end itemize
  16947. @section tonemap_opencl
  16948. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  16949. It accepts the following parameters:
  16950. @table @option
  16951. @item tonemap
  16952. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  16953. @item param
  16954. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  16955. @item desat
  16956. Apply desaturation for highlights that exceed this level of brightness. The
  16957. higher the parameter, the more color information will be preserved. This
  16958. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16959. (smoothly) turning into white instead. This makes images feel more natural,
  16960. at the cost of reducing information about out-of-range colors.
  16961. The default value is 0.5, and the algorithm here is a little different from
  16962. the cpu version tonemap currently. A setting of 0.0 disables this option.
  16963. @item threshold
  16964. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  16965. is used to detect whether the scene has changed or not. If the distance between
  16966. the current frame average brightness and the current running average exceeds
  16967. a threshold value, we would re-calculate scene average and peak brightness.
  16968. The default value is 0.2.
  16969. @item format
  16970. Specify the output pixel format.
  16971. Currently supported formats are:
  16972. @table @var
  16973. @item p010
  16974. @item nv12
  16975. @end table
  16976. @item range, r
  16977. Set the output color range.
  16978. Possible values are:
  16979. @table @var
  16980. @item tv/mpeg
  16981. @item pc/jpeg
  16982. @end table
  16983. Default is same as input.
  16984. @item primaries, p
  16985. Set the output color primaries.
  16986. Possible values are:
  16987. @table @var
  16988. @item bt709
  16989. @item bt2020
  16990. @end table
  16991. Default is same as input.
  16992. @item transfer, t
  16993. Set the output transfer characteristics.
  16994. Possible values are:
  16995. @table @var
  16996. @item bt709
  16997. @item bt2020
  16998. @end table
  16999. Default is bt709.
  17000. @item matrix, m
  17001. Set the output colorspace matrix.
  17002. Possible value are:
  17003. @table @var
  17004. @item bt709
  17005. @item bt2020
  17006. @end table
  17007. Default is same as input.
  17008. @end table
  17009. @subsection Example
  17010. @itemize
  17011. @item
  17012. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17013. @example
  17014. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17015. @end example
  17016. @end itemize
  17017. @section unsharp_opencl
  17018. Sharpen or blur the input video.
  17019. It accepts the following parameters:
  17020. @table @option
  17021. @item luma_msize_x, lx
  17022. Set the luma matrix horizontal size.
  17023. Range is @code{[1, 23]} and default value is @code{5}.
  17024. @item luma_msize_y, ly
  17025. Set the luma matrix vertical size.
  17026. Range is @code{[1, 23]} and default value is @code{5}.
  17027. @item luma_amount, la
  17028. Set the luma effect strength.
  17029. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17030. Negative values will blur the input video, while positive values will
  17031. sharpen it, a value of zero will disable the effect.
  17032. @item chroma_msize_x, cx
  17033. Set the chroma matrix horizontal size.
  17034. Range is @code{[1, 23]} and default value is @code{5}.
  17035. @item chroma_msize_y, cy
  17036. Set the chroma matrix vertical size.
  17037. Range is @code{[1, 23]} and default value is @code{5}.
  17038. @item chroma_amount, ca
  17039. Set the chroma effect strength.
  17040. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17041. Negative values will blur the input video, while positive values will
  17042. sharpen it, a value of zero will disable the effect.
  17043. @end table
  17044. All parameters are optional and default to the equivalent of the
  17045. string '5:5:1.0:5:5:0.0'.
  17046. @subsection Examples
  17047. @itemize
  17048. @item
  17049. Apply strong luma sharpen effect:
  17050. @example
  17051. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17052. @end example
  17053. @item
  17054. Apply a strong blur of both luma and chroma parameters:
  17055. @example
  17056. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17057. @end example
  17058. @end itemize
  17059. @section xfade_opencl
  17060. Cross fade two videos with custom transition effect by using OpenCL.
  17061. It accepts the following options:
  17062. @table @option
  17063. @item transition
  17064. Set one of possible transition effects.
  17065. @table @option
  17066. @item custom
  17067. Select custom transition effect, the actual transition description
  17068. will be picked from source and kernel options.
  17069. @item fade
  17070. @item wipeleft
  17071. @item wiperight
  17072. @item wipeup
  17073. @item wipedown
  17074. @item slideleft
  17075. @item slideright
  17076. @item slideup
  17077. @item slidedown
  17078. Default transition is fade.
  17079. @end table
  17080. @item source
  17081. OpenCL program source file for custom transition.
  17082. @item kernel
  17083. Set name of kernel to use for custom transition from program source file.
  17084. @item duration
  17085. Set duration of video transition.
  17086. @item offset
  17087. Set time of start of transition relative to first video.
  17088. @end table
  17089. The program source file must contain a kernel function with the given name,
  17090. which will be run once for each plane of the output. Each run on a plane
  17091. gets enqueued as a separate 2D global NDRange with one work-item for each
  17092. pixel to be generated. The global ID offset for each work-item is therefore
  17093. the coordinates of a pixel in the destination image.
  17094. The kernel function needs to take the following arguments:
  17095. @itemize
  17096. @item
  17097. Destination image, @var{__write_only image2d_t}.
  17098. This image will become the output; the kernel should write all of it.
  17099. @item
  17100. First Source image, @var{__read_only image2d_t}.
  17101. Second Source image, @var{__read_only image2d_t}.
  17102. These are the most recent images on each input. The kernel may read from
  17103. them to generate the output, but they can't be written to.
  17104. @item
  17105. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17106. @end itemize
  17107. Example programs:
  17108. @itemize
  17109. @item
  17110. Apply dots curtain transition effect:
  17111. @verbatim
  17112. __kernel void blend_images(__write_only image2d_t dst,
  17113. __read_only image2d_t src1,
  17114. __read_only image2d_t src2,
  17115. float progress)
  17116. {
  17117. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17118. CLK_FILTER_LINEAR);
  17119. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17120. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17121. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17122. rp = rp / dim;
  17123. float2 dots = (float2)(20.0, 20.0);
  17124. float2 center = (float2)(0,0);
  17125. float2 unused;
  17126. float4 val1 = read_imagef(src1, sampler, p);
  17127. float4 val2 = read_imagef(src2, sampler, p);
  17128. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17129. write_imagef(dst, p, next ? val1 : val2);
  17130. }
  17131. @end verbatim
  17132. @end itemize
  17133. @c man end OPENCL VIDEO FILTERS
  17134. @chapter VAAPI Video Filters
  17135. @c man begin VAAPI VIDEO FILTERS
  17136. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17137. To enable compilation of these filters you need to configure FFmpeg with
  17138. @code{--enable-vaapi}.
  17139. 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}
  17140. @section tonemap_vaapi
  17141. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17142. It maps the dynamic range of HDR10 content to the SDR content.
  17143. It currently only accepts HDR10 as input.
  17144. It accepts the following parameters:
  17145. @table @option
  17146. @item format
  17147. Specify the output pixel format.
  17148. Currently supported formats are:
  17149. @table @var
  17150. @item p010
  17151. @item nv12
  17152. @end table
  17153. Default is nv12.
  17154. @item primaries, p
  17155. Set the output color primaries.
  17156. Default is same as input.
  17157. @item transfer, t
  17158. Set the output transfer characteristics.
  17159. Default is bt709.
  17160. @item matrix, m
  17161. Set the output colorspace matrix.
  17162. Default is same as input.
  17163. @end table
  17164. @subsection Example
  17165. @itemize
  17166. @item
  17167. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17168. @example
  17169. tonemap_vaapi=format=p010:t=bt2020-10
  17170. @end example
  17171. @end itemize
  17172. @c man end VAAPI VIDEO FILTERS
  17173. @chapter Video Sources
  17174. @c man begin VIDEO SOURCES
  17175. Below is a description of the currently available video sources.
  17176. @section buffer
  17177. Buffer video frames, and make them available to the filter chain.
  17178. This source is mainly intended for a programmatic use, in particular
  17179. through the interface defined in @file{libavfilter/buffersrc.h}.
  17180. It accepts the following parameters:
  17181. @table @option
  17182. @item video_size
  17183. Specify the size (width and height) of the buffered video frames. For the
  17184. syntax of this option, check the
  17185. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17186. @item width
  17187. The input video width.
  17188. @item height
  17189. The input video height.
  17190. @item pix_fmt
  17191. A string representing the pixel format of the buffered video frames.
  17192. It may be a number corresponding to a pixel format, or a pixel format
  17193. name.
  17194. @item time_base
  17195. Specify the timebase assumed by the timestamps of the buffered frames.
  17196. @item frame_rate
  17197. Specify the frame rate expected for the video stream.
  17198. @item pixel_aspect, sar
  17199. The sample (pixel) aspect ratio of the input video.
  17200. @item sws_param
  17201. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17202. to the filtergraph description to specify swscale flags for automatically
  17203. inserted scalers. See @ref{Filtergraph syntax}.
  17204. @item hw_frames_ctx
  17205. When using a hardware pixel format, this should be a reference to an
  17206. AVHWFramesContext describing input frames.
  17207. @end table
  17208. For example:
  17209. @example
  17210. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17211. @end example
  17212. will instruct the source to accept video frames with size 320x240 and
  17213. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17214. square pixels (1:1 sample aspect ratio).
  17215. Since the pixel format with name "yuv410p" corresponds to the number 6
  17216. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17217. this example corresponds to:
  17218. @example
  17219. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17220. @end example
  17221. Alternatively, the options can be specified as a flat string, but this
  17222. syntax is deprecated:
  17223. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17224. @section cellauto
  17225. Create a pattern generated by an elementary cellular automaton.
  17226. The initial state of the cellular automaton can be defined through the
  17227. @option{filename} and @option{pattern} options. If such options are
  17228. not specified an initial state is created randomly.
  17229. At each new frame a new row in the video is filled with the result of
  17230. the cellular automaton next generation. The behavior when the whole
  17231. frame is filled is defined by the @option{scroll} option.
  17232. This source accepts the following options:
  17233. @table @option
  17234. @item filename, f
  17235. Read the initial cellular automaton state, i.e. the starting row, from
  17236. the specified file.
  17237. In the file, each non-whitespace character is considered an alive
  17238. cell, a newline will terminate the row, and further characters in the
  17239. file will be ignored.
  17240. @item pattern, p
  17241. Read the initial cellular automaton state, i.e. the starting row, from
  17242. the specified string.
  17243. Each non-whitespace character in the string is considered an alive
  17244. cell, a newline will terminate the row, and further characters in the
  17245. string will be ignored.
  17246. @item rate, r
  17247. Set the video rate, that is the number of frames generated per second.
  17248. Default is 25.
  17249. @item random_fill_ratio, ratio
  17250. Set the random fill ratio for the initial cellular automaton row. It
  17251. is a floating point number value ranging from 0 to 1, defaults to
  17252. 1/PHI.
  17253. This option is ignored when a file or a pattern is specified.
  17254. @item random_seed, seed
  17255. Set the seed for filling randomly the initial row, must be an integer
  17256. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17257. set to -1, the filter will try to use a good random seed on a best
  17258. effort basis.
  17259. @item rule
  17260. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17261. Default value is 110.
  17262. @item size, s
  17263. Set the size of the output video. For the syntax of this option, check the
  17264. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17265. If @option{filename} or @option{pattern} is specified, the size is set
  17266. by default to the width of the specified initial state row, and the
  17267. height is set to @var{width} * PHI.
  17268. If @option{size} is set, it must contain the width of the specified
  17269. pattern string, and the specified pattern will be centered in the
  17270. larger row.
  17271. If a filename or a pattern string is not specified, the size value
  17272. defaults to "320x518" (used for a randomly generated initial state).
  17273. @item scroll
  17274. If set to 1, scroll the output upward when all the rows in the output
  17275. have been already filled. If set to 0, the new generated row will be
  17276. written over the top row just after the bottom row is filled.
  17277. Defaults to 1.
  17278. @item start_full, full
  17279. If set to 1, completely fill the output with generated rows before
  17280. outputting the first frame.
  17281. This is the default behavior, for disabling set the value to 0.
  17282. @item stitch
  17283. If set to 1, stitch the left and right row edges together.
  17284. This is the default behavior, for disabling set the value to 0.
  17285. @end table
  17286. @subsection Examples
  17287. @itemize
  17288. @item
  17289. Read the initial state from @file{pattern}, and specify an output of
  17290. size 200x400.
  17291. @example
  17292. cellauto=f=pattern:s=200x400
  17293. @end example
  17294. @item
  17295. Generate a random initial row with a width of 200 cells, with a fill
  17296. ratio of 2/3:
  17297. @example
  17298. cellauto=ratio=2/3:s=200x200
  17299. @end example
  17300. @item
  17301. Create a pattern generated by rule 18 starting by a single alive cell
  17302. centered on an initial row with width 100:
  17303. @example
  17304. cellauto=p=@@:s=100x400:full=0:rule=18
  17305. @end example
  17306. @item
  17307. Specify a more elaborated initial pattern:
  17308. @example
  17309. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17310. @end example
  17311. @end itemize
  17312. @anchor{coreimagesrc}
  17313. @section coreimagesrc
  17314. Video source generated on GPU using Apple's CoreImage API on OSX.
  17315. This video source is a specialized version of the @ref{coreimage} video filter.
  17316. Use a core image generator at the beginning of the applied filterchain to
  17317. generate the content.
  17318. The coreimagesrc video source accepts the following options:
  17319. @table @option
  17320. @item list_generators
  17321. List all available generators along with all their respective options as well as
  17322. possible minimum and maximum values along with the default values.
  17323. @example
  17324. list_generators=true
  17325. @end example
  17326. @item size, s
  17327. Specify the size of the sourced video. For the syntax of this option, check the
  17328. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17329. The default value is @code{320x240}.
  17330. @item rate, r
  17331. Specify the frame rate of the sourced video, as the number of frames
  17332. generated per second. It has to be a string in the format
  17333. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17334. number or a valid video frame rate abbreviation. The default value is
  17335. "25".
  17336. @item sar
  17337. Set the sample aspect ratio of the sourced video.
  17338. @item duration, d
  17339. Set the duration of the sourced video. See
  17340. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17341. for the accepted syntax.
  17342. If not specified, or the expressed duration is negative, the video is
  17343. supposed to be generated forever.
  17344. @end table
  17345. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17346. A complete filterchain can be used for further processing of the
  17347. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17348. and examples for details.
  17349. @subsection Examples
  17350. @itemize
  17351. @item
  17352. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17353. given as complete and escaped command-line for Apple's standard bash shell:
  17354. @example
  17355. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17356. @end example
  17357. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17358. need for a nullsrc video source.
  17359. @end itemize
  17360. @section gradients
  17361. Generate several gradients.
  17362. @table @option
  17363. @item size, s
  17364. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17365. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17366. @item rate, r
  17367. Set frame rate, expressed as number of frames per second. Default
  17368. value is "25".
  17369. @item c0, c1, c2, c3, c4, c5, c6, c7
  17370. Set 8 colors. Default values for colors is to pick random one.
  17371. @item x0, y0, y0, y1
  17372. Set gradient line source and destination points. If negative or out of range, random ones
  17373. are picked.
  17374. @item nb_colors, n
  17375. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17376. @item seed
  17377. Set seed for picking gradient line points.
  17378. @item duration, d
  17379. Set the duration of the sourced video. See
  17380. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17381. for the accepted syntax.
  17382. If not specified, or the expressed duration is negative, the video is
  17383. supposed to be generated forever.
  17384. @item speed
  17385. Set speed of gradients rotation.
  17386. @end table
  17387. @section mandelbrot
  17388. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17389. point specified with @var{start_x} and @var{start_y}.
  17390. This source accepts the following options:
  17391. @table @option
  17392. @item end_pts
  17393. Set the terminal pts value. Default value is 400.
  17394. @item end_scale
  17395. Set the terminal scale value.
  17396. Must be a floating point value. Default value is 0.3.
  17397. @item inner
  17398. Set the inner coloring mode, that is the algorithm used to draw the
  17399. Mandelbrot fractal internal region.
  17400. It shall assume one of the following values:
  17401. @table @option
  17402. @item black
  17403. Set black mode.
  17404. @item convergence
  17405. Show time until convergence.
  17406. @item mincol
  17407. Set color based on point closest to the origin of the iterations.
  17408. @item period
  17409. Set period mode.
  17410. @end table
  17411. Default value is @var{mincol}.
  17412. @item bailout
  17413. Set the bailout value. Default value is 10.0.
  17414. @item maxiter
  17415. Set the maximum of iterations performed by the rendering
  17416. algorithm. Default value is 7189.
  17417. @item outer
  17418. Set outer coloring mode.
  17419. It shall assume one of following values:
  17420. @table @option
  17421. @item iteration_count
  17422. Set iteration count mode.
  17423. @item normalized_iteration_count
  17424. set normalized iteration count mode.
  17425. @end table
  17426. Default value is @var{normalized_iteration_count}.
  17427. @item rate, r
  17428. Set frame rate, expressed as number of frames per second. Default
  17429. value is "25".
  17430. @item size, s
  17431. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17432. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17433. @item start_scale
  17434. Set the initial scale value. Default value is 3.0.
  17435. @item start_x
  17436. Set the initial x position. Must be a floating point value between
  17437. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17438. @item start_y
  17439. Set the initial y position. Must be a floating point value between
  17440. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17441. @end table
  17442. @section mptestsrc
  17443. Generate various test patterns, as generated by the MPlayer test filter.
  17444. The size of the generated video is fixed, and is 256x256.
  17445. This source is useful in particular for testing encoding features.
  17446. This source accepts the following options:
  17447. @table @option
  17448. @item rate, r
  17449. Specify the frame rate of the sourced video, as the number of frames
  17450. generated per second. It has to be a string in the format
  17451. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17452. number or a valid video frame rate abbreviation. The default value is
  17453. "25".
  17454. @item duration, d
  17455. Set the duration of the sourced video. See
  17456. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17457. for the accepted syntax.
  17458. If not specified, or the expressed duration is negative, the video is
  17459. supposed to be generated forever.
  17460. @item test, t
  17461. Set the number or the name of the test to perform. Supported tests are:
  17462. @table @option
  17463. @item dc_luma
  17464. @item dc_chroma
  17465. @item freq_luma
  17466. @item freq_chroma
  17467. @item amp_luma
  17468. @item amp_chroma
  17469. @item cbp
  17470. @item mv
  17471. @item ring1
  17472. @item ring2
  17473. @item all
  17474. @item max_frames, m
  17475. Set the maximum number of frames generated for each test, default value is 30.
  17476. @end table
  17477. Default value is "all", which will cycle through the list of all tests.
  17478. @end table
  17479. Some examples:
  17480. @example
  17481. mptestsrc=t=dc_luma
  17482. @end example
  17483. will generate a "dc_luma" test pattern.
  17484. @section frei0r_src
  17485. Provide a frei0r source.
  17486. To enable compilation of this filter you need to install the frei0r
  17487. header and configure FFmpeg with @code{--enable-frei0r}.
  17488. This source accepts the following parameters:
  17489. @table @option
  17490. @item size
  17491. The size of the video to generate. For the syntax of this option, check the
  17492. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17493. @item framerate
  17494. The framerate of the generated video. It may be a string of the form
  17495. @var{num}/@var{den} or a frame rate abbreviation.
  17496. @item filter_name
  17497. The name to the frei0r source to load. For more information regarding frei0r and
  17498. how to set the parameters, read the @ref{frei0r} section in the video filters
  17499. documentation.
  17500. @item filter_params
  17501. A '|'-separated list of parameters to pass to the frei0r source.
  17502. @end table
  17503. For example, to generate a frei0r partik0l source with size 200x200
  17504. and frame rate 10 which is overlaid on the overlay filter main input:
  17505. @example
  17506. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17507. @end example
  17508. @section life
  17509. Generate a life pattern.
  17510. This source is based on a generalization of John Conway's life game.
  17511. The sourced input represents a life grid, each pixel represents a cell
  17512. which can be in one of two possible states, alive or dead. Every cell
  17513. interacts with its eight neighbours, which are the cells that are
  17514. horizontally, vertically, or diagonally adjacent.
  17515. At each interaction the grid evolves according to the adopted rule,
  17516. which specifies the number of neighbor alive cells which will make a
  17517. cell stay alive or born. The @option{rule} option allows one to specify
  17518. the rule to adopt.
  17519. This source accepts the following options:
  17520. @table @option
  17521. @item filename, f
  17522. Set the file from which to read the initial grid state. In the file,
  17523. each non-whitespace character is considered an alive cell, and newline
  17524. is used to delimit the end of each row.
  17525. If this option is not specified, the initial grid is generated
  17526. randomly.
  17527. @item rate, r
  17528. Set the video rate, that is the number of frames generated per second.
  17529. Default is 25.
  17530. @item random_fill_ratio, ratio
  17531. Set the random fill ratio for the initial random grid. It is a
  17532. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17533. It is ignored when a file is specified.
  17534. @item random_seed, seed
  17535. Set the seed for filling the initial random grid, must be an integer
  17536. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17537. set to -1, the filter will try to use a good random seed on a best
  17538. effort basis.
  17539. @item rule
  17540. Set the life rule.
  17541. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17542. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17543. @var{NS} specifies the number of alive neighbor cells which make a
  17544. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17545. which make a dead cell to become alive (i.e. to "born").
  17546. "s" and "b" can be used in place of "S" and "B", respectively.
  17547. Alternatively a rule can be specified by an 18-bits integer. The 9
  17548. high order bits are used to encode the next cell state if it is alive
  17549. for each number of neighbor alive cells, the low order bits specify
  17550. the rule for "borning" new cells. Higher order bits encode for an
  17551. higher number of neighbor cells.
  17552. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17553. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17554. Default value is "S23/B3", which is the original Conway's game of life
  17555. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17556. cells, and will born a new cell if there are three alive cells around
  17557. a dead cell.
  17558. @item size, s
  17559. Set the size of the output video. For the syntax of this option, check the
  17560. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17561. If @option{filename} is specified, the size is set by default to the
  17562. same size of the input file. If @option{size} is set, it must contain
  17563. the size specified in the input file, and the initial grid defined in
  17564. that file is centered in the larger resulting area.
  17565. If a filename is not specified, the size value defaults to "320x240"
  17566. (used for a randomly generated initial grid).
  17567. @item stitch
  17568. If set to 1, stitch the left and right grid edges together, and the
  17569. top and bottom edges also. Defaults to 1.
  17570. @item mold
  17571. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17572. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17573. value from 0 to 255.
  17574. @item life_color
  17575. Set the color of living (or new born) cells.
  17576. @item death_color
  17577. Set the color of dead cells. If @option{mold} is set, this is the first color
  17578. used to represent a dead cell.
  17579. @item mold_color
  17580. Set mold color, for definitely dead and moldy cells.
  17581. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17582. ffmpeg-utils manual,ffmpeg-utils}.
  17583. @end table
  17584. @subsection Examples
  17585. @itemize
  17586. @item
  17587. Read a grid from @file{pattern}, and center it on a grid of size
  17588. 300x300 pixels:
  17589. @example
  17590. life=f=pattern:s=300x300
  17591. @end example
  17592. @item
  17593. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17594. @example
  17595. life=ratio=2/3:s=200x200
  17596. @end example
  17597. @item
  17598. Specify a custom rule for evolving a randomly generated grid:
  17599. @example
  17600. life=rule=S14/B34
  17601. @end example
  17602. @item
  17603. Full example with slow death effect (mold) using @command{ffplay}:
  17604. @example
  17605. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17606. @end example
  17607. @end itemize
  17608. @anchor{allrgb}
  17609. @anchor{allyuv}
  17610. @anchor{color}
  17611. @anchor{haldclutsrc}
  17612. @anchor{nullsrc}
  17613. @anchor{pal75bars}
  17614. @anchor{pal100bars}
  17615. @anchor{rgbtestsrc}
  17616. @anchor{smptebars}
  17617. @anchor{smptehdbars}
  17618. @anchor{testsrc}
  17619. @anchor{testsrc2}
  17620. @anchor{yuvtestsrc}
  17621. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17622. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17623. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17624. The @code{color} source provides an uniformly colored input.
  17625. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17626. @ref{haldclut} filter.
  17627. The @code{nullsrc} source returns unprocessed video frames. It is
  17628. mainly useful to be employed in analysis / debugging tools, or as the
  17629. source for filters which ignore the input data.
  17630. The @code{pal75bars} source generates a color bars pattern, based on
  17631. EBU PAL recommendations with 75% color levels.
  17632. The @code{pal100bars} source generates a color bars pattern, based on
  17633. EBU PAL recommendations with 100% color levels.
  17634. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17635. detecting RGB vs BGR issues. You should see a red, green and blue
  17636. stripe from top to bottom.
  17637. The @code{smptebars} source generates a color bars pattern, based on
  17638. the SMPTE Engineering Guideline EG 1-1990.
  17639. The @code{smptehdbars} source generates a color bars pattern, based on
  17640. the SMPTE RP 219-2002.
  17641. The @code{testsrc} source generates a test video pattern, showing a
  17642. color pattern, a scrolling gradient and a timestamp. This is mainly
  17643. intended for testing purposes.
  17644. The @code{testsrc2} source is similar to testsrc, but supports more
  17645. pixel formats instead of just @code{rgb24}. This allows using it as an
  17646. input for other tests without requiring a format conversion.
  17647. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17648. see a y, cb and cr stripe from top to bottom.
  17649. The sources accept the following parameters:
  17650. @table @option
  17651. @item level
  17652. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17653. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17654. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17655. coded on a @code{1/(N*N)} scale.
  17656. @item color, c
  17657. Specify the color of the source, only available in the @code{color}
  17658. source. For the syntax of this option, check the
  17659. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17660. @item size, s
  17661. Specify the size of the sourced video. For the syntax of this option, check the
  17662. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17663. The default value is @code{320x240}.
  17664. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17665. @code{haldclutsrc} filters.
  17666. @item rate, r
  17667. Specify the frame rate of the sourced video, as the number of frames
  17668. generated per second. It has to be a string in the format
  17669. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17670. number or a valid video frame rate abbreviation. The default value is
  17671. "25".
  17672. @item duration, d
  17673. Set the duration of the sourced video. See
  17674. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17675. for the accepted syntax.
  17676. If not specified, or the expressed duration is negative, the video is
  17677. supposed to be generated forever.
  17678. Since the frame rate is used as time base, all frames including the last one
  17679. will have their full duration. If the specified duration is not a multiple
  17680. of the frame duration, it will be rounded up.
  17681. @item sar
  17682. Set the sample aspect ratio of the sourced video.
  17683. @item alpha
  17684. Specify the alpha (opacity) of the background, only available in the
  17685. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17686. 255 (fully opaque, the default).
  17687. @item decimals, n
  17688. Set the number of decimals to show in the timestamp, only available in the
  17689. @code{testsrc} source.
  17690. The displayed timestamp value will correspond to the original
  17691. timestamp value multiplied by the power of 10 of the specified
  17692. value. Default value is 0.
  17693. @end table
  17694. @subsection Examples
  17695. @itemize
  17696. @item
  17697. Generate a video with a duration of 5.3 seconds, with size
  17698. 176x144 and a frame rate of 10 frames per second:
  17699. @example
  17700. testsrc=duration=5.3:size=qcif:rate=10
  17701. @end example
  17702. @item
  17703. The following graph description will generate a red source
  17704. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17705. frames per second:
  17706. @example
  17707. color=c=red@@0.2:s=qcif:r=10
  17708. @end example
  17709. @item
  17710. If the input content is to be ignored, @code{nullsrc} can be used. The
  17711. following command generates noise in the luminance plane by employing
  17712. the @code{geq} filter:
  17713. @example
  17714. nullsrc=s=256x256, geq=random(1)*255:128:128
  17715. @end example
  17716. @end itemize
  17717. @subsection Commands
  17718. The @code{color} source supports the following commands:
  17719. @table @option
  17720. @item c, color
  17721. Set the color of the created image. Accepts the same syntax of the
  17722. corresponding @option{color} option.
  17723. @end table
  17724. @section openclsrc
  17725. Generate video using an OpenCL program.
  17726. @table @option
  17727. @item source
  17728. OpenCL program source file.
  17729. @item kernel
  17730. Kernel name in program.
  17731. @item size, s
  17732. Size of frames to generate. This must be set.
  17733. @item format
  17734. Pixel format to use for the generated frames. This must be set.
  17735. @item rate, r
  17736. Number of frames generated every second. Default value is '25'.
  17737. @end table
  17738. For details of how the program loading works, see the @ref{program_opencl}
  17739. filter.
  17740. Example programs:
  17741. @itemize
  17742. @item
  17743. Generate a colour ramp by setting pixel values from the position of the pixel
  17744. in the output image. (Note that this will work with all pixel formats, but
  17745. the generated output will not be the same.)
  17746. @verbatim
  17747. __kernel void ramp(__write_only image2d_t dst,
  17748. unsigned int index)
  17749. {
  17750. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17751. float4 val;
  17752. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17753. write_imagef(dst, loc, val);
  17754. }
  17755. @end verbatim
  17756. @item
  17757. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17758. @verbatim
  17759. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17760. unsigned int index)
  17761. {
  17762. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17763. float4 value = 0.0f;
  17764. int x = loc.x + index;
  17765. int y = loc.y + index;
  17766. while (x > 0 || y > 0) {
  17767. if (x % 3 == 1 && y % 3 == 1) {
  17768. value = 1.0f;
  17769. break;
  17770. }
  17771. x /= 3;
  17772. y /= 3;
  17773. }
  17774. write_imagef(dst, loc, value);
  17775. }
  17776. @end verbatim
  17777. @end itemize
  17778. @section sierpinski
  17779. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17780. This source accepts the following options:
  17781. @table @option
  17782. @item size, s
  17783. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17784. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17785. @item rate, r
  17786. Set frame rate, expressed as number of frames per second. Default
  17787. value is "25".
  17788. @item seed
  17789. Set seed which is used for random panning.
  17790. @item jump
  17791. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17792. @item type
  17793. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17794. @end table
  17795. @c man end VIDEO SOURCES
  17796. @chapter Video Sinks
  17797. @c man begin VIDEO SINKS
  17798. Below is a description of the currently available video sinks.
  17799. @section buffersink
  17800. Buffer video frames, and make them available to the end of the filter
  17801. graph.
  17802. This sink is mainly intended for programmatic use, in particular
  17803. through the interface defined in @file{libavfilter/buffersink.h}
  17804. or the options system.
  17805. It accepts a pointer to an AVBufferSinkContext structure, which
  17806. defines the incoming buffers' formats, to be passed as the opaque
  17807. parameter to @code{avfilter_init_filter} for initialization.
  17808. @section nullsink
  17809. Null video sink: do absolutely nothing with the input video. It is
  17810. mainly useful as a template and for use in analysis / debugging
  17811. tools.
  17812. @c man end VIDEO SINKS
  17813. @chapter Multimedia Filters
  17814. @c man begin MULTIMEDIA FILTERS
  17815. Below is a description of the currently available multimedia filters.
  17816. @section abitscope
  17817. Convert input audio to a video output, displaying the audio bit scope.
  17818. The filter accepts the following options:
  17819. @table @option
  17820. @item rate, r
  17821. Set frame rate, expressed as number of frames per second. Default
  17822. value is "25".
  17823. @item size, s
  17824. Specify the video size for the output. For the syntax of this option, check the
  17825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17826. Default value is @code{1024x256}.
  17827. @item colors
  17828. Specify list of colors separated by space or by '|' which will be used to
  17829. draw channels. Unrecognized or missing colors will be replaced
  17830. by white color.
  17831. @end table
  17832. @section adrawgraph
  17833. Draw a graph using input audio metadata.
  17834. See @ref{drawgraph}
  17835. @section agraphmonitor
  17836. See @ref{graphmonitor}.
  17837. @section ahistogram
  17838. Convert input audio to a video output, displaying the volume histogram.
  17839. The filter accepts the following options:
  17840. @table @option
  17841. @item dmode
  17842. Specify how histogram is calculated.
  17843. It accepts the following values:
  17844. @table @samp
  17845. @item single
  17846. Use single histogram for all channels.
  17847. @item separate
  17848. Use separate histogram for each channel.
  17849. @end table
  17850. Default is @code{single}.
  17851. @item rate, r
  17852. Set frame rate, expressed as number of frames per second. Default
  17853. value is "25".
  17854. @item size, s
  17855. Specify the video size for the output. For the syntax of this option, check the
  17856. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17857. Default value is @code{hd720}.
  17858. @item scale
  17859. Set display scale.
  17860. It accepts the following values:
  17861. @table @samp
  17862. @item log
  17863. logarithmic
  17864. @item sqrt
  17865. square root
  17866. @item cbrt
  17867. cubic root
  17868. @item lin
  17869. linear
  17870. @item rlog
  17871. reverse logarithmic
  17872. @end table
  17873. Default is @code{log}.
  17874. @item ascale
  17875. Set amplitude scale.
  17876. It accepts the following values:
  17877. @table @samp
  17878. @item log
  17879. logarithmic
  17880. @item lin
  17881. linear
  17882. @end table
  17883. Default is @code{log}.
  17884. @item acount
  17885. Set how much frames to accumulate in histogram.
  17886. Default is 1. Setting this to -1 accumulates all frames.
  17887. @item rheight
  17888. Set histogram ratio of window height.
  17889. @item slide
  17890. Set sonogram sliding.
  17891. It accepts the following values:
  17892. @table @samp
  17893. @item replace
  17894. replace old rows with new ones.
  17895. @item scroll
  17896. scroll from top to bottom.
  17897. @end table
  17898. Default is @code{replace}.
  17899. @end table
  17900. @section aphasemeter
  17901. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  17902. representing mean phase of current audio frame. A video output can also be produced and is
  17903. enabled by default. The audio is passed through as first output.
  17904. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  17905. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  17906. and @code{1} means channels are in phase.
  17907. The filter accepts the following options, all related to its video output:
  17908. @table @option
  17909. @item rate, r
  17910. Set the output frame rate. Default value is @code{25}.
  17911. @item size, s
  17912. Set the video size for the output. For the syntax of this option, check the
  17913. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17914. Default value is @code{800x400}.
  17915. @item rc
  17916. @item gc
  17917. @item bc
  17918. Specify the red, green, blue contrast. Default values are @code{2},
  17919. @code{7} and @code{1}.
  17920. Allowed range is @code{[0, 255]}.
  17921. @item mpc
  17922. Set color which will be used for drawing median phase. If color is
  17923. @code{none} which is default, no median phase value will be drawn.
  17924. @item video
  17925. Enable video output. Default is enabled.
  17926. @end table
  17927. @subsection phasing detection
  17928. The filter also detects out of phase and mono sequences in stereo streams.
  17929. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  17930. The filter accepts the following options for this detection:
  17931. @table @option
  17932. @item phasing
  17933. Enable mono and out of phase detection. Default is disabled.
  17934. @item tolerance, t
  17935. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  17936. Allowed range is @code{[0, 1]}.
  17937. @item angle, a
  17938. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  17939. Allowed range is @code{[90, 180]}.
  17940. @item duration, d
  17941. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  17942. @end table
  17943. @subsection Examples
  17944. @itemize
  17945. @item
  17946. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  17947. @example
  17948. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  17949. @end example
  17950. @end itemize
  17951. @section avectorscope
  17952. Convert input audio to a video output, representing the audio vector
  17953. scope.
  17954. The filter is used to measure the difference between channels of stereo
  17955. audio stream. A monaural signal, consisting of identical left and right
  17956. signal, results in straight vertical line. Any stereo separation is visible
  17957. as a deviation from this line, creating a Lissajous figure.
  17958. If the straight (or deviation from it) but horizontal line appears this
  17959. indicates that the left and right channels are out of phase.
  17960. The filter accepts the following options:
  17961. @table @option
  17962. @item mode, m
  17963. Set the vectorscope mode.
  17964. Available values are:
  17965. @table @samp
  17966. @item lissajous
  17967. Lissajous rotated by 45 degrees.
  17968. @item lissajous_xy
  17969. Same as above but not rotated.
  17970. @item polar
  17971. Shape resembling half of circle.
  17972. @end table
  17973. Default value is @samp{lissajous}.
  17974. @item size, s
  17975. Set the video size for the output. For the syntax of this option, check the
  17976. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17977. Default value is @code{400x400}.
  17978. @item rate, r
  17979. Set the output frame rate. Default value is @code{25}.
  17980. @item rc
  17981. @item gc
  17982. @item bc
  17983. @item ac
  17984. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  17985. @code{160}, @code{80} and @code{255}.
  17986. Allowed range is @code{[0, 255]}.
  17987. @item rf
  17988. @item gf
  17989. @item bf
  17990. @item af
  17991. Specify the red, green, blue and alpha fade. Default values are @code{15},
  17992. @code{10}, @code{5} and @code{5}.
  17993. Allowed range is @code{[0, 255]}.
  17994. @item zoom
  17995. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  17996. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  17997. @item draw
  17998. Set the vectorscope drawing mode.
  17999. Available values are:
  18000. @table @samp
  18001. @item dot
  18002. Draw dot for each sample.
  18003. @item line
  18004. Draw line between previous and current sample.
  18005. @end table
  18006. Default value is @samp{dot}.
  18007. @item scale
  18008. Specify amplitude scale of audio samples.
  18009. Available values are:
  18010. @table @samp
  18011. @item lin
  18012. Linear.
  18013. @item sqrt
  18014. Square root.
  18015. @item cbrt
  18016. Cubic root.
  18017. @item log
  18018. Logarithmic.
  18019. @end table
  18020. @item swap
  18021. Swap left channel axis with right channel axis.
  18022. @item mirror
  18023. Mirror axis.
  18024. @table @samp
  18025. @item none
  18026. No mirror.
  18027. @item x
  18028. Mirror only x axis.
  18029. @item y
  18030. Mirror only y axis.
  18031. @item xy
  18032. Mirror both axis.
  18033. @end table
  18034. @end table
  18035. @subsection Examples
  18036. @itemize
  18037. @item
  18038. Complete example using @command{ffplay}:
  18039. @example
  18040. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18041. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18042. @end example
  18043. @end itemize
  18044. @section bench, abench
  18045. Benchmark part of a filtergraph.
  18046. The filter accepts the following options:
  18047. @table @option
  18048. @item action
  18049. Start or stop a timer.
  18050. Available values are:
  18051. @table @samp
  18052. @item start
  18053. Get the current time, set it as frame metadata (using the key
  18054. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18055. @item stop
  18056. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18057. the input frame metadata to get the time difference. Time difference, average,
  18058. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18059. @code{min}) are then printed. The timestamps are expressed in seconds.
  18060. @end table
  18061. @end table
  18062. @subsection Examples
  18063. @itemize
  18064. @item
  18065. Benchmark @ref{selectivecolor} filter:
  18066. @example
  18067. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18068. @end example
  18069. @end itemize
  18070. @section concat
  18071. Concatenate audio and video streams, joining them together one after the
  18072. other.
  18073. The filter works on segments of synchronized video and audio streams. All
  18074. segments must have the same number of streams of each type, and that will
  18075. also be the number of streams at output.
  18076. The filter accepts the following options:
  18077. @table @option
  18078. @item n
  18079. Set the number of segments. Default is 2.
  18080. @item v
  18081. Set the number of output video streams, that is also the number of video
  18082. streams in each segment. Default is 1.
  18083. @item a
  18084. Set the number of output audio streams, that is also the number of audio
  18085. streams in each segment. Default is 0.
  18086. @item unsafe
  18087. Activate unsafe mode: do not fail if segments have a different format.
  18088. @end table
  18089. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18090. @var{a} audio outputs.
  18091. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18092. segment, in the same order as the outputs, then the inputs for the second
  18093. segment, etc.
  18094. Related streams do not always have exactly the same duration, for various
  18095. reasons including codec frame size or sloppy authoring. For that reason,
  18096. related synchronized streams (e.g. a video and its audio track) should be
  18097. concatenated at once. The concat filter will use the duration of the longest
  18098. stream in each segment (except the last one), and if necessary pad shorter
  18099. audio streams with silence.
  18100. For this filter to work correctly, all segments must start at timestamp 0.
  18101. All corresponding streams must have the same parameters in all segments; the
  18102. filtering system will automatically select a common pixel format for video
  18103. streams, and a common sample format, sample rate and channel layout for
  18104. audio streams, but other settings, such as resolution, must be converted
  18105. explicitly by the user.
  18106. Different frame rates are acceptable but will result in variable frame rate
  18107. at output; be sure to configure the output file to handle it.
  18108. @subsection Examples
  18109. @itemize
  18110. @item
  18111. Concatenate an opening, an episode and an ending, all in bilingual version
  18112. (video in stream 0, audio in streams 1 and 2):
  18113. @example
  18114. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18115. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18116. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18117. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18118. @end example
  18119. @item
  18120. Concatenate two parts, handling audio and video separately, using the
  18121. (a)movie sources, and adjusting the resolution:
  18122. @example
  18123. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18124. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18125. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18126. @end example
  18127. Note that a desync will happen at the stitch if the audio and video streams
  18128. do not have exactly the same duration in the first file.
  18129. @end itemize
  18130. @subsection Commands
  18131. This filter supports the following commands:
  18132. @table @option
  18133. @item next
  18134. Close the current segment and step to the next one
  18135. @end table
  18136. @anchor{ebur128}
  18137. @section ebur128
  18138. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18139. level. By default, it logs a message at a frequency of 10Hz with the
  18140. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18141. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18142. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18143. sample format is double-precision floating point. The input stream will be converted to
  18144. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18145. after this filter to obtain the original parameters.
  18146. The filter also has a video output (see the @var{video} option) with a real
  18147. time graph to observe the loudness evolution. The graphic contains the logged
  18148. message mentioned above, so it is not printed anymore when this option is set,
  18149. unless the verbose logging is set. The main graphing area contains the
  18150. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18151. the momentary loudness (400 milliseconds), but can optionally be configured
  18152. to instead display short-term loudness (see @var{gauge}).
  18153. The green area marks a +/- 1LU target range around the target loudness
  18154. (-23LUFS by default, unless modified through @var{target}).
  18155. More information about the Loudness Recommendation EBU R128 on
  18156. @url{http://tech.ebu.ch/loudness}.
  18157. The filter accepts the following options:
  18158. @table @option
  18159. @item video
  18160. Activate the video output. The audio stream is passed unchanged whether this
  18161. option is set or no. The video stream will be the first output stream if
  18162. activated. Default is @code{0}.
  18163. @item size
  18164. Set the video size. This option is for video only. For the syntax of this
  18165. option, check the
  18166. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18167. Default and minimum resolution is @code{640x480}.
  18168. @item meter
  18169. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18170. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18171. other integer value between this range is allowed.
  18172. @item metadata
  18173. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18174. into 100ms output frames, each of them containing various loudness information
  18175. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18176. Default is @code{0}.
  18177. @item framelog
  18178. Force the frame logging level.
  18179. Available values are:
  18180. @table @samp
  18181. @item info
  18182. information logging level
  18183. @item verbose
  18184. verbose logging level
  18185. @end table
  18186. By default, the logging level is set to @var{info}. If the @option{video} or
  18187. the @option{metadata} options are set, it switches to @var{verbose}.
  18188. @item peak
  18189. Set peak mode(s).
  18190. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18191. values are:
  18192. @table @samp
  18193. @item none
  18194. Disable any peak mode (default).
  18195. @item sample
  18196. Enable sample-peak mode.
  18197. Simple peak mode looking for the higher sample value. It logs a message
  18198. for sample-peak (identified by @code{SPK}).
  18199. @item true
  18200. Enable true-peak mode.
  18201. If enabled, the peak lookup is done on an over-sampled version of the input
  18202. stream for better peak accuracy. It logs a message for true-peak.
  18203. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18204. This mode requires a build with @code{libswresample}.
  18205. @end table
  18206. @item dualmono
  18207. Treat mono input files as "dual mono". If a mono file is intended for playback
  18208. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18209. If set to @code{true}, this option will compensate for this effect.
  18210. Multi-channel input files are not affected by this option.
  18211. @item panlaw
  18212. Set a specific pan law to be used for the measurement of dual mono files.
  18213. This parameter is optional, and has a default value of -3.01dB.
  18214. @item target
  18215. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18216. This parameter is optional and has a default value of -23LUFS as specified
  18217. by EBU R128. However, material published online may prefer a level of -16LUFS
  18218. (e.g. for use with podcasts or video platforms).
  18219. @item gauge
  18220. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18221. @code{shortterm}. By default the momentary value will be used, but in certain
  18222. scenarios it may be more useful to observe the short term value instead (e.g.
  18223. live mixing).
  18224. @item scale
  18225. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18226. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18227. video output, not the summary or continuous log output.
  18228. @end table
  18229. @subsection Examples
  18230. @itemize
  18231. @item
  18232. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18233. @example
  18234. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18235. @end example
  18236. @item
  18237. Run an analysis with @command{ffmpeg}:
  18238. @example
  18239. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18240. @end example
  18241. @end itemize
  18242. @section interleave, ainterleave
  18243. Temporally interleave frames from several inputs.
  18244. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18245. These filters read frames from several inputs and send the oldest
  18246. queued frame to the output.
  18247. Input streams must have well defined, monotonically increasing frame
  18248. timestamp values.
  18249. In order to submit one frame to output, these filters need to enqueue
  18250. at least one frame for each input, so they cannot work in case one
  18251. input is not yet terminated and will not receive incoming frames.
  18252. For example consider the case when one input is a @code{select} filter
  18253. which always drops input frames. The @code{interleave} filter will keep
  18254. reading from that input, but it will never be able to send new frames
  18255. to output until the input sends an end-of-stream signal.
  18256. Also, depending on inputs synchronization, the filters will drop
  18257. frames in case one input receives more frames than the other ones, and
  18258. the queue is already filled.
  18259. These filters accept the following options:
  18260. @table @option
  18261. @item nb_inputs, n
  18262. Set the number of different inputs, it is 2 by default.
  18263. @item duration
  18264. How to determine the end-of-stream.
  18265. @table @option
  18266. @item longest
  18267. The duration of the longest input. (default)
  18268. @item shortest
  18269. The duration of the shortest input.
  18270. @item first
  18271. The duration of the first input.
  18272. @end table
  18273. @end table
  18274. @subsection Examples
  18275. @itemize
  18276. @item
  18277. Interleave frames belonging to different streams using @command{ffmpeg}:
  18278. @example
  18279. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18280. @end example
  18281. @item
  18282. Add flickering blur effect:
  18283. @example
  18284. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18285. @end example
  18286. @end itemize
  18287. @section metadata, ametadata
  18288. Manipulate frame metadata.
  18289. This filter accepts the following options:
  18290. @table @option
  18291. @item mode
  18292. Set mode of operation of the filter.
  18293. Can be one of the following:
  18294. @table @samp
  18295. @item select
  18296. If both @code{value} and @code{key} is set, select frames
  18297. which have such metadata. If only @code{key} is set, select
  18298. every frame that has such key in metadata.
  18299. @item add
  18300. Add new metadata @code{key} and @code{value}. If key is already available
  18301. do nothing.
  18302. @item modify
  18303. Modify value of already present key.
  18304. @item delete
  18305. If @code{value} is set, delete only keys that have such value.
  18306. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18307. the frame.
  18308. @item print
  18309. Print key and its value if metadata was found. If @code{key} is not set print all
  18310. metadata values available in frame.
  18311. @end table
  18312. @item key
  18313. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18314. @item value
  18315. Set metadata value which will be used. This option is mandatory for
  18316. @code{modify} and @code{add} mode.
  18317. @item function
  18318. Which function to use when comparing metadata value and @code{value}.
  18319. Can be one of following:
  18320. @table @samp
  18321. @item same_str
  18322. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18323. @item starts_with
  18324. Values are interpreted as strings, returns true if metadata value starts with
  18325. the @code{value} option string.
  18326. @item less
  18327. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18328. @item equal
  18329. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18330. @item greater
  18331. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18332. @item expr
  18333. Values are interpreted as floats, returns true if expression from option @code{expr}
  18334. evaluates to true.
  18335. @item ends_with
  18336. Values are interpreted as strings, returns true if metadata value ends with
  18337. the @code{value} option string.
  18338. @end table
  18339. @item expr
  18340. Set expression which is used when @code{function} is set to @code{expr}.
  18341. The expression is evaluated through the eval API and can contain the following
  18342. constants:
  18343. @table @option
  18344. @item VALUE1
  18345. Float representation of @code{value} from metadata key.
  18346. @item VALUE2
  18347. Float representation of @code{value} as supplied by user in @code{value} option.
  18348. @end table
  18349. @item file
  18350. If specified in @code{print} mode, output is written to the named file. Instead of
  18351. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18352. for standard output. If @code{file} option is not set, output is written to the log
  18353. with AV_LOG_INFO loglevel.
  18354. @item direct
  18355. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18356. @end table
  18357. @subsection Examples
  18358. @itemize
  18359. @item
  18360. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18361. between 0 and 1.
  18362. @example
  18363. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18364. @end example
  18365. @item
  18366. Print silencedetect output to file @file{metadata.txt}.
  18367. @example
  18368. silencedetect,ametadata=mode=print:file=metadata.txt
  18369. @end example
  18370. @item
  18371. Direct all metadata to a pipe with file descriptor 4.
  18372. @example
  18373. metadata=mode=print:file='pipe\:4'
  18374. @end example
  18375. @end itemize
  18376. @section perms, aperms
  18377. Set read/write permissions for the output frames.
  18378. These filters are mainly aimed at developers to test direct path in the
  18379. following filter in the filtergraph.
  18380. The filters accept the following options:
  18381. @table @option
  18382. @item mode
  18383. Select the permissions mode.
  18384. It accepts the following values:
  18385. @table @samp
  18386. @item none
  18387. Do nothing. This is the default.
  18388. @item ro
  18389. Set all the output frames read-only.
  18390. @item rw
  18391. Set all the output frames directly writable.
  18392. @item toggle
  18393. Make the frame read-only if writable, and writable if read-only.
  18394. @item random
  18395. Set each output frame read-only or writable randomly.
  18396. @end table
  18397. @item seed
  18398. Set the seed for the @var{random} mode, must be an integer included between
  18399. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18400. @code{-1}, the filter will try to use a good random seed on a best effort
  18401. basis.
  18402. @end table
  18403. Note: in case of auto-inserted filter between the permission filter and the
  18404. following one, the permission might not be received as expected in that
  18405. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18406. perms/aperms filter can avoid this problem.
  18407. @section realtime, arealtime
  18408. Slow down filtering to match real time approximately.
  18409. These filters will pause the filtering for a variable amount of time to
  18410. match the output rate with the input timestamps.
  18411. They are similar to the @option{re} option to @code{ffmpeg}.
  18412. They accept the following options:
  18413. @table @option
  18414. @item limit
  18415. Time limit for the pauses. Any pause longer than that will be considered
  18416. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18417. @item speed
  18418. Speed factor for processing. The value must be a float larger than zero.
  18419. Values larger than 1.0 will result in faster than realtime processing,
  18420. smaller will slow processing down. The @var{limit} is automatically adapted
  18421. accordingly. Default is 1.0.
  18422. A processing speed faster than what is possible without these filters cannot
  18423. be achieved.
  18424. @end table
  18425. @anchor{select}
  18426. @section select, aselect
  18427. Select frames to pass in output.
  18428. This filter accepts the following options:
  18429. @table @option
  18430. @item expr, e
  18431. Set expression, which is evaluated for each input frame.
  18432. If the expression is evaluated to zero, the frame is discarded.
  18433. If the evaluation result is negative or NaN, the frame is sent to the
  18434. first output; otherwise it is sent to the output with index
  18435. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18436. For example a value of @code{1.2} corresponds to the output with index
  18437. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18438. @item outputs, n
  18439. Set the number of outputs. The output to which to send the selected
  18440. frame is based on the result of the evaluation. Default value is 1.
  18441. @end table
  18442. The expression can contain the following constants:
  18443. @table @option
  18444. @item n
  18445. The (sequential) number of the filtered frame, starting from 0.
  18446. @item selected_n
  18447. The (sequential) number of the selected frame, starting from 0.
  18448. @item prev_selected_n
  18449. The sequential number of the last selected frame. It's NAN if undefined.
  18450. @item TB
  18451. The timebase of the input timestamps.
  18452. @item pts
  18453. The PTS (Presentation TimeStamp) of the filtered video frame,
  18454. expressed in @var{TB} units. It's NAN if undefined.
  18455. @item t
  18456. The PTS of the filtered video frame,
  18457. expressed in seconds. It's NAN if undefined.
  18458. @item prev_pts
  18459. The PTS of the previously filtered video frame. It's NAN if undefined.
  18460. @item prev_selected_pts
  18461. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18462. @item prev_selected_t
  18463. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18464. @item start_pts
  18465. The PTS of the first video frame in the video. It's NAN if undefined.
  18466. @item start_t
  18467. The time of the first video frame in the video. It's NAN if undefined.
  18468. @item pict_type @emph{(video only)}
  18469. The type of the filtered frame. It can assume one of the following
  18470. values:
  18471. @table @option
  18472. @item I
  18473. @item P
  18474. @item B
  18475. @item S
  18476. @item SI
  18477. @item SP
  18478. @item BI
  18479. @end table
  18480. @item interlace_type @emph{(video only)}
  18481. The frame interlace type. It can assume one of the following values:
  18482. @table @option
  18483. @item PROGRESSIVE
  18484. The frame is progressive (not interlaced).
  18485. @item TOPFIRST
  18486. The frame is top-field-first.
  18487. @item BOTTOMFIRST
  18488. The frame is bottom-field-first.
  18489. @end table
  18490. @item consumed_sample_n @emph{(audio only)}
  18491. the number of selected samples before the current frame
  18492. @item samples_n @emph{(audio only)}
  18493. the number of samples in the current frame
  18494. @item sample_rate @emph{(audio only)}
  18495. the input sample rate
  18496. @item key
  18497. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18498. @item pos
  18499. the position in the file of the filtered frame, -1 if the information
  18500. is not available (e.g. for synthetic video)
  18501. @item scene @emph{(video only)}
  18502. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18503. probability for the current frame to introduce a new scene, while a higher
  18504. value means the current frame is more likely to be one (see the example below)
  18505. @item concatdec_select
  18506. The concat demuxer can select only part of a concat input file by setting an
  18507. inpoint and an outpoint, but the output packets may not be entirely contained
  18508. in the selected interval. By using this variable, it is possible to skip frames
  18509. generated by the concat demuxer which are not exactly contained in the selected
  18510. interval.
  18511. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18512. and the @var{lavf.concat.duration} packet metadata values which are also
  18513. present in the decoded frames.
  18514. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18515. start_time and either the duration metadata is missing or the frame pts is less
  18516. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18517. missing.
  18518. That basically means that an input frame is selected if its pts is within the
  18519. interval set by the concat demuxer.
  18520. @end table
  18521. The default value of the select expression is "1".
  18522. @subsection Examples
  18523. @itemize
  18524. @item
  18525. Select all frames in input:
  18526. @example
  18527. select
  18528. @end example
  18529. The example above is the same as:
  18530. @example
  18531. select=1
  18532. @end example
  18533. @item
  18534. Skip all frames:
  18535. @example
  18536. select=0
  18537. @end example
  18538. @item
  18539. Select only I-frames:
  18540. @example
  18541. select='eq(pict_type\,I)'
  18542. @end example
  18543. @item
  18544. Select one frame every 100:
  18545. @example
  18546. select='not(mod(n\,100))'
  18547. @end example
  18548. @item
  18549. Select only frames contained in the 10-20 time interval:
  18550. @example
  18551. select=between(t\,10\,20)
  18552. @end example
  18553. @item
  18554. Select only I-frames contained in the 10-20 time interval:
  18555. @example
  18556. select=between(t\,10\,20)*eq(pict_type\,I)
  18557. @end example
  18558. @item
  18559. Select frames with a minimum distance of 10 seconds:
  18560. @example
  18561. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18562. @end example
  18563. @item
  18564. Use aselect to select only audio frames with samples number > 100:
  18565. @example
  18566. aselect='gt(samples_n\,100)'
  18567. @end example
  18568. @item
  18569. Create a mosaic of the first scenes:
  18570. @example
  18571. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18572. @end example
  18573. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18574. choice.
  18575. @item
  18576. Send even and odd frames to separate outputs, and compose them:
  18577. @example
  18578. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18579. @end example
  18580. @item
  18581. Select useful frames from an ffconcat file which is using inpoints and
  18582. outpoints but where the source files are not intra frame only.
  18583. @example
  18584. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18585. @end example
  18586. @end itemize
  18587. @section sendcmd, asendcmd
  18588. Send commands to filters in the filtergraph.
  18589. These filters read commands to be sent to other filters in the
  18590. filtergraph.
  18591. @code{sendcmd} must be inserted between two video filters,
  18592. @code{asendcmd} must be inserted between two audio filters, but apart
  18593. from that they act the same way.
  18594. The specification of commands can be provided in the filter arguments
  18595. with the @var{commands} option, or in a file specified by the
  18596. @var{filename} option.
  18597. These filters accept the following options:
  18598. @table @option
  18599. @item commands, c
  18600. Set the commands to be read and sent to the other filters.
  18601. @item filename, f
  18602. Set the filename of the commands to be read and sent to the other
  18603. filters.
  18604. @end table
  18605. @subsection Commands syntax
  18606. A commands description consists of a sequence of interval
  18607. specifications, comprising a list of commands to be executed when a
  18608. particular event related to that interval occurs. The occurring event
  18609. is typically the current frame time entering or leaving a given time
  18610. interval.
  18611. An interval is specified by the following syntax:
  18612. @example
  18613. @var{START}[-@var{END}] @var{COMMANDS};
  18614. @end example
  18615. The time interval is specified by the @var{START} and @var{END} times.
  18616. @var{END} is optional and defaults to the maximum time.
  18617. The current frame time is considered within the specified interval if
  18618. it is included in the interval [@var{START}, @var{END}), that is when
  18619. the time is greater or equal to @var{START} and is lesser than
  18620. @var{END}.
  18621. @var{COMMANDS} consists of a sequence of one or more command
  18622. specifications, separated by ",", relating to that interval. The
  18623. syntax of a command specification is given by:
  18624. @example
  18625. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18626. @end example
  18627. @var{FLAGS} is optional and specifies the type of events relating to
  18628. the time interval which enable sending the specified command, and must
  18629. be a non-null sequence of identifier flags separated by "+" or "|" and
  18630. enclosed between "[" and "]".
  18631. The following flags are recognized:
  18632. @table @option
  18633. @item enter
  18634. The command is sent when the current frame timestamp enters the
  18635. specified interval. In other words, the command is sent when the
  18636. previous frame timestamp was not in the given interval, and the
  18637. current is.
  18638. @item leave
  18639. The command is sent when the current frame timestamp leaves the
  18640. specified interval. In other words, the command is sent when the
  18641. previous frame timestamp was in the given interval, and the
  18642. current is not.
  18643. @item expr
  18644. The command @var{ARG} is interpreted as expression and result of
  18645. expression is passed as @var{ARG}.
  18646. The expression is evaluated through the eval API and can contain the following
  18647. constants:
  18648. @table @option
  18649. @item POS
  18650. Original position in the file of the frame, or undefined if undefined
  18651. for the current frame.
  18652. @item PTS
  18653. The presentation timestamp in input.
  18654. @item N
  18655. The count of the input frame for video or audio, starting from 0.
  18656. @item T
  18657. The time in seconds of the current frame.
  18658. @item TS
  18659. The start time in seconds of the current command interval.
  18660. @item TE
  18661. The end time in seconds of the current command interval.
  18662. @item TI
  18663. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18664. @end table
  18665. @end table
  18666. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18667. assumed.
  18668. @var{TARGET} specifies the target of the command, usually the name of
  18669. the filter class or a specific filter instance name.
  18670. @var{COMMAND} specifies the name of the command for the target filter.
  18671. @var{ARG} is optional and specifies the optional list of argument for
  18672. the given @var{COMMAND}.
  18673. Between one interval specification and another, whitespaces, or
  18674. sequences of characters starting with @code{#} until the end of line,
  18675. are ignored and can be used to annotate comments.
  18676. A simplified BNF description of the commands specification syntax
  18677. follows:
  18678. @example
  18679. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18680. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18681. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18682. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18683. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18684. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18685. @end example
  18686. @subsection Examples
  18687. @itemize
  18688. @item
  18689. Specify audio tempo change at second 4:
  18690. @example
  18691. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18692. @end example
  18693. @item
  18694. Target a specific filter instance:
  18695. @example
  18696. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18697. @end example
  18698. @item
  18699. Specify a list of drawtext and hue commands in a file.
  18700. @example
  18701. # show text in the interval 5-10
  18702. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18703. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18704. # desaturate the image in the interval 15-20
  18705. 15.0-20.0 [enter] hue s 0,
  18706. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18707. [leave] hue s 1,
  18708. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18709. # apply an exponential saturation fade-out effect, starting from time 25
  18710. 25 [enter] hue s exp(25-t)
  18711. @end example
  18712. A filtergraph allowing to read and process the above command list
  18713. stored in a file @file{test.cmd}, can be specified with:
  18714. @example
  18715. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18716. @end example
  18717. @end itemize
  18718. @anchor{setpts}
  18719. @section setpts, asetpts
  18720. Change the PTS (presentation timestamp) of the input frames.
  18721. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18722. This filter accepts the following options:
  18723. @table @option
  18724. @item expr
  18725. The expression which is evaluated for each frame to construct its timestamp.
  18726. @end table
  18727. The expression is evaluated through the eval API and can contain the following
  18728. constants:
  18729. @table @option
  18730. @item FRAME_RATE, FR
  18731. frame rate, only defined for constant frame-rate video
  18732. @item PTS
  18733. The presentation timestamp in input
  18734. @item N
  18735. The count of the input frame for video or the number of consumed samples,
  18736. not including the current frame for audio, starting from 0.
  18737. @item NB_CONSUMED_SAMPLES
  18738. The number of consumed samples, not including the current frame (only
  18739. audio)
  18740. @item NB_SAMPLES, S
  18741. The number of samples in the current frame (only audio)
  18742. @item SAMPLE_RATE, SR
  18743. The audio sample rate.
  18744. @item STARTPTS
  18745. The PTS of the first frame.
  18746. @item STARTT
  18747. the time in seconds of the first frame
  18748. @item INTERLACED
  18749. State whether the current frame is interlaced.
  18750. @item T
  18751. the time in seconds of the current frame
  18752. @item POS
  18753. original position in the file of the frame, or undefined if undefined
  18754. for the current frame
  18755. @item PREV_INPTS
  18756. The previous input PTS.
  18757. @item PREV_INT
  18758. previous input time in seconds
  18759. @item PREV_OUTPTS
  18760. The previous output PTS.
  18761. @item PREV_OUTT
  18762. previous output time in seconds
  18763. @item RTCTIME
  18764. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18765. instead.
  18766. @item RTCSTART
  18767. The wallclock (RTC) time at the start of the movie in microseconds.
  18768. @item TB
  18769. The timebase of the input timestamps.
  18770. @end table
  18771. @subsection Examples
  18772. @itemize
  18773. @item
  18774. Start counting PTS from zero
  18775. @example
  18776. setpts=PTS-STARTPTS
  18777. @end example
  18778. @item
  18779. Apply fast motion effect:
  18780. @example
  18781. setpts=0.5*PTS
  18782. @end example
  18783. @item
  18784. Apply slow motion effect:
  18785. @example
  18786. setpts=2.0*PTS
  18787. @end example
  18788. @item
  18789. Set fixed rate of 25 frames per second:
  18790. @example
  18791. setpts=N/(25*TB)
  18792. @end example
  18793. @item
  18794. Set fixed rate 25 fps with some jitter:
  18795. @example
  18796. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18797. @end example
  18798. @item
  18799. Apply an offset of 10 seconds to the input PTS:
  18800. @example
  18801. setpts=PTS+10/TB
  18802. @end example
  18803. @item
  18804. Generate timestamps from a "live source" and rebase onto the current timebase:
  18805. @example
  18806. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18807. @end example
  18808. @item
  18809. Generate timestamps by counting samples:
  18810. @example
  18811. asetpts=N/SR/TB
  18812. @end example
  18813. @end itemize
  18814. @section setrange
  18815. Force color range for the output video frame.
  18816. The @code{setrange} filter marks the color range property for the
  18817. output frames. It does not change the input frame, but only sets the
  18818. corresponding property, which affects how the frame is treated by
  18819. following filters.
  18820. The filter accepts the following options:
  18821. @table @option
  18822. @item range
  18823. Available values are:
  18824. @table @samp
  18825. @item auto
  18826. Keep the same color range property.
  18827. @item unspecified, unknown
  18828. Set the color range as unspecified.
  18829. @item limited, tv, mpeg
  18830. Set the color range as limited.
  18831. @item full, pc, jpeg
  18832. Set the color range as full.
  18833. @end table
  18834. @end table
  18835. @section settb, asettb
  18836. Set the timebase to use for the output frames timestamps.
  18837. It is mainly useful for testing timebase configuration.
  18838. It accepts the following parameters:
  18839. @table @option
  18840. @item expr, tb
  18841. The expression which is evaluated into the output timebase.
  18842. @end table
  18843. The value for @option{tb} is an arithmetic expression representing a
  18844. rational. The expression can contain the constants "AVTB" (the default
  18845. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  18846. audio only). Default value is "intb".
  18847. @subsection Examples
  18848. @itemize
  18849. @item
  18850. Set the timebase to 1/25:
  18851. @example
  18852. settb=expr=1/25
  18853. @end example
  18854. @item
  18855. Set the timebase to 1/10:
  18856. @example
  18857. settb=expr=0.1
  18858. @end example
  18859. @item
  18860. Set the timebase to 1001/1000:
  18861. @example
  18862. settb=1+0.001
  18863. @end example
  18864. @item
  18865. Set the timebase to 2*intb:
  18866. @example
  18867. settb=2*intb
  18868. @end example
  18869. @item
  18870. Set the default timebase value:
  18871. @example
  18872. settb=AVTB
  18873. @end example
  18874. @end itemize
  18875. @section showcqt
  18876. Convert input audio to a video output representing frequency spectrum
  18877. logarithmically using Brown-Puckette constant Q transform algorithm with
  18878. direct frequency domain coefficient calculation (but the transform itself
  18879. is not really constant Q, instead the Q factor is actually variable/clamped),
  18880. with musical tone scale, from E0 to D#10.
  18881. The filter accepts the following options:
  18882. @table @option
  18883. @item size, s
  18884. Specify the video size for the output. It must be even. For the syntax of this option,
  18885. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18886. Default value is @code{1920x1080}.
  18887. @item fps, rate, r
  18888. Set the output frame rate. Default value is @code{25}.
  18889. @item bar_h
  18890. Set the bargraph height. It must be even. Default value is @code{-1} which
  18891. computes the bargraph height automatically.
  18892. @item axis_h
  18893. Set the axis height. It must be even. Default value is @code{-1} which computes
  18894. the axis height automatically.
  18895. @item sono_h
  18896. Set the sonogram height. It must be even. Default value is @code{-1} which
  18897. computes the sonogram height automatically.
  18898. @item fullhd
  18899. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  18900. instead. Default value is @code{1}.
  18901. @item sono_v, volume
  18902. Specify the sonogram volume expression. It can contain variables:
  18903. @table @option
  18904. @item bar_v
  18905. the @var{bar_v} evaluated expression
  18906. @item frequency, freq, f
  18907. the frequency where it is evaluated
  18908. @item timeclamp, tc
  18909. the value of @var{timeclamp} option
  18910. @end table
  18911. and functions:
  18912. @table @option
  18913. @item a_weighting(f)
  18914. A-weighting of equal loudness
  18915. @item b_weighting(f)
  18916. B-weighting of equal loudness
  18917. @item c_weighting(f)
  18918. C-weighting of equal loudness.
  18919. @end table
  18920. Default value is @code{16}.
  18921. @item bar_v, volume2
  18922. Specify the bargraph volume expression. It can contain variables:
  18923. @table @option
  18924. @item sono_v
  18925. the @var{sono_v} evaluated expression
  18926. @item frequency, freq, f
  18927. the frequency where it is evaluated
  18928. @item timeclamp, tc
  18929. the value of @var{timeclamp} option
  18930. @end table
  18931. and functions:
  18932. @table @option
  18933. @item a_weighting(f)
  18934. A-weighting of equal loudness
  18935. @item b_weighting(f)
  18936. B-weighting of equal loudness
  18937. @item c_weighting(f)
  18938. C-weighting of equal loudness.
  18939. @end table
  18940. Default value is @code{sono_v}.
  18941. @item sono_g, gamma
  18942. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  18943. higher gamma makes the spectrum having more range. Default value is @code{3}.
  18944. Acceptable range is @code{[1, 7]}.
  18945. @item bar_g, gamma2
  18946. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  18947. @code{[1, 7]}.
  18948. @item bar_t
  18949. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  18950. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  18951. @item timeclamp, tc
  18952. Specify the transform timeclamp. At low frequency, there is trade-off between
  18953. accuracy in time domain and frequency domain. If timeclamp is lower,
  18954. event in time domain is represented more accurately (such as fast bass drum),
  18955. otherwise event in frequency domain is represented more accurately
  18956. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  18957. @item attack
  18958. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  18959. limits future samples by applying asymmetric windowing in time domain, useful
  18960. when low latency is required. Accepted range is @code{[0, 1]}.
  18961. @item basefreq
  18962. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  18963. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  18964. @item endfreq
  18965. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  18966. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  18967. @item coeffclamp
  18968. This option is deprecated and ignored.
  18969. @item tlength
  18970. Specify the transform length in time domain. Use this option to control accuracy
  18971. trade-off between time domain and frequency domain at every frequency sample.
  18972. It can contain variables:
  18973. @table @option
  18974. @item frequency, freq, f
  18975. the frequency where it is evaluated
  18976. @item timeclamp, tc
  18977. the value of @var{timeclamp} option.
  18978. @end table
  18979. Default value is @code{384*tc/(384+tc*f)}.
  18980. @item count
  18981. Specify the transform count for every video frame. Default value is @code{6}.
  18982. Acceptable range is @code{[1, 30]}.
  18983. @item fcount
  18984. Specify the transform count for every single pixel. Default value is @code{0},
  18985. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  18986. @item fontfile
  18987. Specify font file for use with freetype to draw the axis. If not specified,
  18988. use embedded font. Note that drawing with font file or embedded font is not
  18989. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  18990. option instead.
  18991. @item font
  18992. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  18993. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  18994. escaping.
  18995. @item fontcolor
  18996. Specify font color expression. This is arithmetic expression that should return
  18997. integer value 0xRRGGBB. It can contain variables:
  18998. @table @option
  18999. @item frequency, freq, f
  19000. the frequency where it is evaluated
  19001. @item timeclamp, tc
  19002. the value of @var{timeclamp} option
  19003. @end table
  19004. and functions:
  19005. @table @option
  19006. @item midi(f)
  19007. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19008. @item r(x), g(x), b(x)
  19009. red, green, and blue value of intensity x.
  19010. @end table
  19011. Default value is @code{st(0, (midi(f)-59.5)/12);
  19012. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19013. r(1-ld(1)) + b(ld(1))}.
  19014. @item axisfile
  19015. Specify image file to draw the axis. This option override @var{fontfile} and
  19016. @var{fontcolor} option.
  19017. @item axis, text
  19018. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19019. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19020. Default value is @code{1}.
  19021. @item csp
  19022. Set colorspace. The accepted values are:
  19023. @table @samp
  19024. @item unspecified
  19025. Unspecified (default)
  19026. @item bt709
  19027. BT.709
  19028. @item fcc
  19029. FCC
  19030. @item bt470bg
  19031. BT.470BG or BT.601-6 625
  19032. @item smpte170m
  19033. SMPTE-170M or BT.601-6 525
  19034. @item smpte240m
  19035. SMPTE-240M
  19036. @item bt2020ncl
  19037. BT.2020 with non-constant luminance
  19038. @end table
  19039. @item cscheme
  19040. Set spectrogram color scheme. This is list of floating point values with format
  19041. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19042. The default is @code{1|0.5|0|0|0.5|1}.
  19043. @end table
  19044. @subsection Examples
  19045. @itemize
  19046. @item
  19047. Playing audio while showing the spectrum:
  19048. @example
  19049. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19050. @end example
  19051. @item
  19052. Same as above, but with frame rate 30 fps:
  19053. @example
  19054. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19055. @end example
  19056. @item
  19057. Playing at 1280x720:
  19058. @example
  19059. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19060. @end example
  19061. @item
  19062. Disable sonogram display:
  19063. @example
  19064. sono_h=0
  19065. @end example
  19066. @item
  19067. A1 and its harmonics: A1, A2, (near)E3, A3:
  19068. @example
  19069. 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),
  19070. asplit[a][out1]; [a] showcqt [out0]'
  19071. @end example
  19072. @item
  19073. Same as above, but with more accuracy in frequency domain:
  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=timeclamp=0.5 [out0]'
  19077. @end example
  19078. @item
  19079. Custom volume:
  19080. @example
  19081. bar_v=10:sono_v=bar_v*a_weighting(f)
  19082. @end example
  19083. @item
  19084. Custom gamma, now spectrum is linear to the amplitude.
  19085. @example
  19086. bar_g=2:sono_g=2
  19087. @end example
  19088. @item
  19089. Custom tlength equation:
  19090. @example
  19091. 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)))'
  19092. @end example
  19093. @item
  19094. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19095. @example
  19096. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19097. @end example
  19098. @item
  19099. Custom font using fontconfig:
  19100. @example
  19101. font='Courier New,Monospace,mono|bold'
  19102. @end example
  19103. @item
  19104. Custom frequency range with custom axis using image file:
  19105. @example
  19106. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19107. @end example
  19108. @end itemize
  19109. @section showfreqs
  19110. Convert input audio to video output representing the audio power spectrum.
  19111. Audio amplitude is on Y-axis while frequency is on X-axis.
  19112. The filter accepts the following options:
  19113. @table @option
  19114. @item size, s
  19115. Specify size of video. For the syntax of this option, check the
  19116. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19117. Default is @code{1024x512}.
  19118. @item mode
  19119. Set display mode.
  19120. This set how each frequency bin will be represented.
  19121. It accepts the following values:
  19122. @table @samp
  19123. @item line
  19124. @item bar
  19125. @item dot
  19126. @end table
  19127. Default is @code{bar}.
  19128. @item ascale
  19129. Set amplitude scale.
  19130. It accepts the following values:
  19131. @table @samp
  19132. @item lin
  19133. Linear scale.
  19134. @item sqrt
  19135. Square root scale.
  19136. @item cbrt
  19137. Cubic root scale.
  19138. @item log
  19139. Logarithmic scale.
  19140. @end table
  19141. Default is @code{log}.
  19142. @item fscale
  19143. Set frequency scale.
  19144. It accepts the following values:
  19145. @table @samp
  19146. @item lin
  19147. Linear scale.
  19148. @item log
  19149. Logarithmic scale.
  19150. @item rlog
  19151. Reverse logarithmic scale.
  19152. @end table
  19153. Default is @code{lin}.
  19154. @item win_size
  19155. Set window size. Allowed range is from 16 to 65536.
  19156. Default is @code{2048}
  19157. @item win_func
  19158. Set windowing function.
  19159. It accepts the following values:
  19160. @table @samp
  19161. @item rect
  19162. @item bartlett
  19163. @item hanning
  19164. @item hamming
  19165. @item blackman
  19166. @item welch
  19167. @item flattop
  19168. @item bharris
  19169. @item bnuttall
  19170. @item bhann
  19171. @item sine
  19172. @item nuttall
  19173. @item lanczos
  19174. @item gauss
  19175. @item tukey
  19176. @item dolph
  19177. @item cauchy
  19178. @item parzen
  19179. @item poisson
  19180. @item bohman
  19181. @end table
  19182. Default is @code{hanning}.
  19183. @item overlap
  19184. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19185. which means optimal overlap for selected window function will be picked.
  19186. @item averaging
  19187. Set time averaging. Setting this to 0 will display current maximal peaks.
  19188. Default is @code{1}, which means time averaging is disabled.
  19189. @item colors
  19190. Specify list of colors separated by space or by '|' which will be used to
  19191. draw channel frequencies. Unrecognized or missing colors will be replaced
  19192. by white color.
  19193. @item cmode
  19194. Set channel display mode.
  19195. It accepts the following values:
  19196. @table @samp
  19197. @item combined
  19198. @item separate
  19199. @end table
  19200. Default is @code{combined}.
  19201. @item minamp
  19202. Set minimum amplitude used in @code{log} amplitude scaler.
  19203. @item data
  19204. Set data display mode.
  19205. It accepts the following values:
  19206. @table @samp
  19207. @item magnitude
  19208. @item phase
  19209. @item delay
  19210. @end table
  19211. Default is @code{magnitude}.
  19212. @end table
  19213. @section showspatial
  19214. Convert stereo input audio to a video output, representing the spatial relationship
  19215. between two channels.
  19216. The filter accepts the following options:
  19217. @table @option
  19218. @item size, s
  19219. Specify the video size for the output. For the syntax of this option, check the
  19220. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19221. Default value is @code{512x512}.
  19222. @item win_size
  19223. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19224. @item win_func
  19225. Set window function.
  19226. It accepts the following values:
  19227. @table @samp
  19228. @item rect
  19229. @item bartlett
  19230. @item hann
  19231. @item hanning
  19232. @item hamming
  19233. @item blackman
  19234. @item welch
  19235. @item flattop
  19236. @item bharris
  19237. @item bnuttall
  19238. @item bhann
  19239. @item sine
  19240. @item nuttall
  19241. @item lanczos
  19242. @item gauss
  19243. @item tukey
  19244. @item dolph
  19245. @item cauchy
  19246. @item parzen
  19247. @item poisson
  19248. @item bohman
  19249. @end table
  19250. Default value is @code{hann}.
  19251. @item overlap
  19252. Set ratio of overlap window. Default value is @code{0.5}.
  19253. When value is @code{1} overlap is set to recommended size for specific
  19254. window function currently used.
  19255. @end table
  19256. @anchor{showspectrum}
  19257. @section showspectrum
  19258. Convert input audio to a video output, representing the audio frequency
  19259. spectrum.
  19260. The filter accepts the following options:
  19261. @table @option
  19262. @item size, s
  19263. Specify the video size for the output. For the syntax of this option, check the
  19264. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19265. Default value is @code{640x512}.
  19266. @item slide
  19267. Specify how the spectrum should slide along the window.
  19268. It accepts the following values:
  19269. @table @samp
  19270. @item replace
  19271. the samples start again on the left when they reach the right
  19272. @item scroll
  19273. the samples scroll from right to left
  19274. @item fullframe
  19275. frames are only produced when the samples reach the right
  19276. @item rscroll
  19277. the samples scroll from left to right
  19278. @end table
  19279. Default value is @code{replace}.
  19280. @item mode
  19281. Specify display mode.
  19282. It accepts the following values:
  19283. @table @samp
  19284. @item combined
  19285. all channels are displayed in the same row
  19286. @item separate
  19287. all channels are displayed in separate rows
  19288. @end table
  19289. Default value is @samp{combined}.
  19290. @item color
  19291. Specify display color mode.
  19292. It accepts the following values:
  19293. @table @samp
  19294. @item channel
  19295. each channel is displayed in a separate color
  19296. @item intensity
  19297. each channel is displayed using the same color scheme
  19298. @item rainbow
  19299. each channel is displayed using the rainbow color scheme
  19300. @item moreland
  19301. each channel is displayed using the moreland color scheme
  19302. @item nebulae
  19303. each channel is displayed using the nebulae color scheme
  19304. @item fire
  19305. each channel is displayed using the fire color scheme
  19306. @item fiery
  19307. each channel is displayed using the fiery color scheme
  19308. @item fruit
  19309. each channel is displayed using the fruit color scheme
  19310. @item cool
  19311. each channel is displayed using the cool color scheme
  19312. @item magma
  19313. each channel is displayed using the magma color scheme
  19314. @item green
  19315. each channel is displayed using the green color scheme
  19316. @item viridis
  19317. each channel is displayed using the viridis color scheme
  19318. @item plasma
  19319. each channel is displayed using the plasma color scheme
  19320. @item cividis
  19321. each channel is displayed using the cividis color scheme
  19322. @item terrain
  19323. each channel is displayed using the terrain color scheme
  19324. @end table
  19325. Default value is @samp{channel}.
  19326. @item scale
  19327. Specify scale used for calculating intensity color values.
  19328. It accepts the following values:
  19329. @table @samp
  19330. @item lin
  19331. linear
  19332. @item sqrt
  19333. square root, default
  19334. @item cbrt
  19335. cubic root
  19336. @item log
  19337. logarithmic
  19338. @item 4thrt
  19339. 4th root
  19340. @item 5thrt
  19341. 5th root
  19342. @end table
  19343. Default value is @samp{sqrt}.
  19344. @item fscale
  19345. Specify frequency scale.
  19346. It accepts the following values:
  19347. @table @samp
  19348. @item lin
  19349. linear
  19350. @item log
  19351. logarithmic
  19352. @end table
  19353. Default value is @samp{lin}.
  19354. @item saturation
  19355. Set saturation modifier for displayed colors. Negative values provide
  19356. alternative color scheme. @code{0} is no saturation at all.
  19357. Saturation must be in [-10.0, 10.0] range.
  19358. Default value is @code{1}.
  19359. @item win_func
  19360. Set window function.
  19361. It accepts the following values:
  19362. @table @samp
  19363. @item rect
  19364. @item bartlett
  19365. @item hann
  19366. @item hanning
  19367. @item hamming
  19368. @item blackman
  19369. @item welch
  19370. @item flattop
  19371. @item bharris
  19372. @item bnuttall
  19373. @item bhann
  19374. @item sine
  19375. @item nuttall
  19376. @item lanczos
  19377. @item gauss
  19378. @item tukey
  19379. @item dolph
  19380. @item cauchy
  19381. @item parzen
  19382. @item poisson
  19383. @item bohman
  19384. @end table
  19385. Default value is @code{hann}.
  19386. @item orientation
  19387. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19388. @code{horizontal}. Default is @code{vertical}.
  19389. @item overlap
  19390. Set ratio of overlap window. Default value is @code{0}.
  19391. When value is @code{1} overlap is set to recommended size for specific
  19392. window function currently used.
  19393. @item gain
  19394. Set scale gain for calculating intensity color values.
  19395. Default value is @code{1}.
  19396. @item data
  19397. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19398. @item rotation
  19399. Set color rotation, must be in [-1.0, 1.0] range.
  19400. Default value is @code{0}.
  19401. @item start
  19402. Set start frequency from which to display spectrogram. Default is @code{0}.
  19403. @item stop
  19404. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19405. @item fps
  19406. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19407. @item legend
  19408. Draw time and frequency axes and legends. Default is disabled.
  19409. @end table
  19410. The usage is very similar to the showwaves filter; see the examples in that
  19411. section.
  19412. @subsection Examples
  19413. @itemize
  19414. @item
  19415. Large window with logarithmic color scaling:
  19416. @example
  19417. showspectrum=s=1280x480:scale=log
  19418. @end example
  19419. @item
  19420. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19421. @example
  19422. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19423. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19424. @end example
  19425. @end itemize
  19426. @section showspectrumpic
  19427. Convert input audio to a single video frame, representing the audio frequency
  19428. spectrum.
  19429. The filter accepts the following options:
  19430. @table @option
  19431. @item size, s
  19432. Specify the video size for the output. For the syntax of this option, check the
  19433. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19434. Default value is @code{4096x2048}.
  19435. @item mode
  19436. Specify display mode.
  19437. It accepts the following values:
  19438. @table @samp
  19439. @item combined
  19440. all channels are displayed in the same row
  19441. @item separate
  19442. all channels are displayed in separate rows
  19443. @end table
  19444. Default value is @samp{combined}.
  19445. @item color
  19446. Specify display color mode.
  19447. It accepts the following values:
  19448. @table @samp
  19449. @item channel
  19450. each channel is displayed in a separate color
  19451. @item intensity
  19452. each channel is displayed using the same color scheme
  19453. @item rainbow
  19454. each channel is displayed using the rainbow color scheme
  19455. @item moreland
  19456. each channel is displayed using the moreland color scheme
  19457. @item nebulae
  19458. each channel is displayed using the nebulae color scheme
  19459. @item fire
  19460. each channel is displayed using the fire color scheme
  19461. @item fiery
  19462. each channel is displayed using the fiery color scheme
  19463. @item fruit
  19464. each channel is displayed using the fruit color scheme
  19465. @item cool
  19466. each channel is displayed using the cool color scheme
  19467. @item magma
  19468. each channel is displayed using the magma color scheme
  19469. @item green
  19470. each channel is displayed using the green color scheme
  19471. @item viridis
  19472. each channel is displayed using the viridis color scheme
  19473. @item plasma
  19474. each channel is displayed using the plasma color scheme
  19475. @item cividis
  19476. each channel is displayed using the cividis color scheme
  19477. @item terrain
  19478. each channel is displayed using the terrain color scheme
  19479. @end table
  19480. Default value is @samp{intensity}.
  19481. @item scale
  19482. Specify scale used for calculating intensity color values.
  19483. It accepts the following values:
  19484. @table @samp
  19485. @item lin
  19486. linear
  19487. @item sqrt
  19488. square root, default
  19489. @item cbrt
  19490. cubic root
  19491. @item log
  19492. logarithmic
  19493. @item 4thrt
  19494. 4th root
  19495. @item 5thrt
  19496. 5th root
  19497. @end table
  19498. Default value is @samp{log}.
  19499. @item fscale
  19500. Specify frequency scale.
  19501. It accepts the following values:
  19502. @table @samp
  19503. @item lin
  19504. linear
  19505. @item log
  19506. logarithmic
  19507. @end table
  19508. Default value is @samp{lin}.
  19509. @item saturation
  19510. Set saturation modifier for displayed colors. Negative values provide
  19511. alternative color scheme. @code{0} is no saturation at all.
  19512. Saturation must be in [-10.0, 10.0] range.
  19513. Default value is @code{1}.
  19514. @item win_func
  19515. Set window function.
  19516. It accepts the following values:
  19517. @table @samp
  19518. @item rect
  19519. @item bartlett
  19520. @item hann
  19521. @item hanning
  19522. @item hamming
  19523. @item blackman
  19524. @item welch
  19525. @item flattop
  19526. @item bharris
  19527. @item bnuttall
  19528. @item bhann
  19529. @item sine
  19530. @item nuttall
  19531. @item lanczos
  19532. @item gauss
  19533. @item tukey
  19534. @item dolph
  19535. @item cauchy
  19536. @item parzen
  19537. @item poisson
  19538. @item bohman
  19539. @end table
  19540. Default value is @code{hann}.
  19541. @item orientation
  19542. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19543. @code{horizontal}. Default is @code{vertical}.
  19544. @item gain
  19545. Set scale gain for calculating intensity color values.
  19546. Default value is @code{1}.
  19547. @item legend
  19548. Draw time and frequency axes and legends. Default is enabled.
  19549. @item rotation
  19550. Set color rotation, must be in [-1.0, 1.0] range.
  19551. Default value is @code{0}.
  19552. @item start
  19553. Set start frequency from which to display spectrogram. Default is @code{0}.
  19554. @item stop
  19555. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19556. @end table
  19557. @subsection Examples
  19558. @itemize
  19559. @item
  19560. Extract an audio spectrogram of a whole audio track
  19561. in a 1024x1024 picture using @command{ffmpeg}:
  19562. @example
  19563. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19564. @end example
  19565. @end itemize
  19566. @section showvolume
  19567. Convert input audio volume to a video output.
  19568. The filter accepts the following options:
  19569. @table @option
  19570. @item rate, r
  19571. Set video rate.
  19572. @item b
  19573. Set border width, allowed range is [0, 5]. Default is 1.
  19574. @item w
  19575. Set channel width, allowed range is [80, 8192]. Default is 400.
  19576. @item h
  19577. Set channel height, allowed range is [1, 900]. Default is 20.
  19578. @item f
  19579. Set fade, allowed range is [0, 1]. Default is 0.95.
  19580. @item c
  19581. Set volume color expression.
  19582. The expression can use the following variables:
  19583. @table @option
  19584. @item VOLUME
  19585. Current max volume of channel in dB.
  19586. @item PEAK
  19587. Current peak.
  19588. @item CHANNEL
  19589. Current channel number, starting from 0.
  19590. @end table
  19591. @item t
  19592. If set, displays channel names. Default is enabled.
  19593. @item v
  19594. If set, displays volume values. Default is enabled.
  19595. @item o
  19596. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19597. default is @code{h}.
  19598. @item s
  19599. Set step size, allowed range is [0, 5]. Default is 0, which means
  19600. step is disabled.
  19601. @item p
  19602. Set background opacity, allowed range is [0, 1]. Default is 0.
  19603. @item m
  19604. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19605. default is @code{p}.
  19606. @item ds
  19607. Set display scale, can be linear: @code{lin} or log: @code{log},
  19608. default is @code{lin}.
  19609. @item dm
  19610. In second.
  19611. If set to > 0., display a line for the max level
  19612. in the previous seconds.
  19613. default is disabled: @code{0.}
  19614. @item dmc
  19615. The color of the max line. Use when @code{dm} option is set to > 0.
  19616. default is: @code{orange}
  19617. @end table
  19618. @section showwaves
  19619. Convert input audio to a video output, representing the samples waves.
  19620. The filter accepts the following options:
  19621. @table @option
  19622. @item size, s
  19623. Specify the video size for the output. For the syntax of this option, check the
  19624. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19625. Default value is @code{600x240}.
  19626. @item mode
  19627. Set display mode.
  19628. Available values are:
  19629. @table @samp
  19630. @item point
  19631. Draw a point for each sample.
  19632. @item line
  19633. Draw a vertical line for each sample.
  19634. @item p2p
  19635. Draw a point for each sample and a line between them.
  19636. @item cline
  19637. Draw a centered vertical line for each sample.
  19638. @end table
  19639. Default value is @code{point}.
  19640. @item n
  19641. Set the number of samples which are printed on the same column. A
  19642. larger value will decrease the frame rate. Must be a positive
  19643. integer. This option can be set only if the value for @var{rate}
  19644. is not explicitly specified.
  19645. @item rate, r
  19646. Set the (approximate) output frame rate. This is done by setting the
  19647. option @var{n}. Default value is "25".
  19648. @item split_channels
  19649. Set if channels should be drawn separately or overlap. Default value is 0.
  19650. @item colors
  19651. Set colors separated by '|' which are going to be used for drawing of each channel.
  19652. @item scale
  19653. Set amplitude scale.
  19654. Available values are:
  19655. @table @samp
  19656. @item lin
  19657. Linear.
  19658. @item log
  19659. Logarithmic.
  19660. @item sqrt
  19661. Square root.
  19662. @item cbrt
  19663. Cubic root.
  19664. @end table
  19665. Default is linear.
  19666. @item draw
  19667. Set the draw mode. This is mostly useful to set for high @var{n}.
  19668. Available values are:
  19669. @table @samp
  19670. @item scale
  19671. Scale pixel values for each drawn sample.
  19672. @item full
  19673. Draw every sample directly.
  19674. @end table
  19675. Default value is @code{scale}.
  19676. @end table
  19677. @subsection Examples
  19678. @itemize
  19679. @item
  19680. Output the input file audio and the corresponding video representation
  19681. at the same time:
  19682. @example
  19683. amovie=a.mp3,asplit[out0],showwaves[out1]
  19684. @end example
  19685. @item
  19686. Create a synthetic signal and show it with showwaves, forcing a
  19687. frame rate of 30 frames per second:
  19688. @example
  19689. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19690. @end example
  19691. @end itemize
  19692. @section showwavespic
  19693. Convert input audio to a single video frame, representing the samples waves.
  19694. The filter accepts the following options:
  19695. @table @option
  19696. @item size, s
  19697. Specify the video size for the output. For the syntax of this option, check the
  19698. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19699. Default value is @code{600x240}.
  19700. @item split_channels
  19701. Set if channels should be drawn separately or overlap. Default value is 0.
  19702. @item colors
  19703. Set colors separated by '|' which are going to be used for drawing of each channel.
  19704. @item scale
  19705. Set amplitude scale.
  19706. Available values are:
  19707. @table @samp
  19708. @item lin
  19709. Linear.
  19710. @item log
  19711. Logarithmic.
  19712. @item sqrt
  19713. Square root.
  19714. @item cbrt
  19715. Cubic root.
  19716. @end table
  19717. Default is linear.
  19718. @item draw
  19719. Set the draw mode.
  19720. Available values are:
  19721. @table @samp
  19722. @item scale
  19723. Scale pixel values for each drawn sample.
  19724. @item full
  19725. Draw every sample directly.
  19726. @end table
  19727. Default value is @code{scale}.
  19728. @item filter
  19729. Set the filter mode.
  19730. Available values are:
  19731. @table @samp
  19732. @item average
  19733. Use average samples values for each drawn sample.
  19734. @item peak
  19735. Use peak samples values for each drawn sample.
  19736. @end table
  19737. Default value is @code{average}.
  19738. @end table
  19739. @subsection Examples
  19740. @itemize
  19741. @item
  19742. Extract a channel split representation of the wave form of a whole audio track
  19743. in a 1024x800 picture using @command{ffmpeg}:
  19744. @example
  19745. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19746. @end example
  19747. @end itemize
  19748. @section sidedata, asidedata
  19749. Delete frame side data, or select frames based on it.
  19750. This filter accepts the following options:
  19751. @table @option
  19752. @item mode
  19753. Set mode of operation of the filter.
  19754. Can be one of the following:
  19755. @table @samp
  19756. @item select
  19757. Select every frame with side data of @code{type}.
  19758. @item delete
  19759. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19760. data in the frame.
  19761. @end table
  19762. @item type
  19763. Set side data type used with all modes. Must be set for @code{select} mode. For
  19764. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19765. in @file{libavutil/frame.h}. For example, to choose
  19766. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19767. @end table
  19768. @section spectrumsynth
  19769. Synthesize audio from 2 input video spectrums, first input stream represents
  19770. magnitude across time and second represents phase across time.
  19771. The filter will transform from frequency domain as displayed in videos back
  19772. to time domain as presented in audio output.
  19773. This filter is primarily created for reversing processed @ref{showspectrum}
  19774. filter outputs, but can synthesize sound from other spectrograms too.
  19775. But in such case results are going to be poor if the phase data is not
  19776. available, because in such cases phase data need to be recreated, usually
  19777. it's just recreated from random noise.
  19778. For best results use gray only output (@code{channel} color mode in
  19779. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19780. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19781. @code{data} option. Inputs videos should generally use @code{fullframe}
  19782. slide mode as that saves resources needed for decoding video.
  19783. The filter accepts the following options:
  19784. @table @option
  19785. @item sample_rate
  19786. Specify sample rate of output audio, the sample rate of audio from which
  19787. spectrum was generated may differ.
  19788. @item channels
  19789. Set number of channels represented in input video spectrums.
  19790. @item scale
  19791. Set scale which was used when generating magnitude input spectrum.
  19792. Can be @code{lin} or @code{log}. Default is @code{log}.
  19793. @item slide
  19794. Set slide which was used when generating inputs spectrums.
  19795. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19796. Default is @code{fullframe}.
  19797. @item win_func
  19798. Set window function used for resynthesis.
  19799. @item overlap
  19800. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19801. which means optimal overlap for selected window function will be picked.
  19802. @item orientation
  19803. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19804. Default is @code{vertical}.
  19805. @end table
  19806. @subsection Examples
  19807. @itemize
  19808. @item
  19809. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19810. then resynthesize videos back to audio with spectrumsynth:
  19811. @example
  19812. 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
  19813. 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
  19814. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19815. @end example
  19816. @end itemize
  19817. @section split, asplit
  19818. Split input into several identical outputs.
  19819. @code{asplit} works with audio input, @code{split} with video.
  19820. The filter accepts a single parameter which specifies the number of outputs. If
  19821. unspecified, it defaults to 2.
  19822. @subsection Examples
  19823. @itemize
  19824. @item
  19825. Create two separate outputs from the same input:
  19826. @example
  19827. [in] split [out0][out1]
  19828. @end example
  19829. @item
  19830. To create 3 or more outputs, you need to specify the number of
  19831. outputs, like in:
  19832. @example
  19833. [in] asplit=3 [out0][out1][out2]
  19834. @end example
  19835. @item
  19836. Create two separate outputs from the same input, one cropped and
  19837. one padded:
  19838. @example
  19839. [in] split [splitout1][splitout2];
  19840. [splitout1] crop=100:100:0:0 [cropout];
  19841. [splitout2] pad=200:200:100:100 [padout];
  19842. @end example
  19843. @item
  19844. Create 5 copies of the input audio with @command{ffmpeg}:
  19845. @example
  19846. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  19847. @end example
  19848. @end itemize
  19849. @section zmq, azmq
  19850. Receive commands sent through a libzmq client, and forward them to
  19851. filters in the filtergraph.
  19852. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  19853. must be inserted between two video filters, @code{azmq} between two
  19854. audio filters. Both are capable to send messages to any filter type.
  19855. To enable these filters you need to install the libzmq library and
  19856. headers and configure FFmpeg with @code{--enable-libzmq}.
  19857. For more information about libzmq see:
  19858. @url{http://www.zeromq.org/}
  19859. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  19860. receives messages sent through a network interface defined by the
  19861. @option{bind_address} (or the abbreviation "@option{b}") option.
  19862. Default value of this option is @file{tcp://localhost:5555}. You may
  19863. want to alter this value to your needs, but do not forget to escape any
  19864. ':' signs (see @ref{filtergraph escaping}).
  19865. The received message must be in the form:
  19866. @example
  19867. @var{TARGET} @var{COMMAND} [@var{ARG}]
  19868. @end example
  19869. @var{TARGET} specifies the target of the command, usually the name of
  19870. the filter class or a specific filter instance name. The default
  19871. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  19872. but you can override this by using the @samp{filter_name@@id} syntax
  19873. (see @ref{Filtergraph syntax}).
  19874. @var{COMMAND} specifies the name of the command for the target filter.
  19875. @var{ARG} is optional and specifies the optional argument list for the
  19876. given @var{COMMAND}.
  19877. Upon reception, the message is processed and the corresponding command
  19878. is injected into the filtergraph. Depending on the result, the filter
  19879. will send a reply to the client, adopting the format:
  19880. @example
  19881. @var{ERROR_CODE} @var{ERROR_REASON}
  19882. @var{MESSAGE}
  19883. @end example
  19884. @var{MESSAGE} is optional.
  19885. @subsection Examples
  19886. Look at @file{tools/zmqsend} for an example of a zmq client which can
  19887. be used to send commands processed by these filters.
  19888. Consider the following filtergraph generated by @command{ffplay}.
  19889. In this example the last overlay filter has an instance name. All other
  19890. filters will have default instance names.
  19891. @example
  19892. ffplay -dumpgraph 1 -f lavfi "
  19893. color=s=100x100:c=red [l];
  19894. color=s=100x100:c=blue [r];
  19895. nullsrc=s=200x100, zmq [bg];
  19896. [bg][l] overlay [bg+l];
  19897. [bg+l][r] overlay@@my=x=100 "
  19898. @end example
  19899. To change the color of the left side of the video, the following
  19900. command can be used:
  19901. @example
  19902. echo Parsed_color_0 c yellow | tools/zmqsend
  19903. @end example
  19904. To change the right side:
  19905. @example
  19906. echo Parsed_color_1 c pink | tools/zmqsend
  19907. @end example
  19908. To change the position of the right side:
  19909. @example
  19910. echo overlay@@my x 150 | tools/zmqsend
  19911. @end example
  19912. @c man end MULTIMEDIA FILTERS
  19913. @chapter Multimedia Sources
  19914. @c man begin MULTIMEDIA SOURCES
  19915. Below is a description of the currently available multimedia sources.
  19916. @section amovie
  19917. This is the same as @ref{movie} source, except it selects an audio
  19918. stream by default.
  19919. @anchor{movie}
  19920. @section movie
  19921. Read audio and/or video stream(s) from a movie container.
  19922. It accepts the following parameters:
  19923. @table @option
  19924. @item filename
  19925. The name of the resource to read (not necessarily a file; it can also be a
  19926. device or a stream accessed through some protocol).
  19927. @item format_name, f
  19928. Specifies the format assumed for the movie to read, and can be either
  19929. the name of a container or an input device. If not specified, the
  19930. format is guessed from @var{movie_name} or by probing.
  19931. @item seek_point, sp
  19932. Specifies the seek point in seconds. The frames will be output
  19933. starting from this seek point. The parameter is evaluated with
  19934. @code{av_strtod}, so the numerical value may be suffixed by an IS
  19935. postfix. The default value is "0".
  19936. @item streams, s
  19937. Specifies the streams to read. Several streams can be specified,
  19938. separated by "+". The source will then have as many outputs, in the
  19939. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  19940. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  19941. respectively the default (best suited) video and audio stream. Default
  19942. is "dv", or "da" if the filter is called as "amovie".
  19943. @item stream_index, si
  19944. Specifies the index of the video stream to read. If the value is -1,
  19945. the most suitable video stream will be automatically selected. The default
  19946. value is "-1". Deprecated. If the filter is called "amovie", it will select
  19947. audio instead of video.
  19948. @item loop
  19949. Specifies how many times to read the stream in sequence.
  19950. If the value is 0, the stream will be looped infinitely.
  19951. Default value is "1".
  19952. Note that when the movie is looped the source timestamps are not
  19953. changed, so it will generate non monotonically increasing timestamps.
  19954. @item discontinuity
  19955. Specifies the time difference between frames above which the point is
  19956. considered a timestamp discontinuity which is removed by adjusting the later
  19957. timestamps.
  19958. @end table
  19959. It allows overlaying a second video on top of the main input of
  19960. a filtergraph, as shown in this graph:
  19961. @example
  19962. input -----------> deltapts0 --> overlay --> output
  19963. ^
  19964. |
  19965. movie --> scale--> deltapts1 -------+
  19966. @end example
  19967. @subsection Examples
  19968. @itemize
  19969. @item
  19970. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  19971. on top of the input labelled "in":
  19972. @example
  19973. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19974. [in] setpts=PTS-STARTPTS [main];
  19975. [main][over] overlay=16:16 [out]
  19976. @end example
  19977. @item
  19978. Read from a video4linux2 device, and overlay it on top of the input
  19979. labelled "in":
  19980. @example
  19981. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  19982. [in] setpts=PTS-STARTPTS [main];
  19983. [main][over] overlay=16:16 [out]
  19984. @end example
  19985. @item
  19986. Read the first video stream and the audio stream with id 0x81 from
  19987. dvd.vob; the video is connected to the pad named "video" and the audio is
  19988. connected to the pad named "audio":
  19989. @example
  19990. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  19991. @end example
  19992. @end itemize
  19993. @subsection Commands
  19994. Both movie and amovie support the following commands:
  19995. @table @option
  19996. @item seek
  19997. Perform seek using "av_seek_frame".
  19998. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  19999. @itemize
  20000. @item
  20001. @var{stream_index}: If stream_index is -1, a default
  20002. stream is selected, and @var{timestamp} is automatically converted
  20003. from AV_TIME_BASE units to the stream specific time_base.
  20004. @item
  20005. @var{timestamp}: Timestamp in AVStream.time_base units
  20006. or, if no stream is specified, in AV_TIME_BASE units.
  20007. @item
  20008. @var{flags}: Flags which select direction and seeking mode.
  20009. @end itemize
  20010. @item get_duration
  20011. Get movie duration in AV_TIME_BASE units.
  20012. @end table
  20013. @c man end MULTIMEDIA SOURCES