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.

24716 lines
658KB

  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. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. 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"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. 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
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. 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
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @item normalize, n
  1198. Normalize biquad coefficients, by default is disabled.
  1199. Enabling it will normalize magnitude response at DC to 0dB.
  1200. @end table
  1201. @subsection Commands
  1202. This filter supports the following commands:
  1203. @table @option
  1204. @item frequency, f
  1205. Change allpass frequency.
  1206. Syntax for the command is : "@var{frequency}"
  1207. @item width_type, t
  1208. Change allpass width_type.
  1209. Syntax for the command is : "@var{width_type}"
  1210. @item width, w
  1211. Change allpass width.
  1212. Syntax for the command is : "@var{width}"
  1213. @item mix, m
  1214. Change allpass mix.
  1215. Syntax for the command is : "@var{mix}"
  1216. @end table
  1217. @section aloop
  1218. Loop audio samples.
  1219. The filter accepts the following options:
  1220. @table @option
  1221. @item loop
  1222. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1223. Default is 0.
  1224. @item size
  1225. Set maximal number of samples. Default is 0.
  1226. @item start
  1227. Set first sample of loop. Default is 0.
  1228. @end table
  1229. @anchor{amerge}
  1230. @section amerge
  1231. Merge two or more audio streams into a single multi-channel stream.
  1232. The filter accepts the following options:
  1233. @table @option
  1234. @item inputs
  1235. Set the number of inputs. Default is 2.
  1236. @end table
  1237. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1238. the channel layout of the output will be set accordingly and the channels
  1239. will be reordered as necessary. If the channel layouts of the inputs are not
  1240. disjoint, the output will have all the channels of the first input then all
  1241. the channels of the second input, in that order, and the channel layout of
  1242. the output will be the default value corresponding to the total number of
  1243. channels.
  1244. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1245. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1246. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1247. first input, b1 is the first channel of the second input).
  1248. On the other hand, if both input are in stereo, the output channels will be
  1249. in the default order: a1, a2, b1, b2, and the channel layout will be
  1250. arbitrarily set to 4.0, which may or may not be the expected value.
  1251. All inputs must have the same sample rate, and format.
  1252. If inputs do not have the same duration, the output will stop with the
  1253. shortest.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Merge two mono files into a stereo stream:
  1258. @example
  1259. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1260. @end example
  1261. @item
  1262. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1263. @example
  1264. 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
  1265. @end example
  1266. @end itemize
  1267. @section amix
  1268. Mixes multiple audio inputs into a single output.
  1269. Note that this filter only supports float samples (the @var{amerge}
  1270. and @var{pan} audio filters support many formats). If the @var{amix}
  1271. input has integer samples then @ref{aresample} will be automatically
  1272. inserted to perform the conversion to float samples.
  1273. For example
  1274. @example
  1275. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1276. @end example
  1277. will mix 3 input audio streams to a single output with the same duration as the
  1278. first input and a dropout transition time of 3 seconds.
  1279. It accepts the following parameters:
  1280. @table @option
  1281. @item inputs
  1282. The number of inputs. If unspecified, it defaults to 2.
  1283. @item duration
  1284. How to determine the end-of-stream.
  1285. @table @option
  1286. @item longest
  1287. The duration of the longest input. (default)
  1288. @item shortest
  1289. The duration of the shortest input.
  1290. @item first
  1291. The duration of the first input.
  1292. @end table
  1293. @item dropout_transition
  1294. The transition time, in seconds, for volume renormalization when an input
  1295. stream ends. The default value is 2 seconds.
  1296. @item weights
  1297. Specify weight of each input audio stream as sequence.
  1298. Each weight is separated by space. By default all inputs have same weight.
  1299. @end table
  1300. @section amultiply
  1301. Multiply first audio stream with second audio stream and store result
  1302. in output audio stream. Multiplication is done by multiplying each
  1303. sample from first stream with sample at same position from second stream.
  1304. With this element-wise multiplication one can create amplitude fades and
  1305. amplitude modulations.
  1306. @section anequalizer
  1307. High-order parametric multiband equalizer for each channel.
  1308. It accepts the following parameters:
  1309. @table @option
  1310. @item params
  1311. This option string is in format:
  1312. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1313. Each equalizer band is separated by '|'.
  1314. @table @option
  1315. @item chn
  1316. Set channel number to which equalization will be applied.
  1317. If input doesn't have that channel the entry is ignored.
  1318. @item f
  1319. Set central frequency for band.
  1320. If input doesn't have that frequency the entry is ignored.
  1321. @item w
  1322. Set band width in hertz.
  1323. @item g
  1324. Set band gain in dB.
  1325. @item t
  1326. Set filter type for band, optional, can be:
  1327. @table @samp
  1328. @item 0
  1329. Butterworth, this is default.
  1330. @item 1
  1331. Chebyshev type 1.
  1332. @item 2
  1333. Chebyshev type 2.
  1334. @end table
  1335. @end table
  1336. @item curves
  1337. With this option activated frequency response of anequalizer is displayed
  1338. in video stream.
  1339. @item size
  1340. Set video stream size. Only useful if curves option is activated.
  1341. @item mgain
  1342. Set max gain that will be displayed. Only useful if curves option is activated.
  1343. Setting this to a reasonable value makes it possible to display gain which is derived from
  1344. neighbour bands which are too close to each other and thus produce higher gain
  1345. when both are activated.
  1346. @item fscale
  1347. Set frequency scale used to draw frequency response in video output.
  1348. Can be linear or logarithmic. Default is logarithmic.
  1349. @item colors
  1350. Set color for each channel curve which is going to be displayed in video stream.
  1351. This is list of color names separated by space or by '|'.
  1352. Unrecognised or missing colors will be replaced by white color.
  1353. @end table
  1354. @subsection Examples
  1355. @itemize
  1356. @item
  1357. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1358. for first 2 channels using Chebyshev type 1 filter:
  1359. @example
  1360. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1361. @end example
  1362. @end itemize
  1363. @subsection Commands
  1364. This filter supports the following commands:
  1365. @table @option
  1366. @item change
  1367. Alter existing filter parameters.
  1368. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1369. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1370. error is returned.
  1371. @var{freq} set new frequency parameter.
  1372. @var{width} set new width parameter in herz.
  1373. @var{gain} set new gain parameter in dB.
  1374. Full filter invocation with asendcmd may look like this:
  1375. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1376. @end table
  1377. @section anlmdn
  1378. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1379. Each sample is adjusted by looking for other samples with similar contexts. This
  1380. context similarity is defined by comparing their surrounding patches of size
  1381. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1382. The filter accepts the following options:
  1383. @table @option
  1384. @item s
  1385. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1386. @item p
  1387. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1388. Default value is 2 milliseconds.
  1389. @item r
  1390. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1391. Default value is 6 milliseconds.
  1392. @item o
  1393. Set the output mode.
  1394. It accepts the following values:
  1395. @table @option
  1396. @item i
  1397. Pass input unchanged.
  1398. @item o
  1399. Pass noise filtered out.
  1400. @item n
  1401. Pass only noise.
  1402. Default value is @var{o}.
  1403. @end table
  1404. @item m
  1405. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1406. @end table
  1407. @subsection Commands
  1408. This filter supports the following commands:
  1409. @table @option
  1410. @item s
  1411. Change denoise strength. Argument is single float number.
  1412. Syntax for the command is : "@var{s}"
  1413. @item o
  1414. Change output mode.
  1415. Syntax for the command is : "i", "o" or "n" string.
  1416. @end table
  1417. @section anlms
  1418. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1419. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1420. relate to producing the least mean square of the error signal (difference between the desired,
  1421. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1422. A description of the accepted options follows.
  1423. @table @option
  1424. @item order
  1425. Set filter order.
  1426. @item mu
  1427. Set filter mu.
  1428. @item eps
  1429. Set the filter eps.
  1430. @item leakage
  1431. Set the filter leakage.
  1432. @item out_mode
  1433. It accepts the following values:
  1434. @table @option
  1435. @item i
  1436. Pass the 1st input.
  1437. @item d
  1438. Pass the 2nd input.
  1439. @item o
  1440. Pass filtered samples.
  1441. @item n
  1442. Pass difference between desired and filtered samples.
  1443. Default value is @var{o}.
  1444. @end table
  1445. @end table
  1446. @subsection Examples
  1447. @itemize
  1448. @item
  1449. One of many usages of this filter is noise reduction, input audio is filtered
  1450. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1451. @example
  1452. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1453. @end example
  1454. @end itemize
  1455. @subsection Commands
  1456. This filter supports the same commands as options, excluding option @code{order}.
  1457. @section anull
  1458. Pass the audio source unchanged to the output.
  1459. @section apad
  1460. Pad the end of an audio stream with silence.
  1461. This can be used together with @command{ffmpeg} @option{-shortest} to
  1462. extend audio streams to the same length as the video stream.
  1463. A description of the accepted options follows.
  1464. @table @option
  1465. @item packet_size
  1466. Set silence packet size. Default value is 4096.
  1467. @item pad_len
  1468. Set the number of samples of silence to add to the end. After the
  1469. value is reached, the stream is terminated. This option is mutually
  1470. exclusive with @option{whole_len}.
  1471. @item whole_len
  1472. Set the minimum total number of samples in the output audio stream. If
  1473. the value is longer than the input audio length, silence is added to
  1474. the end, until the value is reached. This option is mutually exclusive
  1475. with @option{pad_len}.
  1476. @item pad_dur
  1477. Specify the duration of samples of silence to add. See
  1478. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1479. for the accepted syntax. Used only if set to non-zero value.
  1480. @item whole_dur
  1481. Specify the minimum total duration in the output audio stream. See
  1482. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1483. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1484. the input audio length, silence is added to the end, until the value is reached.
  1485. This option is mutually exclusive with @option{pad_dur}
  1486. @end table
  1487. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1488. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1489. the input stream indefinitely.
  1490. @subsection Examples
  1491. @itemize
  1492. @item
  1493. Add 1024 samples of silence to the end of the input:
  1494. @example
  1495. apad=pad_len=1024
  1496. @end example
  1497. @item
  1498. Make sure the audio output will contain at least 10000 samples, pad
  1499. the input with silence if required:
  1500. @example
  1501. apad=whole_len=10000
  1502. @end example
  1503. @item
  1504. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1505. video stream will always result the shortest and will be converted
  1506. until the end in the output file when using the @option{shortest}
  1507. option:
  1508. @example
  1509. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1510. @end example
  1511. @end itemize
  1512. @section aphaser
  1513. Add a phasing effect to the input audio.
  1514. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1515. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1516. A description of the accepted parameters follows.
  1517. @table @option
  1518. @item in_gain
  1519. Set input gain. Default is 0.4.
  1520. @item out_gain
  1521. Set output gain. Default is 0.74
  1522. @item delay
  1523. Set delay in milliseconds. Default is 3.0.
  1524. @item decay
  1525. Set decay. Default is 0.4.
  1526. @item speed
  1527. Set modulation speed in Hz. Default is 0.5.
  1528. @item type
  1529. Set modulation type. Default is triangular.
  1530. It accepts the following values:
  1531. @table @samp
  1532. @item triangular, t
  1533. @item sinusoidal, s
  1534. @end table
  1535. @end table
  1536. @section apulsator
  1537. Audio pulsator is something between an autopanner and a tremolo.
  1538. But it can produce funny stereo effects as well. Pulsator changes the volume
  1539. of the left and right channel based on a LFO (low frequency oscillator) with
  1540. different waveforms and shifted phases.
  1541. This filter have the ability to define an offset between left and right
  1542. channel. An offset of 0 means that both LFO shapes match each other.
  1543. The left and right channel are altered equally - a conventional tremolo.
  1544. An offset of 50% means that the shape of the right channel is exactly shifted
  1545. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1546. an autopanner. At 1 both curves match again. Every setting in between moves the
  1547. phase shift gapless between all stages and produces some "bypassing" sounds with
  1548. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1549. the 0.5) the faster the signal passes from the left to the right speaker.
  1550. The filter accepts the following options:
  1551. @table @option
  1552. @item level_in
  1553. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1554. @item level_out
  1555. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1556. @item mode
  1557. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1558. sawup or sawdown. Default is sine.
  1559. @item amount
  1560. Set modulation. Define how much of original signal is affected by the LFO.
  1561. @item offset_l
  1562. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1563. @item offset_r
  1564. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1565. @item width
  1566. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1567. @item timing
  1568. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1569. @item bpm
  1570. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1571. is set to bpm.
  1572. @item ms
  1573. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1574. is set to ms.
  1575. @item hz
  1576. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1577. if timing is set to hz.
  1578. @end table
  1579. @anchor{aresample}
  1580. @section aresample
  1581. Resample the input audio to the specified parameters, using the
  1582. libswresample library. If none are specified then the filter will
  1583. automatically convert between its input and output.
  1584. This filter is also able to stretch/squeeze the audio data to make it match
  1585. the timestamps or to inject silence / cut out audio to make it match the
  1586. timestamps, do a combination of both or do neither.
  1587. The filter accepts the syntax
  1588. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1589. expresses a sample rate and @var{resampler_options} is a list of
  1590. @var{key}=@var{value} pairs, separated by ":". See the
  1591. @ref{Resampler Options,,"Resampler Options" section in the
  1592. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1593. for the complete list of supported options.
  1594. @subsection Examples
  1595. @itemize
  1596. @item
  1597. Resample the input audio to 44100Hz:
  1598. @example
  1599. aresample=44100
  1600. @end example
  1601. @item
  1602. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1603. samples per second compensation:
  1604. @example
  1605. aresample=async=1000
  1606. @end example
  1607. @end itemize
  1608. @section areverse
  1609. Reverse an audio clip.
  1610. Warning: This filter requires memory to buffer the entire clip, so trimming
  1611. is suggested.
  1612. @subsection Examples
  1613. @itemize
  1614. @item
  1615. Take the first 5 seconds of a clip, and reverse it.
  1616. @example
  1617. atrim=end=5,areverse
  1618. @end example
  1619. @end itemize
  1620. @section arnndn
  1621. Reduce noise from speech using Recurrent Neural Networks.
  1622. This filter accepts the following options:
  1623. @table @option
  1624. @item model, m
  1625. Set train model file to load. This option is always required.
  1626. @end table
  1627. @section asetnsamples
  1628. Set the number of samples per each output audio frame.
  1629. The last output packet may contain a different number of samples, as
  1630. the filter will flush all the remaining samples when the input audio
  1631. signals its end.
  1632. The filter accepts the following options:
  1633. @table @option
  1634. @item nb_out_samples, n
  1635. Set the number of frames per each output audio frame. The number is
  1636. intended as the number of samples @emph{per each channel}.
  1637. Default value is 1024.
  1638. @item pad, p
  1639. If set to 1, the filter will pad the last audio frame with zeroes, so
  1640. that the last frame will contain the same number of samples as the
  1641. previous ones. Default value is 1.
  1642. @end table
  1643. For example, to set the number of per-frame samples to 1234 and
  1644. disable padding for the last frame, use:
  1645. @example
  1646. asetnsamples=n=1234:p=0
  1647. @end example
  1648. @section asetrate
  1649. Set the sample rate without altering the PCM data.
  1650. This will result in a change of speed and pitch.
  1651. The filter accepts the following options:
  1652. @table @option
  1653. @item sample_rate, r
  1654. Set the output sample rate. Default is 44100 Hz.
  1655. @end table
  1656. @section ashowinfo
  1657. Show a line containing various information for each input audio frame.
  1658. The input audio is not modified.
  1659. The shown line contains a sequence of key/value pairs of the form
  1660. @var{key}:@var{value}.
  1661. The following values are shown in the output:
  1662. @table @option
  1663. @item n
  1664. The (sequential) number of the input frame, starting from 0.
  1665. @item pts
  1666. The presentation timestamp of the input frame, in time base units; the time base
  1667. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1668. @item pts_time
  1669. The presentation timestamp of the input frame in seconds.
  1670. @item pos
  1671. position of the frame in the input stream, -1 if this information in
  1672. unavailable and/or meaningless (for example in case of synthetic audio)
  1673. @item fmt
  1674. The sample format.
  1675. @item chlayout
  1676. The channel layout.
  1677. @item rate
  1678. The sample rate for the audio frame.
  1679. @item nb_samples
  1680. The number of samples (per channel) in the frame.
  1681. @item checksum
  1682. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1683. audio, the data is treated as if all the planes were concatenated.
  1684. @item plane_checksums
  1685. A list of Adler-32 checksums for each data plane.
  1686. @end table
  1687. @section asoftclip
  1688. Apply audio soft clipping.
  1689. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1690. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1691. This filter accepts the following options:
  1692. @table @option
  1693. @item type
  1694. Set type of soft-clipping.
  1695. It accepts the following values:
  1696. @table @option
  1697. @item tanh
  1698. @item atan
  1699. @item cubic
  1700. @item exp
  1701. @item alg
  1702. @item quintic
  1703. @item sin
  1704. @end table
  1705. @item param
  1706. Set additional parameter which controls sigmoid function.
  1707. @end table
  1708. @section asr
  1709. Automatic Speech Recognition
  1710. This filter uses PocketSphinx for speech recognition. To enable
  1711. compilation of this filter, you need to configure FFmpeg with
  1712. @code{--enable-pocketsphinx}.
  1713. It accepts the following options:
  1714. @table @option
  1715. @item rate
  1716. Set sampling rate of input audio. Defaults is @code{16000}.
  1717. This need to match speech models, otherwise one will get poor results.
  1718. @item hmm
  1719. Set dictionary containing acoustic model files.
  1720. @item dict
  1721. Set pronunciation dictionary.
  1722. @item lm
  1723. Set language model file.
  1724. @item lmctl
  1725. Set language model set.
  1726. @item lmname
  1727. Set which language model to use.
  1728. @item logfn
  1729. Set output for log messages.
  1730. @end table
  1731. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1732. @anchor{astats}
  1733. @section astats
  1734. Display time domain statistical information about the audio channels.
  1735. Statistics are calculated and displayed for each audio channel and,
  1736. where applicable, an overall figure is also given.
  1737. It accepts the following option:
  1738. @table @option
  1739. @item length
  1740. Short window length in seconds, used for peak and trough RMS measurement.
  1741. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1742. @item metadata
  1743. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1744. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1745. disabled.
  1746. Available keys for each channel are:
  1747. DC_offset
  1748. Min_level
  1749. Max_level
  1750. Min_difference
  1751. Max_difference
  1752. Mean_difference
  1753. RMS_difference
  1754. Peak_level
  1755. RMS_peak
  1756. RMS_trough
  1757. Crest_factor
  1758. Flat_factor
  1759. Peak_count
  1760. Bit_depth
  1761. Dynamic_range
  1762. Zero_crossings
  1763. Zero_crossings_rate
  1764. Number_of_NaNs
  1765. Number_of_Infs
  1766. Number_of_denormals
  1767. and for Overall:
  1768. DC_offset
  1769. Min_level
  1770. Max_level
  1771. Min_difference
  1772. Max_difference
  1773. Mean_difference
  1774. RMS_difference
  1775. Peak_level
  1776. RMS_level
  1777. RMS_peak
  1778. RMS_trough
  1779. Flat_factor
  1780. Peak_count
  1781. Bit_depth
  1782. Number_of_samples
  1783. Number_of_NaNs
  1784. Number_of_Infs
  1785. Number_of_denormals
  1786. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1787. this @code{lavfi.astats.Overall.Peak_count}.
  1788. For description what each key means read below.
  1789. @item reset
  1790. Set number of frame after which stats are going to be recalculated.
  1791. Default is disabled.
  1792. @item measure_perchannel
  1793. Select the entries which need to be measured per channel. The metadata keys can
  1794. be used as flags, default is @option{all} which measures everything.
  1795. @option{none} disables all per channel measurement.
  1796. @item measure_overall
  1797. Select the entries which need to be measured overall. The metadata keys can
  1798. be used as flags, default is @option{all} which measures everything.
  1799. @option{none} disables all overall measurement.
  1800. @end table
  1801. A description of each shown parameter follows:
  1802. @table @option
  1803. @item DC offset
  1804. Mean amplitude displacement from zero.
  1805. @item Min level
  1806. Minimal sample level.
  1807. @item Max level
  1808. Maximal sample level.
  1809. @item Min difference
  1810. Minimal difference between two consecutive samples.
  1811. @item Max difference
  1812. Maximal difference between two consecutive samples.
  1813. @item Mean difference
  1814. Mean difference between two consecutive samples.
  1815. The average of each difference between two consecutive samples.
  1816. @item RMS difference
  1817. Root Mean Square difference between two consecutive samples.
  1818. @item Peak level dB
  1819. @item RMS level dB
  1820. Standard peak and RMS level measured in dBFS.
  1821. @item RMS peak dB
  1822. @item RMS trough dB
  1823. Peak and trough values for RMS level measured over a short window.
  1824. @item Crest factor
  1825. Standard ratio of peak to RMS level (note: not in dB).
  1826. @item Flat factor
  1827. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1828. (i.e. either @var{Min level} or @var{Max level}).
  1829. @item Peak count
  1830. Number of occasions (not the number of samples) that the signal attained either
  1831. @var{Min level} or @var{Max level}.
  1832. @item Bit depth
  1833. Overall bit depth of audio. Number of bits used for each sample.
  1834. @item Dynamic range
  1835. Measured dynamic range of audio in dB.
  1836. @item Zero crossings
  1837. Number of points where the waveform crosses the zero level axis.
  1838. @item Zero crossings rate
  1839. Rate of Zero crossings and number of audio samples.
  1840. @end table
  1841. @section atempo
  1842. Adjust audio tempo.
  1843. The filter accepts exactly one parameter, the audio tempo. If not
  1844. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1845. be in the [0.5, 100.0] range.
  1846. Note that tempo greater than 2 will skip some samples rather than
  1847. blend them in. If for any reason this is a concern it is always
  1848. possible to daisy-chain several instances of atempo to achieve the
  1849. desired product tempo.
  1850. @subsection Examples
  1851. @itemize
  1852. @item
  1853. Slow down audio to 80% tempo:
  1854. @example
  1855. atempo=0.8
  1856. @end example
  1857. @item
  1858. To speed up audio to 300% tempo:
  1859. @example
  1860. atempo=3
  1861. @end example
  1862. @item
  1863. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1864. @example
  1865. atempo=sqrt(3),atempo=sqrt(3)
  1866. @end example
  1867. @end itemize
  1868. @subsection Commands
  1869. This filter supports the following commands:
  1870. @table @option
  1871. @item tempo
  1872. Change filter tempo scale factor.
  1873. Syntax for the command is : "@var{tempo}"
  1874. @end table
  1875. @section atrim
  1876. Trim the input so that the output contains one continuous subpart of the input.
  1877. It accepts the following parameters:
  1878. @table @option
  1879. @item start
  1880. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1881. sample with the timestamp @var{start} will be the first sample in the output.
  1882. @item end
  1883. Specify time of the first audio sample that will be dropped, i.e. the
  1884. audio sample immediately preceding the one with the timestamp @var{end} will be
  1885. the last sample in the output.
  1886. @item start_pts
  1887. Same as @var{start}, except this option sets the start timestamp in samples
  1888. instead of seconds.
  1889. @item end_pts
  1890. Same as @var{end}, except this option sets the end timestamp in samples instead
  1891. of seconds.
  1892. @item duration
  1893. The maximum duration of the output in seconds.
  1894. @item start_sample
  1895. The number of the first sample that should be output.
  1896. @item end_sample
  1897. The number of the first sample that should be dropped.
  1898. @end table
  1899. @option{start}, @option{end}, and @option{duration} are expressed as time
  1900. duration specifications; see
  1901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1902. Note that the first two sets of the start/end options and the @option{duration}
  1903. option look at the frame timestamp, while the _sample options simply count the
  1904. samples that pass through the filter. So start/end_pts and start/end_sample will
  1905. give different results when the timestamps are wrong, inexact or do not start at
  1906. zero. Also note that this filter does not modify the timestamps. If you wish
  1907. to have the output timestamps start at zero, insert the asetpts filter after the
  1908. atrim filter.
  1909. If multiple start or end options are set, this filter tries to be greedy and
  1910. keep all samples that match at least one of the specified constraints. To keep
  1911. only the part that matches all the constraints at once, chain multiple atrim
  1912. filters.
  1913. The defaults are such that all the input is kept. So it is possible to set e.g.
  1914. just the end values to keep everything before the specified time.
  1915. Examples:
  1916. @itemize
  1917. @item
  1918. Drop everything except the second minute of input:
  1919. @example
  1920. ffmpeg -i INPUT -af atrim=60:120
  1921. @end example
  1922. @item
  1923. Keep only the first 1000 samples:
  1924. @example
  1925. ffmpeg -i INPUT -af atrim=end_sample=1000
  1926. @end example
  1927. @end itemize
  1928. @section axcorrelate
  1929. Calculate normalized cross-correlation between two input audio streams.
  1930. Resulted samples are always between -1 and 1 inclusive.
  1931. If result is 1 it means two input samples are highly correlated in that selected segment.
  1932. Result 0 means they are not correlated at all.
  1933. If result is -1 it means two input samples are out of phase, which means they cancel each
  1934. other.
  1935. The filter accepts the following options:
  1936. @table @option
  1937. @item size
  1938. Set size of segment over which cross-correlation is calculated.
  1939. Default is 256. Allowed range is from 2 to 131072.
  1940. @item algo
  1941. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  1942. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  1943. are always zero and thus need much less calculations to make.
  1944. This is generally not true, but is valid for typical audio streams.
  1945. @end table
  1946. @subsection Examples
  1947. @itemize
  1948. @item
  1949. Calculate correlation between channels in stereo audio stream:
  1950. @example
  1951. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  1952. @end example
  1953. @end itemize
  1954. @section bandpass
  1955. Apply a two-pole Butterworth band-pass filter with central
  1956. frequency @var{frequency}, and (3dB-point) band-width width.
  1957. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1958. instead of the default: constant 0dB peak gain.
  1959. The filter roll off at 6dB per octave (20dB per decade).
  1960. The filter accepts the following options:
  1961. @table @option
  1962. @item frequency, f
  1963. Set the filter's central frequency. Default is @code{3000}.
  1964. @item csg
  1965. Constant skirt gain if set to 1. Defaults to 0.
  1966. @item width_type, t
  1967. Set method to specify band-width of filter.
  1968. @table @option
  1969. @item h
  1970. Hz
  1971. @item q
  1972. Q-Factor
  1973. @item o
  1974. octave
  1975. @item s
  1976. slope
  1977. @item k
  1978. kHz
  1979. @end table
  1980. @item width, w
  1981. Specify the band-width of a filter in width_type units.
  1982. @item mix, m
  1983. How much to use filtered signal in output. Default is 1.
  1984. Range is between 0 and 1.
  1985. @item channels, c
  1986. Specify which channels to filter, by default all available are filtered.
  1987. @item normalize, n
  1988. Normalize biquad coefficients, by default is disabled.
  1989. Enabling it will normalize magnitude response at DC to 0dB.
  1990. @end table
  1991. @subsection Commands
  1992. This filter supports the following commands:
  1993. @table @option
  1994. @item frequency, f
  1995. Change bandpass frequency.
  1996. Syntax for the command is : "@var{frequency}"
  1997. @item width_type, t
  1998. Change bandpass width_type.
  1999. Syntax for the command is : "@var{width_type}"
  2000. @item width, w
  2001. Change bandpass width.
  2002. Syntax for the command is : "@var{width}"
  2003. @item mix, m
  2004. Change bandpass mix.
  2005. Syntax for the command is : "@var{mix}"
  2006. @end table
  2007. @section bandreject
  2008. Apply a two-pole Butterworth band-reject filter with central
  2009. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2010. The filter roll off at 6dB per octave (20dB per decade).
  2011. The filter accepts the following options:
  2012. @table @option
  2013. @item frequency, f
  2014. Set the filter's central frequency. Default is @code{3000}.
  2015. @item width_type, t
  2016. Set method to specify band-width of filter.
  2017. @table @option
  2018. @item h
  2019. Hz
  2020. @item q
  2021. Q-Factor
  2022. @item o
  2023. octave
  2024. @item s
  2025. slope
  2026. @item k
  2027. kHz
  2028. @end table
  2029. @item width, w
  2030. Specify the band-width of a filter in width_type units.
  2031. @item mix, m
  2032. How much to use filtered signal in output. Default is 1.
  2033. Range is between 0 and 1.
  2034. @item channels, c
  2035. Specify which channels to filter, by default all available are filtered.
  2036. @item normalize, n
  2037. Normalize biquad coefficients, by default is disabled.
  2038. Enabling it will normalize magnitude response at DC to 0dB.
  2039. @end table
  2040. @subsection Commands
  2041. This filter supports the following commands:
  2042. @table @option
  2043. @item frequency, f
  2044. Change bandreject frequency.
  2045. Syntax for the command is : "@var{frequency}"
  2046. @item width_type, t
  2047. Change bandreject width_type.
  2048. Syntax for the command is : "@var{width_type}"
  2049. @item width, w
  2050. Change bandreject width.
  2051. Syntax for the command is : "@var{width}"
  2052. @item mix, m
  2053. Change bandreject mix.
  2054. Syntax for the command is : "@var{mix}"
  2055. @end table
  2056. @section bass, lowshelf
  2057. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2058. shelving filter with a response similar to that of a standard
  2059. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2060. The filter accepts the following options:
  2061. @table @option
  2062. @item gain, g
  2063. Give the gain at 0 Hz. Its useful range is about -20
  2064. (for a large cut) to +20 (for a large boost).
  2065. Beware of clipping when using a positive gain.
  2066. @item frequency, f
  2067. Set the filter's central frequency and so can be used
  2068. to extend or reduce the frequency range to be boosted or cut.
  2069. The default value is @code{100} Hz.
  2070. @item width_type, t
  2071. Set method to specify band-width of filter.
  2072. @table @option
  2073. @item h
  2074. Hz
  2075. @item q
  2076. Q-Factor
  2077. @item o
  2078. octave
  2079. @item s
  2080. slope
  2081. @item k
  2082. kHz
  2083. @end table
  2084. @item width, w
  2085. Determine how steep is the filter's shelf transition.
  2086. @item mix, m
  2087. How much to use filtered signal in output. Default is 1.
  2088. Range is between 0 and 1.
  2089. @item channels, c
  2090. Specify which channels to filter, by default all available are filtered.
  2091. @item normalize, n
  2092. Normalize biquad coefficients, by default is disabled.
  2093. Enabling it will normalize magnitude response at DC to 0dB.
  2094. @end table
  2095. @subsection Commands
  2096. This filter supports the following commands:
  2097. @table @option
  2098. @item frequency, f
  2099. Change bass frequency.
  2100. Syntax for the command is : "@var{frequency}"
  2101. @item width_type, t
  2102. Change bass width_type.
  2103. Syntax for the command is : "@var{width_type}"
  2104. @item width, w
  2105. Change bass width.
  2106. Syntax for the command is : "@var{width}"
  2107. @item gain, g
  2108. Change bass gain.
  2109. Syntax for the command is : "@var{gain}"
  2110. @item mix, m
  2111. Change bass mix.
  2112. Syntax for the command is : "@var{mix}"
  2113. @end table
  2114. @section biquad
  2115. Apply a biquad IIR filter with the given coefficients.
  2116. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2117. are the numerator and denominator coefficients respectively.
  2118. and @var{channels}, @var{c} specify which channels to filter, by default all
  2119. available are filtered.
  2120. @subsection Commands
  2121. This filter supports the following commands:
  2122. @table @option
  2123. @item a0
  2124. @item a1
  2125. @item a2
  2126. @item b0
  2127. @item b1
  2128. @item b2
  2129. Change biquad parameter.
  2130. Syntax for the command is : "@var{value}"
  2131. @item mix, m
  2132. How much to use filtered signal in output. Default is 1.
  2133. Range is between 0 and 1.
  2134. @item channels, c
  2135. Specify which channels to filter, by default all available are filtered.
  2136. @item normalize, n
  2137. Normalize biquad coefficients, by default is disabled.
  2138. Enabling it will normalize magnitude response at DC to 0dB.
  2139. @end table
  2140. @section bs2b
  2141. Bauer stereo to binaural transformation, which improves headphone listening of
  2142. stereo audio records.
  2143. To enable compilation of this filter you need to configure FFmpeg with
  2144. @code{--enable-libbs2b}.
  2145. It accepts the following parameters:
  2146. @table @option
  2147. @item profile
  2148. Pre-defined crossfeed level.
  2149. @table @option
  2150. @item default
  2151. Default level (fcut=700, feed=50).
  2152. @item cmoy
  2153. Chu Moy circuit (fcut=700, feed=60).
  2154. @item jmeier
  2155. Jan Meier circuit (fcut=650, feed=95).
  2156. @end table
  2157. @item fcut
  2158. Cut frequency (in Hz).
  2159. @item feed
  2160. Feed level (in Hz).
  2161. @end table
  2162. @section channelmap
  2163. Remap input channels to new locations.
  2164. It accepts the following parameters:
  2165. @table @option
  2166. @item map
  2167. Map channels from input to output. The argument is a '|'-separated list of
  2168. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2169. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2170. channel (e.g. FL for front left) or its index in the input channel layout.
  2171. @var{out_channel} is the name of the output channel or its index in the output
  2172. channel layout. If @var{out_channel} is not given then it is implicitly an
  2173. index, starting with zero and increasing by one for each mapping.
  2174. @item channel_layout
  2175. The channel layout of the output stream.
  2176. @end table
  2177. If no mapping is present, the filter will implicitly map input channels to
  2178. output channels, preserving indices.
  2179. @subsection Examples
  2180. @itemize
  2181. @item
  2182. For example, assuming a 5.1+downmix input MOV file,
  2183. @example
  2184. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2185. @end example
  2186. will create an output WAV file tagged as stereo from the downmix channels of
  2187. the input.
  2188. @item
  2189. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2190. @example
  2191. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2192. @end example
  2193. @end itemize
  2194. @section channelsplit
  2195. Split each channel from an input audio stream into a separate output stream.
  2196. It accepts the following parameters:
  2197. @table @option
  2198. @item channel_layout
  2199. The channel layout of the input stream. The default is "stereo".
  2200. @item channels
  2201. A channel layout describing the channels to be extracted as separate output streams
  2202. or "all" to extract each input channel as a separate stream. The default is "all".
  2203. Choosing channels not present in channel layout in the input will result in an error.
  2204. @end table
  2205. @subsection Examples
  2206. @itemize
  2207. @item
  2208. For example, assuming a stereo input MP3 file,
  2209. @example
  2210. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2211. @end example
  2212. will create an output Matroska file with two audio streams, one containing only
  2213. the left channel and the other the right channel.
  2214. @item
  2215. Split a 5.1 WAV file into per-channel files:
  2216. @example
  2217. ffmpeg -i in.wav -filter_complex
  2218. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2219. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2220. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2221. side_right.wav
  2222. @end example
  2223. @item
  2224. Extract only LFE from a 5.1 WAV file:
  2225. @example
  2226. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2227. -map '[LFE]' lfe.wav
  2228. @end example
  2229. @end itemize
  2230. @section chorus
  2231. Add a chorus effect to the audio.
  2232. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2233. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2234. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2235. The modulation depth defines the range the modulated delay is played before or after
  2236. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2237. sound tuned around the original one, like in a chorus where some vocals are slightly
  2238. off key.
  2239. It accepts the following parameters:
  2240. @table @option
  2241. @item in_gain
  2242. Set input gain. Default is 0.4.
  2243. @item out_gain
  2244. Set output gain. Default is 0.4.
  2245. @item delays
  2246. Set delays. A typical delay is around 40ms to 60ms.
  2247. @item decays
  2248. Set decays.
  2249. @item speeds
  2250. Set speeds.
  2251. @item depths
  2252. Set depths.
  2253. @end table
  2254. @subsection Examples
  2255. @itemize
  2256. @item
  2257. A single delay:
  2258. @example
  2259. chorus=0.7:0.9:55:0.4:0.25:2
  2260. @end example
  2261. @item
  2262. Two delays:
  2263. @example
  2264. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2265. @end example
  2266. @item
  2267. Fuller sounding chorus with three delays:
  2268. @example
  2269. 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
  2270. @end example
  2271. @end itemize
  2272. @section compand
  2273. Compress or expand the audio's dynamic range.
  2274. It accepts the following parameters:
  2275. @table @option
  2276. @item attacks
  2277. @item decays
  2278. A list of times in seconds for each channel over which the instantaneous level
  2279. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2280. increase of volume and @var{decays} refers to decrease of volume. For most
  2281. situations, the attack time (response to the audio getting louder) should be
  2282. shorter than the decay time, because the human ear is more sensitive to sudden
  2283. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2284. a typical value for decay is 0.8 seconds.
  2285. If specified number of attacks & decays is lower than number of channels, the last
  2286. set attack/decay will be used for all remaining channels.
  2287. @item points
  2288. A list of points for the transfer function, specified in dB relative to the
  2289. maximum possible signal amplitude. Each key points list must be defined using
  2290. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2291. @code{x0/y0 x1/y1 x2/y2 ....}
  2292. The input values must be in strictly increasing order but the transfer function
  2293. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2294. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2295. function are @code{-70/-70|-60/-20|1/0}.
  2296. @item soft-knee
  2297. Set the curve radius in dB for all joints. It defaults to 0.01.
  2298. @item gain
  2299. Set the additional gain in dB to be applied at all points on the transfer
  2300. function. This allows for easy adjustment of the overall gain.
  2301. It defaults to 0.
  2302. @item volume
  2303. Set an initial volume, in dB, to be assumed for each channel when filtering
  2304. starts. This permits the user to supply a nominal level initially, so that, for
  2305. example, a very large gain is not applied to initial signal levels before the
  2306. companding has begun to operate. A typical value for audio which is initially
  2307. quiet is -90 dB. It defaults to 0.
  2308. @item delay
  2309. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2310. delayed before being fed to the volume adjuster. Specifying a delay
  2311. approximately equal to the attack/decay times allows the filter to effectively
  2312. operate in predictive rather than reactive mode. It defaults to 0.
  2313. @end table
  2314. @subsection Examples
  2315. @itemize
  2316. @item
  2317. Make music with both quiet and loud passages suitable for listening to in a
  2318. noisy environment:
  2319. @example
  2320. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2321. @end example
  2322. Another example for audio with whisper and explosion parts:
  2323. @example
  2324. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2325. @end example
  2326. @item
  2327. A noise gate for when the noise is at a lower level than the signal:
  2328. @example
  2329. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2330. @end example
  2331. @item
  2332. Here is another noise gate, this time for when the noise is at a higher level
  2333. than the signal (making it, in some ways, similar to squelch):
  2334. @example
  2335. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2336. @end example
  2337. @item
  2338. 2:1 compression starting at -6dB:
  2339. @example
  2340. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2341. @end example
  2342. @item
  2343. 2:1 compression starting at -9dB:
  2344. @example
  2345. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2346. @end example
  2347. @item
  2348. 2:1 compression starting at -12dB:
  2349. @example
  2350. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2351. @end example
  2352. @item
  2353. 2:1 compression starting at -18dB:
  2354. @example
  2355. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2356. @end example
  2357. @item
  2358. 3:1 compression starting at -15dB:
  2359. @example
  2360. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2361. @end example
  2362. @item
  2363. Compressor/Gate:
  2364. @example
  2365. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2366. @end example
  2367. @item
  2368. Expander:
  2369. @example
  2370. 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
  2371. @end example
  2372. @item
  2373. Hard limiter at -6dB:
  2374. @example
  2375. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2376. @end example
  2377. @item
  2378. Hard limiter at -12dB:
  2379. @example
  2380. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2381. @end example
  2382. @item
  2383. Hard noise gate at -35 dB:
  2384. @example
  2385. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2386. @end example
  2387. @item
  2388. Soft limiter:
  2389. @example
  2390. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2391. @end example
  2392. @end itemize
  2393. @section compensationdelay
  2394. Compensation Delay Line is a metric based delay to compensate differing
  2395. positions of microphones or speakers.
  2396. For example, you have recorded guitar with two microphones placed in
  2397. different locations. Because the front of sound wave has fixed speed in
  2398. normal conditions, the phasing of microphones can vary and depends on
  2399. their location and interposition. The best sound mix can be achieved when
  2400. these microphones are in phase (synchronized). Note that a distance of
  2401. ~30 cm between microphones makes one microphone capture the signal in
  2402. antiphase to the other microphone. That makes the final mix sound moody.
  2403. This filter helps to solve phasing problems by adding different delays
  2404. to each microphone track and make them synchronized.
  2405. The best result can be reached when you take one track as base and
  2406. synchronize other tracks one by one with it.
  2407. Remember that synchronization/delay tolerance depends on sample rate, too.
  2408. Higher sample rates will give more tolerance.
  2409. The filter accepts the following parameters:
  2410. @table @option
  2411. @item mm
  2412. Set millimeters distance. This is compensation distance for fine tuning.
  2413. Default is 0.
  2414. @item cm
  2415. Set cm distance. This is compensation distance for tightening distance setup.
  2416. Default is 0.
  2417. @item m
  2418. Set meters distance. This is compensation distance for hard distance setup.
  2419. Default is 0.
  2420. @item dry
  2421. Set dry amount. Amount of unprocessed (dry) signal.
  2422. Default is 0.
  2423. @item wet
  2424. Set wet amount. Amount of processed (wet) signal.
  2425. Default is 1.
  2426. @item temp
  2427. Set temperature in degrees Celsius. This is the temperature of the environment.
  2428. Default is 20.
  2429. @end table
  2430. @section crossfeed
  2431. Apply headphone crossfeed filter.
  2432. Crossfeed is the process of blending the left and right channels of stereo
  2433. audio recording.
  2434. It is mainly used to reduce extreme stereo separation of low frequencies.
  2435. The intent is to produce more speaker like sound to the listener.
  2436. The filter accepts the following options:
  2437. @table @option
  2438. @item strength
  2439. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2440. This sets gain of low shelf filter for side part of stereo image.
  2441. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2442. @item range
  2443. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2444. This sets cut off frequency of low shelf filter. Default is cut off near
  2445. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2446. @item level_in
  2447. Set input gain. Default is 0.9.
  2448. @item level_out
  2449. Set output gain. Default is 1.
  2450. @end table
  2451. @section crystalizer
  2452. Simple algorithm to expand audio dynamic range.
  2453. The filter accepts the following options:
  2454. @table @option
  2455. @item i
  2456. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2457. (unchanged sound) to 10.0 (maximum effect).
  2458. @item c
  2459. Enable clipping. By default is enabled.
  2460. @end table
  2461. @section dcshift
  2462. Apply a DC shift to the audio.
  2463. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2464. in the recording chain) from the audio. The effect of a DC offset is reduced
  2465. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2466. a signal has a DC offset.
  2467. @table @option
  2468. @item shift
  2469. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2470. the audio.
  2471. @item limitergain
  2472. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2473. used to prevent clipping.
  2474. @end table
  2475. @section deesser
  2476. Apply de-essing to the audio samples.
  2477. @table @option
  2478. @item i
  2479. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2480. Default is 0.
  2481. @item m
  2482. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2483. Default is 0.5.
  2484. @item f
  2485. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2486. Default is 0.5.
  2487. @item s
  2488. Set the output mode.
  2489. It accepts the following values:
  2490. @table @option
  2491. @item i
  2492. Pass input unchanged.
  2493. @item o
  2494. Pass ess filtered out.
  2495. @item e
  2496. Pass only ess.
  2497. Default value is @var{o}.
  2498. @end table
  2499. @end table
  2500. @section drmeter
  2501. Measure audio dynamic range.
  2502. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2503. is found in transition material. And anything less that 8 have very poor dynamics
  2504. and is very compressed.
  2505. The filter accepts the following options:
  2506. @table @option
  2507. @item length
  2508. Set window length in seconds used to split audio into segments of equal length.
  2509. Default is 3 seconds.
  2510. @end table
  2511. @section dynaudnorm
  2512. Dynamic Audio Normalizer.
  2513. This filter applies a certain amount of gain to the input audio in order
  2514. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2515. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2516. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2517. This allows for applying extra gain to the "quiet" sections of the audio
  2518. while avoiding distortions or clipping the "loud" sections. In other words:
  2519. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2520. sections, in the sense that the volume of each section is brought to the
  2521. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2522. this goal *without* applying "dynamic range compressing". It will retain 100%
  2523. of the dynamic range *within* each section of the audio file.
  2524. @table @option
  2525. @item framelen, f
  2526. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2527. Default is 500 milliseconds.
  2528. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2529. referred to as frames. This is required, because a peak magnitude has no
  2530. meaning for just a single sample value. Instead, we need to determine the
  2531. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2532. normalizer would simply use the peak magnitude of the complete file, the
  2533. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2534. frame. The length of a frame is specified in milliseconds. By default, the
  2535. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2536. been found to give good results with most files.
  2537. Note that the exact frame length, in number of samples, will be determined
  2538. automatically, based on the sampling rate of the individual input audio file.
  2539. @item gausssize, g
  2540. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2541. number. Default is 31.
  2542. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2543. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2544. is specified in frames, centered around the current frame. For the sake of
  2545. simplicity, this must be an odd number. Consequently, the default value of 31
  2546. takes into account the current frame, as well as the 15 preceding frames and
  2547. the 15 subsequent frames. Using a larger window results in a stronger
  2548. smoothing effect and thus in less gain variation, i.e. slower gain
  2549. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2550. effect and thus in more gain variation, i.e. faster gain adaptation.
  2551. In other words, the more you increase this value, the more the Dynamic Audio
  2552. Normalizer will behave like a "traditional" normalization filter. On the
  2553. contrary, the more you decrease this value, the more the Dynamic Audio
  2554. Normalizer will behave like a dynamic range compressor.
  2555. @item peak, p
  2556. Set the target peak value. This specifies the highest permissible magnitude
  2557. level for the normalized audio input. This filter will try to approach the
  2558. target peak magnitude as closely as possible, but at the same time it also
  2559. makes sure that the normalized signal will never exceed the peak magnitude.
  2560. A frame's maximum local gain factor is imposed directly by the target peak
  2561. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2562. It is not recommended to go above this value.
  2563. @item maxgain, m
  2564. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2565. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2566. factor for each input frame, i.e. the maximum gain factor that does not
  2567. result in clipping or distortion. The maximum gain factor is determined by
  2568. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2569. additionally bounds the frame's maximum gain factor by a predetermined
  2570. (global) maximum gain factor. This is done in order to avoid excessive gain
  2571. factors in "silent" or almost silent frames. By default, the maximum gain
  2572. factor is 10.0, For most inputs the default value should be sufficient and
  2573. it usually is not recommended to increase this value. Though, for input
  2574. with an extremely low overall volume level, it may be necessary to allow even
  2575. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2576. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2577. Instead, a "sigmoid" threshold function will be applied. This way, the
  2578. gain factors will smoothly approach the threshold value, but never exceed that
  2579. value.
  2580. @item targetrms, r
  2581. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2582. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2583. This means that the maximum local gain factor for each frame is defined
  2584. (only) by the frame's highest magnitude sample. This way, the samples can
  2585. be amplified as much as possible without exceeding the maximum signal
  2586. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2587. Normalizer can also take into account the frame's root mean square,
  2588. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2589. determine the power of a time-varying signal. It is therefore considered
  2590. that the RMS is a better approximation of the "perceived loudness" than
  2591. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2592. frames to a constant RMS value, a uniform "perceived loudness" can be
  2593. established. If a target RMS value has been specified, a frame's local gain
  2594. factor is defined as the factor that would result in exactly that RMS value.
  2595. Note, however, that the maximum local gain factor is still restricted by the
  2596. frame's highest magnitude sample, in order to prevent clipping.
  2597. @item coupling, n
  2598. Enable channels coupling. By default is enabled.
  2599. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2600. amount. This means the same gain factor will be applied to all channels, i.e.
  2601. the maximum possible gain factor is determined by the "loudest" channel.
  2602. However, in some recordings, it may happen that the volume of the different
  2603. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2604. In this case, this option can be used to disable the channel coupling. This way,
  2605. the gain factor will be determined independently for each channel, depending
  2606. only on the individual channel's highest magnitude sample. This allows for
  2607. harmonizing the volume of the different channels.
  2608. @item correctdc, c
  2609. Enable DC bias correction. By default is disabled.
  2610. An audio signal (in the time domain) is a sequence of sample values.
  2611. In the Dynamic Audio Normalizer these sample values are represented in the
  2612. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2613. audio signal, or "waveform", should be centered around the zero point.
  2614. That means if we calculate the mean value of all samples in a file, or in a
  2615. single frame, then the result should be 0.0 or at least very close to that
  2616. value. If, however, there is a significant deviation of the mean value from
  2617. 0.0, in either positive or negative direction, this is referred to as a
  2618. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2619. Audio Normalizer provides optional DC bias correction.
  2620. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2621. the mean value, or "DC correction" offset, of each input frame and subtract
  2622. that value from all of the frame's sample values which ensures those samples
  2623. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2624. boundaries, the DC correction offset values will be interpolated smoothly
  2625. between neighbouring frames.
  2626. @item altboundary, b
  2627. Enable alternative boundary mode. By default is disabled.
  2628. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2629. around each frame. This includes the preceding frames as well as the
  2630. subsequent frames. However, for the "boundary" frames, located at the very
  2631. beginning and at the very end of the audio file, not all neighbouring
  2632. frames are available. In particular, for the first few frames in the audio
  2633. file, the preceding frames are not known. And, similarly, for the last few
  2634. frames in the audio file, the subsequent frames are not known. Thus, the
  2635. question arises which gain factors should be assumed for the missing frames
  2636. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2637. to deal with this situation. The default boundary mode assumes a gain factor
  2638. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2639. "fade out" at the beginning and at the end of the input, respectively.
  2640. @item compress, s
  2641. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2642. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2643. compression. This means that signal peaks will not be pruned and thus the
  2644. full dynamic range will be retained within each local neighbourhood. However,
  2645. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2646. normalization algorithm with a more "traditional" compression.
  2647. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2648. (thresholding) function. If (and only if) the compression feature is enabled,
  2649. all input frames will be processed by a soft knee thresholding function prior
  2650. to the actual normalization process. Put simply, the thresholding function is
  2651. going to prune all samples whose magnitude exceeds a certain threshold value.
  2652. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2653. value. Instead, the threshold value will be adjusted for each individual
  2654. frame.
  2655. In general, smaller parameters result in stronger compression, and vice versa.
  2656. Values below 3.0 are not recommended, because audible distortion may appear.
  2657. @end table
  2658. @section earwax
  2659. Make audio easier to listen to on headphones.
  2660. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2661. so that when listened to on headphones the stereo image is moved from
  2662. inside your head (standard for headphones) to outside and in front of
  2663. the listener (standard for speakers).
  2664. Ported from SoX.
  2665. @section equalizer
  2666. Apply a two-pole peaking equalisation (EQ) filter. With this
  2667. filter, the signal-level at and around a selected frequency can
  2668. be increased or decreased, whilst (unlike bandpass and bandreject
  2669. filters) that at all other frequencies is unchanged.
  2670. In order to produce complex equalisation curves, this filter can
  2671. be given several times, each with a different central frequency.
  2672. The filter accepts the following options:
  2673. @table @option
  2674. @item frequency, f
  2675. Set the filter's central frequency in Hz.
  2676. @item width_type, t
  2677. Set method to specify band-width of filter.
  2678. @table @option
  2679. @item h
  2680. Hz
  2681. @item q
  2682. Q-Factor
  2683. @item o
  2684. octave
  2685. @item s
  2686. slope
  2687. @item k
  2688. kHz
  2689. @end table
  2690. @item width, w
  2691. Specify the band-width of a filter in width_type units.
  2692. @item gain, g
  2693. Set the required gain or attenuation in dB.
  2694. Beware of clipping when using a positive gain.
  2695. @item mix, m
  2696. How much to use filtered signal in output. Default is 1.
  2697. Range is between 0 and 1.
  2698. @item channels, c
  2699. Specify which channels to filter, by default all available are filtered.
  2700. @item normalize, n
  2701. Normalize biquad coefficients, by default is disabled.
  2702. Enabling it will normalize magnitude response at DC to 0dB.
  2703. @end table
  2704. @subsection Examples
  2705. @itemize
  2706. @item
  2707. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2708. @example
  2709. equalizer=f=1000:t=h:width=200:g=-10
  2710. @end example
  2711. @item
  2712. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2713. @example
  2714. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2715. @end example
  2716. @end itemize
  2717. @subsection Commands
  2718. This filter supports the following commands:
  2719. @table @option
  2720. @item frequency, f
  2721. Change equalizer frequency.
  2722. Syntax for the command is : "@var{frequency}"
  2723. @item width_type, t
  2724. Change equalizer width_type.
  2725. Syntax for the command is : "@var{width_type}"
  2726. @item width, w
  2727. Change equalizer width.
  2728. Syntax for the command is : "@var{width}"
  2729. @item gain, g
  2730. Change equalizer gain.
  2731. Syntax for the command is : "@var{gain}"
  2732. @item mix, m
  2733. Change equalizer mix.
  2734. Syntax for the command is : "@var{mix}"
  2735. @end table
  2736. @section extrastereo
  2737. Linearly increases the difference between left and right channels which
  2738. adds some sort of "live" effect to playback.
  2739. The filter accepts the following options:
  2740. @table @option
  2741. @item m
  2742. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2743. (average of both channels), with 1.0 sound will be unchanged, with
  2744. -1.0 left and right channels will be swapped.
  2745. @item c
  2746. Enable clipping. By default is enabled.
  2747. @end table
  2748. @subsection Commands
  2749. This filter supports the all above options as @ref{commands}.
  2750. @section firequalizer
  2751. Apply FIR Equalization using arbitrary frequency response.
  2752. The filter accepts the following option:
  2753. @table @option
  2754. @item gain
  2755. Set gain curve equation (in dB). The expression can contain variables:
  2756. @table @option
  2757. @item f
  2758. the evaluated frequency
  2759. @item sr
  2760. sample rate
  2761. @item ch
  2762. channel number, set to 0 when multichannels evaluation is disabled
  2763. @item chid
  2764. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2765. multichannels evaluation is disabled
  2766. @item chs
  2767. number of channels
  2768. @item chlayout
  2769. channel_layout, see libavutil/channel_layout.h
  2770. @end table
  2771. and functions:
  2772. @table @option
  2773. @item gain_interpolate(f)
  2774. interpolate gain on frequency f based on gain_entry
  2775. @item cubic_interpolate(f)
  2776. same as gain_interpolate, but smoother
  2777. @end table
  2778. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2779. @item gain_entry
  2780. Set gain entry for gain_interpolate function. The expression can
  2781. contain functions:
  2782. @table @option
  2783. @item entry(f, g)
  2784. store gain entry at frequency f with value g
  2785. @end table
  2786. This option is also available as command.
  2787. @item delay
  2788. Set filter delay in seconds. Higher value means more accurate.
  2789. Default is @code{0.01}.
  2790. @item accuracy
  2791. Set filter accuracy in Hz. Lower value means more accurate.
  2792. Default is @code{5}.
  2793. @item wfunc
  2794. Set window function. Acceptable values are:
  2795. @table @option
  2796. @item rectangular
  2797. rectangular window, useful when gain curve is already smooth
  2798. @item hann
  2799. hann window (default)
  2800. @item hamming
  2801. hamming window
  2802. @item blackman
  2803. blackman window
  2804. @item nuttall3
  2805. 3-terms continuous 1st derivative nuttall window
  2806. @item mnuttall3
  2807. minimum 3-terms discontinuous nuttall window
  2808. @item nuttall
  2809. 4-terms continuous 1st derivative nuttall window
  2810. @item bnuttall
  2811. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2812. @item bharris
  2813. blackman-harris window
  2814. @item tukey
  2815. tukey window
  2816. @end table
  2817. @item fixed
  2818. If enabled, use fixed number of audio samples. This improves speed when
  2819. filtering with large delay. Default is disabled.
  2820. @item multi
  2821. Enable multichannels evaluation on gain. Default is disabled.
  2822. @item zero_phase
  2823. Enable zero phase mode by subtracting timestamp to compensate delay.
  2824. Default is disabled.
  2825. @item scale
  2826. Set scale used by gain. Acceptable values are:
  2827. @table @option
  2828. @item linlin
  2829. linear frequency, linear gain
  2830. @item linlog
  2831. linear frequency, logarithmic (in dB) gain (default)
  2832. @item loglin
  2833. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2834. @item loglog
  2835. logarithmic frequency, logarithmic gain
  2836. @end table
  2837. @item dumpfile
  2838. Set file for dumping, suitable for gnuplot.
  2839. @item dumpscale
  2840. Set scale for dumpfile. Acceptable values are same with scale option.
  2841. Default is linlog.
  2842. @item fft2
  2843. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2844. Default is disabled.
  2845. @item min_phase
  2846. Enable minimum phase impulse response. Default is disabled.
  2847. @end table
  2848. @subsection Examples
  2849. @itemize
  2850. @item
  2851. lowpass at 1000 Hz:
  2852. @example
  2853. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2854. @end example
  2855. @item
  2856. lowpass at 1000 Hz with gain_entry:
  2857. @example
  2858. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2859. @end example
  2860. @item
  2861. custom equalization:
  2862. @example
  2863. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2864. @end example
  2865. @item
  2866. higher delay with zero phase to compensate delay:
  2867. @example
  2868. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2869. @end example
  2870. @item
  2871. lowpass on left channel, highpass on right channel:
  2872. @example
  2873. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2874. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2875. @end example
  2876. @end itemize
  2877. @section flanger
  2878. Apply a flanging effect to the audio.
  2879. The filter accepts the following options:
  2880. @table @option
  2881. @item delay
  2882. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2883. @item depth
  2884. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2885. @item regen
  2886. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2887. Default value is 0.
  2888. @item width
  2889. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2890. Default value is 71.
  2891. @item speed
  2892. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2893. @item shape
  2894. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2895. Default value is @var{sinusoidal}.
  2896. @item phase
  2897. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2898. Default value is 25.
  2899. @item interp
  2900. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2901. Default is @var{linear}.
  2902. @end table
  2903. @section haas
  2904. Apply Haas effect to audio.
  2905. Note that this makes most sense to apply on mono signals.
  2906. With this filter applied to mono signals it give some directionality and
  2907. stretches its stereo image.
  2908. The filter accepts the following options:
  2909. @table @option
  2910. @item level_in
  2911. Set input level. By default is @var{1}, or 0dB
  2912. @item level_out
  2913. Set output level. By default is @var{1}, or 0dB.
  2914. @item side_gain
  2915. Set gain applied to side part of signal. By default is @var{1}.
  2916. @item middle_source
  2917. Set kind of middle source. Can be one of the following:
  2918. @table @samp
  2919. @item left
  2920. Pick left channel.
  2921. @item right
  2922. Pick right channel.
  2923. @item mid
  2924. Pick middle part signal of stereo image.
  2925. @item side
  2926. Pick side part signal of stereo image.
  2927. @end table
  2928. @item middle_phase
  2929. Change middle phase. By default is disabled.
  2930. @item left_delay
  2931. Set left channel delay. By default is @var{2.05} milliseconds.
  2932. @item left_balance
  2933. Set left channel balance. By default is @var{-1}.
  2934. @item left_gain
  2935. Set left channel gain. By default is @var{1}.
  2936. @item left_phase
  2937. Change left phase. By default is disabled.
  2938. @item right_delay
  2939. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2940. @item right_balance
  2941. Set right channel balance. By default is @var{1}.
  2942. @item right_gain
  2943. Set right channel gain. By default is @var{1}.
  2944. @item right_phase
  2945. Change right phase. By default is enabled.
  2946. @end table
  2947. @section hdcd
  2948. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2949. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2950. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2951. of HDCD, and detects the Transient Filter flag.
  2952. @example
  2953. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2954. @end example
  2955. When using the filter with wav, note the default encoding for wav is 16-bit,
  2956. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2957. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2958. @example
  2959. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2960. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2961. @end example
  2962. The filter accepts the following options:
  2963. @table @option
  2964. @item disable_autoconvert
  2965. Disable any automatic format conversion or resampling in the filter graph.
  2966. @item process_stereo
  2967. Process the stereo channels together. If target_gain does not match between
  2968. channels, consider it invalid and use the last valid target_gain.
  2969. @item cdt_ms
  2970. Set the code detect timer period in ms.
  2971. @item force_pe
  2972. Always extend peaks above -3dBFS even if PE isn't signaled.
  2973. @item analyze_mode
  2974. Replace audio with a solid tone and adjust the amplitude to signal some
  2975. specific aspect of the decoding process. The output file can be loaded in
  2976. an audio editor alongside the original to aid analysis.
  2977. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2978. Modes are:
  2979. @table @samp
  2980. @item 0, off
  2981. Disabled
  2982. @item 1, lle
  2983. Gain adjustment level at each sample
  2984. @item 2, pe
  2985. Samples where peak extend occurs
  2986. @item 3, cdt
  2987. Samples where the code detect timer is active
  2988. @item 4, tgm
  2989. Samples where the target gain does not match between channels
  2990. @end table
  2991. @end table
  2992. @section headphone
  2993. Apply head-related transfer functions (HRTFs) to create virtual
  2994. loudspeakers around the user for binaural listening via headphones.
  2995. The HRIRs are provided via additional streams, for each channel
  2996. one stereo input stream is needed.
  2997. The filter accepts the following options:
  2998. @table @option
  2999. @item map
  3000. Set mapping of input streams for convolution.
  3001. The argument is a '|'-separated list of channel names in order as they
  3002. are given as additional stream inputs for filter.
  3003. This also specify number of input streams. Number of input streams
  3004. must be not less than number of channels in first stream plus one.
  3005. @item gain
  3006. Set gain applied to audio. Value is in dB. Default is 0.
  3007. @item type
  3008. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3009. processing audio in time domain which is slow.
  3010. @var{freq} is processing audio in frequency domain which is fast.
  3011. Default is @var{freq}.
  3012. @item lfe
  3013. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3014. @item size
  3015. Set size of frame in number of samples which will be processed at once.
  3016. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3017. @item hrir
  3018. Set format of hrir stream.
  3019. Default value is @var{stereo}. Alternative value is @var{multich}.
  3020. If value is set to @var{stereo}, number of additional streams should
  3021. be greater or equal to number of input channels in first input stream.
  3022. Also each additional stream should have stereo number of channels.
  3023. If value is set to @var{multich}, number of additional streams should
  3024. be exactly one. Also number of input channels of additional stream
  3025. should be equal or greater than twice number of channels of first input
  3026. stream.
  3027. @end table
  3028. @subsection Examples
  3029. @itemize
  3030. @item
  3031. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3032. each amovie filter use stereo file with IR coefficients as input.
  3033. The files give coefficients for each position of virtual loudspeaker:
  3034. @example
  3035. ffmpeg -i input.wav
  3036. -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"
  3037. output.wav
  3038. @end example
  3039. @item
  3040. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3041. but now in @var{multich} @var{hrir} format.
  3042. @example
  3043. 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"
  3044. output.wav
  3045. @end example
  3046. @end itemize
  3047. @section highpass
  3048. Apply a high-pass filter with 3dB point frequency.
  3049. The filter can be either single-pole, or double-pole (the default).
  3050. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3051. The filter accepts the following options:
  3052. @table @option
  3053. @item frequency, f
  3054. Set frequency in Hz. Default is 3000.
  3055. @item poles, p
  3056. Set number of poles. Default is 2.
  3057. @item width_type, t
  3058. Set method to specify band-width of filter.
  3059. @table @option
  3060. @item h
  3061. Hz
  3062. @item q
  3063. Q-Factor
  3064. @item o
  3065. octave
  3066. @item s
  3067. slope
  3068. @item k
  3069. kHz
  3070. @end table
  3071. @item width, w
  3072. Specify the band-width of a filter in width_type units.
  3073. Applies only to double-pole filter.
  3074. The default is 0.707q and gives a Butterworth response.
  3075. @item mix, m
  3076. How much to use filtered signal in output. Default is 1.
  3077. Range is between 0 and 1.
  3078. @item channels, c
  3079. Specify which channels to filter, by default all available are filtered.
  3080. @item normalize, n
  3081. Normalize biquad coefficients, by default is disabled.
  3082. Enabling it will normalize magnitude response at DC to 0dB.
  3083. @end table
  3084. @subsection Commands
  3085. This filter supports the following commands:
  3086. @table @option
  3087. @item frequency, f
  3088. Change highpass frequency.
  3089. Syntax for the command is : "@var{frequency}"
  3090. @item width_type, t
  3091. Change highpass width_type.
  3092. Syntax for the command is : "@var{width_type}"
  3093. @item width, w
  3094. Change highpass width.
  3095. Syntax for the command is : "@var{width}"
  3096. @item mix, m
  3097. Change highpass mix.
  3098. Syntax for the command is : "@var{mix}"
  3099. @end table
  3100. @section join
  3101. Join multiple input streams into one multi-channel stream.
  3102. It accepts the following parameters:
  3103. @table @option
  3104. @item inputs
  3105. The number of input streams. It defaults to 2.
  3106. @item channel_layout
  3107. The desired output channel layout. It defaults to stereo.
  3108. @item map
  3109. Map channels from inputs to output. The argument is a '|'-separated list of
  3110. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3111. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3112. can be either the name of the input channel (e.g. FL for front left) or its
  3113. index in the specified input stream. @var{out_channel} is the name of the output
  3114. channel.
  3115. @end table
  3116. The filter will attempt to guess the mappings when they are not specified
  3117. explicitly. It does so by first trying to find an unused matching input channel
  3118. and if that fails it picks the first unused input channel.
  3119. Join 3 inputs (with properly set channel layouts):
  3120. @example
  3121. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3122. @end example
  3123. Build a 5.1 output from 6 single-channel streams:
  3124. @example
  3125. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3126. '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'
  3127. out
  3128. @end example
  3129. @section ladspa
  3130. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3131. To enable compilation of this filter you need to configure FFmpeg with
  3132. @code{--enable-ladspa}.
  3133. @table @option
  3134. @item file, f
  3135. Specifies the name of LADSPA plugin library to load. If the environment
  3136. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3137. each one of the directories specified by the colon separated list in
  3138. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3139. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3140. @file{/usr/lib/ladspa/}.
  3141. @item plugin, p
  3142. Specifies the plugin within the library. Some libraries contain only
  3143. one plugin, but others contain many of them. If this is not set filter
  3144. will list all available plugins within the specified library.
  3145. @item controls, c
  3146. Set the '|' separated list of controls which are zero or more floating point
  3147. values that determine the behavior of the loaded plugin (for example delay,
  3148. threshold or gain).
  3149. Controls need to be defined using the following syntax:
  3150. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3151. @var{valuei} is the value set on the @var{i}-th control.
  3152. Alternatively they can be also defined using the following syntax:
  3153. @var{value0}|@var{value1}|@var{value2}|..., where
  3154. @var{valuei} is the value set on the @var{i}-th control.
  3155. If @option{controls} is set to @code{help}, all available controls and
  3156. their valid ranges are printed.
  3157. @item sample_rate, s
  3158. Specify the sample rate, default to 44100. Only used if plugin have
  3159. zero inputs.
  3160. @item nb_samples, n
  3161. Set the number of samples per channel per each output frame, default
  3162. is 1024. Only used if plugin have zero inputs.
  3163. @item duration, d
  3164. Set the minimum duration of the sourced audio. See
  3165. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3166. for the accepted syntax.
  3167. Note that the resulting duration may be greater than the specified duration,
  3168. as the generated audio is always cut at the end of a complete frame.
  3169. If not specified, or the expressed duration is negative, the audio is
  3170. supposed to be generated forever.
  3171. Only used if plugin have zero inputs.
  3172. @end table
  3173. @subsection Examples
  3174. @itemize
  3175. @item
  3176. List all available plugins within amp (LADSPA example plugin) library:
  3177. @example
  3178. ladspa=file=amp
  3179. @end example
  3180. @item
  3181. List all available controls and their valid ranges for @code{vcf_notch}
  3182. plugin from @code{VCF} library:
  3183. @example
  3184. ladspa=f=vcf:p=vcf_notch:c=help
  3185. @end example
  3186. @item
  3187. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3188. plugin library:
  3189. @example
  3190. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3191. @end example
  3192. @item
  3193. Add reverberation to the audio using TAP-plugins
  3194. (Tom's Audio Processing plugins):
  3195. @example
  3196. ladspa=file=tap_reverb:tap_reverb
  3197. @end example
  3198. @item
  3199. Generate white noise, with 0.2 amplitude:
  3200. @example
  3201. ladspa=file=cmt:noise_source_white:c=c0=.2
  3202. @end example
  3203. @item
  3204. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3205. @code{C* Audio Plugin Suite} (CAPS) library:
  3206. @example
  3207. ladspa=file=caps:Click:c=c1=20'
  3208. @end example
  3209. @item
  3210. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3211. @example
  3212. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3213. @end example
  3214. @item
  3215. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3216. @code{SWH Plugins} collection:
  3217. @example
  3218. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3219. @end example
  3220. @item
  3221. Attenuate low frequencies using Multiband EQ from Steve Harris
  3222. @code{SWH Plugins} collection:
  3223. @example
  3224. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3225. @end example
  3226. @item
  3227. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3228. (CAPS) library:
  3229. @example
  3230. ladspa=caps:Narrower
  3231. @end example
  3232. @item
  3233. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3234. @example
  3235. ladspa=caps:White:.2
  3236. @end example
  3237. @item
  3238. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3239. @example
  3240. ladspa=caps:Fractal:c=c1=1
  3241. @end example
  3242. @item
  3243. Dynamic volume normalization using @code{VLevel} plugin:
  3244. @example
  3245. ladspa=vlevel-ladspa:vlevel_mono
  3246. @end example
  3247. @end itemize
  3248. @subsection Commands
  3249. This filter supports the following commands:
  3250. @table @option
  3251. @item cN
  3252. Modify the @var{N}-th control value.
  3253. If the specified value is not valid, it is ignored and prior one is kept.
  3254. @end table
  3255. @section loudnorm
  3256. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3257. Support for both single pass (livestreams, files) and double pass (files) modes.
  3258. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3259. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3260. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item I, i
  3264. Set integrated loudness target.
  3265. Range is -70.0 - -5.0. Default value is -24.0.
  3266. @item LRA, lra
  3267. Set loudness range target.
  3268. Range is 1.0 - 20.0. Default value is 7.0.
  3269. @item TP, tp
  3270. Set maximum true peak.
  3271. Range is -9.0 - +0.0. Default value is -2.0.
  3272. @item measured_I, measured_i
  3273. Measured IL of input file.
  3274. Range is -99.0 - +0.0.
  3275. @item measured_LRA, measured_lra
  3276. Measured LRA of input file.
  3277. Range is 0.0 - 99.0.
  3278. @item measured_TP, measured_tp
  3279. Measured true peak of input file.
  3280. Range is -99.0 - +99.0.
  3281. @item measured_thresh
  3282. Measured threshold of input file.
  3283. Range is -99.0 - +0.0.
  3284. @item offset
  3285. Set offset gain. Gain is applied before the true-peak limiter.
  3286. Range is -99.0 - +99.0. Default is +0.0.
  3287. @item linear
  3288. Normalize linearly if possible.
  3289. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3290. to be specified in order to use this mode.
  3291. Options are true or false. Default is true.
  3292. @item dual_mono
  3293. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3294. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3295. If set to @code{true}, this option will compensate for this effect.
  3296. Multi-channel input files are not affected by this option.
  3297. Options are true or false. Default is false.
  3298. @item print_format
  3299. Set print format for stats. Options are summary, json, or none.
  3300. Default value is none.
  3301. @end table
  3302. @section lowpass
  3303. Apply a low-pass filter with 3dB point frequency.
  3304. The filter can be either single-pole or double-pole (the default).
  3305. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3306. The filter accepts the following options:
  3307. @table @option
  3308. @item frequency, f
  3309. Set frequency in Hz. Default is 500.
  3310. @item poles, p
  3311. Set number of poles. Default is 2.
  3312. @item width_type, t
  3313. Set method to specify band-width of filter.
  3314. @table @option
  3315. @item h
  3316. Hz
  3317. @item q
  3318. Q-Factor
  3319. @item o
  3320. octave
  3321. @item s
  3322. slope
  3323. @item k
  3324. kHz
  3325. @end table
  3326. @item width, w
  3327. Specify the band-width of a filter in width_type units.
  3328. Applies only to double-pole filter.
  3329. The default is 0.707q and gives a Butterworth response.
  3330. @item mix, m
  3331. How much to use filtered signal in output. Default is 1.
  3332. Range is between 0 and 1.
  3333. @item channels, c
  3334. Specify which channels to filter, by default all available are filtered.
  3335. @item normalize, n
  3336. Normalize biquad coefficients, by default is disabled.
  3337. Enabling it will normalize magnitude response at DC to 0dB.
  3338. @end table
  3339. @subsection Examples
  3340. @itemize
  3341. @item
  3342. Lowpass only LFE channel, it LFE is not present it does nothing:
  3343. @example
  3344. lowpass=c=LFE
  3345. @end example
  3346. @end itemize
  3347. @subsection Commands
  3348. This filter supports the following commands:
  3349. @table @option
  3350. @item frequency, f
  3351. Change lowpass frequency.
  3352. Syntax for the command is : "@var{frequency}"
  3353. @item width_type, t
  3354. Change lowpass width_type.
  3355. Syntax for the command is : "@var{width_type}"
  3356. @item width, w
  3357. Change lowpass width.
  3358. Syntax for the command is : "@var{width}"
  3359. @item mix, m
  3360. Change lowpass mix.
  3361. Syntax for the command is : "@var{mix}"
  3362. @end table
  3363. @section lv2
  3364. Load a LV2 (LADSPA Version 2) plugin.
  3365. To enable compilation of this filter you need to configure FFmpeg with
  3366. @code{--enable-lv2}.
  3367. @table @option
  3368. @item plugin, p
  3369. Specifies the plugin URI. You may need to escape ':'.
  3370. @item controls, c
  3371. Set the '|' separated list of controls which are zero or more floating point
  3372. values that determine the behavior of the loaded plugin (for example delay,
  3373. threshold or gain).
  3374. If @option{controls} is set to @code{help}, all available controls and
  3375. their valid ranges are printed.
  3376. @item sample_rate, s
  3377. Specify the sample rate, default to 44100. Only used if plugin have
  3378. zero inputs.
  3379. @item nb_samples, n
  3380. Set the number of samples per channel per each output frame, default
  3381. is 1024. Only used if plugin have zero inputs.
  3382. @item duration, d
  3383. Set the minimum duration of the sourced audio. See
  3384. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3385. for the accepted syntax.
  3386. Note that the resulting duration may be greater than the specified duration,
  3387. as the generated audio is always cut at the end of a complete frame.
  3388. If not specified, or the expressed duration is negative, the audio is
  3389. supposed to be generated forever.
  3390. Only used if plugin have zero inputs.
  3391. @end table
  3392. @subsection Examples
  3393. @itemize
  3394. @item
  3395. Apply bass enhancer plugin from Calf:
  3396. @example
  3397. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3398. @end example
  3399. @item
  3400. Apply vinyl plugin from Calf:
  3401. @example
  3402. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3403. @end example
  3404. @item
  3405. Apply bit crusher plugin from ArtyFX:
  3406. @example
  3407. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3408. @end example
  3409. @end itemize
  3410. @section mcompand
  3411. Multiband Compress or expand the audio's dynamic range.
  3412. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3413. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3414. response when absent compander action.
  3415. It accepts the following parameters:
  3416. @table @option
  3417. @item args
  3418. This option syntax is:
  3419. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3420. For explanation of each item refer to compand filter documentation.
  3421. @end table
  3422. @anchor{pan}
  3423. @section pan
  3424. Mix channels with specific gain levels. The filter accepts the output
  3425. channel layout followed by a set of channels definitions.
  3426. This filter is also designed to efficiently remap the channels of an audio
  3427. stream.
  3428. The filter accepts parameters of the form:
  3429. "@var{l}|@var{outdef}|@var{outdef}|..."
  3430. @table @option
  3431. @item l
  3432. output channel layout or number of channels
  3433. @item outdef
  3434. output channel specification, of the form:
  3435. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3436. @item out_name
  3437. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3438. number (c0, c1, etc.)
  3439. @item gain
  3440. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3441. @item in_name
  3442. input channel to use, see out_name for details; it is not possible to mix
  3443. named and numbered input channels
  3444. @end table
  3445. If the `=' in a channel specification is replaced by `<', then the gains for
  3446. that specification will be renormalized so that the total is 1, thus
  3447. avoiding clipping noise.
  3448. @subsection Mixing examples
  3449. For example, if you want to down-mix from stereo to mono, but with a bigger
  3450. factor for the left channel:
  3451. @example
  3452. pan=1c|c0=0.9*c0+0.1*c1
  3453. @end example
  3454. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3455. 7-channels surround:
  3456. @example
  3457. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3458. @end example
  3459. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3460. that should be preferred (see "-ac" option) unless you have very specific
  3461. needs.
  3462. @subsection Remapping examples
  3463. The channel remapping will be effective if, and only if:
  3464. @itemize
  3465. @item gain coefficients are zeroes or ones,
  3466. @item only one input per channel output,
  3467. @end itemize
  3468. If all these conditions are satisfied, the filter will notify the user ("Pure
  3469. channel mapping detected"), and use an optimized and lossless method to do the
  3470. remapping.
  3471. For example, if you have a 5.1 source and want a stereo audio stream by
  3472. dropping the extra channels:
  3473. @example
  3474. pan="stereo| c0=FL | c1=FR"
  3475. @end example
  3476. Given the same source, you can also switch front left and front right channels
  3477. and keep the input channel layout:
  3478. @example
  3479. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3480. @end example
  3481. If the input is a stereo audio stream, you can mute the front left channel (and
  3482. still keep the stereo channel layout) with:
  3483. @example
  3484. pan="stereo|c1=c1"
  3485. @end example
  3486. Still with a stereo audio stream input, you can copy the right channel in both
  3487. front left and right:
  3488. @example
  3489. pan="stereo| c0=FR | c1=FR"
  3490. @end example
  3491. @section replaygain
  3492. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3493. outputs it unchanged.
  3494. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3495. @section resample
  3496. Convert the audio sample format, sample rate and channel layout. It is
  3497. not meant to be used directly.
  3498. @section rubberband
  3499. Apply time-stretching and pitch-shifting with librubberband.
  3500. To enable compilation of this filter, you need to configure FFmpeg with
  3501. @code{--enable-librubberband}.
  3502. The filter accepts the following options:
  3503. @table @option
  3504. @item tempo
  3505. Set tempo scale factor.
  3506. @item pitch
  3507. Set pitch scale factor.
  3508. @item transients
  3509. Set transients detector.
  3510. Possible values are:
  3511. @table @var
  3512. @item crisp
  3513. @item mixed
  3514. @item smooth
  3515. @end table
  3516. @item detector
  3517. Set detector.
  3518. Possible values are:
  3519. @table @var
  3520. @item compound
  3521. @item percussive
  3522. @item soft
  3523. @end table
  3524. @item phase
  3525. Set phase.
  3526. Possible values are:
  3527. @table @var
  3528. @item laminar
  3529. @item independent
  3530. @end table
  3531. @item window
  3532. Set processing window size.
  3533. Possible values are:
  3534. @table @var
  3535. @item standard
  3536. @item short
  3537. @item long
  3538. @end table
  3539. @item smoothing
  3540. Set smoothing.
  3541. Possible values are:
  3542. @table @var
  3543. @item off
  3544. @item on
  3545. @end table
  3546. @item formant
  3547. Enable formant preservation when shift pitching.
  3548. Possible values are:
  3549. @table @var
  3550. @item shifted
  3551. @item preserved
  3552. @end table
  3553. @item pitchq
  3554. Set pitch quality.
  3555. Possible values are:
  3556. @table @var
  3557. @item quality
  3558. @item speed
  3559. @item consistency
  3560. @end table
  3561. @item channels
  3562. Set channels.
  3563. Possible values are:
  3564. @table @var
  3565. @item apart
  3566. @item together
  3567. @end table
  3568. @end table
  3569. @subsection Commands
  3570. This filter supports the following commands:
  3571. @table @option
  3572. @item tempo
  3573. Change filter tempo scale factor.
  3574. Syntax for the command is : "@var{tempo}"
  3575. @item pitch
  3576. Change filter pitch scale factor.
  3577. Syntax for the command is : "@var{pitch}"
  3578. @end table
  3579. @section sidechaincompress
  3580. This filter acts like normal compressor but has the ability to compress
  3581. detected signal using second input signal.
  3582. It needs two input streams and returns one output stream.
  3583. First input stream will be processed depending on second stream signal.
  3584. The filtered signal then can be filtered with other filters in later stages of
  3585. processing. See @ref{pan} and @ref{amerge} filter.
  3586. The filter accepts the following options:
  3587. @table @option
  3588. @item level_in
  3589. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3590. @item mode
  3591. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3592. Default is @code{downward}.
  3593. @item threshold
  3594. If a signal of second stream raises above this level it will affect the gain
  3595. reduction of first stream.
  3596. By default is 0.125. Range is between 0.00097563 and 1.
  3597. @item ratio
  3598. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3599. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3600. Default is 2. Range is between 1 and 20.
  3601. @item attack
  3602. Amount of milliseconds the signal has to rise above the threshold before gain
  3603. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3604. @item release
  3605. Amount of milliseconds the signal has to fall below the threshold before
  3606. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3607. @item makeup
  3608. Set the amount by how much signal will be amplified after processing.
  3609. Default is 1. Range is from 1 to 64.
  3610. @item knee
  3611. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3612. Default is 2.82843. Range is between 1 and 8.
  3613. @item link
  3614. Choose if the @code{average} level between all channels of side-chain stream
  3615. or the louder(@code{maximum}) channel of side-chain stream affects the
  3616. reduction. Default is @code{average}.
  3617. @item detection
  3618. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3619. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3620. @item level_sc
  3621. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3622. @item mix
  3623. How much to use compressed signal in output. Default is 1.
  3624. Range is between 0 and 1.
  3625. @end table
  3626. @subsection Examples
  3627. @itemize
  3628. @item
  3629. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3630. depending on the signal of 2nd input and later compressed signal to be
  3631. merged with 2nd input:
  3632. @example
  3633. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3634. @end example
  3635. @end itemize
  3636. @section sidechaingate
  3637. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3638. filter the detected signal before sending it to the gain reduction stage.
  3639. Normally a gate uses the full range signal to detect a level above the
  3640. threshold.
  3641. For example: If you cut all lower frequencies from your sidechain signal
  3642. the gate will decrease the volume of your track only if not enough highs
  3643. appear. With this technique you are able to reduce the resonation of a
  3644. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3645. guitar.
  3646. It needs two input streams and returns one output stream.
  3647. First input stream will be processed depending on second stream signal.
  3648. The filter accepts the following options:
  3649. @table @option
  3650. @item level_in
  3651. Set input level before filtering.
  3652. Default is 1. Allowed range is from 0.015625 to 64.
  3653. @item mode
  3654. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3655. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3656. will be amplified, expanding dynamic range in upward direction.
  3657. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3658. @item range
  3659. Set the level of gain reduction when the signal is below the threshold.
  3660. Default is 0.06125. Allowed range is from 0 to 1.
  3661. Setting this to 0 disables reduction and then filter behaves like expander.
  3662. @item threshold
  3663. If a signal rises above this level the gain reduction is released.
  3664. Default is 0.125. Allowed range is from 0 to 1.
  3665. @item ratio
  3666. Set a ratio about which the signal is reduced.
  3667. Default is 2. Allowed range is from 1 to 9000.
  3668. @item attack
  3669. Amount of milliseconds the signal has to rise above the threshold before gain
  3670. reduction stops.
  3671. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3672. @item release
  3673. Amount of milliseconds the signal has to fall below the threshold before the
  3674. reduction is increased again. Default is 250 milliseconds.
  3675. Allowed range is from 0.01 to 9000.
  3676. @item makeup
  3677. Set amount of amplification of signal after processing.
  3678. Default is 1. Allowed range is from 1 to 64.
  3679. @item knee
  3680. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3681. Default is 2.828427125. Allowed range is from 1 to 8.
  3682. @item detection
  3683. Choose if exact signal should be taken for detection or an RMS like one.
  3684. Default is rms. Can be peak or rms.
  3685. @item link
  3686. Choose if the average level between all channels or the louder channel affects
  3687. the reduction.
  3688. Default is average. Can be average or maximum.
  3689. @item level_sc
  3690. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3691. @end table
  3692. @section silencedetect
  3693. Detect silence in an audio stream.
  3694. This filter logs a message when it detects that the input audio volume is less
  3695. or equal to a noise tolerance value for a duration greater or equal to the
  3696. minimum detected noise duration.
  3697. The printed times and duration are expressed in seconds. The
  3698. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  3699. is set on the first frame whose timestamp equals or exceeds the detection
  3700. duration and it contains the timestamp of the first frame of the silence.
  3701. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  3702. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  3703. keys are set on the first frame after the silence. If @option{mono} is
  3704. enabled, and each channel is evaluated separately, the @code{.X}
  3705. suffixed keys are used, and @code{X} corresponds to the channel number.
  3706. The filter accepts the following options:
  3707. @table @option
  3708. @item noise, n
  3709. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3710. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3711. @item duration, d
  3712. Set silence duration until notification (default is 2 seconds). See
  3713. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3714. for the accepted syntax.
  3715. @item mono, m
  3716. Process each channel separately, instead of combined. By default is disabled.
  3717. @end table
  3718. @subsection Examples
  3719. @itemize
  3720. @item
  3721. Detect 5 seconds of silence with -50dB noise tolerance:
  3722. @example
  3723. silencedetect=n=-50dB:d=5
  3724. @end example
  3725. @item
  3726. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3727. tolerance in @file{silence.mp3}:
  3728. @example
  3729. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3730. @end example
  3731. @end itemize
  3732. @section silenceremove
  3733. Remove silence from the beginning, middle or end of the audio.
  3734. The filter accepts the following options:
  3735. @table @option
  3736. @item start_periods
  3737. This value is used to indicate if audio should be trimmed at beginning of
  3738. the audio. A value of zero indicates no silence should be trimmed from the
  3739. beginning. When specifying a non-zero value, it trims audio up until it
  3740. finds non-silence. Normally, when trimming silence from beginning of audio
  3741. the @var{start_periods} will be @code{1} but it can be increased to higher
  3742. values to trim all audio up to specific count of non-silence periods.
  3743. Default value is @code{0}.
  3744. @item start_duration
  3745. Specify the amount of time that non-silence must be detected before it stops
  3746. trimming audio. By increasing the duration, bursts of noises can be treated
  3747. as silence and trimmed off. Default value is @code{0}.
  3748. @item start_threshold
  3749. This indicates what sample value should be treated as silence. For digital
  3750. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3751. you may wish to increase the value to account for background noise.
  3752. Can be specified in dB (in case "dB" is appended to the specified value)
  3753. or amplitude ratio. Default value is @code{0}.
  3754. @item start_silence
  3755. Specify max duration of silence at beginning that will be kept after
  3756. trimming. Default is 0, which is equal to trimming all samples detected
  3757. as silence.
  3758. @item start_mode
  3759. Specify mode of detection of silence end in start of multi-channel audio.
  3760. Can be @var{any} or @var{all}. Default is @var{any}.
  3761. With @var{any}, any sample that is detected as non-silence will cause
  3762. stopped trimming of silence.
  3763. With @var{all}, only if all channels are detected as non-silence will cause
  3764. stopped trimming of silence.
  3765. @item stop_periods
  3766. Set the count for trimming silence from the end of audio.
  3767. To remove silence from the middle of a file, specify a @var{stop_periods}
  3768. that is negative. This value is then treated as a positive value and is
  3769. used to indicate the effect should restart processing as specified by
  3770. @var{start_periods}, making it suitable for removing periods of silence
  3771. in the middle of the audio.
  3772. Default value is @code{0}.
  3773. @item stop_duration
  3774. Specify a duration of silence that must exist before audio is not copied any
  3775. more. By specifying a higher duration, silence that is wanted can be left in
  3776. the audio.
  3777. Default value is @code{0}.
  3778. @item stop_threshold
  3779. This is the same as @option{start_threshold} but for trimming silence from
  3780. the end of audio.
  3781. Can be specified in dB (in case "dB" is appended to the specified value)
  3782. or amplitude ratio. Default value is @code{0}.
  3783. @item stop_silence
  3784. Specify max duration of silence at end that will be kept after
  3785. trimming. Default is 0, which is equal to trimming all samples detected
  3786. as silence.
  3787. @item stop_mode
  3788. Specify mode of detection of silence start in end of multi-channel audio.
  3789. Can be @var{any} or @var{all}. Default is @var{any}.
  3790. With @var{any}, any sample that is detected as non-silence will cause
  3791. stopped trimming of silence.
  3792. With @var{all}, only if all channels are detected as non-silence will cause
  3793. stopped trimming of silence.
  3794. @item detection
  3795. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3796. and works better with digital silence which is exactly 0.
  3797. Default value is @code{rms}.
  3798. @item window
  3799. Set duration in number of seconds used to calculate size of window in number
  3800. of samples for detecting silence.
  3801. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3802. @end table
  3803. @subsection Examples
  3804. @itemize
  3805. @item
  3806. The following example shows how this filter can be used to start a recording
  3807. that does not contain the delay at the start which usually occurs between
  3808. pressing the record button and the start of the performance:
  3809. @example
  3810. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3811. @end example
  3812. @item
  3813. Trim all silence encountered from beginning to end where there is more than 1
  3814. second of silence in audio:
  3815. @example
  3816. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3817. @end example
  3818. @item
  3819. Trim all digital silence samples, using peak detection, from beginning to end
  3820. where there is more than 0 samples of digital silence in audio and digital
  3821. silence is detected in all channels at same positions in stream:
  3822. @example
  3823. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3824. @end example
  3825. @end itemize
  3826. @section sofalizer
  3827. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3828. loudspeakers around the user for binaural listening via headphones (audio
  3829. formats up to 9 channels supported).
  3830. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3831. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3832. Austrian Academy of Sciences.
  3833. To enable compilation of this filter you need to configure FFmpeg with
  3834. @code{--enable-libmysofa}.
  3835. The filter accepts the following options:
  3836. @table @option
  3837. @item sofa
  3838. Set the SOFA file used for rendering.
  3839. @item gain
  3840. Set gain applied to audio. Value is in dB. Default is 0.
  3841. @item rotation
  3842. Set rotation of virtual loudspeakers in deg. Default is 0.
  3843. @item elevation
  3844. Set elevation of virtual speakers in deg. Default is 0.
  3845. @item radius
  3846. Set distance in meters between loudspeakers and the listener with near-field
  3847. HRTFs. Default is 1.
  3848. @item type
  3849. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3850. processing audio in time domain which is slow.
  3851. @var{freq} is processing audio in frequency domain which is fast.
  3852. Default is @var{freq}.
  3853. @item speakers
  3854. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3855. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3856. Each virtual loudspeaker is described with short channel name following with
  3857. azimuth and elevation in degrees.
  3858. Each virtual loudspeaker description is separated by '|'.
  3859. For example to override front left and front right channel positions use:
  3860. 'speakers=FL 45 15|FR 345 15'.
  3861. Descriptions with unrecognised channel names are ignored.
  3862. @item lfegain
  3863. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3864. @item framesize
  3865. Set custom frame size in number of samples. Default is 1024.
  3866. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3867. is set to @var{freq}.
  3868. @item normalize
  3869. Should all IRs be normalized upon importing SOFA file.
  3870. By default is enabled.
  3871. @item interpolate
  3872. Should nearest IRs be interpolated with neighbor IRs if exact position
  3873. does not match. By default is disabled.
  3874. @item minphase
  3875. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3876. @item anglestep
  3877. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3878. @item radstep
  3879. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3880. @end table
  3881. @subsection Examples
  3882. @itemize
  3883. @item
  3884. Using ClubFritz6 sofa file:
  3885. @example
  3886. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3887. @end example
  3888. @item
  3889. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3890. @example
  3891. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3892. @end example
  3893. @item
  3894. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3895. and also with custom gain:
  3896. @example
  3897. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3898. @end example
  3899. @end itemize
  3900. @section stereotools
  3901. This filter has some handy utilities to manage stereo signals, for converting
  3902. M/S stereo recordings to L/R signal while having control over the parameters
  3903. or spreading the stereo image of master track.
  3904. The filter accepts the following options:
  3905. @table @option
  3906. @item level_in
  3907. Set input level before filtering for both channels. Defaults is 1.
  3908. Allowed range is from 0.015625 to 64.
  3909. @item level_out
  3910. Set output level after filtering for both channels. Defaults is 1.
  3911. Allowed range is from 0.015625 to 64.
  3912. @item balance_in
  3913. Set input balance between both channels. Default is 0.
  3914. Allowed range is from -1 to 1.
  3915. @item balance_out
  3916. Set output balance between both channels. Default is 0.
  3917. Allowed range is from -1 to 1.
  3918. @item softclip
  3919. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3920. clipping. Disabled by default.
  3921. @item mutel
  3922. Mute the left channel. Disabled by default.
  3923. @item muter
  3924. Mute the right channel. Disabled by default.
  3925. @item phasel
  3926. Change the phase of the left channel. Disabled by default.
  3927. @item phaser
  3928. Change the phase of the right channel. Disabled by default.
  3929. @item mode
  3930. Set stereo mode. Available values are:
  3931. @table @samp
  3932. @item lr>lr
  3933. Left/Right to Left/Right, this is default.
  3934. @item lr>ms
  3935. Left/Right to Mid/Side.
  3936. @item ms>lr
  3937. Mid/Side to Left/Right.
  3938. @item lr>ll
  3939. Left/Right to Left/Left.
  3940. @item lr>rr
  3941. Left/Right to Right/Right.
  3942. @item lr>l+r
  3943. Left/Right to Left + Right.
  3944. @item lr>rl
  3945. Left/Right to Right/Left.
  3946. @item ms>ll
  3947. Mid/Side to Left/Left.
  3948. @item ms>rr
  3949. Mid/Side to Right/Right.
  3950. @end table
  3951. @item slev
  3952. Set level of side signal. Default is 1.
  3953. Allowed range is from 0.015625 to 64.
  3954. @item sbal
  3955. Set balance of side signal. Default is 0.
  3956. Allowed range is from -1 to 1.
  3957. @item mlev
  3958. Set level of the middle signal. Default is 1.
  3959. Allowed range is from 0.015625 to 64.
  3960. @item mpan
  3961. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3962. @item base
  3963. Set stereo base between mono and inversed channels. Default is 0.
  3964. Allowed range is from -1 to 1.
  3965. @item delay
  3966. Set delay in milliseconds how much to delay left from right channel and
  3967. vice versa. Default is 0. Allowed range is from -20 to 20.
  3968. @item sclevel
  3969. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3970. @item phase
  3971. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3972. @item bmode_in, bmode_out
  3973. Set balance mode for balance_in/balance_out option.
  3974. Can be one of the following:
  3975. @table @samp
  3976. @item balance
  3977. Classic balance mode. Attenuate one channel at time.
  3978. Gain is raised up to 1.
  3979. @item amplitude
  3980. Similar as classic mode above but gain is raised up to 2.
  3981. @item power
  3982. Equal power distribution, from -6dB to +6dB range.
  3983. @end table
  3984. @end table
  3985. @subsection Examples
  3986. @itemize
  3987. @item
  3988. Apply karaoke like effect:
  3989. @example
  3990. stereotools=mlev=0.015625
  3991. @end example
  3992. @item
  3993. Convert M/S signal to L/R:
  3994. @example
  3995. "stereotools=mode=ms>lr"
  3996. @end example
  3997. @end itemize
  3998. @section stereowiden
  3999. This filter enhance the stereo effect by suppressing signal common to both
  4000. channels and by delaying the signal of left into right and vice versa,
  4001. thereby widening the stereo effect.
  4002. The filter accepts the following options:
  4003. @table @option
  4004. @item delay
  4005. Time in milliseconds of the delay of left signal into right and vice versa.
  4006. Default is 20 milliseconds.
  4007. @item feedback
  4008. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4009. effect of left signal in right output and vice versa which gives widening
  4010. effect. Default is 0.3.
  4011. @item crossfeed
  4012. Cross feed of left into right with inverted phase. This helps in suppressing
  4013. the mono. If the value is 1 it will cancel all the signal common to both
  4014. channels. Default is 0.3.
  4015. @item drymix
  4016. Set level of input signal of original channel. Default is 0.8.
  4017. @end table
  4018. @subsection Commands
  4019. This filter supports the all above options except @code{delay} as @ref{commands}.
  4020. @section superequalizer
  4021. Apply 18 band equalizer.
  4022. The filter accepts the following options:
  4023. @table @option
  4024. @item 1b
  4025. Set 65Hz band gain.
  4026. @item 2b
  4027. Set 92Hz band gain.
  4028. @item 3b
  4029. Set 131Hz band gain.
  4030. @item 4b
  4031. Set 185Hz band gain.
  4032. @item 5b
  4033. Set 262Hz band gain.
  4034. @item 6b
  4035. Set 370Hz band gain.
  4036. @item 7b
  4037. Set 523Hz band gain.
  4038. @item 8b
  4039. Set 740Hz band gain.
  4040. @item 9b
  4041. Set 1047Hz band gain.
  4042. @item 10b
  4043. Set 1480Hz band gain.
  4044. @item 11b
  4045. Set 2093Hz band gain.
  4046. @item 12b
  4047. Set 2960Hz band gain.
  4048. @item 13b
  4049. Set 4186Hz band gain.
  4050. @item 14b
  4051. Set 5920Hz band gain.
  4052. @item 15b
  4053. Set 8372Hz band gain.
  4054. @item 16b
  4055. Set 11840Hz band gain.
  4056. @item 17b
  4057. Set 16744Hz band gain.
  4058. @item 18b
  4059. Set 20000Hz band gain.
  4060. @end table
  4061. @section surround
  4062. Apply audio surround upmix filter.
  4063. This filter allows to produce multichannel output from audio stream.
  4064. The filter accepts the following options:
  4065. @table @option
  4066. @item chl_out
  4067. Set output channel layout. By default, this is @var{5.1}.
  4068. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4069. for the required syntax.
  4070. @item chl_in
  4071. Set input channel layout. By default, this is @var{stereo}.
  4072. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4073. for the required syntax.
  4074. @item level_in
  4075. Set input volume level. By default, this is @var{1}.
  4076. @item level_out
  4077. Set output volume level. By default, this is @var{1}.
  4078. @item lfe
  4079. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4080. @item lfe_low
  4081. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4082. @item lfe_high
  4083. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4084. @item lfe_mode
  4085. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4086. In @var{add} mode, LFE channel is created from input audio and added to output.
  4087. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4088. also all non-LFE output channels are subtracted with output LFE channel.
  4089. @item angle
  4090. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4091. Default is @var{90}.
  4092. @item fc_in
  4093. Set front center input volume. By default, this is @var{1}.
  4094. @item fc_out
  4095. Set front center output volume. By default, this is @var{1}.
  4096. @item fl_in
  4097. Set front left input volume. By default, this is @var{1}.
  4098. @item fl_out
  4099. Set front left output volume. By default, this is @var{1}.
  4100. @item fr_in
  4101. Set front right input volume. By default, this is @var{1}.
  4102. @item fr_out
  4103. Set front right output volume. By default, this is @var{1}.
  4104. @item sl_in
  4105. Set side left input volume. By default, this is @var{1}.
  4106. @item sl_out
  4107. Set side left output volume. By default, this is @var{1}.
  4108. @item sr_in
  4109. Set side right input volume. By default, this is @var{1}.
  4110. @item sr_out
  4111. Set side right output volume. By default, this is @var{1}.
  4112. @item bl_in
  4113. Set back left input volume. By default, this is @var{1}.
  4114. @item bl_out
  4115. Set back left output volume. By default, this is @var{1}.
  4116. @item br_in
  4117. Set back right input volume. By default, this is @var{1}.
  4118. @item br_out
  4119. Set back right output volume. By default, this is @var{1}.
  4120. @item bc_in
  4121. Set back center input volume. By default, this is @var{1}.
  4122. @item bc_out
  4123. Set back center output volume. By default, this is @var{1}.
  4124. @item lfe_in
  4125. Set LFE input volume. By default, this is @var{1}.
  4126. @item lfe_out
  4127. Set LFE output volume. By default, this is @var{1}.
  4128. @item allx
  4129. Set spread usage of stereo image across X axis for all channels.
  4130. @item ally
  4131. Set spread usage of stereo image across Y axis for all channels.
  4132. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4133. Set spread usage of stereo image across X axis for each channel.
  4134. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4135. Set spread usage of stereo image across Y axis for each channel.
  4136. @item win_size
  4137. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4138. @item win_func
  4139. Set window function.
  4140. It accepts the following values:
  4141. @table @samp
  4142. @item rect
  4143. @item bartlett
  4144. @item hann, hanning
  4145. @item hamming
  4146. @item blackman
  4147. @item welch
  4148. @item flattop
  4149. @item bharris
  4150. @item bnuttall
  4151. @item bhann
  4152. @item sine
  4153. @item nuttall
  4154. @item lanczos
  4155. @item gauss
  4156. @item tukey
  4157. @item dolph
  4158. @item cauchy
  4159. @item parzen
  4160. @item poisson
  4161. @item bohman
  4162. @end table
  4163. Default is @code{hann}.
  4164. @item overlap
  4165. Set window overlap. If set to 1, the recommended overlap for selected
  4166. window function will be picked. Default is @code{0.5}.
  4167. @end table
  4168. @section treble, highshelf
  4169. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4170. shelving filter with a response similar to that of a standard
  4171. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4172. The filter accepts the following options:
  4173. @table @option
  4174. @item gain, g
  4175. Give the gain at whichever is the lower of ~22 kHz and the
  4176. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4177. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4178. @item frequency, f
  4179. Set the filter's central frequency and so can be used
  4180. to extend or reduce the frequency range to be boosted or cut.
  4181. The default value is @code{3000} Hz.
  4182. @item width_type, t
  4183. Set method to specify band-width of filter.
  4184. @table @option
  4185. @item h
  4186. Hz
  4187. @item q
  4188. Q-Factor
  4189. @item o
  4190. octave
  4191. @item s
  4192. slope
  4193. @item k
  4194. kHz
  4195. @end table
  4196. @item width, w
  4197. Determine how steep is the filter's shelf transition.
  4198. @item mix, m
  4199. How much to use filtered signal in output. Default is 1.
  4200. Range is between 0 and 1.
  4201. @item channels, c
  4202. Specify which channels to filter, by default all available are filtered.
  4203. @item normalize, n
  4204. Normalize biquad coefficients, by default is disabled.
  4205. Enabling it will normalize magnitude response at DC to 0dB.
  4206. @end table
  4207. @subsection Commands
  4208. This filter supports the following commands:
  4209. @table @option
  4210. @item frequency, f
  4211. Change treble frequency.
  4212. Syntax for the command is : "@var{frequency}"
  4213. @item width_type, t
  4214. Change treble width_type.
  4215. Syntax for the command is : "@var{width_type}"
  4216. @item width, w
  4217. Change treble width.
  4218. Syntax for the command is : "@var{width}"
  4219. @item gain, g
  4220. Change treble gain.
  4221. Syntax for the command is : "@var{gain}"
  4222. @item mix, m
  4223. Change treble mix.
  4224. Syntax for the command is : "@var{mix}"
  4225. @end table
  4226. @section tremolo
  4227. Sinusoidal amplitude modulation.
  4228. The filter accepts the following options:
  4229. @table @option
  4230. @item f
  4231. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4232. (20 Hz or lower) will result in a tremolo effect.
  4233. This filter may also be used as a ring modulator by specifying
  4234. a modulation frequency higher than 20 Hz.
  4235. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4236. @item d
  4237. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4238. Default value is 0.5.
  4239. @end table
  4240. @section vibrato
  4241. Sinusoidal phase modulation.
  4242. The filter accepts the following options:
  4243. @table @option
  4244. @item f
  4245. Modulation frequency in Hertz.
  4246. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4247. @item d
  4248. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4249. Default value is 0.5.
  4250. @end table
  4251. @section volume
  4252. Adjust the input audio volume.
  4253. It accepts the following parameters:
  4254. @table @option
  4255. @item volume
  4256. Set audio volume expression.
  4257. Output values are clipped to the maximum value.
  4258. The output audio volume is given by the relation:
  4259. @example
  4260. @var{output_volume} = @var{volume} * @var{input_volume}
  4261. @end example
  4262. The default value for @var{volume} is "1.0".
  4263. @item precision
  4264. This parameter represents the mathematical precision.
  4265. It determines which input sample formats will be allowed, which affects the
  4266. precision of the volume scaling.
  4267. @table @option
  4268. @item fixed
  4269. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4270. @item float
  4271. 32-bit floating-point; this limits input sample format to FLT. (default)
  4272. @item double
  4273. 64-bit floating-point; this limits input sample format to DBL.
  4274. @end table
  4275. @item replaygain
  4276. Choose the behaviour on encountering ReplayGain side data in input frames.
  4277. @table @option
  4278. @item drop
  4279. Remove ReplayGain side data, ignoring its contents (the default).
  4280. @item ignore
  4281. Ignore ReplayGain side data, but leave it in the frame.
  4282. @item track
  4283. Prefer the track gain, if present.
  4284. @item album
  4285. Prefer the album gain, if present.
  4286. @end table
  4287. @item replaygain_preamp
  4288. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4289. Default value for @var{replaygain_preamp} is 0.0.
  4290. @item eval
  4291. Set when the volume expression is evaluated.
  4292. It accepts the following values:
  4293. @table @samp
  4294. @item once
  4295. only evaluate expression once during the filter initialization, or
  4296. when the @samp{volume} command is sent
  4297. @item frame
  4298. evaluate expression for each incoming frame
  4299. @end table
  4300. Default value is @samp{once}.
  4301. @end table
  4302. The volume expression can contain the following parameters.
  4303. @table @option
  4304. @item n
  4305. frame number (starting at zero)
  4306. @item nb_channels
  4307. number of channels
  4308. @item nb_consumed_samples
  4309. number of samples consumed by the filter
  4310. @item nb_samples
  4311. number of samples in the current frame
  4312. @item pos
  4313. original frame position in the file
  4314. @item pts
  4315. frame PTS
  4316. @item sample_rate
  4317. sample rate
  4318. @item startpts
  4319. PTS at start of stream
  4320. @item startt
  4321. time at start of stream
  4322. @item t
  4323. frame time
  4324. @item tb
  4325. timestamp timebase
  4326. @item volume
  4327. last set volume value
  4328. @end table
  4329. Note that when @option{eval} is set to @samp{once} only the
  4330. @var{sample_rate} and @var{tb} variables are available, all other
  4331. variables will evaluate to NAN.
  4332. @subsection Commands
  4333. This filter supports the following commands:
  4334. @table @option
  4335. @item volume
  4336. Modify the volume expression.
  4337. The command accepts the same syntax of the corresponding option.
  4338. If the specified expression is not valid, it is kept at its current
  4339. value.
  4340. @item replaygain_noclip
  4341. Prevent clipping by limiting the gain applied.
  4342. Default value for @var{replaygain_noclip} is 1.
  4343. @end table
  4344. @subsection Examples
  4345. @itemize
  4346. @item
  4347. Halve the input audio volume:
  4348. @example
  4349. volume=volume=0.5
  4350. volume=volume=1/2
  4351. volume=volume=-6.0206dB
  4352. @end example
  4353. In all the above example the named key for @option{volume} can be
  4354. omitted, for example like in:
  4355. @example
  4356. volume=0.5
  4357. @end example
  4358. @item
  4359. Increase input audio power by 6 decibels using fixed-point precision:
  4360. @example
  4361. volume=volume=6dB:precision=fixed
  4362. @end example
  4363. @item
  4364. Fade volume after time 10 with an annihilation period of 5 seconds:
  4365. @example
  4366. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4367. @end example
  4368. @end itemize
  4369. @section volumedetect
  4370. Detect the volume of the input video.
  4371. The filter has no parameters. The input is not modified. Statistics about
  4372. the volume will be printed in the log when the input stream end is reached.
  4373. In particular it will show the mean volume (root mean square), maximum
  4374. volume (on a per-sample basis), and the beginning of a histogram of the
  4375. registered volume values (from the maximum value to a cumulated 1/1000 of
  4376. the samples).
  4377. All volumes are in decibels relative to the maximum PCM value.
  4378. @subsection Examples
  4379. Here is an excerpt of the output:
  4380. @example
  4381. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4382. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4383. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4384. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4385. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4386. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4387. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4388. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4389. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4390. @end example
  4391. It means that:
  4392. @itemize
  4393. @item
  4394. The mean square energy is approximately -27 dB, or 10^-2.7.
  4395. @item
  4396. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4397. @item
  4398. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4399. @end itemize
  4400. In other words, raising the volume by +4 dB does not cause any clipping,
  4401. raising it by +5 dB causes clipping for 6 samples, etc.
  4402. @c man end AUDIO FILTERS
  4403. @chapter Audio Sources
  4404. @c man begin AUDIO SOURCES
  4405. Below is a description of the currently available audio sources.
  4406. @section abuffer
  4407. Buffer audio frames, and make them available to the filter chain.
  4408. This source is mainly intended for a programmatic use, in particular
  4409. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4410. It accepts the following parameters:
  4411. @table @option
  4412. @item time_base
  4413. The timebase which will be used for timestamps of submitted frames. It must be
  4414. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4415. @item sample_rate
  4416. The sample rate of the incoming audio buffers.
  4417. @item sample_fmt
  4418. The sample format of the incoming audio buffers.
  4419. Either a sample format name or its corresponding integer representation from
  4420. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4421. @item channel_layout
  4422. The channel layout of the incoming audio buffers.
  4423. Either a channel layout name from channel_layout_map in
  4424. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4425. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4426. @item channels
  4427. The number of channels of the incoming audio buffers.
  4428. If both @var{channels} and @var{channel_layout} are specified, then they
  4429. must be consistent.
  4430. @end table
  4431. @subsection Examples
  4432. @example
  4433. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4434. @end example
  4435. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4436. Since the sample format with name "s16p" corresponds to the number
  4437. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4438. equivalent to:
  4439. @example
  4440. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4441. @end example
  4442. @section aevalsrc
  4443. Generate an audio signal specified by an expression.
  4444. This source accepts in input one or more expressions (one for each
  4445. channel), which are evaluated and used to generate a corresponding
  4446. audio signal.
  4447. This source accepts the following options:
  4448. @table @option
  4449. @item exprs
  4450. Set the '|'-separated expressions list for each separate channel. In case the
  4451. @option{channel_layout} option is not specified, the selected channel layout
  4452. depends on the number of provided expressions. Otherwise the last
  4453. specified expression is applied to the remaining output channels.
  4454. @item channel_layout, c
  4455. Set the channel layout. The number of channels in the specified layout
  4456. must be equal to the number of specified expressions.
  4457. @item duration, d
  4458. Set the minimum duration of the sourced audio. See
  4459. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4460. for the accepted syntax.
  4461. Note that the resulting duration may be greater than the specified
  4462. duration, as the generated audio is always cut at the end of a
  4463. complete frame.
  4464. If not specified, or the expressed duration is negative, the audio is
  4465. supposed to be generated forever.
  4466. @item nb_samples, n
  4467. Set the number of samples per channel per each output frame,
  4468. default to 1024.
  4469. @item sample_rate, s
  4470. Specify the sample rate, default to 44100.
  4471. @end table
  4472. Each expression in @var{exprs} can contain the following constants:
  4473. @table @option
  4474. @item n
  4475. number of the evaluated sample, starting from 0
  4476. @item t
  4477. time of the evaluated sample expressed in seconds, starting from 0
  4478. @item s
  4479. sample rate
  4480. @end table
  4481. @subsection Examples
  4482. @itemize
  4483. @item
  4484. Generate silence:
  4485. @example
  4486. aevalsrc=0
  4487. @end example
  4488. @item
  4489. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4490. 8000 Hz:
  4491. @example
  4492. aevalsrc="sin(440*2*PI*t):s=8000"
  4493. @end example
  4494. @item
  4495. Generate a two channels signal, specify the channel layout (Front
  4496. Center + Back Center) explicitly:
  4497. @example
  4498. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4499. @end example
  4500. @item
  4501. Generate white noise:
  4502. @example
  4503. aevalsrc="-2+random(0)"
  4504. @end example
  4505. @item
  4506. Generate an amplitude modulated signal:
  4507. @example
  4508. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4509. @end example
  4510. @item
  4511. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4512. @example
  4513. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4514. @end example
  4515. @end itemize
  4516. @section anullsrc
  4517. The null audio source, return unprocessed audio frames. It is mainly useful
  4518. as a template and to be employed in analysis / debugging tools, or as
  4519. the source for filters which ignore the input data (for example the sox
  4520. synth filter).
  4521. This source accepts the following options:
  4522. @table @option
  4523. @item channel_layout, cl
  4524. Specifies the channel layout, and can be either an integer or a string
  4525. representing a channel layout. The default value of @var{channel_layout}
  4526. is "stereo".
  4527. Check the channel_layout_map definition in
  4528. @file{libavutil/channel_layout.c} for the mapping between strings and
  4529. channel layout values.
  4530. @item sample_rate, r
  4531. Specifies the sample rate, and defaults to 44100.
  4532. @item nb_samples, n
  4533. Set the number of samples per requested frames.
  4534. @end table
  4535. @subsection Examples
  4536. @itemize
  4537. @item
  4538. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4539. @example
  4540. anullsrc=r=48000:cl=4
  4541. @end example
  4542. @item
  4543. Do the same operation with a more obvious syntax:
  4544. @example
  4545. anullsrc=r=48000:cl=mono
  4546. @end example
  4547. @end itemize
  4548. All the parameters need to be explicitly defined.
  4549. @section flite
  4550. Synthesize a voice utterance using the libflite library.
  4551. To enable compilation of this filter you need to configure FFmpeg with
  4552. @code{--enable-libflite}.
  4553. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4554. The filter accepts the following options:
  4555. @table @option
  4556. @item list_voices
  4557. If set to 1, list the names of the available voices and exit
  4558. immediately. Default value is 0.
  4559. @item nb_samples, n
  4560. Set the maximum number of samples per frame. Default value is 512.
  4561. @item textfile
  4562. Set the filename containing the text to speak.
  4563. @item text
  4564. Set the text to speak.
  4565. @item voice, v
  4566. Set the voice to use for the speech synthesis. Default value is
  4567. @code{kal}. See also the @var{list_voices} option.
  4568. @end table
  4569. @subsection Examples
  4570. @itemize
  4571. @item
  4572. Read from file @file{speech.txt}, and synthesize the text using the
  4573. standard flite voice:
  4574. @example
  4575. flite=textfile=speech.txt
  4576. @end example
  4577. @item
  4578. Read the specified text selecting the @code{slt} voice:
  4579. @example
  4580. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4581. @end example
  4582. @item
  4583. Input text to ffmpeg:
  4584. @example
  4585. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4586. @end example
  4587. @item
  4588. Make @file{ffplay} speak the specified text, using @code{flite} and
  4589. the @code{lavfi} device:
  4590. @example
  4591. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4592. @end example
  4593. @end itemize
  4594. For more information about libflite, check:
  4595. @url{http://www.festvox.org/flite/}
  4596. @section anoisesrc
  4597. Generate a noise audio signal.
  4598. The filter accepts the following options:
  4599. @table @option
  4600. @item sample_rate, r
  4601. Specify the sample rate. Default value is 48000 Hz.
  4602. @item amplitude, a
  4603. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4604. is 1.0.
  4605. @item duration, d
  4606. Specify the duration of the generated audio stream. Not specifying this option
  4607. results in noise with an infinite length.
  4608. @item color, colour, c
  4609. Specify the color of noise. Available noise colors are white, pink, brown,
  4610. blue and violet. Default color is white.
  4611. @item seed, s
  4612. Specify a value used to seed the PRNG.
  4613. @item nb_samples, n
  4614. Set the number of samples per each output frame, default is 1024.
  4615. @end table
  4616. @subsection Examples
  4617. @itemize
  4618. @item
  4619. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4620. @example
  4621. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4622. @end example
  4623. @end itemize
  4624. @section hilbert
  4625. Generate odd-tap Hilbert transform FIR coefficients.
  4626. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4627. the signal by 90 degrees.
  4628. This is used in many matrix coding schemes and for analytic signal generation.
  4629. The process is often written as a multiplication by i (or j), the imaginary unit.
  4630. The filter accepts the following options:
  4631. @table @option
  4632. @item sample_rate, s
  4633. Set sample rate, default is 44100.
  4634. @item taps, t
  4635. Set length of FIR filter, default is 22051.
  4636. @item nb_samples, n
  4637. Set number of samples per each frame.
  4638. @item win_func, w
  4639. Set window function to be used when generating FIR coefficients.
  4640. @end table
  4641. @section sinc
  4642. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4643. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4644. The filter accepts the following options:
  4645. @table @option
  4646. @item sample_rate, r
  4647. Set sample rate, default is 44100.
  4648. @item nb_samples, n
  4649. Set number of samples per each frame. Default is 1024.
  4650. @item hp
  4651. Set high-pass frequency. Default is 0.
  4652. @item lp
  4653. Set low-pass frequency. Default is 0.
  4654. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4655. is higher than 0 then filter will create band-pass filter coefficients,
  4656. otherwise band-reject filter coefficients.
  4657. @item phase
  4658. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4659. @item beta
  4660. Set Kaiser window beta.
  4661. @item att
  4662. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4663. @item round
  4664. Enable rounding, by default is disabled.
  4665. @item hptaps
  4666. Set number of taps for high-pass filter.
  4667. @item lptaps
  4668. Set number of taps for low-pass filter.
  4669. @end table
  4670. @section sine
  4671. Generate an audio signal made of a sine wave with amplitude 1/8.
  4672. The audio signal is bit-exact.
  4673. The filter accepts the following options:
  4674. @table @option
  4675. @item frequency, f
  4676. Set the carrier frequency. Default is 440 Hz.
  4677. @item beep_factor, b
  4678. Enable a periodic beep every second with frequency @var{beep_factor} times
  4679. the carrier frequency. Default is 0, meaning the beep is disabled.
  4680. @item sample_rate, r
  4681. Specify the sample rate, default is 44100.
  4682. @item duration, d
  4683. Specify the duration of the generated audio stream.
  4684. @item samples_per_frame
  4685. Set the number of samples per output frame.
  4686. The expression can contain the following constants:
  4687. @table @option
  4688. @item n
  4689. The (sequential) number of the output audio frame, starting from 0.
  4690. @item pts
  4691. The PTS (Presentation TimeStamp) of the output audio frame,
  4692. expressed in @var{TB} units.
  4693. @item t
  4694. The PTS of the output audio frame, expressed in seconds.
  4695. @item TB
  4696. The timebase of the output audio frames.
  4697. @end table
  4698. Default is @code{1024}.
  4699. @end table
  4700. @subsection Examples
  4701. @itemize
  4702. @item
  4703. Generate a simple 440 Hz sine wave:
  4704. @example
  4705. sine
  4706. @end example
  4707. @item
  4708. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4709. @example
  4710. sine=220:4:d=5
  4711. sine=f=220:b=4:d=5
  4712. sine=frequency=220:beep_factor=4:duration=5
  4713. @end example
  4714. @item
  4715. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4716. pattern:
  4717. @example
  4718. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4719. @end example
  4720. @end itemize
  4721. @c man end AUDIO SOURCES
  4722. @chapter Audio Sinks
  4723. @c man begin AUDIO SINKS
  4724. Below is a description of the currently available audio sinks.
  4725. @section abuffersink
  4726. Buffer audio frames, and make them available to the end of filter chain.
  4727. This sink is mainly intended for programmatic use, in particular
  4728. through the interface defined in @file{libavfilter/buffersink.h}
  4729. or the options system.
  4730. It accepts a pointer to an AVABufferSinkContext structure, which
  4731. defines the incoming buffers' formats, to be passed as the opaque
  4732. parameter to @code{avfilter_init_filter} for initialization.
  4733. @section anullsink
  4734. Null audio sink; do absolutely nothing with the input audio. It is
  4735. mainly useful as a template and for use in analysis / debugging
  4736. tools.
  4737. @c man end AUDIO SINKS
  4738. @chapter Video Filters
  4739. @c man begin VIDEO FILTERS
  4740. When you configure your FFmpeg build, you can disable any of the
  4741. existing filters using @code{--disable-filters}.
  4742. The configure output will show the video filters included in your
  4743. build.
  4744. Below is a description of the currently available video filters.
  4745. @section addroi
  4746. Mark a region of interest in a video frame.
  4747. The frame data is passed through unchanged, but metadata is attached
  4748. to the frame indicating regions of interest which can affect the
  4749. behaviour of later encoding. Multiple regions can be marked by
  4750. applying the filter multiple times.
  4751. @table @option
  4752. @item x
  4753. Region distance in pixels from the left edge of the frame.
  4754. @item y
  4755. Region distance in pixels from the top edge of the frame.
  4756. @item w
  4757. Region width in pixels.
  4758. @item h
  4759. Region height in pixels.
  4760. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4761. and may contain the following variables:
  4762. @table @option
  4763. @item iw
  4764. Width of the input frame.
  4765. @item ih
  4766. Height of the input frame.
  4767. @end table
  4768. @item qoffset
  4769. Quantisation offset to apply within the region.
  4770. This must be a real value in the range -1 to +1. A value of zero
  4771. indicates no quality change. A negative value asks for better quality
  4772. (less quantisation), while a positive value asks for worse quality
  4773. (greater quantisation).
  4774. The range is calibrated so that the extreme values indicate the
  4775. largest possible offset - if the rest of the frame is encoded with the
  4776. worst possible quality, an offset of -1 indicates that this region
  4777. should be encoded with the best possible quality anyway. Intermediate
  4778. values are then interpolated in some codec-dependent way.
  4779. For example, in 10-bit H.264 the quantisation parameter varies between
  4780. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4781. this region should be encoded with a QP around one-tenth of the full
  4782. range better than the rest of the frame. So, if most of the frame
  4783. were to be encoded with a QP of around 30, this region would get a QP
  4784. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4785. An extreme value of -1 would indicate that this region should be
  4786. encoded with the best possible quality regardless of the treatment of
  4787. the rest of the frame - that is, should be encoded at a QP of -12.
  4788. @item clear
  4789. If set to true, remove any existing regions of interest marked on the
  4790. frame before adding the new one.
  4791. @end table
  4792. @subsection Examples
  4793. @itemize
  4794. @item
  4795. Mark the centre quarter of the frame as interesting.
  4796. @example
  4797. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4798. @end example
  4799. @item
  4800. Mark the 100-pixel-wide region on the left edge of the frame as very
  4801. uninteresting (to be encoded at much lower quality than the rest of
  4802. the frame).
  4803. @example
  4804. addroi=0:0:100:ih:+1/5
  4805. @end example
  4806. @end itemize
  4807. @section alphaextract
  4808. Extract the alpha component from the input as a grayscale video. This
  4809. is especially useful with the @var{alphamerge} filter.
  4810. @section alphamerge
  4811. Add or replace the alpha component of the primary input with the
  4812. grayscale value of a second input. This is intended for use with
  4813. @var{alphaextract} to allow the transmission or storage of frame
  4814. sequences that have alpha in a format that doesn't support an alpha
  4815. channel.
  4816. For example, to reconstruct full frames from a normal YUV-encoded video
  4817. and a separate video created with @var{alphaextract}, you might use:
  4818. @example
  4819. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4820. @end example
  4821. Since this filter is designed for reconstruction, it operates on frame
  4822. sequences without considering timestamps, and terminates when either
  4823. input reaches end of stream. This will cause problems if your encoding
  4824. pipeline drops frames. If you're trying to apply an image as an
  4825. overlay to a video stream, consider the @var{overlay} filter instead.
  4826. @section amplify
  4827. Amplify differences between current pixel and pixels of adjacent frames in
  4828. same pixel location.
  4829. This filter accepts the following options:
  4830. @table @option
  4831. @item radius
  4832. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4833. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4834. @item factor
  4835. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4836. @item threshold
  4837. Set threshold for difference amplification. Any difference greater or equal to
  4838. this value will not alter source pixel. Default is 10.
  4839. Allowed range is from 0 to 65535.
  4840. @item tolerance
  4841. Set tolerance for difference amplification. Any difference lower to
  4842. this value will not alter source pixel. Default is 0.
  4843. Allowed range is from 0 to 65535.
  4844. @item low
  4845. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4846. This option controls maximum possible value that will decrease source pixel value.
  4847. @item high
  4848. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4849. This option controls maximum possible value that will increase source pixel value.
  4850. @item planes
  4851. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4852. @end table
  4853. @subsection Commands
  4854. This filter supports the following @ref{commands} that corresponds to option of same name:
  4855. @table @option
  4856. @item factor
  4857. @item threshold
  4858. @item tolerance
  4859. @item low
  4860. @item high
  4861. @item planes
  4862. @end table
  4863. @section ass
  4864. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4865. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4866. Substation Alpha) subtitles files.
  4867. This filter accepts the following option in addition to the common options from
  4868. the @ref{subtitles} filter:
  4869. @table @option
  4870. @item shaping
  4871. Set the shaping engine
  4872. Available values are:
  4873. @table @samp
  4874. @item auto
  4875. The default libass shaping engine, which is the best available.
  4876. @item simple
  4877. Fast, font-agnostic shaper that can do only substitutions
  4878. @item complex
  4879. Slower shaper using OpenType for substitutions and positioning
  4880. @end table
  4881. The default is @code{auto}.
  4882. @end table
  4883. @section atadenoise
  4884. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4885. The filter accepts the following options:
  4886. @table @option
  4887. @item 0a
  4888. Set threshold A for 1st plane. Default is 0.02.
  4889. Valid range is 0 to 0.3.
  4890. @item 0b
  4891. Set threshold B for 1st plane. Default is 0.04.
  4892. Valid range is 0 to 5.
  4893. @item 1a
  4894. Set threshold A for 2nd plane. Default is 0.02.
  4895. Valid range is 0 to 0.3.
  4896. @item 1b
  4897. Set threshold B for 2nd plane. Default is 0.04.
  4898. Valid range is 0 to 5.
  4899. @item 2a
  4900. Set threshold A for 3rd plane. Default is 0.02.
  4901. Valid range is 0 to 0.3.
  4902. @item 2b
  4903. Set threshold B for 3rd plane. Default is 0.04.
  4904. Valid range is 0 to 5.
  4905. Threshold A is designed to react on abrupt changes in the input signal and
  4906. threshold B is designed to react on continuous changes in the input signal.
  4907. @item s
  4908. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4909. number in range [5, 129].
  4910. @item p
  4911. Set what planes of frame filter will use for averaging. Default is all.
  4912. @item a
  4913. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  4914. Alternatively can be set to @code{s} serial.
  4915. Parallel can be faster then serial, while other way around is never true.
  4916. Parallel will abort early on first change being greater then thresholds, while serial
  4917. will continue processing other side of frames if they are equal or bellow thresholds.
  4918. @end table
  4919. @subsection Commands
  4920. This filter supports same @ref{commands} as options except option @code{s}.
  4921. The command accepts the same syntax of the corresponding option.
  4922. @section avgblur
  4923. Apply average blur filter.
  4924. The filter accepts the following options:
  4925. @table @option
  4926. @item sizeX
  4927. Set horizontal radius size.
  4928. @item planes
  4929. Set which planes to filter. By default all planes are filtered.
  4930. @item sizeY
  4931. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4932. Default is @code{0}.
  4933. @end table
  4934. @subsection Commands
  4935. This filter supports same commands as options.
  4936. The command accepts the same syntax of the corresponding option.
  4937. If the specified expression is not valid, it is kept at its current
  4938. value.
  4939. @section bbox
  4940. Compute the bounding box for the non-black pixels in the input frame
  4941. luminance plane.
  4942. This filter computes the bounding box containing all the pixels with a
  4943. luminance value greater than the minimum allowed value.
  4944. The parameters describing the bounding box are printed on the filter
  4945. log.
  4946. The filter accepts the following option:
  4947. @table @option
  4948. @item min_val
  4949. Set the minimal luminance value. Default is @code{16}.
  4950. @end table
  4951. @section bilateral
  4952. Apply bilateral filter, spatial smoothing while preserving edges.
  4953. The filter accepts the following options:
  4954. @table @option
  4955. @item sigmaS
  4956. Set sigma of gaussian function to calculate spatial weight.
  4957. Allowed range is 0 to 10. Default is 0.1.
  4958. @item sigmaR
  4959. Set sigma of gaussian function to calculate range weight.
  4960. Allowed range is 0 to 1. Default is 0.1.
  4961. @item planes
  4962. Set planes to filter. Default is first only.
  4963. @end table
  4964. @section bitplanenoise
  4965. Show and measure bit plane noise.
  4966. The filter accepts the following options:
  4967. @table @option
  4968. @item bitplane
  4969. Set which plane to analyze. Default is @code{1}.
  4970. @item filter
  4971. Filter out noisy pixels from @code{bitplane} set above.
  4972. Default is disabled.
  4973. @end table
  4974. @section blackdetect
  4975. Detect video intervals that are (almost) completely black. Can be
  4976. useful to detect chapter transitions, commercials, or invalid
  4977. recordings. Output lines contains the time for the start, end and
  4978. duration of the detected black interval expressed in seconds.
  4979. In order to display the output lines, you need to set the loglevel at
  4980. least to the AV_LOG_INFO value.
  4981. The filter accepts the following options:
  4982. @table @option
  4983. @item black_min_duration, d
  4984. Set the minimum detected black duration expressed in seconds. It must
  4985. be a non-negative floating point number.
  4986. Default value is 2.0.
  4987. @item picture_black_ratio_th, pic_th
  4988. Set the threshold for considering a picture "black".
  4989. Express the minimum value for the ratio:
  4990. @example
  4991. @var{nb_black_pixels} / @var{nb_pixels}
  4992. @end example
  4993. for which a picture is considered black.
  4994. Default value is 0.98.
  4995. @item pixel_black_th, pix_th
  4996. Set the threshold for considering a pixel "black".
  4997. The threshold expresses the maximum pixel luminance value for which a
  4998. pixel is considered "black". The provided value is scaled according to
  4999. the following equation:
  5000. @example
  5001. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5002. @end example
  5003. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5004. the input video format, the range is [0-255] for YUV full-range
  5005. formats and [16-235] for YUV non full-range formats.
  5006. Default value is 0.10.
  5007. @end table
  5008. The following example sets the maximum pixel threshold to the minimum
  5009. value, and detects only black intervals of 2 or more seconds:
  5010. @example
  5011. blackdetect=d=2:pix_th=0.00
  5012. @end example
  5013. @section blackframe
  5014. Detect frames that are (almost) completely black. Can be useful to
  5015. detect chapter transitions or commercials. Output lines consist of
  5016. the frame number of the detected frame, the percentage of blackness,
  5017. the position in the file if known or -1 and the timestamp in seconds.
  5018. In order to display the output lines, you need to set the loglevel at
  5019. least to the AV_LOG_INFO value.
  5020. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5021. The value represents the percentage of pixels in the picture that
  5022. are below the threshold value.
  5023. It accepts the following parameters:
  5024. @table @option
  5025. @item amount
  5026. The percentage of the pixels that have to be below the threshold; it defaults to
  5027. @code{98}.
  5028. @item threshold, thresh
  5029. The threshold below which a pixel value is considered black; it defaults to
  5030. @code{32}.
  5031. @end table
  5032. @section blend, tblend
  5033. Blend two video frames into each other.
  5034. The @code{blend} filter takes two input streams and outputs one
  5035. stream, the first input is the "top" layer and second input is
  5036. "bottom" layer. By default, the output terminates when the longest input terminates.
  5037. The @code{tblend} (time blend) filter takes two consecutive frames
  5038. from one single stream, and outputs the result obtained by blending
  5039. the new frame on top of the old frame.
  5040. A description of the accepted options follows.
  5041. @table @option
  5042. @item c0_mode
  5043. @item c1_mode
  5044. @item c2_mode
  5045. @item c3_mode
  5046. @item all_mode
  5047. Set blend mode for specific pixel component or all pixel components in case
  5048. of @var{all_mode}. Default value is @code{normal}.
  5049. Available values for component modes are:
  5050. @table @samp
  5051. @item addition
  5052. @item grainmerge
  5053. @item and
  5054. @item average
  5055. @item burn
  5056. @item darken
  5057. @item difference
  5058. @item grainextract
  5059. @item divide
  5060. @item dodge
  5061. @item freeze
  5062. @item exclusion
  5063. @item extremity
  5064. @item glow
  5065. @item hardlight
  5066. @item hardmix
  5067. @item heat
  5068. @item lighten
  5069. @item linearlight
  5070. @item multiply
  5071. @item multiply128
  5072. @item negation
  5073. @item normal
  5074. @item or
  5075. @item overlay
  5076. @item phoenix
  5077. @item pinlight
  5078. @item reflect
  5079. @item screen
  5080. @item softlight
  5081. @item subtract
  5082. @item vividlight
  5083. @item xor
  5084. @end table
  5085. @item c0_opacity
  5086. @item c1_opacity
  5087. @item c2_opacity
  5088. @item c3_opacity
  5089. @item all_opacity
  5090. Set blend opacity for specific pixel component or all pixel components in case
  5091. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5092. @item c0_expr
  5093. @item c1_expr
  5094. @item c2_expr
  5095. @item c3_expr
  5096. @item all_expr
  5097. Set blend expression for specific pixel component or all pixel components in case
  5098. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5099. The expressions can use the following variables:
  5100. @table @option
  5101. @item N
  5102. The sequential number of the filtered frame, starting from @code{0}.
  5103. @item X
  5104. @item Y
  5105. the coordinates of the current sample
  5106. @item W
  5107. @item H
  5108. the width and height of currently filtered plane
  5109. @item SW
  5110. @item SH
  5111. Width and height scale for the plane being filtered. It is the
  5112. ratio between the dimensions of the current plane to the luma plane,
  5113. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5114. the luma plane and @code{0.5,0.5} for the chroma planes.
  5115. @item T
  5116. Time of the current frame, expressed in seconds.
  5117. @item TOP, A
  5118. Value of pixel component at current location for first video frame (top layer).
  5119. @item BOTTOM, B
  5120. Value of pixel component at current location for second video frame (bottom layer).
  5121. @end table
  5122. @end table
  5123. The @code{blend} filter also supports the @ref{framesync} options.
  5124. @subsection Examples
  5125. @itemize
  5126. @item
  5127. Apply transition from bottom layer to top layer in first 10 seconds:
  5128. @example
  5129. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5130. @end example
  5131. @item
  5132. Apply linear horizontal transition from top layer to bottom layer:
  5133. @example
  5134. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5135. @end example
  5136. @item
  5137. Apply 1x1 checkerboard effect:
  5138. @example
  5139. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5140. @end example
  5141. @item
  5142. Apply uncover left effect:
  5143. @example
  5144. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5145. @end example
  5146. @item
  5147. Apply uncover down effect:
  5148. @example
  5149. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5150. @end example
  5151. @item
  5152. Apply uncover up-left effect:
  5153. @example
  5154. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5155. @end example
  5156. @item
  5157. Split diagonally video and shows top and bottom layer on each side:
  5158. @example
  5159. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5160. @end example
  5161. @item
  5162. Display differences between the current and the previous frame:
  5163. @example
  5164. tblend=all_mode=grainextract
  5165. @end example
  5166. @end itemize
  5167. @section bm3d
  5168. Denoise frames using Block-Matching 3D algorithm.
  5169. The filter accepts the following options.
  5170. @table @option
  5171. @item sigma
  5172. Set denoising strength. Default value is 1.
  5173. Allowed range is from 0 to 999.9.
  5174. The denoising algorithm is very sensitive to sigma, so adjust it
  5175. according to the source.
  5176. @item block
  5177. Set local patch size. This sets dimensions in 2D.
  5178. @item bstep
  5179. Set sliding step for processing blocks. Default value is 4.
  5180. Allowed range is from 1 to 64.
  5181. Smaller values allows processing more reference blocks and is slower.
  5182. @item group
  5183. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5184. When set to 1, no block matching is done. Larger values allows more blocks
  5185. in single group.
  5186. Allowed range is from 1 to 256.
  5187. @item range
  5188. Set radius for search block matching. Default is 9.
  5189. Allowed range is from 1 to INT32_MAX.
  5190. @item mstep
  5191. Set step between two search locations for block matching. Default is 1.
  5192. Allowed range is from 1 to 64. Smaller is slower.
  5193. @item thmse
  5194. Set threshold of mean square error for block matching. Valid range is 0 to
  5195. INT32_MAX.
  5196. @item hdthr
  5197. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5198. Larger values results in stronger hard-thresholding filtering in frequency
  5199. domain.
  5200. @item estim
  5201. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5202. Default is @code{basic}.
  5203. @item ref
  5204. If enabled, filter will use 2nd stream for block matching.
  5205. Default is disabled for @code{basic} value of @var{estim} option,
  5206. and always enabled if value of @var{estim} is @code{final}.
  5207. @item planes
  5208. Set planes to filter. Default is all available except alpha.
  5209. @end table
  5210. @subsection Examples
  5211. @itemize
  5212. @item
  5213. Basic filtering with bm3d:
  5214. @example
  5215. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5216. @end example
  5217. @item
  5218. Same as above, but filtering only luma:
  5219. @example
  5220. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5221. @end example
  5222. @item
  5223. Same as above, but with both estimation modes:
  5224. @example
  5225. 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
  5226. @end example
  5227. @item
  5228. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5229. @example
  5230. 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
  5231. @end example
  5232. @end itemize
  5233. @section boxblur
  5234. Apply a boxblur algorithm to the input video.
  5235. It accepts the following parameters:
  5236. @table @option
  5237. @item luma_radius, lr
  5238. @item luma_power, lp
  5239. @item chroma_radius, cr
  5240. @item chroma_power, cp
  5241. @item alpha_radius, ar
  5242. @item alpha_power, ap
  5243. @end table
  5244. A description of the accepted options follows.
  5245. @table @option
  5246. @item luma_radius, lr
  5247. @item chroma_radius, cr
  5248. @item alpha_radius, ar
  5249. Set an expression for the box radius in pixels used for blurring the
  5250. corresponding input plane.
  5251. The radius value must be a non-negative number, and must not be
  5252. greater than the value of the expression @code{min(w,h)/2} for the
  5253. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5254. planes.
  5255. Default value for @option{luma_radius} is "2". If not specified,
  5256. @option{chroma_radius} and @option{alpha_radius} default to the
  5257. corresponding value set for @option{luma_radius}.
  5258. The expressions can contain the following constants:
  5259. @table @option
  5260. @item w
  5261. @item h
  5262. The input width and height in pixels.
  5263. @item cw
  5264. @item ch
  5265. The input chroma image width and height in pixels.
  5266. @item hsub
  5267. @item vsub
  5268. The horizontal and vertical chroma subsample values. For example, for the
  5269. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5270. @end table
  5271. @item luma_power, lp
  5272. @item chroma_power, cp
  5273. @item alpha_power, ap
  5274. Specify how many times the boxblur filter is applied to the
  5275. corresponding plane.
  5276. Default value for @option{luma_power} is 2. If not specified,
  5277. @option{chroma_power} and @option{alpha_power} default to the
  5278. corresponding value set for @option{luma_power}.
  5279. A value of 0 will disable the effect.
  5280. @end table
  5281. @subsection Examples
  5282. @itemize
  5283. @item
  5284. Apply a boxblur filter with the luma, chroma, and alpha radii
  5285. set to 2:
  5286. @example
  5287. boxblur=luma_radius=2:luma_power=1
  5288. boxblur=2:1
  5289. @end example
  5290. @item
  5291. Set the luma radius to 2, and alpha and chroma radius to 0:
  5292. @example
  5293. boxblur=2:1:cr=0:ar=0
  5294. @end example
  5295. @item
  5296. Set the luma and chroma radii to a fraction of the video dimension:
  5297. @example
  5298. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5299. @end example
  5300. @end itemize
  5301. @section bwdif
  5302. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5303. Deinterlacing Filter").
  5304. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5305. interpolation algorithms.
  5306. It accepts the following parameters:
  5307. @table @option
  5308. @item mode
  5309. The interlacing mode to adopt. It accepts one of the following values:
  5310. @table @option
  5311. @item 0, send_frame
  5312. Output one frame for each frame.
  5313. @item 1, send_field
  5314. Output one frame for each field.
  5315. @end table
  5316. The default value is @code{send_field}.
  5317. @item parity
  5318. The picture field parity assumed for the input interlaced video. It accepts one
  5319. of the following values:
  5320. @table @option
  5321. @item 0, tff
  5322. Assume the top field is first.
  5323. @item 1, bff
  5324. Assume the bottom field is first.
  5325. @item -1, auto
  5326. Enable automatic detection of field parity.
  5327. @end table
  5328. The default value is @code{auto}.
  5329. If the interlacing is unknown or the decoder does not export this information,
  5330. top field first will be assumed.
  5331. @item deint
  5332. Specify which frames to deinterlace. Accepts one of the following
  5333. values:
  5334. @table @option
  5335. @item 0, all
  5336. Deinterlace all frames.
  5337. @item 1, interlaced
  5338. Only deinterlace frames marked as interlaced.
  5339. @end table
  5340. The default value is @code{all}.
  5341. @end table
  5342. @section chromahold
  5343. Remove all color information for all colors except for certain one.
  5344. The filter accepts the following options:
  5345. @table @option
  5346. @item color
  5347. The color which will not be replaced with neutral chroma.
  5348. @item similarity
  5349. Similarity percentage with the above color.
  5350. 0.01 matches only the exact key color, while 1.0 matches everything.
  5351. @item blend
  5352. Blend percentage.
  5353. 0.0 makes pixels either fully gray, or not gray at all.
  5354. Higher values result in more preserved color.
  5355. @item yuv
  5356. Signals that the color passed is already in YUV instead of RGB.
  5357. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5358. This can be used to pass exact YUV values as hexadecimal numbers.
  5359. @end table
  5360. @subsection Commands
  5361. This filter supports same @ref{commands} as options.
  5362. The command accepts the same syntax of the corresponding option.
  5363. If the specified expression is not valid, it is kept at its current
  5364. value.
  5365. @section chromakey
  5366. YUV colorspace color/chroma keying.
  5367. The filter accepts the following options:
  5368. @table @option
  5369. @item color
  5370. The color which will be replaced with transparency.
  5371. @item similarity
  5372. Similarity percentage with the key color.
  5373. 0.01 matches only the exact key color, while 1.0 matches everything.
  5374. @item blend
  5375. Blend percentage.
  5376. 0.0 makes pixels either fully transparent, or not transparent at all.
  5377. Higher values result in semi-transparent pixels, with a higher transparency
  5378. the more similar the pixels color is to the key color.
  5379. @item yuv
  5380. Signals that the color passed is already in YUV instead of RGB.
  5381. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5382. This can be used to pass exact YUV values as hexadecimal numbers.
  5383. @end table
  5384. @subsection Commands
  5385. This filter supports same @ref{commands} as options.
  5386. The command accepts the same syntax of the corresponding option.
  5387. If the specified expression is not valid, it is kept at its current
  5388. value.
  5389. @subsection Examples
  5390. @itemize
  5391. @item
  5392. Make every green pixel in the input image transparent:
  5393. @example
  5394. ffmpeg -i input.png -vf chromakey=green out.png
  5395. @end example
  5396. @item
  5397. Overlay a greenscreen-video on top of a static black background.
  5398. @example
  5399. 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
  5400. @end example
  5401. @end itemize
  5402. @section chromashift
  5403. Shift chroma pixels horizontally and/or vertically.
  5404. The filter accepts the following options:
  5405. @table @option
  5406. @item cbh
  5407. Set amount to shift chroma-blue horizontally.
  5408. @item cbv
  5409. Set amount to shift chroma-blue vertically.
  5410. @item crh
  5411. Set amount to shift chroma-red horizontally.
  5412. @item crv
  5413. Set amount to shift chroma-red vertically.
  5414. @item edge
  5415. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5416. @end table
  5417. @subsection Commands
  5418. This filter supports the all above options as @ref{commands}.
  5419. @section ciescope
  5420. Display CIE color diagram with pixels overlaid onto it.
  5421. The filter accepts the following options:
  5422. @table @option
  5423. @item system
  5424. Set color system.
  5425. @table @samp
  5426. @item ntsc, 470m
  5427. @item ebu, 470bg
  5428. @item smpte
  5429. @item 240m
  5430. @item apple
  5431. @item widergb
  5432. @item cie1931
  5433. @item rec709, hdtv
  5434. @item uhdtv, rec2020
  5435. @item dcip3
  5436. @end table
  5437. @item cie
  5438. Set CIE system.
  5439. @table @samp
  5440. @item xyy
  5441. @item ucs
  5442. @item luv
  5443. @end table
  5444. @item gamuts
  5445. Set what gamuts to draw.
  5446. See @code{system} option for available values.
  5447. @item size, s
  5448. Set ciescope size, by default set to 512.
  5449. @item intensity, i
  5450. Set intensity used to map input pixel values to CIE diagram.
  5451. @item contrast
  5452. Set contrast used to draw tongue colors that are out of active color system gamut.
  5453. @item corrgamma
  5454. Correct gamma displayed on scope, by default enabled.
  5455. @item showwhite
  5456. Show white point on CIE diagram, by default disabled.
  5457. @item gamma
  5458. Set input gamma. Used only with XYZ input color space.
  5459. @end table
  5460. @section codecview
  5461. Visualize information exported by some codecs.
  5462. Some codecs can export information through frames using side-data or other
  5463. means. For example, some MPEG based codecs export motion vectors through the
  5464. @var{export_mvs} flag in the codec @option{flags2} option.
  5465. The filter accepts the following option:
  5466. @table @option
  5467. @item mv
  5468. Set motion vectors to visualize.
  5469. Available flags for @var{mv} are:
  5470. @table @samp
  5471. @item pf
  5472. forward predicted MVs of P-frames
  5473. @item bf
  5474. forward predicted MVs of B-frames
  5475. @item bb
  5476. backward predicted MVs of B-frames
  5477. @end table
  5478. @item qp
  5479. Display quantization parameters using the chroma planes.
  5480. @item mv_type, mvt
  5481. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5482. Available flags for @var{mv_type} are:
  5483. @table @samp
  5484. @item fp
  5485. forward predicted MVs
  5486. @item bp
  5487. backward predicted MVs
  5488. @end table
  5489. @item frame_type, ft
  5490. Set frame type to visualize motion vectors of.
  5491. Available flags for @var{frame_type} are:
  5492. @table @samp
  5493. @item if
  5494. intra-coded frames (I-frames)
  5495. @item pf
  5496. predicted frames (P-frames)
  5497. @item bf
  5498. bi-directionally predicted frames (B-frames)
  5499. @end table
  5500. @end table
  5501. @subsection Examples
  5502. @itemize
  5503. @item
  5504. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5505. @example
  5506. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5507. @end example
  5508. @item
  5509. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5510. @example
  5511. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5512. @end example
  5513. @end itemize
  5514. @section colorbalance
  5515. Modify intensity of primary colors (red, green and blue) of input frames.
  5516. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5517. regions for the red-cyan, green-magenta or blue-yellow balance.
  5518. A positive adjustment value shifts the balance towards the primary color, a negative
  5519. value towards the complementary color.
  5520. The filter accepts the following options:
  5521. @table @option
  5522. @item rs
  5523. @item gs
  5524. @item bs
  5525. Adjust red, green and blue shadows (darkest pixels).
  5526. @item rm
  5527. @item gm
  5528. @item bm
  5529. Adjust red, green and blue midtones (medium pixels).
  5530. @item rh
  5531. @item gh
  5532. @item bh
  5533. Adjust red, green and blue highlights (brightest pixels).
  5534. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5535. @item pl
  5536. Preserve lightness when changing color balance. Default is disabled.
  5537. @end table
  5538. @subsection Examples
  5539. @itemize
  5540. @item
  5541. Add red color cast to shadows:
  5542. @example
  5543. colorbalance=rs=.3
  5544. @end example
  5545. @end itemize
  5546. @subsection Commands
  5547. This filter supports the all above options as @ref{commands}.
  5548. @section colorchannelmixer
  5549. Adjust video input frames by re-mixing color channels.
  5550. This filter modifies a color channel by adding the values associated to
  5551. the other channels of the same pixels. For example if the value to
  5552. modify is red, the output value will be:
  5553. @example
  5554. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5555. @end example
  5556. The filter accepts the following options:
  5557. @table @option
  5558. @item rr
  5559. @item rg
  5560. @item rb
  5561. @item ra
  5562. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5563. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5564. @item gr
  5565. @item gg
  5566. @item gb
  5567. @item ga
  5568. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5569. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5570. @item br
  5571. @item bg
  5572. @item bb
  5573. @item ba
  5574. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5575. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5576. @item ar
  5577. @item ag
  5578. @item ab
  5579. @item aa
  5580. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5581. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5582. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5583. @end table
  5584. @subsection Examples
  5585. @itemize
  5586. @item
  5587. Convert source to grayscale:
  5588. @example
  5589. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5590. @end example
  5591. @item
  5592. Simulate sepia tones:
  5593. @example
  5594. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5595. @end example
  5596. @end itemize
  5597. @subsection Commands
  5598. This filter supports the all above options as @ref{commands}.
  5599. @section colorkey
  5600. RGB colorspace color keying.
  5601. The filter accepts the following options:
  5602. @table @option
  5603. @item color
  5604. The color which will be replaced with transparency.
  5605. @item similarity
  5606. Similarity percentage with the key color.
  5607. 0.01 matches only the exact key color, while 1.0 matches everything.
  5608. @item blend
  5609. Blend percentage.
  5610. 0.0 makes pixels either fully transparent, or not transparent at all.
  5611. Higher values result in semi-transparent pixels, with a higher transparency
  5612. the more similar the pixels color is to the key color.
  5613. @end table
  5614. @subsection Examples
  5615. @itemize
  5616. @item
  5617. Make every green pixel in the input image transparent:
  5618. @example
  5619. ffmpeg -i input.png -vf colorkey=green out.png
  5620. @end example
  5621. @item
  5622. Overlay a greenscreen-video on top of a static background image.
  5623. @example
  5624. 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
  5625. @end example
  5626. @end itemize
  5627. @section colorhold
  5628. Remove all color information for all RGB colors except for certain one.
  5629. The filter accepts the following options:
  5630. @table @option
  5631. @item color
  5632. The color which will not be replaced with neutral gray.
  5633. @item similarity
  5634. Similarity percentage with the above color.
  5635. 0.01 matches only the exact key color, while 1.0 matches everything.
  5636. @item blend
  5637. Blend percentage. 0.0 makes pixels fully gray.
  5638. Higher values result in more preserved color.
  5639. @end table
  5640. @section colorlevels
  5641. Adjust video input frames using levels.
  5642. The filter accepts the following options:
  5643. @table @option
  5644. @item rimin
  5645. @item gimin
  5646. @item bimin
  5647. @item aimin
  5648. Adjust red, green, blue and alpha input black point.
  5649. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5650. @item rimax
  5651. @item gimax
  5652. @item bimax
  5653. @item aimax
  5654. Adjust red, green, blue and alpha input white point.
  5655. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5656. Input levels are used to lighten highlights (bright tones), darken shadows
  5657. (dark tones), change the balance of bright and dark tones.
  5658. @item romin
  5659. @item gomin
  5660. @item bomin
  5661. @item aomin
  5662. Adjust red, green, blue and alpha output black point.
  5663. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5664. @item romax
  5665. @item gomax
  5666. @item bomax
  5667. @item aomax
  5668. Adjust red, green, blue and alpha output white point.
  5669. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5670. Output levels allows manual selection of a constrained output level range.
  5671. @end table
  5672. @subsection Examples
  5673. @itemize
  5674. @item
  5675. Make video output darker:
  5676. @example
  5677. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5678. @end example
  5679. @item
  5680. Increase contrast:
  5681. @example
  5682. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5683. @end example
  5684. @item
  5685. Make video output lighter:
  5686. @example
  5687. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5688. @end example
  5689. @item
  5690. Increase brightness:
  5691. @example
  5692. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5693. @end example
  5694. @end itemize
  5695. @section colormatrix
  5696. Convert color matrix.
  5697. The filter accepts the following options:
  5698. @table @option
  5699. @item src
  5700. @item dst
  5701. Specify the source and destination color matrix. Both values must be
  5702. specified.
  5703. The accepted values are:
  5704. @table @samp
  5705. @item bt709
  5706. BT.709
  5707. @item fcc
  5708. FCC
  5709. @item bt601
  5710. BT.601
  5711. @item bt470
  5712. BT.470
  5713. @item bt470bg
  5714. BT.470BG
  5715. @item smpte170m
  5716. SMPTE-170M
  5717. @item smpte240m
  5718. SMPTE-240M
  5719. @item bt2020
  5720. BT.2020
  5721. @end table
  5722. @end table
  5723. For example to convert from BT.601 to SMPTE-240M, use the command:
  5724. @example
  5725. colormatrix=bt601:smpte240m
  5726. @end example
  5727. @section colorspace
  5728. Convert colorspace, transfer characteristics or color primaries.
  5729. Input video needs to have an even size.
  5730. The filter accepts the following options:
  5731. @table @option
  5732. @anchor{all}
  5733. @item all
  5734. Specify all color properties at once.
  5735. The accepted values are:
  5736. @table @samp
  5737. @item bt470m
  5738. BT.470M
  5739. @item bt470bg
  5740. BT.470BG
  5741. @item bt601-6-525
  5742. BT.601-6 525
  5743. @item bt601-6-625
  5744. BT.601-6 625
  5745. @item bt709
  5746. BT.709
  5747. @item smpte170m
  5748. SMPTE-170M
  5749. @item smpte240m
  5750. SMPTE-240M
  5751. @item bt2020
  5752. BT.2020
  5753. @end table
  5754. @anchor{space}
  5755. @item space
  5756. Specify output colorspace.
  5757. The accepted values are:
  5758. @table @samp
  5759. @item bt709
  5760. BT.709
  5761. @item fcc
  5762. FCC
  5763. @item bt470bg
  5764. BT.470BG or BT.601-6 625
  5765. @item smpte170m
  5766. SMPTE-170M or BT.601-6 525
  5767. @item smpte240m
  5768. SMPTE-240M
  5769. @item ycgco
  5770. YCgCo
  5771. @item bt2020ncl
  5772. BT.2020 with non-constant luminance
  5773. @end table
  5774. @anchor{trc}
  5775. @item trc
  5776. Specify output transfer characteristics.
  5777. The accepted values are:
  5778. @table @samp
  5779. @item bt709
  5780. BT.709
  5781. @item bt470m
  5782. BT.470M
  5783. @item bt470bg
  5784. BT.470BG
  5785. @item gamma22
  5786. Constant gamma of 2.2
  5787. @item gamma28
  5788. Constant gamma of 2.8
  5789. @item smpte170m
  5790. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5791. @item smpte240m
  5792. SMPTE-240M
  5793. @item srgb
  5794. SRGB
  5795. @item iec61966-2-1
  5796. iec61966-2-1
  5797. @item iec61966-2-4
  5798. iec61966-2-4
  5799. @item xvycc
  5800. xvycc
  5801. @item bt2020-10
  5802. BT.2020 for 10-bits content
  5803. @item bt2020-12
  5804. BT.2020 for 12-bits content
  5805. @end table
  5806. @anchor{primaries}
  5807. @item primaries
  5808. Specify output color primaries.
  5809. The accepted values are:
  5810. @table @samp
  5811. @item bt709
  5812. BT.709
  5813. @item bt470m
  5814. BT.470M
  5815. @item bt470bg
  5816. BT.470BG or BT.601-6 625
  5817. @item smpte170m
  5818. SMPTE-170M or BT.601-6 525
  5819. @item smpte240m
  5820. SMPTE-240M
  5821. @item film
  5822. film
  5823. @item smpte431
  5824. SMPTE-431
  5825. @item smpte432
  5826. SMPTE-432
  5827. @item bt2020
  5828. BT.2020
  5829. @item jedec-p22
  5830. JEDEC P22 phosphors
  5831. @end table
  5832. @anchor{range}
  5833. @item range
  5834. Specify output color range.
  5835. The accepted values are:
  5836. @table @samp
  5837. @item tv
  5838. TV (restricted) range
  5839. @item mpeg
  5840. MPEG (restricted) range
  5841. @item pc
  5842. PC (full) range
  5843. @item jpeg
  5844. JPEG (full) range
  5845. @end table
  5846. @item format
  5847. Specify output color format.
  5848. The accepted values are:
  5849. @table @samp
  5850. @item yuv420p
  5851. YUV 4:2:0 planar 8-bits
  5852. @item yuv420p10
  5853. YUV 4:2:0 planar 10-bits
  5854. @item yuv420p12
  5855. YUV 4:2:0 planar 12-bits
  5856. @item yuv422p
  5857. YUV 4:2:2 planar 8-bits
  5858. @item yuv422p10
  5859. YUV 4:2:2 planar 10-bits
  5860. @item yuv422p12
  5861. YUV 4:2:2 planar 12-bits
  5862. @item yuv444p
  5863. YUV 4:4:4 planar 8-bits
  5864. @item yuv444p10
  5865. YUV 4:4:4 planar 10-bits
  5866. @item yuv444p12
  5867. YUV 4:4:4 planar 12-bits
  5868. @end table
  5869. @item fast
  5870. Do a fast conversion, which skips gamma/primary correction. This will take
  5871. significantly less CPU, but will be mathematically incorrect. To get output
  5872. compatible with that produced by the colormatrix filter, use fast=1.
  5873. @item dither
  5874. Specify dithering mode.
  5875. The accepted values are:
  5876. @table @samp
  5877. @item none
  5878. No dithering
  5879. @item fsb
  5880. Floyd-Steinberg dithering
  5881. @end table
  5882. @item wpadapt
  5883. Whitepoint adaptation mode.
  5884. The accepted values are:
  5885. @table @samp
  5886. @item bradford
  5887. Bradford whitepoint adaptation
  5888. @item vonkries
  5889. von Kries whitepoint adaptation
  5890. @item identity
  5891. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5892. @end table
  5893. @item iall
  5894. Override all input properties at once. Same accepted values as @ref{all}.
  5895. @item ispace
  5896. Override input colorspace. Same accepted values as @ref{space}.
  5897. @item iprimaries
  5898. Override input color primaries. Same accepted values as @ref{primaries}.
  5899. @item itrc
  5900. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5901. @item irange
  5902. Override input color range. Same accepted values as @ref{range}.
  5903. @end table
  5904. The filter converts the transfer characteristics, color space and color
  5905. primaries to the specified user values. The output value, if not specified,
  5906. is set to a default value based on the "all" property. If that property is
  5907. also not specified, the filter will log an error. The output color range and
  5908. format default to the same value as the input color range and format. The
  5909. input transfer characteristics, color space, color primaries and color range
  5910. should be set on the input data. If any of these are missing, the filter will
  5911. log an error and no conversion will take place.
  5912. For example to convert the input to SMPTE-240M, use the command:
  5913. @example
  5914. colorspace=smpte240m
  5915. @end example
  5916. @section convolution
  5917. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5918. The filter accepts the following options:
  5919. @table @option
  5920. @item 0m
  5921. @item 1m
  5922. @item 2m
  5923. @item 3m
  5924. Set matrix for each plane.
  5925. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5926. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5927. @item 0rdiv
  5928. @item 1rdiv
  5929. @item 2rdiv
  5930. @item 3rdiv
  5931. Set multiplier for calculated value for each plane.
  5932. If unset or 0, it will be sum of all matrix elements.
  5933. @item 0bias
  5934. @item 1bias
  5935. @item 2bias
  5936. @item 3bias
  5937. Set bias for each plane. This value is added to the result of the multiplication.
  5938. Useful for making the overall image brighter or darker. Default is 0.0.
  5939. @item 0mode
  5940. @item 1mode
  5941. @item 2mode
  5942. @item 3mode
  5943. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5944. Default is @var{square}.
  5945. @end table
  5946. @subsection Examples
  5947. @itemize
  5948. @item
  5949. Apply sharpen:
  5950. @example
  5951. 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"
  5952. @end example
  5953. @item
  5954. Apply blur:
  5955. @example
  5956. 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"
  5957. @end example
  5958. @item
  5959. Apply edge enhance:
  5960. @example
  5961. 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"
  5962. @end example
  5963. @item
  5964. Apply edge detect:
  5965. @example
  5966. 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"
  5967. @end example
  5968. @item
  5969. Apply laplacian edge detector which includes diagonals:
  5970. @example
  5971. 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"
  5972. @end example
  5973. @item
  5974. Apply emboss:
  5975. @example
  5976. 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"
  5977. @end example
  5978. @end itemize
  5979. @section convolve
  5980. Apply 2D convolution of video stream in frequency domain using second stream
  5981. as impulse.
  5982. The filter accepts the following options:
  5983. @table @option
  5984. @item planes
  5985. Set which planes to process.
  5986. @item impulse
  5987. Set which impulse video frames will be processed, can be @var{first}
  5988. or @var{all}. Default is @var{all}.
  5989. @end table
  5990. The @code{convolve} filter also supports the @ref{framesync} options.
  5991. @section copy
  5992. Copy the input video source unchanged to the output. This is mainly useful for
  5993. testing purposes.
  5994. @anchor{coreimage}
  5995. @section coreimage
  5996. Video filtering on GPU using Apple's CoreImage API on OSX.
  5997. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5998. processed by video hardware. However, software-based OpenGL implementations
  5999. exist which means there is no guarantee for hardware processing. It depends on
  6000. the respective OSX.
  6001. There are many filters and image generators provided by Apple that come with a
  6002. large variety of options. The filter has to be referenced by its name along
  6003. with its options.
  6004. The coreimage filter accepts the following options:
  6005. @table @option
  6006. @item list_filters
  6007. List all available filters and generators along with all their respective
  6008. options as well as possible minimum and maximum values along with the default
  6009. values.
  6010. @example
  6011. list_filters=true
  6012. @end example
  6013. @item filter
  6014. Specify all filters by their respective name and options.
  6015. Use @var{list_filters} to determine all valid filter names and options.
  6016. Numerical options are specified by a float value and are automatically clamped
  6017. to their respective value range. Vector and color options have to be specified
  6018. by a list of space separated float values. Character escaping has to be done.
  6019. A special option name @code{default} is available to use default options for a
  6020. filter.
  6021. It is required to specify either @code{default} or at least one of the filter options.
  6022. All omitted options are used with their default values.
  6023. The syntax of the filter string is as follows:
  6024. @example
  6025. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6026. @end example
  6027. @item output_rect
  6028. Specify a rectangle where the output of the filter chain is copied into the
  6029. input image. It is given by a list of space separated float values:
  6030. @example
  6031. output_rect=x\ y\ width\ height
  6032. @end example
  6033. If not given, the output rectangle equals the dimensions of the input image.
  6034. The output rectangle is automatically cropped at the borders of the input
  6035. image. Negative values are valid for each component.
  6036. @example
  6037. output_rect=25\ 25\ 100\ 100
  6038. @end example
  6039. @end table
  6040. Several filters can be chained for successive processing without GPU-HOST
  6041. transfers allowing for fast processing of complex filter chains.
  6042. Currently, only filters with zero (generators) or exactly one (filters) input
  6043. image and one output image are supported. Also, transition filters are not yet
  6044. usable as intended.
  6045. Some filters generate output images with additional padding depending on the
  6046. respective filter kernel. The padding is automatically removed to ensure the
  6047. filter output has the same size as the input image.
  6048. For image generators, the size of the output image is determined by the
  6049. previous output image of the filter chain or the input image of the whole
  6050. filterchain, respectively. The generators do not use the pixel information of
  6051. this image to generate their output. However, the generated output is
  6052. blended onto this image, resulting in partial or complete coverage of the
  6053. output image.
  6054. The @ref{coreimagesrc} video source can be used for generating input images
  6055. which are directly fed into the filter chain. By using it, providing input
  6056. images by another video source or an input video is not required.
  6057. @subsection Examples
  6058. @itemize
  6059. @item
  6060. List all filters available:
  6061. @example
  6062. coreimage=list_filters=true
  6063. @end example
  6064. @item
  6065. Use the CIBoxBlur filter with default options to blur an image:
  6066. @example
  6067. coreimage=filter=CIBoxBlur@@default
  6068. @end example
  6069. @item
  6070. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6071. its center at 100x100 and a radius of 50 pixels:
  6072. @example
  6073. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6074. @end example
  6075. @item
  6076. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6077. given as complete and escaped command-line for Apple's standard bash shell:
  6078. @example
  6079. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6080. @end example
  6081. @end itemize
  6082. @section cover_rect
  6083. Cover a rectangular object
  6084. It accepts the following options:
  6085. @table @option
  6086. @item cover
  6087. Filepath of the optional cover image, needs to be in yuv420.
  6088. @item mode
  6089. Set covering mode.
  6090. It accepts the following values:
  6091. @table @samp
  6092. @item cover
  6093. cover it by the supplied image
  6094. @item blur
  6095. cover it by interpolating the surrounding pixels
  6096. @end table
  6097. Default value is @var{blur}.
  6098. @end table
  6099. @subsection Examples
  6100. @itemize
  6101. @item
  6102. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6103. @example
  6104. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6105. @end example
  6106. @end itemize
  6107. @section crop
  6108. Crop the input video to given dimensions.
  6109. It accepts the following parameters:
  6110. @table @option
  6111. @item w, out_w
  6112. The width of the output video. It defaults to @code{iw}.
  6113. This expression is evaluated only once during the filter
  6114. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6115. @item h, out_h
  6116. The height of the output video. It defaults to @code{ih}.
  6117. This expression is evaluated only once during the filter
  6118. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6119. @item x
  6120. The horizontal position, in the input video, of the left edge of the output
  6121. video. It defaults to @code{(in_w-out_w)/2}.
  6122. This expression is evaluated per-frame.
  6123. @item y
  6124. The vertical position, in the input video, of the top edge of the output video.
  6125. It defaults to @code{(in_h-out_h)/2}.
  6126. This expression is evaluated per-frame.
  6127. @item keep_aspect
  6128. If set to 1 will force the output display aspect ratio
  6129. to be the same of the input, by changing the output sample aspect
  6130. ratio. It defaults to 0.
  6131. @item exact
  6132. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6133. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6134. It defaults to 0.
  6135. @end table
  6136. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6137. expressions containing the following constants:
  6138. @table @option
  6139. @item x
  6140. @item y
  6141. The computed values for @var{x} and @var{y}. They are evaluated for
  6142. each new frame.
  6143. @item in_w
  6144. @item in_h
  6145. The input width and height.
  6146. @item iw
  6147. @item ih
  6148. These are the same as @var{in_w} and @var{in_h}.
  6149. @item out_w
  6150. @item out_h
  6151. The output (cropped) width and height.
  6152. @item ow
  6153. @item oh
  6154. These are the same as @var{out_w} and @var{out_h}.
  6155. @item a
  6156. same as @var{iw} / @var{ih}
  6157. @item sar
  6158. input sample aspect ratio
  6159. @item dar
  6160. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6161. @item hsub
  6162. @item vsub
  6163. horizontal and vertical chroma subsample values. For example for the
  6164. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6165. @item n
  6166. The number of the input frame, starting from 0.
  6167. @item pos
  6168. the position in the file of the input frame, NAN if unknown
  6169. @item t
  6170. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6171. @end table
  6172. The expression for @var{out_w} may depend on the value of @var{out_h},
  6173. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6174. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6175. evaluated after @var{out_w} and @var{out_h}.
  6176. The @var{x} and @var{y} parameters specify the expressions for the
  6177. position of the top-left corner of the output (non-cropped) area. They
  6178. are evaluated for each frame. If the evaluated value is not valid, it
  6179. is approximated to the nearest valid value.
  6180. The expression for @var{x} may depend on @var{y}, and the expression
  6181. for @var{y} may depend on @var{x}.
  6182. @subsection Examples
  6183. @itemize
  6184. @item
  6185. Crop area with size 100x100 at position (12,34).
  6186. @example
  6187. crop=100:100:12:34
  6188. @end example
  6189. Using named options, the example above becomes:
  6190. @example
  6191. crop=w=100:h=100:x=12:y=34
  6192. @end example
  6193. @item
  6194. Crop the central input area with size 100x100:
  6195. @example
  6196. crop=100:100
  6197. @end example
  6198. @item
  6199. Crop the central input area with size 2/3 of the input video:
  6200. @example
  6201. crop=2/3*in_w:2/3*in_h
  6202. @end example
  6203. @item
  6204. Crop the input video central square:
  6205. @example
  6206. crop=out_w=in_h
  6207. crop=in_h
  6208. @end example
  6209. @item
  6210. Delimit the rectangle with the top-left corner placed at position
  6211. 100:100 and the right-bottom corner corresponding to the right-bottom
  6212. corner of the input image.
  6213. @example
  6214. crop=in_w-100:in_h-100:100:100
  6215. @end example
  6216. @item
  6217. Crop 10 pixels from the left and right borders, and 20 pixels from
  6218. the top and bottom borders
  6219. @example
  6220. crop=in_w-2*10:in_h-2*20
  6221. @end example
  6222. @item
  6223. Keep only the bottom right quarter of the input image:
  6224. @example
  6225. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6226. @end example
  6227. @item
  6228. Crop height for getting Greek harmony:
  6229. @example
  6230. crop=in_w:1/PHI*in_w
  6231. @end example
  6232. @item
  6233. Apply trembling effect:
  6234. @example
  6235. 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)
  6236. @end example
  6237. @item
  6238. Apply erratic camera effect depending on timestamp:
  6239. @example
  6240. 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)"
  6241. @end example
  6242. @item
  6243. Set x depending on the value of y:
  6244. @example
  6245. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6246. @end example
  6247. @end itemize
  6248. @subsection Commands
  6249. This filter supports the following commands:
  6250. @table @option
  6251. @item w, out_w
  6252. @item h, out_h
  6253. @item x
  6254. @item y
  6255. Set width/height of the output video and the horizontal/vertical position
  6256. in the input video.
  6257. The command accepts the same syntax of the corresponding option.
  6258. If the specified expression is not valid, it is kept at its current
  6259. value.
  6260. @end table
  6261. @section cropdetect
  6262. Auto-detect the crop size.
  6263. It calculates the necessary cropping parameters and prints the
  6264. recommended parameters via the logging system. The detected dimensions
  6265. correspond to the non-black area of the input video.
  6266. It accepts the following parameters:
  6267. @table @option
  6268. @item limit
  6269. Set higher black value threshold, which can be optionally specified
  6270. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6271. value greater to the set value is considered non-black. It defaults to 24.
  6272. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6273. on the bitdepth of the pixel format.
  6274. @item round
  6275. The value which the width/height should be divisible by. It defaults to
  6276. 16. The offset is automatically adjusted to center the video. Use 2 to
  6277. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6278. encoding to most video codecs.
  6279. @item reset_count, reset
  6280. Set the counter that determines after how many frames cropdetect will
  6281. reset the previously detected largest video area and start over to
  6282. detect the current optimal crop area. Default value is 0.
  6283. This can be useful when channel logos distort the video area. 0
  6284. indicates 'never reset', and returns the largest area encountered during
  6285. playback.
  6286. @end table
  6287. @anchor{cue}
  6288. @section cue
  6289. Delay video filtering until a given wallclock timestamp. The filter first
  6290. passes on @option{preroll} amount of frames, then it buffers at most
  6291. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6292. it forwards the buffered frames and also any subsequent frames coming in its
  6293. input.
  6294. The filter can be used synchronize the output of multiple ffmpeg processes for
  6295. realtime output devices like decklink. By putting the delay in the filtering
  6296. chain and pre-buffering frames the process can pass on data to output almost
  6297. immediately after the target wallclock timestamp is reached.
  6298. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6299. some use cases.
  6300. @table @option
  6301. @item cue
  6302. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6303. @item preroll
  6304. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6305. @item buffer
  6306. The maximum duration of content to buffer before waiting for the cue expressed
  6307. in seconds. Default is 0.
  6308. @end table
  6309. @anchor{curves}
  6310. @section curves
  6311. Apply color adjustments using curves.
  6312. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6313. component (red, green and blue) has its values defined by @var{N} key points
  6314. tied from each other using a smooth curve. The x-axis represents the pixel
  6315. values from the input frame, and the y-axis the new pixel values to be set for
  6316. the output frame.
  6317. By default, a component curve is defined by the two points @var{(0;0)} and
  6318. @var{(1;1)}. This creates a straight line where each original pixel value is
  6319. "adjusted" to its own value, which means no change to the image.
  6320. The filter allows you to redefine these two points and add some more. A new
  6321. curve (using a natural cubic spline interpolation) will be define to pass
  6322. smoothly through all these new coordinates. The new defined points needs to be
  6323. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6324. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6325. the vector spaces, the values will be clipped accordingly.
  6326. The filter accepts the following options:
  6327. @table @option
  6328. @item preset
  6329. Select one of the available color presets. This option can be used in addition
  6330. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6331. options takes priority on the preset values.
  6332. Available presets are:
  6333. @table @samp
  6334. @item none
  6335. @item color_negative
  6336. @item cross_process
  6337. @item darker
  6338. @item increase_contrast
  6339. @item lighter
  6340. @item linear_contrast
  6341. @item medium_contrast
  6342. @item negative
  6343. @item strong_contrast
  6344. @item vintage
  6345. @end table
  6346. Default is @code{none}.
  6347. @item master, m
  6348. Set the master key points. These points will define a second pass mapping. It
  6349. is sometimes called a "luminance" or "value" mapping. It can be used with
  6350. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6351. post-processing LUT.
  6352. @item red, r
  6353. Set the key points for the red component.
  6354. @item green, g
  6355. Set the key points for the green component.
  6356. @item blue, b
  6357. Set the key points for the blue component.
  6358. @item all
  6359. Set the key points for all components (not including master).
  6360. Can be used in addition to the other key points component
  6361. options. In this case, the unset component(s) will fallback on this
  6362. @option{all} setting.
  6363. @item psfile
  6364. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6365. @item plot
  6366. Save Gnuplot script of the curves in specified file.
  6367. @end table
  6368. To avoid some filtergraph syntax conflicts, each key points list need to be
  6369. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6370. @subsection Examples
  6371. @itemize
  6372. @item
  6373. Increase slightly the middle level of blue:
  6374. @example
  6375. curves=blue='0/0 0.5/0.58 1/1'
  6376. @end example
  6377. @item
  6378. Vintage effect:
  6379. @example
  6380. 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'
  6381. @end example
  6382. Here we obtain the following coordinates for each components:
  6383. @table @var
  6384. @item red
  6385. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6386. @item green
  6387. @code{(0;0) (0.50;0.48) (1;1)}
  6388. @item blue
  6389. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6390. @end table
  6391. @item
  6392. The previous example can also be achieved with the associated built-in preset:
  6393. @example
  6394. curves=preset=vintage
  6395. @end example
  6396. @item
  6397. Or simply:
  6398. @example
  6399. curves=vintage
  6400. @end example
  6401. @item
  6402. Use a Photoshop preset and redefine the points of the green component:
  6403. @example
  6404. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6405. @end example
  6406. @item
  6407. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6408. and @command{gnuplot}:
  6409. @example
  6410. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6411. gnuplot -p /tmp/curves.plt
  6412. @end example
  6413. @end itemize
  6414. @section datascope
  6415. Video data analysis filter.
  6416. This filter shows hexadecimal pixel values of part of video.
  6417. The filter accepts the following options:
  6418. @table @option
  6419. @item size, s
  6420. Set output video size.
  6421. @item x
  6422. Set x offset from where to pick pixels.
  6423. @item y
  6424. Set y offset from where to pick pixels.
  6425. @item mode
  6426. Set scope mode, can be one of the following:
  6427. @table @samp
  6428. @item mono
  6429. Draw hexadecimal pixel values with white color on black background.
  6430. @item color
  6431. Draw hexadecimal pixel values with input video pixel color on black
  6432. background.
  6433. @item color2
  6434. Draw hexadecimal pixel values on color background picked from input video,
  6435. the text color is picked in such way so its always visible.
  6436. @end table
  6437. @item axis
  6438. Draw rows and columns numbers on left and top of video.
  6439. @item opacity
  6440. Set background opacity.
  6441. @item format
  6442. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  6443. @end table
  6444. @section dctdnoiz
  6445. Denoise frames using 2D DCT (frequency domain filtering).
  6446. This filter is not designed for real time.
  6447. The filter accepts the following options:
  6448. @table @option
  6449. @item sigma, s
  6450. Set the noise sigma constant.
  6451. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6452. coefficient (absolute value) below this threshold with be dropped.
  6453. If you need a more advanced filtering, see @option{expr}.
  6454. Default is @code{0}.
  6455. @item overlap
  6456. Set number overlapping pixels for each block. Since the filter can be slow, you
  6457. may want to reduce this value, at the cost of a less effective filter and the
  6458. risk of various artefacts.
  6459. If the overlapping value doesn't permit processing the whole input width or
  6460. height, a warning will be displayed and according borders won't be denoised.
  6461. Default value is @var{blocksize}-1, which is the best possible setting.
  6462. @item expr, e
  6463. Set the coefficient factor expression.
  6464. For each coefficient of a DCT block, this expression will be evaluated as a
  6465. multiplier value for the coefficient.
  6466. If this is option is set, the @option{sigma} option will be ignored.
  6467. The absolute value of the coefficient can be accessed through the @var{c}
  6468. variable.
  6469. @item n
  6470. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6471. @var{blocksize}, which is the width and height of the processed blocks.
  6472. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6473. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6474. on the speed processing. Also, a larger block size does not necessarily means a
  6475. better de-noising.
  6476. @end table
  6477. @subsection Examples
  6478. Apply a denoise with a @option{sigma} of @code{4.5}:
  6479. @example
  6480. dctdnoiz=4.5
  6481. @end example
  6482. The same operation can be achieved using the expression system:
  6483. @example
  6484. dctdnoiz=e='gte(c, 4.5*3)'
  6485. @end example
  6486. Violent denoise using a block size of @code{16x16}:
  6487. @example
  6488. dctdnoiz=15:n=4
  6489. @end example
  6490. @section deband
  6491. Remove banding artifacts from input video.
  6492. It works by replacing banded pixels with average value of referenced pixels.
  6493. The filter accepts the following options:
  6494. @table @option
  6495. @item 1thr
  6496. @item 2thr
  6497. @item 3thr
  6498. @item 4thr
  6499. Set banding detection threshold for each plane. Default is 0.02.
  6500. Valid range is 0.00003 to 0.5.
  6501. If difference between current pixel and reference pixel is less than threshold,
  6502. it will be considered as banded.
  6503. @item range, r
  6504. Banding detection range in pixels. Default is 16. If positive, random number
  6505. in range 0 to set value will be used. If negative, exact absolute value
  6506. will be used.
  6507. The range defines square of four pixels around current pixel.
  6508. @item direction, d
  6509. Set direction in radians from which four pixel will be compared. If positive,
  6510. random direction from 0 to set direction will be picked. If negative, exact of
  6511. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6512. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6513. column.
  6514. @item blur, b
  6515. If enabled, current pixel is compared with average value of all four
  6516. surrounding pixels. The default is enabled. If disabled current pixel is
  6517. compared with all four surrounding pixels. The pixel is considered banded
  6518. if only all four differences with surrounding pixels are less than threshold.
  6519. @item coupling, c
  6520. If enabled, current pixel is changed if and only if all pixel components are banded,
  6521. e.g. banding detection threshold is triggered for all color components.
  6522. The default is disabled.
  6523. @end table
  6524. @section deblock
  6525. Remove blocking artifacts from input video.
  6526. The filter accepts the following options:
  6527. @table @option
  6528. @item filter
  6529. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6530. This controls what kind of deblocking is applied.
  6531. @item block
  6532. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6533. @item alpha
  6534. @item beta
  6535. @item gamma
  6536. @item delta
  6537. Set blocking detection thresholds. Allowed range is 0 to 1.
  6538. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6539. Using higher threshold gives more deblocking strength.
  6540. Setting @var{alpha} controls threshold detection at exact edge of block.
  6541. Remaining options controls threshold detection near the edge. Each one for
  6542. below/above or left/right. Setting any of those to @var{0} disables
  6543. deblocking.
  6544. @item planes
  6545. Set planes to filter. Default is to filter all available planes.
  6546. @end table
  6547. @subsection Examples
  6548. @itemize
  6549. @item
  6550. Deblock using weak filter and block size of 4 pixels.
  6551. @example
  6552. deblock=filter=weak:block=4
  6553. @end example
  6554. @item
  6555. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6556. deblocking more edges.
  6557. @example
  6558. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6559. @end example
  6560. @item
  6561. Similar as above, but filter only first plane.
  6562. @example
  6563. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6564. @end example
  6565. @item
  6566. Similar as above, but filter only second and third plane.
  6567. @example
  6568. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6569. @end example
  6570. @end itemize
  6571. @anchor{decimate}
  6572. @section decimate
  6573. Drop duplicated frames at regular intervals.
  6574. The filter accepts the following options:
  6575. @table @option
  6576. @item cycle
  6577. Set the number of frames from which one will be dropped. Setting this to
  6578. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6579. Default is @code{5}.
  6580. @item dupthresh
  6581. Set the threshold for duplicate detection. If the difference metric for a frame
  6582. is less than or equal to this value, then it is declared as duplicate. Default
  6583. is @code{1.1}
  6584. @item scthresh
  6585. Set scene change threshold. Default is @code{15}.
  6586. @item blockx
  6587. @item blocky
  6588. Set the size of the x and y-axis blocks used during metric calculations.
  6589. Larger blocks give better noise suppression, but also give worse detection of
  6590. small movements. Must be a power of two. Default is @code{32}.
  6591. @item ppsrc
  6592. Mark main input as a pre-processed input and activate clean source input
  6593. stream. This allows the input to be pre-processed with various filters to help
  6594. the metrics calculation while keeping the frame selection lossless. When set to
  6595. @code{1}, the first stream is for the pre-processed input, and the second
  6596. stream is the clean source from where the kept frames are chosen. Default is
  6597. @code{0}.
  6598. @item chroma
  6599. Set whether or not chroma is considered in the metric calculations. Default is
  6600. @code{1}.
  6601. @end table
  6602. @section deconvolve
  6603. Apply 2D deconvolution of video stream in frequency domain using second stream
  6604. as impulse.
  6605. The filter accepts the following options:
  6606. @table @option
  6607. @item planes
  6608. Set which planes to process.
  6609. @item impulse
  6610. Set which impulse video frames will be processed, can be @var{first}
  6611. or @var{all}. Default is @var{all}.
  6612. @item noise
  6613. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6614. and height are not same and not power of 2 or if stream prior to convolving
  6615. had noise.
  6616. @end table
  6617. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6618. @section dedot
  6619. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6620. It accepts the following options:
  6621. @table @option
  6622. @item m
  6623. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6624. @var{rainbows} for cross-color reduction.
  6625. @item lt
  6626. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6627. @item tl
  6628. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6629. @item tc
  6630. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6631. @item ct
  6632. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6633. @end table
  6634. @section deflate
  6635. Apply deflate effect to the video.
  6636. This filter replaces the pixel by the local(3x3) average by taking into account
  6637. only values lower than the pixel.
  6638. It accepts the following options:
  6639. @table @option
  6640. @item threshold0
  6641. @item threshold1
  6642. @item threshold2
  6643. @item threshold3
  6644. Limit the maximum change for each plane, default is 65535.
  6645. If 0, plane will remain unchanged.
  6646. @end table
  6647. @subsection Commands
  6648. This filter supports the all above options as @ref{commands}.
  6649. @section deflicker
  6650. Remove temporal frame luminance variations.
  6651. It accepts the following options:
  6652. @table @option
  6653. @item size, s
  6654. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6655. @item mode, m
  6656. Set averaging mode to smooth temporal luminance variations.
  6657. Available values are:
  6658. @table @samp
  6659. @item am
  6660. Arithmetic mean
  6661. @item gm
  6662. Geometric mean
  6663. @item hm
  6664. Harmonic mean
  6665. @item qm
  6666. Quadratic mean
  6667. @item cm
  6668. Cubic mean
  6669. @item pm
  6670. Power mean
  6671. @item median
  6672. Median
  6673. @end table
  6674. @item bypass
  6675. Do not actually modify frame. Useful when one only wants metadata.
  6676. @end table
  6677. @section dejudder
  6678. Remove judder produced by partially interlaced telecined content.
  6679. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6680. source was partially telecined content then the output of @code{pullup,dejudder}
  6681. will have a variable frame rate. May change the recorded frame rate of the
  6682. container. Aside from that change, this filter will not affect constant frame
  6683. rate video.
  6684. The option available in this filter is:
  6685. @table @option
  6686. @item cycle
  6687. Specify the length of the window over which the judder repeats.
  6688. Accepts any integer greater than 1. Useful values are:
  6689. @table @samp
  6690. @item 4
  6691. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6692. @item 5
  6693. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6694. @item 20
  6695. If a mixture of the two.
  6696. @end table
  6697. The default is @samp{4}.
  6698. @end table
  6699. @section delogo
  6700. Suppress a TV station logo by a simple interpolation of the surrounding
  6701. pixels. Just set a rectangle covering the logo and watch it disappear
  6702. (and sometimes something even uglier appear - your mileage may vary).
  6703. It accepts the following parameters:
  6704. @table @option
  6705. @item x
  6706. @item y
  6707. Specify the top left corner coordinates of the logo. They must be
  6708. specified.
  6709. @item w
  6710. @item h
  6711. Specify the width and height of the logo to clear. They must be
  6712. specified.
  6713. @item band, t
  6714. Specify the thickness of the fuzzy edge of the rectangle (added to
  6715. @var{w} and @var{h}). The default value is 1. This option is
  6716. deprecated, setting higher values should no longer be necessary and
  6717. is not recommended.
  6718. @item show
  6719. When set to 1, a green rectangle is drawn on the screen to simplify
  6720. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6721. The default value is 0.
  6722. The rectangle is drawn on the outermost pixels which will be (partly)
  6723. replaced with interpolated values. The values of the next pixels
  6724. immediately outside this rectangle in each direction will be used to
  6725. compute the interpolated pixel values inside the rectangle.
  6726. @end table
  6727. @subsection Examples
  6728. @itemize
  6729. @item
  6730. Set a rectangle covering the area with top left corner coordinates 0,0
  6731. and size 100x77, and a band of size 10:
  6732. @example
  6733. delogo=x=0:y=0:w=100:h=77:band=10
  6734. @end example
  6735. @end itemize
  6736. @section derain
  6737. Remove the rain in the input image/video by applying the derain methods based on
  6738. convolutional neural networks. Supported models:
  6739. @itemize
  6740. @item
  6741. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6742. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6743. @end itemize
  6744. Training as well as model generation scripts are provided in
  6745. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6746. Native model files (.model) can be generated from TensorFlow model
  6747. files (.pb) by using tools/python/convert.py
  6748. The filter accepts the following options:
  6749. @table @option
  6750. @item filter_type
  6751. Specify which filter to use. This option accepts the following values:
  6752. @table @samp
  6753. @item derain
  6754. Derain filter. To conduct derain filter, you need to use a derain model.
  6755. @item dehaze
  6756. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6757. @end table
  6758. Default value is @samp{derain}.
  6759. @item dnn_backend
  6760. Specify which DNN backend to use for model loading and execution. This option accepts
  6761. the following values:
  6762. @table @samp
  6763. @item native
  6764. Native implementation of DNN loading and execution.
  6765. @item tensorflow
  6766. TensorFlow backend. To enable this backend you
  6767. need to install the TensorFlow for C library (see
  6768. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6769. @code{--enable-libtensorflow}
  6770. @end table
  6771. Default value is @samp{native}.
  6772. @item model
  6773. Set path to model file specifying network architecture and its parameters.
  6774. Note that different backends use different file formats. TensorFlow and native
  6775. backend can load files for only its format.
  6776. @end table
  6777. @section deshake
  6778. Attempt to fix small changes in horizontal and/or vertical shift. This
  6779. filter helps remove camera shake from hand-holding a camera, bumping a
  6780. tripod, moving on a vehicle, etc.
  6781. The filter accepts the following options:
  6782. @table @option
  6783. @item x
  6784. @item y
  6785. @item w
  6786. @item h
  6787. Specify a rectangular area where to limit the search for motion
  6788. vectors.
  6789. If desired the search for motion vectors can be limited to a
  6790. rectangular area of the frame defined by its top left corner, width
  6791. and height. These parameters have the same meaning as the drawbox
  6792. filter which can be used to visualise the position of the bounding
  6793. box.
  6794. This is useful when simultaneous movement of subjects within the frame
  6795. might be confused for camera motion by the motion vector search.
  6796. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6797. then the full frame is used. This allows later options to be set
  6798. without specifying the bounding box for the motion vector search.
  6799. Default - search the whole frame.
  6800. @item rx
  6801. @item ry
  6802. Specify the maximum extent of movement in x and y directions in the
  6803. range 0-64 pixels. Default 16.
  6804. @item edge
  6805. Specify how to generate pixels to fill blanks at the edge of the
  6806. frame. Available values are:
  6807. @table @samp
  6808. @item blank, 0
  6809. Fill zeroes at blank locations
  6810. @item original, 1
  6811. Original image at blank locations
  6812. @item clamp, 2
  6813. Extruded edge value at blank locations
  6814. @item mirror, 3
  6815. Mirrored edge at blank locations
  6816. @end table
  6817. Default value is @samp{mirror}.
  6818. @item blocksize
  6819. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6820. default 8.
  6821. @item contrast
  6822. Specify the contrast threshold for blocks. Only blocks with more than
  6823. the specified contrast (difference between darkest and lightest
  6824. pixels) will be considered. Range 1-255, default 125.
  6825. @item search
  6826. Specify the search strategy. Available values are:
  6827. @table @samp
  6828. @item exhaustive, 0
  6829. Set exhaustive search
  6830. @item less, 1
  6831. Set less exhaustive search.
  6832. @end table
  6833. Default value is @samp{exhaustive}.
  6834. @item filename
  6835. If set then a detailed log of the motion search is written to the
  6836. specified file.
  6837. @end table
  6838. @section despill
  6839. Remove unwanted contamination of foreground colors, caused by reflected color of
  6840. greenscreen or bluescreen.
  6841. This filter accepts the following options:
  6842. @table @option
  6843. @item type
  6844. Set what type of despill to use.
  6845. @item mix
  6846. Set how spillmap will be generated.
  6847. @item expand
  6848. Set how much to get rid of still remaining spill.
  6849. @item red
  6850. Controls amount of red in spill area.
  6851. @item green
  6852. Controls amount of green in spill area.
  6853. Should be -1 for greenscreen.
  6854. @item blue
  6855. Controls amount of blue in spill area.
  6856. Should be -1 for bluescreen.
  6857. @item brightness
  6858. Controls brightness of spill area, preserving colors.
  6859. @item alpha
  6860. Modify alpha from generated spillmap.
  6861. @end table
  6862. @section detelecine
  6863. Apply an exact inverse of the telecine operation. It requires a predefined
  6864. pattern specified using the pattern option which must be the same as that passed
  6865. to the telecine filter.
  6866. This filter accepts the following options:
  6867. @table @option
  6868. @item first_field
  6869. @table @samp
  6870. @item top, t
  6871. top field first
  6872. @item bottom, b
  6873. bottom field first
  6874. The default value is @code{top}.
  6875. @end table
  6876. @item pattern
  6877. A string of numbers representing the pulldown pattern you wish to apply.
  6878. The default value is @code{23}.
  6879. @item start_frame
  6880. A number representing position of the first frame with respect to the telecine
  6881. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6882. @end table
  6883. @section dilation
  6884. Apply dilation effect to the video.
  6885. This filter replaces the pixel by the local(3x3) maximum.
  6886. It accepts the following options:
  6887. @table @option
  6888. @item threshold0
  6889. @item threshold1
  6890. @item threshold2
  6891. @item threshold3
  6892. Limit the maximum change for each plane, default is 65535.
  6893. If 0, plane will remain unchanged.
  6894. @item coordinates
  6895. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6896. pixels are used.
  6897. Flags to local 3x3 coordinates maps like this:
  6898. 1 2 3
  6899. 4 5
  6900. 6 7 8
  6901. @end table
  6902. @subsection Commands
  6903. This filter supports the all above options as @ref{commands}.
  6904. @section displace
  6905. Displace pixels as indicated by second and third input stream.
  6906. It takes three input streams and outputs one stream, the first input is the
  6907. source, and second and third input are displacement maps.
  6908. The second input specifies how much to displace pixels along the
  6909. x-axis, while the third input specifies how much to displace pixels
  6910. along the y-axis.
  6911. If one of displacement map streams terminates, last frame from that
  6912. displacement map will be used.
  6913. Note that once generated, displacements maps can be reused over and over again.
  6914. A description of the accepted options follows.
  6915. @table @option
  6916. @item edge
  6917. Set displace behavior for pixels that are out of range.
  6918. Available values are:
  6919. @table @samp
  6920. @item blank
  6921. Missing pixels are replaced by black pixels.
  6922. @item smear
  6923. Adjacent pixels will spread out to replace missing pixels.
  6924. @item wrap
  6925. Out of range pixels are wrapped so they point to pixels of other side.
  6926. @item mirror
  6927. Out of range pixels will be replaced with mirrored pixels.
  6928. @end table
  6929. Default is @samp{smear}.
  6930. @end table
  6931. @subsection Examples
  6932. @itemize
  6933. @item
  6934. Add ripple effect to rgb input of video size hd720:
  6935. @example
  6936. 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
  6937. @end example
  6938. @item
  6939. Add wave effect to rgb input of video size hd720:
  6940. @example
  6941. 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
  6942. @end example
  6943. @end itemize
  6944. @section dnn_processing
  6945. Do image processing with deep neural networks. Currently only AVFrame with RGB24
  6946. and BGR24 are supported, more formats will be added later.
  6947. The filter accepts the following options:
  6948. @table @option
  6949. @item dnn_backend
  6950. Specify which DNN backend to use for model loading and execution. This option accepts
  6951. the following values:
  6952. @table @samp
  6953. @item native
  6954. Native implementation of DNN loading and execution.
  6955. @item tensorflow
  6956. TensorFlow backend. To enable this backend you
  6957. need to install the TensorFlow for C library (see
  6958. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6959. @code{--enable-libtensorflow}
  6960. @end table
  6961. Default value is @samp{native}.
  6962. @item model
  6963. Set path to model file specifying network architecture and its parameters.
  6964. Note that different backends use different file formats. TensorFlow and native
  6965. backend can load files for only its format.
  6966. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  6967. @item input
  6968. Set the input name of the dnn network.
  6969. @item output
  6970. Set the output name of the dnn network.
  6971. @item fmt
  6972. Set the pixel format for the Frame. Allowed values are @code{AV_PIX_FMT_RGB24}, and @code{AV_PIX_FMT_BGR24}.
  6973. Default value is @code{AV_PIX_FMT_RGB24}.
  6974. @end table
  6975. @section drawbox
  6976. Draw a colored box on the input image.
  6977. It accepts the following parameters:
  6978. @table @option
  6979. @item x
  6980. @item y
  6981. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6982. @item width, w
  6983. @item height, h
  6984. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6985. the input width and height. It defaults to 0.
  6986. @item color, c
  6987. Specify the color of the box to write. For the general syntax of this option,
  6988. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6989. value @code{invert} is used, the box edge color is the same as the
  6990. video with inverted luma.
  6991. @item thickness, t
  6992. The expression which sets the thickness of the box edge.
  6993. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6994. See below for the list of accepted constants.
  6995. @item replace
  6996. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6997. will overwrite the video's color and alpha pixels.
  6998. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6999. @end table
  7000. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7001. following constants:
  7002. @table @option
  7003. @item dar
  7004. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7005. @item hsub
  7006. @item vsub
  7007. horizontal and vertical chroma subsample values. For example for the
  7008. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7009. @item in_h, ih
  7010. @item in_w, iw
  7011. The input width and height.
  7012. @item sar
  7013. The input sample aspect ratio.
  7014. @item x
  7015. @item y
  7016. The x and y offset coordinates where the box is drawn.
  7017. @item w
  7018. @item h
  7019. The width and height of the drawn box.
  7020. @item t
  7021. The thickness of the drawn box.
  7022. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7023. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7024. @end table
  7025. @subsection Examples
  7026. @itemize
  7027. @item
  7028. Draw a black box around the edge of the input image:
  7029. @example
  7030. drawbox
  7031. @end example
  7032. @item
  7033. Draw a box with color red and an opacity of 50%:
  7034. @example
  7035. drawbox=10:20:200:60:red@@0.5
  7036. @end example
  7037. The previous example can be specified as:
  7038. @example
  7039. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7040. @end example
  7041. @item
  7042. Fill the box with pink color:
  7043. @example
  7044. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7045. @end example
  7046. @item
  7047. Draw a 2-pixel red 2.40:1 mask:
  7048. @example
  7049. 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
  7050. @end example
  7051. @end itemize
  7052. @subsection Commands
  7053. This filter supports same commands as options.
  7054. The command accepts the same syntax of the corresponding option.
  7055. If the specified expression is not valid, it is kept at its current
  7056. value.
  7057. @anchor{drawgraph}
  7058. @section drawgraph
  7059. Draw a graph using input video metadata.
  7060. It accepts the following parameters:
  7061. @table @option
  7062. @item m1
  7063. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7064. @item fg1
  7065. Set 1st foreground color expression.
  7066. @item m2
  7067. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7068. @item fg2
  7069. Set 2nd foreground color expression.
  7070. @item m3
  7071. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7072. @item fg3
  7073. Set 3rd foreground color expression.
  7074. @item m4
  7075. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7076. @item fg4
  7077. Set 4th foreground color expression.
  7078. @item min
  7079. Set minimal value of metadata value.
  7080. @item max
  7081. Set maximal value of metadata value.
  7082. @item bg
  7083. Set graph background color. Default is white.
  7084. @item mode
  7085. Set graph mode.
  7086. Available values for mode is:
  7087. @table @samp
  7088. @item bar
  7089. @item dot
  7090. @item line
  7091. @end table
  7092. Default is @code{line}.
  7093. @item slide
  7094. Set slide mode.
  7095. Available values for slide is:
  7096. @table @samp
  7097. @item frame
  7098. Draw new frame when right border is reached.
  7099. @item replace
  7100. Replace old columns with new ones.
  7101. @item scroll
  7102. Scroll from right to left.
  7103. @item rscroll
  7104. Scroll from left to right.
  7105. @item picture
  7106. Draw single picture.
  7107. @end table
  7108. Default is @code{frame}.
  7109. @item size
  7110. Set size of graph video. For the syntax of this option, check the
  7111. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7112. The default value is @code{900x256}.
  7113. The foreground color expressions can use the following variables:
  7114. @table @option
  7115. @item MIN
  7116. Minimal value of metadata value.
  7117. @item MAX
  7118. Maximal value of metadata value.
  7119. @item VAL
  7120. Current metadata key value.
  7121. @end table
  7122. The color is defined as 0xAABBGGRR.
  7123. @end table
  7124. Example using metadata from @ref{signalstats} filter:
  7125. @example
  7126. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7127. @end example
  7128. Example using metadata from @ref{ebur128} filter:
  7129. @example
  7130. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7131. @end example
  7132. @section drawgrid
  7133. Draw a grid on the input image.
  7134. It accepts the following parameters:
  7135. @table @option
  7136. @item x
  7137. @item y
  7138. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7139. @item width, w
  7140. @item height, h
  7141. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7142. input width and height, respectively, minus @code{thickness}, so image gets
  7143. framed. Default to 0.
  7144. @item color, c
  7145. Specify the color of the grid. For the general syntax of this option,
  7146. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7147. value @code{invert} is used, the grid color is the same as the
  7148. video with inverted luma.
  7149. @item thickness, t
  7150. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7151. See below for the list of accepted constants.
  7152. @item replace
  7153. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7154. will overwrite the video's color and alpha pixels.
  7155. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7156. @end table
  7157. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7158. following constants:
  7159. @table @option
  7160. @item dar
  7161. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7162. @item hsub
  7163. @item vsub
  7164. horizontal and vertical chroma subsample values. For example for the
  7165. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7166. @item in_h, ih
  7167. @item in_w, iw
  7168. The input grid cell width and height.
  7169. @item sar
  7170. The input sample aspect ratio.
  7171. @item x
  7172. @item y
  7173. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7174. @item w
  7175. @item h
  7176. The width and height of the drawn cell.
  7177. @item t
  7178. The thickness of the drawn cell.
  7179. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7180. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7181. @end table
  7182. @subsection Examples
  7183. @itemize
  7184. @item
  7185. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7186. @example
  7187. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7188. @end example
  7189. @item
  7190. Draw a white 3x3 grid with an opacity of 50%:
  7191. @example
  7192. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7193. @end example
  7194. @end itemize
  7195. @subsection Commands
  7196. This filter supports same commands as options.
  7197. The command accepts the same syntax of the corresponding option.
  7198. If the specified expression is not valid, it is kept at its current
  7199. value.
  7200. @anchor{drawtext}
  7201. @section drawtext
  7202. Draw a text string or text from a specified file on top of a video, using the
  7203. libfreetype library.
  7204. To enable compilation of this filter, you need to configure FFmpeg with
  7205. @code{--enable-libfreetype}.
  7206. To enable default font fallback and the @var{font} option you need to
  7207. configure FFmpeg with @code{--enable-libfontconfig}.
  7208. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7209. @code{--enable-libfribidi}.
  7210. @subsection Syntax
  7211. It accepts the following parameters:
  7212. @table @option
  7213. @item box
  7214. Used to draw a box around text using the background color.
  7215. The value must be either 1 (enable) or 0 (disable).
  7216. The default value of @var{box} is 0.
  7217. @item boxborderw
  7218. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7219. The default value of @var{boxborderw} is 0.
  7220. @item boxcolor
  7221. The color to be used for drawing box around text. For the syntax of this
  7222. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7223. The default value of @var{boxcolor} is "white".
  7224. @item line_spacing
  7225. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7226. The default value of @var{line_spacing} is 0.
  7227. @item borderw
  7228. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7229. The default value of @var{borderw} is 0.
  7230. @item bordercolor
  7231. Set the color to be used for drawing border around text. For the syntax of this
  7232. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7233. The default value of @var{bordercolor} is "black".
  7234. @item expansion
  7235. Select how the @var{text} is expanded. Can be either @code{none},
  7236. @code{strftime} (deprecated) or
  7237. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7238. below for details.
  7239. @item basetime
  7240. Set a start time for the count. Value is in microseconds. Only applied
  7241. in the deprecated strftime expansion mode. To emulate in normal expansion
  7242. mode use the @code{pts} function, supplying the start time (in seconds)
  7243. as the second argument.
  7244. @item fix_bounds
  7245. If true, check and fix text coords to avoid clipping.
  7246. @item fontcolor
  7247. The color to be used for drawing fonts. For the syntax of this option, check
  7248. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7249. The default value of @var{fontcolor} is "black".
  7250. @item fontcolor_expr
  7251. String which is expanded the same way as @var{text} to obtain dynamic
  7252. @var{fontcolor} value. By default this option has empty value and is not
  7253. processed. When this option is set, it overrides @var{fontcolor} option.
  7254. @item font
  7255. The font family to be used for drawing text. By default Sans.
  7256. @item fontfile
  7257. The font file to be used for drawing text. The path must be included.
  7258. This parameter is mandatory if the fontconfig support is disabled.
  7259. @item alpha
  7260. Draw the text applying alpha blending. The value can
  7261. be a number between 0.0 and 1.0.
  7262. The expression accepts the same variables @var{x, y} as well.
  7263. The default value is 1.
  7264. Please see @var{fontcolor_expr}.
  7265. @item fontsize
  7266. The font size to be used for drawing text.
  7267. The default value of @var{fontsize} is 16.
  7268. @item text_shaping
  7269. If set to 1, attempt to shape the text (for example, reverse the order of
  7270. right-to-left text and join Arabic characters) before drawing it.
  7271. Otherwise, just draw the text exactly as given.
  7272. By default 1 (if supported).
  7273. @item ft_load_flags
  7274. The flags to be used for loading the fonts.
  7275. The flags map the corresponding flags supported by libfreetype, and are
  7276. a combination of the following values:
  7277. @table @var
  7278. @item default
  7279. @item no_scale
  7280. @item no_hinting
  7281. @item render
  7282. @item no_bitmap
  7283. @item vertical_layout
  7284. @item force_autohint
  7285. @item crop_bitmap
  7286. @item pedantic
  7287. @item ignore_global_advance_width
  7288. @item no_recurse
  7289. @item ignore_transform
  7290. @item monochrome
  7291. @item linear_design
  7292. @item no_autohint
  7293. @end table
  7294. Default value is "default".
  7295. For more information consult the documentation for the FT_LOAD_*
  7296. libfreetype flags.
  7297. @item shadowcolor
  7298. The color to be used for drawing a shadow behind the drawn text. For the
  7299. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7300. ffmpeg-utils manual,ffmpeg-utils}.
  7301. The default value of @var{shadowcolor} is "black".
  7302. @item shadowx
  7303. @item shadowy
  7304. The x and y offsets for the text shadow position with respect to the
  7305. position of the text. They can be either positive or negative
  7306. values. The default value for both is "0".
  7307. @item start_number
  7308. The starting frame number for the n/frame_num variable. The default value
  7309. is "0".
  7310. @item tabsize
  7311. The size in number of spaces to use for rendering the tab.
  7312. Default value is 4.
  7313. @item timecode
  7314. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7315. format. It can be used with or without text parameter. @var{timecode_rate}
  7316. option must be specified.
  7317. @item timecode_rate, rate, r
  7318. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7319. integer. Minimum value is "1".
  7320. Drop-frame timecode is supported for frame rates 30 & 60.
  7321. @item tc24hmax
  7322. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7323. Default is 0 (disabled).
  7324. @item text
  7325. The text string to be drawn. The text must be a sequence of UTF-8
  7326. encoded characters.
  7327. This parameter is mandatory if no file is specified with the parameter
  7328. @var{textfile}.
  7329. @item textfile
  7330. A text file containing text to be drawn. The text must be a sequence
  7331. of UTF-8 encoded characters.
  7332. This parameter is mandatory if no text string is specified with the
  7333. parameter @var{text}.
  7334. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7335. @item reload
  7336. If set to 1, the @var{textfile} will be reloaded before each frame.
  7337. Be sure to update it atomically, or it may be read partially, or even fail.
  7338. @item x
  7339. @item y
  7340. The expressions which specify the offsets where text will be drawn
  7341. within the video frame. They are relative to the top/left border of the
  7342. output image.
  7343. The default value of @var{x} and @var{y} is "0".
  7344. See below for the list of accepted constants and functions.
  7345. @end table
  7346. The parameters for @var{x} and @var{y} are expressions containing the
  7347. following constants and functions:
  7348. @table @option
  7349. @item dar
  7350. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7351. @item hsub
  7352. @item vsub
  7353. horizontal and vertical chroma subsample values. For example for the
  7354. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7355. @item line_h, lh
  7356. the height of each text line
  7357. @item main_h, h, H
  7358. the input height
  7359. @item main_w, w, W
  7360. the input width
  7361. @item max_glyph_a, ascent
  7362. the maximum distance from the baseline to the highest/upper grid
  7363. coordinate used to place a glyph outline point, for all the rendered
  7364. glyphs.
  7365. It is a positive value, due to the grid's orientation with the Y axis
  7366. upwards.
  7367. @item max_glyph_d, descent
  7368. the maximum distance from the baseline to the lowest grid coordinate
  7369. used to place a glyph outline point, for all the rendered glyphs.
  7370. This is a negative value, due to the grid's orientation, with the Y axis
  7371. upwards.
  7372. @item max_glyph_h
  7373. maximum glyph height, that is the maximum height for all the glyphs
  7374. contained in the rendered text, it is equivalent to @var{ascent} -
  7375. @var{descent}.
  7376. @item max_glyph_w
  7377. maximum glyph width, that is the maximum width for all the glyphs
  7378. contained in the rendered text
  7379. @item n
  7380. the number of input frame, starting from 0
  7381. @item rand(min, max)
  7382. return a random number included between @var{min} and @var{max}
  7383. @item sar
  7384. The input sample aspect ratio.
  7385. @item t
  7386. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7387. @item text_h, th
  7388. the height of the rendered text
  7389. @item text_w, tw
  7390. the width of the rendered text
  7391. @item x
  7392. @item y
  7393. the x and y offset coordinates where the text is drawn.
  7394. These parameters allow the @var{x} and @var{y} expressions to refer
  7395. to each other, so you can for example specify @code{y=x/dar}.
  7396. @item pict_type
  7397. A one character description of the current frame's picture type.
  7398. @item pkt_pos
  7399. The current packet's position in the input file or stream
  7400. (in bytes, from the start of the input). A value of -1 indicates
  7401. this info is not available.
  7402. @item pkt_duration
  7403. The current packet's duration, in seconds.
  7404. @item pkt_size
  7405. The current packet's size (in bytes).
  7406. @end table
  7407. @anchor{drawtext_expansion}
  7408. @subsection Text expansion
  7409. If @option{expansion} is set to @code{strftime},
  7410. the filter recognizes strftime() sequences in the provided text and
  7411. expands them accordingly. Check the documentation of strftime(). This
  7412. feature is deprecated.
  7413. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7414. If @option{expansion} is set to @code{normal} (which is the default),
  7415. the following expansion mechanism is used.
  7416. The backslash character @samp{\}, followed by any character, always expands to
  7417. the second character.
  7418. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7419. braces is a function name, possibly followed by arguments separated by ':'.
  7420. If the arguments contain special characters or delimiters (':' or '@}'),
  7421. they should be escaped.
  7422. Note that they probably must also be escaped as the value for the
  7423. @option{text} option in the filter argument string and as the filter
  7424. argument in the filtergraph description, and possibly also for the shell,
  7425. that makes up to four levels of escaping; using a text file avoids these
  7426. problems.
  7427. The following functions are available:
  7428. @table @command
  7429. @item expr, e
  7430. The expression evaluation result.
  7431. It must take one argument specifying the expression to be evaluated,
  7432. which accepts the same constants and functions as the @var{x} and
  7433. @var{y} values. Note that not all constants should be used, for
  7434. example the text size is not known when evaluating the expression, so
  7435. the constants @var{text_w} and @var{text_h} will have an undefined
  7436. value.
  7437. @item expr_int_format, eif
  7438. Evaluate the expression's value and output as formatted integer.
  7439. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7440. The second argument specifies the output format. Allowed values are @samp{x},
  7441. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7442. @code{printf} function.
  7443. The third parameter is optional and sets the number of positions taken by the output.
  7444. It can be used to add padding with zeros from the left.
  7445. @item gmtime
  7446. The time at which the filter is running, expressed in UTC.
  7447. It can accept an argument: a strftime() format string.
  7448. @item localtime
  7449. The time at which the filter is running, expressed in the local time zone.
  7450. It can accept an argument: a strftime() format string.
  7451. @item metadata
  7452. Frame metadata. Takes one or two arguments.
  7453. The first argument is mandatory and specifies the metadata key.
  7454. The second argument is optional and specifies a default value, used when the
  7455. metadata key is not found or empty.
  7456. Available metadata can be identified by inspecting entries
  7457. starting with TAG included within each frame section
  7458. printed by running @code{ffprobe -show_frames}.
  7459. String metadata generated in filters leading to
  7460. the drawtext filter are also available.
  7461. @item n, frame_num
  7462. The frame number, starting from 0.
  7463. @item pict_type
  7464. A one character description of the current picture type.
  7465. @item pts
  7466. The timestamp of the current frame.
  7467. It can take up to three arguments.
  7468. The first argument is the format of the timestamp; it defaults to @code{flt}
  7469. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7470. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7471. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7472. @code{localtime} stands for the timestamp of the frame formatted as
  7473. local time zone time.
  7474. The second argument is an offset added to the timestamp.
  7475. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7476. supplied to present the hour part of the formatted timestamp in 24h format
  7477. (00-23).
  7478. If the format is set to @code{localtime} or @code{gmtime},
  7479. a third argument may be supplied: a strftime() format string.
  7480. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7481. @end table
  7482. @subsection Commands
  7483. This filter supports altering parameters via commands:
  7484. @table @option
  7485. @item reinit
  7486. Alter existing filter parameters.
  7487. Syntax for the argument is the same as for filter invocation, e.g.
  7488. @example
  7489. fontsize=56:fontcolor=green:text='Hello World'
  7490. @end example
  7491. Full filter invocation with sendcmd would look like this:
  7492. @example
  7493. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7494. @end example
  7495. @end table
  7496. If the entire argument can't be parsed or applied as valid values then the filter will
  7497. continue with its existing parameters.
  7498. @subsection Examples
  7499. @itemize
  7500. @item
  7501. Draw "Test Text" with font FreeSerif, using the default values for the
  7502. optional parameters.
  7503. @example
  7504. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7505. @end example
  7506. @item
  7507. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7508. and y=50 (counting from the top-left corner of the screen), text is
  7509. yellow with a red box around it. Both the text and the box have an
  7510. opacity of 20%.
  7511. @example
  7512. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7513. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7514. @end example
  7515. Note that the double quotes are not necessary if spaces are not used
  7516. within the parameter list.
  7517. @item
  7518. Show the text at the center of the video frame:
  7519. @example
  7520. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7521. @end example
  7522. @item
  7523. Show the text at a random position, switching to a new position every 30 seconds:
  7524. @example
  7525. 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)"
  7526. @end example
  7527. @item
  7528. Show a text line sliding from right to left in the last row of the video
  7529. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7530. with no newlines.
  7531. @example
  7532. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7533. @end example
  7534. @item
  7535. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7536. @example
  7537. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7538. @end example
  7539. @item
  7540. Draw a single green letter "g", at the center of the input video.
  7541. The glyph baseline is placed at half screen height.
  7542. @example
  7543. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7544. @end example
  7545. @item
  7546. Show text for 1 second every 3 seconds:
  7547. @example
  7548. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7549. @end example
  7550. @item
  7551. Use fontconfig to set the font. Note that the colons need to be escaped.
  7552. @example
  7553. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7554. @end example
  7555. @item
  7556. Print the date of a real-time encoding (see strftime(3)):
  7557. @example
  7558. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7559. @end example
  7560. @item
  7561. Show text fading in and out (appearing/disappearing):
  7562. @example
  7563. #!/bin/sh
  7564. DS=1.0 # display start
  7565. DE=10.0 # display end
  7566. FID=1.5 # fade in duration
  7567. FOD=5 # fade out duration
  7568. 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 @}"
  7569. @end example
  7570. @item
  7571. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7572. and the @option{fontsize} value are included in the @option{y} offset.
  7573. @example
  7574. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7575. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7576. @end example
  7577. @end itemize
  7578. For more information about libfreetype, check:
  7579. @url{http://www.freetype.org/}.
  7580. For more information about fontconfig, check:
  7581. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7582. For more information about libfribidi, check:
  7583. @url{http://fribidi.org/}.
  7584. @section edgedetect
  7585. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7586. The filter accepts the following options:
  7587. @table @option
  7588. @item low
  7589. @item high
  7590. Set low and high threshold values used by the Canny thresholding
  7591. algorithm.
  7592. The high threshold selects the "strong" edge pixels, which are then
  7593. connected through 8-connectivity with the "weak" edge pixels selected
  7594. by the low threshold.
  7595. @var{low} and @var{high} threshold values must be chosen in the range
  7596. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7597. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7598. is @code{50/255}.
  7599. @item mode
  7600. Define the drawing mode.
  7601. @table @samp
  7602. @item wires
  7603. Draw white/gray wires on black background.
  7604. @item colormix
  7605. Mix the colors to create a paint/cartoon effect.
  7606. @item canny
  7607. Apply Canny edge detector on all selected planes.
  7608. @end table
  7609. Default value is @var{wires}.
  7610. @item planes
  7611. Select planes for filtering. By default all available planes are filtered.
  7612. @end table
  7613. @subsection Examples
  7614. @itemize
  7615. @item
  7616. Standard edge detection with custom values for the hysteresis thresholding:
  7617. @example
  7618. edgedetect=low=0.1:high=0.4
  7619. @end example
  7620. @item
  7621. Painting effect without thresholding:
  7622. @example
  7623. edgedetect=mode=colormix:high=0
  7624. @end example
  7625. @end itemize
  7626. @section elbg
  7627. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7628. For each input image, the filter will compute the optimal mapping from
  7629. the input to the output given the codebook length, that is the number
  7630. of distinct output colors.
  7631. This filter accepts the following options.
  7632. @table @option
  7633. @item codebook_length, l
  7634. Set codebook length. The value must be a positive integer, and
  7635. represents the number of distinct output colors. Default value is 256.
  7636. @item nb_steps, n
  7637. Set the maximum number of iterations to apply for computing the optimal
  7638. mapping. The higher the value the better the result and the higher the
  7639. computation time. Default value is 1.
  7640. @item seed, s
  7641. Set a random seed, must be an integer included between 0 and
  7642. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7643. will try to use a good random seed on a best effort basis.
  7644. @item pal8
  7645. Set pal8 output pixel format. This option does not work with codebook
  7646. length greater than 256.
  7647. @end table
  7648. @section entropy
  7649. Measure graylevel entropy in histogram of color channels of video frames.
  7650. It accepts the following parameters:
  7651. @table @option
  7652. @item mode
  7653. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7654. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7655. between neighbour histogram values.
  7656. @end table
  7657. @section eq
  7658. Set brightness, contrast, saturation and approximate gamma adjustment.
  7659. The filter accepts the following options:
  7660. @table @option
  7661. @item contrast
  7662. Set the contrast expression. The value must be a float value in range
  7663. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7664. @item brightness
  7665. Set the brightness expression. The value must be a float value in
  7666. range @code{-1.0} to @code{1.0}. The default value is "0".
  7667. @item saturation
  7668. Set the saturation expression. The value must be a float in
  7669. range @code{0.0} to @code{3.0}. The default value is "1".
  7670. @item gamma
  7671. Set the gamma expression. The value must be a float in range
  7672. @code{0.1} to @code{10.0}. The default value is "1".
  7673. @item gamma_r
  7674. Set the gamma expression for red. The value must be a float in
  7675. range @code{0.1} to @code{10.0}. The default value is "1".
  7676. @item gamma_g
  7677. Set the gamma expression for green. The value must be a float in range
  7678. @code{0.1} to @code{10.0}. The default value is "1".
  7679. @item gamma_b
  7680. Set the gamma expression for blue. The value must be a float in range
  7681. @code{0.1} to @code{10.0}. The default value is "1".
  7682. @item gamma_weight
  7683. Set the gamma weight expression. It can be used to reduce the effect
  7684. of a high gamma value on bright image areas, e.g. keep them from
  7685. getting overamplified and just plain white. The value must be a float
  7686. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7687. gamma correction all the way down while @code{1.0} leaves it at its
  7688. full strength. Default is "1".
  7689. @item eval
  7690. Set when the expressions for brightness, contrast, saturation and
  7691. gamma expressions are evaluated.
  7692. It accepts the following values:
  7693. @table @samp
  7694. @item init
  7695. only evaluate expressions once during the filter initialization or
  7696. when a command is processed
  7697. @item frame
  7698. evaluate expressions for each incoming frame
  7699. @end table
  7700. Default value is @samp{init}.
  7701. @end table
  7702. The expressions accept the following parameters:
  7703. @table @option
  7704. @item n
  7705. frame count of the input frame starting from 0
  7706. @item pos
  7707. byte position of the corresponding packet in the input file, NAN if
  7708. unspecified
  7709. @item r
  7710. frame rate of the input video, NAN if the input frame rate is unknown
  7711. @item t
  7712. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7713. @end table
  7714. @subsection Commands
  7715. The filter supports the following commands:
  7716. @table @option
  7717. @item contrast
  7718. Set the contrast expression.
  7719. @item brightness
  7720. Set the brightness expression.
  7721. @item saturation
  7722. Set the saturation expression.
  7723. @item gamma
  7724. Set the gamma expression.
  7725. @item gamma_r
  7726. Set the gamma_r expression.
  7727. @item gamma_g
  7728. Set gamma_g expression.
  7729. @item gamma_b
  7730. Set gamma_b expression.
  7731. @item gamma_weight
  7732. Set gamma_weight expression.
  7733. The command accepts the same syntax of the corresponding option.
  7734. If the specified expression is not valid, it is kept at its current
  7735. value.
  7736. @end table
  7737. @section erosion
  7738. Apply erosion effect to the video.
  7739. This filter replaces the pixel by the local(3x3) minimum.
  7740. It accepts the following options:
  7741. @table @option
  7742. @item threshold0
  7743. @item threshold1
  7744. @item threshold2
  7745. @item threshold3
  7746. Limit the maximum change for each plane, default is 65535.
  7747. If 0, plane will remain unchanged.
  7748. @item coordinates
  7749. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7750. pixels are used.
  7751. Flags to local 3x3 coordinates maps like this:
  7752. 1 2 3
  7753. 4 5
  7754. 6 7 8
  7755. @end table
  7756. @subsection Commands
  7757. This filter supports the all above options as @ref{commands}.
  7758. @section extractplanes
  7759. Extract color channel components from input video stream into
  7760. separate grayscale video streams.
  7761. The filter accepts the following option:
  7762. @table @option
  7763. @item planes
  7764. Set plane(s) to extract.
  7765. Available values for planes are:
  7766. @table @samp
  7767. @item y
  7768. @item u
  7769. @item v
  7770. @item a
  7771. @item r
  7772. @item g
  7773. @item b
  7774. @end table
  7775. Choosing planes not available in the input will result in an error.
  7776. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7777. with @code{y}, @code{u}, @code{v} planes at same time.
  7778. @end table
  7779. @subsection Examples
  7780. @itemize
  7781. @item
  7782. Extract luma, u and v color channel component from input video frame
  7783. into 3 grayscale outputs:
  7784. @example
  7785. 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
  7786. @end example
  7787. @end itemize
  7788. @section fade
  7789. Apply a fade-in/out effect to the input video.
  7790. It accepts the following parameters:
  7791. @table @option
  7792. @item type, t
  7793. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7794. effect.
  7795. Default is @code{in}.
  7796. @item start_frame, s
  7797. Specify the number of the frame to start applying the fade
  7798. effect at. Default is 0.
  7799. @item nb_frames, n
  7800. The number of frames that the fade effect lasts. At the end of the
  7801. fade-in effect, the output video will have the same intensity as the input video.
  7802. At the end of the fade-out transition, the output video will be filled with the
  7803. selected @option{color}.
  7804. Default is 25.
  7805. @item alpha
  7806. If set to 1, fade only alpha channel, if one exists on the input.
  7807. Default value is 0.
  7808. @item start_time, st
  7809. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7810. effect. If both start_frame and start_time are specified, the fade will start at
  7811. whichever comes last. Default is 0.
  7812. @item duration, d
  7813. The number of seconds for which the fade effect has to last. At the end of the
  7814. fade-in effect the output video will have the same intensity as the input video,
  7815. at the end of the fade-out transition the output video will be filled with the
  7816. selected @option{color}.
  7817. If both duration and nb_frames are specified, duration is used. Default is 0
  7818. (nb_frames is used by default).
  7819. @item color, c
  7820. Specify the color of the fade. Default is "black".
  7821. @end table
  7822. @subsection Examples
  7823. @itemize
  7824. @item
  7825. Fade in the first 30 frames of video:
  7826. @example
  7827. fade=in:0:30
  7828. @end example
  7829. The command above is equivalent to:
  7830. @example
  7831. fade=t=in:s=0:n=30
  7832. @end example
  7833. @item
  7834. Fade out the last 45 frames of a 200-frame video:
  7835. @example
  7836. fade=out:155:45
  7837. fade=type=out:start_frame=155:nb_frames=45
  7838. @end example
  7839. @item
  7840. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7841. @example
  7842. fade=in:0:25, fade=out:975:25
  7843. @end example
  7844. @item
  7845. Make the first 5 frames yellow, then fade in from frame 5-24:
  7846. @example
  7847. fade=in:5:20:color=yellow
  7848. @end example
  7849. @item
  7850. Fade in alpha over first 25 frames of video:
  7851. @example
  7852. fade=in:0:25:alpha=1
  7853. @end example
  7854. @item
  7855. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7856. @example
  7857. fade=t=in:st=5.5:d=0.5
  7858. @end example
  7859. @end itemize
  7860. @section fftdnoiz
  7861. Denoise frames using 3D FFT (frequency domain filtering).
  7862. The filter accepts the following options:
  7863. @table @option
  7864. @item sigma
  7865. Set the noise sigma constant. This sets denoising strength.
  7866. Default value is 1. Allowed range is from 0 to 30.
  7867. Using very high sigma with low overlap may give blocking artifacts.
  7868. @item amount
  7869. Set amount of denoising. By default all detected noise is reduced.
  7870. Default value is 1. Allowed range is from 0 to 1.
  7871. @item block
  7872. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7873. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7874. block size in pixels is 2^4 which is 16.
  7875. @item overlap
  7876. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7877. @item prev
  7878. Set number of previous frames to use for denoising. By default is set to 0.
  7879. @item next
  7880. Set number of next frames to to use for denoising. By default is set to 0.
  7881. @item planes
  7882. Set planes which will be filtered, by default are all available filtered
  7883. except alpha.
  7884. @end table
  7885. @section fftfilt
  7886. Apply arbitrary expressions to samples in frequency domain
  7887. @table @option
  7888. @item dc_Y
  7889. Adjust the dc value (gain) of the luma plane of the image. The filter
  7890. accepts an integer value in range @code{0} to @code{1000}. The default
  7891. value is set to @code{0}.
  7892. @item dc_U
  7893. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7894. filter accepts an integer value in range @code{0} to @code{1000}. The
  7895. default value is set to @code{0}.
  7896. @item dc_V
  7897. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7898. filter accepts an integer value in range @code{0} to @code{1000}. The
  7899. default value is set to @code{0}.
  7900. @item weight_Y
  7901. Set the frequency domain weight expression for the luma plane.
  7902. @item weight_U
  7903. Set the frequency domain weight expression for the 1st chroma plane.
  7904. @item weight_V
  7905. Set the frequency domain weight expression for the 2nd chroma plane.
  7906. @item eval
  7907. Set when the expressions are evaluated.
  7908. It accepts the following values:
  7909. @table @samp
  7910. @item init
  7911. Only evaluate expressions once during the filter initialization.
  7912. @item frame
  7913. Evaluate expressions for each incoming frame.
  7914. @end table
  7915. Default value is @samp{init}.
  7916. The filter accepts the following variables:
  7917. @item X
  7918. @item Y
  7919. The coordinates of the current sample.
  7920. @item W
  7921. @item H
  7922. The width and height of the image.
  7923. @item N
  7924. The number of input frame, starting from 0.
  7925. @end table
  7926. @subsection Examples
  7927. @itemize
  7928. @item
  7929. High-pass:
  7930. @example
  7931. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7932. @end example
  7933. @item
  7934. Low-pass:
  7935. @example
  7936. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7937. @end example
  7938. @item
  7939. Sharpen:
  7940. @example
  7941. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7942. @end example
  7943. @item
  7944. Blur:
  7945. @example
  7946. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7947. @end example
  7948. @end itemize
  7949. @section field
  7950. Extract a single field from an interlaced image using stride
  7951. arithmetic to avoid wasting CPU time. The output frames are marked as
  7952. non-interlaced.
  7953. The filter accepts the following options:
  7954. @table @option
  7955. @item type
  7956. Specify whether to extract the top (if the value is @code{0} or
  7957. @code{top}) or the bottom field (if the value is @code{1} or
  7958. @code{bottom}).
  7959. @end table
  7960. @section fieldhint
  7961. Create new frames by copying the top and bottom fields from surrounding frames
  7962. supplied as numbers by the hint file.
  7963. @table @option
  7964. @item hint
  7965. Set file containing hints: absolute/relative frame numbers.
  7966. There must be one line for each frame in a clip. Each line must contain two
  7967. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7968. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7969. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7970. for @code{relative} mode. First number tells from which frame to pick up top
  7971. field and second number tells from which frame to pick up bottom field.
  7972. If optionally followed by @code{+} output frame will be marked as interlaced,
  7973. else if followed by @code{-} output frame will be marked as progressive, else
  7974. it will be marked same as input frame.
  7975. If optionally followed by @code{t} output frame will use only top field, or in
  7976. case of @code{b} it will use only bottom field.
  7977. If line starts with @code{#} or @code{;} that line is skipped.
  7978. @item mode
  7979. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7980. @end table
  7981. Example of first several lines of @code{hint} file for @code{relative} mode:
  7982. @example
  7983. 0,0 - # first frame
  7984. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7985. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7986. 1,0 -
  7987. 0,0 -
  7988. 0,0 -
  7989. 1,0 -
  7990. 1,0 -
  7991. 1,0 -
  7992. 0,0 -
  7993. 0,0 -
  7994. 1,0 -
  7995. 1,0 -
  7996. 1,0 -
  7997. 0,0 -
  7998. @end example
  7999. @section fieldmatch
  8000. Field matching filter for inverse telecine. It is meant to reconstruct the
  8001. progressive frames from a telecined stream. The filter does not drop duplicated
  8002. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8003. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8004. The separation of the field matching and the decimation is notably motivated by
  8005. the possibility of inserting a de-interlacing filter fallback between the two.
  8006. If the source has mixed telecined and real interlaced content,
  8007. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8008. But these remaining combed frames will be marked as interlaced, and thus can be
  8009. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8010. In addition to the various configuration options, @code{fieldmatch} can take an
  8011. optional second stream, activated through the @option{ppsrc} option. If
  8012. enabled, the frames reconstruction will be based on the fields and frames from
  8013. this second stream. This allows the first input to be pre-processed in order to
  8014. help the various algorithms of the filter, while keeping the output lossless
  8015. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8016. or brightness/contrast adjustments can help.
  8017. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8018. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8019. which @code{fieldmatch} is based on. While the semantic and usage are very
  8020. close, some behaviour and options names can differ.
  8021. The @ref{decimate} filter currently only works for constant frame rate input.
  8022. If your input has mixed telecined (30fps) and progressive content with a lower
  8023. framerate like 24fps use the following filterchain to produce the necessary cfr
  8024. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8025. The filter accepts the following options:
  8026. @table @option
  8027. @item order
  8028. Specify the assumed field order of the input stream. Available values are:
  8029. @table @samp
  8030. @item auto
  8031. Auto detect parity (use FFmpeg's internal parity value).
  8032. @item bff
  8033. Assume bottom field first.
  8034. @item tff
  8035. Assume top field first.
  8036. @end table
  8037. Note that it is sometimes recommended not to trust the parity announced by the
  8038. stream.
  8039. Default value is @var{auto}.
  8040. @item mode
  8041. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8042. sense that it won't risk creating jerkiness due to duplicate frames when
  8043. possible, but if there are bad edits or blended fields it will end up
  8044. outputting combed frames when a good match might actually exist. On the other
  8045. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8046. but will almost always find a good frame if there is one. The other values are
  8047. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8048. jerkiness and creating duplicate frames versus finding good matches in sections
  8049. with bad edits, orphaned fields, blended fields, etc.
  8050. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8051. Available values are:
  8052. @table @samp
  8053. @item pc
  8054. 2-way matching (p/c)
  8055. @item pc_n
  8056. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8057. @item pc_u
  8058. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8059. @item pc_n_ub
  8060. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8061. still combed (p/c + n + u/b)
  8062. @item pcn
  8063. 3-way matching (p/c/n)
  8064. @item pcn_ub
  8065. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8066. detected as combed (p/c/n + u/b)
  8067. @end table
  8068. The parenthesis at the end indicate the matches that would be used for that
  8069. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8070. @var{top}).
  8071. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8072. the slowest.
  8073. Default value is @var{pc_n}.
  8074. @item ppsrc
  8075. Mark the main input stream as a pre-processed input, and enable the secondary
  8076. input stream as the clean source to pick the fields from. See the filter
  8077. introduction for more details. It is similar to the @option{clip2} feature from
  8078. VFM/TFM.
  8079. Default value is @code{0} (disabled).
  8080. @item field
  8081. Set the field to match from. It is recommended to set this to the same value as
  8082. @option{order} unless you experience matching failures with that setting. In
  8083. certain circumstances changing the field that is used to match from can have a
  8084. large impact on matching performance. Available values are:
  8085. @table @samp
  8086. @item auto
  8087. Automatic (same value as @option{order}).
  8088. @item bottom
  8089. Match from the bottom field.
  8090. @item top
  8091. Match from the top field.
  8092. @end table
  8093. Default value is @var{auto}.
  8094. @item mchroma
  8095. Set whether or not chroma is included during the match comparisons. In most
  8096. cases it is recommended to leave this enabled. You should set this to @code{0}
  8097. only if your clip has bad chroma problems such as heavy rainbowing or other
  8098. artifacts. Setting this to @code{0} could also be used to speed things up at
  8099. the cost of some accuracy.
  8100. Default value is @code{1}.
  8101. @item y0
  8102. @item y1
  8103. These define an exclusion band which excludes the lines between @option{y0} and
  8104. @option{y1} from being included in the field matching decision. An exclusion
  8105. band can be used to ignore subtitles, a logo, or other things that may
  8106. interfere with the matching. @option{y0} sets the starting scan line and
  8107. @option{y1} sets the ending line; all lines in between @option{y0} and
  8108. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8109. @option{y0} and @option{y1} to the same value will disable the feature.
  8110. @option{y0} and @option{y1} defaults to @code{0}.
  8111. @item scthresh
  8112. Set the scene change detection threshold as a percentage of maximum change on
  8113. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8114. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8115. @option{scthresh} is @code{[0.0, 100.0]}.
  8116. Default value is @code{12.0}.
  8117. @item combmatch
  8118. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8119. account the combed scores of matches when deciding what match to use as the
  8120. final match. Available values are:
  8121. @table @samp
  8122. @item none
  8123. No final matching based on combed scores.
  8124. @item sc
  8125. Combed scores are only used when a scene change is detected.
  8126. @item full
  8127. Use combed scores all the time.
  8128. @end table
  8129. Default is @var{sc}.
  8130. @item combdbg
  8131. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8132. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8133. Available values are:
  8134. @table @samp
  8135. @item none
  8136. No forced calculation.
  8137. @item pcn
  8138. Force p/c/n calculations.
  8139. @item pcnub
  8140. Force p/c/n/u/b calculations.
  8141. @end table
  8142. Default value is @var{none}.
  8143. @item cthresh
  8144. This is the area combing threshold used for combed frame detection. This
  8145. essentially controls how "strong" or "visible" combing must be to be detected.
  8146. Larger values mean combing must be more visible and smaller values mean combing
  8147. can be less visible or strong and still be detected. Valid settings are from
  8148. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8149. be detected as combed). This is basically a pixel difference value. A good
  8150. range is @code{[8, 12]}.
  8151. Default value is @code{9}.
  8152. @item chroma
  8153. Sets whether or not chroma is considered in the combed frame decision. Only
  8154. disable this if your source has chroma problems (rainbowing, etc.) that are
  8155. causing problems for the combed frame detection with chroma enabled. Actually,
  8156. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8157. where there is chroma only combing in the source.
  8158. Default value is @code{0}.
  8159. @item blockx
  8160. @item blocky
  8161. Respectively set the x-axis and y-axis size of the window used during combed
  8162. frame detection. This has to do with the size of the area in which
  8163. @option{combpel} pixels are required to be detected as combed for a frame to be
  8164. declared combed. See the @option{combpel} parameter description for more info.
  8165. Possible values are any number that is a power of 2 starting at 4 and going up
  8166. to 512.
  8167. Default value is @code{16}.
  8168. @item combpel
  8169. The number of combed pixels inside any of the @option{blocky} by
  8170. @option{blockx} size blocks on the frame for the frame to be detected as
  8171. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8172. setting controls "how much" combing there must be in any localized area (a
  8173. window defined by the @option{blockx} and @option{blocky} settings) on the
  8174. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8175. which point no frames will ever be detected as combed). This setting is known
  8176. as @option{MI} in TFM/VFM vocabulary.
  8177. Default value is @code{80}.
  8178. @end table
  8179. @anchor{p/c/n/u/b meaning}
  8180. @subsection p/c/n/u/b meaning
  8181. @subsubsection p/c/n
  8182. We assume the following telecined stream:
  8183. @example
  8184. Top fields: 1 2 2 3 4
  8185. Bottom fields: 1 2 3 4 4
  8186. @end example
  8187. The numbers correspond to the progressive frame the fields relate to. Here, the
  8188. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8189. When @code{fieldmatch} is configured to run a matching from bottom
  8190. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8191. @example
  8192. Input stream:
  8193. T 1 2 2 3 4
  8194. B 1 2 3 4 4 <-- matching reference
  8195. Matches: c c n n c
  8196. Output stream:
  8197. T 1 2 3 4 4
  8198. B 1 2 3 4 4
  8199. @end example
  8200. As a result of the field matching, we can see that some frames get duplicated.
  8201. To perform a complete inverse telecine, you need to rely on a decimation filter
  8202. after this operation. See for instance the @ref{decimate} filter.
  8203. The same operation now matching from top fields (@option{field}=@var{top})
  8204. looks like this:
  8205. @example
  8206. Input stream:
  8207. T 1 2 2 3 4 <-- matching reference
  8208. B 1 2 3 4 4
  8209. Matches: c c p p c
  8210. Output stream:
  8211. T 1 2 2 3 4
  8212. B 1 2 2 3 4
  8213. @end example
  8214. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8215. basically, they refer to the frame and field of the opposite parity:
  8216. @itemize
  8217. @item @var{p} matches the field of the opposite parity in the previous frame
  8218. @item @var{c} matches the field of the opposite parity in the current frame
  8219. @item @var{n} matches the field of the opposite parity in the next frame
  8220. @end itemize
  8221. @subsubsection u/b
  8222. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8223. from the opposite parity flag. In the following examples, we assume that we are
  8224. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8225. 'x' is placed above and below each matched fields.
  8226. With bottom matching (@option{field}=@var{bottom}):
  8227. @example
  8228. Match: c p n b u
  8229. x x x x x
  8230. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8231. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8232. x x x x x
  8233. Output frames:
  8234. 2 1 2 2 2
  8235. 2 2 2 1 3
  8236. @end example
  8237. With top matching (@option{field}=@var{top}):
  8238. @example
  8239. Match: c p n b u
  8240. x x x x x
  8241. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8242. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8243. x x x x x
  8244. Output frames:
  8245. 2 2 2 1 2
  8246. 2 1 3 2 2
  8247. @end example
  8248. @subsection Examples
  8249. Simple IVTC of a top field first telecined stream:
  8250. @example
  8251. fieldmatch=order=tff:combmatch=none, decimate
  8252. @end example
  8253. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8254. @example
  8255. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8256. @end example
  8257. @section fieldorder
  8258. Transform the field order of the input video.
  8259. It accepts the following parameters:
  8260. @table @option
  8261. @item order
  8262. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8263. for bottom field first.
  8264. @end table
  8265. The default value is @samp{tff}.
  8266. The transformation is done by shifting the picture content up or down
  8267. by one line, and filling the remaining line with appropriate picture content.
  8268. This method is consistent with most broadcast field order converters.
  8269. If the input video is not flagged as being interlaced, or it is already
  8270. flagged as being of the required output field order, then this filter does
  8271. not alter the incoming video.
  8272. It is very useful when converting to or from PAL DV material,
  8273. which is bottom field first.
  8274. For example:
  8275. @example
  8276. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8277. @end example
  8278. @section fifo, afifo
  8279. Buffer input images and send them when they are requested.
  8280. It is mainly useful when auto-inserted by the libavfilter
  8281. framework.
  8282. It does not take parameters.
  8283. @section fillborders
  8284. Fill borders of the input video, without changing video stream dimensions.
  8285. Sometimes video can have garbage at the four edges and you may not want to
  8286. crop video input to keep size multiple of some number.
  8287. This filter accepts the following options:
  8288. @table @option
  8289. @item left
  8290. Number of pixels to fill from left border.
  8291. @item right
  8292. Number of pixels to fill from right border.
  8293. @item top
  8294. Number of pixels to fill from top border.
  8295. @item bottom
  8296. Number of pixels to fill from bottom border.
  8297. @item mode
  8298. Set fill mode.
  8299. It accepts the following values:
  8300. @table @samp
  8301. @item smear
  8302. fill pixels using outermost pixels
  8303. @item mirror
  8304. fill pixels using mirroring
  8305. @item fixed
  8306. fill pixels with constant value
  8307. @end table
  8308. Default is @var{smear}.
  8309. @item color
  8310. Set color for pixels in fixed mode. Default is @var{black}.
  8311. @end table
  8312. @subsection Commands
  8313. This filter supports same @ref{commands} as options.
  8314. The command accepts the same syntax of the corresponding option.
  8315. If the specified expression is not valid, it is kept at its current
  8316. value.
  8317. @section find_rect
  8318. Find a rectangular object
  8319. It accepts the following options:
  8320. @table @option
  8321. @item object
  8322. Filepath of the object image, needs to be in gray8.
  8323. @item threshold
  8324. Detection threshold, default is 0.5.
  8325. @item mipmaps
  8326. Number of mipmaps, default is 3.
  8327. @item xmin, ymin, xmax, ymax
  8328. Specifies the rectangle in which to search.
  8329. @end table
  8330. @subsection Examples
  8331. @itemize
  8332. @item
  8333. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8334. @example
  8335. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8336. @end example
  8337. @end itemize
  8338. @section floodfill
  8339. Flood area with values of same pixel components with another values.
  8340. It accepts the following options:
  8341. @table @option
  8342. @item x
  8343. Set pixel x coordinate.
  8344. @item y
  8345. Set pixel y coordinate.
  8346. @item s0
  8347. Set source #0 component value.
  8348. @item s1
  8349. Set source #1 component value.
  8350. @item s2
  8351. Set source #2 component value.
  8352. @item s3
  8353. Set source #3 component value.
  8354. @item d0
  8355. Set destination #0 component value.
  8356. @item d1
  8357. Set destination #1 component value.
  8358. @item d2
  8359. Set destination #2 component value.
  8360. @item d3
  8361. Set destination #3 component value.
  8362. @end table
  8363. @anchor{format}
  8364. @section format
  8365. Convert the input video to one of the specified pixel formats.
  8366. Libavfilter will try to pick one that is suitable as input to
  8367. the next filter.
  8368. It accepts the following parameters:
  8369. @table @option
  8370. @item pix_fmts
  8371. A '|'-separated list of pixel format names, such as
  8372. "pix_fmts=yuv420p|monow|rgb24".
  8373. @end table
  8374. @subsection Examples
  8375. @itemize
  8376. @item
  8377. Convert the input video to the @var{yuv420p} format
  8378. @example
  8379. format=pix_fmts=yuv420p
  8380. @end example
  8381. Convert the input video to any of the formats in the list
  8382. @example
  8383. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8384. @end example
  8385. @end itemize
  8386. @anchor{fps}
  8387. @section fps
  8388. Convert the video to specified constant frame rate by duplicating or dropping
  8389. frames as necessary.
  8390. It accepts the following parameters:
  8391. @table @option
  8392. @item fps
  8393. The desired output frame rate. The default is @code{25}.
  8394. @item start_time
  8395. Assume the first PTS should be the given value, in seconds. This allows for
  8396. padding/trimming at the start of stream. By default, no assumption is made
  8397. about the first frame's expected PTS, so no padding or trimming is done.
  8398. For example, this could be set to 0 to pad the beginning with duplicates of
  8399. the first frame if a video stream starts after the audio stream or to trim any
  8400. frames with a negative PTS.
  8401. @item round
  8402. Timestamp (PTS) rounding method.
  8403. Possible values are:
  8404. @table @option
  8405. @item zero
  8406. round towards 0
  8407. @item inf
  8408. round away from 0
  8409. @item down
  8410. round towards -infinity
  8411. @item up
  8412. round towards +infinity
  8413. @item near
  8414. round to nearest
  8415. @end table
  8416. The default is @code{near}.
  8417. @item eof_action
  8418. Action performed when reading the last frame.
  8419. Possible values are:
  8420. @table @option
  8421. @item round
  8422. Use same timestamp rounding method as used for other frames.
  8423. @item pass
  8424. Pass through last frame if input duration has not been reached yet.
  8425. @end table
  8426. The default is @code{round}.
  8427. @end table
  8428. Alternatively, the options can be specified as a flat string:
  8429. @var{fps}[:@var{start_time}[:@var{round}]].
  8430. See also the @ref{setpts} filter.
  8431. @subsection Examples
  8432. @itemize
  8433. @item
  8434. A typical usage in order to set the fps to 25:
  8435. @example
  8436. fps=fps=25
  8437. @end example
  8438. @item
  8439. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8440. @example
  8441. fps=fps=film:round=near
  8442. @end example
  8443. @end itemize
  8444. @section framepack
  8445. Pack two different video streams into a stereoscopic video, setting proper
  8446. metadata on supported codecs. The two views should have the same size and
  8447. framerate and processing will stop when the shorter video ends. Please note
  8448. that you may conveniently adjust view properties with the @ref{scale} and
  8449. @ref{fps} filters.
  8450. It accepts the following parameters:
  8451. @table @option
  8452. @item format
  8453. The desired packing format. Supported values are:
  8454. @table @option
  8455. @item sbs
  8456. The views are next to each other (default).
  8457. @item tab
  8458. The views are on top of each other.
  8459. @item lines
  8460. The views are packed by line.
  8461. @item columns
  8462. The views are packed by column.
  8463. @item frameseq
  8464. The views are temporally interleaved.
  8465. @end table
  8466. @end table
  8467. Some examples:
  8468. @example
  8469. # Convert left and right views into a frame-sequential video
  8470. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8471. # Convert views into a side-by-side video with the same output resolution as the input
  8472. 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
  8473. @end example
  8474. @section framerate
  8475. Change the frame rate by interpolating new video output frames from the source
  8476. frames.
  8477. This filter is not designed to function correctly with interlaced media. If
  8478. you wish to change the frame rate of interlaced media then you are required
  8479. to deinterlace before this filter and re-interlace after this filter.
  8480. A description of the accepted options follows.
  8481. @table @option
  8482. @item fps
  8483. Specify the output frames per second. This option can also be specified
  8484. as a value alone. The default is @code{50}.
  8485. @item interp_start
  8486. Specify the start of a range where the output frame will be created as a
  8487. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8488. the default is @code{15}.
  8489. @item interp_end
  8490. Specify the end of a range where the output frame will be created as a
  8491. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8492. the default is @code{240}.
  8493. @item scene
  8494. Specify the level at which a scene change is detected as a value between
  8495. 0 and 100 to indicate a new scene; a low value reflects a low
  8496. probability for the current frame to introduce a new scene, while a higher
  8497. value means the current frame is more likely to be one.
  8498. The default is @code{8.2}.
  8499. @item flags
  8500. Specify flags influencing the filter process.
  8501. Available value for @var{flags} is:
  8502. @table @option
  8503. @item scene_change_detect, scd
  8504. Enable scene change detection using the value of the option @var{scene}.
  8505. This flag is enabled by default.
  8506. @end table
  8507. @end table
  8508. @section framestep
  8509. Select one frame every N-th frame.
  8510. This filter accepts the following option:
  8511. @table @option
  8512. @item step
  8513. Select frame after every @code{step} frames.
  8514. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8515. @end table
  8516. @section freezedetect
  8517. Detect frozen video.
  8518. This filter logs a message and sets frame metadata when it detects that the
  8519. input video has no significant change in content during a specified duration.
  8520. Video freeze detection calculates the mean average absolute difference of all
  8521. the components of video frames and compares it to a noise floor.
  8522. The printed times and duration are expressed in seconds. The
  8523. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8524. whose timestamp equals or exceeds the detection duration and it contains the
  8525. timestamp of the first frame of the freeze. The
  8526. @code{lavfi.freezedetect.freeze_duration} and
  8527. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8528. after the freeze.
  8529. The filter accepts the following options:
  8530. @table @option
  8531. @item noise, n
  8532. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8533. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8534. 0.001.
  8535. @item duration, d
  8536. Set freeze duration until notification (default is 2 seconds).
  8537. @end table
  8538. @anchor{frei0r}
  8539. @section frei0r
  8540. Apply a frei0r effect to the input video.
  8541. To enable the compilation of this filter, you need to install the frei0r
  8542. header and configure FFmpeg with @code{--enable-frei0r}.
  8543. It accepts the following parameters:
  8544. @table @option
  8545. @item filter_name
  8546. The name of the frei0r effect to load. If the environment variable
  8547. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8548. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8549. Otherwise, the standard frei0r paths are searched, in this order:
  8550. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8551. @file{/usr/lib/frei0r-1/}.
  8552. @item filter_params
  8553. A '|'-separated list of parameters to pass to the frei0r effect.
  8554. @end table
  8555. A frei0r effect parameter can be a boolean (its value is either
  8556. "y" or "n"), a double, a color (specified as
  8557. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8558. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8559. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8560. a position (specified as @var{X}/@var{Y}, where
  8561. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8562. The number and types of parameters depend on the loaded effect. If an
  8563. effect parameter is not specified, the default value is set.
  8564. @subsection Examples
  8565. @itemize
  8566. @item
  8567. Apply the distort0r effect, setting the first two double parameters:
  8568. @example
  8569. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8570. @end example
  8571. @item
  8572. Apply the colordistance effect, taking a color as the first parameter:
  8573. @example
  8574. frei0r=colordistance:0.2/0.3/0.4
  8575. frei0r=colordistance:violet
  8576. frei0r=colordistance:0x112233
  8577. @end example
  8578. @item
  8579. Apply the perspective effect, specifying the top left and top right image
  8580. positions:
  8581. @example
  8582. frei0r=perspective:0.2/0.2|0.8/0.2
  8583. @end example
  8584. @end itemize
  8585. For more information, see
  8586. @url{http://frei0r.dyne.org}
  8587. @section fspp
  8588. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8589. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8590. processing filter, one of them is performed once per block, not per pixel.
  8591. This allows for much higher speed.
  8592. The filter accepts the following options:
  8593. @table @option
  8594. @item quality
  8595. Set quality. This option defines the number of levels for averaging. It accepts
  8596. an integer in the range 4-5. Default value is @code{4}.
  8597. @item qp
  8598. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8599. If not set, the filter will use the QP from the video stream (if available).
  8600. @item strength
  8601. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8602. more details but also more artifacts, while higher values make the image smoother
  8603. but also blurrier. Default value is @code{0} − PSNR optimal.
  8604. @item use_bframe_qp
  8605. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8606. option may cause flicker since the B-Frames have often larger QP. Default is
  8607. @code{0} (not enabled).
  8608. @end table
  8609. @section gblur
  8610. Apply Gaussian blur filter.
  8611. The filter accepts the following options:
  8612. @table @option
  8613. @item sigma
  8614. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8615. @item steps
  8616. Set number of steps for Gaussian approximation. Default is @code{1}.
  8617. @item planes
  8618. Set which planes to filter. By default all planes are filtered.
  8619. @item sigmaV
  8620. Set vertical sigma, if negative it will be same as @code{sigma}.
  8621. Default is @code{-1}.
  8622. @end table
  8623. @subsection Commands
  8624. This filter supports same commands as options.
  8625. The command accepts the same syntax of the corresponding option.
  8626. If the specified expression is not valid, it is kept at its current
  8627. value.
  8628. @section geq
  8629. Apply generic equation to each pixel.
  8630. The filter accepts the following options:
  8631. @table @option
  8632. @item lum_expr, lum
  8633. Set the luminance expression.
  8634. @item cb_expr, cb
  8635. Set the chrominance blue expression.
  8636. @item cr_expr, cr
  8637. Set the chrominance red expression.
  8638. @item alpha_expr, a
  8639. Set the alpha expression.
  8640. @item red_expr, r
  8641. Set the red expression.
  8642. @item green_expr, g
  8643. Set the green expression.
  8644. @item blue_expr, b
  8645. Set the blue expression.
  8646. @end table
  8647. The colorspace is selected according to the specified options. If one
  8648. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8649. options is specified, the filter will automatically select a YCbCr
  8650. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8651. @option{blue_expr} options is specified, it will select an RGB
  8652. colorspace.
  8653. If one of the chrominance expression is not defined, it falls back on the other
  8654. one. If no alpha expression is specified it will evaluate to opaque value.
  8655. If none of chrominance expressions are specified, they will evaluate
  8656. to the luminance expression.
  8657. The expressions can use the following variables and functions:
  8658. @table @option
  8659. @item N
  8660. The sequential number of the filtered frame, starting from @code{0}.
  8661. @item X
  8662. @item Y
  8663. The coordinates of the current sample.
  8664. @item W
  8665. @item H
  8666. The width and height of the image.
  8667. @item SW
  8668. @item SH
  8669. Width and height scale depending on the currently filtered plane. It is the
  8670. ratio between the corresponding luma plane number of pixels and the current
  8671. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8672. @code{0.5,0.5} for chroma planes.
  8673. @item T
  8674. Time of the current frame, expressed in seconds.
  8675. @item p(x, y)
  8676. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8677. plane.
  8678. @item lum(x, y)
  8679. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8680. plane.
  8681. @item cb(x, y)
  8682. Return the value of the pixel at location (@var{x},@var{y}) of the
  8683. blue-difference chroma plane. Return 0 if there is no such plane.
  8684. @item cr(x, y)
  8685. Return the value of the pixel at location (@var{x},@var{y}) of the
  8686. red-difference chroma plane. Return 0 if there is no such plane.
  8687. @item r(x, y)
  8688. @item g(x, y)
  8689. @item b(x, y)
  8690. Return the value of the pixel at location (@var{x},@var{y}) of the
  8691. red/green/blue component. Return 0 if there is no such component.
  8692. @item alpha(x, y)
  8693. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8694. plane. Return 0 if there is no such plane.
  8695. @item interpolation
  8696. Set one of interpolation methods:
  8697. @table @option
  8698. @item nearest, n
  8699. @item bilinear, b
  8700. @end table
  8701. Default is bilinear.
  8702. @end table
  8703. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8704. automatically clipped to the closer edge.
  8705. @subsection Examples
  8706. @itemize
  8707. @item
  8708. Flip the image horizontally:
  8709. @example
  8710. geq=p(W-X\,Y)
  8711. @end example
  8712. @item
  8713. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8714. wavelength of 100 pixels:
  8715. @example
  8716. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8717. @end example
  8718. @item
  8719. Generate a fancy enigmatic moving light:
  8720. @example
  8721. 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
  8722. @end example
  8723. @item
  8724. Generate a quick emboss effect:
  8725. @example
  8726. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8727. @end example
  8728. @item
  8729. Modify RGB components depending on pixel position:
  8730. @example
  8731. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8732. @end example
  8733. @item
  8734. Create a radial gradient that is the same size as the input (also see
  8735. the @ref{vignette} filter):
  8736. @example
  8737. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8738. @end example
  8739. @end itemize
  8740. @section gradfun
  8741. Fix the banding artifacts that are sometimes introduced into nearly flat
  8742. regions by truncation to 8-bit color depth.
  8743. Interpolate the gradients that should go where the bands are, and
  8744. dither them.
  8745. It is designed for playback only. Do not use it prior to
  8746. lossy compression, because compression tends to lose the dither and
  8747. bring back the bands.
  8748. It accepts the following parameters:
  8749. @table @option
  8750. @item strength
  8751. The maximum amount by which the filter will change any one pixel. This is also
  8752. the threshold for detecting nearly flat regions. Acceptable values range from
  8753. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8754. valid range.
  8755. @item radius
  8756. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8757. gradients, but also prevents the filter from modifying the pixels near detailed
  8758. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8759. values will be clipped to the valid range.
  8760. @end table
  8761. Alternatively, the options can be specified as a flat string:
  8762. @var{strength}[:@var{radius}]
  8763. @subsection Examples
  8764. @itemize
  8765. @item
  8766. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8767. @example
  8768. gradfun=3.5:8
  8769. @end example
  8770. @item
  8771. Specify radius, omitting the strength (which will fall-back to the default
  8772. value):
  8773. @example
  8774. gradfun=radius=8
  8775. @end example
  8776. @end itemize
  8777. @anchor{graphmonitor}
  8778. @section graphmonitor
  8779. Show various filtergraph stats.
  8780. With this filter one can debug complete filtergraph.
  8781. Especially issues with links filling with queued frames.
  8782. The filter accepts the following options:
  8783. @table @option
  8784. @item size, s
  8785. Set video output size. Default is @var{hd720}.
  8786. @item opacity, o
  8787. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8788. @item mode, m
  8789. Set output mode, can be @var{fulll} or @var{compact}.
  8790. In @var{compact} mode only filters with some queued frames have displayed stats.
  8791. @item flags, f
  8792. Set flags which enable which stats are shown in video.
  8793. Available values for flags are:
  8794. @table @samp
  8795. @item queue
  8796. Display number of queued frames in each link.
  8797. @item frame_count_in
  8798. Display number of frames taken from filter.
  8799. @item frame_count_out
  8800. Display number of frames given out from filter.
  8801. @item pts
  8802. Display current filtered frame pts.
  8803. @item time
  8804. Display current filtered frame time.
  8805. @item timebase
  8806. Display time base for filter link.
  8807. @item format
  8808. Display used format for filter link.
  8809. @item size
  8810. Display video size or number of audio channels in case of audio used by filter link.
  8811. @item rate
  8812. Display video frame rate or sample rate in case of audio used by filter link.
  8813. @end table
  8814. @item rate, r
  8815. Set upper limit for video rate of output stream, Default value is @var{25}.
  8816. This guarantee that output video frame rate will not be higher than this value.
  8817. @end table
  8818. @section greyedge
  8819. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8820. and corrects the scene colors accordingly.
  8821. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8822. The filter accepts the following options:
  8823. @table @option
  8824. @item difford
  8825. The order of differentiation to be applied on the scene. Must be chosen in the range
  8826. [0,2] and default value is 1.
  8827. @item minknorm
  8828. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8829. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8830. max value instead of calculating Minkowski distance.
  8831. @item sigma
  8832. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8833. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8834. can't be equal to 0 if @var{difford} is greater than 0.
  8835. @end table
  8836. @subsection Examples
  8837. @itemize
  8838. @item
  8839. Grey Edge:
  8840. @example
  8841. greyedge=difford=1:minknorm=5:sigma=2
  8842. @end example
  8843. @item
  8844. Max Edge:
  8845. @example
  8846. greyedge=difford=1:minknorm=0:sigma=2
  8847. @end example
  8848. @end itemize
  8849. @anchor{haldclut}
  8850. @section haldclut
  8851. Apply a Hald CLUT to a video stream.
  8852. First input is the video stream to process, and second one is the Hald CLUT.
  8853. The Hald CLUT input can be a simple picture or a complete video stream.
  8854. The filter accepts the following options:
  8855. @table @option
  8856. @item shortest
  8857. Force termination when the shortest input terminates. Default is @code{0}.
  8858. @item repeatlast
  8859. Continue applying the last CLUT after the end of the stream. A value of
  8860. @code{0} disable the filter after the last frame of the CLUT is reached.
  8861. Default is @code{1}.
  8862. @end table
  8863. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8864. filters share the same internals).
  8865. This filter also supports the @ref{framesync} options.
  8866. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8867. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8868. @subsection Workflow examples
  8869. @subsubsection Hald CLUT video stream
  8870. Generate an identity Hald CLUT stream altered with various effects:
  8871. @example
  8872. 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
  8873. @end example
  8874. Note: make sure you use a lossless codec.
  8875. Then use it with @code{haldclut} to apply it on some random stream:
  8876. @example
  8877. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8878. @end example
  8879. The Hald CLUT will be applied to the 10 first seconds (duration of
  8880. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8881. to the remaining frames of the @code{mandelbrot} stream.
  8882. @subsubsection Hald CLUT with preview
  8883. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8884. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8885. biggest possible square starting at the top left of the picture. The remaining
  8886. padding pixels (bottom or right) will be ignored. This area can be used to add
  8887. a preview of the Hald CLUT.
  8888. Typically, the following generated Hald CLUT will be supported by the
  8889. @code{haldclut} filter:
  8890. @example
  8891. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8892. pad=iw+320 [padded_clut];
  8893. smptebars=s=320x256, split [a][b];
  8894. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8895. [main][b] overlay=W-320" -frames:v 1 clut.png
  8896. @end example
  8897. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8898. bars are displayed on the right-top, and below the same color bars processed by
  8899. the color changes.
  8900. Then, the effect of this Hald CLUT can be visualized with:
  8901. @example
  8902. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8903. @end example
  8904. @section hflip
  8905. Flip the input video horizontally.
  8906. For example, to horizontally flip the input video with @command{ffmpeg}:
  8907. @example
  8908. ffmpeg -i in.avi -vf "hflip" out.avi
  8909. @end example
  8910. @section histeq
  8911. This filter applies a global color histogram equalization on a
  8912. per-frame basis.
  8913. It can be used to correct video that has a compressed range of pixel
  8914. intensities. The filter redistributes the pixel intensities to
  8915. equalize their distribution across the intensity range. It may be
  8916. viewed as an "automatically adjusting contrast filter". This filter is
  8917. useful only for correcting degraded or poorly captured source
  8918. video.
  8919. The filter accepts the following options:
  8920. @table @option
  8921. @item strength
  8922. Determine the amount of equalization to be applied. As the strength
  8923. is reduced, the distribution of pixel intensities more-and-more
  8924. approaches that of the input frame. The value must be a float number
  8925. in the range [0,1] and defaults to 0.200.
  8926. @item intensity
  8927. Set the maximum intensity that can generated and scale the output
  8928. values appropriately. The strength should be set as desired and then
  8929. the intensity can be limited if needed to avoid washing-out. The value
  8930. must be a float number in the range [0,1] and defaults to 0.210.
  8931. @item antibanding
  8932. Set the antibanding level. If enabled the filter will randomly vary
  8933. the luminance of output pixels by a small amount to avoid banding of
  8934. the histogram. Possible values are @code{none}, @code{weak} or
  8935. @code{strong}. It defaults to @code{none}.
  8936. @end table
  8937. @anchor{histogram}
  8938. @section histogram
  8939. Compute and draw a color distribution histogram for the input video.
  8940. The computed histogram is a representation of the color component
  8941. distribution in an image.
  8942. Standard histogram displays the color components distribution in an image.
  8943. Displays color graph for each color component. Shows distribution of
  8944. the Y, U, V, A or R, G, B components, depending on input format, in the
  8945. current frame. Below each graph a color component scale meter is shown.
  8946. The filter accepts the following options:
  8947. @table @option
  8948. @item level_height
  8949. Set height of level. Default value is @code{200}.
  8950. Allowed range is [50, 2048].
  8951. @item scale_height
  8952. Set height of color scale. Default value is @code{12}.
  8953. Allowed range is [0, 40].
  8954. @item display_mode
  8955. Set display mode.
  8956. It accepts the following values:
  8957. @table @samp
  8958. @item stack
  8959. Per color component graphs are placed below each other.
  8960. @item parade
  8961. Per color component graphs are placed side by side.
  8962. @item overlay
  8963. Presents information identical to that in the @code{parade}, except
  8964. that the graphs representing color components are superimposed directly
  8965. over one another.
  8966. @end table
  8967. Default is @code{stack}.
  8968. @item levels_mode
  8969. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8970. Default is @code{linear}.
  8971. @item components
  8972. Set what color components to display.
  8973. Default is @code{7}.
  8974. @item fgopacity
  8975. Set foreground opacity. Default is @code{0.7}.
  8976. @item bgopacity
  8977. Set background opacity. Default is @code{0.5}.
  8978. @end table
  8979. @subsection Examples
  8980. @itemize
  8981. @item
  8982. Calculate and draw histogram:
  8983. @example
  8984. ffplay -i input -vf histogram
  8985. @end example
  8986. @end itemize
  8987. @anchor{hqdn3d}
  8988. @section hqdn3d
  8989. This is a high precision/quality 3d denoise filter. It aims to reduce
  8990. image noise, producing smooth images and making still images really
  8991. still. It should enhance compressibility.
  8992. It accepts the following optional parameters:
  8993. @table @option
  8994. @item luma_spatial
  8995. A non-negative floating point number which specifies spatial luma strength.
  8996. It defaults to 4.0.
  8997. @item chroma_spatial
  8998. A non-negative floating point number which specifies spatial chroma strength.
  8999. It defaults to 3.0*@var{luma_spatial}/4.0.
  9000. @item luma_tmp
  9001. A floating point number which specifies luma temporal strength. It defaults to
  9002. 6.0*@var{luma_spatial}/4.0.
  9003. @item chroma_tmp
  9004. A floating point number which specifies chroma temporal strength. It defaults to
  9005. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9006. @end table
  9007. @subsection Commands
  9008. This filter supports same @ref{commands} as options.
  9009. The command accepts the same syntax of the corresponding option.
  9010. If the specified expression is not valid, it is kept at its current
  9011. value.
  9012. @anchor{hwdownload}
  9013. @section hwdownload
  9014. Download hardware frames to system memory.
  9015. The input must be in hardware frames, and the output a non-hardware format.
  9016. Not all formats will be supported on the output - it may be necessary to insert
  9017. an additional @option{format} filter immediately following in the graph to get
  9018. the output in a supported format.
  9019. @section hwmap
  9020. Map hardware frames to system memory or to another device.
  9021. This filter has several different modes of operation; which one is used depends
  9022. on the input and output formats:
  9023. @itemize
  9024. @item
  9025. Hardware frame input, normal frame output
  9026. Map the input frames to system memory and pass them to the output. If the
  9027. original hardware frame is later required (for example, after overlaying
  9028. something else on part of it), the @option{hwmap} filter can be used again
  9029. in the next mode to retrieve it.
  9030. @item
  9031. Normal frame input, hardware frame output
  9032. If the input is actually a software-mapped hardware frame, then unmap it -
  9033. that is, return the original hardware frame.
  9034. Otherwise, a device must be provided. Create new hardware surfaces on that
  9035. device for the output, then map them back to the software format at the input
  9036. and give those frames to the preceding filter. This will then act like the
  9037. @option{hwupload} filter, but may be able to avoid an additional copy when
  9038. the input is already in a compatible format.
  9039. @item
  9040. Hardware frame input and output
  9041. A device must be supplied for the output, either directly or with the
  9042. @option{derive_device} option. The input and output devices must be of
  9043. different types and compatible - the exact meaning of this is
  9044. system-dependent, but typically it means that they must refer to the same
  9045. underlying hardware context (for example, refer to the same graphics card).
  9046. If the input frames were originally created on the output device, then unmap
  9047. to retrieve the original frames.
  9048. Otherwise, map the frames to the output device - create new hardware frames
  9049. on the output corresponding to the frames on the input.
  9050. @end itemize
  9051. The following additional parameters are accepted:
  9052. @table @option
  9053. @item mode
  9054. Set the frame mapping mode. Some combination of:
  9055. @table @var
  9056. @item read
  9057. The mapped frame should be readable.
  9058. @item write
  9059. The mapped frame should be writeable.
  9060. @item overwrite
  9061. The mapping will always overwrite the entire frame.
  9062. This may improve performance in some cases, as the original contents of the
  9063. frame need not be loaded.
  9064. @item direct
  9065. The mapping must not involve any copying.
  9066. Indirect mappings to copies of frames are created in some cases where either
  9067. direct mapping is not possible or it would have unexpected properties.
  9068. Setting this flag ensures that the mapping is direct and will fail if that is
  9069. not possible.
  9070. @end table
  9071. Defaults to @var{read+write} if not specified.
  9072. @item derive_device @var{type}
  9073. Rather than using the device supplied at initialisation, instead derive a new
  9074. device of type @var{type} from the device the input frames exist on.
  9075. @item reverse
  9076. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9077. and map them back to the source. This may be necessary in some cases where
  9078. a mapping in one direction is required but only the opposite direction is
  9079. supported by the devices being used.
  9080. This option is dangerous - it may break the preceding filter in undefined
  9081. ways if there are any additional constraints on that filter's output.
  9082. Do not use it without fully understanding the implications of its use.
  9083. @end table
  9084. @anchor{hwupload}
  9085. @section hwupload
  9086. Upload system memory frames to hardware surfaces.
  9087. The device to upload to must be supplied when the filter is initialised. If
  9088. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9089. option.
  9090. @anchor{hwupload_cuda}
  9091. @section hwupload_cuda
  9092. Upload system memory frames to a CUDA device.
  9093. It accepts the following optional parameters:
  9094. @table @option
  9095. @item device
  9096. The number of the CUDA device to use
  9097. @end table
  9098. @section hqx
  9099. Apply a high-quality magnification filter designed for pixel art. This filter
  9100. was originally created by Maxim Stepin.
  9101. It accepts the following option:
  9102. @table @option
  9103. @item n
  9104. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9105. @code{hq3x} and @code{4} for @code{hq4x}.
  9106. Default is @code{3}.
  9107. @end table
  9108. @section hstack
  9109. Stack input videos horizontally.
  9110. All streams must be of same pixel format and of same height.
  9111. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9112. to create same output.
  9113. The filter accepts the following option:
  9114. @table @option
  9115. @item inputs
  9116. Set number of input streams. Default is 2.
  9117. @item shortest
  9118. If set to 1, force the output to terminate when the shortest input
  9119. terminates. Default value is 0.
  9120. @end table
  9121. @section hue
  9122. Modify the hue and/or the saturation of the input.
  9123. It accepts the following parameters:
  9124. @table @option
  9125. @item h
  9126. Specify the hue angle as a number of degrees. It accepts an expression,
  9127. and defaults to "0".
  9128. @item s
  9129. Specify the saturation in the [-10,10] range. It accepts an expression and
  9130. defaults to "1".
  9131. @item H
  9132. Specify the hue angle as a number of radians. It accepts an
  9133. expression, and defaults to "0".
  9134. @item b
  9135. Specify the brightness in the [-10,10] range. It accepts an expression and
  9136. defaults to "0".
  9137. @end table
  9138. @option{h} and @option{H} are mutually exclusive, and can't be
  9139. specified at the same time.
  9140. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9141. expressions containing the following constants:
  9142. @table @option
  9143. @item n
  9144. frame count of the input frame starting from 0
  9145. @item pts
  9146. presentation timestamp of the input frame expressed in time base units
  9147. @item r
  9148. frame rate of the input video, NAN if the input frame rate is unknown
  9149. @item t
  9150. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9151. @item tb
  9152. time base of the input video
  9153. @end table
  9154. @subsection Examples
  9155. @itemize
  9156. @item
  9157. Set the hue to 90 degrees and the saturation to 1.0:
  9158. @example
  9159. hue=h=90:s=1
  9160. @end example
  9161. @item
  9162. Same command but expressing the hue in radians:
  9163. @example
  9164. hue=H=PI/2:s=1
  9165. @end example
  9166. @item
  9167. Rotate hue and make the saturation swing between 0
  9168. and 2 over a period of 1 second:
  9169. @example
  9170. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9171. @end example
  9172. @item
  9173. Apply a 3 seconds saturation fade-in effect starting at 0:
  9174. @example
  9175. hue="s=min(t/3\,1)"
  9176. @end example
  9177. The general fade-in expression can be written as:
  9178. @example
  9179. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9180. @end example
  9181. @item
  9182. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9183. @example
  9184. hue="s=max(0\, min(1\, (8-t)/3))"
  9185. @end example
  9186. The general fade-out expression can be written as:
  9187. @example
  9188. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9189. @end example
  9190. @end itemize
  9191. @subsection Commands
  9192. This filter supports the following commands:
  9193. @table @option
  9194. @item b
  9195. @item s
  9196. @item h
  9197. @item H
  9198. Modify the hue and/or the saturation and/or brightness of the input video.
  9199. The command accepts the same syntax of the corresponding option.
  9200. If the specified expression is not valid, it is kept at its current
  9201. value.
  9202. @end table
  9203. @section hysteresis
  9204. Grow first stream into second stream by connecting components.
  9205. This makes it possible to build more robust edge masks.
  9206. This filter accepts the following options:
  9207. @table @option
  9208. @item planes
  9209. Set which planes will be processed as bitmap, unprocessed planes will be
  9210. copied from first stream.
  9211. By default value 0xf, all planes will be processed.
  9212. @item threshold
  9213. Set threshold which is used in filtering. If pixel component value is higher than
  9214. this value filter algorithm for connecting components is activated.
  9215. By default value is 0.
  9216. @end table
  9217. @section idet
  9218. Detect video interlacing type.
  9219. This filter tries to detect if the input frames are interlaced, progressive,
  9220. top or bottom field first. It will also try to detect fields that are
  9221. repeated between adjacent frames (a sign of telecine).
  9222. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9223. Multiple frame detection incorporates the classification history of previous frames.
  9224. The filter will log these metadata values:
  9225. @table @option
  9226. @item single.current_frame
  9227. Detected type of current frame using single-frame detection. One of:
  9228. ``tff'' (top field first), ``bff'' (bottom field first),
  9229. ``progressive'', or ``undetermined''
  9230. @item single.tff
  9231. Cumulative number of frames detected as top field first using single-frame detection.
  9232. @item multiple.tff
  9233. Cumulative number of frames detected as top field first using multiple-frame detection.
  9234. @item single.bff
  9235. Cumulative number of frames detected as bottom field first using single-frame detection.
  9236. @item multiple.current_frame
  9237. Detected type of current frame using multiple-frame detection. One of:
  9238. ``tff'' (top field first), ``bff'' (bottom field first),
  9239. ``progressive'', or ``undetermined''
  9240. @item multiple.bff
  9241. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9242. @item single.progressive
  9243. Cumulative number of frames detected as progressive using single-frame detection.
  9244. @item multiple.progressive
  9245. Cumulative number of frames detected as progressive using multiple-frame detection.
  9246. @item single.undetermined
  9247. Cumulative number of frames that could not be classified using single-frame detection.
  9248. @item multiple.undetermined
  9249. Cumulative number of frames that could not be classified using multiple-frame detection.
  9250. @item repeated.current_frame
  9251. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9252. @item repeated.neither
  9253. Cumulative number of frames with no repeated field.
  9254. @item repeated.top
  9255. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9256. @item repeated.bottom
  9257. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9258. @end table
  9259. The filter accepts the following options:
  9260. @table @option
  9261. @item intl_thres
  9262. Set interlacing threshold.
  9263. @item prog_thres
  9264. Set progressive threshold.
  9265. @item rep_thres
  9266. Threshold for repeated field detection.
  9267. @item half_life
  9268. Number of frames after which a given frame's contribution to the
  9269. statistics is halved (i.e., it contributes only 0.5 to its
  9270. classification). The default of 0 means that all frames seen are given
  9271. full weight of 1.0 forever.
  9272. @item analyze_interlaced_flag
  9273. When this is not 0 then idet will use the specified number of frames to determine
  9274. if the interlaced flag is accurate, it will not count undetermined frames.
  9275. If the flag is found to be accurate it will be used without any further
  9276. computations, if it is found to be inaccurate it will be cleared without any
  9277. further computations. This allows inserting the idet filter as a low computational
  9278. method to clean up the interlaced flag
  9279. @end table
  9280. @section il
  9281. Deinterleave or interleave fields.
  9282. This filter allows one to process interlaced images fields without
  9283. deinterlacing them. Deinterleaving splits the input frame into 2
  9284. fields (so called half pictures). Odd lines are moved to the top
  9285. half of the output image, even lines to the bottom half.
  9286. You can process (filter) them independently and then re-interleave them.
  9287. The filter accepts the following options:
  9288. @table @option
  9289. @item luma_mode, l
  9290. @item chroma_mode, c
  9291. @item alpha_mode, a
  9292. Available values for @var{luma_mode}, @var{chroma_mode} and
  9293. @var{alpha_mode} are:
  9294. @table @samp
  9295. @item none
  9296. Do nothing.
  9297. @item deinterleave, d
  9298. Deinterleave fields, placing one above the other.
  9299. @item interleave, i
  9300. Interleave fields. Reverse the effect of deinterleaving.
  9301. @end table
  9302. Default value is @code{none}.
  9303. @item luma_swap, ls
  9304. @item chroma_swap, cs
  9305. @item alpha_swap, as
  9306. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9307. @end table
  9308. @subsection Commands
  9309. This filter supports the all above options as @ref{commands}.
  9310. @section inflate
  9311. Apply inflate effect to the video.
  9312. This filter replaces the pixel by the local(3x3) average by taking into account
  9313. only values higher than the pixel.
  9314. It accepts the following options:
  9315. @table @option
  9316. @item threshold0
  9317. @item threshold1
  9318. @item threshold2
  9319. @item threshold3
  9320. Limit the maximum change for each plane, default is 65535.
  9321. If 0, plane will remain unchanged.
  9322. @end table
  9323. @subsection Commands
  9324. This filter supports the all above options as @ref{commands}.
  9325. @section interlace
  9326. Simple interlacing filter from progressive contents. This interleaves upper (or
  9327. lower) lines from odd frames with lower (or upper) lines from even frames,
  9328. halving the frame rate and preserving image height.
  9329. @example
  9330. Original Original New Frame
  9331. Frame 'j' Frame 'j+1' (tff)
  9332. ========== =========== ==================
  9333. Line 0 --------------------> Frame 'j' Line 0
  9334. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9335. Line 2 ---------------------> Frame 'j' Line 2
  9336. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9337. ... ... ...
  9338. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9339. @end example
  9340. It accepts the following optional parameters:
  9341. @table @option
  9342. @item scan
  9343. This determines whether the interlaced frame is taken from the even
  9344. (tff - default) or odd (bff) lines of the progressive frame.
  9345. @item lowpass
  9346. Vertical lowpass filter to avoid twitter interlacing and
  9347. reduce moire patterns.
  9348. @table @samp
  9349. @item 0, off
  9350. Disable vertical lowpass filter
  9351. @item 1, linear
  9352. Enable linear filter (default)
  9353. @item 2, complex
  9354. Enable complex filter. This will slightly less reduce twitter and moire
  9355. but better retain detail and subjective sharpness impression.
  9356. @end table
  9357. @end table
  9358. @section kerndeint
  9359. Deinterlace input video by applying Donald Graft's adaptive kernel
  9360. deinterling. Work on interlaced parts of a video to produce
  9361. progressive frames.
  9362. The description of the accepted parameters follows.
  9363. @table @option
  9364. @item thresh
  9365. Set the threshold which affects the filter's tolerance when
  9366. determining if a pixel line must be processed. It must be an integer
  9367. in the range [0,255] and defaults to 10. A value of 0 will result in
  9368. applying the process on every pixels.
  9369. @item map
  9370. Paint pixels exceeding the threshold value to white if set to 1.
  9371. Default is 0.
  9372. @item order
  9373. Set the fields order. Swap fields if set to 1, leave fields alone if
  9374. 0. Default is 0.
  9375. @item sharp
  9376. Enable additional sharpening if set to 1. Default is 0.
  9377. @item twoway
  9378. Enable twoway sharpening if set to 1. Default is 0.
  9379. @end table
  9380. @subsection Examples
  9381. @itemize
  9382. @item
  9383. Apply default values:
  9384. @example
  9385. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9386. @end example
  9387. @item
  9388. Enable additional sharpening:
  9389. @example
  9390. kerndeint=sharp=1
  9391. @end example
  9392. @item
  9393. Paint processed pixels in white:
  9394. @example
  9395. kerndeint=map=1
  9396. @end example
  9397. @end itemize
  9398. @section lagfun
  9399. Slowly update darker pixels.
  9400. This filter makes short flashes of light appear longer.
  9401. This filter accepts the following options:
  9402. @table @option
  9403. @item decay
  9404. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9405. @item planes
  9406. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9407. @end table
  9408. @section lenscorrection
  9409. Correct radial lens distortion
  9410. This filter can be used to correct for radial distortion as can result from the use
  9411. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9412. one can use tools available for example as part of opencv or simply trial-and-error.
  9413. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9414. and extract the k1 and k2 coefficients from the resulting matrix.
  9415. Note that effectively the same filter is available in the open-source tools Krita and
  9416. Digikam from the KDE project.
  9417. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9418. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9419. brightness distribution, so you may want to use both filters together in certain
  9420. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9421. be applied before or after lens correction.
  9422. @subsection Options
  9423. The filter accepts the following options:
  9424. @table @option
  9425. @item cx
  9426. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9427. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9428. width. Default is 0.5.
  9429. @item cy
  9430. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9431. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9432. height. Default is 0.5.
  9433. @item k1
  9434. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9435. no correction. Default is 0.
  9436. @item k2
  9437. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9438. 0 means no correction. Default is 0.
  9439. @end table
  9440. The formula that generates the correction is:
  9441. @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)
  9442. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9443. distances from the focal point in the source and target images, respectively.
  9444. @section lensfun
  9445. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9446. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9447. to apply the lens correction. The filter will load the lensfun database and
  9448. query it to find the corresponding camera and lens entries in the database. As
  9449. long as these entries can be found with the given options, the filter can
  9450. perform corrections on frames. Note that incomplete strings will result in the
  9451. filter choosing the best match with the given options, and the filter will
  9452. output the chosen camera and lens models (logged with level "info"). You must
  9453. provide the make, camera model, and lens model as they are required.
  9454. The filter accepts the following options:
  9455. @table @option
  9456. @item make
  9457. The make of the camera (for example, "Canon"). This option is required.
  9458. @item model
  9459. The model of the camera (for example, "Canon EOS 100D"). This option is
  9460. required.
  9461. @item lens_model
  9462. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9463. option is required.
  9464. @item mode
  9465. The type of correction to apply. The following values are valid options:
  9466. @table @samp
  9467. @item vignetting
  9468. Enables fixing lens vignetting.
  9469. @item geometry
  9470. Enables fixing lens geometry. This is the default.
  9471. @item subpixel
  9472. Enables fixing chromatic aberrations.
  9473. @item vig_geo
  9474. Enables fixing lens vignetting and lens geometry.
  9475. @item vig_subpixel
  9476. Enables fixing lens vignetting and chromatic aberrations.
  9477. @item distortion
  9478. Enables fixing both lens geometry and chromatic aberrations.
  9479. @item all
  9480. Enables all possible corrections.
  9481. @end table
  9482. @item focal_length
  9483. The focal length of the image/video (zoom; expected constant for video). For
  9484. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9485. range should be chosen when using that lens. Default 18.
  9486. @item aperture
  9487. The aperture of the image/video (expected constant for video). Note that
  9488. aperture is only used for vignetting correction. Default 3.5.
  9489. @item focus_distance
  9490. The focus distance of the image/video (expected constant for video). Note that
  9491. focus distance is only used for vignetting and only slightly affects the
  9492. vignetting correction process. If unknown, leave it at the default value (which
  9493. is 1000).
  9494. @item scale
  9495. The scale factor which is applied after transformation. After correction the
  9496. video is no longer necessarily rectangular. This parameter controls how much of
  9497. the resulting image is visible. The value 0 means that a value will be chosen
  9498. automatically such that there is little or no unmapped area in the output
  9499. image. 1.0 means that no additional scaling is done. Lower values may result
  9500. in more of the corrected image being visible, while higher values may avoid
  9501. unmapped areas in the output.
  9502. @item target_geometry
  9503. The target geometry of the output image/video. The following values are valid
  9504. options:
  9505. @table @samp
  9506. @item rectilinear (default)
  9507. @item fisheye
  9508. @item panoramic
  9509. @item equirectangular
  9510. @item fisheye_orthographic
  9511. @item fisheye_stereographic
  9512. @item fisheye_equisolid
  9513. @item fisheye_thoby
  9514. @end table
  9515. @item reverse
  9516. Apply the reverse of image correction (instead of correcting distortion, apply
  9517. it).
  9518. @item interpolation
  9519. The type of interpolation used when correcting distortion. The following values
  9520. are valid options:
  9521. @table @samp
  9522. @item nearest
  9523. @item linear (default)
  9524. @item lanczos
  9525. @end table
  9526. @end table
  9527. @subsection Examples
  9528. @itemize
  9529. @item
  9530. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9531. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9532. aperture of "8.0".
  9533. @example
  9534. 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
  9535. @end example
  9536. @item
  9537. Apply the same as before, but only for the first 5 seconds of video.
  9538. @example
  9539. 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
  9540. @end example
  9541. @end itemize
  9542. @section libvmaf
  9543. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9544. score between two input videos.
  9545. The obtained VMAF score is printed through the logging system.
  9546. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9547. After installing the library it can be enabled using:
  9548. @code{./configure --enable-libvmaf --enable-version3}.
  9549. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9550. The filter has following options:
  9551. @table @option
  9552. @item model_path
  9553. Set the model path which is to be used for SVM.
  9554. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  9555. @item log_path
  9556. Set the file path to be used to store logs.
  9557. @item log_fmt
  9558. Set the format of the log file (xml or json).
  9559. @item enable_transform
  9560. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9561. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9562. Default value: @code{false}
  9563. @item phone_model
  9564. Invokes the phone model which will generate VMAF scores higher than in the
  9565. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9566. Default value: @code{false}
  9567. @item psnr
  9568. Enables computing psnr along with vmaf.
  9569. Default value: @code{false}
  9570. @item ssim
  9571. Enables computing ssim along with vmaf.
  9572. Default value: @code{false}
  9573. @item ms_ssim
  9574. Enables computing ms_ssim along with vmaf.
  9575. Default value: @code{false}
  9576. @item pool
  9577. Set the pool method to be used for computing vmaf.
  9578. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  9579. @item n_threads
  9580. Set number of threads to be used when computing vmaf.
  9581. Default value: @code{0}, which makes use of all available logical processors.
  9582. @item n_subsample
  9583. Set interval for frame subsampling used when computing vmaf.
  9584. Default value: @code{1}
  9585. @item enable_conf_interval
  9586. Enables confidence interval.
  9587. Default value: @code{false}
  9588. @end table
  9589. This filter also supports the @ref{framesync} options.
  9590. @subsection Examples
  9591. @itemize
  9592. @item
  9593. On the below examples the input file @file{main.mpg} being processed is
  9594. compared with the reference file @file{ref.mpg}.
  9595. @example
  9596. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9597. @end example
  9598. @item
  9599. Example with options:
  9600. @example
  9601. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9602. @end example
  9603. @item
  9604. Example with options and different containers:
  9605. @example
  9606. 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 -
  9607. @end example
  9608. @end itemize
  9609. @section limiter
  9610. Limits the pixel components values to the specified range [min, max].
  9611. The filter accepts the following options:
  9612. @table @option
  9613. @item min
  9614. Lower bound. Defaults to the lowest allowed value for the input.
  9615. @item max
  9616. Upper bound. Defaults to the highest allowed value for the input.
  9617. @item planes
  9618. Specify which planes will be processed. Defaults to all available.
  9619. @end table
  9620. @section loop
  9621. Loop video frames.
  9622. The filter accepts the following options:
  9623. @table @option
  9624. @item loop
  9625. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9626. Default is 0.
  9627. @item size
  9628. Set maximal size in number of frames. Default is 0.
  9629. @item start
  9630. Set first frame of loop. Default is 0.
  9631. @end table
  9632. @subsection Examples
  9633. @itemize
  9634. @item
  9635. Loop single first frame infinitely:
  9636. @example
  9637. loop=loop=-1:size=1:start=0
  9638. @end example
  9639. @item
  9640. Loop single first frame 10 times:
  9641. @example
  9642. loop=loop=10:size=1:start=0
  9643. @end example
  9644. @item
  9645. Loop 10 first frames 5 times:
  9646. @example
  9647. loop=loop=5:size=10:start=0
  9648. @end example
  9649. @end itemize
  9650. @section lut1d
  9651. Apply a 1D LUT to an input video.
  9652. The filter accepts the following options:
  9653. @table @option
  9654. @item file
  9655. Set the 1D LUT file name.
  9656. Currently supported formats:
  9657. @table @samp
  9658. @item cube
  9659. Iridas
  9660. @item csp
  9661. cineSpace
  9662. @end table
  9663. @item interp
  9664. Select interpolation mode.
  9665. Available values are:
  9666. @table @samp
  9667. @item nearest
  9668. Use values from the nearest defined point.
  9669. @item linear
  9670. Interpolate values using the linear interpolation.
  9671. @item cosine
  9672. Interpolate values using the cosine interpolation.
  9673. @item cubic
  9674. Interpolate values using the cubic interpolation.
  9675. @item spline
  9676. Interpolate values using the spline interpolation.
  9677. @end table
  9678. @end table
  9679. @anchor{lut3d}
  9680. @section lut3d
  9681. Apply a 3D LUT to an input video.
  9682. The filter accepts the following options:
  9683. @table @option
  9684. @item file
  9685. Set the 3D LUT file name.
  9686. Currently supported formats:
  9687. @table @samp
  9688. @item 3dl
  9689. AfterEffects
  9690. @item cube
  9691. Iridas
  9692. @item dat
  9693. DaVinci
  9694. @item m3d
  9695. Pandora
  9696. @item csp
  9697. cineSpace
  9698. @end table
  9699. @item interp
  9700. Select interpolation mode.
  9701. Available values are:
  9702. @table @samp
  9703. @item nearest
  9704. Use values from the nearest defined point.
  9705. @item trilinear
  9706. Interpolate values using the 8 points defining a cube.
  9707. @item tetrahedral
  9708. Interpolate values using a tetrahedron.
  9709. @end table
  9710. @end table
  9711. @section lumakey
  9712. Turn certain luma values into transparency.
  9713. The filter accepts the following options:
  9714. @table @option
  9715. @item threshold
  9716. Set the luma which will be used as base for transparency.
  9717. Default value is @code{0}.
  9718. @item tolerance
  9719. Set the range of luma values to be keyed out.
  9720. Default value is @code{0.01}.
  9721. @item softness
  9722. Set the range of softness. Default value is @code{0}.
  9723. Use this to control gradual transition from zero to full transparency.
  9724. @end table
  9725. @subsection Commands
  9726. This filter supports same @ref{commands} as options.
  9727. The command accepts the same syntax of the corresponding option.
  9728. If the specified expression is not valid, it is kept at its current
  9729. value.
  9730. @section lut, lutrgb, lutyuv
  9731. Compute a look-up table for binding each pixel component input value
  9732. to an output value, and apply it to the input video.
  9733. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9734. to an RGB input video.
  9735. These filters accept the following parameters:
  9736. @table @option
  9737. @item c0
  9738. set first pixel component expression
  9739. @item c1
  9740. set second pixel component expression
  9741. @item c2
  9742. set third pixel component expression
  9743. @item c3
  9744. set fourth pixel component expression, corresponds to the alpha component
  9745. @item r
  9746. set red component expression
  9747. @item g
  9748. set green component expression
  9749. @item b
  9750. set blue component expression
  9751. @item a
  9752. alpha component expression
  9753. @item y
  9754. set Y/luminance component expression
  9755. @item u
  9756. set U/Cb component expression
  9757. @item v
  9758. set V/Cr component expression
  9759. @end table
  9760. Each of them specifies the expression to use for computing the lookup table for
  9761. the corresponding pixel component values.
  9762. The exact component associated to each of the @var{c*} options depends on the
  9763. format in input.
  9764. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9765. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9766. The expressions can contain the following constants and functions:
  9767. @table @option
  9768. @item w
  9769. @item h
  9770. The input width and height.
  9771. @item val
  9772. The input value for the pixel component.
  9773. @item clipval
  9774. The input value, clipped to the @var{minval}-@var{maxval} range.
  9775. @item maxval
  9776. The maximum value for the pixel component.
  9777. @item minval
  9778. The minimum value for the pixel component.
  9779. @item negval
  9780. The negated value for the pixel component value, clipped to the
  9781. @var{minval}-@var{maxval} range; it corresponds to the expression
  9782. "maxval-clipval+minval".
  9783. @item clip(val)
  9784. The computed value in @var{val}, clipped to the
  9785. @var{minval}-@var{maxval} range.
  9786. @item gammaval(gamma)
  9787. The computed gamma correction value of the pixel component value,
  9788. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9789. expression
  9790. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9791. @end table
  9792. All expressions default to "val".
  9793. @subsection Examples
  9794. @itemize
  9795. @item
  9796. Negate input video:
  9797. @example
  9798. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9799. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9800. @end example
  9801. The above is the same as:
  9802. @example
  9803. lutrgb="r=negval:g=negval:b=negval"
  9804. lutyuv="y=negval:u=negval:v=negval"
  9805. @end example
  9806. @item
  9807. Negate luminance:
  9808. @example
  9809. lutyuv=y=negval
  9810. @end example
  9811. @item
  9812. Remove chroma components, turning the video into a graytone image:
  9813. @example
  9814. lutyuv="u=128:v=128"
  9815. @end example
  9816. @item
  9817. Apply a luma burning effect:
  9818. @example
  9819. lutyuv="y=2*val"
  9820. @end example
  9821. @item
  9822. Remove green and blue components:
  9823. @example
  9824. lutrgb="g=0:b=0"
  9825. @end example
  9826. @item
  9827. Set a constant alpha channel value on input:
  9828. @example
  9829. format=rgba,lutrgb=a="maxval-minval/2"
  9830. @end example
  9831. @item
  9832. Correct luminance gamma by a factor of 0.5:
  9833. @example
  9834. lutyuv=y=gammaval(0.5)
  9835. @end example
  9836. @item
  9837. Discard least significant bits of luma:
  9838. @example
  9839. lutyuv=y='bitand(val, 128+64+32)'
  9840. @end example
  9841. @item
  9842. Technicolor like effect:
  9843. @example
  9844. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9845. @end example
  9846. @end itemize
  9847. @section lut2, tlut2
  9848. The @code{lut2} filter takes two input streams and outputs one
  9849. stream.
  9850. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9851. from one single stream.
  9852. This filter accepts the following parameters:
  9853. @table @option
  9854. @item c0
  9855. set first pixel component expression
  9856. @item c1
  9857. set second pixel component expression
  9858. @item c2
  9859. set third pixel component expression
  9860. @item c3
  9861. set fourth pixel component expression, corresponds to the alpha component
  9862. @item d
  9863. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9864. which means bit depth is automatically picked from first input format.
  9865. @end table
  9866. Each of them specifies the expression to use for computing the lookup table for
  9867. the corresponding pixel component values.
  9868. The exact component associated to each of the @var{c*} options depends on the
  9869. format in inputs.
  9870. The expressions can contain the following constants:
  9871. @table @option
  9872. @item w
  9873. @item h
  9874. The input width and height.
  9875. @item x
  9876. The first input value for the pixel component.
  9877. @item y
  9878. The second input value for the pixel component.
  9879. @item bdx
  9880. The first input video bit depth.
  9881. @item bdy
  9882. The second input video bit depth.
  9883. @end table
  9884. All expressions default to "x".
  9885. @subsection Examples
  9886. @itemize
  9887. @item
  9888. Highlight differences between two RGB video streams:
  9889. @example
  9890. 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)'
  9891. @end example
  9892. @item
  9893. Highlight differences between two YUV video streams:
  9894. @example
  9895. 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)'
  9896. @end example
  9897. @item
  9898. Show max difference between two video streams:
  9899. @example
  9900. 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)))'
  9901. @end example
  9902. @end itemize
  9903. @section maskedclamp
  9904. Clamp the first input stream with the second input and third input stream.
  9905. Returns the value of first stream to be between second input
  9906. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9907. This filter accepts the following options:
  9908. @table @option
  9909. @item undershoot
  9910. Default value is @code{0}.
  9911. @item overshoot
  9912. Default value is @code{0}.
  9913. @item planes
  9914. Set which planes will be processed as bitmap, unprocessed planes will be
  9915. copied from first stream.
  9916. By default value 0xf, all planes will be processed.
  9917. @end table
  9918. @section maskedmax
  9919. Merge the second and third input stream into output stream using absolute differences
  9920. between second input stream and first input stream and absolute difference between
  9921. third input stream and first input stream. The picked value will be from second input
  9922. stream if second absolute difference is greater than first one or from third input stream
  9923. otherwise.
  9924. This filter accepts the following options:
  9925. @table @option
  9926. @item planes
  9927. Set which planes will be processed as bitmap, unprocessed planes will be
  9928. copied from first stream.
  9929. By default value 0xf, all planes will be processed.
  9930. @end table
  9931. @section maskedmerge
  9932. Merge the first input stream with the second input stream using per pixel
  9933. weights in the third input stream.
  9934. A value of 0 in the third stream pixel component means that pixel component
  9935. from first stream is returned unchanged, while maximum value (eg. 255 for
  9936. 8-bit videos) means that pixel component from second stream is returned
  9937. unchanged. Intermediate values define the amount of merging between both
  9938. input stream's pixel components.
  9939. This filter accepts the following options:
  9940. @table @option
  9941. @item planes
  9942. Set which planes will be processed as bitmap, unprocessed planes will be
  9943. copied from first stream.
  9944. By default value 0xf, all planes will be processed.
  9945. @end table
  9946. @section maskedmin
  9947. Merge the second and third input stream into output stream using absolute differences
  9948. between second input stream and first input stream and absolute difference between
  9949. third input stream and first input stream. The picked value will be from second input
  9950. stream if second absolute difference is less than first one or from third input stream
  9951. otherwise.
  9952. This filter accepts the following options:
  9953. @table @option
  9954. @item planes
  9955. Set which planes will be processed as bitmap, unprocessed planes will be
  9956. copied from first stream.
  9957. By default value 0xf, all planes will be processed.
  9958. @end table
  9959. @section maskfun
  9960. Create mask from input video.
  9961. For example it is useful to create motion masks after @code{tblend} filter.
  9962. This filter accepts the following options:
  9963. @table @option
  9964. @item low
  9965. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9966. @item high
  9967. Set high threshold. Any pixel component higher than this value will be set to max value
  9968. allowed for current pixel format.
  9969. @item planes
  9970. Set planes to filter, by default all available planes are filtered.
  9971. @item fill
  9972. Fill all frame pixels with this value.
  9973. @item sum
  9974. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9975. average, output frame will be completely filled with value set by @var{fill} option.
  9976. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9977. @end table
  9978. @section mcdeint
  9979. Apply motion-compensation deinterlacing.
  9980. It needs one field per frame as input and must thus be used together
  9981. with yadif=1/3 or equivalent.
  9982. This filter accepts the following options:
  9983. @table @option
  9984. @item mode
  9985. Set the deinterlacing mode.
  9986. It accepts one of the following values:
  9987. @table @samp
  9988. @item fast
  9989. @item medium
  9990. @item slow
  9991. use iterative motion estimation
  9992. @item extra_slow
  9993. like @samp{slow}, but use multiple reference frames.
  9994. @end table
  9995. Default value is @samp{fast}.
  9996. @item parity
  9997. Set the picture field parity assumed for the input video. It must be
  9998. one of the following values:
  9999. @table @samp
  10000. @item 0, tff
  10001. assume top field first
  10002. @item 1, bff
  10003. assume bottom field first
  10004. @end table
  10005. Default value is @samp{bff}.
  10006. @item qp
  10007. Set per-block quantization parameter (QP) used by the internal
  10008. encoder.
  10009. Higher values should result in a smoother motion vector field but less
  10010. optimal individual vectors. Default value is 1.
  10011. @end table
  10012. @section median
  10013. Pick median pixel from certain rectangle defined by radius.
  10014. This filter accepts the following options:
  10015. @table @option
  10016. @item radius
  10017. Set horizontal radius size. Default value is @code{1}.
  10018. Allowed range is integer from 1 to 127.
  10019. @item planes
  10020. Set which planes to process. Default is @code{15}, which is all available planes.
  10021. @item radiusV
  10022. Set vertical radius size. Default value is @code{0}.
  10023. Allowed range is integer from 0 to 127.
  10024. If it is 0, value will be picked from horizontal @code{radius} option.
  10025. @end table
  10026. @subsection Commands
  10027. This filter supports same @ref{commands} as options.
  10028. The command accepts the same syntax of the corresponding option.
  10029. If the specified expression is not valid, it is kept at its current
  10030. value.
  10031. @section mergeplanes
  10032. Merge color channel components from several video streams.
  10033. The filter accepts up to 4 input streams, and merge selected input
  10034. planes to the output video.
  10035. This filter accepts the following options:
  10036. @table @option
  10037. @item mapping
  10038. Set input to output plane mapping. Default is @code{0}.
  10039. The mappings is specified as a bitmap. It should be specified as a
  10040. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10041. mapping for the first plane of the output stream. 'A' sets the number of
  10042. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10043. corresponding input to use (from 0 to 3). The rest of the mappings is
  10044. similar, 'Bb' describes the mapping for the output stream second
  10045. plane, 'Cc' describes the mapping for the output stream third plane and
  10046. 'Dd' describes the mapping for the output stream fourth plane.
  10047. @item format
  10048. Set output pixel format. Default is @code{yuva444p}.
  10049. @end table
  10050. @subsection Examples
  10051. @itemize
  10052. @item
  10053. Merge three gray video streams of same width and height into single video stream:
  10054. @example
  10055. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10056. @end example
  10057. @item
  10058. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10059. @example
  10060. [a0][a1]mergeplanes=0x00010210:yuva444p
  10061. @end example
  10062. @item
  10063. Swap Y and A plane in yuva444p stream:
  10064. @example
  10065. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10066. @end example
  10067. @item
  10068. Swap U and V plane in yuv420p stream:
  10069. @example
  10070. format=yuv420p,mergeplanes=0x000201:yuv420p
  10071. @end example
  10072. @item
  10073. Cast a rgb24 clip to yuv444p:
  10074. @example
  10075. format=rgb24,mergeplanes=0x000102:yuv444p
  10076. @end example
  10077. @end itemize
  10078. @section mestimate
  10079. Estimate and export motion vectors using block matching algorithms.
  10080. Motion vectors are stored in frame side data to be used by other filters.
  10081. This filter accepts the following options:
  10082. @table @option
  10083. @item method
  10084. Specify the motion estimation method. Accepts one of the following values:
  10085. @table @samp
  10086. @item esa
  10087. Exhaustive search algorithm.
  10088. @item tss
  10089. Three step search algorithm.
  10090. @item tdls
  10091. Two dimensional logarithmic search algorithm.
  10092. @item ntss
  10093. New three step search algorithm.
  10094. @item fss
  10095. Four step search algorithm.
  10096. @item ds
  10097. Diamond search algorithm.
  10098. @item hexbs
  10099. Hexagon-based search algorithm.
  10100. @item epzs
  10101. Enhanced predictive zonal search algorithm.
  10102. @item umh
  10103. Uneven multi-hexagon search algorithm.
  10104. @end table
  10105. Default value is @samp{esa}.
  10106. @item mb_size
  10107. Macroblock size. Default @code{16}.
  10108. @item search_param
  10109. Search parameter. Default @code{7}.
  10110. @end table
  10111. @section midequalizer
  10112. Apply Midway Image Equalization effect using two video streams.
  10113. Midway Image Equalization adjusts a pair of images to have the same
  10114. histogram, while maintaining their dynamics as much as possible. It's
  10115. useful for e.g. matching exposures from a pair of stereo cameras.
  10116. This filter has two inputs and one output, which must be of same pixel format, but
  10117. may be of different sizes. The output of filter is first input adjusted with
  10118. midway histogram of both inputs.
  10119. This filter accepts the following option:
  10120. @table @option
  10121. @item planes
  10122. Set which planes to process. Default is @code{15}, which is all available planes.
  10123. @end table
  10124. @section minterpolate
  10125. Convert the video to specified frame rate using motion interpolation.
  10126. This filter accepts the following options:
  10127. @table @option
  10128. @item fps
  10129. 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}.
  10130. @item mi_mode
  10131. Motion interpolation mode. Following values are accepted:
  10132. @table @samp
  10133. @item dup
  10134. Duplicate previous or next frame for interpolating new ones.
  10135. @item blend
  10136. Blend source frames. Interpolated frame is mean of previous and next frames.
  10137. @item mci
  10138. Motion compensated interpolation. Following options are effective when this mode is selected:
  10139. @table @samp
  10140. @item mc_mode
  10141. Motion compensation mode. Following values are accepted:
  10142. @table @samp
  10143. @item obmc
  10144. Overlapped block motion compensation.
  10145. @item aobmc
  10146. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10147. @end table
  10148. Default mode is @samp{obmc}.
  10149. @item me_mode
  10150. Motion estimation mode. Following values are accepted:
  10151. @table @samp
  10152. @item bidir
  10153. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10154. @item bilat
  10155. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10156. @end table
  10157. Default mode is @samp{bilat}.
  10158. @item me
  10159. The algorithm to be used for motion estimation. Following values are accepted:
  10160. @table @samp
  10161. @item esa
  10162. Exhaustive search algorithm.
  10163. @item tss
  10164. Three step search algorithm.
  10165. @item tdls
  10166. Two dimensional logarithmic search algorithm.
  10167. @item ntss
  10168. New three step search algorithm.
  10169. @item fss
  10170. Four step search algorithm.
  10171. @item ds
  10172. Diamond search algorithm.
  10173. @item hexbs
  10174. Hexagon-based search algorithm.
  10175. @item epzs
  10176. Enhanced predictive zonal search algorithm.
  10177. @item umh
  10178. Uneven multi-hexagon search algorithm.
  10179. @end table
  10180. Default algorithm is @samp{epzs}.
  10181. @item mb_size
  10182. Macroblock size. Default @code{16}.
  10183. @item search_param
  10184. Motion estimation search parameter. Default @code{32}.
  10185. @item vsbmc
  10186. 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).
  10187. @end table
  10188. @end table
  10189. @item scd
  10190. 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:
  10191. @table @samp
  10192. @item none
  10193. Disable scene change detection.
  10194. @item fdiff
  10195. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10196. @end table
  10197. Default method is @samp{fdiff}.
  10198. @item scd_threshold
  10199. Scene change detection threshold. Default is @code{5.0}.
  10200. @end table
  10201. @section mix
  10202. Mix several video input streams into one video stream.
  10203. A description of the accepted options follows.
  10204. @table @option
  10205. @item nb_inputs
  10206. The number of inputs. If unspecified, it defaults to 2.
  10207. @item weights
  10208. Specify weight of each input video stream as sequence.
  10209. Each weight is separated by space. If number of weights
  10210. is smaller than number of @var{frames} last specified
  10211. weight will be used for all remaining unset weights.
  10212. @item scale
  10213. Specify scale, if it is set it will be multiplied with sum
  10214. of each weight multiplied with pixel values to give final destination
  10215. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10216. @item duration
  10217. Specify how end of stream is determined.
  10218. @table @samp
  10219. @item longest
  10220. The duration of the longest input. (default)
  10221. @item shortest
  10222. The duration of the shortest input.
  10223. @item first
  10224. The duration of the first input.
  10225. @end table
  10226. @end table
  10227. @section mpdecimate
  10228. Drop frames that do not differ greatly from the previous frame in
  10229. order to reduce frame rate.
  10230. The main use of this filter is for very-low-bitrate encoding
  10231. (e.g. streaming over dialup modem), but it could in theory be used for
  10232. fixing movies that were inverse-telecined incorrectly.
  10233. A description of the accepted options follows.
  10234. @table @option
  10235. @item max
  10236. Set the maximum number of consecutive frames which can be dropped (if
  10237. positive), or the minimum interval between dropped frames (if
  10238. negative). If the value is 0, the frame is dropped disregarding the
  10239. number of previous sequentially dropped frames.
  10240. Default value is 0.
  10241. @item hi
  10242. @item lo
  10243. @item frac
  10244. Set the dropping threshold values.
  10245. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10246. represent actual pixel value differences, so a threshold of 64
  10247. corresponds to 1 unit of difference for each pixel, or the same spread
  10248. out differently over the block.
  10249. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10250. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10251. meaning the whole image) differ by more than a threshold of @option{lo}.
  10252. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10253. 64*5, and default value for @option{frac} is 0.33.
  10254. @end table
  10255. @section negate
  10256. Negate (invert) the input video.
  10257. It accepts the following option:
  10258. @table @option
  10259. @item negate_alpha
  10260. With value 1, it negates the alpha component, if present. Default value is 0.
  10261. @end table
  10262. @anchor{nlmeans}
  10263. @section nlmeans
  10264. Denoise frames using Non-Local Means algorithm.
  10265. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10266. context similarity is defined by comparing their surrounding patches of size
  10267. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10268. around the pixel.
  10269. Note that the research area defines centers for patches, which means some
  10270. patches will be made of pixels outside that research area.
  10271. The filter accepts the following options.
  10272. @table @option
  10273. @item s
  10274. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10275. @item p
  10276. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10277. @item pc
  10278. Same as @option{p} but for chroma planes.
  10279. The default value is @var{0} and means automatic.
  10280. @item r
  10281. Set research size. Default is 15. Must be odd number in range [0, 99].
  10282. @item rc
  10283. Same as @option{r} but for chroma planes.
  10284. The default value is @var{0} and means automatic.
  10285. @end table
  10286. @section nnedi
  10287. Deinterlace video using neural network edge directed interpolation.
  10288. This filter accepts the following options:
  10289. @table @option
  10290. @item weights
  10291. Mandatory option, without binary file filter can not work.
  10292. Currently file can be found here:
  10293. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10294. @item deint
  10295. Set which frames to deinterlace, by default it is @code{all}.
  10296. Can be @code{all} or @code{interlaced}.
  10297. @item field
  10298. Set mode of operation.
  10299. Can be one of the following:
  10300. @table @samp
  10301. @item af
  10302. Use frame flags, both fields.
  10303. @item a
  10304. Use frame flags, single field.
  10305. @item t
  10306. Use top field only.
  10307. @item b
  10308. Use bottom field only.
  10309. @item tf
  10310. Use both fields, top first.
  10311. @item bf
  10312. Use both fields, bottom first.
  10313. @end table
  10314. @item planes
  10315. Set which planes to process, by default filter process all frames.
  10316. @item nsize
  10317. Set size of local neighborhood around each pixel, used by the predictor neural
  10318. network.
  10319. Can be one of the following:
  10320. @table @samp
  10321. @item s8x6
  10322. @item s16x6
  10323. @item s32x6
  10324. @item s48x6
  10325. @item s8x4
  10326. @item s16x4
  10327. @item s32x4
  10328. @end table
  10329. @item nns
  10330. Set the number of neurons in predictor neural network.
  10331. Can be one of the following:
  10332. @table @samp
  10333. @item n16
  10334. @item n32
  10335. @item n64
  10336. @item n128
  10337. @item n256
  10338. @end table
  10339. @item qual
  10340. Controls the number of different neural network predictions that are blended
  10341. together to compute the final output value. Can be @code{fast}, default or
  10342. @code{slow}.
  10343. @item etype
  10344. Set which set of weights to use in the predictor.
  10345. Can be one of the following:
  10346. @table @samp
  10347. @item a
  10348. weights trained to minimize absolute error
  10349. @item s
  10350. weights trained to minimize squared error
  10351. @end table
  10352. @item pscrn
  10353. Controls whether or not the prescreener neural network is used to decide
  10354. which pixels should be processed by the predictor neural network and which
  10355. can be handled by simple cubic interpolation.
  10356. The prescreener is trained to know whether cubic interpolation will be
  10357. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10358. The computational complexity of the prescreener nn is much less than that of
  10359. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10360. using the prescreener generally results in much faster processing.
  10361. The prescreener is pretty accurate, so the difference between using it and not
  10362. using it is almost always unnoticeable.
  10363. Can be one of the following:
  10364. @table @samp
  10365. @item none
  10366. @item original
  10367. @item new
  10368. @end table
  10369. Default is @code{new}.
  10370. @item fapprox
  10371. Set various debugging flags.
  10372. @end table
  10373. @section noformat
  10374. Force libavfilter not to use any of the specified pixel formats for the
  10375. input to the next filter.
  10376. It accepts the following parameters:
  10377. @table @option
  10378. @item pix_fmts
  10379. A '|'-separated list of pixel format names, such as
  10380. pix_fmts=yuv420p|monow|rgb24".
  10381. @end table
  10382. @subsection Examples
  10383. @itemize
  10384. @item
  10385. Force libavfilter to use a format different from @var{yuv420p} for the
  10386. input to the vflip filter:
  10387. @example
  10388. noformat=pix_fmts=yuv420p,vflip
  10389. @end example
  10390. @item
  10391. Convert the input video to any of the formats not contained in the list:
  10392. @example
  10393. noformat=yuv420p|yuv444p|yuv410p
  10394. @end example
  10395. @end itemize
  10396. @section noise
  10397. Add noise on video input frame.
  10398. The filter accepts the following options:
  10399. @table @option
  10400. @item all_seed
  10401. @item c0_seed
  10402. @item c1_seed
  10403. @item c2_seed
  10404. @item c3_seed
  10405. Set noise seed for specific pixel component or all pixel components in case
  10406. of @var{all_seed}. Default value is @code{123457}.
  10407. @item all_strength, alls
  10408. @item c0_strength, c0s
  10409. @item c1_strength, c1s
  10410. @item c2_strength, c2s
  10411. @item c3_strength, c3s
  10412. Set noise strength for specific pixel component or all pixel components in case
  10413. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10414. @item all_flags, allf
  10415. @item c0_flags, c0f
  10416. @item c1_flags, c1f
  10417. @item c2_flags, c2f
  10418. @item c3_flags, c3f
  10419. Set pixel component flags or set flags for all components if @var{all_flags}.
  10420. Available values for component flags are:
  10421. @table @samp
  10422. @item a
  10423. averaged temporal noise (smoother)
  10424. @item p
  10425. mix random noise with a (semi)regular pattern
  10426. @item t
  10427. temporal noise (noise pattern changes between frames)
  10428. @item u
  10429. uniform noise (gaussian otherwise)
  10430. @end table
  10431. @end table
  10432. @subsection Examples
  10433. Add temporal and uniform noise to input video:
  10434. @example
  10435. noise=alls=20:allf=t+u
  10436. @end example
  10437. @section normalize
  10438. Normalize RGB video (aka histogram stretching, contrast stretching).
  10439. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10440. For each channel of each frame, the filter computes the input range and maps
  10441. it linearly to the user-specified output range. The output range defaults
  10442. to the full dynamic range from pure black to pure white.
  10443. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10444. changes in brightness) caused when small dark or bright objects enter or leave
  10445. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10446. video camera, and, like a video camera, it may cause a period of over- or
  10447. under-exposure of the video.
  10448. The R,G,B channels can be normalized independently, which may cause some
  10449. color shifting, or linked together as a single channel, which prevents
  10450. color shifting. Linked normalization preserves hue. Independent normalization
  10451. does not, so it can be used to remove some color casts. Independent and linked
  10452. normalization can be combined in any ratio.
  10453. The normalize filter accepts the following options:
  10454. @table @option
  10455. @item blackpt
  10456. @item whitept
  10457. Colors which define the output range. The minimum input value is mapped to
  10458. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10459. The defaults are black and white respectively. Specifying white for
  10460. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10461. normalized video. Shades of grey can be used to reduce the dynamic range
  10462. (contrast). Specifying saturated colors here can create some interesting
  10463. effects.
  10464. @item smoothing
  10465. The number of previous frames to use for temporal smoothing. The input range
  10466. of each channel is smoothed using a rolling average over the current frame
  10467. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10468. smoothing).
  10469. @item independence
  10470. Controls the ratio of independent (color shifting) channel normalization to
  10471. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10472. independent. Defaults to 1.0 (fully independent).
  10473. @item strength
  10474. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10475. expensive no-op. Defaults to 1.0 (full strength).
  10476. @end table
  10477. @subsection Commands
  10478. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  10479. The command accepts the same syntax of the corresponding option.
  10480. If the specified expression is not valid, it is kept at its current
  10481. value.
  10482. @subsection Examples
  10483. Stretch video contrast to use the full dynamic range, with no temporal
  10484. smoothing; may flicker depending on the source content:
  10485. @example
  10486. normalize=blackpt=black:whitept=white:smoothing=0
  10487. @end example
  10488. As above, but with 50 frames of temporal smoothing; flicker should be
  10489. reduced, depending on the source content:
  10490. @example
  10491. normalize=blackpt=black:whitept=white:smoothing=50
  10492. @end example
  10493. As above, but with hue-preserving linked channel normalization:
  10494. @example
  10495. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10496. @end example
  10497. As above, but with half strength:
  10498. @example
  10499. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10500. @end example
  10501. Map the darkest input color to red, the brightest input color to cyan:
  10502. @example
  10503. normalize=blackpt=red:whitept=cyan
  10504. @end example
  10505. @section null
  10506. Pass the video source unchanged to the output.
  10507. @section ocr
  10508. Optical Character Recognition
  10509. This filter uses Tesseract for optical character recognition. To enable
  10510. compilation of this filter, you need to configure FFmpeg with
  10511. @code{--enable-libtesseract}.
  10512. It accepts the following options:
  10513. @table @option
  10514. @item datapath
  10515. Set datapath to tesseract data. Default is to use whatever was
  10516. set at installation.
  10517. @item language
  10518. Set language, default is "eng".
  10519. @item whitelist
  10520. Set character whitelist.
  10521. @item blacklist
  10522. Set character blacklist.
  10523. @end table
  10524. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10525. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10526. @section ocv
  10527. Apply a video transform using libopencv.
  10528. To enable this filter, install the libopencv library and headers and
  10529. configure FFmpeg with @code{--enable-libopencv}.
  10530. It accepts the following parameters:
  10531. @table @option
  10532. @item filter_name
  10533. The name of the libopencv filter to apply.
  10534. @item filter_params
  10535. The parameters to pass to the libopencv filter. If not specified, the default
  10536. values are assumed.
  10537. @end table
  10538. Refer to the official libopencv documentation for more precise
  10539. information:
  10540. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10541. Several libopencv filters are supported; see the following subsections.
  10542. @anchor{dilate}
  10543. @subsection dilate
  10544. Dilate an image by using a specific structuring element.
  10545. It corresponds to the libopencv function @code{cvDilate}.
  10546. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10547. @var{struct_el} represents a structuring element, and has the syntax:
  10548. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10549. @var{cols} and @var{rows} represent the number of columns and rows of
  10550. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10551. point, and @var{shape} the shape for the structuring element. @var{shape}
  10552. must be "rect", "cross", "ellipse", or "custom".
  10553. If the value for @var{shape} is "custom", it must be followed by a
  10554. string of the form "=@var{filename}". The file with name
  10555. @var{filename} is assumed to represent a binary image, with each
  10556. printable character corresponding to a bright pixel. When a custom
  10557. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10558. or columns and rows of the read file are assumed instead.
  10559. The default value for @var{struct_el} is "3x3+0x0/rect".
  10560. @var{nb_iterations} specifies the number of times the transform is
  10561. applied to the image, and defaults to 1.
  10562. Some examples:
  10563. @example
  10564. # Use the default values
  10565. ocv=dilate
  10566. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10567. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10568. # Read the shape from the file diamond.shape, iterating two times.
  10569. # The file diamond.shape may contain a pattern of characters like this
  10570. # *
  10571. # ***
  10572. # *****
  10573. # ***
  10574. # *
  10575. # The specified columns and rows are ignored
  10576. # but the anchor point coordinates are not
  10577. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10578. @end example
  10579. @subsection erode
  10580. Erode an image by using a specific structuring element.
  10581. It corresponds to the libopencv function @code{cvErode}.
  10582. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10583. with the same syntax and semantics as the @ref{dilate} filter.
  10584. @subsection smooth
  10585. Smooth the input video.
  10586. The filter takes the following parameters:
  10587. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10588. @var{type} is the type of smooth filter to apply, and must be one of
  10589. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10590. or "bilateral". The default value is "gaussian".
  10591. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10592. depends on the smooth type. @var{param1} and
  10593. @var{param2} accept integer positive values or 0. @var{param3} and
  10594. @var{param4} accept floating point values.
  10595. The default value for @var{param1} is 3. The default value for the
  10596. other parameters is 0.
  10597. These parameters correspond to the parameters assigned to the
  10598. libopencv function @code{cvSmooth}.
  10599. @section oscilloscope
  10600. 2D Video Oscilloscope.
  10601. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10602. It accepts the following parameters:
  10603. @table @option
  10604. @item x
  10605. Set scope center x position.
  10606. @item y
  10607. Set scope center y position.
  10608. @item s
  10609. Set scope size, relative to frame diagonal.
  10610. @item t
  10611. Set scope tilt/rotation.
  10612. @item o
  10613. Set trace opacity.
  10614. @item tx
  10615. Set trace center x position.
  10616. @item ty
  10617. Set trace center y position.
  10618. @item tw
  10619. Set trace width, relative to width of frame.
  10620. @item th
  10621. Set trace height, relative to height of frame.
  10622. @item c
  10623. Set which components to trace. By default it traces first three components.
  10624. @item g
  10625. Draw trace grid. By default is enabled.
  10626. @item st
  10627. Draw some statistics. By default is enabled.
  10628. @item sc
  10629. Draw scope. By default is enabled.
  10630. @end table
  10631. @subsection Commands
  10632. This filter supports same @ref{commands} as options.
  10633. The command accepts the same syntax of the corresponding option.
  10634. If the specified expression is not valid, it is kept at its current
  10635. value.
  10636. @subsection Examples
  10637. @itemize
  10638. @item
  10639. Inspect full first row of video frame.
  10640. @example
  10641. oscilloscope=x=0.5:y=0:s=1
  10642. @end example
  10643. @item
  10644. Inspect full last row of video frame.
  10645. @example
  10646. oscilloscope=x=0.5:y=1:s=1
  10647. @end example
  10648. @item
  10649. Inspect full 5th line of video frame of height 1080.
  10650. @example
  10651. oscilloscope=x=0.5:y=5/1080:s=1
  10652. @end example
  10653. @item
  10654. Inspect full last column of video frame.
  10655. @example
  10656. oscilloscope=x=1:y=0.5:s=1:t=1
  10657. @end example
  10658. @end itemize
  10659. @anchor{overlay}
  10660. @section overlay
  10661. Overlay one video on top of another.
  10662. It takes two inputs and has one output. The first input is the "main"
  10663. video on which the second input is overlaid.
  10664. It accepts the following parameters:
  10665. A description of the accepted options follows.
  10666. @table @option
  10667. @item x
  10668. @item y
  10669. Set the expression for the x and y coordinates of the overlaid video
  10670. on the main video. Default value is "0" for both expressions. In case
  10671. the expression is invalid, it is set to a huge value (meaning that the
  10672. overlay will not be displayed within the output visible area).
  10673. @item eof_action
  10674. See @ref{framesync}.
  10675. @item eval
  10676. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10677. It accepts the following values:
  10678. @table @samp
  10679. @item init
  10680. only evaluate expressions once during the filter initialization or
  10681. when a command is processed
  10682. @item frame
  10683. evaluate expressions for each incoming frame
  10684. @end table
  10685. Default value is @samp{frame}.
  10686. @item shortest
  10687. See @ref{framesync}.
  10688. @item format
  10689. Set the format for the output video.
  10690. It accepts the following values:
  10691. @table @samp
  10692. @item yuv420
  10693. force YUV420 output
  10694. @item yuv422
  10695. force YUV422 output
  10696. @item yuv444
  10697. force YUV444 output
  10698. @item rgb
  10699. force packed RGB output
  10700. @item gbrp
  10701. force planar RGB output
  10702. @item auto
  10703. automatically pick format
  10704. @end table
  10705. Default value is @samp{yuv420}.
  10706. @item repeatlast
  10707. See @ref{framesync}.
  10708. @item alpha
  10709. Set format of alpha of the overlaid video, it can be @var{straight} or
  10710. @var{premultiplied}. Default is @var{straight}.
  10711. @end table
  10712. The @option{x}, and @option{y} expressions can contain the following
  10713. parameters.
  10714. @table @option
  10715. @item main_w, W
  10716. @item main_h, H
  10717. The main input width and height.
  10718. @item overlay_w, w
  10719. @item overlay_h, h
  10720. The overlay input width and height.
  10721. @item x
  10722. @item y
  10723. The computed values for @var{x} and @var{y}. They are evaluated for
  10724. each new frame.
  10725. @item hsub
  10726. @item vsub
  10727. horizontal and vertical chroma subsample values of the output
  10728. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10729. @var{vsub} is 1.
  10730. @item n
  10731. the number of input frame, starting from 0
  10732. @item pos
  10733. the position in the file of the input frame, NAN if unknown
  10734. @item t
  10735. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10736. @end table
  10737. This filter also supports the @ref{framesync} options.
  10738. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10739. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10740. when @option{eval} is set to @samp{init}.
  10741. Be aware that frames are taken from each input video in timestamp
  10742. order, hence, if their initial timestamps differ, it is a good idea
  10743. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10744. have them begin in the same zero timestamp, as the example for
  10745. the @var{movie} filter does.
  10746. You can chain together more overlays but you should test the
  10747. efficiency of such approach.
  10748. @subsection Commands
  10749. This filter supports the following commands:
  10750. @table @option
  10751. @item x
  10752. @item y
  10753. Modify the x and y of the overlay input.
  10754. The command accepts the same syntax of the corresponding option.
  10755. If the specified expression is not valid, it is kept at its current
  10756. value.
  10757. @end table
  10758. @subsection Examples
  10759. @itemize
  10760. @item
  10761. Draw the overlay at 10 pixels from the bottom right corner of the main
  10762. video:
  10763. @example
  10764. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10765. @end example
  10766. Using named options the example above becomes:
  10767. @example
  10768. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10769. @end example
  10770. @item
  10771. Insert a transparent PNG logo in the bottom left corner of the input,
  10772. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10773. @example
  10774. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10775. @end example
  10776. @item
  10777. Insert 2 different transparent PNG logos (second logo on bottom
  10778. right corner) using the @command{ffmpeg} tool:
  10779. @example
  10780. 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
  10781. @end example
  10782. @item
  10783. Add a transparent color layer on top of the main video; @code{WxH}
  10784. must specify the size of the main input to the overlay filter:
  10785. @example
  10786. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10787. @end example
  10788. @item
  10789. Play an original video and a filtered version (here with the deshake
  10790. filter) side by side using the @command{ffplay} tool:
  10791. @example
  10792. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10793. @end example
  10794. The above command is the same as:
  10795. @example
  10796. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10797. @end example
  10798. @item
  10799. Make a sliding overlay appearing from the left to the right top part of the
  10800. screen starting since time 2:
  10801. @example
  10802. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10803. @end example
  10804. @item
  10805. Compose output by putting two input videos side to side:
  10806. @example
  10807. ffmpeg -i left.avi -i right.avi -filter_complex "
  10808. nullsrc=size=200x100 [background];
  10809. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10810. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10811. [background][left] overlay=shortest=1 [background+left];
  10812. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10813. "
  10814. @end example
  10815. @item
  10816. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10817. @example
  10818. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10819. -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]'
  10820. masked.avi
  10821. @end example
  10822. @item
  10823. Chain several overlays in cascade:
  10824. @example
  10825. nullsrc=s=200x200 [bg];
  10826. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10827. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10828. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10829. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10830. [in3] null, [mid2] overlay=100:100 [out0]
  10831. @end example
  10832. @end itemize
  10833. @section owdenoise
  10834. Apply Overcomplete Wavelet denoiser.
  10835. The filter accepts the following options:
  10836. @table @option
  10837. @item depth
  10838. Set depth.
  10839. Larger depth values will denoise lower frequency components more, but
  10840. slow down filtering.
  10841. Must be an int in the range 8-16, default is @code{8}.
  10842. @item luma_strength, ls
  10843. Set luma strength.
  10844. Must be a double value in the range 0-1000, default is @code{1.0}.
  10845. @item chroma_strength, cs
  10846. Set chroma strength.
  10847. Must be a double value in the range 0-1000, default is @code{1.0}.
  10848. @end table
  10849. @anchor{pad}
  10850. @section pad
  10851. Add paddings to the input image, and place the original input at the
  10852. provided @var{x}, @var{y} coordinates.
  10853. It accepts the following parameters:
  10854. @table @option
  10855. @item width, w
  10856. @item height, h
  10857. Specify an expression for the size of the output image with the
  10858. paddings added. If the value for @var{width} or @var{height} is 0, the
  10859. corresponding input size is used for the output.
  10860. The @var{width} expression can reference the value set by the
  10861. @var{height} expression, and vice versa.
  10862. The default value of @var{width} and @var{height} is 0.
  10863. @item x
  10864. @item y
  10865. Specify the offsets to place the input image at within the padded area,
  10866. with respect to the top/left border of the output image.
  10867. The @var{x} expression can reference the value set by the @var{y}
  10868. expression, and vice versa.
  10869. The default value of @var{x} and @var{y} is 0.
  10870. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10871. so the input image is centered on the padded area.
  10872. @item color
  10873. Specify the color of the padded area. For the syntax of this option,
  10874. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10875. manual,ffmpeg-utils}.
  10876. The default value of @var{color} is "black".
  10877. @item eval
  10878. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10879. It accepts the following values:
  10880. @table @samp
  10881. @item init
  10882. Only evaluate expressions once during the filter initialization or when
  10883. a command is processed.
  10884. @item frame
  10885. Evaluate expressions for each incoming frame.
  10886. @end table
  10887. Default value is @samp{init}.
  10888. @item aspect
  10889. Pad to aspect instead to a resolution.
  10890. @end table
  10891. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10892. options are expressions containing the following constants:
  10893. @table @option
  10894. @item in_w
  10895. @item in_h
  10896. The input video width and height.
  10897. @item iw
  10898. @item ih
  10899. These are the same as @var{in_w} and @var{in_h}.
  10900. @item out_w
  10901. @item out_h
  10902. The output width and height (the size of the padded area), as
  10903. specified by the @var{width} and @var{height} expressions.
  10904. @item ow
  10905. @item oh
  10906. These are the same as @var{out_w} and @var{out_h}.
  10907. @item x
  10908. @item y
  10909. The x and y offsets as specified by the @var{x} and @var{y}
  10910. expressions, or NAN if not yet specified.
  10911. @item a
  10912. same as @var{iw} / @var{ih}
  10913. @item sar
  10914. input sample aspect ratio
  10915. @item dar
  10916. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10917. @item hsub
  10918. @item vsub
  10919. The horizontal and vertical chroma subsample values. For example for the
  10920. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10921. @end table
  10922. @subsection Examples
  10923. @itemize
  10924. @item
  10925. Add paddings with the color "violet" to the input video. The output video
  10926. size is 640x480, and the top-left corner of the input video is placed at
  10927. column 0, row 40
  10928. @example
  10929. pad=640:480:0:40:violet
  10930. @end example
  10931. The example above is equivalent to the following command:
  10932. @example
  10933. pad=width=640:height=480:x=0:y=40:color=violet
  10934. @end example
  10935. @item
  10936. Pad the input to get an output with dimensions increased by 3/2,
  10937. and put the input video at the center of the padded area:
  10938. @example
  10939. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10940. @end example
  10941. @item
  10942. Pad the input to get a squared output with size equal to the maximum
  10943. value between the input width and height, and put the input video at
  10944. the center of the padded area:
  10945. @example
  10946. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10947. @end example
  10948. @item
  10949. Pad the input to get a final w/h ratio of 16:9:
  10950. @example
  10951. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10952. @end example
  10953. @item
  10954. In case of anamorphic video, in order to set the output display aspect
  10955. correctly, it is necessary to use @var{sar} in the expression,
  10956. according to the relation:
  10957. @example
  10958. (ih * X / ih) * sar = output_dar
  10959. X = output_dar / sar
  10960. @end example
  10961. Thus the previous example needs to be modified to:
  10962. @example
  10963. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10964. @end example
  10965. @item
  10966. Double the output size and put the input video in the bottom-right
  10967. corner of the output padded area:
  10968. @example
  10969. pad="2*iw:2*ih:ow-iw:oh-ih"
  10970. @end example
  10971. @end itemize
  10972. @anchor{palettegen}
  10973. @section palettegen
  10974. Generate one palette for a whole video stream.
  10975. It accepts the following options:
  10976. @table @option
  10977. @item max_colors
  10978. Set the maximum number of colors to quantize in the palette.
  10979. Note: the palette will still contain 256 colors; the unused palette entries
  10980. will be black.
  10981. @item reserve_transparent
  10982. Create a palette of 255 colors maximum and reserve the last one for
  10983. transparency. Reserving the transparency color is useful for GIF optimization.
  10984. If not set, the maximum of colors in the palette will be 256. You probably want
  10985. to disable this option for a standalone image.
  10986. Set by default.
  10987. @item transparency_color
  10988. Set the color that will be used as background for transparency.
  10989. @item stats_mode
  10990. Set statistics mode.
  10991. It accepts the following values:
  10992. @table @samp
  10993. @item full
  10994. Compute full frame histograms.
  10995. @item diff
  10996. Compute histograms only for the part that differs from previous frame. This
  10997. might be relevant to give more importance to the moving part of your input if
  10998. the background is static.
  10999. @item single
  11000. Compute new histogram for each frame.
  11001. @end table
  11002. Default value is @var{full}.
  11003. @end table
  11004. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11005. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11006. color quantization of the palette. This information is also visible at
  11007. @var{info} logging level.
  11008. @subsection Examples
  11009. @itemize
  11010. @item
  11011. Generate a representative palette of a given video using @command{ffmpeg}:
  11012. @example
  11013. ffmpeg -i input.mkv -vf palettegen palette.png
  11014. @end example
  11015. @end itemize
  11016. @section paletteuse
  11017. Use a palette to downsample an input video stream.
  11018. The filter takes two inputs: one video stream and a palette. The palette must
  11019. be a 256 pixels image.
  11020. It accepts the following options:
  11021. @table @option
  11022. @item dither
  11023. Select dithering mode. Available algorithms are:
  11024. @table @samp
  11025. @item bayer
  11026. Ordered 8x8 bayer dithering (deterministic)
  11027. @item heckbert
  11028. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11029. Note: this dithering is sometimes considered "wrong" and is included as a
  11030. reference.
  11031. @item floyd_steinberg
  11032. Floyd and Steingberg dithering (error diffusion)
  11033. @item sierra2
  11034. Frankie Sierra dithering v2 (error diffusion)
  11035. @item sierra2_4a
  11036. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11037. @end table
  11038. Default is @var{sierra2_4a}.
  11039. @item bayer_scale
  11040. When @var{bayer} dithering is selected, this option defines the scale of the
  11041. pattern (how much the crosshatch pattern is visible). A low value means more
  11042. visible pattern for less banding, and higher value means less visible pattern
  11043. at the cost of more banding.
  11044. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11045. @item diff_mode
  11046. If set, define the zone to process
  11047. @table @samp
  11048. @item rectangle
  11049. Only the changing rectangle will be reprocessed. This is similar to GIF
  11050. cropping/offsetting compression mechanism. This option can be useful for speed
  11051. if only a part of the image is changing, and has use cases such as limiting the
  11052. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11053. moving scene (it leads to more deterministic output if the scene doesn't change
  11054. much, and as a result less moving noise and better GIF compression).
  11055. @end table
  11056. Default is @var{none}.
  11057. @item new
  11058. Take new palette for each output frame.
  11059. @item alpha_threshold
  11060. Sets the alpha threshold for transparency. Alpha values above this threshold
  11061. will be treated as completely opaque, and values below this threshold will be
  11062. treated as completely transparent.
  11063. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11064. @end table
  11065. @subsection Examples
  11066. @itemize
  11067. @item
  11068. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11069. using @command{ffmpeg}:
  11070. @example
  11071. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11072. @end example
  11073. @end itemize
  11074. @section perspective
  11075. Correct perspective of video not recorded perpendicular to the screen.
  11076. A description of the accepted parameters follows.
  11077. @table @option
  11078. @item x0
  11079. @item y0
  11080. @item x1
  11081. @item y1
  11082. @item x2
  11083. @item y2
  11084. @item x3
  11085. @item y3
  11086. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11087. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11088. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11089. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11090. then the corners of the source will be sent to the specified coordinates.
  11091. The expressions can use the following variables:
  11092. @table @option
  11093. @item W
  11094. @item H
  11095. the width and height of video frame.
  11096. @item in
  11097. Input frame count.
  11098. @item on
  11099. Output frame count.
  11100. @end table
  11101. @item interpolation
  11102. Set interpolation for perspective correction.
  11103. It accepts the following values:
  11104. @table @samp
  11105. @item linear
  11106. @item cubic
  11107. @end table
  11108. Default value is @samp{linear}.
  11109. @item sense
  11110. Set interpretation of coordinate options.
  11111. It accepts the following values:
  11112. @table @samp
  11113. @item 0, source
  11114. Send point in the source specified by the given coordinates to
  11115. the corners of the destination.
  11116. @item 1, destination
  11117. Send the corners of the source to the point in the destination specified
  11118. by the given coordinates.
  11119. Default value is @samp{source}.
  11120. @end table
  11121. @item eval
  11122. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11123. It accepts the following values:
  11124. @table @samp
  11125. @item init
  11126. only evaluate expressions once during the filter initialization or
  11127. when a command is processed
  11128. @item frame
  11129. evaluate expressions for each incoming frame
  11130. @end table
  11131. Default value is @samp{init}.
  11132. @end table
  11133. @section phase
  11134. Delay interlaced video by one field time so that the field order changes.
  11135. The intended use is to fix PAL movies that have been captured with the
  11136. opposite field order to the film-to-video transfer.
  11137. A description of the accepted parameters follows.
  11138. @table @option
  11139. @item mode
  11140. Set phase mode.
  11141. It accepts the following values:
  11142. @table @samp
  11143. @item t
  11144. Capture field order top-first, transfer bottom-first.
  11145. Filter will delay the bottom field.
  11146. @item b
  11147. Capture field order bottom-first, transfer top-first.
  11148. Filter will delay the top field.
  11149. @item p
  11150. Capture and transfer with the same field order. This mode only exists
  11151. for the documentation of the other options to refer to, but if you
  11152. actually select it, the filter will faithfully do nothing.
  11153. @item a
  11154. Capture field order determined automatically by field flags, transfer
  11155. opposite.
  11156. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11157. basis using field flags. If no field information is available,
  11158. then this works just like @samp{u}.
  11159. @item u
  11160. Capture unknown or varying, transfer opposite.
  11161. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11162. analyzing the images and selecting the alternative that produces best
  11163. match between the fields.
  11164. @item T
  11165. Capture top-first, transfer unknown or varying.
  11166. Filter selects among @samp{t} and @samp{p} using image analysis.
  11167. @item B
  11168. Capture bottom-first, transfer unknown or varying.
  11169. Filter selects among @samp{b} and @samp{p} using image analysis.
  11170. @item A
  11171. Capture determined by field flags, transfer unknown or varying.
  11172. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11173. image analysis. If no field information is available, then this works just
  11174. like @samp{U}. This is the default mode.
  11175. @item U
  11176. Both capture and transfer unknown or varying.
  11177. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11178. @end table
  11179. @end table
  11180. @section photosensitivity
  11181. Reduce various flashes in video, so to help users with epilepsy.
  11182. It accepts the following options:
  11183. @table @option
  11184. @item frames, f
  11185. Set how many frames to use when filtering. Default is 30.
  11186. @item threshold, t
  11187. Set detection threshold factor. Default is 1.
  11188. Lower is stricter.
  11189. @item skip
  11190. Set how many pixels to skip when sampling frames. Default is 1.
  11191. Allowed range is from 1 to 1024.
  11192. @item bypass
  11193. Leave frames unchanged. Default is disabled.
  11194. @end table
  11195. @section pixdesctest
  11196. Pixel format descriptor test filter, mainly useful for internal
  11197. testing. The output video should be equal to the input video.
  11198. For example:
  11199. @example
  11200. format=monow, pixdesctest
  11201. @end example
  11202. can be used to test the monowhite pixel format descriptor definition.
  11203. @section pixscope
  11204. Display sample values of color channels. Mainly useful for checking color
  11205. and levels. Minimum supported resolution is 640x480.
  11206. The filters accept the following options:
  11207. @table @option
  11208. @item x
  11209. Set scope X position, relative offset on X axis.
  11210. @item y
  11211. Set scope Y position, relative offset on Y axis.
  11212. @item w
  11213. Set scope width.
  11214. @item h
  11215. Set scope height.
  11216. @item o
  11217. Set window opacity. This window also holds statistics about pixel area.
  11218. @item wx
  11219. Set window X position, relative offset on X axis.
  11220. @item wy
  11221. Set window Y position, relative offset on Y axis.
  11222. @end table
  11223. @section pp
  11224. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11225. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11226. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11227. Each subfilter and some options have a short and a long name that can be used
  11228. interchangeably, i.e. dr/dering are the same.
  11229. The filters accept the following options:
  11230. @table @option
  11231. @item subfilters
  11232. Set postprocessing subfilters string.
  11233. @end table
  11234. All subfilters share common options to determine their scope:
  11235. @table @option
  11236. @item a/autoq
  11237. Honor the quality commands for this subfilter.
  11238. @item c/chrom
  11239. Do chrominance filtering, too (default).
  11240. @item y/nochrom
  11241. Do luminance filtering only (no chrominance).
  11242. @item n/noluma
  11243. Do chrominance filtering only (no luminance).
  11244. @end table
  11245. These options can be appended after the subfilter name, separated by a '|'.
  11246. Available subfilters are:
  11247. @table @option
  11248. @item hb/hdeblock[|difference[|flatness]]
  11249. Horizontal deblocking filter
  11250. @table @option
  11251. @item difference
  11252. Difference factor where higher values mean more deblocking (default: @code{32}).
  11253. @item flatness
  11254. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11255. @end table
  11256. @item vb/vdeblock[|difference[|flatness]]
  11257. Vertical deblocking filter
  11258. @table @option
  11259. @item difference
  11260. Difference factor where higher values mean more deblocking (default: @code{32}).
  11261. @item flatness
  11262. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11263. @end table
  11264. @item ha/hadeblock[|difference[|flatness]]
  11265. Accurate horizontal deblocking filter
  11266. @table @option
  11267. @item difference
  11268. Difference factor where higher values mean more deblocking (default: @code{32}).
  11269. @item flatness
  11270. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11271. @end table
  11272. @item va/vadeblock[|difference[|flatness]]
  11273. Accurate vertical deblocking filter
  11274. @table @option
  11275. @item difference
  11276. Difference factor where higher values mean more deblocking (default: @code{32}).
  11277. @item flatness
  11278. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11279. @end table
  11280. @end table
  11281. The horizontal and vertical deblocking filters share the difference and
  11282. flatness values so you cannot set different horizontal and vertical
  11283. thresholds.
  11284. @table @option
  11285. @item h1/x1hdeblock
  11286. Experimental horizontal deblocking filter
  11287. @item v1/x1vdeblock
  11288. Experimental vertical deblocking filter
  11289. @item dr/dering
  11290. Deringing filter
  11291. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  11292. @table @option
  11293. @item threshold1
  11294. larger -> stronger filtering
  11295. @item threshold2
  11296. larger -> stronger filtering
  11297. @item threshold3
  11298. larger -> stronger filtering
  11299. @end table
  11300. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  11301. @table @option
  11302. @item f/fullyrange
  11303. Stretch luminance to @code{0-255}.
  11304. @end table
  11305. @item lb/linblenddeint
  11306. Linear blend deinterlacing filter that deinterlaces the given block by
  11307. filtering all lines with a @code{(1 2 1)} filter.
  11308. @item li/linipoldeint
  11309. Linear interpolating deinterlacing filter that deinterlaces the given block by
  11310. linearly interpolating every second line.
  11311. @item ci/cubicipoldeint
  11312. Cubic interpolating deinterlacing filter deinterlaces the given block by
  11313. cubically interpolating every second line.
  11314. @item md/mediandeint
  11315. Median deinterlacing filter that deinterlaces the given block by applying a
  11316. median filter to every second line.
  11317. @item fd/ffmpegdeint
  11318. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  11319. second line with a @code{(-1 4 2 4 -1)} filter.
  11320. @item l5/lowpass5
  11321. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  11322. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  11323. @item fq/forceQuant[|quantizer]
  11324. Overrides the quantizer table from the input with the constant quantizer you
  11325. specify.
  11326. @table @option
  11327. @item quantizer
  11328. Quantizer to use
  11329. @end table
  11330. @item de/default
  11331. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  11332. @item fa/fast
  11333. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  11334. @item ac
  11335. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11336. @end table
  11337. @subsection Examples
  11338. @itemize
  11339. @item
  11340. Apply horizontal and vertical deblocking, deringing and automatic
  11341. brightness/contrast:
  11342. @example
  11343. pp=hb/vb/dr/al
  11344. @end example
  11345. @item
  11346. Apply default filters without brightness/contrast correction:
  11347. @example
  11348. pp=de/-al
  11349. @end example
  11350. @item
  11351. Apply default filters and temporal denoiser:
  11352. @example
  11353. pp=default/tmpnoise|1|2|3
  11354. @end example
  11355. @item
  11356. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11357. automatically depending on available CPU time:
  11358. @example
  11359. pp=hb|y/vb|a
  11360. @end example
  11361. @end itemize
  11362. @section pp7
  11363. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11364. similar to spp = 6 with 7 point DCT, where only the center sample is
  11365. used after IDCT.
  11366. The filter accepts the following options:
  11367. @table @option
  11368. @item qp
  11369. Force a constant quantization parameter. It accepts an integer in range
  11370. 0 to 63. If not set, the filter will use the QP from the video stream
  11371. (if available).
  11372. @item mode
  11373. Set thresholding mode. Available modes are:
  11374. @table @samp
  11375. @item hard
  11376. Set hard thresholding.
  11377. @item soft
  11378. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11379. @item medium
  11380. Set medium thresholding (good results, default).
  11381. @end table
  11382. @end table
  11383. @section premultiply
  11384. Apply alpha premultiply effect to input video stream using first plane
  11385. of second stream as alpha.
  11386. Both streams must have same dimensions and same pixel format.
  11387. The filter accepts the following option:
  11388. @table @option
  11389. @item planes
  11390. Set which planes will be processed, unprocessed planes will be copied.
  11391. By default value 0xf, all planes will be processed.
  11392. @item inplace
  11393. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11394. @end table
  11395. @section prewitt
  11396. Apply prewitt operator to input video stream.
  11397. The filter accepts the following option:
  11398. @table @option
  11399. @item planes
  11400. Set which planes will be processed, unprocessed planes will be copied.
  11401. By default value 0xf, all planes will be processed.
  11402. @item scale
  11403. Set value which will be multiplied with filtered result.
  11404. @item delta
  11405. Set value which will be added to filtered result.
  11406. @end table
  11407. @anchor{program_opencl}
  11408. @section program_opencl
  11409. Filter video using an OpenCL program.
  11410. @table @option
  11411. @item source
  11412. OpenCL program source file.
  11413. @item kernel
  11414. Kernel name in program.
  11415. @item inputs
  11416. Number of inputs to the filter. Defaults to 1.
  11417. @item size, s
  11418. Size of output frames. Defaults to the same as the first input.
  11419. @end table
  11420. The program source file must contain a kernel function with the given name,
  11421. which will be run once for each plane of the output. Each run on a plane
  11422. gets enqueued as a separate 2D global NDRange with one work-item for each
  11423. pixel to be generated. The global ID offset for each work-item is therefore
  11424. the coordinates of a pixel in the destination image.
  11425. The kernel function needs to take the following arguments:
  11426. @itemize
  11427. @item
  11428. Destination image, @var{__write_only image2d_t}.
  11429. This image will become the output; the kernel should write all of it.
  11430. @item
  11431. Frame index, @var{unsigned int}.
  11432. This is a counter starting from zero and increasing by one for each frame.
  11433. @item
  11434. Source images, @var{__read_only image2d_t}.
  11435. These are the most recent images on each input. The kernel may read from
  11436. them to generate the output, but they can't be written to.
  11437. @end itemize
  11438. Example programs:
  11439. @itemize
  11440. @item
  11441. Copy the input to the output (output must be the same size as the input).
  11442. @verbatim
  11443. __kernel void copy(__write_only image2d_t destination,
  11444. unsigned int index,
  11445. __read_only image2d_t source)
  11446. {
  11447. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11448. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11449. float4 value = read_imagef(source, sampler, location);
  11450. write_imagef(destination, location, value);
  11451. }
  11452. @end verbatim
  11453. @item
  11454. Apply a simple transformation, rotating the input by an amount increasing
  11455. with the index counter. Pixel values are linearly interpolated by the
  11456. sampler, and the output need not have the same dimensions as the input.
  11457. @verbatim
  11458. __kernel void rotate_image(__write_only image2d_t dst,
  11459. unsigned int index,
  11460. __read_only image2d_t src)
  11461. {
  11462. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11463. CLK_FILTER_LINEAR);
  11464. float angle = (float)index / 100.0f;
  11465. float2 dst_dim = convert_float2(get_image_dim(dst));
  11466. float2 src_dim = convert_float2(get_image_dim(src));
  11467. float2 dst_cen = dst_dim / 2.0f;
  11468. float2 src_cen = src_dim / 2.0f;
  11469. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11470. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11471. float2 src_pos = {
  11472. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11473. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11474. };
  11475. src_pos = src_pos * src_dim / dst_dim;
  11476. float2 src_loc = src_pos + src_cen;
  11477. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11478. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11479. write_imagef(dst, dst_loc, 0.5f);
  11480. else
  11481. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11482. }
  11483. @end verbatim
  11484. @item
  11485. Blend two inputs together, with the amount of each input used varying
  11486. with the index counter.
  11487. @verbatim
  11488. __kernel void blend_images(__write_only image2d_t dst,
  11489. unsigned int index,
  11490. __read_only image2d_t src1,
  11491. __read_only image2d_t src2)
  11492. {
  11493. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11494. CLK_FILTER_LINEAR);
  11495. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11496. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11497. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11498. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11499. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11500. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11501. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11502. }
  11503. @end verbatim
  11504. @end itemize
  11505. @section pseudocolor
  11506. Alter frame colors in video with pseudocolors.
  11507. This filter accepts the following options:
  11508. @table @option
  11509. @item c0
  11510. set pixel first component expression
  11511. @item c1
  11512. set pixel second component expression
  11513. @item c2
  11514. set pixel third component expression
  11515. @item c3
  11516. set pixel fourth component expression, corresponds to the alpha component
  11517. @item i
  11518. set component to use as base for altering colors
  11519. @end table
  11520. Each of them specifies the expression to use for computing the lookup table for
  11521. the corresponding pixel component values.
  11522. The expressions can contain the following constants and functions:
  11523. @table @option
  11524. @item w
  11525. @item h
  11526. The input width and height.
  11527. @item val
  11528. The input value for the pixel component.
  11529. @item ymin, umin, vmin, amin
  11530. The minimum allowed component value.
  11531. @item ymax, umax, vmax, amax
  11532. The maximum allowed component value.
  11533. @end table
  11534. All expressions default to "val".
  11535. @subsection Examples
  11536. @itemize
  11537. @item
  11538. Change too high luma values to gradient:
  11539. @example
  11540. 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'"
  11541. @end example
  11542. @end itemize
  11543. @section psnr
  11544. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11545. Ratio) between two input videos.
  11546. This filter takes in input two input videos, the first input is
  11547. considered the "main" source and is passed unchanged to the
  11548. output. The second input is used as a "reference" video for computing
  11549. the PSNR.
  11550. Both video inputs must have the same resolution and pixel format for
  11551. this filter to work correctly. Also it assumes that both inputs
  11552. have the same number of frames, which are compared one by one.
  11553. The obtained average PSNR is printed through the logging system.
  11554. The filter stores the accumulated MSE (mean squared error) of each
  11555. frame, and at the end of the processing it is averaged across all frames
  11556. equally, and the following formula is applied to obtain the PSNR:
  11557. @example
  11558. PSNR = 10*log10(MAX^2/MSE)
  11559. @end example
  11560. Where MAX is the average of the maximum values of each component of the
  11561. image.
  11562. The description of the accepted parameters follows.
  11563. @table @option
  11564. @item stats_file, f
  11565. If specified the filter will use the named file to save the PSNR of
  11566. each individual frame. When filename equals "-" the data is sent to
  11567. standard output.
  11568. @item stats_version
  11569. Specifies which version of the stats file format to use. Details of
  11570. each format are written below.
  11571. Default value is 1.
  11572. @item stats_add_max
  11573. Determines whether the max value is output to the stats log.
  11574. Default value is 0.
  11575. Requires stats_version >= 2. If this is set and stats_version < 2,
  11576. the filter will return an error.
  11577. @end table
  11578. This filter also supports the @ref{framesync} options.
  11579. The file printed if @var{stats_file} is selected, contains a sequence of
  11580. key/value pairs of the form @var{key}:@var{value} for each compared
  11581. couple of frames.
  11582. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11583. the list of per-frame-pair stats, with key value pairs following the frame
  11584. format with the following parameters:
  11585. @table @option
  11586. @item psnr_log_version
  11587. The version of the log file format. Will match @var{stats_version}.
  11588. @item fields
  11589. A comma separated list of the per-frame-pair parameters included in
  11590. the log.
  11591. @end table
  11592. A description of each shown per-frame-pair parameter follows:
  11593. @table @option
  11594. @item n
  11595. sequential number of the input frame, starting from 1
  11596. @item mse_avg
  11597. Mean Square Error pixel-by-pixel average difference of the compared
  11598. frames, averaged over all the image components.
  11599. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11600. Mean Square Error pixel-by-pixel average difference of the compared
  11601. frames for the component specified by the suffix.
  11602. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11603. Peak Signal to Noise ratio of the compared frames for the component
  11604. specified by the suffix.
  11605. @item max_avg, max_y, max_u, max_v
  11606. Maximum allowed value for each channel, and average over all
  11607. channels.
  11608. @end table
  11609. @subsection Examples
  11610. @itemize
  11611. @item
  11612. For example:
  11613. @example
  11614. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11615. [main][ref] psnr="stats_file=stats.log" [out]
  11616. @end example
  11617. On this example the input file being processed is compared with the
  11618. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11619. is stored in @file{stats.log}.
  11620. @item
  11621. Another example with different containers:
  11622. @example
  11623. 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 -
  11624. @end example
  11625. @end itemize
  11626. @anchor{pullup}
  11627. @section pullup
  11628. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11629. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11630. content.
  11631. The pullup filter is designed to take advantage of future context in making
  11632. its decisions. This filter is stateless in the sense that it does not lock
  11633. onto a pattern to follow, but it instead looks forward to the following
  11634. fields in order to identify matches and rebuild progressive frames.
  11635. To produce content with an even framerate, insert the fps filter after
  11636. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11637. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11638. The filter accepts the following options:
  11639. @table @option
  11640. @item jl
  11641. @item jr
  11642. @item jt
  11643. @item jb
  11644. These options set the amount of "junk" to ignore at the left, right, top, and
  11645. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11646. while top and bottom are in units of 2 lines.
  11647. The default is 8 pixels on each side.
  11648. @item sb
  11649. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11650. filter generating an occasional mismatched frame, but it may also cause an
  11651. excessive number of frames to be dropped during high motion sequences.
  11652. Conversely, setting it to -1 will make filter match fields more easily.
  11653. This may help processing of video where there is slight blurring between
  11654. the fields, but may also cause there to be interlaced frames in the output.
  11655. Default value is @code{0}.
  11656. @item mp
  11657. Set the metric plane to use. It accepts the following values:
  11658. @table @samp
  11659. @item l
  11660. Use luma plane.
  11661. @item u
  11662. Use chroma blue plane.
  11663. @item v
  11664. Use chroma red plane.
  11665. @end table
  11666. This option may be set to use chroma plane instead of the default luma plane
  11667. for doing filter's computations. This may improve accuracy on very clean
  11668. source material, but more likely will decrease accuracy, especially if there
  11669. is chroma noise (rainbow effect) or any grayscale video.
  11670. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11671. load and make pullup usable in realtime on slow machines.
  11672. @end table
  11673. For best results (without duplicated frames in the output file) it is
  11674. necessary to change the output frame rate. For example, to inverse
  11675. telecine NTSC input:
  11676. @example
  11677. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11678. @end example
  11679. @section qp
  11680. Change video quantization parameters (QP).
  11681. The filter accepts the following option:
  11682. @table @option
  11683. @item qp
  11684. Set expression for quantization parameter.
  11685. @end table
  11686. The expression is evaluated through the eval API and can contain, among others,
  11687. the following constants:
  11688. @table @var
  11689. @item known
  11690. 1 if index is not 129, 0 otherwise.
  11691. @item qp
  11692. Sequential index starting from -129 to 128.
  11693. @end table
  11694. @subsection Examples
  11695. @itemize
  11696. @item
  11697. Some equation like:
  11698. @example
  11699. qp=2+2*sin(PI*qp)
  11700. @end example
  11701. @end itemize
  11702. @section random
  11703. Flush video frames from internal cache of frames into a random order.
  11704. No frame is discarded.
  11705. Inspired by @ref{frei0r} nervous filter.
  11706. @table @option
  11707. @item frames
  11708. Set size in number of frames of internal cache, in range from @code{2} to
  11709. @code{512}. Default is @code{30}.
  11710. @item seed
  11711. Set seed for random number generator, must be an integer included between
  11712. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11713. less than @code{0}, the filter will try to use a good random seed on a
  11714. best effort basis.
  11715. @end table
  11716. @section readeia608
  11717. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11718. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11719. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11720. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11721. @table @option
  11722. @item lavfi.readeia608.X.cc
  11723. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11724. @item lavfi.readeia608.X.line
  11725. The number of the line on which the EIA-608 data was identified and read.
  11726. @end table
  11727. This filter accepts the following options:
  11728. @table @option
  11729. @item scan_min
  11730. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11731. @item scan_max
  11732. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11733. @item spw
  11734. Set the ratio of width reserved for sync code detection.
  11735. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  11736. @item chp
  11737. Enable checking the parity bit. In the event of a parity error, the filter will output
  11738. @code{0x00} for that character. Default is false.
  11739. @item lp
  11740. Lowpass lines prior to further processing. Default is enabled.
  11741. @end table
  11742. @subsection Examples
  11743. @itemize
  11744. @item
  11745. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11746. @example
  11747. 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
  11748. @end example
  11749. @end itemize
  11750. @section readvitc
  11751. Read vertical interval timecode (VITC) information from the top lines of a
  11752. video frame.
  11753. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11754. timecode value, if a valid timecode has been detected. Further metadata key
  11755. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11756. timecode data has been found or not.
  11757. This filter accepts the following options:
  11758. @table @option
  11759. @item scan_max
  11760. Set the maximum number of lines to scan for VITC data. If the value is set to
  11761. @code{-1} the full video frame is scanned. Default is @code{45}.
  11762. @item thr_b
  11763. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11764. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11765. @item thr_w
  11766. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11767. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11768. @end table
  11769. @subsection Examples
  11770. @itemize
  11771. @item
  11772. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11773. draw @code{--:--:--:--} as a placeholder:
  11774. @example
  11775. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11776. @end example
  11777. @end itemize
  11778. @section remap
  11779. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11780. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11781. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11782. value for pixel will be used for destination pixel.
  11783. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11784. will have Xmap/Ymap video stream dimensions.
  11785. Xmap and Ymap input video streams are 16bit depth, single channel.
  11786. @table @option
  11787. @item format
  11788. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11789. Default is @code{color}.
  11790. @end table
  11791. @section removegrain
  11792. The removegrain filter is a spatial denoiser for progressive video.
  11793. @table @option
  11794. @item m0
  11795. Set mode for the first plane.
  11796. @item m1
  11797. Set mode for the second plane.
  11798. @item m2
  11799. Set mode for the third plane.
  11800. @item m3
  11801. Set mode for the fourth plane.
  11802. @end table
  11803. Range of mode is from 0 to 24. Description of each mode follows:
  11804. @table @var
  11805. @item 0
  11806. Leave input plane unchanged. Default.
  11807. @item 1
  11808. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11809. @item 2
  11810. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11811. @item 3
  11812. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11813. @item 4
  11814. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11815. This is equivalent to a median filter.
  11816. @item 5
  11817. Line-sensitive clipping giving the minimal change.
  11818. @item 6
  11819. Line-sensitive clipping, intermediate.
  11820. @item 7
  11821. Line-sensitive clipping, intermediate.
  11822. @item 8
  11823. Line-sensitive clipping, intermediate.
  11824. @item 9
  11825. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11826. @item 10
  11827. Replaces the target pixel with the closest neighbour.
  11828. @item 11
  11829. [1 2 1] horizontal and vertical kernel blur.
  11830. @item 12
  11831. Same as mode 11.
  11832. @item 13
  11833. Bob mode, interpolates top field from the line where the neighbours
  11834. pixels are the closest.
  11835. @item 14
  11836. Bob mode, interpolates bottom field from the line where the neighbours
  11837. pixels are the closest.
  11838. @item 15
  11839. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11840. interpolation formula.
  11841. @item 16
  11842. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11843. interpolation formula.
  11844. @item 17
  11845. Clips the pixel with the minimum and maximum of respectively the maximum and
  11846. minimum of each pair of opposite neighbour pixels.
  11847. @item 18
  11848. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11849. the current pixel is minimal.
  11850. @item 19
  11851. Replaces the pixel with the average of its 8 neighbours.
  11852. @item 20
  11853. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11854. @item 21
  11855. Clips pixels using the averages of opposite neighbour.
  11856. @item 22
  11857. Same as mode 21 but simpler and faster.
  11858. @item 23
  11859. Small edge and halo removal, but reputed useless.
  11860. @item 24
  11861. Similar as 23.
  11862. @end table
  11863. @section removelogo
  11864. Suppress a TV station logo, using an image file to determine which
  11865. pixels comprise the logo. It works by filling in the pixels that
  11866. comprise the logo with neighboring pixels.
  11867. The filter accepts the following options:
  11868. @table @option
  11869. @item filename, f
  11870. Set the filter bitmap file, which can be any image format supported by
  11871. libavformat. The width and height of the image file must match those of the
  11872. video stream being processed.
  11873. @end table
  11874. Pixels in the provided bitmap image with a value of zero are not
  11875. considered part of the logo, non-zero pixels are considered part of
  11876. the logo. If you use white (255) for the logo and black (0) for the
  11877. rest, you will be safe. For making the filter bitmap, it is
  11878. recommended to take a screen capture of a black frame with the logo
  11879. visible, and then using a threshold filter followed by the erode
  11880. filter once or twice.
  11881. If needed, little splotches can be fixed manually. Remember that if
  11882. logo pixels are not covered, the filter quality will be much
  11883. reduced. Marking too many pixels as part of the logo does not hurt as
  11884. much, but it will increase the amount of blurring needed to cover over
  11885. the image and will destroy more information than necessary, and extra
  11886. pixels will slow things down on a large logo.
  11887. @section repeatfields
  11888. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11889. fields based on its value.
  11890. @section reverse
  11891. Reverse a video clip.
  11892. Warning: This filter requires memory to buffer the entire clip, so trimming
  11893. is suggested.
  11894. @subsection Examples
  11895. @itemize
  11896. @item
  11897. Take the first 5 seconds of a clip, and reverse it.
  11898. @example
  11899. trim=end=5,reverse
  11900. @end example
  11901. @end itemize
  11902. @section rgbashift
  11903. Shift R/G/B/A pixels horizontally and/or vertically.
  11904. The filter accepts the following options:
  11905. @table @option
  11906. @item rh
  11907. Set amount to shift red horizontally.
  11908. @item rv
  11909. Set amount to shift red vertically.
  11910. @item gh
  11911. Set amount to shift green horizontally.
  11912. @item gv
  11913. Set amount to shift green vertically.
  11914. @item bh
  11915. Set amount to shift blue horizontally.
  11916. @item bv
  11917. Set amount to shift blue vertically.
  11918. @item ah
  11919. Set amount to shift alpha horizontally.
  11920. @item av
  11921. Set amount to shift alpha vertically.
  11922. @item edge
  11923. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11924. @end table
  11925. @subsection Commands
  11926. This filter supports the all above options as @ref{commands}.
  11927. @section roberts
  11928. Apply roberts cross operator to input video stream.
  11929. The filter accepts the following option:
  11930. @table @option
  11931. @item planes
  11932. Set which planes will be processed, unprocessed planes will be copied.
  11933. By default value 0xf, all planes will be processed.
  11934. @item scale
  11935. Set value which will be multiplied with filtered result.
  11936. @item delta
  11937. Set value which will be added to filtered result.
  11938. @end table
  11939. @section rotate
  11940. Rotate video by an arbitrary angle expressed in radians.
  11941. The filter accepts the following options:
  11942. A description of the optional parameters follows.
  11943. @table @option
  11944. @item angle, a
  11945. Set an expression for the angle by which to rotate the input video
  11946. clockwise, expressed as a number of radians. A negative value will
  11947. result in a counter-clockwise rotation. By default it is set to "0".
  11948. This expression is evaluated for each frame.
  11949. @item out_w, ow
  11950. Set the output width expression, default value is "iw".
  11951. This expression is evaluated just once during configuration.
  11952. @item out_h, oh
  11953. Set the output height expression, default value is "ih".
  11954. This expression is evaluated just once during configuration.
  11955. @item bilinear
  11956. Enable bilinear interpolation if set to 1, a value of 0 disables
  11957. it. Default value is 1.
  11958. @item fillcolor, c
  11959. Set the color used to fill the output area not covered by the rotated
  11960. image. For the general syntax of this option, check the
  11961. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11962. If the special value "none" is selected then no
  11963. background is printed (useful for example if the background is never shown).
  11964. Default value is "black".
  11965. @end table
  11966. The expressions for the angle and the output size can contain the
  11967. following constants and functions:
  11968. @table @option
  11969. @item n
  11970. sequential number of the input frame, starting from 0. It is always NAN
  11971. before the first frame is filtered.
  11972. @item t
  11973. time in seconds of the input frame, it is set to 0 when the filter is
  11974. configured. It is always NAN before the first frame is filtered.
  11975. @item hsub
  11976. @item vsub
  11977. horizontal and vertical chroma subsample values. For example for the
  11978. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11979. @item in_w, iw
  11980. @item in_h, ih
  11981. the input video width and height
  11982. @item out_w, ow
  11983. @item out_h, oh
  11984. the output width and height, that is the size of the padded area as
  11985. specified by the @var{width} and @var{height} expressions
  11986. @item rotw(a)
  11987. @item roth(a)
  11988. the minimal width/height required for completely containing the input
  11989. video rotated by @var{a} radians.
  11990. These are only available when computing the @option{out_w} and
  11991. @option{out_h} expressions.
  11992. @end table
  11993. @subsection Examples
  11994. @itemize
  11995. @item
  11996. Rotate the input by PI/6 radians clockwise:
  11997. @example
  11998. rotate=PI/6
  11999. @end example
  12000. @item
  12001. Rotate the input by PI/6 radians counter-clockwise:
  12002. @example
  12003. rotate=-PI/6
  12004. @end example
  12005. @item
  12006. Rotate the input by 45 degrees clockwise:
  12007. @example
  12008. rotate=45*PI/180
  12009. @end example
  12010. @item
  12011. Apply a constant rotation with period T, starting from an angle of PI/3:
  12012. @example
  12013. rotate=PI/3+2*PI*t/T
  12014. @end example
  12015. @item
  12016. Make the input video rotation oscillating with a period of T
  12017. seconds and an amplitude of A radians:
  12018. @example
  12019. rotate=A*sin(2*PI/T*t)
  12020. @end example
  12021. @item
  12022. Rotate the video, output size is chosen so that the whole rotating
  12023. input video is always completely contained in the output:
  12024. @example
  12025. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12026. @end example
  12027. @item
  12028. Rotate the video, reduce the output size so that no background is ever
  12029. shown:
  12030. @example
  12031. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12032. @end example
  12033. @end itemize
  12034. @subsection Commands
  12035. The filter supports the following commands:
  12036. @table @option
  12037. @item a, angle
  12038. Set the angle expression.
  12039. The command accepts the same syntax of the corresponding option.
  12040. If the specified expression is not valid, it is kept at its current
  12041. value.
  12042. @end table
  12043. @section sab
  12044. Apply Shape Adaptive Blur.
  12045. The filter accepts the following options:
  12046. @table @option
  12047. @item luma_radius, lr
  12048. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12049. value is 1.0. A greater value will result in a more blurred image, and
  12050. in slower processing.
  12051. @item luma_pre_filter_radius, lpfr
  12052. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12053. value is 1.0.
  12054. @item luma_strength, ls
  12055. Set luma maximum difference between pixels to still be considered, must
  12056. be a value in the 0.1-100.0 range, default value is 1.0.
  12057. @item chroma_radius, cr
  12058. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12059. greater value will result in a more blurred image, and in slower
  12060. processing.
  12061. @item chroma_pre_filter_radius, cpfr
  12062. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12063. @item chroma_strength, cs
  12064. Set chroma maximum difference between pixels to still be considered,
  12065. must be a value in the -0.9-100.0 range.
  12066. @end table
  12067. Each chroma option value, if not explicitly specified, is set to the
  12068. corresponding luma option value.
  12069. @anchor{scale}
  12070. @section scale
  12071. Scale (resize) the input video, using the libswscale library.
  12072. The scale filter forces the output display aspect ratio to be the same
  12073. of the input, by changing the output sample aspect ratio.
  12074. If the input image format is different from the format requested by
  12075. the next filter, the scale filter will convert the input to the
  12076. requested format.
  12077. @subsection Options
  12078. The filter accepts the following options, or any of the options
  12079. supported by the libswscale scaler.
  12080. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12081. the complete list of scaler options.
  12082. @table @option
  12083. @item width, w
  12084. @item height, h
  12085. Set the output video dimension expression. Default value is the input
  12086. dimension.
  12087. If the @var{width} or @var{w} value is 0, the input width is used for
  12088. the output. If the @var{height} or @var{h} value is 0, the input height
  12089. is used for the output.
  12090. If one and only one of the values is -n with n >= 1, the scale filter
  12091. will use a value that maintains the aspect ratio of the input image,
  12092. calculated from the other specified dimension. After that it will,
  12093. however, make sure that the calculated dimension is divisible by n and
  12094. adjust the value if necessary.
  12095. If both values are -n with n >= 1, the behavior will be identical to
  12096. both values being set to 0 as previously detailed.
  12097. See below for the list of accepted constants for use in the dimension
  12098. expression.
  12099. @item eval
  12100. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12101. @table @samp
  12102. @item init
  12103. Only evaluate expressions once during the filter initialization or when a command is processed.
  12104. @item frame
  12105. Evaluate expressions for each incoming frame.
  12106. @end table
  12107. Default value is @samp{init}.
  12108. @item interl
  12109. Set the interlacing mode. It accepts the following values:
  12110. @table @samp
  12111. @item 1
  12112. Force interlaced aware scaling.
  12113. @item 0
  12114. Do not apply interlaced scaling.
  12115. @item -1
  12116. Select interlaced aware scaling depending on whether the source frames
  12117. are flagged as interlaced or not.
  12118. @end table
  12119. Default value is @samp{0}.
  12120. @item flags
  12121. Set libswscale scaling flags. See
  12122. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12123. complete list of values. If not explicitly specified the filter applies
  12124. the default flags.
  12125. @item param0, param1
  12126. Set libswscale input parameters for scaling algorithms that need them. See
  12127. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12128. complete documentation. If not explicitly specified the filter applies
  12129. empty parameters.
  12130. @item size, s
  12131. Set the video size. For the syntax of this option, check the
  12132. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12133. @item in_color_matrix
  12134. @item out_color_matrix
  12135. Set in/output YCbCr color space type.
  12136. This allows the autodetected value to be overridden as well as allows forcing
  12137. a specific value used for the output and encoder.
  12138. If not specified, the color space type depends on the pixel format.
  12139. Possible values:
  12140. @table @samp
  12141. @item auto
  12142. Choose automatically.
  12143. @item bt709
  12144. Format conforming to International Telecommunication Union (ITU)
  12145. Recommendation BT.709.
  12146. @item fcc
  12147. Set color space conforming to the United States Federal Communications
  12148. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12149. @item bt601
  12150. @item bt470
  12151. @item smpte170m
  12152. Set color space conforming to:
  12153. @itemize
  12154. @item
  12155. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12156. @item
  12157. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12158. @item
  12159. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12160. @end itemize
  12161. @item smpte240m
  12162. Set color space conforming to SMPTE ST 240:1999.
  12163. @item bt2020
  12164. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12165. @end table
  12166. @item in_range
  12167. @item out_range
  12168. Set in/output YCbCr sample range.
  12169. This allows the autodetected value to be overridden as well as allows forcing
  12170. a specific value used for the output and encoder. If not specified, the
  12171. range depends on the pixel format. Possible values:
  12172. @table @samp
  12173. @item auto/unknown
  12174. Choose automatically.
  12175. @item jpeg/full/pc
  12176. Set full range (0-255 in case of 8-bit luma).
  12177. @item mpeg/limited/tv
  12178. Set "MPEG" range (16-235 in case of 8-bit luma).
  12179. @end table
  12180. @item force_original_aspect_ratio
  12181. Enable decreasing or increasing output video width or height if necessary to
  12182. keep the original aspect ratio. Possible values:
  12183. @table @samp
  12184. @item disable
  12185. Scale the video as specified and disable this feature.
  12186. @item decrease
  12187. The output video dimensions will automatically be decreased if needed.
  12188. @item increase
  12189. The output video dimensions will automatically be increased if needed.
  12190. @end table
  12191. One useful instance of this option is that when you know a specific device's
  12192. maximum allowed resolution, you can use this to limit the output video to
  12193. that, while retaining the aspect ratio. For example, device A allows
  12194. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12195. decrease) and specifying 1280x720 to the command line makes the output
  12196. 1280x533.
  12197. Please note that this is a different thing than specifying -1 for @option{w}
  12198. or @option{h}, you still need to specify the output resolution for this option
  12199. to work.
  12200. @item force_divisible_by
  12201. Ensures that both the output dimensions, width and height, are divisible by the
  12202. given integer when used together with @option{force_original_aspect_ratio}. This
  12203. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12204. This option respects the value set for @option{force_original_aspect_ratio},
  12205. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12206. may be slightly modified.
  12207. This option can be handy if you need to have a video fit within or exceed
  12208. a defined resolution using @option{force_original_aspect_ratio} but also have
  12209. encoder restrictions on width or height divisibility.
  12210. @end table
  12211. The values of the @option{w} and @option{h} options are expressions
  12212. containing the following constants:
  12213. @table @var
  12214. @item in_w
  12215. @item in_h
  12216. The input width and height
  12217. @item iw
  12218. @item ih
  12219. These are the same as @var{in_w} and @var{in_h}.
  12220. @item out_w
  12221. @item out_h
  12222. The output (scaled) width and height
  12223. @item ow
  12224. @item oh
  12225. These are the same as @var{out_w} and @var{out_h}
  12226. @item a
  12227. The same as @var{iw} / @var{ih}
  12228. @item sar
  12229. input sample aspect ratio
  12230. @item dar
  12231. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12232. @item hsub
  12233. @item vsub
  12234. horizontal and vertical input chroma subsample values. For example for the
  12235. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12236. @item ohsub
  12237. @item ovsub
  12238. horizontal and vertical output chroma subsample values. For example for the
  12239. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12240. @end table
  12241. @subsection Examples
  12242. @itemize
  12243. @item
  12244. Scale the input video to a size of 200x100
  12245. @example
  12246. scale=w=200:h=100
  12247. @end example
  12248. This is equivalent to:
  12249. @example
  12250. scale=200:100
  12251. @end example
  12252. or:
  12253. @example
  12254. scale=200x100
  12255. @end example
  12256. @item
  12257. Specify a size abbreviation for the output size:
  12258. @example
  12259. scale=qcif
  12260. @end example
  12261. which can also be written as:
  12262. @example
  12263. scale=size=qcif
  12264. @end example
  12265. @item
  12266. Scale the input to 2x:
  12267. @example
  12268. scale=w=2*iw:h=2*ih
  12269. @end example
  12270. @item
  12271. The above is the same as:
  12272. @example
  12273. scale=2*in_w:2*in_h
  12274. @end example
  12275. @item
  12276. Scale the input to 2x with forced interlaced scaling:
  12277. @example
  12278. scale=2*iw:2*ih:interl=1
  12279. @end example
  12280. @item
  12281. Scale the input to half size:
  12282. @example
  12283. scale=w=iw/2:h=ih/2
  12284. @end example
  12285. @item
  12286. Increase the width, and set the height to the same size:
  12287. @example
  12288. scale=3/2*iw:ow
  12289. @end example
  12290. @item
  12291. Seek Greek harmony:
  12292. @example
  12293. scale=iw:1/PHI*iw
  12294. scale=ih*PHI:ih
  12295. @end example
  12296. @item
  12297. Increase the height, and set the width to 3/2 of the height:
  12298. @example
  12299. scale=w=3/2*oh:h=3/5*ih
  12300. @end example
  12301. @item
  12302. Increase the size, making the size a multiple of the chroma
  12303. subsample values:
  12304. @example
  12305. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12306. @end example
  12307. @item
  12308. Increase the width to a maximum of 500 pixels,
  12309. keeping the same aspect ratio as the input:
  12310. @example
  12311. scale=w='min(500\, iw*3/2):h=-1'
  12312. @end example
  12313. @item
  12314. Make pixels square by combining scale and setsar:
  12315. @example
  12316. scale='trunc(ih*dar):ih',setsar=1/1
  12317. @end example
  12318. @item
  12319. Make pixels square by combining scale and setsar,
  12320. making sure the resulting resolution is even (required by some codecs):
  12321. @example
  12322. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12323. @end example
  12324. @end itemize
  12325. @subsection Commands
  12326. This filter supports the following commands:
  12327. @table @option
  12328. @item width, w
  12329. @item height, h
  12330. Set the output video dimension expression.
  12331. The command accepts the same syntax of the corresponding option.
  12332. If the specified expression is not valid, it is kept at its current
  12333. value.
  12334. @end table
  12335. @section scale_npp
  12336. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12337. format conversion on CUDA video frames. Setting the output width and height
  12338. works in the same way as for the @var{scale} filter.
  12339. The following additional options are accepted:
  12340. @table @option
  12341. @item format
  12342. The pixel format of the output CUDA frames. If set to the string "same" (the
  12343. default), the input format will be kept. Note that automatic format negotiation
  12344. and conversion is not yet supported for hardware frames
  12345. @item interp_algo
  12346. The interpolation algorithm used for resizing. One of the following:
  12347. @table @option
  12348. @item nn
  12349. Nearest neighbour.
  12350. @item linear
  12351. @item cubic
  12352. @item cubic2p_bspline
  12353. 2-parameter cubic (B=1, C=0)
  12354. @item cubic2p_catmullrom
  12355. 2-parameter cubic (B=0, C=1/2)
  12356. @item cubic2p_b05c03
  12357. 2-parameter cubic (B=1/2, C=3/10)
  12358. @item super
  12359. Supersampling
  12360. @item lanczos
  12361. @end table
  12362. @item force_original_aspect_ratio
  12363. Enable decreasing or increasing output video width or height if necessary to
  12364. keep the original aspect ratio. Possible values:
  12365. @table @samp
  12366. @item disable
  12367. Scale the video as specified and disable this feature.
  12368. @item decrease
  12369. The output video dimensions will automatically be decreased if needed.
  12370. @item increase
  12371. The output video dimensions will automatically be increased if needed.
  12372. @end table
  12373. One useful instance of this option is that when you know a specific device's
  12374. maximum allowed resolution, you can use this to limit the output video to
  12375. that, while retaining the aspect ratio. For example, device A allows
  12376. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12377. decrease) and specifying 1280x720 to the command line makes the output
  12378. 1280x533.
  12379. Please note that this is a different thing than specifying -1 for @option{w}
  12380. or @option{h}, you still need to specify the output resolution for this option
  12381. to work.
  12382. @item force_divisible_by
  12383. Ensures that both the output dimensions, width and height, are divisible by the
  12384. given integer when used together with @option{force_original_aspect_ratio}. This
  12385. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12386. This option respects the value set for @option{force_original_aspect_ratio},
  12387. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12388. may be slightly modified.
  12389. This option can be handy if you need to have a video fit within or exceed
  12390. a defined resolution using @option{force_original_aspect_ratio} but also have
  12391. encoder restrictions on width or height divisibility.
  12392. @end table
  12393. @section scale2ref
  12394. Scale (resize) the input video, based on a reference video.
  12395. See the scale filter for available options, scale2ref supports the same but
  12396. uses the reference video instead of the main input as basis. scale2ref also
  12397. supports the following additional constants for the @option{w} and
  12398. @option{h} options:
  12399. @table @var
  12400. @item main_w
  12401. @item main_h
  12402. The main input video's width and height
  12403. @item main_a
  12404. The same as @var{main_w} / @var{main_h}
  12405. @item main_sar
  12406. The main input video's sample aspect ratio
  12407. @item main_dar, mdar
  12408. The main input video's display aspect ratio. Calculated from
  12409. @code{(main_w / main_h) * main_sar}.
  12410. @item main_hsub
  12411. @item main_vsub
  12412. The main input video's horizontal and vertical chroma subsample values.
  12413. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12414. is 1.
  12415. @end table
  12416. @subsection Examples
  12417. @itemize
  12418. @item
  12419. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12420. @example
  12421. 'scale2ref[b][a];[a][b]overlay'
  12422. @end example
  12423. @item
  12424. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12425. @example
  12426. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12427. @end example
  12428. @end itemize
  12429. @section scroll
  12430. Scroll input video horizontally and/or vertically by constant speed.
  12431. The filter accepts the following options:
  12432. @table @option
  12433. @item horizontal, h
  12434. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12435. Negative values changes scrolling direction.
  12436. @item vertical, v
  12437. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12438. Negative values changes scrolling direction.
  12439. @item hpos
  12440. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12441. @item vpos
  12442. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12443. @end table
  12444. @subsection Commands
  12445. This filter supports the following @ref{commands}:
  12446. @table @option
  12447. @item horizontal, h
  12448. Set the horizontal scrolling speed.
  12449. @item vertical, v
  12450. Set the vertical scrolling speed.
  12451. @end table
  12452. @anchor{selectivecolor}
  12453. @section selectivecolor
  12454. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12455. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12456. by the "purity" of the color (that is, how saturated it already is).
  12457. This filter is similar to the Adobe Photoshop Selective Color tool.
  12458. The filter accepts the following options:
  12459. @table @option
  12460. @item correction_method
  12461. Select color correction method.
  12462. Available values are:
  12463. @table @samp
  12464. @item absolute
  12465. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12466. component value).
  12467. @item relative
  12468. Specified adjustments are relative to the original component value.
  12469. @end table
  12470. Default is @code{absolute}.
  12471. @item reds
  12472. Adjustments for red pixels (pixels where the red component is the maximum)
  12473. @item yellows
  12474. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12475. @item greens
  12476. Adjustments for green pixels (pixels where the green component is the maximum)
  12477. @item cyans
  12478. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12479. @item blues
  12480. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12481. @item magentas
  12482. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12483. @item whites
  12484. Adjustments for white pixels (pixels where all components are greater than 128)
  12485. @item neutrals
  12486. Adjustments for all pixels except pure black and pure white
  12487. @item blacks
  12488. Adjustments for black pixels (pixels where all components are lesser than 128)
  12489. @item psfile
  12490. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12491. @end table
  12492. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12493. 4 space separated floating point adjustment values in the [-1,1] range,
  12494. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12495. pixels of its range.
  12496. @subsection Examples
  12497. @itemize
  12498. @item
  12499. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12500. increase magenta by 27% in blue areas:
  12501. @example
  12502. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12503. @end example
  12504. @item
  12505. Use a Photoshop selective color preset:
  12506. @example
  12507. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12508. @end example
  12509. @end itemize
  12510. @anchor{separatefields}
  12511. @section separatefields
  12512. The @code{separatefields} takes a frame-based video input and splits
  12513. each frame into its components fields, producing a new half height clip
  12514. with twice the frame rate and twice the frame count.
  12515. This filter use field-dominance information in frame to decide which
  12516. of each pair of fields to place first in the output.
  12517. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12518. @section setdar, setsar
  12519. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12520. output video.
  12521. This is done by changing the specified Sample (aka Pixel) Aspect
  12522. Ratio, according to the following equation:
  12523. @example
  12524. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12525. @end example
  12526. Keep in mind that the @code{setdar} filter does not modify the pixel
  12527. dimensions of the video frame. Also, the display aspect ratio set by
  12528. this filter may be changed by later filters in the filterchain,
  12529. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12530. applied.
  12531. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12532. the filter output video.
  12533. Note that as a consequence of the application of this filter, the
  12534. output display aspect ratio will change according to the equation
  12535. above.
  12536. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12537. filter may be changed by later filters in the filterchain, e.g. if
  12538. another "setsar" or a "setdar" filter is applied.
  12539. It accepts the following parameters:
  12540. @table @option
  12541. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12542. Set the aspect ratio used by the filter.
  12543. The parameter can be a floating point number string, an expression, or
  12544. a string of the form @var{num}:@var{den}, where @var{num} and
  12545. @var{den} are the numerator and denominator of the aspect ratio. If
  12546. the parameter is not specified, it is assumed the value "0".
  12547. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12548. should be escaped.
  12549. @item max
  12550. Set the maximum integer value to use for expressing numerator and
  12551. denominator when reducing the expressed aspect ratio to a rational.
  12552. Default value is @code{100}.
  12553. @end table
  12554. The parameter @var{sar} is an expression containing
  12555. the following constants:
  12556. @table @option
  12557. @item E, PI, PHI
  12558. These are approximated values for the mathematical constants e
  12559. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12560. @item w, h
  12561. The input width and height.
  12562. @item a
  12563. These are the same as @var{w} / @var{h}.
  12564. @item sar
  12565. The input sample aspect ratio.
  12566. @item dar
  12567. The input display aspect ratio. It is the same as
  12568. (@var{w} / @var{h}) * @var{sar}.
  12569. @item hsub, vsub
  12570. Horizontal and vertical chroma subsample values. For example, for the
  12571. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12572. @end table
  12573. @subsection Examples
  12574. @itemize
  12575. @item
  12576. To change the display aspect ratio to 16:9, specify one of the following:
  12577. @example
  12578. setdar=dar=1.77777
  12579. setdar=dar=16/9
  12580. @end example
  12581. @item
  12582. To change the sample aspect ratio to 10:11, specify:
  12583. @example
  12584. setsar=sar=10/11
  12585. @end example
  12586. @item
  12587. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12588. 1000 in the aspect ratio reduction, use the command:
  12589. @example
  12590. setdar=ratio=16/9:max=1000
  12591. @end example
  12592. @end itemize
  12593. @anchor{setfield}
  12594. @section setfield
  12595. Force field for the output video frame.
  12596. The @code{setfield} filter marks the interlace type field for the
  12597. output frames. It does not change the input frame, but only sets the
  12598. corresponding property, which affects how the frame is treated by
  12599. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12600. The filter accepts the following options:
  12601. @table @option
  12602. @item mode
  12603. Available values are:
  12604. @table @samp
  12605. @item auto
  12606. Keep the same field property.
  12607. @item bff
  12608. Mark the frame as bottom-field-first.
  12609. @item tff
  12610. Mark the frame as top-field-first.
  12611. @item prog
  12612. Mark the frame as progressive.
  12613. @end table
  12614. @end table
  12615. @anchor{setparams}
  12616. @section setparams
  12617. Force frame parameter for the output video frame.
  12618. The @code{setparams} filter marks interlace and color range for the
  12619. output frames. It does not change the input frame, but only sets the
  12620. corresponding property, which affects how the frame is treated by
  12621. filters/encoders.
  12622. @table @option
  12623. @item field_mode
  12624. Available values are:
  12625. @table @samp
  12626. @item auto
  12627. Keep the same field property (default).
  12628. @item bff
  12629. Mark the frame as bottom-field-first.
  12630. @item tff
  12631. Mark the frame as top-field-first.
  12632. @item prog
  12633. Mark the frame as progressive.
  12634. @end table
  12635. @item range
  12636. Available values are:
  12637. @table @samp
  12638. @item auto
  12639. Keep the same color range property (default).
  12640. @item unspecified, unknown
  12641. Mark the frame as unspecified color range.
  12642. @item limited, tv, mpeg
  12643. Mark the frame as limited range.
  12644. @item full, pc, jpeg
  12645. Mark the frame as full range.
  12646. @end table
  12647. @item color_primaries
  12648. Set the color primaries.
  12649. Available values are:
  12650. @table @samp
  12651. @item auto
  12652. Keep the same color primaries property (default).
  12653. @item bt709
  12654. @item unknown
  12655. @item bt470m
  12656. @item bt470bg
  12657. @item smpte170m
  12658. @item smpte240m
  12659. @item film
  12660. @item bt2020
  12661. @item smpte428
  12662. @item smpte431
  12663. @item smpte432
  12664. @item jedec-p22
  12665. @end table
  12666. @item color_trc
  12667. Set the color transfer.
  12668. Available values are:
  12669. @table @samp
  12670. @item auto
  12671. Keep the same color trc property (default).
  12672. @item bt709
  12673. @item unknown
  12674. @item bt470m
  12675. @item bt470bg
  12676. @item smpte170m
  12677. @item smpte240m
  12678. @item linear
  12679. @item log100
  12680. @item log316
  12681. @item iec61966-2-4
  12682. @item bt1361e
  12683. @item iec61966-2-1
  12684. @item bt2020-10
  12685. @item bt2020-12
  12686. @item smpte2084
  12687. @item smpte428
  12688. @item arib-std-b67
  12689. @end table
  12690. @item colorspace
  12691. Set the colorspace.
  12692. Available values are:
  12693. @table @samp
  12694. @item auto
  12695. Keep the same colorspace property (default).
  12696. @item gbr
  12697. @item bt709
  12698. @item unknown
  12699. @item fcc
  12700. @item bt470bg
  12701. @item smpte170m
  12702. @item smpte240m
  12703. @item ycgco
  12704. @item bt2020nc
  12705. @item bt2020c
  12706. @item smpte2085
  12707. @item chroma-derived-nc
  12708. @item chroma-derived-c
  12709. @item ictcp
  12710. @end table
  12711. @end table
  12712. @section showinfo
  12713. Show a line containing various information for each input video frame.
  12714. The input video is not modified.
  12715. This filter supports the following options:
  12716. @table @option
  12717. @item checksum
  12718. Calculate checksums of each plane. By default enabled.
  12719. @end table
  12720. The shown line contains a sequence of key/value pairs of the form
  12721. @var{key}:@var{value}.
  12722. The following values are shown in the output:
  12723. @table @option
  12724. @item n
  12725. The (sequential) number of the input frame, starting from 0.
  12726. @item pts
  12727. The Presentation TimeStamp of the input frame, expressed as a number of
  12728. time base units. The time base unit depends on the filter input pad.
  12729. @item pts_time
  12730. The Presentation TimeStamp of the input frame, expressed as a number of
  12731. seconds.
  12732. @item pos
  12733. The position of the frame in the input stream, or -1 if this information is
  12734. unavailable and/or meaningless (for example in case of synthetic video).
  12735. @item fmt
  12736. The pixel format name.
  12737. @item sar
  12738. The sample aspect ratio of the input frame, expressed in the form
  12739. @var{num}/@var{den}.
  12740. @item s
  12741. The size of the input frame. For the syntax of this option, check the
  12742. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12743. @item i
  12744. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12745. for bottom field first).
  12746. @item iskey
  12747. This is 1 if the frame is a key frame, 0 otherwise.
  12748. @item type
  12749. The picture type of the input frame ("I" for an I-frame, "P" for a
  12750. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12751. Also refer to the documentation of the @code{AVPictureType} enum and of
  12752. the @code{av_get_picture_type_char} function defined in
  12753. @file{libavutil/avutil.h}.
  12754. @item checksum
  12755. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12756. @item plane_checksum
  12757. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12758. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12759. @end table
  12760. @section showpalette
  12761. Displays the 256 colors palette of each frame. This filter is only relevant for
  12762. @var{pal8} pixel format frames.
  12763. It accepts the following option:
  12764. @table @option
  12765. @item s
  12766. Set the size of the box used to represent one palette color entry. Default is
  12767. @code{30} (for a @code{30x30} pixel box).
  12768. @end table
  12769. @section shuffleframes
  12770. Reorder and/or duplicate and/or drop video frames.
  12771. It accepts the following parameters:
  12772. @table @option
  12773. @item mapping
  12774. Set the destination indexes of input frames.
  12775. This is space or '|' separated list of indexes that maps input frames to output
  12776. frames. Number of indexes also sets maximal value that each index may have.
  12777. '-1' index have special meaning and that is to drop frame.
  12778. @end table
  12779. The first frame has the index 0. The default is to keep the input unchanged.
  12780. @subsection Examples
  12781. @itemize
  12782. @item
  12783. Swap second and third frame of every three frames of the input:
  12784. @example
  12785. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12786. @end example
  12787. @item
  12788. Swap 10th and 1st frame of every ten frames of the input:
  12789. @example
  12790. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12791. @end example
  12792. @end itemize
  12793. @section shuffleplanes
  12794. Reorder and/or duplicate video planes.
  12795. It accepts the following parameters:
  12796. @table @option
  12797. @item map0
  12798. The index of the input plane to be used as the first output plane.
  12799. @item map1
  12800. The index of the input plane to be used as the second output plane.
  12801. @item map2
  12802. The index of the input plane to be used as the third output plane.
  12803. @item map3
  12804. The index of the input plane to be used as the fourth output plane.
  12805. @end table
  12806. The first plane has the index 0. The default is to keep the input unchanged.
  12807. @subsection Examples
  12808. @itemize
  12809. @item
  12810. Swap the second and third planes of the input:
  12811. @example
  12812. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12813. @end example
  12814. @end itemize
  12815. @anchor{signalstats}
  12816. @section signalstats
  12817. Evaluate various visual metrics that assist in determining issues associated
  12818. with the digitization of analog video media.
  12819. By default the filter will log these metadata values:
  12820. @table @option
  12821. @item YMIN
  12822. Display the minimal Y value contained within the input frame. Expressed in
  12823. range of [0-255].
  12824. @item YLOW
  12825. Display the Y value at the 10% percentile within the input frame. Expressed in
  12826. range of [0-255].
  12827. @item YAVG
  12828. Display the average Y value within the input frame. Expressed in range of
  12829. [0-255].
  12830. @item YHIGH
  12831. Display the Y value at the 90% percentile within the input frame. Expressed in
  12832. range of [0-255].
  12833. @item YMAX
  12834. Display the maximum Y value contained within the input frame. Expressed in
  12835. range of [0-255].
  12836. @item UMIN
  12837. Display the minimal U value contained within the input frame. Expressed in
  12838. range of [0-255].
  12839. @item ULOW
  12840. Display the U value at the 10% percentile within the input frame. Expressed in
  12841. range of [0-255].
  12842. @item UAVG
  12843. Display the average U value within the input frame. Expressed in range of
  12844. [0-255].
  12845. @item UHIGH
  12846. Display the U value at the 90% percentile within the input frame. Expressed in
  12847. range of [0-255].
  12848. @item UMAX
  12849. Display the maximum U value contained within the input frame. Expressed in
  12850. range of [0-255].
  12851. @item VMIN
  12852. Display the minimal V value contained within the input frame. Expressed in
  12853. range of [0-255].
  12854. @item VLOW
  12855. Display the V value at the 10% percentile within the input frame. Expressed in
  12856. range of [0-255].
  12857. @item VAVG
  12858. Display the average V value within the input frame. Expressed in range of
  12859. [0-255].
  12860. @item VHIGH
  12861. Display the V value at the 90% percentile within the input frame. Expressed in
  12862. range of [0-255].
  12863. @item VMAX
  12864. Display the maximum V value contained within the input frame. Expressed in
  12865. range of [0-255].
  12866. @item SATMIN
  12867. Display the minimal saturation value contained within the input frame.
  12868. Expressed in range of [0-~181.02].
  12869. @item SATLOW
  12870. Display the saturation value at the 10% percentile within the input frame.
  12871. Expressed in range of [0-~181.02].
  12872. @item SATAVG
  12873. Display the average saturation value within the input frame. Expressed in range
  12874. of [0-~181.02].
  12875. @item SATHIGH
  12876. Display the saturation value at the 90% percentile within the input frame.
  12877. Expressed in range of [0-~181.02].
  12878. @item SATMAX
  12879. Display the maximum saturation value contained within the input frame.
  12880. Expressed in range of [0-~181.02].
  12881. @item HUEMED
  12882. Display the median value for hue within the input frame. Expressed in range of
  12883. [0-360].
  12884. @item HUEAVG
  12885. Display the average value for hue within the input frame. Expressed in range of
  12886. [0-360].
  12887. @item YDIF
  12888. Display the average of sample value difference between all values of the Y
  12889. plane in the current frame and corresponding values of the previous input frame.
  12890. Expressed in range of [0-255].
  12891. @item UDIF
  12892. Display the average of sample value difference between all values of the U
  12893. plane in the current frame and corresponding values of the previous input frame.
  12894. Expressed in range of [0-255].
  12895. @item VDIF
  12896. Display the average of sample value difference between all values of the V
  12897. plane in the current frame and corresponding values of the previous input frame.
  12898. Expressed in range of [0-255].
  12899. @item YBITDEPTH
  12900. Display bit depth of Y plane in current frame.
  12901. Expressed in range of [0-16].
  12902. @item UBITDEPTH
  12903. Display bit depth of U plane in current frame.
  12904. Expressed in range of [0-16].
  12905. @item VBITDEPTH
  12906. Display bit depth of V plane in current frame.
  12907. Expressed in range of [0-16].
  12908. @end table
  12909. The filter accepts the following options:
  12910. @table @option
  12911. @item stat
  12912. @item out
  12913. @option{stat} specify an additional form of image analysis.
  12914. @option{out} output video with the specified type of pixel highlighted.
  12915. Both options accept the following values:
  12916. @table @samp
  12917. @item tout
  12918. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12919. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12920. include the results of video dropouts, head clogs, or tape tracking issues.
  12921. @item vrep
  12922. Identify @var{vertical line repetition}. Vertical line repetition includes
  12923. similar rows of pixels within a frame. In born-digital video vertical line
  12924. repetition is common, but this pattern is uncommon in video digitized from an
  12925. analog source. When it occurs in video that results from the digitization of an
  12926. analog source it can indicate concealment from a dropout compensator.
  12927. @item brng
  12928. Identify pixels that fall outside of legal broadcast range.
  12929. @end table
  12930. @item color, c
  12931. Set the highlight color for the @option{out} option. The default color is
  12932. yellow.
  12933. @end table
  12934. @subsection Examples
  12935. @itemize
  12936. @item
  12937. Output data of various video metrics:
  12938. @example
  12939. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12940. @end example
  12941. @item
  12942. Output specific data about the minimum and maximum values of the Y plane per frame:
  12943. @example
  12944. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12945. @end example
  12946. @item
  12947. Playback video while highlighting pixels that are outside of broadcast range in red.
  12948. @example
  12949. ffplay example.mov -vf signalstats="out=brng:color=red"
  12950. @end example
  12951. @item
  12952. Playback video with signalstats metadata drawn over the frame.
  12953. @example
  12954. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12955. @end example
  12956. The contents of signalstat_drawtext.txt used in the command are:
  12957. @example
  12958. time %@{pts:hms@}
  12959. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12960. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12961. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12962. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12963. @end example
  12964. @end itemize
  12965. @anchor{signature}
  12966. @section signature
  12967. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12968. input. In this case the matching between the inputs can be calculated additionally.
  12969. The filter always passes through the first input. The signature of each stream can
  12970. be written into a file.
  12971. It accepts the following options:
  12972. @table @option
  12973. @item detectmode
  12974. Enable or disable the matching process.
  12975. Available values are:
  12976. @table @samp
  12977. @item off
  12978. Disable the calculation of a matching (default).
  12979. @item full
  12980. Calculate the matching for the whole video and output whether the whole video
  12981. matches or only parts.
  12982. @item fast
  12983. Calculate only until a matching is found or the video ends. Should be faster in
  12984. some cases.
  12985. @end table
  12986. @item nb_inputs
  12987. Set the number of inputs. The option value must be a non negative integer.
  12988. Default value is 1.
  12989. @item filename
  12990. Set the path to which the output is written. If there is more than one input,
  12991. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12992. integer), that will be replaced with the input number. If no filename is
  12993. specified, no output will be written. This is the default.
  12994. @item format
  12995. Choose the output format.
  12996. Available values are:
  12997. @table @samp
  12998. @item binary
  12999. Use the specified binary representation (default).
  13000. @item xml
  13001. Use the specified xml representation.
  13002. @end table
  13003. @item th_d
  13004. Set threshold to detect one word as similar. The option value must be an integer
  13005. greater than zero. The default value is 9000.
  13006. @item th_dc
  13007. Set threshold to detect all words as similar. The option value must be an integer
  13008. greater than zero. The default value is 60000.
  13009. @item th_xh
  13010. Set threshold to detect frames as similar. The option value must be an integer
  13011. greater than zero. The default value is 116.
  13012. @item th_di
  13013. Set the minimum length of a sequence in frames to recognize it as matching
  13014. sequence. The option value must be a non negative integer value.
  13015. The default value is 0.
  13016. @item th_it
  13017. Set the minimum relation, that matching frames to all frames must have.
  13018. The option value must be a double value between 0 and 1. The default value is 0.5.
  13019. @end table
  13020. @subsection Examples
  13021. @itemize
  13022. @item
  13023. To calculate the signature of an input video and store it in signature.bin:
  13024. @example
  13025. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13026. @end example
  13027. @item
  13028. To detect whether two videos match and store the signatures in XML format in
  13029. signature0.xml and signature1.xml:
  13030. @example
  13031. 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 -
  13032. @end example
  13033. @end itemize
  13034. @anchor{smartblur}
  13035. @section smartblur
  13036. Blur the input video without impacting the outlines.
  13037. It accepts the following options:
  13038. @table @option
  13039. @item luma_radius, lr
  13040. Set the luma radius. The option value must be a float number in
  13041. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13042. used to blur the image (slower if larger). Default value is 1.0.
  13043. @item luma_strength, ls
  13044. Set the luma strength. The option value must be a float number
  13045. in the range [-1.0,1.0] that configures the blurring. A value included
  13046. in [0.0,1.0] will blur the image whereas a value included in
  13047. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13048. @item luma_threshold, lt
  13049. Set the luma threshold used as a coefficient to determine
  13050. whether a pixel should be blurred or not. The option value must be an
  13051. integer in the range [-30,30]. A value of 0 will filter all the image,
  13052. a value included in [0,30] will filter flat areas and a value included
  13053. in [-30,0] will filter edges. Default value is 0.
  13054. @item chroma_radius, cr
  13055. Set the chroma radius. The option value must be a float number in
  13056. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13057. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13058. @item chroma_strength, cs
  13059. Set the chroma strength. The option value must be a float number
  13060. in the range [-1.0,1.0] that configures the blurring. A value included
  13061. in [0.0,1.0] will blur the image whereas a value included in
  13062. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13063. @item chroma_threshold, ct
  13064. Set the chroma threshold used as a coefficient to determine
  13065. whether a pixel should be blurred or not. The option value must be an
  13066. integer in the range [-30,30]. A value of 0 will filter all the image,
  13067. a value included in [0,30] will filter flat areas and a value included
  13068. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13069. @end table
  13070. If a chroma option is not explicitly set, the corresponding luma value
  13071. is set.
  13072. @section sobel
  13073. Apply sobel operator to input video stream.
  13074. The filter accepts the following option:
  13075. @table @option
  13076. @item planes
  13077. Set which planes will be processed, unprocessed planes will be copied.
  13078. By default value 0xf, all planes will be processed.
  13079. @item scale
  13080. Set value which will be multiplied with filtered result.
  13081. @item delta
  13082. Set value which will be added to filtered result.
  13083. @end table
  13084. @anchor{spp}
  13085. @section spp
  13086. Apply a simple postprocessing filter that compresses and decompresses the image
  13087. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13088. and average the results.
  13089. The filter accepts the following options:
  13090. @table @option
  13091. @item quality
  13092. Set quality. This option defines the number of levels for averaging. It accepts
  13093. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13094. effect. A value of @code{6} means the higher quality. For each increment of
  13095. that value the speed drops by a factor of approximately 2. Default value is
  13096. @code{3}.
  13097. @item qp
  13098. Force a constant quantization parameter. If not set, the filter will use the QP
  13099. from the video stream (if available).
  13100. @item mode
  13101. Set thresholding mode. Available modes are:
  13102. @table @samp
  13103. @item hard
  13104. Set hard thresholding (default).
  13105. @item soft
  13106. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13107. @end table
  13108. @item use_bframe_qp
  13109. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13110. option may cause flicker since the B-Frames have often larger QP. Default is
  13111. @code{0} (not enabled).
  13112. @end table
  13113. @section sr
  13114. Scale the input by applying one of the super-resolution methods based on
  13115. convolutional neural networks. Supported models:
  13116. @itemize
  13117. @item
  13118. Super-Resolution Convolutional Neural Network model (SRCNN).
  13119. See @url{https://arxiv.org/abs/1501.00092}.
  13120. @item
  13121. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13122. See @url{https://arxiv.org/abs/1609.05158}.
  13123. @end itemize
  13124. Training scripts as well as scripts for model file (.pb) saving can be found at
  13125. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13126. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13127. Native model files (.model) can be generated from TensorFlow model
  13128. files (.pb) by using tools/python/convert.py
  13129. The filter accepts the following options:
  13130. @table @option
  13131. @item dnn_backend
  13132. Specify which DNN backend to use for model loading and execution. This option accepts
  13133. the following values:
  13134. @table @samp
  13135. @item native
  13136. Native implementation of DNN loading and execution.
  13137. @item tensorflow
  13138. TensorFlow backend. To enable this backend you
  13139. need to install the TensorFlow for C library (see
  13140. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13141. @code{--enable-libtensorflow}
  13142. @end table
  13143. Default value is @samp{native}.
  13144. @item model
  13145. Set path to model file specifying network architecture and its parameters.
  13146. Note that different backends use different file formats. TensorFlow backend
  13147. can load files for both formats, while native backend can load files for only
  13148. its format.
  13149. @item scale_factor
  13150. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13151. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13152. input upscaled using bicubic upscaling with proper scale factor.
  13153. @end table
  13154. @section ssim
  13155. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13156. This filter takes in input two input videos, the first input is
  13157. considered the "main" source and is passed unchanged to the
  13158. output. The second input is used as a "reference" video for computing
  13159. the SSIM.
  13160. Both video inputs must have the same resolution and pixel format for
  13161. this filter to work correctly. Also it assumes that both inputs
  13162. have the same number of frames, which are compared one by one.
  13163. The filter stores the calculated SSIM of each frame.
  13164. The description of the accepted parameters follows.
  13165. @table @option
  13166. @item stats_file, f
  13167. If specified the filter will use the named file to save the SSIM of
  13168. each individual frame. When filename equals "-" the data is sent to
  13169. standard output.
  13170. @end table
  13171. The file printed if @var{stats_file} is selected, contains a sequence of
  13172. key/value pairs of the form @var{key}:@var{value} for each compared
  13173. couple of frames.
  13174. A description of each shown parameter follows:
  13175. @table @option
  13176. @item n
  13177. sequential number of the input frame, starting from 1
  13178. @item Y, U, V, R, G, B
  13179. SSIM of the compared frames for the component specified by the suffix.
  13180. @item All
  13181. SSIM of the compared frames for the whole frame.
  13182. @item dB
  13183. Same as above but in dB representation.
  13184. @end table
  13185. This filter also supports the @ref{framesync} options.
  13186. @subsection Examples
  13187. @itemize
  13188. @item
  13189. For example:
  13190. @example
  13191. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13192. [main][ref] ssim="stats_file=stats.log" [out]
  13193. @end example
  13194. On this example the input file being processed is compared with the
  13195. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13196. is stored in @file{stats.log}.
  13197. @item
  13198. Another example with both psnr and ssim at same time:
  13199. @example
  13200. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13201. @end example
  13202. @item
  13203. Another example with different containers:
  13204. @example
  13205. 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 -
  13206. @end example
  13207. @end itemize
  13208. @section stereo3d
  13209. Convert between different stereoscopic image formats.
  13210. The filters accept the following options:
  13211. @table @option
  13212. @item in
  13213. Set stereoscopic image format of input.
  13214. Available values for input image formats are:
  13215. @table @samp
  13216. @item sbsl
  13217. side by side parallel (left eye left, right eye right)
  13218. @item sbsr
  13219. side by side crosseye (right eye left, left eye right)
  13220. @item sbs2l
  13221. side by side parallel with half width resolution
  13222. (left eye left, right eye right)
  13223. @item sbs2r
  13224. side by side crosseye with half width resolution
  13225. (right eye left, left eye right)
  13226. @item abl
  13227. @item tbl
  13228. above-below (left eye above, right eye below)
  13229. @item abr
  13230. @item tbr
  13231. above-below (right eye above, left eye below)
  13232. @item ab2l
  13233. @item tb2l
  13234. above-below with half height resolution
  13235. (left eye above, right eye below)
  13236. @item ab2r
  13237. @item tb2r
  13238. above-below with half height resolution
  13239. (right eye above, left eye below)
  13240. @item al
  13241. alternating frames (left eye first, right eye second)
  13242. @item ar
  13243. alternating frames (right eye first, left eye second)
  13244. @item irl
  13245. interleaved rows (left eye has top row, right eye starts on next row)
  13246. @item irr
  13247. interleaved rows (right eye has top row, left eye starts on next row)
  13248. @item icl
  13249. interleaved columns, left eye first
  13250. @item icr
  13251. interleaved columns, right eye first
  13252. Default value is @samp{sbsl}.
  13253. @end table
  13254. @item out
  13255. Set stereoscopic image format of output.
  13256. @table @samp
  13257. @item sbsl
  13258. side by side parallel (left eye left, right eye right)
  13259. @item sbsr
  13260. side by side crosseye (right eye left, left eye right)
  13261. @item sbs2l
  13262. side by side parallel with half width resolution
  13263. (left eye left, right eye right)
  13264. @item sbs2r
  13265. side by side crosseye with half width resolution
  13266. (right eye left, left eye right)
  13267. @item abl
  13268. @item tbl
  13269. above-below (left eye above, right eye below)
  13270. @item abr
  13271. @item tbr
  13272. above-below (right eye above, left eye below)
  13273. @item ab2l
  13274. @item tb2l
  13275. above-below with half height resolution
  13276. (left eye above, right eye below)
  13277. @item ab2r
  13278. @item tb2r
  13279. above-below with half height resolution
  13280. (right eye above, left eye below)
  13281. @item al
  13282. alternating frames (left eye first, right eye second)
  13283. @item ar
  13284. alternating frames (right eye first, left eye second)
  13285. @item irl
  13286. interleaved rows (left eye has top row, right eye starts on next row)
  13287. @item irr
  13288. interleaved rows (right eye has top row, left eye starts on next row)
  13289. @item arbg
  13290. anaglyph red/blue gray
  13291. (red filter on left eye, blue filter on right eye)
  13292. @item argg
  13293. anaglyph red/green gray
  13294. (red filter on left eye, green filter on right eye)
  13295. @item arcg
  13296. anaglyph red/cyan gray
  13297. (red filter on left eye, cyan filter on right eye)
  13298. @item arch
  13299. anaglyph red/cyan half colored
  13300. (red filter on left eye, cyan filter on right eye)
  13301. @item arcc
  13302. anaglyph red/cyan color
  13303. (red filter on left eye, cyan filter on right eye)
  13304. @item arcd
  13305. anaglyph red/cyan color optimized with the least squares projection of dubois
  13306. (red filter on left eye, cyan filter on right eye)
  13307. @item agmg
  13308. anaglyph green/magenta gray
  13309. (green filter on left eye, magenta filter on right eye)
  13310. @item agmh
  13311. anaglyph green/magenta half colored
  13312. (green filter on left eye, magenta filter on right eye)
  13313. @item agmc
  13314. anaglyph green/magenta colored
  13315. (green filter on left eye, magenta filter on right eye)
  13316. @item agmd
  13317. anaglyph green/magenta color optimized with the least squares projection of dubois
  13318. (green filter on left eye, magenta filter on right eye)
  13319. @item aybg
  13320. anaglyph yellow/blue gray
  13321. (yellow filter on left eye, blue filter on right eye)
  13322. @item aybh
  13323. anaglyph yellow/blue half colored
  13324. (yellow filter on left eye, blue filter on right eye)
  13325. @item aybc
  13326. anaglyph yellow/blue colored
  13327. (yellow filter on left eye, blue filter on right eye)
  13328. @item aybd
  13329. anaglyph yellow/blue color optimized with the least squares projection of dubois
  13330. (yellow filter on left eye, blue filter on right eye)
  13331. @item ml
  13332. mono output (left eye only)
  13333. @item mr
  13334. mono output (right eye only)
  13335. @item chl
  13336. checkerboard, left eye first
  13337. @item chr
  13338. checkerboard, right eye first
  13339. @item icl
  13340. interleaved columns, left eye first
  13341. @item icr
  13342. interleaved columns, right eye first
  13343. @item hdmi
  13344. HDMI frame pack
  13345. @end table
  13346. Default value is @samp{arcd}.
  13347. @end table
  13348. @subsection Examples
  13349. @itemize
  13350. @item
  13351. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  13352. @example
  13353. stereo3d=sbsl:aybd
  13354. @end example
  13355. @item
  13356. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  13357. @example
  13358. stereo3d=abl:sbsr
  13359. @end example
  13360. @end itemize
  13361. @section streamselect, astreamselect
  13362. Select video or audio streams.
  13363. The filter accepts the following options:
  13364. @table @option
  13365. @item inputs
  13366. Set number of inputs. Default is 2.
  13367. @item map
  13368. Set input indexes to remap to outputs.
  13369. @end table
  13370. @subsection Commands
  13371. The @code{streamselect} and @code{astreamselect} filter supports the following
  13372. commands:
  13373. @table @option
  13374. @item map
  13375. Set input indexes to remap to outputs.
  13376. @end table
  13377. @subsection Examples
  13378. @itemize
  13379. @item
  13380. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13381. @example
  13382. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13383. @end example
  13384. @item
  13385. Same as above, but for audio:
  13386. @example
  13387. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13388. @end example
  13389. @end itemize
  13390. @anchor{subtitles}
  13391. @section subtitles
  13392. Draw subtitles on top of input video using the libass library.
  13393. To enable compilation of this filter you need to configure FFmpeg with
  13394. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13395. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13396. Alpha) subtitles format.
  13397. The filter accepts the following options:
  13398. @table @option
  13399. @item filename, f
  13400. Set the filename of the subtitle file to read. It must be specified.
  13401. @item original_size
  13402. Specify the size of the original video, the video for which the ASS file
  13403. was composed. For the syntax of this option, check the
  13404. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13405. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13406. correctly scale the fonts if the aspect ratio has been changed.
  13407. @item fontsdir
  13408. Set a directory path containing fonts that can be used by the filter.
  13409. These fonts will be used in addition to whatever the font provider uses.
  13410. @item alpha
  13411. Process alpha channel, by default alpha channel is untouched.
  13412. @item charenc
  13413. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13414. useful if not UTF-8.
  13415. @item stream_index, si
  13416. Set subtitles stream index. @code{subtitles} filter only.
  13417. @item force_style
  13418. Override default style or script info parameters of the subtitles. It accepts a
  13419. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13420. @end table
  13421. If the first key is not specified, it is assumed that the first value
  13422. specifies the @option{filename}.
  13423. For example, to render the file @file{sub.srt} on top of the input
  13424. video, use the command:
  13425. @example
  13426. subtitles=sub.srt
  13427. @end example
  13428. which is equivalent to:
  13429. @example
  13430. subtitles=filename=sub.srt
  13431. @end example
  13432. To render the default subtitles stream from file @file{video.mkv}, use:
  13433. @example
  13434. subtitles=video.mkv
  13435. @end example
  13436. To render the second subtitles stream from that file, use:
  13437. @example
  13438. subtitles=video.mkv:si=1
  13439. @end example
  13440. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13441. @code{DejaVu Serif}, use:
  13442. @example
  13443. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13444. @end example
  13445. @section super2xsai
  13446. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13447. Interpolate) pixel art scaling algorithm.
  13448. Useful for enlarging pixel art images without reducing sharpness.
  13449. @section swaprect
  13450. Swap two rectangular objects in video.
  13451. This filter accepts the following options:
  13452. @table @option
  13453. @item w
  13454. Set object width.
  13455. @item h
  13456. Set object height.
  13457. @item x1
  13458. Set 1st rect x coordinate.
  13459. @item y1
  13460. Set 1st rect y coordinate.
  13461. @item x2
  13462. Set 2nd rect x coordinate.
  13463. @item y2
  13464. Set 2nd rect y coordinate.
  13465. All expressions are evaluated once for each frame.
  13466. @end table
  13467. The all options are expressions containing the following constants:
  13468. @table @option
  13469. @item w
  13470. @item h
  13471. The input width and height.
  13472. @item a
  13473. same as @var{w} / @var{h}
  13474. @item sar
  13475. input sample aspect ratio
  13476. @item dar
  13477. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13478. @item n
  13479. The number of the input frame, starting from 0.
  13480. @item t
  13481. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13482. @item pos
  13483. the position in the file of the input frame, NAN if unknown
  13484. @end table
  13485. @section swapuv
  13486. Swap U & V plane.
  13487. @section telecine
  13488. Apply telecine process to the video.
  13489. This filter accepts the following options:
  13490. @table @option
  13491. @item first_field
  13492. @table @samp
  13493. @item top, t
  13494. top field first
  13495. @item bottom, b
  13496. bottom field first
  13497. The default value is @code{top}.
  13498. @end table
  13499. @item pattern
  13500. A string of numbers representing the pulldown pattern you wish to apply.
  13501. The default value is @code{23}.
  13502. @end table
  13503. @example
  13504. Some typical patterns:
  13505. NTSC output (30i):
  13506. 27.5p: 32222
  13507. 24p: 23 (classic)
  13508. 24p: 2332 (preferred)
  13509. 20p: 33
  13510. 18p: 334
  13511. 16p: 3444
  13512. PAL output (25i):
  13513. 27.5p: 12222
  13514. 24p: 222222222223 ("Euro pulldown")
  13515. 16.67p: 33
  13516. 16p: 33333334
  13517. @end example
  13518. @section thistogram
  13519. Compute and draw a color distribution histogram for the input video across time.
  13520. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  13521. at certain time, this filter shows also past histograms of number of frames defined
  13522. by @code{width} option.
  13523. The computed histogram is a representation of the color component
  13524. distribution in an image.
  13525. The filter accepts the following options:
  13526. @table @option
  13527. @item width, w
  13528. Set width of single color component output. Default value is @code{0}.
  13529. Value of @code{0} means width will be picked from input video.
  13530. This also set number of passed histograms to keep.
  13531. Allowed range is [0, 8192].
  13532. @item display_mode, d
  13533. Set display mode.
  13534. It accepts the following values:
  13535. @table @samp
  13536. @item stack
  13537. Per color component graphs are placed below each other.
  13538. @item parade
  13539. Per color component graphs are placed side by side.
  13540. @item overlay
  13541. Presents information identical to that in the @code{parade}, except
  13542. that the graphs representing color components are superimposed directly
  13543. over one another.
  13544. @end table
  13545. Default is @code{stack}.
  13546. @item levels_mode, m
  13547. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  13548. Default is @code{linear}.
  13549. @item components, c
  13550. Set what color components to display.
  13551. Default is @code{7}.
  13552. @item bgopacity, b
  13553. Set background opacity. Default is @code{0.9}.
  13554. @item envelope, e
  13555. Show envelope. Default is disabled.
  13556. @item ecolor, ec
  13557. Set envelope color. Default is @code{gold}.
  13558. @end table
  13559. @section threshold
  13560. Apply threshold effect to video stream.
  13561. This filter needs four video streams to perform thresholding.
  13562. First stream is stream we are filtering.
  13563. Second stream is holding threshold values, third stream is holding min values,
  13564. and last, fourth stream is holding max values.
  13565. The filter accepts the following option:
  13566. @table @option
  13567. @item planes
  13568. Set which planes will be processed, unprocessed planes will be copied.
  13569. By default value 0xf, all planes will be processed.
  13570. @end table
  13571. For example if first stream pixel's component value is less then threshold value
  13572. of pixel component from 2nd threshold stream, third stream value will picked,
  13573. otherwise fourth stream pixel component value will be picked.
  13574. Using color source filter one can perform various types of thresholding:
  13575. @subsection Examples
  13576. @itemize
  13577. @item
  13578. Binary threshold, using gray color as threshold:
  13579. @example
  13580. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13581. @end example
  13582. @item
  13583. Inverted binary threshold, using gray color as threshold:
  13584. @example
  13585. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13586. @end example
  13587. @item
  13588. Truncate binary threshold, using gray color as threshold:
  13589. @example
  13590. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13591. @end example
  13592. @item
  13593. Threshold to zero, using gray color as threshold:
  13594. @example
  13595. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13596. @end example
  13597. @item
  13598. Inverted threshold to zero, using gray color as threshold:
  13599. @example
  13600. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13601. @end example
  13602. @end itemize
  13603. @section thumbnail
  13604. Select the most representative frame in a given sequence of consecutive frames.
  13605. The filter accepts the following options:
  13606. @table @option
  13607. @item n
  13608. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13609. will pick one of them, and then handle the next batch of @var{n} frames until
  13610. the end. Default is @code{100}.
  13611. @end table
  13612. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13613. value will result in a higher memory usage, so a high value is not recommended.
  13614. @subsection Examples
  13615. @itemize
  13616. @item
  13617. Extract one picture each 50 frames:
  13618. @example
  13619. thumbnail=50
  13620. @end example
  13621. @item
  13622. Complete example of a thumbnail creation with @command{ffmpeg}:
  13623. @example
  13624. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13625. @end example
  13626. @end itemize
  13627. @section tile
  13628. Tile several successive frames together.
  13629. The filter accepts the following options:
  13630. @table @option
  13631. @item layout
  13632. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13633. this option, check the
  13634. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13635. @item nb_frames
  13636. Set the maximum number of frames to render in the given area. It must be less
  13637. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13638. the area will be used.
  13639. @item margin
  13640. Set the outer border margin in pixels.
  13641. @item padding
  13642. Set the inner border thickness (i.e. the number of pixels between frames). For
  13643. more advanced padding options (such as having different values for the edges),
  13644. refer to the pad video filter.
  13645. @item color
  13646. Specify the color of the unused area. For the syntax of this option, check the
  13647. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13648. The default value of @var{color} is "black".
  13649. @item overlap
  13650. Set the number of frames to overlap when tiling several successive frames together.
  13651. The value must be between @code{0} and @var{nb_frames - 1}.
  13652. @item init_padding
  13653. Set the number of frames to initially be empty before displaying first output frame.
  13654. This controls how soon will one get first output frame.
  13655. The value must be between @code{0} and @var{nb_frames - 1}.
  13656. @end table
  13657. @subsection Examples
  13658. @itemize
  13659. @item
  13660. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13661. @example
  13662. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13663. @end example
  13664. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13665. duplicating each output frame to accommodate the originally detected frame
  13666. rate.
  13667. @item
  13668. Display @code{5} pictures in an area of @code{3x2} frames,
  13669. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13670. mixed flat and named options:
  13671. @example
  13672. tile=3x2:nb_frames=5:padding=7:margin=2
  13673. @end example
  13674. @end itemize
  13675. @section tinterlace
  13676. Perform various types of temporal field interlacing.
  13677. Frames are counted starting from 1, so the first input frame is
  13678. considered odd.
  13679. The filter accepts the following options:
  13680. @table @option
  13681. @item mode
  13682. Specify the mode of the interlacing. This option can also be specified
  13683. as a value alone. See below for a list of values for this option.
  13684. Available values are:
  13685. @table @samp
  13686. @item merge, 0
  13687. Move odd frames into the upper field, even into the lower field,
  13688. generating a double height frame at half frame rate.
  13689. @example
  13690. ------> time
  13691. Input:
  13692. Frame 1 Frame 2 Frame 3 Frame 4
  13693. 11111 22222 33333 44444
  13694. 11111 22222 33333 44444
  13695. 11111 22222 33333 44444
  13696. 11111 22222 33333 44444
  13697. Output:
  13698. 11111 33333
  13699. 22222 44444
  13700. 11111 33333
  13701. 22222 44444
  13702. 11111 33333
  13703. 22222 44444
  13704. 11111 33333
  13705. 22222 44444
  13706. @end example
  13707. @item drop_even, 1
  13708. Only output odd frames, even frames are dropped, generating a frame with
  13709. unchanged height at half frame rate.
  13710. @example
  13711. ------> time
  13712. Input:
  13713. Frame 1 Frame 2 Frame 3 Frame 4
  13714. 11111 22222 33333 44444
  13715. 11111 22222 33333 44444
  13716. 11111 22222 33333 44444
  13717. 11111 22222 33333 44444
  13718. Output:
  13719. 11111 33333
  13720. 11111 33333
  13721. 11111 33333
  13722. 11111 33333
  13723. @end example
  13724. @item drop_odd, 2
  13725. Only output even frames, odd frames are dropped, generating a frame with
  13726. unchanged height at half frame rate.
  13727. @example
  13728. ------> time
  13729. Input:
  13730. Frame 1 Frame 2 Frame 3 Frame 4
  13731. 11111 22222 33333 44444
  13732. 11111 22222 33333 44444
  13733. 11111 22222 33333 44444
  13734. 11111 22222 33333 44444
  13735. Output:
  13736. 22222 44444
  13737. 22222 44444
  13738. 22222 44444
  13739. 22222 44444
  13740. @end example
  13741. @item pad, 3
  13742. Expand each frame to full height, but pad alternate lines with black,
  13743. generating a frame with double height at the same input frame rate.
  13744. @example
  13745. ------> time
  13746. Input:
  13747. Frame 1 Frame 2 Frame 3 Frame 4
  13748. 11111 22222 33333 44444
  13749. 11111 22222 33333 44444
  13750. 11111 22222 33333 44444
  13751. 11111 22222 33333 44444
  13752. Output:
  13753. 11111 ..... 33333 .....
  13754. ..... 22222 ..... 44444
  13755. 11111 ..... 33333 .....
  13756. ..... 22222 ..... 44444
  13757. 11111 ..... 33333 .....
  13758. ..... 22222 ..... 44444
  13759. 11111 ..... 33333 .....
  13760. ..... 22222 ..... 44444
  13761. @end example
  13762. @item interleave_top, 4
  13763. Interleave the upper field from odd frames with the lower field from
  13764. even frames, generating a frame with unchanged height at half frame rate.
  13765. @example
  13766. ------> time
  13767. Input:
  13768. Frame 1 Frame 2 Frame 3 Frame 4
  13769. 11111<- 22222 33333<- 44444
  13770. 11111 22222<- 33333 44444<-
  13771. 11111<- 22222 33333<- 44444
  13772. 11111 22222<- 33333 44444<-
  13773. Output:
  13774. 11111 33333
  13775. 22222 44444
  13776. 11111 33333
  13777. 22222 44444
  13778. @end example
  13779. @item interleave_bottom, 5
  13780. Interleave the lower field from odd frames with the upper field from
  13781. even frames, generating a frame with unchanged height at half frame rate.
  13782. @example
  13783. ------> time
  13784. Input:
  13785. Frame 1 Frame 2 Frame 3 Frame 4
  13786. 11111 22222<- 33333 44444<-
  13787. 11111<- 22222 33333<- 44444
  13788. 11111 22222<- 33333 44444<-
  13789. 11111<- 22222 33333<- 44444
  13790. Output:
  13791. 22222 44444
  13792. 11111 33333
  13793. 22222 44444
  13794. 11111 33333
  13795. @end example
  13796. @item interlacex2, 6
  13797. Double frame rate with unchanged height. Frames are inserted each
  13798. containing the second temporal field from the previous input frame and
  13799. the first temporal field from the next input frame. This mode relies on
  13800. the top_field_first flag. Useful for interlaced video displays with no
  13801. field synchronisation.
  13802. @example
  13803. ------> time
  13804. Input:
  13805. Frame 1 Frame 2 Frame 3 Frame 4
  13806. 11111 22222 33333 44444
  13807. 11111 22222 33333 44444
  13808. 11111 22222 33333 44444
  13809. 11111 22222 33333 44444
  13810. Output:
  13811. 11111 22222 22222 33333 33333 44444 44444
  13812. 11111 11111 22222 22222 33333 33333 44444
  13813. 11111 22222 22222 33333 33333 44444 44444
  13814. 11111 11111 22222 22222 33333 33333 44444
  13815. @end example
  13816. @item mergex2, 7
  13817. Move odd frames into the upper field, even into the lower field,
  13818. generating a double height frame at same frame rate.
  13819. @example
  13820. ------> time
  13821. Input:
  13822. Frame 1 Frame 2 Frame 3 Frame 4
  13823. 11111 22222 33333 44444
  13824. 11111 22222 33333 44444
  13825. 11111 22222 33333 44444
  13826. 11111 22222 33333 44444
  13827. Output:
  13828. 11111 33333 33333 55555
  13829. 22222 22222 44444 44444
  13830. 11111 33333 33333 55555
  13831. 22222 22222 44444 44444
  13832. 11111 33333 33333 55555
  13833. 22222 22222 44444 44444
  13834. 11111 33333 33333 55555
  13835. 22222 22222 44444 44444
  13836. @end example
  13837. @end table
  13838. Numeric values are deprecated but are accepted for backward
  13839. compatibility reasons.
  13840. Default mode is @code{merge}.
  13841. @item flags
  13842. Specify flags influencing the filter process.
  13843. Available value for @var{flags} is:
  13844. @table @option
  13845. @item low_pass_filter, vlpf
  13846. Enable linear vertical low-pass filtering in the filter.
  13847. Vertical low-pass filtering is required when creating an interlaced
  13848. destination from a progressive source which contains high-frequency
  13849. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13850. patterning.
  13851. @item complex_filter, cvlpf
  13852. Enable complex vertical low-pass filtering.
  13853. This will slightly less reduce interlace 'twitter' and Moire
  13854. patterning but better retain detail and subjective sharpness impression.
  13855. @item bypass_il
  13856. Bypass already interlaced frames, only adjust the frame rate.
  13857. @end table
  13858. Vertical low-pass filtering and bypassing already interlaced frames can only be
  13859. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  13860. @end table
  13861. @section tmix
  13862. Mix successive video frames.
  13863. A description of the accepted options follows.
  13864. @table @option
  13865. @item frames
  13866. The number of successive frames to mix. If unspecified, it defaults to 3.
  13867. @item weights
  13868. Specify weight of each input video frame.
  13869. Each weight is separated by space. If number of weights is smaller than
  13870. number of @var{frames} last specified weight will be used for all remaining
  13871. unset weights.
  13872. @item scale
  13873. Specify scale, if it is set it will be multiplied with sum
  13874. of each weight multiplied with pixel values to give final destination
  13875. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13876. @end table
  13877. @subsection Examples
  13878. @itemize
  13879. @item
  13880. Average 7 successive frames:
  13881. @example
  13882. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13883. @end example
  13884. @item
  13885. Apply simple temporal convolution:
  13886. @example
  13887. tmix=frames=3:weights="-1 3 -1"
  13888. @end example
  13889. @item
  13890. Similar as above but only showing temporal differences:
  13891. @example
  13892. tmix=frames=3:weights="-1 2 -1":scale=1
  13893. @end example
  13894. @end itemize
  13895. @anchor{tonemap}
  13896. @section tonemap
  13897. Tone map colors from different dynamic ranges.
  13898. This filter expects data in single precision floating point, as it needs to
  13899. operate on (and can output) out-of-range values. Another filter, such as
  13900. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13901. The tonemapping algorithms implemented only work on linear light, so input
  13902. data should be linearized beforehand (and possibly correctly tagged).
  13903. @example
  13904. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13905. @end example
  13906. @subsection Options
  13907. The filter accepts the following options.
  13908. @table @option
  13909. @item tonemap
  13910. Set the tone map algorithm to use.
  13911. Possible values are:
  13912. @table @var
  13913. @item none
  13914. Do not apply any tone map, only desaturate overbright pixels.
  13915. @item clip
  13916. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13917. in-range values, while distorting out-of-range values.
  13918. @item linear
  13919. Stretch the entire reference gamut to a linear multiple of the display.
  13920. @item gamma
  13921. Fit a logarithmic transfer between the tone curves.
  13922. @item reinhard
  13923. Preserve overall image brightness with a simple curve, using nonlinear
  13924. contrast, which results in flattening details and degrading color accuracy.
  13925. @item hable
  13926. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13927. of slightly darkening everything. Use it when detail preservation is more
  13928. important than color and brightness accuracy.
  13929. @item mobius
  13930. Smoothly map out-of-range values, while retaining contrast and colors for
  13931. in-range material as much as possible. Use it when color accuracy is more
  13932. important than detail preservation.
  13933. @end table
  13934. Default is none.
  13935. @item param
  13936. Tune the tone mapping algorithm.
  13937. This affects the following algorithms:
  13938. @table @var
  13939. @item none
  13940. Ignored.
  13941. @item linear
  13942. Specifies the scale factor to use while stretching.
  13943. Default to 1.0.
  13944. @item gamma
  13945. Specifies the exponent of the function.
  13946. Default to 1.8.
  13947. @item clip
  13948. Specify an extra linear coefficient to multiply into the signal before clipping.
  13949. Default to 1.0.
  13950. @item reinhard
  13951. Specify the local contrast coefficient at the display peak.
  13952. Default to 0.5, which means that in-gamut values will be about half as bright
  13953. as when clipping.
  13954. @item hable
  13955. Ignored.
  13956. @item mobius
  13957. Specify the transition point from linear to mobius transform. Every value
  13958. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13959. more accurate the result will be, at the cost of losing bright details.
  13960. Default to 0.3, which due to the steep initial slope still preserves in-range
  13961. colors fairly accurately.
  13962. @end table
  13963. @item desat
  13964. Apply desaturation for highlights that exceed this level of brightness. The
  13965. higher the parameter, the more color information will be preserved. This
  13966. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13967. (smoothly) turning into white instead. This makes images feel more natural,
  13968. at the cost of reducing information about out-of-range colors.
  13969. The default of 2.0 is somewhat conservative and will mostly just apply to
  13970. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13971. This option works only if the input frame has a supported color tag.
  13972. @item peak
  13973. Override signal/nominal/reference peak with this value. Useful when the
  13974. embedded peak information in display metadata is not reliable or when tone
  13975. mapping from a lower range to a higher range.
  13976. @end table
  13977. @section tpad
  13978. Temporarily pad video frames.
  13979. The filter accepts the following options:
  13980. @table @option
  13981. @item start
  13982. Specify number of delay frames before input video stream.
  13983. @item stop
  13984. Specify number of padding frames after input video stream.
  13985. Set to -1 to pad indefinitely.
  13986. @item start_mode
  13987. Set kind of frames added to beginning of stream.
  13988. Can be either @var{add} or @var{clone}.
  13989. With @var{add} frames of solid-color are added.
  13990. With @var{clone} frames are clones of first frame.
  13991. @item stop_mode
  13992. Set kind of frames added to end of stream.
  13993. Can be either @var{add} or @var{clone}.
  13994. With @var{add} frames of solid-color are added.
  13995. With @var{clone} frames are clones of last frame.
  13996. @item start_duration, stop_duration
  13997. Specify the duration of the start/stop delay. See
  13998. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13999. for the accepted syntax.
  14000. These options override @var{start} and @var{stop}.
  14001. @item color
  14002. Specify the color of the padded area. For the syntax of this option,
  14003. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14004. manual,ffmpeg-utils}.
  14005. The default value of @var{color} is "black".
  14006. @end table
  14007. @anchor{transpose}
  14008. @section transpose
  14009. Transpose rows with columns in the input video and optionally flip it.
  14010. It accepts the following parameters:
  14011. @table @option
  14012. @item dir
  14013. Specify the transposition direction.
  14014. Can assume the following values:
  14015. @table @samp
  14016. @item 0, 4, cclock_flip
  14017. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14018. @example
  14019. L.R L.l
  14020. . . -> . .
  14021. l.r R.r
  14022. @end example
  14023. @item 1, 5, clock
  14024. Rotate by 90 degrees clockwise, that is:
  14025. @example
  14026. L.R l.L
  14027. . . -> . .
  14028. l.r r.R
  14029. @end example
  14030. @item 2, 6, cclock
  14031. Rotate by 90 degrees counterclockwise, that is:
  14032. @example
  14033. L.R R.r
  14034. . . -> . .
  14035. l.r L.l
  14036. @end example
  14037. @item 3, 7, clock_flip
  14038. Rotate by 90 degrees clockwise and vertically flip, that is:
  14039. @example
  14040. L.R r.R
  14041. . . -> . .
  14042. l.r l.L
  14043. @end example
  14044. @end table
  14045. For values between 4-7, the transposition is only done if the input
  14046. video geometry is portrait and not landscape. These values are
  14047. deprecated, the @code{passthrough} option should be used instead.
  14048. Numerical values are deprecated, and should be dropped in favor of
  14049. symbolic constants.
  14050. @item passthrough
  14051. Do not apply the transposition if the input geometry matches the one
  14052. specified by the specified value. It accepts the following values:
  14053. @table @samp
  14054. @item none
  14055. Always apply transposition.
  14056. @item portrait
  14057. Preserve portrait geometry (when @var{height} >= @var{width}).
  14058. @item landscape
  14059. Preserve landscape geometry (when @var{width} >= @var{height}).
  14060. @end table
  14061. Default value is @code{none}.
  14062. @end table
  14063. For example to rotate by 90 degrees clockwise and preserve portrait
  14064. layout:
  14065. @example
  14066. transpose=dir=1:passthrough=portrait
  14067. @end example
  14068. The command above can also be specified as:
  14069. @example
  14070. transpose=1:portrait
  14071. @end example
  14072. @section transpose_npp
  14073. Transpose rows with columns in the input video and optionally flip it.
  14074. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14075. It accepts the following parameters:
  14076. @table @option
  14077. @item dir
  14078. Specify the transposition direction.
  14079. Can assume the following values:
  14080. @table @samp
  14081. @item cclock_flip
  14082. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14083. @item clock
  14084. Rotate by 90 degrees clockwise.
  14085. @item cclock
  14086. Rotate by 90 degrees counterclockwise.
  14087. @item clock_flip
  14088. Rotate by 90 degrees clockwise and vertically flip.
  14089. @end table
  14090. @item passthrough
  14091. Do not apply the transposition if the input geometry matches the one
  14092. specified by the specified value. It accepts the following values:
  14093. @table @samp
  14094. @item none
  14095. Always apply transposition. (default)
  14096. @item portrait
  14097. Preserve portrait geometry (when @var{height} >= @var{width}).
  14098. @item landscape
  14099. Preserve landscape geometry (when @var{width} >= @var{height}).
  14100. @end table
  14101. @end table
  14102. @section trim
  14103. Trim the input so that the output contains one continuous subpart of the input.
  14104. It accepts the following parameters:
  14105. @table @option
  14106. @item start
  14107. Specify the time of the start of the kept section, i.e. the frame with the
  14108. timestamp @var{start} will be the first frame in the output.
  14109. @item end
  14110. Specify the time of the first frame that will be dropped, i.e. the frame
  14111. immediately preceding the one with the timestamp @var{end} will be the last
  14112. frame in the output.
  14113. @item start_pts
  14114. This is the same as @var{start}, except this option sets the start timestamp
  14115. in timebase units instead of seconds.
  14116. @item end_pts
  14117. This is the same as @var{end}, except this option sets the end timestamp
  14118. in timebase units instead of seconds.
  14119. @item duration
  14120. The maximum duration of the output in seconds.
  14121. @item start_frame
  14122. The number of the first frame that should be passed to the output.
  14123. @item end_frame
  14124. The number of the first frame that should be dropped.
  14125. @end table
  14126. @option{start}, @option{end}, and @option{duration} are expressed as time
  14127. duration specifications; see
  14128. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14129. for the accepted syntax.
  14130. Note that the first two sets of the start/end options and the @option{duration}
  14131. option look at the frame timestamp, while the _frame variants simply count the
  14132. frames that pass through the filter. Also note that this filter does not modify
  14133. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14134. setpts filter after the trim filter.
  14135. If multiple start or end options are set, this filter tries to be greedy and
  14136. keep all the frames that match at least one of the specified constraints. To keep
  14137. only the part that matches all the constraints at once, chain multiple trim
  14138. filters.
  14139. The defaults are such that all the input is kept. So it is possible to set e.g.
  14140. just the end values to keep everything before the specified time.
  14141. Examples:
  14142. @itemize
  14143. @item
  14144. Drop everything except the second minute of input:
  14145. @example
  14146. ffmpeg -i INPUT -vf trim=60:120
  14147. @end example
  14148. @item
  14149. Keep only the first second:
  14150. @example
  14151. ffmpeg -i INPUT -vf trim=duration=1
  14152. @end example
  14153. @end itemize
  14154. @section unpremultiply
  14155. Apply alpha unpremultiply effect to input video stream using first plane
  14156. of second stream as alpha.
  14157. Both streams must have same dimensions and same pixel format.
  14158. The filter accepts the following option:
  14159. @table @option
  14160. @item planes
  14161. Set which planes will be processed, unprocessed planes will be copied.
  14162. By default value 0xf, all planes will be processed.
  14163. If the format has 1 or 2 components, then luma is bit 0.
  14164. If the format has 3 or 4 components:
  14165. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14166. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14167. If present, the alpha channel is always the last bit.
  14168. @item inplace
  14169. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14170. @end table
  14171. @anchor{unsharp}
  14172. @section unsharp
  14173. Sharpen or blur the input video.
  14174. It accepts the following parameters:
  14175. @table @option
  14176. @item luma_msize_x, lx
  14177. Set the luma matrix horizontal size. It must be an odd integer between
  14178. 3 and 23. The default value is 5.
  14179. @item luma_msize_y, ly
  14180. Set the luma matrix vertical size. It must be an odd integer between 3
  14181. and 23. The default value is 5.
  14182. @item luma_amount, la
  14183. Set the luma effect strength. It must be a floating point number, reasonable
  14184. values lay between -1.5 and 1.5.
  14185. Negative values will blur the input video, while positive values will
  14186. sharpen it, a value of zero will disable the effect.
  14187. Default value is 1.0.
  14188. @item chroma_msize_x, cx
  14189. Set the chroma matrix horizontal size. It must be an odd integer
  14190. between 3 and 23. The default value is 5.
  14191. @item chroma_msize_y, cy
  14192. Set the chroma matrix vertical size. It must be an odd integer
  14193. between 3 and 23. The default value is 5.
  14194. @item chroma_amount, ca
  14195. Set the chroma effect strength. It must be a floating point number, reasonable
  14196. values lay between -1.5 and 1.5.
  14197. Negative values will blur the input video, while positive values will
  14198. sharpen it, a value of zero will disable the effect.
  14199. Default value is 0.0.
  14200. @end table
  14201. All parameters are optional and default to the equivalent of the
  14202. string '5:5:1.0:5:5:0.0'.
  14203. @subsection Examples
  14204. @itemize
  14205. @item
  14206. Apply strong luma sharpen effect:
  14207. @example
  14208. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14209. @end example
  14210. @item
  14211. Apply a strong blur of both luma and chroma parameters:
  14212. @example
  14213. unsharp=7:7:-2:7:7:-2
  14214. @end example
  14215. @end itemize
  14216. @section uspp
  14217. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14218. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14219. shifts and average the results.
  14220. The way this differs from the behavior of spp is that uspp actually encodes &
  14221. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14222. DCT similar to MJPEG.
  14223. The filter accepts the following options:
  14224. @table @option
  14225. @item quality
  14226. Set quality. This option defines the number of levels for averaging. It accepts
  14227. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14228. effect. A value of @code{8} means the higher quality. For each increment of
  14229. that value the speed drops by a factor of approximately 2. Default value is
  14230. @code{3}.
  14231. @item qp
  14232. Force a constant quantization parameter. If not set, the filter will use the QP
  14233. from the video stream (if available).
  14234. @end table
  14235. @section v360
  14236. Convert 360 videos between various formats.
  14237. The filter accepts the following options:
  14238. @table @option
  14239. @item input
  14240. @item output
  14241. Set format of the input/output video.
  14242. Available formats:
  14243. @table @samp
  14244. @item e
  14245. @item equirect
  14246. Equirectangular projection.
  14247. @item c3x2
  14248. @item c6x1
  14249. @item c1x6
  14250. Cubemap with 3x2/6x1/1x6 layout.
  14251. Format specific options:
  14252. @table @option
  14253. @item in_pad
  14254. @item out_pad
  14255. Set padding proportion for the input/output cubemap. Values in decimals.
  14256. Example values:
  14257. @table @samp
  14258. @item 0
  14259. No padding.
  14260. @item 0.01
  14261. 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)
  14262. @end table
  14263. Default value is @b{@samp{0}}.
  14264. @item fin_pad
  14265. @item fout_pad
  14266. Set fixed padding for the input/output cubemap. Values in pixels.
  14267. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  14268. @item in_forder
  14269. @item out_forder
  14270. Set order of faces for the input/output cubemap. Choose one direction for each position.
  14271. Designation of directions:
  14272. @table @samp
  14273. @item r
  14274. right
  14275. @item l
  14276. left
  14277. @item u
  14278. up
  14279. @item d
  14280. down
  14281. @item f
  14282. forward
  14283. @item b
  14284. back
  14285. @end table
  14286. Default value is @b{@samp{rludfb}}.
  14287. @item in_frot
  14288. @item out_frot
  14289. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  14290. Designation of angles:
  14291. @table @samp
  14292. @item 0
  14293. 0 degrees clockwise
  14294. @item 1
  14295. 90 degrees clockwise
  14296. @item 2
  14297. 180 degrees clockwise
  14298. @item 3
  14299. 270 degrees clockwise
  14300. @end table
  14301. Default value is @b{@samp{000000}}.
  14302. @end table
  14303. @item eac
  14304. Equi-Angular Cubemap.
  14305. @item flat
  14306. @item gnomonic
  14307. @item rectilinear
  14308. Regular video. @i{(output only)}
  14309. Format specific options:
  14310. @table @option
  14311. @item h_fov
  14312. @item v_fov
  14313. @item d_fov
  14314. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14315. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14316. @end table
  14317. @item dfisheye
  14318. Dual fisheye.
  14319. Format specific options:
  14320. @table @option
  14321. @item in_pad
  14322. @item out_pad
  14323. Set padding proportion. Values in decimals.
  14324. Example values:
  14325. @table @samp
  14326. @item 0
  14327. No padding.
  14328. @item 0.01
  14329. 1% padding.
  14330. @end table
  14331. Default value is @b{@samp{0}}.
  14332. @end table
  14333. @item barrel
  14334. @item fb
  14335. Facebook's 360 format.
  14336. @item sg
  14337. Stereographic format.
  14338. Format specific options:
  14339. @table @option
  14340. @item h_fov
  14341. @item v_fov
  14342. @item d_fov
  14343. Set horizontal/vertical/diagonal field of view. Values in degrees.
  14344. If diagonal field of view is set it overrides horizontal and vertical field of view.
  14345. @end table
  14346. @item mercator
  14347. Mercator format.
  14348. @item ball
  14349. Ball format, gives significant distortion toward the back.
  14350. @item hammer
  14351. Hammer-Aitoff map projection format.
  14352. @item sinusoidal
  14353. Sinusoidal map projection format.
  14354. @end table
  14355. @item interp
  14356. Set interpolation method.@*
  14357. @i{Note: more complex interpolation methods require much more memory to run.}
  14358. Available methods:
  14359. @table @samp
  14360. @item near
  14361. @item nearest
  14362. Nearest neighbour.
  14363. @item line
  14364. @item linear
  14365. Bilinear interpolation.
  14366. @item cube
  14367. @item cubic
  14368. Bicubic interpolation.
  14369. @item lanc
  14370. @item lanczos
  14371. Lanczos interpolation.
  14372. @end table
  14373. Default value is @b{@samp{line}}.
  14374. @item w
  14375. @item h
  14376. Set the output video resolution.
  14377. Default resolution depends on formats.
  14378. @item in_stereo
  14379. @item out_stereo
  14380. Set the input/output stereo format.
  14381. @table @samp
  14382. @item 2d
  14383. 2D mono
  14384. @item sbs
  14385. Side by side
  14386. @item tb
  14387. Top bottom
  14388. @end table
  14389. Default value is @b{@samp{2d}} for input and output format.
  14390. @item yaw
  14391. @item pitch
  14392. @item roll
  14393. Set rotation for the output video. Values in degrees.
  14394. @item rorder
  14395. Set rotation order for the output video. Choose one item for each position.
  14396. @table @samp
  14397. @item y, Y
  14398. yaw
  14399. @item p, P
  14400. pitch
  14401. @item r, R
  14402. roll
  14403. @end table
  14404. Default value is @b{@samp{ypr}}.
  14405. @item h_flip
  14406. @item v_flip
  14407. @item d_flip
  14408. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  14409. @item ih_flip
  14410. @item iv_flip
  14411. Set if input video is flipped horizontally/vertically. Boolean values.
  14412. @item in_trans
  14413. Set if input video is transposed. Boolean value, by default disabled.
  14414. @item out_trans
  14415. Set if output video needs to be transposed. Boolean value, by default disabled.
  14416. @end table
  14417. @subsection Examples
  14418. @itemize
  14419. @item
  14420. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14421. @example
  14422. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14423. @end example
  14424. @item
  14425. Extract back view of Equi-Angular Cubemap:
  14426. @example
  14427. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14428. @end example
  14429. @item
  14430. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14431. @example
  14432. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14433. @end example
  14434. @end itemize
  14435. @section vaguedenoiser
  14436. Apply a wavelet based denoiser.
  14437. It transforms each frame from the video input into the wavelet domain,
  14438. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14439. the obtained coefficients. It does an inverse wavelet transform after.
  14440. Due to wavelet properties, it should give a nice smoothed result, and
  14441. reduced noise, without blurring picture features.
  14442. This filter accepts the following options:
  14443. @table @option
  14444. @item threshold
  14445. The filtering strength. The higher, the more filtered the video will be.
  14446. Hard thresholding can use a higher threshold than soft thresholding
  14447. before the video looks overfiltered. Default value is 2.
  14448. @item method
  14449. The filtering method the filter will use.
  14450. It accepts the following values:
  14451. @table @samp
  14452. @item hard
  14453. All values under the threshold will be zeroed.
  14454. @item soft
  14455. All values under the threshold will be zeroed. All values above will be
  14456. reduced by the threshold.
  14457. @item garrote
  14458. Scales or nullifies coefficients - intermediary between (more) soft and
  14459. (less) hard thresholding.
  14460. @end table
  14461. Default is garrote.
  14462. @item nsteps
  14463. Number of times, the wavelet will decompose the picture. Picture can't
  14464. be decomposed beyond a particular point (typically, 8 for a 640x480
  14465. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14466. @item percent
  14467. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14468. @item planes
  14469. A list of the planes to process. By default all planes are processed.
  14470. @end table
  14471. @section vectorscope
  14472. Display 2 color component values in the two dimensional graph (which is called
  14473. a vectorscope).
  14474. This filter accepts the following options:
  14475. @table @option
  14476. @item mode, m
  14477. Set vectorscope mode.
  14478. It accepts the following values:
  14479. @table @samp
  14480. @item gray
  14481. @item tint
  14482. Gray values are displayed on graph, higher brightness means more pixels have
  14483. same component color value on location in graph. This is the default mode.
  14484. @item color
  14485. Gray values are displayed on graph. Surrounding pixels values which are not
  14486. present in video frame are drawn in gradient of 2 color components which are
  14487. set by option @code{x} and @code{y}. The 3rd color component is static.
  14488. @item color2
  14489. Actual color components values present in video frame are displayed on graph.
  14490. @item color3
  14491. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14492. on graph increases value of another color component, which is luminance by
  14493. default values of @code{x} and @code{y}.
  14494. @item color4
  14495. Actual colors present in video frame are displayed on graph. If two different
  14496. colors map to same position on graph then color with higher value of component
  14497. not present in graph is picked.
  14498. @item color5
  14499. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14500. component picked from radial gradient.
  14501. @end table
  14502. @item x
  14503. Set which color component will be represented on X-axis. Default is @code{1}.
  14504. @item y
  14505. Set which color component will be represented on Y-axis. Default is @code{2}.
  14506. @item intensity, i
  14507. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14508. of color component which represents frequency of (X, Y) location in graph.
  14509. @item envelope, e
  14510. @table @samp
  14511. @item none
  14512. No envelope, this is default.
  14513. @item instant
  14514. Instant envelope, even darkest single pixel will be clearly highlighted.
  14515. @item peak
  14516. Hold maximum and minimum values presented in graph over time. This way you
  14517. can still spot out of range values without constantly looking at vectorscope.
  14518. @item peak+instant
  14519. Peak and instant envelope combined together.
  14520. @end table
  14521. @item graticule, g
  14522. Set what kind of graticule to draw.
  14523. @table @samp
  14524. @item none
  14525. @item green
  14526. @item color
  14527. @item invert
  14528. @end table
  14529. @item opacity, o
  14530. Set graticule opacity.
  14531. @item flags, f
  14532. Set graticule flags.
  14533. @table @samp
  14534. @item white
  14535. Draw graticule for white point.
  14536. @item black
  14537. Draw graticule for black point.
  14538. @item name
  14539. Draw color points short names.
  14540. @end table
  14541. @item bgopacity, b
  14542. Set background opacity.
  14543. @item lthreshold, l
  14544. Set low threshold for color component not represented on X or Y axis.
  14545. Values lower than this value will be ignored. Default is 0.
  14546. Note this value is multiplied with actual max possible value one pixel component
  14547. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14548. is 0.1 * 255 = 25.
  14549. @item hthreshold, h
  14550. Set high threshold for color component not represented on X or Y axis.
  14551. Values higher than this value will be ignored. Default is 1.
  14552. Note this value is multiplied with actual max possible value one pixel component
  14553. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14554. is 0.9 * 255 = 230.
  14555. @item colorspace, c
  14556. Set what kind of colorspace to use when drawing graticule.
  14557. @table @samp
  14558. @item auto
  14559. @item 601
  14560. @item 709
  14561. @end table
  14562. Default is auto.
  14563. @item tint0, t0
  14564. @item tint1, t1
  14565. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  14566. This means no tint, and output will remain gray.
  14567. @end table
  14568. @anchor{vidstabdetect}
  14569. @section vidstabdetect
  14570. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14571. @ref{vidstabtransform} for pass 2.
  14572. This filter generates a file with relative translation and rotation
  14573. transform information about subsequent frames, which is then used by
  14574. the @ref{vidstabtransform} filter.
  14575. To enable compilation of this filter you need to configure FFmpeg with
  14576. @code{--enable-libvidstab}.
  14577. This filter accepts the following options:
  14578. @table @option
  14579. @item result
  14580. Set the path to the file used to write the transforms information.
  14581. Default value is @file{transforms.trf}.
  14582. @item shakiness
  14583. Set how shaky the video is and how quick the camera is. It accepts an
  14584. integer in the range 1-10, a value of 1 means little shakiness, a
  14585. value of 10 means strong shakiness. Default value is 5.
  14586. @item accuracy
  14587. Set the accuracy of the detection process. It must be a value in the
  14588. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14589. accuracy. Default value is 15.
  14590. @item stepsize
  14591. Set stepsize of the search process. The region around minimum is
  14592. scanned with 1 pixel resolution. Default value is 6.
  14593. @item mincontrast
  14594. Set minimum contrast. Below this value a local measurement field is
  14595. discarded. Must be a floating point value in the range 0-1. Default
  14596. value is 0.3.
  14597. @item tripod
  14598. Set reference frame number for tripod mode.
  14599. If enabled, the motion of the frames is compared to a reference frame
  14600. in the filtered stream, identified by the specified number. The idea
  14601. is to compensate all movements in a more-or-less static scene and keep
  14602. the camera view absolutely still.
  14603. If set to 0, it is disabled. The frames are counted starting from 1.
  14604. @item show
  14605. Show fields and transforms in the resulting frames. It accepts an
  14606. integer in the range 0-2. Default value is 0, which disables any
  14607. visualization.
  14608. @end table
  14609. @subsection Examples
  14610. @itemize
  14611. @item
  14612. Use default values:
  14613. @example
  14614. vidstabdetect
  14615. @end example
  14616. @item
  14617. Analyze strongly shaky movie and put the results in file
  14618. @file{mytransforms.trf}:
  14619. @example
  14620. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14621. @end example
  14622. @item
  14623. Visualize the result of internal transformations in the resulting
  14624. video:
  14625. @example
  14626. vidstabdetect=show=1
  14627. @end example
  14628. @item
  14629. Analyze a video with medium shakiness using @command{ffmpeg}:
  14630. @example
  14631. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14632. @end example
  14633. @end itemize
  14634. @anchor{vidstabtransform}
  14635. @section vidstabtransform
  14636. Video stabilization/deshaking: pass 2 of 2,
  14637. see @ref{vidstabdetect} for pass 1.
  14638. Read a file with transform information for each frame and
  14639. apply/compensate them. Together with the @ref{vidstabdetect}
  14640. filter this can be used to deshake videos. See also
  14641. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14642. the @ref{unsharp} filter, see below.
  14643. To enable compilation of this filter you need to configure FFmpeg with
  14644. @code{--enable-libvidstab}.
  14645. @subsection Options
  14646. @table @option
  14647. @item input
  14648. Set path to the file used to read the transforms. Default value is
  14649. @file{transforms.trf}.
  14650. @item smoothing
  14651. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14652. camera movements. Default value is 10.
  14653. For example a number of 10 means that 21 frames are used (10 in the
  14654. past and 10 in the future) to smoothen the motion in the video. A
  14655. larger value leads to a smoother video, but limits the acceleration of
  14656. the camera (pan/tilt movements). 0 is a special case where a static
  14657. camera is simulated.
  14658. @item optalgo
  14659. Set the camera path optimization algorithm.
  14660. Accepted values are:
  14661. @table @samp
  14662. @item gauss
  14663. gaussian kernel low-pass filter on camera motion (default)
  14664. @item avg
  14665. averaging on transformations
  14666. @end table
  14667. @item maxshift
  14668. Set maximal number of pixels to translate frames. Default value is -1,
  14669. meaning no limit.
  14670. @item maxangle
  14671. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14672. value is -1, meaning no limit.
  14673. @item crop
  14674. Specify how to deal with borders that may be visible due to movement
  14675. compensation.
  14676. Available values are:
  14677. @table @samp
  14678. @item keep
  14679. keep image information from previous frame (default)
  14680. @item black
  14681. fill the border black
  14682. @end table
  14683. @item invert
  14684. Invert transforms if set to 1. Default value is 0.
  14685. @item relative
  14686. Consider transforms as relative to previous frame if set to 1,
  14687. absolute if set to 0. Default value is 0.
  14688. @item zoom
  14689. Set percentage to zoom. A positive value will result in a zoom-in
  14690. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14691. zoom).
  14692. @item optzoom
  14693. Set optimal zooming to avoid borders.
  14694. Accepted values are:
  14695. @table @samp
  14696. @item 0
  14697. disabled
  14698. @item 1
  14699. optimal static zoom value is determined (only very strong movements
  14700. will lead to visible borders) (default)
  14701. @item 2
  14702. optimal adaptive zoom value is determined (no borders will be
  14703. visible), see @option{zoomspeed}
  14704. @end table
  14705. Note that the value given at zoom is added to the one calculated here.
  14706. @item zoomspeed
  14707. Set percent to zoom maximally each frame (enabled when
  14708. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14709. 0.25.
  14710. @item interpol
  14711. Specify type of interpolation.
  14712. Available values are:
  14713. @table @samp
  14714. @item no
  14715. no interpolation
  14716. @item linear
  14717. linear only horizontal
  14718. @item bilinear
  14719. linear in both directions (default)
  14720. @item bicubic
  14721. cubic in both directions (slow)
  14722. @end table
  14723. @item tripod
  14724. Enable virtual tripod mode if set to 1, which is equivalent to
  14725. @code{relative=0:smoothing=0}. Default value is 0.
  14726. Use also @code{tripod} option of @ref{vidstabdetect}.
  14727. @item debug
  14728. Increase log verbosity if set to 1. Also the detected global motions
  14729. are written to the temporary file @file{global_motions.trf}. Default
  14730. value is 0.
  14731. @end table
  14732. @subsection Examples
  14733. @itemize
  14734. @item
  14735. Use @command{ffmpeg} for a typical stabilization with default values:
  14736. @example
  14737. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14738. @end example
  14739. Note the use of the @ref{unsharp} filter which is always recommended.
  14740. @item
  14741. Zoom in a bit more and load transform data from a given file:
  14742. @example
  14743. vidstabtransform=zoom=5:input="mytransforms.trf"
  14744. @end example
  14745. @item
  14746. Smoothen the video even more:
  14747. @example
  14748. vidstabtransform=smoothing=30
  14749. @end example
  14750. @end itemize
  14751. @section vflip
  14752. Flip the input video vertically.
  14753. For example, to vertically flip a video with @command{ffmpeg}:
  14754. @example
  14755. ffmpeg -i in.avi -vf "vflip" out.avi
  14756. @end example
  14757. @section vfrdet
  14758. Detect variable frame rate video.
  14759. This filter tries to detect if the input is variable or constant frame rate.
  14760. At end it will output number of frames detected as having variable delta pts,
  14761. and ones with constant delta pts.
  14762. If there was frames with variable delta, than it will also show min, max and
  14763. average delta encountered.
  14764. @section vibrance
  14765. Boost or alter saturation.
  14766. The filter accepts the following options:
  14767. @table @option
  14768. @item intensity
  14769. Set strength of boost if positive value or strength of alter if negative value.
  14770. Default is 0. Allowed range is from -2 to 2.
  14771. @item rbal
  14772. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14773. @item gbal
  14774. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14775. @item bbal
  14776. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14777. @item rlum
  14778. Set the red luma coefficient.
  14779. @item glum
  14780. Set the green luma coefficient.
  14781. @item blum
  14782. Set the blue luma coefficient.
  14783. @item alternate
  14784. If @code{intensity} is negative and this is set to 1, colors will change,
  14785. otherwise colors will be less saturated, more towards gray.
  14786. @end table
  14787. @subsection Commands
  14788. This filter supports the all above options as @ref{commands}.
  14789. @anchor{vignette}
  14790. @section vignette
  14791. Make or reverse a natural vignetting effect.
  14792. The filter accepts the following options:
  14793. @table @option
  14794. @item angle, a
  14795. Set lens angle expression as a number of radians.
  14796. The value is clipped in the @code{[0,PI/2]} range.
  14797. Default value: @code{"PI/5"}
  14798. @item x0
  14799. @item y0
  14800. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14801. by default.
  14802. @item mode
  14803. Set forward/backward mode.
  14804. Available modes are:
  14805. @table @samp
  14806. @item forward
  14807. The larger the distance from the central point, the darker the image becomes.
  14808. @item backward
  14809. The larger the distance from the central point, the brighter the image becomes.
  14810. This can be used to reverse a vignette effect, though there is no automatic
  14811. detection to extract the lens @option{angle} and other settings (yet). It can
  14812. also be used to create a burning effect.
  14813. @end table
  14814. Default value is @samp{forward}.
  14815. @item eval
  14816. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14817. It accepts the following values:
  14818. @table @samp
  14819. @item init
  14820. Evaluate expressions only once during the filter initialization.
  14821. @item frame
  14822. Evaluate expressions for each incoming frame. This is way slower than the
  14823. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14824. allows advanced dynamic expressions.
  14825. @end table
  14826. Default value is @samp{init}.
  14827. @item dither
  14828. Set dithering to reduce the circular banding effects. Default is @code{1}
  14829. (enabled).
  14830. @item aspect
  14831. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14832. Setting this value to the SAR of the input will make a rectangular vignetting
  14833. following the dimensions of the video.
  14834. Default is @code{1/1}.
  14835. @end table
  14836. @subsection Expressions
  14837. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14838. following parameters.
  14839. @table @option
  14840. @item w
  14841. @item h
  14842. input width and height
  14843. @item n
  14844. the number of input frame, starting from 0
  14845. @item pts
  14846. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14847. @var{TB} units, NAN if undefined
  14848. @item r
  14849. frame rate of the input video, NAN if the input frame rate is unknown
  14850. @item t
  14851. the PTS (Presentation TimeStamp) of the filtered video frame,
  14852. expressed in seconds, NAN if undefined
  14853. @item tb
  14854. time base of the input video
  14855. @end table
  14856. @subsection Examples
  14857. @itemize
  14858. @item
  14859. Apply simple strong vignetting effect:
  14860. @example
  14861. vignette=PI/4
  14862. @end example
  14863. @item
  14864. Make a flickering vignetting:
  14865. @example
  14866. vignette='PI/4+random(1)*PI/50':eval=frame
  14867. @end example
  14868. @end itemize
  14869. @section vmafmotion
  14870. Obtain the average VMAF motion score of a video.
  14871. It is one of the component metrics of VMAF.
  14872. The obtained average motion score is printed through the logging system.
  14873. The filter accepts the following options:
  14874. @table @option
  14875. @item stats_file
  14876. If specified, the filter will use the named file to save the motion score of
  14877. each frame with respect to the previous frame.
  14878. When filename equals "-" the data is sent to standard output.
  14879. @end table
  14880. Example:
  14881. @example
  14882. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  14883. @end example
  14884. @section vstack
  14885. Stack input videos vertically.
  14886. All streams must be of same pixel format and of same width.
  14887. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14888. to create same output.
  14889. The filter accepts the following options:
  14890. @table @option
  14891. @item inputs
  14892. Set number of input streams. Default is 2.
  14893. @item shortest
  14894. If set to 1, force the output to terminate when the shortest input
  14895. terminates. Default value is 0.
  14896. @end table
  14897. @section w3fdif
  14898. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14899. Deinterlacing Filter").
  14900. Based on the process described by Martin Weston for BBC R&D, and
  14901. implemented based on the de-interlace algorithm written by Jim
  14902. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14903. uses filter coefficients calculated by BBC R&D.
  14904. This filter uses field-dominance information in frame to decide which
  14905. of each pair of fields to place first in the output.
  14906. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14907. There are two sets of filter coefficients, so called "simple"
  14908. and "complex". Which set of filter coefficients is used can
  14909. be set by passing an optional parameter:
  14910. @table @option
  14911. @item filter
  14912. Set the interlacing filter coefficients. Accepts one of the following values:
  14913. @table @samp
  14914. @item simple
  14915. Simple filter coefficient set.
  14916. @item complex
  14917. More-complex filter coefficient set.
  14918. @end table
  14919. Default value is @samp{complex}.
  14920. @item deint
  14921. Specify which frames to deinterlace. Accepts one of the following values:
  14922. @table @samp
  14923. @item all
  14924. Deinterlace all frames,
  14925. @item interlaced
  14926. Only deinterlace frames marked as interlaced.
  14927. @end table
  14928. Default value is @samp{all}.
  14929. @end table
  14930. @section waveform
  14931. Video waveform monitor.
  14932. The waveform monitor plots color component intensity. By default luminance
  14933. only. Each column of the waveform corresponds to a column of pixels in the
  14934. source video.
  14935. It accepts the following options:
  14936. @table @option
  14937. @item mode, m
  14938. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14939. In row mode, the graph on the left side represents color component value 0 and
  14940. the right side represents value = 255. In column mode, the top side represents
  14941. color component value = 0 and bottom side represents value = 255.
  14942. @item intensity, i
  14943. Set intensity. Smaller values are useful to find out how many values of the same
  14944. luminance are distributed across input rows/columns.
  14945. Default value is @code{0.04}. Allowed range is [0, 1].
  14946. @item mirror, r
  14947. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14948. In mirrored mode, higher values will be represented on the left
  14949. side for @code{row} mode and at the top for @code{column} mode. Default is
  14950. @code{1} (mirrored).
  14951. @item display, d
  14952. Set display mode.
  14953. It accepts the following values:
  14954. @table @samp
  14955. @item overlay
  14956. Presents information identical to that in the @code{parade}, except
  14957. that the graphs representing color components are superimposed directly
  14958. over one another.
  14959. This display mode makes it easier to spot relative differences or similarities
  14960. in overlapping areas of the color components that are supposed to be identical,
  14961. such as neutral whites, grays, or blacks.
  14962. @item stack
  14963. Display separate graph for the color components side by side in
  14964. @code{row} mode or one below the other in @code{column} mode.
  14965. @item parade
  14966. Display separate graph for the color components side by side in
  14967. @code{column} mode or one below the other in @code{row} mode.
  14968. Using this display mode makes it easy to spot color casts in the highlights
  14969. and shadows of an image, by comparing the contours of the top and the bottom
  14970. graphs of each waveform. Since whites, grays, and blacks are characterized
  14971. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14972. should display three waveforms of roughly equal width/height. If not, the
  14973. correction is easy to perform by making level adjustments the three waveforms.
  14974. @end table
  14975. Default is @code{stack}.
  14976. @item components, c
  14977. Set which color components to display. Default is 1, which means only luminance
  14978. or red color component if input is in RGB colorspace. If is set for example to
  14979. 7 it will display all 3 (if) available color components.
  14980. @item envelope, e
  14981. @table @samp
  14982. @item none
  14983. No envelope, this is default.
  14984. @item instant
  14985. Instant envelope, minimum and maximum values presented in graph will be easily
  14986. visible even with small @code{step} value.
  14987. @item peak
  14988. Hold minimum and maximum values presented in graph across time. This way you
  14989. can still spot out of range values without constantly looking at waveforms.
  14990. @item peak+instant
  14991. Peak and instant envelope combined together.
  14992. @end table
  14993. @item filter, f
  14994. @table @samp
  14995. @item lowpass
  14996. No filtering, this is default.
  14997. @item flat
  14998. Luma and chroma combined together.
  14999. @item aflat
  15000. Similar as above, but shows difference between blue and red chroma.
  15001. @item xflat
  15002. Similar as above, but use different colors.
  15003. @item yflat
  15004. Similar as above, but again with different colors.
  15005. @item chroma
  15006. Displays only chroma.
  15007. @item color
  15008. Displays actual color value on waveform.
  15009. @item acolor
  15010. Similar as above, but with luma showing frequency of chroma values.
  15011. @end table
  15012. @item graticule, g
  15013. Set which graticule to display.
  15014. @table @samp
  15015. @item none
  15016. Do not display graticule.
  15017. @item green
  15018. Display green graticule showing legal broadcast ranges.
  15019. @item orange
  15020. Display orange graticule showing legal broadcast ranges.
  15021. @item invert
  15022. Display invert graticule showing legal broadcast ranges.
  15023. @end table
  15024. @item opacity, o
  15025. Set graticule opacity.
  15026. @item flags, fl
  15027. Set graticule flags.
  15028. @table @samp
  15029. @item numbers
  15030. Draw numbers above lines. By default enabled.
  15031. @item dots
  15032. Draw dots instead of lines.
  15033. @end table
  15034. @item scale, s
  15035. Set scale used for displaying graticule.
  15036. @table @samp
  15037. @item digital
  15038. @item millivolts
  15039. @item ire
  15040. @end table
  15041. Default is digital.
  15042. @item bgopacity, b
  15043. Set background opacity.
  15044. @item tint0, t0
  15045. @item tint1, t1
  15046. Set tint for output.
  15047. Only used with lowpass filter and when display is not overlay and input
  15048. pixel formats are not RGB.
  15049. @end table
  15050. @section weave, doubleweave
  15051. The @code{weave} takes a field-based video input and join
  15052. each two sequential fields into single frame, producing a new double
  15053. height clip with half the frame rate and half the frame count.
  15054. The @code{doubleweave} works same as @code{weave} but without
  15055. halving frame rate and frame count.
  15056. It accepts the following option:
  15057. @table @option
  15058. @item first_field
  15059. Set first field. Available values are:
  15060. @table @samp
  15061. @item top, t
  15062. Set the frame as top-field-first.
  15063. @item bottom, b
  15064. Set the frame as bottom-field-first.
  15065. @end table
  15066. @end table
  15067. @subsection Examples
  15068. @itemize
  15069. @item
  15070. Interlace video using @ref{select} and @ref{separatefields} filter:
  15071. @example
  15072. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15073. @end example
  15074. @end itemize
  15075. @section xbr
  15076. Apply the xBR high-quality magnification filter which is designed for pixel
  15077. art. It follows a set of edge-detection rules, see
  15078. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15079. It accepts the following option:
  15080. @table @option
  15081. @item n
  15082. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15083. @code{3xBR} and @code{4} for @code{4xBR}.
  15084. Default is @code{3}.
  15085. @end table
  15086. @section xmedian
  15087. Pick median pixels from several input videos.
  15088. The filter accepts the following options:
  15089. @table @option
  15090. @item inputs
  15091. Set number of inputs.
  15092. Default is 3. Allowed range is from 3 to 255.
  15093. If number of inputs is even number, than result will be mean value between two median values.
  15094. @item planes
  15095. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15096. @end table
  15097. @section xstack
  15098. Stack video inputs into custom layout.
  15099. All streams must be of same pixel format.
  15100. The filter accepts the following options:
  15101. @table @option
  15102. @item inputs
  15103. Set number of input streams. Default is 2.
  15104. @item layout
  15105. Specify layout of inputs.
  15106. This option requires the desired layout configuration to be explicitly set by the user.
  15107. This sets position of each video input in output. Each input
  15108. is separated by '|'.
  15109. The first number represents the column, and the second number represents the row.
  15110. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  15111. where X is video input from which to take width or height.
  15112. Multiple values can be used when separated by '+'. In such
  15113. case values are summed together.
  15114. Note that if inputs are of different sizes gaps may appear, as not all of
  15115. the output video frame will be filled. Similarly, videos can overlap each
  15116. other if their position doesn't leave enough space for the full frame of
  15117. adjoining videos.
  15118. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  15119. a layout must be set by the user.
  15120. @item shortest
  15121. If set to 1, force the output to terminate when the shortest input
  15122. terminates. Default value is 0.
  15123. @end table
  15124. @subsection Examples
  15125. @itemize
  15126. @item
  15127. Display 4 inputs into 2x2 grid.
  15128. Layout:
  15129. @example
  15130. input1(0, 0) | input3(w0, 0)
  15131. input2(0, h0) | input4(w0, h0)
  15132. @end example
  15133. @example
  15134. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  15135. @end example
  15136. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15137. @item
  15138. Display 4 inputs into 1x4 grid.
  15139. Layout:
  15140. @example
  15141. input1(0, 0)
  15142. input2(0, h0)
  15143. input3(0, h0+h1)
  15144. input4(0, h0+h1+h2)
  15145. @end example
  15146. @example
  15147. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  15148. @end example
  15149. Note that if inputs are of different widths, unused space will appear.
  15150. @item
  15151. Display 9 inputs into 3x3 grid.
  15152. Layout:
  15153. @example
  15154. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  15155. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  15156. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  15157. @end example
  15158. @example
  15159. 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
  15160. @end example
  15161. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15162. @item
  15163. Display 16 inputs into 4x4 grid.
  15164. Layout:
  15165. @example
  15166. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  15167. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  15168. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  15169. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  15170. @end example
  15171. @example
  15172. 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|
  15173. 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
  15174. @end example
  15175. Note that if inputs are of different sizes, gaps or overlaps may occur.
  15176. @end itemize
  15177. @anchor{yadif}
  15178. @section yadif
  15179. Deinterlace the input video ("yadif" means "yet another deinterlacing
  15180. filter").
  15181. It accepts the following parameters:
  15182. @table @option
  15183. @item mode
  15184. The interlacing mode to adopt. It accepts one of the following values:
  15185. @table @option
  15186. @item 0, send_frame
  15187. Output one frame for each frame.
  15188. @item 1, send_field
  15189. Output one frame for each field.
  15190. @item 2, send_frame_nospatial
  15191. Like @code{send_frame}, but it skips the spatial interlacing check.
  15192. @item 3, send_field_nospatial
  15193. Like @code{send_field}, but it skips the spatial interlacing check.
  15194. @end table
  15195. The default value is @code{send_frame}.
  15196. @item parity
  15197. The picture field parity assumed for the input interlaced video. It accepts one
  15198. of the following values:
  15199. @table @option
  15200. @item 0, tff
  15201. Assume the top field is first.
  15202. @item 1, bff
  15203. Assume the bottom field is first.
  15204. @item -1, auto
  15205. Enable automatic detection of field parity.
  15206. @end table
  15207. The default value is @code{auto}.
  15208. If the interlacing is unknown or the decoder does not export this information,
  15209. top field first will be assumed.
  15210. @item deint
  15211. Specify which frames to deinterlace. Accepts one of the following
  15212. values:
  15213. @table @option
  15214. @item 0, all
  15215. Deinterlace all frames.
  15216. @item 1, interlaced
  15217. Only deinterlace frames marked as interlaced.
  15218. @end table
  15219. The default value is @code{all}.
  15220. @end table
  15221. @section yadif_cuda
  15222. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  15223. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  15224. and/or nvenc.
  15225. It accepts the following parameters:
  15226. @table @option
  15227. @item mode
  15228. The interlacing mode to adopt. It accepts one of the following values:
  15229. @table @option
  15230. @item 0, send_frame
  15231. Output one frame for each frame.
  15232. @item 1, send_field
  15233. Output one frame for each field.
  15234. @item 2, send_frame_nospatial
  15235. Like @code{send_frame}, but it skips the spatial interlacing check.
  15236. @item 3, send_field_nospatial
  15237. Like @code{send_field}, but it skips the spatial interlacing check.
  15238. @end table
  15239. The default value is @code{send_frame}.
  15240. @item parity
  15241. The picture field parity assumed for the input interlaced video. It accepts one
  15242. of the following values:
  15243. @table @option
  15244. @item 0, tff
  15245. Assume the top field is first.
  15246. @item 1, bff
  15247. Assume the bottom field is first.
  15248. @item -1, auto
  15249. Enable automatic detection of field parity.
  15250. @end table
  15251. The default value is @code{auto}.
  15252. If the interlacing is unknown or the decoder does not export this information,
  15253. top field first will be assumed.
  15254. @item deint
  15255. Specify which frames to deinterlace. Accepts one of the following
  15256. values:
  15257. @table @option
  15258. @item 0, all
  15259. Deinterlace all frames.
  15260. @item 1, interlaced
  15261. Only deinterlace frames marked as interlaced.
  15262. @end table
  15263. The default value is @code{all}.
  15264. @end table
  15265. @section yaepblur
  15266. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  15267. The algorithm is described in
  15268. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  15269. It accepts the following parameters:
  15270. @table @option
  15271. @item radius, r
  15272. Set the window radius. Default value is 3.
  15273. @item planes, p
  15274. Set which planes to filter. Default is only the first plane.
  15275. @item sigma, s
  15276. Set blur strength. Default value is 128.
  15277. @end table
  15278. @subsection Commands
  15279. This filter supports same @ref{commands} as options.
  15280. @section zoompan
  15281. Apply Zoom & Pan effect.
  15282. This filter accepts the following options:
  15283. @table @option
  15284. @item zoom, z
  15285. Set the zoom expression. Range is 1-10. Default is 1.
  15286. @item x
  15287. @item y
  15288. Set the x and y expression. Default is 0.
  15289. @item d
  15290. Set the duration expression in number of frames.
  15291. This sets for how many number of frames effect will last for
  15292. single input image.
  15293. @item s
  15294. Set the output image size, default is 'hd720'.
  15295. @item fps
  15296. Set the output frame rate, default is '25'.
  15297. @end table
  15298. Each expression can contain the following constants:
  15299. @table @option
  15300. @item in_w, iw
  15301. Input width.
  15302. @item in_h, ih
  15303. Input height.
  15304. @item out_w, ow
  15305. Output width.
  15306. @item out_h, oh
  15307. Output height.
  15308. @item in
  15309. Input frame count.
  15310. @item on
  15311. Output frame count.
  15312. @item x
  15313. @item y
  15314. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  15315. for current input frame.
  15316. @item px
  15317. @item py
  15318. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  15319. not yet such frame (first input frame).
  15320. @item zoom
  15321. Last calculated zoom from 'z' expression for current input frame.
  15322. @item pzoom
  15323. Last calculated zoom of last output frame of previous input frame.
  15324. @item duration
  15325. Number of output frames for current input frame. Calculated from 'd' expression
  15326. for each input frame.
  15327. @item pduration
  15328. number of output frames created for previous input frame
  15329. @item a
  15330. Rational number: input width / input height
  15331. @item sar
  15332. sample aspect ratio
  15333. @item dar
  15334. display aspect ratio
  15335. @end table
  15336. @subsection Examples
  15337. @itemize
  15338. @item
  15339. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  15340. @example
  15341. 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
  15342. @end example
  15343. @item
  15344. Zoom-in up to 1.5 and pan always at center of picture:
  15345. @example
  15346. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15347. @end example
  15348. @item
  15349. Same as above but without pausing:
  15350. @example
  15351. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  15352. @end example
  15353. @end itemize
  15354. @anchor{zscale}
  15355. @section zscale
  15356. Scale (resize) the input video, using the z.lib library:
  15357. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  15358. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  15359. The zscale filter forces the output display aspect ratio to be the same
  15360. as the input, by changing the output sample aspect ratio.
  15361. If the input image format is different from the format requested by
  15362. the next filter, the zscale filter will convert the input to the
  15363. requested format.
  15364. @subsection Options
  15365. The filter accepts the following options.
  15366. @table @option
  15367. @item width, w
  15368. @item height, h
  15369. Set the output video dimension expression. Default value is the input
  15370. dimension.
  15371. If the @var{width} or @var{w} value is 0, the input width is used for
  15372. the output. If the @var{height} or @var{h} value is 0, the input height
  15373. is used for the output.
  15374. If one and only one of the values is -n with n >= 1, the zscale filter
  15375. will use a value that maintains the aspect ratio of the input image,
  15376. calculated from the other specified dimension. After that it will,
  15377. however, make sure that the calculated dimension is divisible by n and
  15378. adjust the value if necessary.
  15379. If both values are -n with n >= 1, the behavior will be identical to
  15380. both values being set to 0 as previously detailed.
  15381. See below for the list of accepted constants for use in the dimension
  15382. expression.
  15383. @item size, s
  15384. Set the video size. For the syntax of this option, check the
  15385. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15386. @item dither, d
  15387. Set the dither type.
  15388. Possible values are:
  15389. @table @var
  15390. @item none
  15391. @item ordered
  15392. @item random
  15393. @item error_diffusion
  15394. @end table
  15395. Default is none.
  15396. @item filter, f
  15397. Set the resize filter type.
  15398. Possible values are:
  15399. @table @var
  15400. @item point
  15401. @item bilinear
  15402. @item bicubic
  15403. @item spline16
  15404. @item spline36
  15405. @item lanczos
  15406. @end table
  15407. Default is bilinear.
  15408. @item range, r
  15409. Set the color range.
  15410. Possible values are:
  15411. @table @var
  15412. @item input
  15413. @item limited
  15414. @item full
  15415. @end table
  15416. Default is same as input.
  15417. @item primaries, p
  15418. Set the color primaries.
  15419. Possible values are:
  15420. @table @var
  15421. @item input
  15422. @item 709
  15423. @item unspecified
  15424. @item 170m
  15425. @item 240m
  15426. @item 2020
  15427. @end table
  15428. Default is same as input.
  15429. @item transfer, t
  15430. Set the transfer characteristics.
  15431. Possible values are:
  15432. @table @var
  15433. @item input
  15434. @item 709
  15435. @item unspecified
  15436. @item 601
  15437. @item linear
  15438. @item 2020_10
  15439. @item 2020_12
  15440. @item smpte2084
  15441. @item iec61966-2-1
  15442. @item arib-std-b67
  15443. @end table
  15444. Default is same as input.
  15445. @item matrix, m
  15446. Set the colorspace matrix.
  15447. Possible value are:
  15448. @table @var
  15449. @item input
  15450. @item 709
  15451. @item unspecified
  15452. @item 470bg
  15453. @item 170m
  15454. @item 2020_ncl
  15455. @item 2020_cl
  15456. @end table
  15457. Default is same as input.
  15458. @item rangein, rin
  15459. Set the input color range.
  15460. Possible values are:
  15461. @table @var
  15462. @item input
  15463. @item limited
  15464. @item full
  15465. @end table
  15466. Default is same as input.
  15467. @item primariesin, pin
  15468. Set the input color primaries.
  15469. Possible values are:
  15470. @table @var
  15471. @item input
  15472. @item 709
  15473. @item unspecified
  15474. @item 170m
  15475. @item 240m
  15476. @item 2020
  15477. @end table
  15478. Default is same as input.
  15479. @item transferin, tin
  15480. Set the input transfer characteristics.
  15481. Possible values are:
  15482. @table @var
  15483. @item input
  15484. @item 709
  15485. @item unspecified
  15486. @item 601
  15487. @item linear
  15488. @item 2020_10
  15489. @item 2020_12
  15490. @end table
  15491. Default is same as input.
  15492. @item matrixin, min
  15493. Set the input colorspace matrix.
  15494. Possible value are:
  15495. @table @var
  15496. @item input
  15497. @item 709
  15498. @item unspecified
  15499. @item 470bg
  15500. @item 170m
  15501. @item 2020_ncl
  15502. @item 2020_cl
  15503. @end table
  15504. @item chromal, c
  15505. Set the output chroma location.
  15506. Possible values are:
  15507. @table @var
  15508. @item input
  15509. @item left
  15510. @item center
  15511. @item topleft
  15512. @item top
  15513. @item bottomleft
  15514. @item bottom
  15515. @end table
  15516. @item chromalin, cin
  15517. Set the input chroma location.
  15518. Possible values are:
  15519. @table @var
  15520. @item input
  15521. @item left
  15522. @item center
  15523. @item topleft
  15524. @item top
  15525. @item bottomleft
  15526. @item bottom
  15527. @end table
  15528. @item npl
  15529. Set the nominal peak luminance.
  15530. @end table
  15531. The values of the @option{w} and @option{h} options are expressions
  15532. containing the following constants:
  15533. @table @var
  15534. @item in_w
  15535. @item in_h
  15536. The input width and height
  15537. @item iw
  15538. @item ih
  15539. These are the same as @var{in_w} and @var{in_h}.
  15540. @item out_w
  15541. @item out_h
  15542. The output (scaled) width and height
  15543. @item ow
  15544. @item oh
  15545. These are the same as @var{out_w} and @var{out_h}
  15546. @item a
  15547. The same as @var{iw} / @var{ih}
  15548. @item sar
  15549. input sample aspect ratio
  15550. @item dar
  15551. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15552. @item hsub
  15553. @item vsub
  15554. horizontal and vertical input chroma subsample values. For example for the
  15555. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15556. @item ohsub
  15557. @item ovsub
  15558. horizontal and vertical output chroma subsample values. For example for the
  15559. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15560. @end table
  15561. @table @option
  15562. @end table
  15563. @c man end VIDEO FILTERS
  15564. @chapter OpenCL Video Filters
  15565. @c man begin OPENCL VIDEO FILTERS
  15566. Below is a description of the currently available OpenCL video filters.
  15567. To enable compilation of these filters you need to configure FFmpeg with
  15568. @code{--enable-opencl}.
  15569. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15570. @table @option
  15571. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15572. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15573. given device parameters.
  15574. @item -filter_hw_device @var{name}
  15575. Pass the hardware device called @var{name} to all filters in any filter graph.
  15576. @end table
  15577. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15578. @itemize
  15579. @item
  15580. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15581. @example
  15582. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15583. @end example
  15584. @end itemize
  15585. 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.
  15586. @section avgblur_opencl
  15587. Apply average blur filter.
  15588. The filter accepts the following options:
  15589. @table @option
  15590. @item sizeX
  15591. Set horizontal radius size.
  15592. Range is @code{[1, 1024]} and default value is @code{1}.
  15593. @item planes
  15594. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15595. @item sizeY
  15596. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15597. @end table
  15598. @subsection Example
  15599. @itemize
  15600. @item
  15601. 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.
  15602. @example
  15603. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15604. @end example
  15605. @end itemize
  15606. @section boxblur_opencl
  15607. Apply a boxblur algorithm to the input video.
  15608. It accepts the following parameters:
  15609. @table @option
  15610. @item luma_radius, lr
  15611. @item luma_power, lp
  15612. @item chroma_radius, cr
  15613. @item chroma_power, cp
  15614. @item alpha_radius, ar
  15615. @item alpha_power, ap
  15616. @end table
  15617. A description of the accepted options follows.
  15618. @table @option
  15619. @item luma_radius, lr
  15620. @item chroma_radius, cr
  15621. @item alpha_radius, ar
  15622. Set an expression for the box radius in pixels used for blurring the
  15623. corresponding input plane.
  15624. The radius value must be a non-negative number, and must not be
  15625. greater than the value of the expression @code{min(w,h)/2} for the
  15626. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15627. planes.
  15628. Default value for @option{luma_radius} is "2". If not specified,
  15629. @option{chroma_radius} and @option{alpha_radius} default to the
  15630. corresponding value set for @option{luma_radius}.
  15631. The expressions can contain the following constants:
  15632. @table @option
  15633. @item w
  15634. @item h
  15635. The input width and height in pixels.
  15636. @item cw
  15637. @item ch
  15638. The input chroma image width and height in pixels.
  15639. @item hsub
  15640. @item vsub
  15641. The horizontal and vertical chroma subsample values. For example, for the
  15642. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15643. @end table
  15644. @item luma_power, lp
  15645. @item chroma_power, cp
  15646. @item alpha_power, ap
  15647. Specify how many times the boxblur filter is applied to the
  15648. corresponding plane.
  15649. Default value for @option{luma_power} is 2. If not specified,
  15650. @option{chroma_power} and @option{alpha_power} default to the
  15651. corresponding value set for @option{luma_power}.
  15652. A value of 0 will disable the effect.
  15653. @end table
  15654. @subsection Examples
  15655. 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.
  15656. @itemize
  15657. @item
  15658. Apply a boxblur filter with the luma, chroma, and alpha radius
  15659. 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.
  15660. @example
  15661. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15662. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15663. @end example
  15664. @item
  15665. 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.
  15666. For the luma plane, a 2x2 box radius will be run once.
  15667. For the chroma plane, a 4x4 box radius will be run 5 times.
  15668. For the alpha plane, a 3x3 box radius will be run 7 times.
  15669. @example
  15670. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15671. @end example
  15672. @end itemize
  15673. @section convolution_opencl
  15674. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15675. The filter accepts the following options:
  15676. @table @option
  15677. @item 0m
  15678. @item 1m
  15679. @item 2m
  15680. @item 3m
  15681. Set matrix for each plane.
  15682. Matrix is sequence of 9, 25 or 49 signed numbers.
  15683. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15684. @item 0rdiv
  15685. @item 1rdiv
  15686. @item 2rdiv
  15687. @item 3rdiv
  15688. Set multiplier for calculated value for each plane.
  15689. If unset or 0, it will be sum of all matrix elements.
  15690. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15691. @item 0bias
  15692. @item 1bias
  15693. @item 2bias
  15694. @item 3bias
  15695. Set bias for each plane. This value is added to the result of the multiplication.
  15696. Useful for making the overall image brighter or darker.
  15697. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15698. @end table
  15699. @subsection Examples
  15700. @itemize
  15701. @item
  15702. Apply sharpen:
  15703. @example
  15704. -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
  15705. @end example
  15706. @item
  15707. Apply blur:
  15708. @example
  15709. -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
  15710. @end example
  15711. @item
  15712. Apply edge enhance:
  15713. @example
  15714. -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
  15715. @end example
  15716. @item
  15717. Apply edge detect:
  15718. @example
  15719. -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
  15720. @end example
  15721. @item
  15722. Apply laplacian edge detector which includes diagonals:
  15723. @example
  15724. -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
  15725. @end example
  15726. @item
  15727. Apply emboss:
  15728. @example
  15729. -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
  15730. @end example
  15731. @end itemize
  15732. @section dilation_opencl
  15733. Apply dilation effect to the video.
  15734. This filter replaces the pixel by the local(3x3) maximum.
  15735. It accepts the following options:
  15736. @table @option
  15737. @item threshold0
  15738. @item threshold1
  15739. @item threshold2
  15740. @item threshold3
  15741. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15742. If @code{0}, plane will remain unchanged.
  15743. @item coordinates
  15744. Flag which specifies the pixel to refer to.
  15745. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15746. Flags to local 3x3 coordinates region centered on @code{x}:
  15747. 1 2 3
  15748. 4 x 5
  15749. 6 7 8
  15750. @end table
  15751. @subsection Example
  15752. @itemize
  15753. @item
  15754. 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.
  15755. @example
  15756. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15757. @end example
  15758. @end itemize
  15759. @section erosion_opencl
  15760. Apply erosion effect to the video.
  15761. This filter replaces the pixel by the local(3x3) minimum.
  15762. It accepts the following options:
  15763. @table @option
  15764. @item threshold0
  15765. @item threshold1
  15766. @item threshold2
  15767. @item threshold3
  15768. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15769. If @code{0}, plane will remain unchanged.
  15770. @item coordinates
  15771. Flag which specifies the pixel to refer to.
  15772. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15773. Flags to local 3x3 coordinates region centered on @code{x}:
  15774. 1 2 3
  15775. 4 x 5
  15776. 6 7 8
  15777. @end table
  15778. @subsection Example
  15779. @itemize
  15780. @item
  15781. 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.
  15782. @example
  15783. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15784. @end example
  15785. @end itemize
  15786. @section colorkey_opencl
  15787. RGB colorspace color keying.
  15788. The filter accepts the following options:
  15789. @table @option
  15790. @item color
  15791. The color which will be replaced with transparency.
  15792. @item similarity
  15793. Similarity percentage with the key color.
  15794. 0.01 matches only the exact key color, while 1.0 matches everything.
  15795. @item blend
  15796. Blend percentage.
  15797. 0.0 makes pixels either fully transparent, or not transparent at all.
  15798. Higher values result in semi-transparent pixels, with a higher transparency
  15799. the more similar the pixels color is to the key color.
  15800. @end table
  15801. @subsection Examples
  15802. @itemize
  15803. @item
  15804. Make every semi-green pixel in the input transparent with some slight blending:
  15805. @example
  15806. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15807. @end example
  15808. @end itemize
  15809. @section deshake_opencl
  15810. Feature-point based video stabilization filter.
  15811. The filter accepts the following options:
  15812. @table @option
  15813. @item tripod
  15814. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15815. @item debug
  15816. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15817. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15818. Viewing point matches in the output video is only supported for RGB input.
  15819. Defaults to @code{0}.
  15820. @item adaptive_crop
  15821. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15822. Defaults to @code{1}.
  15823. @item refine_features
  15824. Whether or not feature points should be refined at a sub-pixel level.
  15825. This can be turned off for a slight performance gain at the cost of precision.
  15826. Defaults to @code{1}.
  15827. @item smooth_strength
  15828. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15829. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15830. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15831. Defaults to @code{0.0}.
  15832. @item smooth_window_multiplier
  15833. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15834. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15835. Acceptable values range from @code{0.1} to @code{10.0}.
  15836. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15837. potentially improving smoothness, but also increase latency and memory usage.
  15838. Defaults to @code{2.0}.
  15839. @end table
  15840. @subsection Examples
  15841. @itemize
  15842. @item
  15843. Stabilize a video with a fixed, medium smoothing strength:
  15844. @example
  15845. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15846. @end example
  15847. @item
  15848. Stabilize a video with debugging (both in console and in rendered video):
  15849. @example
  15850. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15851. @end example
  15852. @end itemize
  15853. @section nlmeans_opencl
  15854. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15855. @section overlay_opencl
  15856. Overlay one video on top of another.
  15857. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15858. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15859. The filter accepts the following options:
  15860. @table @option
  15861. @item x
  15862. Set the x coordinate of the overlaid video on the main video.
  15863. Default value is @code{0}.
  15864. @item y
  15865. Set the y coordinate of the overlaid video on the main video.
  15866. Default value is @code{0}.
  15867. @end table
  15868. @subsection Examples
  15869. @itemize
  15870. @item
  15871. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15872. @example
  15873. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15874. @end example
  15875. @item
  15876. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15877. @example
  15878. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15879. @end example
  15880. @end itemize
  15881. @section prewitt_opencl
  15882. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15883. The filter accepts the following option:
  15884. @table @option
  15885. @item planes
  15886. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15887. @item scale
  15888. Set value which will be multiplied with filtered result.
  15889. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15890. @item delta
  15891. Set value which will be added to filtered result.
  15892. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15893. @end table
  15894. @subsection Example
  15895. @itemize
  15896. @item
  15897. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15898. @example
  15899. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15900. @end example
  15901. @end itemize
  15902. @section roberts_opencl
  15903. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15904. The filter accepts the following option:
  15905. @table @option
  15906. @item planes
  15907. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15908. @item scale
  15909. Set value which will be multiplied with filtered result.
  15910. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15911. @item delta
  15912. Set value which will be added to filtered result.
  15913. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15914. @end table
  15915. @subsection Example
  15916. @itemize
  15917. @item
  15918. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15919. @example
  15920. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15921. @end example
  15922. @end itemize
  15923. @section sobel_opencl
  15924. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15925. The filter accepts the following option:
  15926. @table @option
  15927. @item planes
  15928. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15929. @item scale
  15930. Set value which will be multiplied with filtered result.
  15931. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15932. @item delta
  15933. Set value which will be added to filtered result.
  15934. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15935. @end table
  15936. @subsection Example
  15937. @itemize
  15938. @item
  15939. Apply sobel operator with scale set to 2 and delta set to 10
  15940. @example
  15941. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15942. @end example
  15943. @end itemize
  15944. @section tonemap_opencl
  15945. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15946. It accepts the following parameters:
  15947. @table @option
  15948. @item tonemap
  15949. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15950. @item param
  15951. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15952. @item desat
  15953. Apply desaturation for highlights that exceed this level of brightness. The
  15954. higher the parameter, the more color information will be preserved. This
  15955. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15956. (smoothly) turning into white instead. This makes images feel more natural,
  15957. at the cost of reducing information about out-of-range colors.
  15958. The default value is 0.5, and the algorithm here is a little different from
  15959. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15960. @item threshold
  15961. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15962. is used to detect whether the scene has changed or not. If the distance between
  15963. the current frame average brightness and the current running average exceeds
  15964. a threshold value, we would re-calculate scene average and peak brightness.
  15965. The default value is 0.2.
  15966. @item format
  15967. Specify the output pixel format.
  15968. Currently supported formats are:
  15969. @table @var
  15970. @item p010
  15971. @item nv12
  15972. @end table
  15973. @item range, r
  15974. Set the output color range.
  15975. Possible values are:
  15976. @table @var
  15977. @item tv/mpeg
  15978. @item pc/jpeg
  15979. @end table
  15980. Default is same as input.
  15981. @item primaries, p
  15982. Set the output color primaries.
  15983. Possible values are:
  15984. @table @var
  15985. @item bt709
  15986. @item bt2020
  15987. @end table
  15988. Default is same as input.
  15989. @item transfer, t
  15990. Set the output transfer characteristics.
  15991. Possible values are:
  15992. @table @var
  15993. @item bt709
  15994. @item bt2020
  15995. @end table
  15996. Default is bt709.
  15997. @item matrix, m
  15998. Set the output colorspace matrix.
  15999. Possible value are:
  16000. @table @var
  16001. @item bt709
  16002. @item bt2020
  16003. @end table
  16004. Default is same as input.
  16005. @end table
  16006. @subsection Example
  16007. @itemize
  16008. @item
  16009. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  16010. @example
  16011. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  16012. @end example
  16013. @end itemize
  16014. @section unsharp_opencl
  16015. Sharpen or blur the input video.
  16016. It accepts the following parameters:
  16017. @table @option
  16018. @item luma_msize_x, lx
  16019. Set the luma matrix horizontal size.
  16020. Range is @code{[1, 23]} and default value is @code{5}.
  16021. @item luma_msize_y, ly
  16022. Set the luma matrix vertical size.
  16023. Range is @code{[1, 23]} and default value is @code{5}.
  16024. @item luma_amount, la
  16025. Set the luma effect strength.
  16026. Range is @code{[-10, 10]} and default value is @code{1.0}.
  16027. Negative values will blur the input video, while positive values will
  16028. sharpen it, a value of zero will disable the effect.
  16029. @item chroma_msize_x, cx
  16030. Set the chroma matrix horizontal size.
  16031. Range is @code{[1, 23]} and default value is @code{5}.
  16032. @item chroma_msize_y, cy
  16033. Set the chroma matrix vertical size.
  16034. Range is @code{[1, 23]} and default value is @code{5}.
  16035. @item chroma_amount, ca
  16036. Set the chroma effect strength.
  16037. Range is @code{[-10, 10]} and default value is @code{0.0}.
  16038. Negative values will blur the input video, while positive values will
  16039. sharpen it, a value of zero will disable the effect.
  16040. @end table
  16041. All parameters are optional and default to the equivalent of the
  16042. string '5:5:1.0:5:5:0.0'.
  16043. @subsection Examples
  16044. @itemize
  16045. @item
  16046. Apply strong luma sharpen effect:
  16047. @example
  16048. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  16049. @end example
  16050. @item
  16051. Apply a strong blur of both luma and chroma parameters:
  16052. @example
  16053. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  16054. @end example
  16055. @end itemize
  16056. @c man end OPENCL VIDEO FILTERS
  16057. @chapter VAAPI Video Filters
  16058. @c man begin VAAPI VIDEO FILTERS
  16059. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  16060. To enable compilation of these filters you need to configure FFmpeg with
  16061. @code{--enable-vaapi}.
  16062. 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}
  16063. @section tonemap_vappi
  16064. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  16065. It maps the dynamic range of HDR10 content to the SDR content.
  16066. It currently only accepts HDR10 as input.
  16067. It accepts the following parameters:
  16068. @table @option
  16069. @item format
  16070. Specify the output pixel format.
  16071. Currently supported formats are:
  16072. @table @var
  16073. @item p010
  16074. @item nv12
  16075. @end table
  16076. Default is nv12.
  16077. @item primaries, p
  16078. Set the output color primaries.
  16079. Default is same as input.
  16080. @item transfer, t
  16081. Set the output transfer characteristics.
  16082. Default is bt709.
  16083. @item matrix, m
  16084. Set the output colorspace matrix.
  16085. Default is same as input.
  16086. @end table
  16087. @subsection Example
  16088. @itemize
  16089. @item
  16090. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  16091. @example
  16092. tonemap_vaapi=format=p010:t=bt2020-10
  16093. @end example
  16094. @end itemize
  16095. @c man end VAAPI VIDEO FILTERS
  16096. @chapter Video Sources
  16097. @c man begin VIDEO SOURCES
  16098. Below is a description of the currently available video sources.
  16099. @section buffer
  16100. Buffer video frames, and make them available to the filter chain.
  16101. This source is mainly intended for a programmatic use, in particular
  16102. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  16103. It accepts the following parameters:
  16104. @table @option
  16105. @item video_size
  16106. Specify the size (width and height) of the buffered video frames. For the
  16107. syntax of this option, check the
  16108. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16109. @item width
  16110. The input video width.
  16111. @item height
  16112. The input video height.
  16113. @item pix_fmt
  16114. A string representing the pixel format of the buffered video frames.
  16115. It may be a number corresponding to a pixel format, or a pixel format
  16116. name.
  16117. @item time_base
  16118. Specify the timebase assumed by the timestamps of the buffered frames.
  16119. @item frame_rate
  16120. Specify the frame rate expected for the video stream.
  16121. @item pixel_aspect, sar
  16122. The sample (pixel) aspect ratio of the input video.
  16123. @item sws_param
  16124. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  16125. to the filtergraph description to specify swscale flags for automatically
  16126. inserted scalers. See @ref{Filtergraph syntax}.
  16127. @item hw_frames_ctx
  16128. When using a hardware pixel format, this should be a reference to an
  16129. AVHWFramesContext describing input frames.
  16130. @end table
  16131. For example:
  16132. @example
  16133. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  16134. @end example
  16135. will instruct the source to accept video frames with size 320x240 and
  16136. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  16137. square pixels (1:1 sample aspect ratio).
  16138. Since the pixel format with name "yuv410p" corresponds to the number 6
  16139. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  16140. this example corresponds to:
  16141. @example
  16142. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  16143. @end example
  16144. Alternatively, the options can be specified as a flat string, but this
  16145. syntax is deprecated:
  16146. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  16147. @section cellauto
  16148. Create a pattern generated by an elementary cellular automaton.
  16149. The initial state of the cellular automaton can be defined through the
  16150. @option{filename} and @option{pattern} options. If such options are
  16151. not specified an initial state is created randomly.
  16152. At each new frame a new row in the video is filled with the result of
  16153. the cellular automaton next generation. The behavior when the whole
  16154. frame is filled is defined by the @option{scroll} option.
  16155. This source accepts the following options:
  16156. @table @option
  16157. @item filename, f
  16158. Read the initial cellular automaton state, i.e. the starting row, from
  16159. the specified file.
  16160. In the file, each non-whitespace character is considered an alive
  16161. cell, a newline will terminate the row, and further characters in the
  16162. file will be ignored.
  16163. @item pattern, p
  16164. Read the initial cellular automaton state, i.e. the starting row, from
  16165. the specified string.
  16166. Each non-whitespace character in the string is considered an alive
  16167. cell, a newline will terminate the row, and further characters in the
  16168. string will be ignored.
  16169. @item rate, r
  16170. Set the video rate, that is the number of frames generated per second.
  16171. Default is 25.
  16172. @item random_fill_ratio, ratio
  16173. Set the random fill ratio for the initial cellular automaton row. It
  16174. is a floating point number value ranging from 0 to 1, defaults to
  16175. 1/PHI.
  16176. This option is ignored when a file or a pattern is specified.
  16177. @item random_seed, seed
  16178. Set the seed for filling randomly the initial row, must be an integer
  16179. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16180. set to -1, the filter will try to use a good random seed on a best
  16181. effort basis.
  16182. @item rule
  16183. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  16184. Default value is 110.
  16185. @item size, s
  16186. Set the size of the output video. For the syntax of this option, check the
  16187. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16188. If @option{filename} or @option{pattern} is specified, the size is set
  16189. by default to the width of the specified initial state row, and the
  16190. height is set to @var{width} * PHI.
  16191. If @option{size} is set, it must contain the width of the specified
  16192. pattern string, and the specified pattern will be centered in the
  16193. larger row.
  16194. If a filename or a pattern string is not specified, the size value
  16195. defaults to "320x518" (used for a randomly generated initial state).
  16196. @item scroll
  16197. If set to 1, scroll the output upward when all the rows in the output
  16198. have been already filled. If set to 0, the new generated row will be
  16199. written over the top row just after the bottom row is filled.
  16200. Defaults to 1.
  16201. @item start_full, full
  16202. If set to 1, completely fill the output with generated rows before
  16203. outputting the first frame.
  16204. This is the default behavior, for disabling set the value to 0.
  16205. @item stitch
  16206. If set to 1, stitch the left and right row edges together.
  16207. This is the default behavior, for disabling set the value to 0.
  16208. @end table
  16209. @subsection Examples
  16210. @itemize
  16211. @item
  16212. Read the initial state from @file{pattern}, and specify an output of
  16213. size 200x400.
  16214. @example
  16215. cellauto=f=pattern:s=200x400
  16216. @end example
  16217. @item
  16218. Generate a random initial row with a width of 200 cells, with a fill
  16219. ratio of 2/3:
  16220. @example
  16221. cellauto=ratio=2/3:s=200x200
  16222. @end example
  16223. @item
  16224. Create a pattern generated by rule 18 starting by a single alive cell
  16225. centered on an initial row with width 100:
  16226. @example
  16227. cellauto=p=@@:s=100x400:full=0:rule=18
  16228. @end example
  16229. @item
  16230. Specify a more elaborated initial pattern:
  16231. @example
  16232. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  16233. @end example
  16234. @end itemize
  16235. @anchor{coreimagesrc}
  16236. @section coreimagesrc
  16237. Video source generated on GPU using Apple's CoreImage API on OSX.
  16238. This video source is a specialized version of the @ref{coreimage} video filter.
  16239. Use a core image generator at the beginning of the applied filterchain to
  16240. generate the content.
  16241. The coreimagesrc video source accepts the following options:
  16242. @table @option
  16243. @item list_generators
  16244. List all available generators along with all their respective options as well as
  16245. possible minimum and maximum values along with the default values.
  16246. @example
  16247. list_generators=true
  16248. @end example
  16249. @item size, s
  16250. Specify the size of the sourced video. For the syntax of this option, check the
  16251. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16252. The default value is @code{320x240}.
  16253. @item rate, r
  16254. Specify the frame rate of the sourced video, as the number of frames
  16255. generated per second. It has to be a string in the format
  16256. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16257. number or a valid video frame rate abbreviation. The default value is
  16258. "25".
  16259. @item sar
  16260. Set the sample aspect ratio of the sourced video.
  16261. @item duration, d
  16262. Set the duration of the sourced video. See
  16263. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16264. for the accepted syntax.
  16265. If not specified, or the expressed duration is negative, the video is
  16266. supposed to be generated forever.
  16267. @end table
  16268. Additionally, all options of the @ref{coreimage} video filter are accepted.
  16269. A complete filterchain can be used for further processing of the
  16270. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  16271. and examples for details.
  16272. @subsection Examples
  16273. @itemize
  16274. @item
  16275. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  16276. given as complete and escaped command-line for Apple's standard bash shell:
  16277. @example
  16278. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  16279. @end example
  16280. This example is equivalent to the QRCode example of @ref{coreimage} without the
  16281. need for a nullsrc video source.
  16282. @end itemize
  16283. @section mandelbrot
  16284. Generate a Mandelbrot set fractal, and progressively zoom towards the
  16285. point specified with @var{start_x} and @var{start_y}.
  16286. This source accepts the following options:
  16287. @table @option
  16288. @item end_pts
  16289. Set the terminal pts value. Default value is 400.
  16290. @item end_scale
  16291. Set the terminal scale value.
  16292. Must be a floating point value. Default value is 0.3.
  16293. @item inner
  16294. Set the inner coloring mode, that is the algorithm used to draw the
  16295. Mandelbrot fractal internal region.
  16296. It shall assume one of the following values:
  16297. @table @option
  16298. @item black
  16299. Set black mode.
  16300. @item convergence
  16301. Show time until convergence.
  16302. @item mincol
  16303. Set color based on point closest to the origin of the iterations.
  16304. @item period
  16305. Set period mode.
  16306. @end table
  16307. Default value is @var{mincol}.
  16308. @item bailout
  16309. Set the bailout value. Default value is 10.0.
  16310. @item maxiter
  16311. Set the maximum of iterations performed by the rendering
  16312. algorithm. Default value is 7189.
  16313. @item outer
  16314. Set outer coloring mode.
  16315. It shall assume one of following values:
  16316. @table @option
  16317. @item iteration_count
  16318. Set iteration count mode.
  16319. @item normalized_iteration_count
  16320. set normalized iteration count mode.
  16321. @end table
  16322. Default value is @var{normalized_iteration_count}.
  16323. @item rate, r
  16324. Set frame rate, expressed as number of frames per second. Default
  16325. value is "25".
  16326. @item size, s
  16327. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16328. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16329. @item start_scale
  16330. Set the initial scale value. Default value is 3.0.
  16331. @item start_x
  16332. Set the initial x position. Must be a floating point value between
  16333. -100 and 100. Default value is -0.743643887037158704752191506114774.
  16334. @item start_y
  16335. Set the initial y position. Must be a floating point value between
  16336. -100 and 100. Default value is -0.131825904205311970493132056385139.
  16337. @end table
  16338. @section mptestsrc
  16339. Generate various test patterns, as generated by the MPlayer test filter.
  16340. The size of the generated video is fixed, and is 256x256.
  16341. This source is useful in particular for testing encoding features.
  16342. This source accepts the following options:
  16343. @table @option
  16344. @item rate, r
  16345. Specify the frame rate of the sourced video, as the number of frames
  16346. generated per second. It has to be a string in the format
  16347. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16348. number or a valid video frame rate abbreviation. The default value is
  16349. "25".
  16350. @item duration, d
  16351. Set the duration of the sourced video. See
  16352. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16353. for the accepted syntax.
  16354. If not specified, or the expressed duration is negative, the video is
  16355. supposed to be generated forever.
  16356. @item test, t
  16357. Set the number or the name of the test to perform. Supported tests are:
  16358. @table @option
  16359. @item dc_luma
  16360. @item dc_chroma
  16361. @item freq_luma
  16362. @item freq_chroma
  16363. @item amp_luma
  16364. @item amp_chroma
  16365. @item cbp
  16366. @item mv
  16367. @item ring1
  16368. @item ring2
  16369. @item all
  16370. @item max_frames, m
  16371. Set the maximum number of frames generated for each test, default value is 30.
  16372. @end table
  16373. Default value is "all", which will cycle through the list of all tests.
  16374. @end table
  16375. Some examples:
  16376. @example
  16377. mptestsrc=t=dc_luma
  16378. @end example
  16379. will generate a "dc_luma" test pattern.
  16380. @section frei0r_src
  16381. Provide a frei0r source.
  16382. To enable compilation of this filter you need to install the frei0r
  16383. header and configure FFmpeg with @code{--enable-frei0r}.
  16384. This source accepts the following parameters:
  16385. @table @option
  16386. @item size
  16387. The size of the video to generate. For the syntax of this option, check the
  16388. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16389. @item framerate
  16390. The framerate of the generated video. It may be a string of the form
  16391. @var{num}/@var{den} or a frame rate abbreviation.
  16392. @item filter_name
  16393. The name to the frei0r source to load. For more information regarding frei0r and
  16394. how to set the parameters, read the @ref{frei0r} section in the video filters
  16395. documentation.
  16396. @item filter_params
  16397. A '|'-separated list of parameters to pass to the frei0r source.
  16398. @end table
  16399. For example, to generate a frei0r partik0l source with size 200x200
  16400. and frame rate 10 which is overlaid on the overlay filter main input:
  16401. @example
  16402. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  16403. @end example
  16404. @section life
  16405. Generate a life pattern.
  16406. This source is based on a generalization of John Conway's life game.
  16407. The sourced input represents a life grid, each pixel represents a cell
  16408. which can be in one of two possible states, alive or dead. Every cell
  16409. interacts with its eight neighbours, which are the cells that are
  16410. horizontally, vertically, or diagonally adjacent.
  16411. At each interaction the grid evolves according to the adopted rule,
  16412. which specifies the number of neighbor alive cells which will make a
  16413. cell stay alive or born. The @option{rule} option allows one to specify
  16414. the rule to adopt.
  16415. This source accepts the following options:
  16416. @table @option
  16417. @item filename, f
  16418. Set the file from which to read the initial grid state. In the file,
  16419. each non-whitespace character is considered an alive cell, and newline
  16420. is used to delimit the end of each row.
  16421. If this option is not specified, the initial grid is generated
  16422. randomly.
  16423. @item rate, r
  16424. Set the video rate, that is the number of frames generated per second.
  16425. Default is 25.
  16426. @item random_fill_ratio, ratio
  16427. Set the random fill ratio for the initial random grid. It is a
  16428. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  16429. It is ignored when a file is specified.
  16430. @item random_seed, seed
  16431. Set the seed for filling the initial random grid, must be an integer
  16432. included between 0 and UINT32_MAX. If not specified, or if explicitly
  16433. set to -1, the filter will try to use a good random seed on a best
  16434. effort basis.
  16435. @item rule
  16436. Set the life rule.
  16437. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  16438. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  16439. @var{NS} specifies the number of alive neighbor cells which make a
  16440. live cell stay alive, and @var{NB} the number of alive neighbor cells
  16441. which make a dead cell to become alive (i.e. to "born").
  16442. "s" and "b" can be used in place of "S" and "B", respectively.
  16443. Alternatively a rule can be specified by an 18-bits integer. The 9
  16444. high order bits are used to encode the next cell state if it is alive
  16445. for each number of neighbor alive cells, the low order bits specify
  16446. the rule for "borning" new cells. Higher order bits encode for an
  16447. higher number of neighbor cells.
  16448. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  16449. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  16450. Default value is "S23/B3", which is the original Conway's game of life
  16451. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  16452. cells, and will born a new cell if there are three alive cells around
  16453. a dead cell.
  16454. @item size, s
  16455. Set the size of the output video. For the syntax of this option, check the
  16456. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16457. If @option{filename} is specified, the size is set by default to the
  16458. same size of the input file. If @option{size} is set, it must contain
  16459. the size specified in the input file, and the initial grid defined in
  16460. that file is centered in the larger resulting area.
  16461. If a filename is not specified, the size value defaults to "320x240"
  16462. (used for a randomly generated initial grid).
  16463. @item stitch
  16464. If set to 1, stitch the left and right grid edges together, and the
  16465. top and bottom edges also. Defaults to 1.
  16466. @item mold
  16467. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  16468. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  16469. value from 0 to 255.
  16470. @item life_color
  16471. Set the color of living (or new born) cells.
  16472. @item death_color
  16473. Set the color of dead cells. If @option{mold} is set, this is the first color
  16474. used to represent a dead cell.
  16475. @item mold_color
  16476. Set mold color, for definitely dead and moldy cells.
  16477. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  16478. ffmpeg-utils manual,ffmpeg-utils}.
  16479. @end table
  16480. @subsection Examples
  16481. @itemize
  16482. @item
  16483. Read a grid from @file{pattern}, and center it on a grid of size
  16484. 300x300 pixels:
  16485. @example
  16486. life=f=pattern:s=300x300
  16487. @end example
  16488. @item
  16489. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16490. @example
  16491. life=ratio=2/3:s=200x200
  16492. @end example
  16493. @item
  16494. Specify a custom rule for evolving a randomly generated grid:
  16495. @example
  16496. life=rule=S14/B34
  16497. @end example
  16498. @item
  16499. Full example with slow death effect (mold) using @command{ffplay}:
  16500. @example
  16501. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16502. @end example
  16503. @end itemize
  16504. @anchor{allrgb}
  16505. @anchor{allyuv}
  16506. @anchor{color}
  16507. @anchor{haldclutsrc}
  16508. @anchor{nullsrc}
  16509. @anchor{pal75bars}
  16510. @anchor{pal100bars}
  16511. @anchor{rgbtestsrc}
  16512. @anchor{smptebars}
  16513. @anchor{smptehdbars}
  16514. @anchor{testsrc}
  16515. @anchor{testsrc2}
  16516. @anchor{yuvtestsrc}
  16517. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16518. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16519. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16520. The @code{color} source provides an uniformly colored input.
  16521. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16522. @ref{haldclut} filter.
  16523. The @code{nullsrc} source returns unprocessed video frames. It is
  16524. mainly useful to be employed in analysis / debugging tools, or as the
  16525. source for filters which ignore the input data.
  16526. The @code{pal75bars} source generates a color bars pattern, based on
  16527. EBU PAL recommendations with 75% color levels.
  16528. The @code{pal100bars} source generates a color bars pattern, based on
  16529. EBU PAL recommendations with 100% color levels.
  16530. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16531. detecting RGB vs BGR issues. You should see a red, green and blue
  16532. stripe from top to bottom.
  16533. The @code{smptebars} source generates a color bars pattern, based on
  16534. the SMPTE Engineering Guideline EG 1-1990.
  16535. The @code{smptehdbars} source generates a color bars pattern, based on
  16536. the SMPTE RP 219-2002.
  16537. The @code{testsrc} source generates a test video pattern, showing a
  16538. color pattern, a scrolling gradient and a timestamp. This is mainly
  16539. intended for testing purposes.
  16540. The @code{testsrc2} source is similar to testsrc, but supports more
  16541. pixel formats instead of just @code{rgb24}. This allows using it as an
  16542. input for other tests without requiring a format conversion.
  16543. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16544. see a y, cb and cr stripe from top to bottom.
  16545. The sources accept the following parameters:
  16546. @table @option
  16547. @item level
  16548. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16549. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16550. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16551. coded on a @code{1/(N*N)} scale.
  16552. @item color, c
  16553. Specify the color of the source, only available in the @code{color}
  16554. source. For the syntax of this option, check the
  16555. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16556. @item size, s
  16557. Specify the size of the sourced video. For the syntax of this option, check the
  16558. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16559. The default value is @code{320x240}.
  16560. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16561. @code{haldclutsrc} filters.
  16562. @item rate, r
  16563. Specify the frame rate of the sourced video, as the number of frames
  16564. generated per second. It has to be a string in the format
  16565. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16566. number or a valid video frame rate abbreviation. The default value is
  16567. "25".
  16568. @item duration, d
  16569. Set the duration of the sourced video. See
  16570. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16571. for the accepted syntax.
  16572. If not specified, or the expressed duration is negative, the video is
  16573. supposed to be generated forever.
  16574. @item sar
  16575. Set the sample aspect ratio of the sourced video.
  16576. @item alpha
  16577. Specify the alpha (opacity) of the background, only available in the
  16578. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16579. 255 (fully opaque, the default).
  16580. @item decimals, n
  16581. Set the number of decimals to show in the timestamp, only available in the
  16582. @code{testsrc} source.
  16583. The displayed timestamp value will correspond to the original
  16584. timestamp value multiplied by the power of 10 of the specified
  16585. value. Default value is 0.
  16586. @end table
  16587. @subsection Examples
  16588. @itemize
  16589. @item
  16590. Generate a video with a duration of 5.3 seconds, with size
  16591. 176x144 and a frame rate of 10 frames per second:
  16592. @example
  16593. testsrc=duration=5.3:size=qcif:rate=10
  16594. @end example
  16595. @item
  16596. The following graph description will generate a red source
  16597. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16598. frames per second:
  16599. @example
  16600. color=c=red@@0.2:s=qcif:r=10
  16601. @end example
  16602. @item
  16603. If the input content is to be ignored, @code{nullsrc} can be used. The
  16604. following command generates noise in the luminance plane by employing
  16605. the @code{geq} filter:
  16606. @example
  16607. nullsrc=s=256x256, geq=random(1)*255:128:128
  16608. @end example
  16609. @end itemize
  16610. @subsection Commands
  16611. The @code{color} source supports the following commands:
  16612. @table @option
  16613. @item c, color
  16614. Set the color of the created image. Accepts the same syntax of the
  16615. corresponding @option{color} option.
  16616. @end table
  16617. @section openclsrc
  16618. Generate video using an OpenCL program.
  16619. @table @option
  16620. @item source
  16621. OpenCL program source file.
  16622. @item kernel
  16623. Kernel name in program.
  16624. @item size, s
  16625. Size of frames to generate. This must be set.
  16626. @item format
  16627. Pixel format to use for the generated frames. This must be set.
  16628. @item rate, r
  16629. Number of frames generated every second. Default value is '25'.
  16630. @end table
  16631. For details of how the program loading works, see the @ref{program_opencl}
  16632. filter.
  16633. Example programs:
  16634. @itemize
  16635. @item
  16636. Generate a colour ramp by setting pixel values from the position of the pixel
  16637. in the output image. (Note that this will work with all pixel formats, but
  16638. the generated output will not be the same.)
  16639. @verbatim
  16640. __kernel void ramp(__write_only image2d_t dst,
  16641. unsigned int index)
  16642. {
  16643. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16644. float4 val;
  16645. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16646. write_imagef(dst, loc, val);
  16647. }
  16648. @end verbatim
  16649. @item
  16650. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16651. @verbatim
  16652. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16653. unsigned int index)
  16654. {
  16655. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16656. float4 value = 0.0f;
  16657. int x = loc.x + index;
  16658. int y = loc.y + index;
  16659. while (x > 0 || y > 0) {
  16660. if (x % 3 == 1 && y % 3 == 1) {
  16661. value = 1.0f;
  16662. break;
  16663. }
  16664. x /= 3;
  16665. y /= 3;
  16666. }
  16667. write_imagef(dst, loc, value);
  16668. }
  16669. @end verbatim
  16670. @end itemize
  16671. @section sierpinski
  16672. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16673. This source accepts the following options:
  16674. @table @option
  16675. @item size, s
  16676. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16677. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16678. @item rate, r
  16679. Set frame rate, expressed as number of frames per second. Default
  16680. value is "25".
  16681. @item seed
  16682. Set seed which is used for random panning.
  16683. @item jump
  16684. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16685. @item type
  16686. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16687. @end table
  16688. @c man end VIDEO SOURCES
  16689. @chapter Video Sinks
  16690. @c man begin VIDEO SINKS
  16691. Below is a description of the currently available video sinks.
  16692. @section buffersink
  16693. Buffer video frames, and make them available to the end of the filter
  16694. graph.
  16695. This sink is mainly intended for programmatic use, in particular
  16696. through the interface defined in @file{libavfilter/buffersink.h}
  16697. or the options system.
  16698. It accepts a pointer to an AVBufferSinkContext structure, which
  16699. defines the incoming buffers' formats, to be passed as the opaque
  16700. parameter to @code{avfilter_init_filter} for initialization.
  16701. @section nullsink
  16702. Null video sink: do absolutely nothing with the input video. It is
  16703. mainly useful as a template and for use in analysis / debugging
  16704. tools.
  16705. @c man end VIDEO SINKS
  16706. @chapter Multimedia Filters
  16707. @c man begin MULTIMEDIA FILTERS
  16708. Below is a description of the currently available multimedia filters.
  16709. @section abitscope
  16710. Convert input audio to a video output, displaying the audio bit scope.
  16711. The filter accepts the following options:
  16712. @table @option
  16713. @item rate, r
  16714. Set frame rate, expressed as number of frames per second. Default
  16715. value is "25".
  16716. @item size, s
  16717. Specify the video size for the output. For the syntax of this option, check the
  16718. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16719. Default value is @code{1024x256}.
  16720. @item colors
  16721. Specify list of colors separated by space or by '|' which will be used to
  16722. draw channels. Unrecognized or missing colors will be replaced
  16723. by white color.
  16724. @end table
  16725. @section adrawgraph
  16726. Draw a graph using input audio metadata.
  16727. See @ref{drawgraph}
  16728. @section agraphmonitor
  16729. See @ref{graphmonitor}.
  16730. @section ahistogram
  16731. Convert input audio to a video output, displaying the volume histogram.
  16732. The filter accepts the following options:
  16733. @table @option
  16734. @item dmode
  16735. Specify how histogram is calculated.
  16736. It accepts the following values:
  16737. @table @samp
  16738. @item single
  16739. Use single histogram for all channels.
  16740. @item separate
  16741. Use separate histogram for each channel.
  16742. @end table
  16743. Default is @code{single}.
  16744. @item rate, r
  16745. Set frame rate, expressed as number of frames per second. Default
  16746. value is "25".
  16747. @item size, s
  16748. Specify the video size for the output. For the syntax of this option, check the
  16749. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16750. Default value is @code{hd720}.
  16751. @item scale
  16752. Set display scale.
  16753. It accepts the following values:
  16754. @table @samp
  16755. @item log
  16756. logarithmic
  16757. @item sqrt
  16758. square root
  16759. @item cbrt
  16760. cubic root
  16761. @item lin
  16762. linear
  16763. @item rlog
  16764. reverse logarithmic
  16765. @end table
  16766. Default is @code{log}.
  16767. @item ascale
  16768. Set amplitude scale.
  16769. It accepts the following values:
  16770. @table @samp
  16771. @item log
  16772. logarithmic
  16773. @item lin
  16774. linear
  16775. @end table
  16776. Default is @code{log}.
  16777. @item acount
  16778. Set how much frames to accumulate in histogram.
  16779. Default is 1. Setting this to -1 accumulates all frames.
  16780. @item rheight
  16781. Set histogram ratio of window height.
  16782. @item slide
  16783. Set sonogram sliding.
  16784. It accepts the following values:
  16785. @table @samp
  16786. @item replace
  16787. replace old rows with new ones.
  16788. @item scroll
  16789. scroll from top to bottom.
  16790. @end table
  16791. Default is @code{replace}.
  16792. @end table
  16793. @section aphasemeter
  16794. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16795. representing mean phase of current audio frame. A video output can also be produced and is
  16796. enabled by default. The audio is passed through as first output.
  16797. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16798. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16799. and @code{1} means channels are in phase.
  16800. The filter accepts the following options, all related to its video output:
  16801. @table @option
  16802. @item rate, r
  16803. Set the output frame rate. Default value is @code{25}.
  16804. @item size, s
  16805. Set the video size for the output. For the syntax of this option, check the
  16806. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16807. Default value is @code{800x400}.
  16808. @item rc
  16809. @item gc
  16810. @item bc
  16811. Specify the red, green, blue contrast. Default values are @code{2},
  16812. @code{7} and @code{1}.
  16813. Allowed range is @code{[0, 255]}.
  16814. @item mpc
  16815. Set color which will be used for drawing median phase. If color is
  16816. @code{none} which is default, no median phase value will be drawn.
  16817. @item video
  16818. Enable video output. Default is enabled.
  16819. @end table
  16820. @section avectorscope
  16821. Convert input audio to a video output, representing the audio vector
  16822. scope.
  16823. The filter is used to measure the difference between channels of stereo
  16824. audio stream. A monaural signal, consisting of identical left and right
  16825. signal, results in straight vertical line. Any stereo separation is visible
  16826. as a deviation from this line, creating a Lissajous figure.
  16827. If the straight (or deviation from it) but horizontal line appears this
  16828. indicates that the left and right channels are out of phase.
  16829. The filter accepts the following options:
  16830. @table @option
  16831. @item mode, m
  16832. Set the vectorscope mode.
  16833. Available values are:
  16834. @table @samp
  16835. @item lissajous
  16836. Lissajous rotated by 45 degrees.
  16837. @item lissajous_xy
  16838. Same as above but not rotated.
  16839. @item polar
  16840. Shape resembling half of circle.
  16841. @end table
  16842. Default value is @samp{lissajous}.
  16843. @item size, s
  16844. Set the video size for the output. For the syntax of this option, check the
  16845. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16846. Default value is @code{400x400}.
  16847. @item rate, r
  16848. Set the output frame rate. Default value is @code{25}.
  16849. @item rc
  16850. @item gc
  16851. @item bc
  16852. @item ac
  16853. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16854. @code{160}, @code{80} and @code{255}.
  16855. Allowed range is @code{[0, 255]}.
  16856. @item rf
  16857. @item gf
  16858. @item bf
  16859. @item af
  16860. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16861. @code{10}, @code{5} and @code{5}.
  16862. Allowed range is @code{[0, 255]}.
  16863. @item zoom
  16864. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16865. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16866. @item draw
  16867. Set the vectorscope drawing mode.
  16868. Available values are:
  16869. @table @samp
  16870. @item dot
  16871. Draw dot for each sample.
  16872. @item line
  16873. Draw line between previous and current sample.
  16874. @end table
  16875. Default value is @samp{dot}.
  16876. @item scale
  16877. Specify amplitude scale of audio samples.
  16878. Available values are:
  16879. @table @samp
  16880. @item lin
  16881. Linear.
  16882. @item sqrt
  16883. Square root.
  16884. @item cbrt
  16885. Cubic root.
  16886. @item log
  16887. Logarithmic.
  16888. @end table
  16889. @item swap
  16890. Swap left channel axis with right channel axis.
  16891. @item mirror
  16892. Mirror axis.
  16893. @table @samp
  16894. @item none
  16895. No mirror.
  16896. @item x
  16897. Mirror only x axis.
  16898. @item y
  16899. Mirror only y axis.
  16900. @item xy
  16901. Mirror both axis.
  16902. @end table
  16903. @end table
  16904. @subsection Examples
  16905. @itemize
  16906. @item
  16907. Complete example using @command{ffplay}:
  16908. @example
  16909. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16910. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16911. @end example
  16912. @end itemize
  16913. @section bench, abench
  16914. Benchmark part of a filtergraph.
  16915. The filter accepts the following options:
  16916. @table @option
  16917. @item action
  16918. Start or stop a timer.
  16919. Available values are:
  16920. @table @samp
  16921. @item start
  16922. Get the current time, set it as frame metadata (using the key
  16923. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16924. @item stop
  16925. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16926. the input frame metadata to get the time difference. Time difference, average,
  16927. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16928. @code{min}) are then printed. The timestamps are expressed in seconds.
  16929. @end table
  16930. @end table
  16931. @subsection Examples
  16932. @itemize
  16933. @item
  16934. Benchmark @ref{selectivecolor} filter:
  16935. @example
  16936. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16937. @end example
  16938. @end itemize
  16939. @section concat
  16940. Concatenate audio and video streams, joining them together one after the
  16941. other.
  16942. The filter works on segments of synchronized video and audio streams. All
  16943. segments must have the same number of streams of each type, and that will
  16944. also be the number of streams at output.
  16945. The filter accepts the following options:
  16946. @table @option
  16947. @item n
  16948. Set the number of segments. Default is 2.
  16949. @item v
  16950. Set the number of output video streams, that is also the number of video
  16951. streams in each segment. Default is 1.
  16952. @item a
  16953. Set the number of output audio streams, that is also the number of audio
  16954. streams in each segment. Default is 0.
  16955. @item unsafe
  16956. Activate unsafe mode: do not fail if segments have a different format.
  16957. @end table
  16958. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16959. @var{a} audio outputs.
  16960. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16961. segment, in the same order as the outputs, then the inputs for the second
  16962. segment, etc.
  16963. Related streams do not always have exactly the same duration, for various
  16964. reasons including codec frame size or sloppy authoring. For that reason,
  16965. related synchronized streams (e.g. a video and its audio track) should be
  16966. concatenated at once. The concat filter will use the duration of the longest
  16967. stream in each segment (except the last one), and if necessary pad shorter
  16968. audio streams with silence.
  16969. For this filter to work correctly, all segments must start at timestamp 0.
  16970. All corresponding streams must have the same parameters in all segments; the
  16971. filtering system will automatically select a common pixel format for video
  16972. streams, and a common sample format, sample rate and channel layout for
  16973. audio streams, but other settings, such as resolution, must be converted
  16974. explicitly by the user.
  16975. Different frame rates are acceptable but will result in variable frame rate
  16976. at output; be sure to configure the output file to handle it.
  16977. @subsection Examples
  16978. @itemize
  16979. @item
  16980. Concatenate an opening, an episode and an ending, all in bilingual version
  16981. (video in stream 0, audio in streams 1 and 2):
  16982. @example
  16983. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16984. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16985. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16986. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16987. @end example
  16988. @item
  16989. Concatenate two parts, handling audio and video separately, using the
  16990. (a)movie sources, and adjusting the resolution:
  16991. @example
  16992. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16993. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16994. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16995. @end example
  16996. Note that a desync will happen at the stitch if the audio and video streams
  16997. do not have exactly the same duration in the first file.
  16998. @end itemize
  16999. @subsection Commands
  17000. This filter supports the following commands:
  17001. @table @option
  17002. @item next
  17003. Close the current segment and step to the next one
  17004. @end table
  17005. @anchor{ebur128}
  17006. @section ebur128
  17007. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  17008. level. By default, it logs a message at a frequency of 10Hz with the
  17009. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  17010. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  17011. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  17012. sample format is double-precision floating point. The input stream will be converted to
  17013. this specification, if needed. Users may need to insert aformat and/or aresample filters
  17014. after this filter to obtain the original parameters.
  17015. The filter also has a video output (see the @var{video} option) with a real
  17016. time graph to observe the loudness evolution. The graphic contains the logged
  17017. message mentioned above, so it is not printed anymore when this option is set,
  17018. unless the verbose logging is set. The main graphing area contains the
  17019. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  17020. the momentary loudness (400 milliseconds), but can optionally be configured
  17021. to instead display short-term loudness (see @var{gauge}).
  17022. The green area marks a +/- 1LU target range around the target loudness
  17023. (-23LUFS by default, unless modified through @var{target}).
  17024. More information about the Loudness Recommendation EBU R128 on
  17025. @url{http://tech.ebu.ch/loudness}.
  17026. The filter accepts the following options:
  17027. @table @option
  17028. @item video
  17029. Activate the video output. The audio stream is passed unchanged whether this
  17030. option is set or no. The video stream will be the first output stream if
  17031. activated. Default is @code{0}.
  17032. @item size
  17033. Set the video size. This option is for video only. For the syntax of this
  17034. option, check the
  17035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17036. Default and minimum resolution is @code{640x480}.
  17037. @item meter
  17038. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  17039. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  17040. other integer value between this range is allowed.
  17041. @item metadata
  17042. Set metadata injection. If set to @code{1}, the audio input will be segmented
  17043. into 100ms output frames, each of them containing various loudness information
  17044. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  17045. Default is @code{0}.
  17046. @item framelog
  17047. Force the frame logging level.
  17048. Available values are:
  17049. @table @samp
  17050. @item info
  17051. information logging level
  17052. @item verbose
  17053. verbose logging level
  17054. @end table
  17055. By default, the logging level is set to @var{info}. If the @option{video} or
  17056. the @option{metadata} options are set, it switches to @var{verbose}.
  17057. @item peak
  17058. Set peak mode(s).
  17059. Available modes can be cumulated (the option is a @code{flag} type). Possible
  17060. values are:
  17061. @table @samp
  17062. @item none
  17063. Disable any peak mode (default).
  17064. @item sample
  17065. Enable sample-peak mode.
  17066. Simple peak mode looking for the higher sample value. It logs a message
  17067. for sample-peak (identified by @code{SPK}).
  17068. @item true
  17069. Enable true-peak mode.
  17070. If enabled, the peak lookup is done on an over-sampled version of the input
  17071. stream for better peak accuracy. It logs a message for true-peak.
  17072. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  17073. This mode requires a build with @code{libswresample}.
  17074. @end table
  17075. @item dualmono
  17076. Treat mono input files as "dual mono". If a mono file is intended for playback
  17077. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  17078. If set to @code{true}, this option will compensate for this effect.
  17079. Multi-channel input files are not affected by this option.
  17080. @item panlaw
  17081. Set a specific pan law to be used for the measurement of dual mono files.
  17082. This parameter is optional, and has a default value of -3.01dB.
  17083. @item target
  17084. Set a specific target level (in LUFS) used as relative zero in the visualization.
  17085. This parameter is optional and has a default value of -23LUFS as specified
  17086. by EBU R128. However, material published online may prefer a level of -16LUFS
  17087. (e.g. for use with podcasts or video platforms).
  17088. @item gauge
  17089. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  17090. @code{shortterm}. By default the momentary value will be used, but in certain
  17091. scenarios it may be more useful to observe the short term value instead (e.g.
  17092. live mixing).
  17093. @item scale
  17094. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  17095. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  17096. video output, not the summary or continuous log output.
  17097. @end table
  17098. @subsection Examples
  17099. @itemize
  17100. @item
  17101. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  17102. @example
  17103. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  17104. @end example
  17105. @item
  17106. Run an analysis with @command{ffmpeg}:
  17107. @example
  17108. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  17109. @end example
  17110. @end itemize
  17111. @section interleave, ainterleave
  17112. Temporally interleave frames from several inputs.
  17113. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  17114. These filters read frames from several inputs and send the oldest
  17115. queued frame to the output.
  17116. Input streams must have well defined, monotonically increasing frame
  17117. timestamp values.
  17118. In order to submit one frame to output, these filters need to enqueue
  17119. at least one frame for each input, so they cannot work in case one
  17120. input is not yet terminated and will not receive incoming frames.
  17121. For example consider the case when one input is a @code{select} filter
  17122. which always drops input frames. The @code{interleave} filter will keep
  17123. reading from that input, but it will never be able to send new frames
  17124. to output until the input sends an end-of-stream signal.
  17125. Also, depending on inputs synchronization, the filters will drop
  17126. frames in case one input receives more frames than the other ones, and
  17127. the queue is already filled.
  17128. These filters accept the following options:
  17129. @table @option
  17130. @item nb_inputs, n
  17131. Set the number of different inputs, it is 2 by default.
  17132. @end table
  17133. @subsection Examples
  17134. @itemize
  17135. @item
  17136. Interleave frames belonging to different streams using @command{ffmpeg}:
  17137. @example
  17138. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  17139. @end example
  17140. @item
  17141. Add flickering blur effect:
  17142. @example
  17143. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  17144. @end example
  17145. @end itemize
  17146. @section metadata, ametadata
  17147. Manipulate frame metadata.
  17148. This filter accepts the following options:
  17149. @table @option
  17150. @item mode
  17151. Set mode of operation of the filter.
  17152. Can be one of the following:
  17153. @table @samp
  17154. @item select
  17155. If both @code{value} and @code{key} is set, select frames
  17156. which have such metadata. If only @code{key} is set, select
  17157. every frame that has such key in metadata.
  17158. @item add
  17159. Add new metadata @code{key} and @code{value}. If key is already available
  17160. do nothing.
  17161. @item modify
  17162. Modify value of already present key.
  17163. @item delete
  17164. If @code{value} is set, delete only keys that have such value.
  17165. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  17166. the frame.
  17167. @item print
  17168. Print key and its value if metadata was found. If @code{key} is not set print all
  17169. metadata values available in frame.
  17170. @end table
  17171. @item key
  17172. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  17173. @item value
  17174. Set metadata value which will be used. This option is mandatory for
  17175. @code{modify} and @code{add} mode.
  17176. @item function
  17177. Which function to use when comparing metadata value and @code{value}.
  17178. Can be one of following:
  17179. @table @samp
  17180. @item same_str
  17181. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  17182. @item starts_with
  17183. Values are interpreted as strings, returns true if metadata value starts with
  17184. the @code{value} option string.
  17185. @item less
  17186. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  17187. @item equal
  17188. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  17189. @item greater
  17190. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  17191. @item expr
  17192. Values are interpreted as floats, returns true if expression from option @code{expr}
  17193. evaluates to true.
  17194. @item ends_with
  17195. Values are interpreted as strings, returns true if metadata value ends with
  17196. the @code{value} option string.
  17197. @end table
  17198. @item expr
  17199. Set expression which is used when @code{function} is set to @code{expr}.
  17200. The expression is evaluated through the eval API and can contain the following
  17201. constants:
  17202. @table @option
  17203. @item VALUE1
  17204. Float representation of @code{value} from metadata key.
  17205. @item VALUE2
  17206. Float representation of @code{value} as supplied by user in @code{value} option.
  17207. @end table
  17208. @item file
  17209. If specified in @code{print} mode, output is written to the named file. Instead of
  17210. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  17211. for standard output. If @code{file} option is not set, output is written to the log
  17212. with AV_LOG_INFO loglevel.
  17213. @end table
  17214. @subsection Examples
  17215. @itemize
  17216. @item
  17217. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  17218. between 0 and 1.
  17219. @example
  17220. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  17221. @end example
  17222. @item
  17223. Print silencedetect output to file @file{metadata.txt}.
  17224. @example
  17225. silencedetect,ametadata=mode=print:file=metadata.txt
  17226. @end example
  17227. @item
  17228. Direct all metadata to a pipe with file descriptor 4.
  17229. @example
  17230. metadata=mode=print:file='pipe\:4'
  17231. @end example
  17232. @end itemize
  17233. @section perms, aperms
  17234. Set read/write permissions for the output frames.
  17235. These filters are mainly aimed at developers to test direct path in the
  17236. following filter in the filtergraph.
  17237. The filters accept the following options:
  17238. @table @option
  17239. @item mode
  17240. Select the permissions mode.
  17241. It accepts the following values:
  17242. @table @samp
  17243. @item none
  17244. Do nothing. This is the default.
  17245. @item ro
  17246. Set all the output frames read-only.
  17247. @item rw
  17248. Set all the output frames directly writable.
  17249. @item toggle
  17250. Make the frame read-only if writable, and writable if read-only.
  17251. @item random
  17252. Set each output frame read-only or writable randomly.
  17253. @end table
  17254. @item seed
  17255. Set the seed for the @var{random} mode, must be an integer included between
  17256. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  17257. @code{-1}, the filter will try to use a good random seed on a best effort
  17258. basis.
  17259. @end table
  17260. Note: in case of auto-inserted filter between the permission filter and the
  17261. following one, the permission might not be received as expected in that
  17262. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  17263. perms/aperms filter can avoid this problem.
  17264. @section realtime, arealtime
  17265. Slow down filtering to match real time approximately.
  17266. These filters will pause the filtering for a variable amount of time to
  17267. match the output rate with the input timestamps.
  17268. They are similar to the @option{re} option to @code{ffmpeg}.
  17269. They accept the following options:
  17270. @table @option
  17271. @item limit
  17272. Time limit for the pauses. Any pause longer than that will be considered
  17273. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  17274. @item speed
  17275. Speed factor for processing. The value must be a float larger than zero.
  17276. Values larger than 1.0 will result in faster than realtime processing,
  17277. smaller will slow processing down. The @var{limit} is automatically adapted
  17278. accordingly. Default is 1.0.
  17279. A processing speed faster than what is possible without these filters cannot
  17280. be achieved.
  17281. @end table
  17282. @anchor{select}
  17283. @section select, aselect
  17284. Select frames to pass in output.
  17285. This filter accepts the following options:
  17286. @table @option
  17287. @item expr, e
  17288. Set expression, which is evaluated for each input frame.
  17289. If the expression is evaluated to zero, the frame is discarded.
  17290. If the evaluation result is negative or NaN, the frame is sent to the
  17291. first output; otherwise it is sent to the output with index
  17292. @code{ceil(val)-1}, assuming that the input index starts from 0.
  17293. For example a value of @code{1.2} corresponds to the output with index
  17294. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  17295. @item outputs, n
  17296. Set the number of outputs. The output to which to send the selected
  17297. frame is based on the result of the evaluation. Default value is 1.
  17298. @end table
  17299. The expression can contain the following constants:
  17300. @table @option
  17301. @item n
  17302. The (sequential) number of the filtered frame, starting from 0.
  17303. @item selected_n
  17304. The (sequential) number of the selected frame, starting from 0.
  17305. @item prev_selected_n
  17306. The sequential number of the last selected frame. It's NAN if undefined.
  17307. @item TB
  17308. The timebase of the input timestamps.
  17309. @item pts
  17310. The PTS (Presentation TimeStamp) of the filtered video frame,
  17311. expressed in @var{TB} units. It's NAN if undefined.
  17312. @item t
  17313. The PTS of the filtered video frame,
  17314. expressed in seconds. It's NAN if undefined.
  17315. @item prev_pts
  17316. The PTS of the previously filtered video frame. It's NAN if undefined.
  17317. @item prev_selected_pts
  17318. The PTS of the last previously filtered video frame. It's NAN if undefined.
  17319. @item prev_selected_t
  17320. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  17321. @item start_pts
  17322. The PTS of the first video frame in the video. It's NAN if undefined.
  17323. @item start_t
  17324. The time of the first video frame in the video. It's NAN if undefined.
  17325. @item pict_type @emph{(video only)}
  17326. The type of the filtered frame. It can assume one of the following
  17327. values:
  17328. @table @option
  17329. @item I
  17330. @item P
  17331. @item B
  17332. @item S
  17333. @item SI
  17334. @item SP
  17335. @item BI
  17336. @end table
  17337. @item interlace_type @emph{(video only)}
  17338. The frame interlace type. It can assume one of the following values:
  17339. @table @option
  17340. @item PROGRESSIVE
  17341. The frame is progressive (not interlaced).
  17342. @item TOPFIRST
  17343. The frame is top-field-first.
  17344. @item BOTTOMFIRST
  17345. The frame is bottom-field-first.
  17346. @end table
  17347. @item consumed_sample_n @emph{(audio only)}
  17348. the number of selected samples before the current frame
  17349. @item samples_n @emph{(audio only)}
  17350. the number of samples in the current frame
  17351. @item sample_rate @emph{(audio only)}
  17352. the input sample rate
  17353. @item key
  17354. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  17355. @item pos
  17356. the position in the file of the filtered frame, -1 if the information
  17357. is not available (e.g. for synthetic video)
  17358. @item scene @emph{(video only)}
  17359. value between 0 and 1 to indicate a new scene; a low value reflects a low
  17360. probability for the current frame to introduce a new scene, while a higher
  17361. value means the current frame is more likely to be one (see the example below)
  17362. @item concatdec_select
  17363. The concat demuxer can select only part of a concat input file by setting an
  17364. inpoint and an outpoint, but the output packets may not be entirely contained
  17365. in the selected interval. By using this variable, it is possible to skip frames
  17366. generated by the concat demuxer which are not exactly contained in the selected
  17367. interval.
  17368. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  17369. and the @var{lavf.concat.duration} packet metadata values which are also
  17370. present in the decoded frames.
  17371. The @var{concatdec_select} variable is -1 if the frame pts is at least
  17372. start_time and either the duration metadata is missing or the frame pts is less
  17373. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  17374. missing.
  17375. That basically means that an input frame is selected if its pts is within the
  17376. interval set by the concat demuxer.
  17377. @end table
  17378. The default value of the select expression is "1".
  17379. @subsection Examples
  17380. @itemize
  17381. @item
  17382. Select all frames in input:
  17383. @example
  17384. select
  17385. @end example
  17386. The example above is the same as:
  17387. @example
  17388. select=1
  17389. @end example
  17390. @item
  17391. Skip all frames:
  17392. @example
  17393. select=0
  17394. @end example
  17395. @item
  17396. Select only I-frames:
  17397. @example
  17398. select='eq(pict_type\,I)'
  17399. @end example
  17400. @item
  17401. Select one frame every 100:
  17402. @example
  17403. select='not(mod(n\,100))'
  17404. @end example
  17405. @item
  17406. Select only frames contained in the 10-20 time interval:
  17407. @example
  17408. select=between(t\,10\,20)
  17409. @end example
  17410. @item
  17411. Select only I-frames contained in the 10-20 time interval:
  17412. @example
  17413. select=between(t\,10\,20)*eq(pict_type\,I)
  17414. @end example
  17415. @item
  17416. Select frames with a minimum distance of 10 seconds:
  17417. @example
  17418. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17419. @end example
  17420. @item
  17421. Use aselect to select only audio frames with samples number > 100:
  17422. @example
  17423. aselect='gt(samples_n\,100)'
  17424. @end example
  17425. @item
  17426. Create a mosaic of the first scenes:
  17427. @example
  17428. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17429. @end example
  17430. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17431. choice.
  17432. @item
  17433. Send even and odd frames to separate outputs, and compose them:
  17434. @example
  17435. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17436. @end example
  17437. @item
  17438. Select useful frames from an ffconcat file which is using inpoints and
  17439. outpoints but where the source files are not intra frame only.
  17440. @example
  17441. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17442. @end example
  17443. @end itemize
  17444. @section sendcmd, asendcmd
  17445. Send commands to filters in the filtergraph.
  17446. These filters read commands to be sent to other filters in the
  17447. filtergraph.
  17448. @code{sendcmd} must be inserted between two video filters,
  17449. @code{asendcmd} must be inserted between two audio filters, but apart
  17450. from that they act the same way.
  17451. The specification of commands can be provided in the filter arguments
  17452. with the @var{commands} option, or in a file specified by the
  17453. @var{filename} option.
  17454. These filters accept the following options:
  17455. @table @option
  17456. @item commands, c
  17457. Set the commands to be read and sent to the other filters.
  17458. @item filename, f
  17459. Set the filename of the commands to be read and sent to the other
  17460. filters.
  17461. @end table
  17462. @subsection Commands syntax
  17463. A commands description consists of a sequence of interval
  17464. specifications, comprising a list of commands to be executed when a
  17465. particular event related to that interval occurs. The occurring event
  17466. is typically the current frame time entering or leaving a given time
  17467. interval.
  17468. An interval is specified by the following syntax:
  17469. @example
  17470. @var{START}[-@var{END}] @var{COMMANDS};
  17471. @end example
  17472. The time interval is specified by the @var{START} and @var{END} times.
  17473. @var{END} is optional and defaults to the maximum time.
  17474. The current frame time is considered within the specified interval if
  17475. it is included in the interval [@var{START}, @var{END}), that is when
  17476. the time is greater or equal to @var{START} and is lesser than
  17477. @var{END}.
  17478. @var{COMMANDS} consists of a sequence of one or more command
  17479. specifications, separated by ",", relating to that interval. The
  17480. syntax of a command specification is given by:
  17481. @example
  17482. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17483. @end example
  17484. @var{FLAGS} is optional and specifies the type of events relating to
  17485. the time interval which enable sending the specified command, and must
  17486. be a non-null sequence of identifier flags separated by "+" or "|" and
  17487. enclosed between "[" and "]".
  17488. The following flags are recognized:
  17489. @table @option
  17490. @item enter
  17491. The command is sent when the current frame timestamp enters the
  17492. specified interval. In other words, the command is sent when the
  17493. previous frame timestamp was not in the given interval, and the
  17494. current is.
  17495. @item leave
  17496. The command is sent when the current frame timestamp leaves the
  17497. specified interval. In other words, the command is sent when the
  17498. previous frame timestamp was in the given interval, and the
  17499. current is not.
  17500. @end table
  17501. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17502. assumed.
  17503. @var{TARGET} specifies the target of the command, usually the name of
  17504. the filter class or a specific filter instance name.
  17505. @var{COMMAND} specifies the name of the command for the target filter.
  17506. @var{ARG} is optional and specifies the optional list of argument for
  17507. the given @var{COMMAND}.
  17508. Between one interval specification and another, whitespaces, or
  17509. sequences of characters starting with @code{#} until the end of line,
  17510. are ignored and can be used to annotate comments.
  17511. A simplified BNF description of the commands specification syntax
  17512. follows:
  17513. @example
  17514. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17515. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17516. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17517. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17518. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17519. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17520. @end example
  17521. @subsection Examples
  17522. @itemize
  17523. @item
  17524. Specify audio tempo change at second 4:
  17525. @example
  17526. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17527. @end example
  17528. @item
  17529. Target a specific filter instance:
  17530. @example
  17531. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17532. @end example
  17533. @item
  17534. Specify a list of drawtext and hue commands in a file.
  17535. @example
  17536. # show text in the interval 5-10
  17537. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17538. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17539. # desaturate the image in the interval 15-20
  17540. 15.0-20.0 [enter] hue s 0,
  17541. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17542. [leave] hue s 1,
  17543. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17544. # apply an exponential saturation fade-out effect, starting from time 25
  17545. 25 [enter] hue s exp(25-t)
  17546. @end example
  17547. A filtergraph allowing to read and process the above command list
  17548. stored in a file @file{test.cmd}, can be specified with:
  17549. @example
  17550. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17551. @end example
  17552. @end itemize
  17553. @anchor{setpts}
  17554. @section setpts, asetpts
  17555. Change the PTS (presentation timestamp) of the input frames.
  17556. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17557. This filter accepts the following options:
  17558. @table @option
  17559. @item expr
  17560. The expression which is evaluated for each frame to construct its timestamp.
  17561. @end table
  17562. The expression is evaluated through the eval API and can contain the following
  17563. constants:
  17564. @table @option
  17565. @item FRAME_RATE, FR
  17566. frame rate, only defined for constant frame-rate video
  17567. @item PTS
  17568. The presentation timestamp in input
  17569. @item N
  17570. The count of the input frame for video or the number of consumed samples,
  17571. not including the current frame for audio, starting from 0.
  17572. @item NB_CONSUMED_SAMPLES
  17573. The number of consumed samples, not including the current frame (only
  17574. audio)
  17575. @item NB_SAMPLES, S
  17576. The number of samples in the current frame (only audio)
  17577. @item SAMPLE_RATE, SR
  17578. The audio sample rate.
  17579. @item STARTPTS
  17580. The PTS of the first frame.
  17581. @item STARTT
  17582. the time in seconds of the first frame
  17583. @item INTERLACED
  17584. State whether the current frame is interlaced.
  17585. @item T
  17586. the time in seconds of the current frame
  17587. @item POS
  17588. original position in the file of the frame, or undefined if undefined
  17589. for the current frame
  17590. @item PREV_INPTS
  17591. The previous input PTS.
  17592. @item PREV_INT
  17593. previous input time in seconds
  17594. @item PREV_OUTPTS
  17595. The previous output PTS.
  17596. @item PREV_OUTT
  17597. previous output time in seconds
  17598. @item RTCTIME
  17599. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17600. instead.
  17601. @item RTCSTART
  17602. The wallclock (RTC) time at the start of the movie in microseconds.
  17603. @item TB
  17604. The timebase of the input timestamps.
  17605. @end table
  17606. @subsection Examples
  17607. @itemize
  17608. @item
  17609. Start counting PTS from zero
  17610. @example
  17611. setpts=PTS-STARTPTS
  17612. @end example
  17613. @item
  17614. Apply fast motion effect:
  17615. @example
  17616. setpts=0.5*PTS
  17617. @end example
  17618. @item
  17619. Apply slow motion effect:
  17620. @example
  17621. setpts=2.0*PTS
  17622. @end example
  17623. @item
  17624. Set fixed rate of 25 frames per second:
  17625. @example
  17626. setpts=N/(25*TB)
  17627. @end example
  17628. @item
  17629. Set fixed rate 25 fps with some jitter:
  17630. @example
  17631. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17632. @end example
  17633. @item
  17634. Apply an offset of 10 seconds to the input PTS:
  17635. @example
  17636. setpts=PTS+10/TB
  17637. @end example
  17638. @item
  17639. Generate timestamps from a "live source" and rebase onto the current timebase:
  17640. @example
  17641. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17642. @end example
  17643. @item
  17644. Generate timestamps by counting samples:
  17645. @example
  17646. asetpts=N/SR/TB
  17647. @end example
  17648. @end itemize
  17649. @section setrange
  17650. Force color range for the output video frame.
  17651. The @code{setrange} filter marks the color range property for the
  17652. output frames. It does not change the input frame, but only sets the
  17653. corresponding property, which affects how the frame is treated by
  17654. following filters.
  17655. The filter accepts the following options:
  17656. @table @option
  17657. @item range
  17658. Available values are:
  17659. @table @samp
  17660. @item auto
  17661. Keep the same color range property.
  17662. @item unspecified, unknown
  17663. Set the color range as unspecified.
  17664. @item limited, tv, mpeg
  17665. Set the color range as limited.
  17666. @item full, pc, jpeg
  17667. Set the color range as full.
  17668. @end table
  17669. @end table
  17670. @section settb, asettb
  17671. Set the timebase to use for the output frames timestamps.
  17672. It is mainly useful for testing timebase configuration.
  17673. It accepts the following parameters:
  17674. @table @option
  17675. @item expr, tb
  17676. The expression which is evaluated into the output timebase.
  17677. @end table
  17678. The value for @option{tb} is an arithmetic expression representing a
  17679. rational. The expression can contain the constants "AVTB" (the default
  17680. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17681. audio only). Default value is "intb".
  17682. @subsection Examples
  17683. @itemize
  17684. @item
  17685. Set the timebase to 1/25:
  17686. @example
  17687. settb=expr=1/25
  17688. @end example
  17689. @item
  17690. Set the timebase to 1/10:
  17691. @example
  17692. settb=expr=0.1
  17693. @end example
  17694. @item
  17695. Set the timebase to 1001/1000:
  17696. @example
  17697. settb=1+0.001
  17698. @end example
  17699. @item
  17700. Set the timebase to 2*intb:
  17701. @example
  17702. settb=2*intb
  17703. @end example
  17704. @item
  17705. Set the default timebase value:
  17706. @example
  17707. settb=AVTB
  17708. @end example
  17709. @end itemize
  17710. @section showcqt
  17711. Convert input audio to a video output representing frequency spectrum
  17712. logarithmically using Brown-Puckette constant Q transform algorithm with
  17713. direct frequency domain coefficient calculation (but the transform itself
  17714. is not really constant Q, instead the Q factor is actually variable/clamped),
  17715. with musical tone scale, from E0 to D#10.
  17716. The filter accepts the following options:
  17717. @table @option
  17718. @item size, s
  17719. Specify the video size for the output. It must be even. For the syntax of this option,
  17720. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17721. Default value is @code{1920x1080}.
  17722. @item fps, rate, r
  17723. Set the output frame rate. Default value is @code{25}.
  17724. @item bar_h
  17725. Set the bargraph height. It must be even. Default value is @code{-1} which
  17726. computes the bargraph height automatically.
  17727. @item axis_h
  17728. Set the axis height. It must be even. Default value is @code{-1} which computes
  17729. the axis height automatically.
  17730. @item sono_h
  17731. Set the sonogram height. It must be even. Default value is @code{-1} which
  17732. computes the sonogram height automatically.
  17733. @item fullhd
  17734. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17735. instead. Default value is @code{1}.
  17736. @item sono_v, volume
  17737. Specify the sonogram volume expression. It can contain variables:
  17738. @table @option
  17739. @item bar_v
  17740. the @var{bar_v} evaluated expression
  17741. @item frequency, freq, f
  17742. the frequency where it is evaluated
  17743. @item timeclamp, tc
  17744. the value of @var{timeclamp} option
  17745. @end table
  17746. and functions:
  17747. @table @option
  17748. @item a_weighting(f)
  17749. A-weighting of equal loudness
  17750. @item b_weighting(f)
  17751. B-weighting of equal loudness
  17752. @item c_weighting(f)
  17753. C-weighting of equal loudness.
  17754. @end table
  17755. Default value is @code{16}.
  17756. @item bar_v, volume2
  17757. Specify the bargraph volume expression. It can contain variables:
  17758. @table @option
  17759. @item sono_v
  17760. the @var{sono_v} evaluated expression
  17761. @item frequency, freq, f
  17762. the frequency where it is evaluated
  17763. @item timeclamp, tc
  17764. the value of @var{timeclamp} option
  17765. @end table
  17766. and functions:
  17767. @table @option
  17768. @item a_weighting(f)
  17769. A-weighting of equal loudness
  17770. @item b_weighting(f)
  17771. B-weighting of equal loudness
  17772. @item c_weighting(f)
  17773. C-weighting of equal loudness.
  17774. @end table
  17775. Default value is @code{sono_v}.
  17776. @item sono_g, gamma
  17777. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17778. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17779. Acceptable range is @code{[1, 7]}.
  17780. @item bar_g, gamma2
  17781. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17782. @code{[1, 7]}.
  17783. @item bar_t
  17784. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17785. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17786. @item timeclamp, tc
  17787. Specify the transform timeclamp. At low frequency, there is trade-off between
  17788. accuracy in time domain and frequency domain. If timeclamp is lower,
  17789. event in time domain is represented more accurately (such as fast bass drum),
  17790. otherwise event in frequency domain is represented more accurately
  17791. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17792. @item attack
  17793. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17794. limits future samples by applying asymmetric windowing in time domain, useful
  17795. when low latency is required. Accepted range is @code{[0, 1]}.
  17796. @item basefreq
  17797. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17798. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17799. @item endfreq
  17800. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17801. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17802. @item coeffclamp
  17803. This option is deprecated and ignored.
  17804. @item tlength
  17805. Specify the transform length in time domain. Use this option to control accuracy
  17806. trade-off between time domain and frequency domain at every frequency sample.
  17807. It can contain variables:
  17808. @table @option
  17809. @item frequency, freq, f
  17810. the frequency where it is evaluated
  17811. @item timeclamp, tc
  17812. the value of @var{timeclamp} option.
  17813. @end table
  17814. Default value is @code{384*tc/(384+tc*f)}.
  17815. @item count
  17816. Specify the transform count for every video frame. Default value is @code{6}.
  17817. Acceptable range is @code{[1, 30]}.
  17818. @item fcount
  17819. Specify the transform count for every single pixel. Default value is @code{0},
  17820. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17821. @item fontfile
  17822. Specify font file for use with freetype to draw the axis. If not specified,
  17823. use embedded font. Note that drawing with font file or embedded font is not
  17824. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17825. option instead.
  17826. @item font
  17827. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17828. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17829. escaping.
  17830. @item fontcolor
  17831. Specify font color expression. This is arithmetic expression that should return
  17832. integer value 0xRRGGBB. It can contain variables:
  17833. @table @option
  17834. @item frequency, freq, f
  17835. the frequency where it is evaluated
  17836. @item timeclamp, tc
  17837. the value of @var{timeclamp} option
  17838. @end table
  17839. and functions:
  17840. @table @option
  17841. @item midi(f)
  17842. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17843. @item r(x), g(x), b(x)
  17844. red, green, and blue value of intensity x.
  17845. @end table
  17846. Default value is @code{st(0, (midi(f)-59.5)/12);
  17847. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17848. r(1-ld(1)) + b(ld(1))}.
  17849. @item axisfile
  17850. Specify image file to draw the axis. This option override @var{fontfile} and
  17851. @var{fontcolor} option.
  17852. @item axis, text
  17853. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17854. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17855. Default value is @code{1}.
  17856. @item csp
  17857. Set colorspace. The accepted values are:
  17858. @table @samp
  17859. @item unspecified
  17860. Unspecified (default)
  17861. @item bt709
  17862. BT.709
  17863. @item fcc
  17864. FCC
  17865. @item bt470bg
  17866. BT.470BG or BT.601-6 625
  17867. @item smpte170m
  17868. SMPTE-170M or BT.601-6 525
  17869. @item smpte240m
  17870. SMPTE-240M
  17871. @item bt2020ncl
  17872. BT.2020 with non-constant luminance
  17873. @end table
  17874. @item cscheme
  17875. Set spectrogram color scheme. This is list of floating point values with format
  17876. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17877. The default is @code{1|0.5|0|0|0.5|1}.
  17878. @end table
  17879. @subsection Examples
  17880. @itemize
  17881. @item
  17882. Playing audio while showing the spectrum:
  17883. @example
  17884. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17885. @end example
  17886. @item
  17887. Same as above, but with frame rate 30 fps:
  17888. @example
  17889. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17890. @end example
  17891. @item
  17892. Playing at 1280x720:
  17893. @example
  17894. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17895. @end example
  17896. @item
  17897. Disable sonogram display:
  17898. @example
  17899. sono_h=0
  17900. @end example
  17901. @item
  17902. A1 and its harmonics: A1, A2, (near)E3, A3:
  17903. @example
  17904. 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),
  17905. asplit[a][out1]; [a] showcqt [out0]'
  17906. @end example
  17907. @item
  17908. Same as above, but with more accuracy in frequency domain:
  17909. @example
  17910. 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),
  17911. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17912. @end example
  17913. @item
  17914. Custom volume:
  17915. @example
  17916. bar_v=10:sono_v=bar_v*a_weighting(f)
  17917. @end example
  17918. @item
  17919. Custom gamma, now spectrum is linear to the amplitude.
  17920. @example
  17921. bar_g=2:sono_g=2
  17922. @end example
  17923. @item
  17924. Custom tlength equation:
  17925. @example
  17926. 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)))'
  17927. @end example
  17928. @item
  17929. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17930. @example
  17931. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17932. @end example
  17933. @item
  17934. Custom font using fontconfig:
  17935. @example
  17936. font='Courier New,Monospace,mono|bold'
  17937. @end example
  17938. @item
  17939. Custom frequency range with custom axis using image file:
  17940. @example
  17941. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17942. @end example
  17943. @end itemize
  17944. @section showfreqs
  17945. Convert input audio to video output representing the audio power spectrum.
  17946. Audio amplitude is on Y-axis while frequency is on X-axis.
  17947. The filter accepts the following options:
  17948. @table @option
  17949. @item size, s
  17950. Specify size of video. For the syntax of this option, check the
  17951. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17952. Default is @code{1024x512}.
  17953. @item mode
  17954. Set display mode.
  17955. This set how each frequency bin will be represented.
  17956. It accepts the following values:
  17957. @table @samp
  17958. @item line
  17959. @item bar
  17960. @item dot
  17961. @end table
  17962. Default is @code{bar}.
  17963. @item ascale
  17964. Set amplitude scale.
  17965. It accepts the following values:
  17966. @table @samp
  17967. @item lin
  17968. Linear scale.
  17969. @item sqrt
  17970. Square root scale.
  17971. @item cbrt
  17972. Cubic root scale.
  17973. @item log
  17974. Logarithmic scale.
  17975. @end table
  17976. Default is @code{log}.
  17977. @item fscale
  17978. Set frequency scale.
  17979. It accepts the following values:
  17980. @table @samp
  17981. @item lin
  17982. Linear scale.
  17983. @item log
  17984. Logarithmic scale.
  17985. @item rlog
  17986. Reverse logarithmic scale.
  17987. @end table
  17988. Default is @code{lin}.
  17989. @item win_size
  17990. Set window size. Allowed range is from 16 to 65536.
  17991. Default is @code{2048}
  17992. @item win_func
  17993. Set windowing function.
  17994. It accepts the following values:
  17995. @table @samp
  17996. @item rect
  17997. @item bartlett
  17998. @item hanning
  17999. @item hamming
  18000. @item blackman
  18001. @item welch
  18002. @item flattop
  18003. @item bharris
  18004. @item bnuttall
  18005. @item bhann
  18006. @item sine
  18007. @item nuttall
  18008. @item lanczos
  18009. @item gauss
  18010. @item tukey
  18011. @item dolph
  18012. @item cauchy
  18013. @item parzen
  18014. @item poisson
  18015. @item bohman
  18016. @end table
  18017. Default is @code{hanning}.
  18018. @item overlap
  18019. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18020. which means optimal overlap for selected window function will be picked.
  18021. @item averaging
  18022. Set time averaging. Setting this to 0 will display current maximal peaks.
  18023. Default is @code{1}, which means time averaging is disabled.
  18024. @item colors
  18025. Specify list of colors separated by space or by '|' which will be used to
  18026. draw channel frequencies. Unrecognized or missing colors will be replaced
  18027. by white color.
  18028. @item cmode
  18029. Set channel display mode.
  18030. It accepts the following values:
  18031. @table @samp
  18032. @item combined
  18033. @item separate
  18034. @end table
  18035. Default is @code{combined}.
  18036. @item minamp
  18037. Set minimum amplitude used in @code{log} amplitude scaler.
  18038. @end table
  18039. @section showspatial
  18040. Convert stereo input audio to a video output, representing the spatial relationship
  18041. between two channels.
  18042. The filter accepts the following options:
  18043. @table @option
  18044. @item size, s
  18045. Specify the video size for the output. For the syntax of this option, check the
  18046. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18047. Default value is @code{512x512}.
  18048. @item win_size
  18049. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  18050. @item win_func
  18051. Set window function.
  18052. It accepts the following values:
  18053. @table @samp
  18054. @item rect
  18055. @item bartlett
  18056. @item hann
  18057. @item hanning
  18058. @item hamming
  18059. @item blackman
  18060. @item welch
  18061. @item flattop
  18062. @item bharris
  18063. @item bnuttall
  18064. @item bhann
  18065. @item sine
  18066. @item nuttall
  18067. @item lanczos
  18068. @item gauss
  18069. @item tukey
  18070. @item dolph
  18071. @item cauchy
  18072. @item parzen
  18073. @item poisson
  18074. @item bohman
  18075. @end table
  18076. Default value is @code{hann}.
  18077. @item overlap
  18078. Set ratio of overlap window. Default value is @code{0.5}.
  18079. When value is @code{1} overlap is set to recommended size for specific
  18080. window function currently used.
  18081. @end table
  18082. @anchor{showspectrum}
  18083. @section showspectrum
  18084. Convert input audio to a video output, representing the audio frequency
  18085. spectrum.
  18086. The filter accepts the following options:
  18087. @table @option
  18088. @item size, s
  18089. Specify the video size for the output. For the syntax of this option, check the
  18090. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18091. Default value is @code{640x512}.
  18092. @item slide
  18093. Specify how the spectrum should slide along the window.
  18094. It accepts the following values:
  18095. @table @samp
  18096. @item replace
  18097. the samples start again on the left when they reach the right
  18098. @item scroll
  18099. the samples scroll from right to left
  18100. @item fullframe
  18101. frames are only produced when the samples reach the right
  18102. @item rscroll
  18103. the samples scroll from left to right
  18104. @end table
  18105. Default value is @code{replace}.
  18106. @item mode
  18107. Specify display mode.
  18108. It accepts the following values:
  18109. @table @samp
  18110. @item combined
  18111. all channels are displayed in the same row
  18112. @item separate
  18113. all channels are displayed in separate rows
  18114. @end table
  18115. Default value is @samp{combined}.
  18116. @item color
  18117. Specify display color mode.
  18118. It accepts the following values:
  18119. @table @samp
  18120. @item channel
  18121. each channel is displayed in a separate color
  18122. @item intensity
  18123. each channel is displayed using the same color scheme
  18124. @item rainbow
  18125. each channel is displayed using the rainbow color scheme
  18126. @item moreland
  18127. each channel is displayed using the moreland color scheme
  18128. @item nebulae
  18129. each channel is displayed using the nebulae color scheme
  18130. @item fire
  18131. each channel is displayed using the fire color scheme
  18132. @item fiery
  18133. each channel is displayed using the fiery color scheme
  18134. @item fruit
  18135. each channel is displayed using the fruit color scheme
  18136. @item cool
  18137. each channel is displayed using the cool color scheme
  18138. @item magma
  18139. each channel is displayed using the magma color scheme
  18140. @item green
  18141. each channel is displayed using the green color scheme
  18142. @item viridis
  18143. each channel is displayed using the viridis color scheme
  18144. @item plasma
  18145. each channel is displayed using the plasma color scheme
  18146. @item cividis
  18147. each channel is displayed using the cividis color scheme
  18148. @item terrain
  18149. each channel is displayed using the terrain color scheme
  18150. @end table
  18151. Default value is @samp{channel}.
  18152. @item scale
  18153. Specify scale used for calculating intensity color values.
  18154. It accepts the following values:
  18155. @table @samp
  18156. @item lin
  18157. linear
  18158. @item sqrt
  18159. square root, default
  18160. @item cbrt
  18161. cubic root
  18162. @item log
  18163. logarithmic
  18164. @item 4thrt
  18165. 4th root
  18166. @item 5thrt
  18167. 5th root
  18168. @end table
  18169. Default value is @samp{sqrt}.
  18170. @item fscale
  18171. Specify frequency scale.
  18172. It accepts the following values:
  18173. @table @samp
  18174. @item lin
  18175. linear
  18176. @item log
  18177. logarithmic
  18178. @end table
  18179. Default value is @samp{lin}.
  18180. @item saturation
  18181. Set saturation modifier for displayed colors. Negative values provide
  18182. alternative color scheme. @code{0} is no saturation at all.
  18183. Saturation must be in [-10.0, 10.0] range.
  18184. Default value is @code{1}.
  18185. @item win_func
  18186. Set window function.
  18187. It accepts the following values:
  18188. @table @samp
  18189. @item rect
  18190. @item bartlett
  18191. @item hann
  18192. @item hanning
  18193. @item hamming
  18194. @item blackman
  18195. @item welch
  18196. @item flattop
  18197. @item bharris
  18198. @item bnuttall
  18199. @item bhann
  18200. @item sine
  18201. @item nuttall
  18202. @item lanczos
  18203. @item gauss
  18204. @item tukey
  18205. @item dolph
  18206. @item cauchy
  18207. @item parzen
  18208. @item poisson
  18209. @item bohman
  18210. @end table
  18211. Default value is @code{hann}.
  18212. @item orientation
  18213. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18214. @code{horizontal}. Default is @code{vertical}.
  18215. @item overlap
  18216. Set ratio of overlap window. Default value is @code{0}.
  18217. When value is @code{1} overlap is set to recommended size for specific
  18218. window function currently used.
  18219. @item gain
  18220. Set scale gain for calculating intensity color values.
  18221. Default value is @code{1}.
  18222. @item data
  18223. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  18224. @item rotation
  18225. Set color rotation, must be in [-1.0, 1.0] range.
  18226. Default value is @code{0}.
  18227. @item start
  18228. Set start frequency from which to display spectrogram. Default is @code{0}.
  18229. @item stop
  18230. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18231. @item fps
  18232. Set upper frame rate limit. Default is @code{auto}, unlimited.
  18233. @item legend
  18234. Draw time and frequency axes and legends. Default is disabled.
  18235. @end table
  18236. The usage is very similar to the showwaves filter; see the examples in that
  18237. section.
  18238. @subsection Examples
  18239. @itemize
  18240. @item
  18241. Large window with logarithmic color scaling:
  18242. @example
  18243. showspectrum=s=1280x480:scale=log
  18244. @end example
  18245. @item
  18246. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  18247. @example
  18248. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18249. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  18250. @end example
  18251. @end itemize
  18252. @section showspectrumpic
  18253. Convert input audio to a single video frame, representing the audio frequency
  18254. spectrum.
  18255. The filter accepts the following options:
  18256. @table @option
  18257. @item size, s
  18258. Specify the video size for the output. For the syntax of this option, check the
  18259. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18260. Default value is @code{4096x2048}.
  18261. @item mode
  18262. Specify display mode.
  18263. It accepts the following values:
  18264. @table @samp
  18265. @item combined
  18266. all channels are displayed in the same row
  18267. @item separate
  18268. all channels are displayed in separate rows
  18269. @end table
  18270. Default value is @samp{combined}.
  18271. @item color
  18272. Specify display color mode.
  18273. It accepts the following values:
  18274. @table @samp
  18275. @item channel
  18276. each channel is displayed in a separate color
  18277. @item intensity
  18278. each channel is displayed using the same color scheme
  18279. @item rainbow
  18280. each channel is displayed using the rainbow color scheme
  18281. @item moreland
  18282. each channel is displayed using the moreland color scheme
  18283. @item nebulae
  18284. each channel is displayed using the nebulae color scheme
  18285. @item fire
  18286. each channel is displayed using the fire color scheme
  18287. @item fiery
  18288. each channel is displayed using the fiery color scheme
  18289. @item fruit
  18290. each channel is displayed using the fruit color scheme
  18291. @item cool
  18292. each channel is displayed using the cool color scheme
  18293. @item magma
  18294. each channel is displayed using the magma color scheme
  18295. @item green
  18296. each channel is displayed using the green color scheme
  18297. @item viridis
  18298. each channel is displayed using the viridis color scheme
  18299. @item plasma
  18300. each channel is displayed using the plasma color scheme
  18301. @item cividis
  18302. each channel is displayed using the cividis color scheme
  18303. @item terrain
  18304. each channel is displayed using the terrain color scheme
  18305. @end table
  18306. Default value is @samp{intensity}.
  18307. @item scale
  18308. Specify scale used for calculating intensity color values.
  18309. It accepts the following values:
  18310. @table @samp
  18311. @item lin
  18312. linear
  18313. @item sqrt
  18314. square root, default
  18315. @item cbrt
  18316. cubic root
  18317. @item log
  18318. logarithmic
  18319. @item 4thrt
  18320. 4th root
  18321. @item 5thrt
  18322. 5th root
  18323. @end table
  18324. Default value is @samp{log}.
  18325. @item fscale
  18326. Specify frequency scale.
  18327. It accepts the following values:
  18328. @table @samp
  18329. @item lin
  18330. linear
  18331. @item log
  18332. logarithmic
  18333. @end table
  18334. Default value is @samp{lin}.
  18335. @item saturation
  18336. Set saturation modifier for displayed colors. Negative values provide
  18337. alternative color scheme. @code{0} is no saturation at all.
  18338. Saturation must be in [-10.0, 10.0] range.
  18339. Default value is @code{1}.
  18340. @item win_func
  18341. Set window function.
  18342. It accepts the following values:
  18343. @table @samp
  18344. @item rect
  18345. @item bartlett
  18346. @item hann
  18347. @item hanning
  18348. @item hamming
  18349. @item blackman
  18350. @item welch
  18351. @item flattop
  18352. @item bharris
  18353. @item bnuttall
  18354. @item bhann
  18355. @item sine
  18356. @item nuttall
  18357. @item lanczos
  18358. @item gauss
  18359. @item tukey
  18360. @item dolph
  18361. @item cauchy
  18362. @item parzen
  18363. @item poisson
  18364. @item bohman
  18365. @end table
  18366. Default value is @code{hann}.
  18367. @item orientation
  18368. Set orientation of time vs frequency axis. Can be @code{vertical} or
  18369. @code{horizontal}. Default is @code{vertical}.
  18370. @item gain
  18371. Set scale gain for calculating intensity color values.
  18372. Default value is @code{1}.
  18373. @item legend
  18374. Draw time and frequency axes and legends. Default is enabled.
  18375. @item rotation
  18376. Set color rotation, must be in [-1.0, 1.0] range.
  18377. Default value is @code{0}.
  18378. @item start
  18379. Set start frequency from which to display spectrogram. Default is @code{0}.
  18380. @item stop
  18381. Set stop frequency to which to display spectrogram. Default is @code{0}.
  18382. @end table
  18383. @subsection Examples
  18384. @itemize
  18385. @item
  18386. Extract an audio spectrogram of a whole audio track
  18387. in a 1024x1024 picture using @command{ffmpeg}:
  18388. @example
  18389. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  18390. @end example
  18391. @end itemize
  18392. @section showvolume
  18393. Convert input audio volume to a video output.
  18394. The filter accepts the following options:
  18395. @table @option
  18396. @item rate, r
  18397. Set video rate.
  18398. @item b
  18399. Set border width, allowed range is [0, 5]. Default is 1.
  18400. @item w
  18401. Set channel width, allowed range is [80, 8192]. Default is 400.
  18402. @item h
  18403. Set channel height, allowed range is [1, 900]. Default is 20.
  18404. @item f
  18405. Set fade, allowed range is [0, 1]. Default is 0.95.
  18406. @item c
  18407. Set volume color expression.
  18408. The expression can use the following variables:
  18409. @table @option
  18410. @item VOLUME
  18411. Current max volume of channel in dB.
  18412. @item PEAK
  18413. Current peak.
  18414. @item CHANNEL
  18415. Current channel number, starting from 0.
  18416. @end table
  18417. @item t
  18418. If set, displays channel names. Default is enabled.
  18419. @item v
  18420. If set, displays volume values. Default is enabled.
  18421. @item o
  18422. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18423. default is @code{h}.
  18424. @item s
  18425. Set step size, allowed range is [0, 5]. Default is 0, which means
  18426. step is disabled.
  18427. @item p
  18428. Set background opacity, allowed range is [0, 1]. Default is 0.
  18429. @item m
  18430. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18431. default is @code{p}.
  18432. @item ds
  18433. Set display scale, can be linear: @code{lin} or log: @code{log},
  18434. default is @code{lin}.
  18435. @item dm
  18436. In second.
  18437. If set to > 0., display a line for the max level
  18438. in the previous seconds.
  18439. default is disabled: @code{0.}
  18440. @item dmc
  18441. The color of the max line. Use when @code{dm} option is set to > 0.
  18442. default is: @code{orange}
  18443. @end table
  18444. @section showwaves
  18445. Convert input audio to a video output, representing the samples waves.
  18446. The filter accepts the following options:
  18447. @table @option
  18448. @item size, s
  18449. Specify the video size for the output. For the syntax of this option, check the
  18450. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18451. Default value is @code{600x240}.
  18452. @item mode
  18453. Set display mode.
  18454. Available values are:
  18455. @table @samp
  18456. @item point
  18457. Draw a point for each sample.
  18458. @item line
  18459. Draw a vertical line for each sample.
  18460. @item p2p
  18461. Draw a point for each sample and a line between them.
  18462. @item cline
  18463. Draw a centered vertical line for each sample.
  18464. @end table
  18465. Default value is @code{point}.
  18466. @item n
  18467. Set the number of samples which are printed on the same column. A
  18468. larger value will decrease the frame rate. Must be a positive
  18469. integer. This option can be set only if the value for @var{rate}
  18470. is not explicitly specified.
  18471. @item rate, r
  18472. Set the (approximate) output frame rate. This is done by setting the
  18473. option @var{n}. Default value is "25".
  18474. @item split_channels
  18475. Set if channels should be drawn separately or overlap. Default value is 0.
  18476. @item colors
  18477. Set colors separated by '|' which are going to be used for drawing of each channel.
  18478. @item scale
  18479. Set amplitude scale.
  18480. Available values are:
  18481. @table @samp
  18482. @item lin
  18483. Linear.
  18484. @item log
  18485. Logarithmic.
  18486. @item sqrt
  18487. Square root.
  18488. @item cbrt
  18489. Cubic root.
  18490. @end table
  18491. Default is linear.
  18492. @item draw
  18493. Set the draw mode. This is mostly useful to set for high @var{n}.
  18494. Available values are:
  18495. @table @samp
  18496. @item scale
  18497. Scale pixel values for each drawn sample.
  18498. @item full
  18499. Draw every sample directly.
  18500. @end table
  18501. Default value is @code{scale}.
  18502. @end table
  18503. @subsection Examples
  18504. @itemize
  18505. @item
  18506. Output the input file audio and the corresponding video representation
  18507. at the same time:
  18508. @example
  18509. amovie=a.mp3,asplit[out0],showwaves[out1]
  18510. @end example
  18511. @item
  18512. Create a synthetic signal and show it with showwaves, forcing a
  18513. frame rate of 30 frames per second:
  18514. @example
  18515. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18516. @end example
  18517. @end itemize
  18518. @section showwavespic
  18519. Convert input audio to a single video frame, representing the samples waves.
  18520. The filter accepts the following options:
  18521. @table @option
  18522. @item size, s
  18523. Specify the video size for the output. For the syntax of this option, check the
  18524. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18525. Default value is @code{600x240}.
  18526. @item split_channels
  18527. Set if channels should be drawn separately or overlap. Default value is 0.
  18528. @item colors
  18529. Set colors separated by '|' which are going to be used for drawing of each channel.
  18530. @item scale
  18531. Set amplitude scale.
  18532. Available values are:
  18533. @table @samp
  18534. @item lin
  18535. Linear.
  18536. @item log
  18537. Logarithmic.
  18538. @item sqrt
  18539. Square root.
  18540. @item cbrt
  18541. Cubic root.
  18542. @end table
  18543. Default is linear.
  18544. @item draw
  18545. Set the draw mode.
  18546. Available values are:
  18547. @table @samp
  18548. @item scale
  18549. Scale pixel values for each drawn sample.
  18550. @item full
  18551. Draw every sample directly.
  18552. @end table
  18553. Default value is @code{scale}.
  18554. @end table
  18555. @subsection Examples
  18556. @itemize
  18557. @item
  18558. Extract a channel split representation of the wave form of a whole audio track
  18559. in a 1024x800 picture using @command{ffmpeg}:
  18560. @example
  18561. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18562. @end example
  18563. @end itemize
  18564. @section sidedata, asidedata
  18565. Delete frame side data, or select frames based on it.
  18566. This filter accepts the following options:
  18567. @table @option
  18568. @item mode
  18569. Set mode of operation of the filter.
  18570. Can be one of the following:
  18571. @table @samp
  18572. @item select
  18573. Select every frame with side data of @code{type}.
  18574. @item delete
  18575. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18576. data in the frame.
  18577. @end table
  18578. @item type
  18579. Set side data type used with all modes. Must be set for @code{select} mode. For
  18580. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18581. in @file{libavutil/frame.h}. For example, to choose
  18582. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18583. @end table
  18584. @section spectrumsynth
  18585. Synthesize audio from 2 input video spectrums, first input stream represents
  18586. magnitude across time and second represents phase across time.
  18587. The filter will transform from frequency domain as displayed in videos back
  18588. to time domain as presented in audio output.
  18589. This filter is primarily created for reversing processed @ref{showspectrum}
  18590. filter outputs, but can synthesize sound from other spectrograms too.
  18591. But in such case results are going to be poor if the phase data is not
  18592. available, because in such cases phase data need to be recreated, usually
  18593. it's just recreated from random noise.
  18594. For best results use gray only output (@code{channel} color mode in
  18595. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18596. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18597. @code{data} option. Inputs videos should generally use @code{fullframe}
  18598. slide mode as that saves resources needed for decoding video.
  18599. The filter accepts the following options:
  18600. @table @option
  18601. @item sample_rate
  18602. Specify sample rate of output audio, the sample rate of audio from which
  18603. spectrum was generated may differ.
  18604. @item channels
  18605. Set number of channels represented in input video spectrums.
  18606. @item scale
  18607. Set scale which was used when generating magnitude input spectrum.
  18608. Can be @code{lin} or @code{log}. Default is @code{log}.
  18609. @item slide
  18610. Set slide which was used when generating inputs spectrums.
  18611. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18612. Default is @code{fullframe}.
  18613. @item win_func
  18614. Set window function used for resynthesis.
  18615. @item overlap
  18616. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18617. which means optimal overlap for selected window function will be picked.
  18618. @item orientation
  18619. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18620. Default is @code{vertical}.
  18621. @end table
  18622. @subsection Examples
  18623. @itemize
  18624. @item
  18625. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18626. then resynthesize videos back to audio with spectrumsynth:
  18627. @example
  18628. 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
  18629. 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
  18630. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18631. @end example
  18632. @end itemize
  18633. @section split, asplit
  18634. Split input into several identical outputs.
  18635. @code{asplit} works with audio input, @code{split} with video.
  18636. The filter accepts a single parameter which specifies the number of outputs. If
  18637. unspecified, it defaults to 2.
  18638. @subsection Examples
  18639. @itemize
  18640. @item
  18641. Create two separate outputs from the same input:
  18642. @example
  18643. [in] split [out0][out1]
  18644. @end example
  18645. @item
  18646. To create 3 or more outputs, you need to specify the number of
  18647. outputs, like in:
  18648. @example
  18649. [in] asplit=3 [out0][out1][out2]
  18650. @end example
  18651. @item
  18652. Create two separate outputs from the same input, one cropped and
  18653. one padded:
  18654. @example
  18655. [in] split [splitout1][splitout2];
  18656. [splitout1] crop=100:100:0:0 [cropout];
  18657. [splitout2] pad=200:200:100:100 [padout];
  18658. @end example
  18659. @item
  18660. Create 5 copies of the input audio with @command{ffmpeg}:
  18661. @example
  18662. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18663. @end example
  18664. @end itemize
  18665. @section zmq, azmq
  18666. Receive commands sent through a libzmq client, and forward them to
  18667. filters in the filtergraph.
  18668. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18669. must be inserted between two video filters, @code{azmq} between two
  18670. audio filters. Both are capable to send messages to any filter type.
  18671. To enable these filters you need to install the libzmq library and
  18672. headers and configure FFmpeg with @code{--enable-libzmq}.
  18673. For more information about libzmq see:
  18674. @url{http://www.zeromq.org/}
  18675. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18676. receives messages sent through a network interface defined by the
  18677. @option{bind_address} (or the abbreviation "@option{b}") option.
  18678. Default value of this option is @file{tcp://localhost:5555}. You may
  18679. want to alter this value to your needs, but do not forget to escape any
  18680. ':' signs (see @ref{filtergraph escaping}).
  18681. The received message must be in the form:
  18682. @example
  18683. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18684. @end example
  18685. @var{TARGET} specifies the target of the command, usually the name of
  18686. the filter class or a specific filter instance name. The default
  18687. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18688. but you can override this by using the @samp{filter_name@@id} syntax
  18689. (see @ref{Filtergraph syntax}).
  18690. @var{COMMAND} specifies the name of the command for the target filter.
  18691. @var{ARG} is optional and specifies the optional argument list for the
  18692. given @var{COMMAND}.
  18693. Upon reception, the message is processed and the corresponding command
  18694. is injected into the filtergraph. Depending on the result, the filter
  18695. will send a reply to the client, adopting the format:
  18696. @example
  18697. @var{ERROR_CODE} @var{ERROR_REASON}
  18698. @var{MESSAGE}
  18699. @end example
  18700. @var{MESSAGE} is optional.
  18701. @subsection Examples
  18702. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18703. be used to send commands processed by these filters.
  18704. Consider the following filtergraph generated by @command{ffplay}.
  18705. In this example the last overlay filter has an instance name. All other
  18706. filters will have default instance names.
  18707. @example
  18708. ffplay -dumpgraph 1 -f lavfi "
  18709. color=s=100x100:c=red [l];
  18710. color=s=100x100:c=blue [r];
  18711. nullsrc=s=200x100, zmq [bg];
  18712. [bg][l] overlay [bg+l];
  18713. [bg+l][r] overlay@@my=x=100 "
  18714. @end example
  18715. To change the color of the left side of the video, the following
  18716. command can be used:
  18717. @example
  18718. echo Parsed_color_0 c yellow | tools/zmqsend
  18719. @end example
  18720. To change the right side:
  18721. @example
  18722. echo Parsed_color_1 c pink | tools/zmqsend
  18723. @end example
  18724. To change the position of the right side:
  18725. @example
  18726. echo overlay@@my x 150 | tools/zmqsend
  18727. @end example
  18728. @c man end MULTIMEDIA FILTERS
  18729. @chapter Multimedia Sources
  18730. @c man begin MULTIMEDIA SOURCES
  18731. Below is a description of the currently available multimedia sources.
  18732. @section amovie
  18733. This is the same as @ref{movie} source, except it selects an audio
  18734. stream by default.
  18735. @anchor{movie}
  18736. @section movie
  18737. Read audio and/or video stream(s) from a movie container.
  18738. It accepts the following parameters:
  18739. @table @option
  18740. @item filename
  18741. The name of the resource to read (not necessarily a file; it can also be a
  18742. device or a stream accessed through some protocol).
  18743. @item format_name, f
  18744. Specifies the format assumed for the movie to read, and can be either
  18745. the name of a container or an input device. If not specified, the
  18746. format is guessed from @var{movie_name} or by probing.
  18747. @item seek_point, sp
  18748. Specifies the seek point in seconds. The frames will be output
  18749. starting from this seek point. The parameter is evaluated with
  18750. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18751. postfix. The default value is "0".
  18752. @item streams, s
  18753. Specifies the streams to read. Several streams can be specified,
  18754. separated by "+". The source will then have as many outputs, in the
  18755. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18756. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18757. respectively the default (best suited) video and audio stream. Default
  18758. is "dv", or "da" if the filter is called as "amovie".
  18759. @item stream_index, si
  18760. Specifies the index of the video stream to read. If the value is -1,
  18761. the most suitable video stream will be automatically selected. The default
  18762. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18763. audio instead of video.
  18764. @item loop
  18765. Specifies how many times to read the stream in sequence.
  18766. If the value is 0, the stream will be looped infinitely.
  18767. Default value is "1".
  18768. Note that when the movie is looped the source timestamps are not
  18769. changed, so it will generate non monotonically increasing timestamps.
  18770. @item discontinuity
  18771. Specifies the time difference between frames above which the point is
  18772. considered a timestamp discontinuity which is removed by adjusting the later
  18773. timestamps.
  18774. @end table
  18775. It allows overlaying a second video on top of the main input of
  18776. a filtergraph, as shown in this graph:
  18777. @example
  18778. input -----------> deltapts0 --> overlay --> output
  18779. ^
  18780. |
  18781. movie --> scale--> deltapts1 -------+
  18782. @end example
  18783. @subsection Examples
  18784. @itemize
  18785. @item
  18786. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18787. on top of the input labelled "in":
  18788. @example
  18789. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18790. [in] setpts=PTS-STARTPTS [main];
  18791. [main][over] overlay=16:16 [out]
  18792. @end example
  18793. @item
  18794. Read from a video4linux2 device, and overlay it on top of the input
  18795. labelled "in":
  18796. @example
  18797. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18798. [in] setpts=PTS-STARTPTS [main];
  18799. [main][over] overlay=16:16 [out]
  18800. @end example
  18801. @item
  18802. Read the first video stream and the audio stream with id 0x81 from
  18803. dvd.vob; the video is connected to the pad named "video" and the audio is
  18804. connected to the pad named "audio":
  18805. @example
  18806. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18807. @end example
  18808. @end itemize
  18809. @subsection Commands
  18810. Both movie and amovie support the following commands:
  18811. @table @option
  18812. @item seek
  18813. Perform seek using "av_seek_frame".
  18814. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18815. @itemize
  18816. @item
  18817. @var{stream_index}: If stream_index is -1, a default
  18818. stream is selected, and @var{timestamp} is automatically converted
  18819. from AV_TIME_BASE units to the stream specific time_base.
  18820. @item
  18821. @var{timestamp}: Timestamp in AVStream.time_base units
  18822. or, if no stream is specified, in AV_TIME_BASE units.
  18823. @item
  18824. @var{flags}: Flags which select direction and seeking mode.
  18825. @end itemize
  18826. @item get_duration
  18827. Get movie duration in AV_TIME_BASE units.
  18828. @end table
  18829. @c man end MULTIMEDIA SOURCES