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.

27088 lines
717KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @subsection Commands
  505. This filter supports the all above options as @ref{commands}.
  506. @section acue
  507. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  508. filter.
  509. @section adeclick
  510. Remove impulsive noise from input audio.
  511. Samples detected as impulsive noise are replaced by interpolated samples using
  512. autoregressive modelling.
  513. @table @option
  514. @item w
  515. Set window size, in milliseconds. Allowed range is from @code{10} to
  516. @code{100}. Default value is @code{55} milliseconds.
  517. This sets size of window which will be processed at once.
  518. @item o
  519. Set window overlap, in percentage of window size. Allowed range is from
  520. @code{50} to @code{95}. Default value is @code{75} percent.
  521. Setting this to a very high value increases impulsive noise removal but makes
  522. whole process much slower.
  523. @item a
  524. Set autoregression order, in percentage of window size. Allowed range is from
  525. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  526. controls quality of interpolated samples using neighbour good samples.
  527. @item t
  528. Set threshold value. Allowed range is from @code{1} to @code{100}.
  529. Default value is @code{2}.
  530. This controls the strength of impulsive noise which is going to be removed.
  531. The lower value, the more samples will be detected as impulsive noise.
  532. @item b
  533. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  534. @code{10}. Default value is @code{2}.
  535. If any two samples detected as noise are spaced less than this value then any
  536. sample between those two samples will be also detected as noise.
  537. @item m
  538. Set overlap method.
  539. It accepts the following values:
  540. @table @option
  541. @item a
  542. Select overlap-add method. Even not interpolated samples are slightly
  543. changed with this method.
  544. @item s
  545. Select overlap-save method. Not interpolated samples remain unchanged.
  546. @end table
  547. Default value is @code{a}.
  548. @end table
  549. @section adeclip
  550. Remove clipped samples from input audio.
  551. Samples detected as clipped are replaced by interpolated samples using
  552. autoregressive modelling.
  553. @table @option
  554. @item w
  555. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  556. Default value is @code{55} milliseconds.
  557. This sets size of window which will be processed at once.
  558. @item o
  559. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  560. to @code{95}. Default value is @code{75} percent.
  561. @item a
  562. Set autoregression order, in percentage of window size. Allowed range is from
  563. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  564. quality of interpolated samples using neighbour good samples.
  565. @item t
  566. Set threshold value. Allowed range is from @code{1} to @code{100}.
  567. Default value is @code{10}. Higher values make clip detection less aggressive.
  568. @item n
  569. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  570. Default value is @code{1000}. Higher values make clip detection less aggressive.
  571. @item m
  572. Set overlap method.
  573. It accepts the following values:
  574. @table @option
  575. @item a
  576. Select overlap-add method. Even not interpolated samples are slightly changed
  577. with this method.
  578. @item s
  579. Select overlap-save method. Not interpolated samples remain unchanged.
  580. @end table
  581. Default value is @code{a}.
  582. @end table
  583. @section adelay
  584. Delay one or more audio channels.
  585. Samples in delayed channel are filled with silence.
  586. The filter accepts the following option:
  587. @table @option
  588. @item delays
  589. Set list of delays in milliseconds for each channel separated by '|'.
  590. Unused delays will be silently ignored. If number of given delays is
  591. smaller than number of channels all remaining channels will not be delayed.
  592. If you want to delay exact number of samples, append 'S' to number.
  593. If you want instead to delay in seconds, append 's' to number.
  594. @item all
  595. Use last set delay for all remaining channels. By default is disabled.
  596. This option if enabled changes how option @code{delays} is interpreted.
  597. @end table
  598. @subsection Examples
  599. @itemize
  600. @item
  601. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  602. the second channel (and any other channels that may be present) unchanged.
  603. @example
  604. adelay=1500|0|500
  605. @end example
  606. @item
  607. Delay second channel by 500 samples, the third channel by 700 samples and leave
  608. the first channel (and any other channels that may be present) unchanged.
  609. @example
  610. adelay=0|500S|700S
  611. @end example
  612. @item
  613. Delay all channels by same number of samples:
  614. @example
  615. adelay=delays=64S:all=1
  616. @end example
  617. @end itemize
  618. @section adenorm
  619. Remedy denormals in audio by adding extremely low-level noise.
  620. This filter shall be placed before any filter that can produce denormals.
  621. A description of the accepted parameters follows.
  622. @table @option
  623. @item level
  624. Set level of added noise in dB. Default is @code{-351}.
  625. Allowed range is from -451 to -90.
  626. @item type
  627. Set type of added noise.
  628. @table @option
  629. @item dc
  630. Add DC signal.
  631. @item ac
  632. Add AC signal.
  633. @item square
  634. Add square signal.
  635. @item pulse
  636. Add pulse signal.
  637. @end table
  638. Default is @code{dc}.
  639. @end table
  640. @subsection Commands
  641. This filter supports the all above options as @ref{commands}.
  642. @section aderivative, aintegral
  643. Compute derivative/integral of audio stream.
  644. Applying both filters one after another produces original audio.
  645. @section aecho
  646. Apply echoing to the input audio.
  647. Echoes are reflected sound and can occur naturally amongst mountains
  648. (and sometimes large buildings) when talking or shouting; digital echo
  649. effects emulate this behaviour and are often used to help fill out the
  650. sound of a single instrument or vocal. The time difference between the
  651. original signal and the reflection is the @code{delay}, and the
  652. loudness of the reflected signal is the @code{decay}.
  653. Multiple echoes can have different delays and decays.
  654. A description of the accepted parameters follows.
  655. @table @option
  656. @item in_gain
  657. Set input gain of reflected signal. Default is @code{0.6}.
  658. @item out_gain
  659. Set output gain of reflected signal. Default is @code{0.3}.
  660. @item delays
  661. Set list of time intervals in milliseconds between original signal and reflections
  662. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  663. Default is @code{1000}.
  664. @item decays
  665. Set list of loudness of reflected signals separated by '|'.
  666. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  667. Default is @code{0.5}.
  668. @end table
  669. @subsection Examples
  670. @itemize
  671. @item
  672. Make it sound as if there are twice as many instruments as are actually playing:
  673. @example
  674. aecho=0.8:0.88:60:0.4
  675. @end example
  676. @item
  677. If delay is very short, then it sounds like a (metallic) robot playing music:
  678. @example
  679. aecho=0.8:0.88:6:0.4
  680. @end example
  681. @item
  682. A longer delay will sound like an open air concert in the mountains:
  683. @example
  684. aecho=0.8:0.9:1000:0.3
  685. @end example
  686. @item
  687. Same as above but with one more mountain:
  688. @example
  689. aecho=0.8:0.9:1000|1800:0.3|0.25
  690. @end example
  691. @end itemize
  692. @section aemphasis
  693. Audio emphasis filter creates or restores material directly taken from LPs or
  694. emphased CDs with different filter curves. E.g. to store music on vinyl the
  695. signal has to be altered by a filter first to even out the disadvantages of
  696. this recording medium.
  697. Once the material is played back the inverse filter has to be applied to
  698. restore the distortion of the frequency response.
  699. The filter accepts the following options:
  700. @table @option
  701. @item level_in
  702. Set input gain.
  703. @item level_out
  704. Set output gain.
  705. @item mode
  706. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  707. use @code{production} mode. Default is @code{reproduction} mode.
  708. @item type
  709. Set filter type. Selects medium. Can be one of the following:
  710. @table @option
  711. @item col
  712. select Columbia.
  713. @item emi
  714. select EMI.
  715. @item bsi
  716. select BSI (78RPM).
  717. @item riaa
  718. select RIAA.
  719. @item cd
  720. select Compact Disc (CD).
  721. @item 50fm
  722. select 50µs (FM).
  723. @item 75fm
  724. select 75µs (FM).
  725. @item 50kf
  726. select 50µs (FM-KF).
  727. @item 75kf
  728. select 75µs (FM-KF).
  729. @end table
  730. @end table
  731. @subsection Commands
  732. This filter supports the all above options as @ref{commands}.
  733. @section aeval
  734. Modify an audio signal according to the specified expressions.
  735. This filter accepts one or more expressions (one for each channel),
  736. which are evaluated and used to modify a corresponding audio signal.
  737. It accepts the following parameters:
  738. @table @option
  739. @item exprs
  740. Set the '|'-separated expressions list for each separate channel. If
  741. the number of input channels is greater than the number of
  742. expressions, the last specified expression is used for the remaining
  743. output channels.
  744. @item channel_layout, c
  745. Set output channel layout. If not specified, the channel layout is
  746. specified by the number of expressions. If set to @samp{same}, it will
  747. use by default the same input channel layout.
  748. @end table
  749. Each expression in @var{exprs} can contain the following constants and functions:
  750. @table @option
  751. @item ch
  752. channel number of the current expression
  753. @item n
  754. number of the evaluated sample, starting from 0
  755. @item s
  756. sample rate
  757. @item t
  758. time of the evaluated sample expressed in seconds
  759. @item nb_in_channels
  760. @item nb_out_channels
  761. input and output number of channels
  762. @item val(CH)
  763. the value of input channel with number @var{CH}
  764. @end table
  765. Note: this filter is slow. For faster processing you should use a
  766. dedicated filter.
  767. @subsection Examples
  768. @itemize
  769. @item
  770. Half volume:
  771. @example
  772. aeval=val(ch)/2:c=same
  773. @end example
  774. @item
  775. Invert phase of the second channel:
  776. @example
  777. aeval=val(0)|-val(1)
  778. @end example
  779. @end itemize
  780. @anchor{afade}
  781. @section afade
  782. Apply fade-in/out effect to input audio.
  783. A description of the accepted parameters follows.
  784. @table @option
  785. @item type, t
  786. Specify the effect type, can be either @code{in} for fade-in, or
  787. @code{out} for a fade-out effect. Default is @code{in}.
  788. @item start_sample, ss
  789. Specify the number of the start sample for starting to apply the fade
  790. effect. Default is 0.
  791. @item nb_samples, ns
  792. Specify the number of samples for which the fade effect has to last. At
  793. the end of the fade-in effect the output audio will have the same
  794. volume as the input audio, at the end of the fade-out transition
  795. the output audio will be silence. Default is 44100.
  796. @item start_time, st
  797. Specify the start time of the fade effect. Default is 0.
  798. The value must be specified as a time duration; see
  799. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  800. for the accepted syntax.
  801. If set this option is used instead of @var{start_sample}.
  802. @item duration, d
  803. Specify the duration of the fade effect. See
  804. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  805. for the accepted syntax.
  806. At the end of the fade-in effect the output audio will have the same
  807. volume as the input audio, at the end of the fade-out transition
  808. the output audio will be silence.
  809. By default the duration is determined by @var{nb_samples}.
  810. If set this option is used instead of @var{nb_samples}.
  811. @item curve
  812. Set curve for fade transition.
  813. It accepts the following values:
  814. @table @option
  815. @item tri
  816. select triangular, linear slope (default)
  817. @item qsin
  818. select quarter of sine wave
  819. @item hsin
  820. select half of sine wave
  821. @item esin
  822. select exponential sine wave
  823. @item log
  824. select logarithmic
  825. @item ipar
  826. select inverted parabola
  827. @item qua
  828. select quadratic
  829. @item cub
  830. select cubic
  831. @item squ
  832. select square root
  833. @item cbr
  834. select cubic root
  835. @item par
  836. select parabola
  837. @item exp
  838. select exponential
  839. @item iqsin
  840. select inverted quarter of sine wave
  841. @item ihsin
  842. select inverted half of sine wave
  843. @item dese
  844. select double-exponential seat
  845. @item desi
  846. select double-exponential sigmoid
  847. @item losi
  848. select logistic sigmoid
  849. @item sinc
  850. select sine cardinal function
  851. @item isinc
  852. select inverted sine cardinal function
  853. @item nofade
  854. no fade applied
  855. @end table
  856. @end table
  857. @subsection Commands
  858. This filter supports the all above options as @ref{commands}.
  859. @subsection Examples
  860. @itemize
  861. @item
  862. Fade in first 15 seconds of audio:
  863. @example
  864. afade=t=in:ss=0:d=15
  865. @end example
  866. @item
  867. Fade out last 25 seconds of a 900 seconds audio:
  868. @example
  869. afade=t=out:st=875:d=25
  870. @end example
  871. @end itemize
  872. @section afftdn
  873. Denoise audio samples with FFT.
  874. A description of the accepted parameters follows.
  875. @table @option
  876. @item nr
  877. Set the noise reduction in dB, allowed range is 0.01 to 97.
  878. Default value is 12 dB.
  879. @item nf
  880. Set the noise floor in dB, allowed range is -80 to -20.
  881. Default value is -50 dB.
  882. @item nt
  883. Set the noise type.
  884. It accepts the following values:
  885. @table @option
  886. @item w
  887. Select white noise.
  888. @item v
  889. Select vinyl noise.
  890. @item s
  891. Select shellac noise.
  892. @item c
  893. Select custom noise, defined in @code{bn} option.
  894. Default value is white noise.
  895. @end table
  896. @item bn
  897. Set custom band noise for every one of 15 bands.
  898. Bands are separated by ' ' or '|'.
  899. @item rf
  900. Set the residual floor in dB, allowed range is -80 to -20.
  901. Default value is -38 dB.
  902. @item tn
  903. Enable noise tracking. By default is disabled.
  904. With this enabled, noise floor is automatically adjusted.
  905. @item tr
  906. Enable residual tracking. By default is disabled.
  907. @item om
  908. Set the output mode.
  909. It accepts the following values:
  910. @table @option
  911. @item i
  912. Pass input unchanged.
  913. @item o
  914. Pass noise filtered out.
  915. @item n
  916. Pass only noise.
  917. Default value is @var{o}.
  918. @end table
  919. @end table
  920. @subsection Commands
  921. This filter supports the following commands:
  922. @table @option
  923. @item sample_noise, sn
  924. Start or stop measuring noise profile.
  925. Syntax for the command is : "start" or "stop" string.
  926. After measuring noise profile is stopped it will be
  927. automatically applied in filtering.
  928. @item noise_reduction, nr
  929. Change noise reduction. Argument is single float number.
  930. Syntax for the command is : "@var{noise_reduction}"
  931. @item noise_floor, nf
  932. Change noise floor. Argument is single float number.
  933. Syntax for the command is : "@var{noise_floor}"
  934. @item output_mode, om
  935. Change output mode operation.
  936. Syntax for the command is : "i", "o" or "n" string.
  937. @end table
  938. @section afftfilt
  939. Apply arbitrary expressions to samples in frequency domain.
  940. @table @option
  941. @item real
  942. Set frequency domain real expression for each separate channel separated
  943. by '|'. Default is "re".
  944. If the number of input channels is greater than the number of
  945. expressions, the last specified expression is used for the remaining
  946. output channels.
  947. @item imag
  948. Set frequency domain imaginary expression for each separate channel
  949. separated by '|'. Default is "im".
  950. Each expression in @var{real} and @var{imag} can contain the following
  951. constants and functions:
  952. @table @option
  953. @item sr
  954. sample rate
  955. @item b
  956. current frequency bin number
  957. @item nb
  958. number of available bins
  959. @item ch
  960. channel number of the current expression
  961. @item chs
  962. number of channels
  963. @item pts
  964. current frame pts
  965. @item re
  966. current real part of frequency bin of current channel
  967. @item im
  968. current imaginary part of frequency bin of current channel
  969. @item real(b, ch)
  970. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  971. @item imag(b, ch)
  972. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  973. @end table
  974. @item win_size
  975. Set window size. Allowed range is from 16 to 131072.
  976. Default is @code{4096}
  977. @item win_func
  978. Set window function. Default is @code{hann}.
  979. @item overlap
  980. Set window overlap. If set to 1, the recommended overlap for selected
  981. window function will be picked. Default is @code{0.75}.
  982. @end table
  983. @subsection Examples
  984. @itemize
  985. @item
  986. Leave almost only low frequencies in audio:
  987. @example
  988. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  989. @end example
  990. @item
  991. Apply robotize effect:
  992. @example
  993. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  994. @end example
  995. @item
  996. Apply whisper effect:
  997. @example
  998. 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"
  999. @end example
  1000. @end itemize
  1001. @anchor{afir}
  1002. @section afir
  1003. Apply an arbitrary Finite Impulse Response filter.
  1004. This filter is designed for applying long FIR filters,
  1005. up to 60 seconds long.
  1006. It can be used as component for digital crossover filters,
  1007. room equalization, cross talk cancellation, wavefield synthesis,
  1008. auralization, ambiophonics, ambisonics and spatialization.
  1009. This filter uses the streams higher than first one as FIR coefficients.
  1010. If the non-first stream holds a single channel, it will be used
  1011. for all input channels in the first stream, otherwise
  1012. the number of channels in the non-first stream must be same as
  1013. the number of channels in the first stream.
  1014. It accepts the following parameters:
  1015. @table @option
  1016. @item dry
  1017. Set dry gain. This sets input gain.
  1018. @item wet
  1019. Set wet gain. This sets final output gain.
  1020. @item length
  1021. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1022. @item gtype
  1023. Enable applying gain measured from power of IR.
  1024. Set which approach to use for auto gain measurement.
  1025. @table @option
  1026. @item none
  1027. Do not apply any gain.
  1028. @item peak
  1029. select peak gain, very conservative approach. This is default value.
  1030. @item dc
  1031. select DC gain, limited application.
  1032. @item gn
  1033. select gain to noise approach, this is most popular one.
  1034. @end table
  1035. @item irgain
  1036. Set gain to be applied to IR coefficients before filtering.
  1037. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1038. @item irfmt
  1039. Set format of IR stream. Can be @code{mono} or @code{input}.
  1040. Default is @code{input}.
  1041. @item maxir
  1042. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1043. Allowed range is 0.1 to 60 seconds.
  1044. @item response
  1045. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1046. By default it is disabled.
  1047. @item channel
  1048. Set for which IR channel to display frequency response. By default is first channel
  1049. displayed. This option is used only when @var{response} is enabled.
  1050. @item size
  1051. Set video stream size. This option is used only when @var{response} is enabled.
  1052. @item rate
  1053. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1054. @item minp
  1055. Set minimal partition size used for convolution. Default is @var{8192}.
  1056. Allowed range is from @var{1} to @var{32768}.
  1057. Lower values decreases latency at cost of higher CPU usage.
  1058. @item maxp
  1059. Set maximal partition size used for convolution. Default is @var{8192}.
  1060. Allowed range is from @var{8} to @var{32768}.
  1061. Lower values may increase CPU usage.
  1062. @item nbirs
  1063. Set number of input impulse responses streams which will be switchable at runtime.
  1064. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1065. @item ir
  1066. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1067. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1068. This option can be changed at runtime via @ref{commands}.
  1069. @end table
  1070. @subsection Examples
  1071. @itemize
  1072. @item
  1073. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1074. @example
  1075. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1076. @end example
  1077. @end itemize
  1078. @anchor{aformat}
  1079. @section aformat
  1080. Set output format constraints for the input audio. The framework will
  1081. negotiate the most appropriate format to minimize conversions.
  1082. It accepts the following parameters:
  1083. @table @option
  1084. @item sample_fmts, f
  1085. A '|'-separated list of requested sample formats.
  1086. @item sample_rates, r
  1087. A '|'-separated list of requested sample rates.
  1088. @item channel_layouts, cl
  1089. A '|'-separated list of requested channel layouts.
  1090. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1091. for the required syntax.
  1092. @end table
  1093. If a parameter is omitted, all values are allowed.
  1094. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1095. @example
  1096. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1097. @end example
  1098. @section afreqshift
  1099. Apply frequency shift to input audio samples.
  1100. The filter accepts the following options:
  1101. @table @option
  1102. @item shift
  1103. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1104. Default value is 0.0.
  1105. @item level
  1106. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1107. Default value is 1.0.
  1108. @end table
  1109. @subsection Commands
  1110. This filter supports the all above options as @ref{commands}.
  1111. @section agate
  1112. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1113. processing reduces disturbing noise between useful signals.
  1114. Gating is done by detecting the volume below a chosen level @var{threshold}
  1115. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1116. floor is set via @var{range}. Because an exact manipulation of the signal
  1117. would cause distortion of the waveform the reduction can be levelled over
  1118. time. This is done by setting @var{attack} and @var{release}.
  1119. @var{attack} determines how long the signal has to fall below the threshold
  1120. before any reduction will occur and @var{release} sets the time the signal
  1121. has to rise above the threshold to reduce the reduction again.
  1122. Shorter signals than the chosen attack time will be left untouched.
  1123. @table @option
  1124. @item level_in
  1125. Set input level before filtering.
  1126. Default is 1. Allowed range is from 0.015625 to 64.
  1127. @item mode
  1128. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1129. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1130. will be amplified, expanding dynamic range in upward direction.
  1131. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1132. @item range
  1133. Set the level of gain reduction when the signal is below the threshold.
  1134. Default is 0.06125. Allowed range is from 0 to 1.
  1135. Setting this to 0 disables reduction and then filter behaves like expander.
  1136. @item threshold
  1137. If a signal rises above this level the gain reduction is released.
  1138. Default is 0.125. Allowed range is from 0 to 1.
  1139. @item ratio
  1140. Set a ratio by which the signal is reduced.
  1141. Default is 2. Allowed range is from 1 to 9000.
  1142. @item attack
  1143. Amount of milliseconds the signal has to rise above the threshold before gain
  1144. reduction stops.
  1145. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1146. @item release
  1147. Amount of milliseconds the signal has to fall below the threshold before the
  1148. reduction is increased again. Default is 250 milliseconds.
  1149. Allowed range is from 0.01 to 9000.
  1150. @item makeup
  1151. Set amount of amplification of signal after processing.
  1152. Default is 1. Allowed range is from 1 to 64.
  1153. @item knee
  1154. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1155. Default is 2.828427125. Allowed range is from 1 to 8.
  1156. @item detection
  1157. Choose if exact signal should be taken for detection or an RMS like one.
  1158. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1159. @item link
  1160. Choose if the average level between all channels or the louder channel affects
  1161. the reduction.
  1162. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1163. @end table
  1164. @subsection Commands
  1165. This filter supports the all above options as @ref{commands}.
  1166. @section aiir
  1167. Apply an arbitrary Infinite Impulse Response filter.
  1168. It accepts the following parameters:
  1169. @table @option
  1170. @item zeros, z
  1171. Set B/numerator/zeros/reflection coefficients.
  1172. @item poles, p
  1173. Set A/denominator/poles/ladder coefficients.
  1174. @item gains, k
  1175. Set channels gains.
  1176. @item dry_gain
  1177. Set input gain.
  1178. @item wet_gain
  1179. Set output gain.
  1180. @item format, f
  1181. Set coefficients format.
  1182. @table @samp
  1183. @item ll
  1184. lattice-ladder function
  1185. @item sf
  1186. analog transfer function
  1187. @item tf
  1188. digital transfer function
  1189. @item zp
  1190. Z-plane zeros/poles, cartesian (default)
  1191. @item pr
  1192. Z-plane zeros/poles, polar radians
  1193. @item pd
  1194. Z-plane zeros/poles, polar degrees
  1195. @item sp
  1196. S-plane zeros/poles
  1197. @end table
  1198. @item process, r
  1199. Set type of processing.
  1200. @table @samp
  1201. @item d
  1202. direct processing
  1203. @item s
  1204. serial processing
  1205. @item p
  1206. parallel processing
  1207. @end table
  1208. @item precision, e
  1209. Set filtering precision.
  1210. @table @samp
  1211. @item dbl
  1212. double-precision floating-point (default)
  1213. @item flt
  1214. single-precision floating-point
  1215. @item i32
  1216. 32-bit integers
  1217. @item i16
  1218. 16-bit integers
  1219. @end table
  1220. @item normalize, n
  1221. Normalize filter coefficients, by default is enabled.
  1222. Enabling it will normalize magnitude response at DC to 0dB.
  1223. @item mix
  1224. How much to use filtered signal in output. Default is 1.
  1225. Range is between 0 and 1.
  1226. @item response
  1227. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1228. By default it is disabled.
  1229. @item channel
  1230. Set for which IR channel to display frequency response. By default is first channel
  1231. displayed. This option is used only when @var{response} is enabled.
  1232. @item size
  1233. Set video stream size. This option is used only when @var{response} is enabled.
  1234. @end table
  1235. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1236. order.
  1237. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1238. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1239. imaginary unit.
  1240. Different coefficients and gains can be provided for every channel, in such case
  1241. use '|' to separate coefficients or gains. Last provided coefficients will be
  1242. used for all remaining channels.
  1243. @subsection Examples
  1244. @itemize
  1245. @item
  1246. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1247. @example
  1248. 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
  1249. @end example
  1250. @item
  1251. Same as above but in @code{zp} format:
  1252. @example
  1253. 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
  1254. @end example
  1255. @item
  1256. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1257. @example
  1258. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1259. @end example
  1260. @end itemize
  1261. @section alimiter
  1262. The limiter prevents an input signal from rising over a desired threshold.
  1263. This limiter uses lookahead technology to prevent your signal from distorting.
  1264. It means that there is a small delay after the signal is processed. Keep in mind
  1265. that the delay it produces is the attack time you set.
  1266. The filter accepts the following options:
  1267. @table @option
  1268. @item level_in
  1269. Set input gain. Default is 1.
  1270. @item level_out
  1271. Set output gain. Default is 1.
  1272. @item limit
  1273. Don't let signals above this level pass the limiter. Default is 1.
  1274. @item attack
  1275. The limiter will reach its attenuation level in this amount of time in
  1276. milliseconds. Default is 5 milliseconds.
  1277. @item release
  1278. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1279. Default is 50 milliseconds.
  1280. @item asc
  1281. When gain reduction is always needed ASC takes care of releasing to an
  1282. average reduction level rather than reaching a reduction of 0 in the release
  1283. time.
  1284. @item asc_level
  1285. Select how much the release time is affected by ASC, 0 means nearly no changes
  1286. in release time while 1 produces higher release times.
  1287. @item level
  1288. Auto level output signal. Default is enabled.
  1289. This normalizes audio back to 0dB if enabled.
  1290. @end table
  1291. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1292. with @ref{aresample} before applying this filter.
  1293. @section allpass
  1294. Apply a two-pole all-pass filter with central frequency (in Hz)
  1295. @var{frequency}, and filter-width @var{width}.
  1296. An all-pass filter changes the audio's frequency to phase relationship
  1297. without changing its frequency to amplitude relationship.
  1298. The filter accepts the following options:
  1299. @table @option
  1300. @item frequency, f
  1301. Set frequency in Hz.
  1302. @item width_type, t
  1303. Set method to specify band-width of filter.
  1304. @table @option
  1305. @item h
  1306. Hz
  1307. @item q
  1308. Q-Factor
  1309. @item o
  1310. octave
  1311. @item s
  1312. slope
  1313. @item k
  1314. kHz
  1315. @end table
  1316. @item width, w
  1317. Specify the band-width of a filter in width_type units.
  1318. @item mix, m
  1319. How much to use filtered signal in output. Default is 1.
  1320. Range is between 0 and 1.
  1321. @item channels, c
  1322. Specify which channels to filter, by default all available are filtered.
  1323. @item normalize, n
  1324. Normalize biquad coefficients, by default is disabled.
  1325. Enabling it will normalize magnitude response at DC to 0dB.
  1326. @item order, o
  1327. Set the filter order, can be 1 or 2. Default is 2.
  1328. @item transform, a
  1329. Set transform type of IIR filter.
  1330. @table @option
  1331. @item di
  1332. @item dii
  1333. @item tdii
  1334. @item latt
  1335. @end table
  1336. @item precision, r
  1337. Set precison of filtering.
  1338. @table @option
  1339. @item auto
  1340. Pick automatic sample format depending on surround filters.
  1341. @item s16
  1342. Always use signed 16-bit.
  1343. @item s32
  1344. Always use signed 32-bit.
  1345. @item f32
  1346. Always use float 32-bit.
  1347. @item f64
  1348. Always use float 64-bit.
  1349. @end table
  1350. @end table
  1351. @subsection Commands
  1352. This filter supports the following commands:
  1353. @table @option
  1354. @item frequency, f
  1355. Change allpass frequency.
  1356. Syntax for the command is : "@var{frequency}"
  1357. @item width_type, t
  1358. Change allpass width_type.
  1359. Syntax for the command is : "@var{width_type}"
  1360. @item width, w
  1361. Change allpass width.
  1362. Syntax for the command is : "@var{width}"
  1363. @item mix, m
  1364. Change allpass mix.
  1365. Syntax for the command is : "@var{mix}"
  1366. @end table
  1367. @section aloop
  1368. Loop audio samples.
  1369. The filter accepts the following options:
  1370. @table @option
  1371. @item loop
  1372. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1373. Default is 0.
  1374. @item size
  1375. Set maximal number of samples. Default is 0.
  1376. @item start
  1377. Set first sample of loop. Default is 0.
  1378. @end table
  1379. @anchor{amerge}
  1380. @section amerge
  1381. Merge two or more audio streams into a single multi-channel stream.
  1382. The filter accepts the following options:
  1383. @table @option
  1384. @item inputs
  1385. Set the number of inputs. Default is 2.
  1386. @end table
  1387. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1388. the channel layout of the output will be set accordingly and the channels
  1389. will be reordered as necessary. If the channel layouts of the inputs are not
  1390. disjoint, the output will have all the channels of the first input then all
  1391. the channels of the second input, in that order, and the channel layout of
  1392. the output will be the default value corresponding to the total number of
  1393. channels.
  1394. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1395. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1396. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1397. first input, b1 is the first channel of the second input).
  1398. On the other hand, if both input are in stereo, the output channels will be
  1399. in the default order: a1, a2, b1, b2, and the channel layout will be
  1400. arbitrarily set to 4.0, which may or may not be the expected value.
  1401. All inputs must have the same sample rate, and format.
  1402. If inputs do not have the same duration, the output will stop with the
  1403. shortest.
  1404. @subsection Examples
  1405. @itemize
  1406. @item
  1407. Merge two mono files into a stereo stream:
  1408. @example
  1409. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1410. @end example
  1411. @item
  1412. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1413. @example
  1414. 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
  1415. @end example
  1416. @end itemize
  1417. @section amix
  1418. Mixes multiple audio inputs into a single output.
  1419. Note that this filter only supports float samples (the @var{amerge}
  1420. and @var{pan} audio filters support many formats). If the @var{amix}
  1421. input has integer samples then @ref{aresample} will be automatically
  1422. inserted to perform the conversion to float samples.
  1423. For example
  1424. @example
  1425. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1426. @end example
  1427. will mix 3 input audio streams to a single output with the same duration as the
  1428. first input and a dropout transition time of 3 seconds.
  1429. It accepts the following parameters:
  1430. @table @option
  1431. @item inputs
  1432. The number of inputs. If unspecified, it defaults to 2.
  1433. @item duration
  1434. How to determine the end-of-stream.
  1435. @table @option
  1436. @item longest
  1437. The duration of the longest input. (default)
  1438. @item shortest
  1439. The duration of the shortest input.
  1440. @item first
  1441. The duration of the first input.
  1442. @end table
  1443. @item dropout_transition
  1444. The transition time, in seconds, for volume renormalization when an input
  1445. stream ends. The default value is 2 seconds.
  1446. @item weights
  1447. Specify weight of each input audio stream as sequence.
  1448. Each weight is separated by space. By default all inputs have same weight.
  1449. @item sum
  1450. Do not scale inputs but instead do only summation of samples.
  1451. Beware of heavy clipping if inputs are not normalized prior of filtering
  1452. or output from @var{amix} normalized after filtering. By default is disabled.
  1453. @end table
  1454. @subsection Commands
  1455. This filter supports the following commands:
  1456. @table @option
  1457. @item weights
  1458. @item sum
  1459. Syntax is same as option with same name.
  1460. @end table
  1461. @section amultiply
  1462. Multiply first audio stream with second audio stream and store result
  1463. in output audio stream. Multiplication is done by multiplying each
  1464. sample from first stream with sample at same position from second stream.
  1465. With this element-wise multiplication one can create amplitude fades and
  1466. amplitude modulations.
  1467. @section anequalizer
  1468. High-order parametric multiband equalizer for each channel.
  1469. It accepts the following parameters:
  1470. @table @option
  1471. @item params
  1472. This option string is in format:
  1473. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1474. Each equalizer band is separated by '|'.
  1475. @table @option
  1476. @item chn
  1477. Set channel number to which equalization will be applied.
  1478. If input doesn't have that channel the entry is ignored.
  1479. @item f
  1480. Set central frequency for band.
  1481. If input doesn't have that frequency the entry is ignored.
  1482. @item w
  1483. Set band width in Hertz.
  1484. @item g
  1485. Set band gain in dB.
  1486. @item t
  1487. Set filter type for band, optional, can be:
  1488. @table @samp
  1489. @item 0
  1490. Butterworth, this is default.
  1491. @item 1
  1492. Chebyshev type 1.
  1493. @item 2
  1494. Chebyshev type 2.
  1495. @end table
  1496. @end table
  1497. @item curves
  1498. With this option activated frequency response of anequalizer is displayed
  1499. in video stream.
  1500. @item size
  1501. Set video stream size. Only useful if curves option is activated.
  1502. @item mgain
  1503. Set max gain that will be displayed. Only useful if curves option is activated.
  1504. Setting this to a reasonable value makes it possible to display gain which is derived from
  1505. neighbour bands which are too close to each other and thus produce higher gain
  1506. when both are activated.
  1507. @item fscale
  1508. Set frequency scale used to draw frequency response in video output.
  1509. Can be linear or logarithmic. Default is logarithmic.
  1510. @item colors
  1511. Set color for each channel curve which is going to be displayed in video stream.
  1512. This is list of color names separated by space or by '|'.
  1513. Unrecognised or missing colors will be replaced by white color.
  1514. @end table
  1515. @subsection Examples
  1516. @itemize
  1517. @item
  1518. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1519. for first 2 channels using Chebyshev type 1 filter:
  1520. @example
  1521. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1522. @end example
  1523. @end itemize
  1524. @subsection Commands
  1525. This filter supports the following commands:
  1526. @table @option
  1527. @item change
  1528. Alter existing filter parameters.
  1529. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1530. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1531. error is returned.
  1532. @var{freq} set new frequency parameter.
  1533. @var{width} set new width parameter in Hertz.
  1534. @var{gain} set new gain parameter in dB.
  1535. Full filter invocation with asendcmd may look like this:
  1536. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1537. @end table
  1538. @section anlmdn
  1539. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1540. Each sample is adjusted by looking for other samples with similar contexts. This
  1541. context similarity is defined by comparing their surrounding patches of size
  1542. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1543. The filter accepts the following options:
  1544. @table @option
  1545. @item s
  1546. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1547. @item p
  1548. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1549. Default value is 2 milliseconds.
  1550. @item r
  1551. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1552. Default value is 6 milliseconds.
  1553. @item o
  1554. Set the output mode.
  1555. It accepts the following values:
  1556. @table @option
  1557. @item i
  1558. Pass input unchanged.
  1559. @item o
  1560. Pass noise filtered out.
  1561. @item n
  1562. Pass only noise.
  1563. Default value is @var{o}.
  1564. @end table
  1565. @item m
  1566. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1567. @end table
  1568. @subsection Commands
  1569. This filter supports the all above options as @ref{commands}.
  1570. @section anlms
  1571. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1572. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1573. relate to producing the least mean square of the error signal (difference between the desired,
  1574. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1575. A description of the accepted options follows.
  1576. @table @option
  1577. @item order
  1578. Set filter order.
  1579. @item mu
  1580. Set filter mu.
  1581. @item eps
  1582. Set the filter eps.
  1583. @item leakage
  1584. Set the filter leakage.
  1585. @item out_mode
  1586. It accepts the following values:
  1587. @table @option
  1588. @item i
  1589. Pass the 1st input.
  1590. @item d
  1591. Pass the 2nd input.
  1592. @item o
  1593. Pass filtered samples.
  1594. @item n
  1595. Pass difference between desired and filtered samples.
  1596. Default value is @var{o}.
  1597. @end table
  1598. @end table
  1599. @subsection Examples
  1600. @itemize
  1601. @item
  1602. One of many usages of this filter is noise reduction, input audio is filtered
  1603. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1604. @example
  1605. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1606. @end example
  1607. @end itemize
  1608. @subsection Commands
  1609. This filter supports the same commands as options, excluding option @code{order}.
  1610. @section anull
  1611. Pass the audio source unchanged to the output.
  1612. @section apad
  1613. Pad the end of an audio stream with silence.
  1614. This can be used together with @command{ffmpeg} @option{-shortest} to
  1615. extend audio streams to the same length as the video stream.
  1616. A description of the accepted options follows.
  1617. @table @option
  1618. @item packet_size
  1619. Set silence packet size. Default value is 4096.
  1620. @item pad_len
  1621. Set the number of samples of silence to add to the end. After the
  1622. value is reached, the stream is terminated. This option is mutually
  1623. exclusive with @option{whole_len}.
  1624. @item whole_len
  1625. Set the minimum total number of samples in the output audio stream. If
  1626. the value is longer than the input audio length, silence is added to
  1627. the end, until the value is reached. This option is mutually exclusive
  1628. with @option{pad_len}.
  1629. @item pad_dur
  1630. Specify the duration of samples of silence to add. See
  1631. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1632. for the accepted syntax. Used only if set to non-zero value.
  1633. @item whole_dur
  1634. Specify the minimum total duration in the output audio stream. See
  1635. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1636. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1637. the input audio length, silence is added to the end, until the value is reached.
  1638. This option is mutually exclusive with @option{pad_dur}
  1639. @end table
  1640. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1641. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1642. the input stream indefinitely.
  1643. @subsection Examples
  1644. @itemize
  1645. @item
  1646. Add 1024 samples of silence to the end of the input:
  1647. @example
  1648. apad=pad_len=1024
  1649. @end example
  1650. @item
  1651. Make sure the audio output will contain at least 10000 samples, pad
  1652. the input with silence if required:
  1653. @example
  1654. apad=whole_len=10000
  1655. @end example
  1656. @item
  1657. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1658. video stream will always result the shortest and will be converted
  1659. until the end in the output file when using the @option{shortest}
  1660. option:
  1661. @example
  1662. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1663. @end example
  1664. @end itemize
  1665. @section aphaser
  1666. Add a phasing effect to the input audio.
  1667. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1668. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1669. A description of the accepted parameters follows.
  1670. @table @option
  1671. @item in_gain
  1672. Set input gain. Default is 0.4.
  1673. @item out_gain
  1674. Set output gain. Default is 0.74
  1675. @item delay
  1676. Set delay in milliseconds. Default is 3.0.
  1677. @item decay
  1678. Set decay. Default is 0.4.
  1679. @item speed
  1680. Set modulation speed in Hz. Default is 0.5.
  1681. @item type
  1682. Set modulation type. Default is triangular.
  1683. It accepts the following values:
  1684. @table @samp
  1685. @item triangular, t
  1686. @item sinusoidal, s
  1687. @end table
  1688. @end table
  1689. @section aphaseshift
  1690. Apply phase shift to input audio samples.
  1691. The filter accepts the following options:
  1692. @table @option
  1693. @item shift
  1694. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1695. Default value is 0.0.
  1696. @item level
  1697. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1698. Default value is 1.0.
  1699. @end table
  1700. @subsection Commands
  1701. This filter supports the all above options as @ref{commands}.
  1702. @section apulsator
  1703. Audio pulsator is something between an autopanner and a tremolo.
  1704. But it can produce funny stereo effects as well. Pulsator changes the volume
  1705. of the left and right channel based on a LFO (low frequency oscillator) with
  1706. different waveforms and shifted phases.
  1707. This filter have the ability to define an offset between left and right
  1708. channel. An offset of 0 means that both LFO shapes match each other.
  1709. The left and right channel are altered equally - a conventional tremolo.
  1710. An offset of 50% means that the shape of the right channel is exactly shifted
  1711. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1712. an autopanner. At 1 both curves match again. Every setting in between moves the
  1713. phase shift gapless between all stages and produces some "bypassing" sounds with
  1714. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1715. the 0.5) the faster the signal passes from the left to the right speaker.
  1716. The filter accepts the following options:
  1717. @table @option
  1718. @item level_in
  1719. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1720. @item level_out
  1721. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1722. @item mode
  1723. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1724. sawup or sawdown. Default is sine.
  1725. @item amount
  1726. Set modulation. Define how much of original signal is affected by the LFO.
  1727. @item offset_l
  1728. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1729. @item offset_r
  1730. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1731. @item width
  1732. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1733. @item timing
  1734. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1735. @item bpm
  1736. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1737. is set to bpm.
  1738. @item ms
  1739. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1740. is set to ms.
  1741. @item hz
  1742. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1743. if timing is set to hz.
  1744. @end table
  1745. @anchor{aresample}
  1746. @section aresample
  1747. Resample the input audio to the specified parameters, using the
  1748. libswresample library. If none are specified then the filter will
  1749. automatically convert between its input and output.
  1750. This filter is also able to stretch/squeeze the audio data to make it match
  1751. the timestamps or to inject silence / cut out audio to make it match the
  1752. timestamps, do a combination of both or do neither.
  1753. The filter accepts the syntax
  1754. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1755. expresses a sample rate and @var{resampler_options} is a list of
  1756. @var{key}=@var{value} pairs, separated by ":". See the
  1757. @ref{Resampler Options,,"Resampler Options" section in the
  1758. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1759. for the complete list of supported options.
  1760. @subsection Examples
  1761. @itemize
  1762. @item
  1763. Resample the input audio to 44100Hz:
  1764. @example
  1765. aresample=44100
  1766. @end example
  1767. @item
  1768. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1769. samples per second compensation:
  1770. @example
  1771. aresample=async=1000
  1772. @end example
  1773. @end itemize
  1774. @section areverse
  1775. Reverse an audio clip.
  1776. Warning: This filter requires memory to buffer the entire clip, so trimming
  1777. is suggested.
  1778. @subsection Examples
  1779. @itemize
  1780. @item
  1781. Take the first 5 seconds of a clip, and reverse it.
  1782. @example
  1783. atrim=end=5,areverse
  1784. @end example
  1785. @end itemize
  1786. @section arnndn
  1787. Reduce noise from speech using Recurrent Neural Networks.
  1788. This filter accepts the following options:
  1789. @table @option
  1790. @item model, m
  1791. Set train model file to load. This option is always required.
  1792. @item mix
  1793. Set how much to mix filtered samples into final output.
  1794. Allowed range is from -1 to 1. Default value is 1.
  1795. Negative values are special, they set how much to keep filtered noise
  1796. in the final filter output. Set this option to -1 to hear actual
  1797. noise removed from input signal.
  1798. @end table
  1799. @subsection Commands
  1800. This filter supports the all above options as @ref{commands}.
  1801. @section asetnsamples
  1802. Set the number of samples per each output audio frame.
  1803. The last output packet may contain a different number of samples, as
  1804. the filter will flush all the remaining samples when the input audio
  1805. signals its end.
  1806. The filter accepts the following options:
  1807. @table @option
  1808. @item nb_out_samples, n
  1809. Set the number of frames per each output audio frame. The number is
  1810. intended as the number of samples @emph{per each channel}.
  1811. Default value is 1024.
  1812. @item pad, p
  1813. If set to 1, the filter will pad the last audio frame with zeroes, so
  1814. that the last frame will contain the same number of samples as the
  1815. previous ones. Default value is 1.
  1816. @end table
  1817. For example, to set the number of per-frame samples to 1234 and
  1818. disable padding for the last frame, use:
  1819. @example
  1820. asetnsamples=n=1234:p=0
  1821. @end example
  1822. @section asetrate
  1823. Set the sample rate without altering the PCM data.
  1824. This will result in a change of speed and pitch.
  1825. The filter accepts the following options:
  1826. @table @option
  1827. @item sample_rate, r
  1828. Set the output sample rate. Default is 44100 Hz.
  1829. @end table
  1830. @section ashowinfo
  1831. Show a line containing various information for each input audio frame.
  1832. The input audio is not modified.
  1833. The shown line contains a sequence of key/value pairs of the form
  1834. @var{key}:@var{value}.
  1835. The following values are shown in the output:
  1836. @table @option
  1837. @item n
  1838. The (sequential) number of the input frame, starting from 0.
  1839. @item pts
  1840. The presentation timestamp of the input frame, in time base units; the time base
  1841. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1842. @item pts_time
  1843. The presentation timestamp of the input frame in seconds.
  1844. @item pos
  1845. position of the frame in the input stream, -1 if this information in
  1846. unavailable and/or meaningless (for example in case of synthetic audio)
  1847. @item fmt
  1848. The sample format.
  1849. @item chlayout
  1850. The channel layout.
  1851. @item rate
  1852. The sample rate for the audio frame.
  1853. @item nb_samples
  1854. The number of samples (per channel) in the frame.
  1855. @item checksum
  1856. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1857. audio, the data is treated as if all the planes were concatenated.
  1858. @item plane_checksums
  1859. A list of Adler-32 checksums for each data plane.
  1860. @end table
  1861. @section asoftclip
  1862. Apply audio soft clipping.
  1863. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1864. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1865. This filter accepts the following options:
  1866. @table @option
  1867. @item type
  1868. Set type of soft-clipping.
  1869. It accepts the following values:
  1870. @table @option
  1871. @item hard
  1872. @item tanh
  1873. @item atan
  1874. @item cubic
  1875. @item exp
  1876. @item alg
  1877. @item quintic
  1878. @item sin
  1879. @item erf
  1880. @end table
  1881. @item threshold
  1882. Set threshold from where to start clipping. Default value is 0dB or 1.
  1883. @item output
  1884. Set gain applied to output. Default value is 0dB or 1.
  1885. @item param
  1886. Set additional parameter which controls sigmoid function.
  1887. @item oversample
  1888. Set oversampling factor.
  1889. @end table
  1890. @subsection Commands
  1891. This filter supports the all above options as @ref{commands}.
  1892. @section asr
  1893. Automatic Speech Recognition
  1894. This filter uses PocketSphinx for speech recognition. To enable
  1895. compilation of this filter, you need to configure FFmpeg with
  1896. @code{--enable-pocketsphinx}.
  1897. It accepts the following options:
  1898. @table @option
  1899. @item rate
  1900. Set sampling rate of input audio. Defaults is @code{16000}.
  1901. This need to match speech models, otherwise one will get poor results.
  1902. @item hmm
  1903. Set dictionary containing acoustic model files.
  1904. @item dict
  1905. Set pronunciation dictionary.
  1906. @item lm
  1907. Set language model file.
  1908. @item lmctl
  1909. Set language model set.
  1910. @item lmname
  1911. Set which language model to use.
  1912. @item logfn
  1913. Set output for log messages.
  1914. @end table
  1915. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1916. @anchor{astats}
  1917. @section astats
  1918. Display time domain statistical information about the audio channels.
  1919. Statistics are calculated and displayed for each audio channel and,
  1920. where applicable, an overall figure is also given.
  1921. It accepts the following option:
  1922. @table @option
  1923. @item length
  1924. Short window length in seconds, used for peak and trough RMS measurement.
  1925. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1926. @item metadata
  1927. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1928. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1929. disabled.
  1930. Available keys for each channel are:
  1931. DC_offset
  1932. Min_level
  1933. Max_level
  1934. Min_difference
  1935. Max_difference
  1936. Mean_difference
  1937. RMS_difference
  1938. Peak_level
  1939. RMS_peak
  1940. RMS_trough
  1941. Crest_factor
  1942. Flat_factor
  1943. Peak_count
  1944. Noise_floor
  1945. Noise_floor_count
  1946. Bit_depth
  1947. Dynamic_range
  1948. Zero_crossings
  1949. Zero_crossings_rate
  1950. Number_of_NaNs
  1951. Number_of_Infs
  1952. Number_of_denormals
  1953. and for Overall:
  1954. DC_offset
  1955. Min_level
  1956. Max_level
  1957. Min_difference
  1958. Max_difference
  1959. Mean_difference
  1960. RMS_difference
  1961. Peak_level
  1962. RMS_level
  1963. RMS_peak
  1964. RMS_trough
  1965. Flat_factor
  1966. Peak_count
  1967. Noise_floor
  1968. Noise_floor_count
  1969. Bit_depth
  1970. Number_of_samples
  1971. Number_of_NaNs
  1972. Number_of_Infs
  1973. Number_of_denormals
  1974. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1975. this @code{lavfi.astats.Overall.Peak_count}.
  1976. For description what each key means read below.
  1977. @item reset
  1978. Set number of frame after which stats are going to be recalculated.
  1979. Default is disabled.
  1980. @item measure_perchannel
  1981. Select the entries which need to be measured per channel. The metadata keys can
  1982. be used as flags, default is @option{all} which measures everything.
  1983. @option{none} disables all per channel measurement.
  1984. @item measure_overall
  1985. Select the entries which need to be measured overall. The metadata keys can
  1986. be used as flags, default is @option{all} which measures everything.
  1987. @option{none} disables all overall measurement.
  1988. @end table
  1989. A description of each shown parameter follows:
  1990. @table @option
  1991. @item DC offset
  1992. Mean amplitude displacement from zero.
  1993. @item Min level
  1994. Minimal sample level.
  1995. @item Max level
  1996. Maximal sample level.
  1997. @item Min difference
  1998. Minimal difference between two consecutive samples.
  1999. @item Max difference
  2000. Maximal difference between two consecutive samples.
  2001. @item Mean difference
  2002. Mean difference between two consecutive samples.
  2003. The average of each difference between two consecutive samples.
  2004. @item RMS difference
  2005. Root Mean Square difference between two consecutive samples.
  2006. @item Peak level dB
  2007. @item RMS level dB
  2008. Standard peak and RMS level measured in dBFS.
  2009. @item RMS peak dB
  2010. @item RMS trough dB
  2011. Peak and trough values for RMS level measured over a short window.
  2012. @item Crest factor
  2013. Standard ratio of peak to RMS level (note: not in dB).
  2014. @item Flat factor
  2015. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2016. (i.e. either @var{Min level} or @var{Max level}).
  2017. @item Peak count
  2018. Number of occasions (not the number of samples) that the signal attained either
  2019. @var{Min level} or @var{Max level}.
  2020. @item Noise floor dB
  2021. Minimum local peak measured in dBFS over a short window.
  2022. @item Noise floor count
  2023. Number of occasions (not the number of samples) that the signal attained
  2024. @var{Noise floor}.
  2025. @item Bit depth
  2026. Overall bit depth of audio. Number of bits used for each sample.
  2027. @item Dynamic range
  2028. Measured dynamic range of audio in dB.
  2029. @item Zero crossings
  2030. Number of points where the waveform crosses the zero level axis.
  2031. @item Zero crossings rate
  2032. Rate of Zero crossings and number of audio samples.
  2033. @end table
  2034. @section asubboost
  2035. Boost subwoofer frequencies.
  2036. The filter accepts the following options:
  2037. @table @option
  2038. @item dry
  2039. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2040. Default value is 0.7.
  2041. @item wet
  2042. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2043. Default value is 0.7.
  2044. @item decay
  2045. Set delay line decay gain value. Allowed range is from 0 to 1.
  2046. Default value is 0.7.
  2047. @item feedback
  2048. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2049. Default value is 0.9.
  2050. @item cutoff
  2051. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2052. Default value is 100.
  2053. @item slope
  2054. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2055. Default value is 0.5.
  2056. @item delay
  2057. Set delay. Allowed range is from 1 to 100.
  2058. Default value is 20.
  2059. @end table
  2060. @subsection Commands
  2061. This filter supports the all above options as @ref{commands}.
  2062. @section asubcut
  2063. Cut subwoofer frequencies.
  2064. This filter allows to set custom, steeper
  2065. roll off than highpass filter, and thus is able to more attenuate
  2066. frequency content in stop-band.
  2067. The filter accepts the following options:
  2068. @table @option
  2069. @item cutoff
  2070. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2071. Default value is 20.
  2072. @item order
  2073. Set filter order. Available values are from 3 to 20.
  2074. Default value is 10.
  2075. @item level
  2076. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2077. @end table
  2078. @subsection Commands
  2079. This filter supports the all above options as @ref{commands}.
  2080. @section asupercut
  2081. Cut super frequencies.
  2082. The filter accepts the following options:
  2083. @table @option
  2084. @item cutoff
  2085. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2086. Default value is 20000.
  2087. @item order
  2088. Set filter order. Available values are from 3 to 20.
  2089. Default value is 10.
  2090. @item level
  2091. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2092. @end table
  2093. @subsection Commands
  2094. This filter supports the all above options as @ref{commands}.
  2095. @section asuperpass
  2096. Apply high order Butterworth band-pass filter.
  2097. The filter accepts the following options:
  2098. @table @option
  2099. @item centerf
  2100. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2101. Default value is 1000.
  2102. @item order
  2103. Set filter order. Available values are from 4 to 20.
  2104. Default value is 4.
  2105. @item qfactor
  2106. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2107. @item level
  2108. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2109. @end table
  2110. @subsection Commands
  2111. This filter supports the all above options as @ref{commands}.
  2112. @section asuperstop
  2113. Apply high order Butterworth band-stop filter.
  2114. The filter accepts the following options:
  2115. @table @option
  2116. @item centerf
  2117. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2118. Default value is 1000.
  2119. @item order
  2120. Set filter order. Available values are from 4 to 20.
  2121. Default value is 4.
  2122. @item qfactor
  2123. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2124. @item level
  2125. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2126. @end table
  2127. @subsection Commands
  2128. This filter supports the all above options as @ref{commands}.
  2129. @section atempo
  2130. Adjust audio tempo.
  2131. The filter accepts exactly one parameter, the audio tempo. If not
  2132. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2133. be in the [0.5, 100.0] range.
  2134. Note that tempo greater than 2 will skip some samples rather than
  2135. blend them in. If for any reason this is a concern it is always
  2136. possible to daisy-chain several instances of atempo to achieve the
  2137. desired product tempo.
  2138. @subsection Examples
  2139. @itemize
  2140. @item
  2141. Slow down audio to 80% tempo:
  2142. @example
  2143. atempo=0.8
  2144. @end example
  2145. @item
  2146. To speed up audio to 300% tempo:
  2147. @example
  2148. atempo=3
  2149. @end example
  2150. @item
  2151. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2152. @example
  2153. atempo=sqrt(3),atempo=sqrt(3)
  2154. @end example
  2155. @end itemize
  2156. @subsection Commands
  2157. This filter supports the following commands:
  2158. @table @option
  2159. @item tempo
  2160. Change filter tempo scale factor.
  2161. Syntax for the command is : "@var{tempo}"
  2162. @end table
  2163. @section atrim
  2164. Trim the input so that the output contains one continuous subpart of the input.
  2165. It accepts the following parameters:
  2166. @table @option
  2167. @item start
  2168. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2169. sample with the timestamp @var{start} will be the first sample in the output.
  2170. @item end
  2171. Specify time of the first audio sample that will be dropped, i.e. the
  2172. audio sample immediately preceding the one with the timestamp @var{end} will be
  2173. the last sample in the output.
  2174. @item start_pts
  2175. Same as @var{start}, except this option sets the start timestamp in samples
  2176. instead of seconds.
  2177. @item end_pts
  2178. Same as @var{end}, except this option sets the end timestamp in samples instead
  2179. of seconds.
  2180. @item duration
  2181. The maximum duration of the output in seconds.
  2182. @item start_sample
  2183. The number of the first sample that should be output.
  2184. @item end_sample
  2185. The number of the first sample that should be dropped.
  2186. @end table
  2187. @option{start}, @option{end}, and @option{duration} are expressed as time
  2188. duration specifications; see
  2189. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2190. Note that the first two sets of the start/end options and the @option{duration}
  2191. option look at the frame timestamp, while the _sample options simply count the
  2192. samples that pass through the filter. So start/end_pts and start/end_sample will
  2193. give different results when the timestamps are wrong, inexact or do not start at
  2194. zero. Also note that this filter does not modify the timestamps. If you wish
  2195. to have the output timestamps start at zero, insert the asetpts filter after the
  2196. atrim filter.
  2197. If multiple start or end options are set, this filter tries to be greedy and
  2198. keep all samples that match at least one of the specified constraints. To keep
  2199. only the part that matches all the constraints at once, chain multiple atrim
  2200. filters.
  2201. The defaults are such that all the input is kept. So it is possible to set e.g.
  2202. just the end values to keep everything before the specified time.
  2203. Examples:
  2204. @itemize
  2205. @item
  2206. Drop everything except the second minute of input:
  2207. @example
  2208. ffmpeg -i INPUT -af atrim=60:120
  2209. @end example
  2210. @item
  2211. Keep only the first 1000 samples:
  2212. @example
  2213. ffmpeg -i INPUT -af atrim=end_sample=1000
  2214. @end example
  2215. @end itemize
  2216. @section axcorrelate
  2217. Calculate normalized cross-correlation between two input audio streams.
  2218. Resulted samples are always between -1 and 1 inclusive.
  2219. If result is 1 it means two input samples are highly correlated in that selected segment.
  2220. Result 0 means they are not correlated at all.
  2221. If result is -1 it means two input samples are out of phase, which means they cancel each
  2222. other.
  2223. The filter accepts the following options:
  2224. @table @option
  2225. @item size
  2226. Set size of segment over which cross-correlation is calculated.
  2227. Default is 256. Allowed range is from 2 to 131072.
  2228. @item algo
  2229. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2230. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2231. are always zero and thus need much less calculations to make.
  2232. This is generally not true, but is valid for typical audio streams.
  2233. @end table
  2234. @subsection Examples
  2235. @itemize
  2236. @item
  2237. Calculate correlation between channels in stereo audio stream:
  2238. @example
  2239. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2240. @end example
  2241. @end itemize
  2242. @section bandpass
  2243. Apply a two-pole Butterworth band-pass filter with central
  2244. frequency @var{frequency}, and (3dB-point) band-width width.
  2245. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2246. instead of the default: constant 0dB peak gain.
  2247. The filter roll off at 6dB per octave (20dB per decade).
  2248. The filter accepts the following options:
  2249. @table @option
  2250. @item frequency, f
  2251. Set the filter's central frequency. Default is @code{3000}.
  2252. @item csg
  2253. Constant skirt gain if set to 1. Defaults to 0.
  2254. @item width_type, t
  2255. Set method to specify band-width of filter.
  2256. @table @option
  2257. @item h
  2258. Hz
  2259. @item q
  2260. Q-Factor
  2261. @item o
  2262. octave
  2263. @item s
  2264. slope
  2265. @item k
  2266. kHz
  2267. @end table
  2268. @item width, w
  2269. Specify the band-width of a filter in width_type units.
  2270. @item mix, m
  2271. How much to use filtered signal in output. Default is 1.
  2272. Range is between 0 and 1.
  2273. @item channels, c
  2274. Specify which channels to filter, by default all available are filtered.
  2275. @item normalize, n
  2276. Normalize biquad coefficients, by default is disabled.
  2277. Enabling it will normalize magnitude response at DC to 0dB.
  2278. @item transform, a
  2279. Set transform type of IIR filter.
  2280. @table @option
  2281. @item di
  2282. @item dii
  2283. @item tdii
  2284. @item latt
  2285. @end table
  2286. @item precision, r
  2287. Set precison of filtering.
  2288. @table @option
  2289. @item auto
  2290. Pick automatic sample format depending on surround filters.
  2291. @item s16
  2292. Always use signed 16-bit.
  2293. @item s32
  2294. Always use signed 32-bit.
  2295. @item f32
  2296. Always use float 32-bit.
  2297. @item f64
  2298. Always use float 64-bit.
  2299. @end table
  2300. @end table
  2301. @subsection Commands
  2302. This filter supports the following commands:
  2303. @table @option
  2304. @item frequency, f
  2305. Change bandpass frequency.
  2306. Syntax for the command is : "@var{frequency}"
  2307. @item width_type, t
  2308. Change bandpass width_type.
  2309. Syntax for the command is : "@var{width_type}"
  2310. @item width, w
  2311. Change bandpass width.
  2312. Syntax for the command is : "@var{width}"
  2313. @item mix, m
  2314. Change bandpass mix.
  2315. Syntax for the command is : "@var{mix}"
  2316. @end table
  2317. @section bandreject
  2318. Apply a two-pole Butterworth band-reject filter with central
  2319. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2320. The filter roll off at 6dB per octave (20dB per decade).
  2321. The filter accepts the following options:
  2322. @table @option
  2323. @item frequency, f
  2324. Set the filter's central frequency. Default is @code{3000}.
  2325. @item width_type, t
  2326. Set method to specify band-width of filter.
  2327. @table @option
  2328. @item h
  2329. Hz
  2330. @item q
  2331. Q-Factor
  2332. @item o
  2333. octave
  2334. @item s
  2335. slope
  2336. @item k
  2337. kHz
  2338. @end table
  2339. @item width, w
  2340. Specify the band-width of a filter in width_type units.
  2341. @item mix, m
  2342. How much to use filtered signal in output. Default is 1.
  2343. Range is between 0 and 1.
  2344. @item channels, c
  2345. Specify which channels to filter, by default all available are filtered.
  2346. @item normalize, n
  2347. Normalize biquad coefficients, by default is disabled.
  2348. Enabling it will normalize magnitude response at DC to 0dB.
  2349. @item transform, a
  2350. Set transform type of IIR filter.
  2351. @table @option
  2352. @item di
  2353. @item dii
  2354. @item tdii
  2355. @item latt
  2356. @end table
  2357. @item precision, r
  2358. Set precison of filtering.
  2359. @table @option
  2360. @item auto
  2361. Pick automatic sample format depending on surround filters.
  2362. @item s16
  2363. Always use signed 16-bit.
  2364. @item s32
  2365. Always use signed 32-bit.
  2366. @item f32
  2367. Always use float 32-bit.
  2368. @item f64
  2369. Always use float 64-bit.
  2370. @end table
  2371. @end table
  2372. @subsection Commands
  2373. This filter supports the following commands:
  2374. @table @option
  2375. @item frequency, f
  2376. Change bandreject frequency.
  2377. Syntax for the command is : "@var{frequency}"
  2378. @item width_type, t
  2379. Change bandreject width_type.
  2380. Syntax for the command is : "@var{width_type}"
  2381. @item width, w
  2382. Change bandreject width.
  2383. Syntax for the command is : "@var{width}"
  2384. @item mix, m
  2385. Change bandreject mix.
  2386. Syntax for the command is : "@var{mix}"
  2387. @end table
  2388. @section bass, lowshelf
  2389. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2390. shelving filter with a response similar to that of a standard
  2391. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2392. The filter accepts the following options:
  2393. @table @option
  2394. @item gain, g
  2395. Give the gain at 0 Hz. Its useful range is about -20
  2396. (for a large cut) to +20 (for a large boost).
  2397. Beware of clipping when using a positive gain.
  2398. @item frequency, f
  2399. Set the filter's central frequency and so can be used
  2400. to extend or reduce the frequency range to be boosted or cut.
  2401. The default value is @code{100} Hz.
  2402. @item width_type, t
  2403. Set method to specify band-width of filter.
  2404. @table @option
  2405. @item h
  2406. Hz
  2407. @item q
  2408. Q-Factor
  2409. @item o
  2410. octave
  2411. @item s
  2412. slope
  2413. @item k
  2414. kHz
  2415. @end table
  2416. @item width, w
  2417. Determine how steep is the filter's shelf transition.
  2418. @item poles, p
  2419. Set number of poles. Default is 2.
  2420. @item mix, m
  2421. How much to use filtered signal in output. Default is 1.
  2422. Range is between 0 and 1.
  2423. @item channels, c
  2424. Specify which channels to filter, by default all available are filtered.
  2425. @item normalize, n
  2426. Normalize biquad coefficients, by default is disabled.
  2427. Enabling it will normalize magnitude response at DC to 0dB.
  2428. @item transform, a
  2429. Set transform type of IIR filter.
  2430. @table @option
  2431. @item di
  2432. @item dii
  2433. @item tdii
  2434. @item latt
  2435. @end table
  2436. @item precision, r
  2437. Set precison of filtering.
  2438. @table @option
  2439. @item auto
  2440. Pick automatic sample format depending on surround filters.
  2441. @item s16
  2442. Always use signed 16-bit.
  2443. @item s32
  2444. Always use signed 32-bit.
  2445. @item f32
  2446. Always use float 32-bit.
  2447. @item f64
  2448. Always use float 64-bit.
  2449. @end table
  2450. @end table
  2451. @subsection Commands
  2452. This filter supports the following commands:
  2453. @table @option
  2454. @item frequency, f
  2455. Change bass frequency.
  2456. Syntax for the command is : "@var{frequency}"
  2457. @item width_type, t
  2458. Change bass width_type.
  2459. Syntax for the command is : "@var{width_type}"
  2460. @item width, w
  2461. Change bass width.
  2462. Syntax for the command is : "@var{width}"
  2463. @item gain, g
  2464. Change bass gain.
  2465. Syntax for the command is : "@var{gain}"
  2466. @item mix, m
  2467. Change bass mix.
  2468. Syntax for the command is : "@var{mix}"
  2469. @end table
  2470. @section biquad
  2471. Apply a biquad IIR filter with the given coefficients.
  2472. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2473. are the numerator and denominator coefficients respectively.
  2474. and @var{channels}, @var{c} specify which channels to filter, by default all
  2475. available are filtered.
  2476. @subsection Commands
  2477. This filter supports the following commands:
  2478. @table @option
  2479. @item a0
  2480. @item a1
  2481. @item a2
  2482. @item b0
  2483. @item b1
  2484. @item b2
  2485. Change biquad parameter.
  2486. Syntax for the command is : "@var{value}"
  2487. @item mix, m
  2488. How much to use filtered signal in output. Default is 1.
  2489. Range is between 0 and 1.
  2490. @item channels, c
  2491. Specify which channels to filter, by default all available are filtered.
  2492. @item normalize, n
  2493. Normalize biquad coefficients, by default is disabled.
  2494. Enabling it will normalize magnitude response at DC to 0dB.
  2495. @item transform, a
  2496. Set transform type of IIR filter.
  2497. @table @option
  2498. @item di
  2499. @item dii
  2500. @item tdii
  2501. @item latt
  2502. @end table
  2503. @item precision, r
  2504. Set precison of filtering.
  2505. @table @option
  2506. @item auto
  2507. Pick automatic sample format depending on surround filters.
  2508. @item s16
  2509. Always use signed 16-bit.
  2510. @item s32
  2511. Always use signed 32-bit.
  2512. @item f32
  2513. Always use float 32-bit.
  2514. @item f64
  2515. Always use float 64-bit.
  2516. @end table
  2517. @end table
  2518. @section bs2b
  2519. Bauer stereo to binaural transformation, which improves headphone listening of
  2520. stereo audio records.
  2521. To enable compilation of this filter you need to configure FFmpeg with
  2522. @code{--enable-libbs2b}.
  2523. It accepts the following parameters:
  2524. @table @option
  2525. @item profile
  2526. Pre-defined crossfeed level.
  2527. @table @option
  2528. @item default
  2529. Default level (fcut=700, feed=50).
  2530. @item cmoy
  2531. Chu Moy circuit (fcut=700, feed=60).
  2532. @item jmeier
  2533. Jan Meier circuit (fcut=650, feed=95).
  2534. @end table
  2535. @item fcut
  2536. Cut frequency (in Hz).
  2537. @item feed
  2538. Feed level (in Hz).
  2539. @end table
  2540. @section channelmap
  2541. Remap input channels to new locations.
  2542. It accepts the following parameters:
  2543. @table @option
  2544. @item map
  2545. Map channels from input to output. The argument is a '|'-separated list of
  2546. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2547. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2548. channel (e.g. FL for front left) or its index in the input channel layout.
  2549. @var{out_channel} is the name of the output channel or its index in the output
  2550. channel layout. If @var{out_channel} is not given then it is implicitly an
  2551. index, starting with zero and increasing by one for each mapping.
  2552. @item channel_layout
  2553. The channel layout of the output stream.
  2554. @end table
  2555. If no mapping is present, the filter will implicitly map input channels to
  2556. output channels, preserving indices.
  2557. @subsection Examples
  2558. @itemize
  2559. @item
  2560. For example, assuming a 5.1+downmix input MOV file,
  2561. @example
  2562. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2563. @end example
  2564. will create an output WAV file tagged as stereo from the downmix channels of
  2565. the input.
  2566. @item
  2567. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2568. @example
  2569. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2570. @end example
  2571. @end itemize
  2572. @section channelsplit
  2573. Split each channel from an input audio stream into a separate output stream.
  2574. It accepts the following parameters:
  2575. @table @option
  2576. @item channel_layout
  2577. The channel layout of the input stream. The default is "stereo".
  2578. @item channels
  2579. A channel layout describing the channels to be extracted as separate output streams
  2580. or "all" to extract each input channel as a separate stream. The default is "all".
  2581. Choosing channels not present in channel layout in the input will result in an error.
  2582. @end table
  2583. @subsection Examples
  2584. @itemize
  2585. @item
  2586. For example, assuming a stereo input MP3 file,
  2587. @example
  2588. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2589. @end example
  2590. will create an output Matroska file with two audio streams, one containing only
  2591. the left channel and the other the right channel.
  2592. @item
  2593. Split a 5.1 WAV file into per-channel files:
  2594. @example
  2595. ffmpeg -i in.wav -filter_complex
  2596. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2597. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2598. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2599. side_right.wav
  2600. @end example
  2601. @item
  2602. Extract only LFE from a 5.1 WAV file:
  2603. @example
  2604. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2605. -map '[LFE]' lfe.wav
  2606. @end example
  2607. @end itemize
  2608. @section chorus
  2609. Add a chorus effect to the audio.
  2610. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2611. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2612. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2613. The modulation depth defines the range the modulated delay is played before or after
  2614. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2615. sound tuned around the original one, like in a chorus where some vocals are slightly
  2616. off key.
  2617. It accepts the following parameters:
  2618. @table @option
  2619. @item in_gain
  2620. Set input gain. Default is 0.4.
  2621. @item out_gain
  2622. Set output gain. Default is 0.4.
  2623. @item delays
  2624. Set delays. A typical delay is around 40ms to 60ms.
  2625. @item decays
  2626. Set decays.
  2627. @item speeds
  2628. Set speeds.
  2629. @item depths
  2630. Set depths.
  2631. @end table
  2632. @subsection Examples
  2633. @itemize
  2634. @item
  2635. A single delay:
  2636. @example
  2637. chorus=0.7:0.9:55:0.4:0.25:2
  2638. @end example
  2639. @item
  2640. Two delays:
  2641. @example
  2642. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2643. @end example
  2644. @item
  2645. Fuller sounding chorus with three delays:
  2646. @example
  2647. 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
  2648. @end example
  2649. @end itemize
  2650. @section compand
  2651. Compress or expand the audio's dynamic range.
  2652. It accepts the following parameters:
  2653. @table @option
  2654. @item attacks
  2655. @item decays
  2656. A list of times in seconds for each channel over which the instantaneous level
  2657. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2658. increase of volume and @var{decays} refers to decrease of volume. For most
  2659. situations, the attack time (response to the audio getting louder) should be
  2660. shorter than the decay time, because the human ear is more sensitive to sudden
  2661. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2662. a typical value for decay is 0.8 seconds.
  2663. If specified number of attacks & decays is lower than number of channels, the last
  2664. set attack/decay will be used for all remaining channels.
  2665. @item points
  2666. A list of points for the transfer function, specified in dB relative to the
  2667. maximum possible signal amplitude. Each key points list must be defined using
  2668. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2669. @code{x0/y0 x1/y1 x2/y2 ....}
  2670. The input values must be in strictly increasing order but the transfer function
  2671. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2672. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2673. function are @code{-70/-70|-60/-20|1/0}.
  2674. @item soft-knee
  2675. Set the curve radius in dB for all joints. It defaults to 0.01.
  2676. @item gain
  2677. Set the additional gain in dB to be applied at all points on the transfer
  2678. function. This allows for easy adjustment of the overall gain.
  2679. It defaults to 0.
  2680. @item volume
  2681. Set an initial volume, in dB, to be assumed for each channel when filtering
  2682. starts. This permits the user to supply a nominal level initially, so that, for
  2683. example, a very large gain is not applied to initial signal levels before the
  2684. companding has begun to operate. A typical value for audio which is initially
  2685. quiet is -90 dB. It defaults to 0.
  2686. @item delay
  2687. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2688. delayed before being fed to the volume adjuster. Specifying a delay
  2689. approximately equal to the attack/decay times allows the filter to effectively
  2690. operate in predictive rather than reactive mode. It defaults to 0.
  2691. @end table
  2692. @subsection Examples
  2693. @itemize
  2694. @item
  2695. Make music with both quiet and loud passages suitable for listening to in a
  2696. noisy environment:
  2697. @example
  2698. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2699. @end example
  2700. Another example for audio with whisper and explosion parts:
  2701. @example
  2702. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2703. @end example
  2704. @item
  2705. A noise gate for when the noise is at a lower level than the signal:
  2706. @example
  2707. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2708. @end example
  2709. @item
  2710. Here is another noise gate, this time for when the noise is at a higher level
  2711. than the signal (making it, in some ways, similar to squelch):
  2712. @example
  2713. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2714. @end example
  2715. @item
  2716. 2:1 compression starting at -6dB:
  2717. @example
  2718. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2719. @end example
  2720. @item
  2721. 2:1 compression starting at -9dB:
  2722. @example
  2723. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2724. @end example
  2725. @item
  2726. 2:1 compression starting at -12dB:
  2727. @example
  2728. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2729. @end example
  2730. @item
  2731. 2:1 compression starting at -18dB:
  2732. @example
  2733. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2734. @end example
  2735. @item
  2736. 3:1 compression starting at -15dB:
  2737. @example
  2738. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2739. @end example
  2740. @item
  2741. Compressor/Gate:
  2742. @example
  2743. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2744. @end example
  2745. @item
  2746. Expander:
  2747. @example
  2748. 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
  2749. @end example
  2750. @item
  2751. Hard limiter at -6dB:
  2752. @example
  2753. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2754. @end example
  2755. @item
  2756. Hard limiter at -12dB:
  2757. @example
  2758. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2759. @end example
  2760. @item
  2761. Hard noise gate at -35 dB:
  2762. @example
  2763. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2764. @end example
  2765. @item
  2766. Soft limiter:
  2767. @example
  2768. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2769. @end example
  2770. @end itemize
  2771. @section compensationdelay
  2772. Compensation Delay Line is a metric based delay to compensate differing
  2773. positions of microphones or speakers.
  2774. For example, you have recorded guitar with two microphones placed in
  2775. different locations. Because the front of sound wave has fixed speed in
  2776. normal conditions, the phasing of microphones can vary and depends on
  2777. their location and interposition. The best sound mix can be achieved when
  2778. these microphones are in phase (synchronized). Note that a distance of
  2779. ~30 cm between microphones makes one microphone capture the signal in
  2780. antiphase to the other microphone. That makes the final mix sound moody.
  2781. This filter helps to solve phasing problems by adding different delays
  2782. to each microphone track and make them synchronized.
  2783. The best result can be reached when you take one track as base and
  2784. synchronize other tracks one by one with it.
  2785. Remember that synchronization/delay tolerance depends on sample rate, too.
  2786. Higher sample rates will give more tolerance.
  2787. The filter accepts the following parameters:
  2788. @table @option
  2789. @item mm
  2790. Set millimeters distance. This is compensation distance for fine tuning.
  2791. Default is 0.
  2792. @item cm
  2793. Set cm distance. This is compensation distance for tightening distance setup.
  2794. Default is 0.
  2795. @item m
  2796. Set meters distance. This is compensation distance for hard distance setup.
  2797. Default is 0.
  2798. @item dry
  2799. Set dry amount. Amount of unprocessed (dry) signal.
  2800. Default is 0.
  2801. @item wet
  2802. Set wet amount. Amount of processed (wet) signal.
  2803. Default is 1.
  2804. @item temp
  2805. Set temperature in degrees Celsius. This is the temperature of the environment.
  2806. Default is 20.
  2807. @end table
  2808. @section crossfeed
  2809. Apply headphone crossfeed filter.
  2810. Crossfeed is the process of blending the left and right channels of stereo
  2811. audio recording.
  2812. It is mainly used to reduce extreme stereo separation of low frequencies.
  2813. The intent is to produce more speaker like sound to the listener.
  2814. The filter accepts the following options:
  2815. @table @option
  2816. @item strength
  2817. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2818. This sets gain of low shelf filter for side part of stereo image.
  2819. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2820. @item range
  2821. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2822. This sets cut off frequency of low shelf filter. Default is cut off near
  2823. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2824. @item slope
  2825. Set curve slope of low shelf filter. Default is 0.5.
  2826. Allowed range is from 0.01 to 1.
  2827. @item level_in
  2828. Set input gain. Default is 0.9.
  2829. @item level_out
  2830. Set output gain. Default is 1.
  2831. @end table
  2832. @subsection Commands
  2833. This filter supports the all above options as @ref{commands}.
  2834. @section crystalizer
  2835. Simple algorithm for audio noise sharpening.
  2836. This filter linearly increases differences betweeen each audio sample.
  2837. The filter accepts the following options:
  2838. @table @option
  2839. @item i
  2840. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  2841. (unchanged sound) to 10.0 (maximum effect).
  2842. To inverse filtering use negative value.
  2843. @item c
  2844. Enable clipping. By default is enabled.
  2845. @end table
  2846. @subsection Commands
  2847. This filter supports the all above options as @ref{commands}.
  2848. @section dcshift
  2849. Apply a DC shift to the audio.
  2850. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2851. in the recording chain) from the audio. The effect of a DC offset is reduced
  2852. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2853. a signal has a DC offset.
  2854. @table @option
  2855. @item shift
  2856. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2857. the audio.
  2858. @item limitergain
  2859. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2860. used to prevent clipping.
  2861. @end table
  2862. @section deesser
  2863. Apply de-essing to the audio samples.
  2864. @table @option
  2865. @item i
  2866. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2867. Default is 0.
  2868. @item m
  2869. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2870. Default is 0.5.
  2871. @item f
  2872. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2873. Default is 0.5.
  2874. @item s
  2875. Set the output mode.
  2876. It accepts the following values:
  2877. @table @option
  2878. @item i
  2879. Pass input unchanged.
  2880. @item o
  2881. Pass ess filtered out.
  2882. @item e
  2883. Pass only ess.
  2884. Default value is @var{o}.
  2885. @end table
  2886. @end table
  2887. @section drmeter
  2888. Measure audio dynamic range.
  2889. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2890. is found in transition material. And anything less that 8 have very poor dynamics
  2891. and is very compressed.
  2892. The filter accepts the following options:
  2893. @table @option
  2894. @item length
  2895. Set window length in seconds used to split audio into segments of equal length.
  2896. Default is 3 seconds.
  2897. @end table
  2898. @section dynaudnorm
  2899. Dynamic Audio Normalizer.
  2900. This filter applies a certain amount of gain to the input audio in order
  2901. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2902. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2903. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2904. This allows for applying extra gain to the "quiet" sections of the audio
  2905. while avoiding distortions or clipping the "loud" sections. In other words:
  2906. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2907. sections, in the sense that the volume of each section is brought to the
  2908. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2909. this goal *without* applying "dynamic range compressing". It will retain 100%
  2910. of the dynamic range *within* each section of the audio file.
  2911. @table @option
  2912. @item framelen, f
  2913. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2914. Default is 500 milliseconds.
  2915. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2916. referred to as frames. This is required, because a peak magnitude has no
  2917. meaning for just a single sample value. Instead, we need to determine the
  2918. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2919. normalizer would simply use the peak magnitude of the complete file, the
  2920. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2921. frame. The length of a frame is specified in milliseconds. By default, the
  2922. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2923. been found to give good results with most files.
  2924. Note that the exact frame length, in number of samples, will be determined
  2925. automatically, based on the sampling rate of the individual input audio file.
  2926. @item gausssize, g
  2927. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2928. number. Default is 31.
  2929. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2930. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2931. is specified in frames, centered around the current frame. For the sake of
  2932. simplicity, this must be an odd number. Consequently, the default value of 31
  2933. takes into account the current frame, as well as the 15 preceding frames and
  2934. the 15 subsequent frames. Using a larger window results in a stronger
  2935. smoothing effect and thus in less gain variation, i.e. slower gain
  2936. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2937. effect and thus in more gain variation, i.e. faster gain adaptation.
  2938. In other words, the more you increase this value, the more the Dynamic Audio
  2939. Normalizer will behave like a "traditional" normalization filter. On the
  2940. contrary, the more you decrease this value, the more the Dynamic Audio
  2941. Normalizer will behave like a dynamic range compressor.
  2942. @item peak, p
  2943. Set the target peak value. This specifies the highest permissible magnitude
  2944. level for the normalized audio input. This filter will try to approach the
  2945. target peak magnitude as closely as possible, but at the same time it also
  2946. makes sure that the normalized signal will never exceed the peak magnitude.
  2947. A frame's maximum local gain factor is imposed directly by the target peak
  2948. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2949. It is not recommended to go above this value.
  2950. @item maxgain, m
  2951. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2952. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2953. factor for each input frame, i.e. the maximum gain factor that does not
  2954. result in clipping or distortion. The maximum gain factor is determined by
  2955. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2956. additionally bounds the frame's maximum gain factor by a predetermined
  2957. (global) maximum gain factor. This is done in order to avoid excessive gain
  2958. factors in "silent" or almost silent frames. By default, the maximum gain
  2959. factor is 10.0, For most inputs the default value should be sufficient and
  2960. it usually is not recommended to increase this value. Though, for input
  2961. with an extremely low overall volume level, it may be necessary to allow even
  2962. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2963. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2964. Instead, a "sigmoid" threshold function will be applied. This way, the
  2965. gain factors will smoothly approach the threshold value, but never exceed that
  2966. value.
  2967. @item targetrms, r
  2968. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2969. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2970. This means that the maximum local gain factor for each frame is defined
  2971. (only) by the frame's highest magnitude sample. This way, the samples can
  2972. be amplified as much as possible without exceeding the maximum signal
  2973. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2974. Normalizer can also take into account the frame's root mean square,
  2975. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2976. determine the power of a time-varying signal. It is therefore considered
  2977. that the RMS is a better approximation of the "perceived loudness" than
  2978. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2979. frames to a constant RMS value, a uniform "perceived loudness" can be
  2980. established. If a target RMS value has been specified, a frame's local gain
  2981. factor is defined as the factor that would result in exactly that RMS value.
  2982. Note, however, that the maximum local gain factor is still restricted by the
  2983. frame's highest magnitude sample, in order to prevent clipping.
  2984. @item coupling, n
  2985. Enable channels coupling. By default is enabled.
  2986. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2987. amount. This means the same gain factor will be applied to all channels, i.e.
  2988. the maximum possible gain factor is determined by the "loudest" channel.
  2989. However, in some recordings, it may happen that the volume of the different
  2990. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2991. In this case, this option can be used to disable the channel coupling. This way,
  2992. the gain factor will be determined independently for each channel, depending
  2993. only on the individual channel's highest magnitude sample. This allows for
  2994. harmonizing the volume of the different channels.
  2995. @item correctdc, c
  2996. Enable DC bias correction. By default is disabled.
  2997. An audio signal (in the time domain) is a sequence of sample values.
  2998. In the Dynamic Audio Normalizer these sample values are represented in the
  2999. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3000. audio signal, or "waveform", should be centered around the zero point.
  3001. That means if we calculate the mean value of all samples in a file, or in a
  3002. single frame, then the result should be 0.0 or at least very close to that
  3003. value. If, however, there is a significant deviation of the mean value from
  3004. 0.0, in either positive or negative direction, this is referred to as a
  3005. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3006. Audio Normalizer provides optional DC bias correction.
  3007. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3008. the mean value, or "DC correction" offset, of each input frame and subtract
  3009. that value from all of the frame's sample values which ensures those samples
  3010. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3011. boundaries, the DC correction offset values will be interpolated smoothly
  3012. between neighbouring frames.
  3013. @item altboundary, b
  3014. Enable alternative boundary mode. By default is disabled.
  3015. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3016. around each frame. This includes the preceding frames as well as the
  3017. subsequent frames. However, for the "boundary" frames, located at the very
  3018. beginning and at the very end of the audio file, not all neighbouring
  3019. frames are available. In particular, for the first few frames in the audio
  3020. file, the preceding frames are not known. And, similarly, for the last few
  3021. frames in the audio file, the subsequent frames are not known. Thus, the
  3022. question arises which gain factors should be assumed for the missing frames
  3023. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3024. to deal with this situation. The default boundary mode assumes a gain factor
  3025. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3026. "fade out" at the beginning and at the end of the input, respectively.
  3027. @item compress, s
  3028. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3029. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3030. compression. This means that signal peaks will not be pruned and thus the
  3031. full dynamic range will be retained within each local neighbourhood. However,
  3032. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3033. normalization algorithm with a more "traditional" compression.
  3034. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3035. (thresholding) function. If (and only if) the compression feature is enabled,
  3036. all input frames will be processed by a soft knee thresholding function prior
  3037. to the actual normalization process. Put simply, the thresholding function is
  3038. going to prune all samples whose magnitude exceeds a certain threshold value.
  3039. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3040. value. Instead, the threshold value will be adjusted for each individual
  3041. frame.
  3042. In general, smaller parameters result in stronger compression, and vice versa.
  3043. Values below 3.0 are not recommended, because audible distortion may appear.
  3044. @item threshold, t
  3045. Set the target threshold value. This specifies the lowest permissible
  3046. magnitude level for the audio input which will be normalized.
  3047. If input frame volume is above this value frame will be normalized.
  3048. Otherwise frame may not be normalized at all. The default value is set
  3049. to 0, which means all input frames will be normalized.
  3050. This option is mostly useful if digital noise is not wanted to be amplified.
  3051. @end table
  3052. @subsection Commands
  3053. This filter supports the all above options as @ref{commands}.
  3054. @section earwax
  3055. Make audio easier to listen to on headphones.
  3056. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3057. so that when listened to on headphones the stereo image is moved from
  3058. inside your head (standard for headphones) to outside and in front of
  3059. the listener (standard for speakers).
  3060. Ported from SoX.
  3061. @section equalizer
  3062. Apply a two-pole peaking equalisation (EQ) filter. With this
  3063. filter, the signal-level at and around a selected frequency can
  3064. be increased or decreased, whilst (unlike bandpass and bandreject
  3065. filters) that at all other frequencies is unchanged.
  3066. In order to produce complex equalisation curves, this filter can
  3067. be given several times, each with a different central frequency.
  3068. The filter accepts the following options:
  3069. @table @option
  3070. @item frequency, f
  3071. Set the filter's central frequency in Hz.
  3072. @item width_type, t
  3073. Set method to specify band-width of filter.
  3074. @table @option
  3075. @item h
  3076. Hz
  3077. @item q
  3078. Q-Factor
  3079. @item o
  3080. octave
  3081. @item s
  3082. slope
  3083. @item k
  3084. kHz
  3085. @end table
  3086. @item width, w
  3087. Specify the band-width of a filter in width_type units.
  3088. @item gain, g
  3089. Set the required gain or attenuation in dB.
  3090. Beware of clipping when using a positive gain.
  3091. @item mix, m
  3092. How much to use filtered signal in output. Default is 1.
  3093. Range is between 0 and 1.
  3094. @item channels, c
  3095. Specify which channels to filter, by default all available are filtered.
  3096. @item normalize, n
  3097. Normalize biquad coefficients, by default is disabled.
  3098. Enabling it will normalize magnitude response at DC to 0dB.
  3099. @item transform, a
  3100. Set transform type of IIR filter.
  3101. @table @option
  3102. @item di
  3103. @item dii
  3104. @item tdii
  3105. @item latt
  3106. @end table
  3107. @item precision, r
  3108. Set precison of filtering.
  3109. @table @option
  3110. @item auto
  3111. Pick automatic sample format depending on surround filters.
  3112. @item s16
  3113. Always use signed 16-bit.
  3114. @item s32
  3115. Always use signed 32-bit.
  3116. @item f32
  3117. Always use float 32-bit.
  3118. @item f64
  3119. Always use float 64-bit.
  3120. @end table
  3121. @end table
  3122. @subsection Examples
  3123. @itemize
  3124. @item
  3125. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3126. @example
  3127. equalizer=f=1000:t=h:width=200:g=-10
  3128. @end example
  3129. @item
  3130. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3131. @example
  3132. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3133. @end example
  3134. @end itemize
  3135. @subsection Commands
  3136. This filter supports the following commands:
  3137. @table @option
  3138. @item frequency, f
  3139. Change equalizer frequency.
  3140. Syntax for the command is : "@var{frequency}"
  3141. @item width_type, t
  3142. Change equalizer width_type.
  3143. Syntax for the command is : "@var{width_type}"
  3144. @item width, w
  3145. Change equalizer width.
  3146. Syntax for the command is : "@var{width}"
  3147. @item gain, g
  3148. Change equalizer gain.
  3149. Syntax for the command is : "@var{gain}"
  3150. @item mix, m
  3151. Change equalizer mix.
  3152. Syntax for the command is : "@var{mix}"
  3153. @end table
  3154. @section extrastereo
  3155. Linearly increases the difference between left and right channels which
  3156. adds some sort of "live" effect to playback.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item m
  3160. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3161. (average of both channels), with 1.0 sound will be unchanged, with
  3162. -1.0 left and right channels will be swapped.
  3163. @item c
  3164. Enable clipping. By default is enabled.
  3165. @end table
  3166. @subsection Commands
  3167. This filter supports the all above options as @ref{commands}.
  3168. @section firequalizer
  3169. Apply FIR Equalization using arbitrary frequency response.
  3170. The filter accepts the following option:
  3171. @table @option
  3172. @item gain
  3173. Set gain curve equation (in dB). The expression can contain variables:
  3174. @table @option
  3175. @item f
  3176. the evaluated frequency
  3177. @item sr
  3178. sample rate
  3179. @item ch
  3180. channel number, set to 0 when multichannels evaluation is disabled
  3181. @item chid
  3182. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3183. multichannels evaluation is disabled
  3184. @item chs
  3185. number of channels
  3186. @item chlayout
  3187. channel_layout, see libavutil/channel_layout.h
  3188. @end table
  3189. and functions:
  3190. @table @option
  3191. @item gain_interpolate(f)
  3192. interpolate gain on frequency f based on gain_entry
  3193. @item cubic_interpolate(f)
  3194. same as gain_interpolate, but smoother
  3195. @end table
  3196. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3197. @item gain_entry
  3198. Set gain entry for gain_interpolate function. The expression can
  3199. contain functions:
  3200. @table @option
  3201. @item entry(f, g)
  3202. store gain entry at frequency f with value g
  3203. @end table
  3204. This option is also available as command.
  3205. @item delay
  3206. Set filter delay in seconds. Higher value means more accurate.
  3207. Default is @code{0.01}.
  3208. @item accuracy
  3209. Set filter accuracy in Hz. Lower value means more accurate.
  3210. Default is @code{5}.
  3211. @item wfunc
  3212. Set window function. Acceptable values are:
  3213. @table @option
  3214. @item rectangular
  3215. rectangular window, useful when gain curve is already smooth
  3216. @item hann
  3217. hann window (default)
  3218. @item hamming
  3219. hamming window
  3220. @item blackman
  3221. blackman window
  3222. @item nuttall3
  3223. 3-terms continuous 1st derivative nuttall window
  3224. @item mnuttall3
  3225. minimum 3-terms discontinuous nuttall window
  3226. @item nuttall
  3227. 4-terms continuous 1st derivative nuttall window
  3228. @item bnuttall
  3229. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3230. @item bharris
  3231. blackman-harris window
  3232. @item tukey
  3233. tukey window
  3234. @end table
  3235. @item fixed
  3236. If enabled, use fixed number of audio samples. This improves speed when
  3237. filtering with large delay. Default is disabled.
  3238. @item multi
  3239. Enable multichannels evaluation on gain. Default is disabled.
  3240. @item zero_phase
  3241. Enable zero phase mode by subtracting timestamp to compensate delay.
  3242. Default is disabled.
  3243. @item scale
  3244. Set scale used by gain. Acceptable values are:
  3245. @table @option
  3246. @item linlin
  3247. linear frequency, linear gain
  3248. @item linlog
  3249. linear frequency, logarithmic (in dB) gain (default)
  3250. @item loglin
  3251. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3252. @item loglog
  3253. logarithmic frequency, logarithmic gain
  3254. @end table
  3255. @item dumpfile
  3256. Set file for dumping, suitable for gnuplot.
  3257. @item dumpscale
  3258. Set scale for dumpfile. Acceptable values are same with scale option.
  3259. Default is linlog.
  3260. @item fft2
  3261. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3262. Default is disabled.
  3263. @item min_phase
  3264. Enable minimum phase impulse response. Default is disabled.
  3265. @end table
  3266. @subsection Examples
  3267. @itemize
  3268. @item
  3269. lowpass at 1000 Hz:
  3270. @example
  3271. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3272. @end example
  3273. @item
  3274. lowpass at 1000 Hz with gain_entry:
  3275. @example
  3276. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3277. @end example
  3278. @item
  3279. custom equalization:
  3280. @example
  3281. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3282. @end example
  3283. @item
  3284. higher delay with zero phase to compensate delay:
  3285. @example
  3286. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3287. @end example
  3288. @item
  3289. lowpass on left channel, highpass on right channel:
  3290. @example
  3291. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3292. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3293. @end example
  3294. @end itemize
  3295. @section flanger
  3296. Apply a flanging effect to the audio.
  3297. The filter accepts the following options:
  3298. @table @option
  3299. @item delay
  3300. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3301. @item depth
  3302. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3303. @item regen
  3304. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3305. Default value is 0.
  3306. @item width
  3307. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3308. Default value is 71.
  3309. @item speed
  3310. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3311. @item shape
  3312. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3313. Default value is @var{sinusoidal}.
  3314. @item phase
  3315. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3316. Default value is 25.
  3317. @item interp
  3318. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3319. Default is @var{linear}.
  3320. @end table
  3321. @section haas
  3322. Apply Haas effect to audio.
  3323. Note that this makes most sense to apply on mono signals.
  3324. With this filter applied to mono signals it give some directionality and
  3325. stretches its stereo image.
  3326. The filter accepts the following options:
  3327. @table @option
  3328. @item level_in
  3329. Set input level. By default is @var{1}, or 0dB
  3330. @item level_out
  3331. Set output level. By default is @var{1}, or 0dB.
  3332. @item side_gain
  3333. Set gain applied to side part of signal. By default is @var{1}.
  3334. @item middle_source
  3335. Set kind of middle source. Can be one of the following:
  3336. @table @samp
  3337. @item left
  3338. Pick left channel.
  3339. @item right
  3340. Pick right channel.
  3341. @item mid
  3342. Pick middle part signal of stereo image.
  3343. @item side
  3344. Pick side part signal of stereo image.
  3345. @end table
  3346. @item middle_phase
  3347. Change middle phase. By default is disabled.
  3348. @item left_delay
  3349. Set left channel delay. By default is @var{2.05} milliseconds.
  3350. @item left_balance
  3351. Set left channel balance. By default is @var{-1}.
  3352. @item left_gain
  3353. Set left channel gain. By default is @var{1}.
  3354. @item left_phase
  3355. Change left phase. By default is disabled.
  3356. @item right_delay
  3357. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3358. @item right_balance
  3359. Set right channel balance. By default is @var{1}.
  3360. @item right_gain
  3361. Set right channel gain. By default is @var{1}.
  3362. @item right_phase
  3363. Change right phase. By default is enabled.
  3364. @end table
  3365. @section hdcd
  3366. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3367. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3368. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3369. of HDCD, and detects the Transient Filter flag.
  3370. @example
  3371. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3372. @end example
  3373. When using the filter with wav, note the default encoding for wav is 16-bit,
  3374. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3375. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3376. @example
  3377. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3378. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3379. @end example
  3380. The filter accepts the following options:
  3381. @table @option
  3382. @item disable_autoconvert
  3383. Disable any automatic format conversion or resampling in the filter graph.
  3384. @item process_stereo
  3385. Process the stereo channels together. If target_gain does not match between
  3386. channels, consider it invalid and use the last valid target_gain.
  3387. @item cdt_ms
  3388. Set the code detect timer period in ms.
  3389. @item force_pe
  3390. Always extend peaks above -3dBFS even if PE isn't signaled.
  3391. @item analyze_mode
  3392. Replace audio with a solid tone and adjust the amplitude to signal some
  3393. specific aspect of the decoding process. The output file can be loaded in
  3394. an audio editor alongside the original to aid analysis.
  3395. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3396. Modes are:
  3397. @table @samp
  3398. @item 0, off
  3399. Disabled
  3400. @item 1, lle
  3401. Gain adjustment level at each sample
  3402. @item 2, pe
  3403. Samples where peak extend occurs
  3404. @item 3, cdt
  3405. Samples where the code detect timer is active
  3406. @item 4, tgm
  3407. Samples where the target gain does not match between channels
  3408. @end table
  3409. @end table
  3410. @section headphone
  3411. Apply head-related transfer functions (HRTFs) to create virtual
  3412. loudspeakers around the user for binaural listening via headphones.
  3413. The HRIRs are provided via additional streams, for each channel
  3414. one stereo input stream is needed.
  3415. The filter accepts the following options:
  3416. @table @option
  3417. @item map
  3418. Set mapping of input streams for convolution.
  3419. The argument is a '|'-separated list of channel names in order as they
  3420. are given as additional stream inputs for filter.
  3421. This also specify number of input streams. Number of input streams
  3422. must be not less than number of channels in first stream plus one.
  3423. @item gain
  3424. Set gain applied to audio. Value is in dB. Default is 0.
  3425. @item type
  3426. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3427. processing audio in time domain which is slow.
  3428. @var{freq} is processing audio in frequency domain which is fast.
  3429. Default is @var{freq}.
  3430. @item lfe
  3431. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3432. @item size
  3433. Set size of frame in number of samples which will be processed at once.
  3434. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3435. @item hrir
  3436. Set format of hrir stream.
  3437. Default value is @var{stereo}. Alternative value is @var{multich}.
  3438. If value is set to @var{stereo}, number of additional streams should
  3439. be greater or equal to number of input channels in first input stream.
  3440. Also each additional stream should have stereo number of channels.
  3441. If value is set to @var{multich}, number of additional streams should
  3442. be exactly one. Also number of input channels of additional stream
  3443. should be equal or greater than twice number of channels of first input
  3444. stream.
  3445. @end table
  3446. @subsection Examples
  3447. @itemize
  3448. @item
  3449. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3450. each amovie filter use stereo file with IR coefficients as input.
  3451. The files give coefficients for each position of virtual loudspeaker:
  3452. @example
  3453. ffmpeg -i input.wav
  3454. -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"
  3455. output.wav
  3456. @end example
  3457. @item
  3458. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3459. but now in @var{multich} @var{hrir} format.
  3460. @example
  3461. 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"
  3462. output.wav
  3463. @end example
  3464. @end itemize
  3465. @section highpass
  3466. Apply a high-pass filter with 3dB point frequency.
  3467. The filter can be either single-pole, or double-pole (the default).
  3468. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3469. The filter accepts the following options:
  3470. @table @option
  3471. @item frequency, f
  3472. Set frequency in Hz. Default is 3000.
  3473. @item poles, p
  3474. Set number of poles. Default is 2.
  3475. @item width_type, t
  3476. Set method to specify band-width of filter.
  3477. @table @option
  3478. @item h
  3479. Hz
  3480. @item q
  3481. Q-Factor
  3482. @item o
  3483. octave
  3484. @item s
  3485. slope
  3486. @item k
  3487. kHz
  3488. @end table
  3489. @item width, w
  3490. Specify the band-width of a filter in width_type units.
  3491. Applies only to double-pole filter.
  3492. The default is 0.707q and gives a Butterworth response.
  3493. @item mix, m
  3494. How much to use filtered signal in output. Default is 1.
  3495. Range is between 0 and 1.
  3496. @item channels, c
  3497. Specify which channels to filter, by default all available are filtered.
  3498. @item normalize, n
  3499. Normalize biquad coefficients, by default is disabled.
  3500. Enabling it will normalize magnitude response at DC to 0dB.
  3501. @item transform, a
  3502. Set transform type of IIR filter.
  3503. @table @option
  3504. @item di
  3505. @item dii
  3506. @item tdii
  3507. @item latt
  3508. @end table
  3509. @item precision, r
  3510. Set precison of filtering.
  3511. @table @option
  3512. @item auto
  3513. Pick automatic sample format depending on surround filters.
  3514. @item s16
  3515. Always use signed 16-bit.
  3516. @item s32
  3517. Always use signed 32-bit.
  3518. @item f32
  3519. Always use float 32-bit.
  3520. @item f64
  3521. Always use float 64-bit.
  3522. @end table
  3523. @end table
  3524. @subsection Commands
  3525. This filter supports the following commands:
  3526. @table @option
  3527. @item frequency, f
  3528. Change highpass frequency.
  3529. Syntax for the command is : "@var{frequency}"
  3530. @item width_type, t
  3531. Change highpass width_type.
  3532. Syntax for the command is : "@var{width_type}"
  3533. @item width, w
  3534. Change highpass width.
  3535. Syntax for the command is : "@var{width}"
  3536. @item mix, m
  3537. Change highpass mix.
  3538. Syntax for the command is : "@var{mix}"
  3539. @end table
  3540. @section join
  3541. Join multiple input streams into one multi-channel stream.
  3542. It accepts the following parameters:
  3543. @table @option
  3544. @item inputs
  3545. The number of input streams. It defaults to 2.
  3546. @item channel_layout
  3547. The desired output channel layout. It defaults to stereo.
  3548. @item map
  3549. Map channels from inputs to output. The argument is a '|'-separated list of
  3550. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3551. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3552. can be either the name of the input channel (e.g. FL for front left) or its
  3553. index in the specified input stream. @var{out_channel} is the name of the output
  3554. channel.
  3555. @end table
  3556. The filter will attempt to guess the mappings when they are not specified
  3557. explicitly. It does so by first trying to find an unused matching input channel
  3558. and if that fails it picks the first unused input channel.
  3559. Join 3 inputs (with properly set channel layouts):
  3560. @example
  3561. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3562. @end example
  3563. Build a 5.1 output from 6 single-channel streams:
  3564. @example
  3565. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3566. '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'
  3567. out
  3568. @end example
  3569. @section ladspa
  3570. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3571. To enable compilation of this filter you need to configure FFmpeg with
  3572. @code{--enable-ladspa}.
  3573. @table @option
  3574. @item file, f
  3575. Specifies the name of LADSPA plugin library to load. If the environment
  3576. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3577. each one of the directories specified by the colon separated list in
  3578. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3579. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3580. @file{/usr/lib/ladspa/}.
  3581. @item plugin, p
  3582. Specifies the plugin within the library. Some libraries contain only
  3583. one plugin, but others contain many of them. If this is not set filter
  3584. will list all available plugins within the specified library.
  3585. @item controls, c
  3586. Set the '|' separated list of controls which are zero or more floating point
  3587. values that determine the behavior of the loaded plugin (for example delay,
  3588. threshold or gain).
  3589. Controls need to be defined using the following syntax:
  3590. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3591. @var{valuei} is the value set on the @var{i}-th control.
  3592. Alternatively they can be also defined using the following syntax:
  3593. @var{value0}|@var{value1}|@var{value2}|..., where
  3594. @var{valuei} is the value set on the @var{i}-th control.
  3595. If @option{controls} is set to @code{help}, all available controls and
  3596. their valid ranges are printed.
  3597. @item sample_rate, s
  3598. Specify the sample rate, default to 44100. Only used if plugin have
  3599. zero inputs.
  3600. @item nb_samples, n
  3601. Set the number of samples per channel per each output frame, default
  3602. is 1024. Only used if plugin have zero inputs.
  3603. @item duration, d
  3604. Set the minimum duration of the sourced audio. See
  3605. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3606. for the accepted syntax.
  3607. Note that the resulting duration may be greater than the specified duration,
  3608. as the generated audio is always cut at the end of a complete frame.
  3609. If not specified, or the expressed duration is negative, the audio is
  3610. supposed to be generated forever.
  3611. Only used if plugin have zero inputs.
  3612. @item latency, l
  3613. Enable latency compensation, by default is disabled.
  3614. Only used if plugin have inputs.
  3615. @end table
  3616. @subsection Examples
  3617. @itemize
  3618. @item
  3619. List all available plugins within amp (LADSPA example plugin) library:
  3620. @example
  3621. ladspa=file=amp
  3622. @end example
  3623. @item
  3624. List all available controls and their valid ranges for @code{vcf_notch}
  3625. plugin from @code{VCF} library:
  3626. @example
  3627. ladspa=f=vcf:p=vcf_notch:c=help
  3628. @end example
  3629. @item
  3630. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3631. plugin library:
  3632. @example
  3633. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3634. @end example
  3635. @item
  3636. Add reverberation to the audio using TAP-plugins
  3637. (Tom's Audio Processing plugins):
  3638. @example
  3639. ladspa=file=tap_reverb:tap_reverb
  3640. @end example
  3641. @item
  3642. Generate white noise, with 0.2 amplitude:
  3643. @example
  3644. ladspa=file=cmt:noise_source_white:c=c0=.2
  3645. @end example
  3646. @item
  3647. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3648. @code{C* Audio Plugin Suite} (CAPS) library:
  3649. @example
  3650. ladspa=file=caps:Click:c=c1=20'
  3651. @end example
  3652. @item
  3653. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3654. @example
  3655. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3656. @end example
  3657. @item
  3658. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3659. @code{SWH Plugins} collection:
  3660. @example
  3661. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3662. @end example
  3663. @item
  3664. Attenuate low frequencies using Multiband EQ from Steve Harris
  3665. @code{SWH Plugins} collection:
  3666. @example
  3667. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3668. @end example
  3669. @item
  3670. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3671. (CAPS) library:
  3672. @example
  3673. ladspa=caps:Narrower
  3674. @end example
  3675. @item
  3676. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3677. @example
  3678. ladspa=caps:White:.2
  3679. @end example
  3680. @item
  3681. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3682. @example
  3683. ladspa=caps:Fractal:c=c1=1
  3684. @end example
  3685. @item
  3686. Dynamic volume normalization using @code{VLevel} plugin:
  3687. @example
  3688. ladspa=vlevel-ladspa:vlevel_mono
  3689. @end example
  3690. @end itemize
  3691. @subsection Commands
  3692. This filter supports the following commands:
  3693. @table @option
  3694. @item cN
  3695. Modify the @var{N}-th control value.
  3696. If the specified value is not valid, it is ignored and prior one is kept.
  3697. @end table
  3698. @section loudnorm
  3699. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3700. Support for both single pass (livestreams, files) and double pass (files) modes.
  3701. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3702. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3703. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3704. The filter accepts the following options:
  3705. @table @option
  3706. @item I, i
  3707. Set integrated loudness target.
  3708. Range is -70.0 - -5.0. Default value is -24.0.
  3709. @item LRA, lra
  3710. Set loudness range target.
  3711. Range is 1.0 - 20.0. Default value is 7.0.
  3712. @item TP, tp
  3713. Set maximum true peak.
  3714. Range is -9.0 - +0.0. Default value is -2.0.
  3715. @item measured_I, measured_i
  3716. Measured IL of input file.
  3717. Range is -99.0 - +0.0.
  3718. @item measured_LRA, measured_lra
  3719. Measured LRA of input file.
  3720. Range is 0.0 - 99.0.
  3721. @item measured_TP, measured_tp
  3722. Measured true peak of input file.
  3723. Range is -99.0 - +99.0.
  3724. @item measured_thresh
  3725. Measured threshold of input file.
  3726. Range is -99.0 - +0.0.
  3727. @item offset
  3728. Set offset gain. Gain is applied before the true-peak limiter.
  3729. Range is -99.0 - +99.0. Default is +0.0.
  3730. @item linear
  3731. Normalize by linearly scaling the source audio.
  3732. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3733. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3734. be lower than source LRA and the change in integrated loudness shouldn't
  3735. result in a true peak which exceeds the target TP. If any of these
  3736. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3737. Options are @code{true} or @code{false}. Default is @code{true}.
  3738. @item dual_mono
  3739. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3740. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3741. If set to @code{true}, this option will compensate for this effect.
  3742. Multi-channel input files are not affected by this option.
  3743. Options are true or false. Default is false.
  3744. @item print_format
  3745. Set print format for stats. Options are summary, json, or none.
  3746. Default value is none.
  3747. @end table
  3748. @section lowpass
  3749. Apply a low-pass filter with 3dB point frequency.
  3750. The filter can be either single-pole or double-pole (the default).
  3751. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3752. The filter accepts the following options:
  3753. @table @option
  3754. @item frequency, f
  3755. Set frequency in Hz. Default is 500.
  3756. @item poles, p
  3757. Set number of poles. Default is 2.
  3758. @item width_type, t
  3759. Set method to specify band-width of filter.
  3760. @table @option
  3761. @item h
  3762. Hz
  3763. @item q
  3764. Q-Factor
  3765. @item o
  3766. octave
  3767. @item s
  3768. slope
  3769. @item k
  3770. kHz
  3771. @end table
  3772. @item width, w
  3773. Specify the band-width of a filter in width_type units.
  3774. Applies only to double-pole filter.
  3775. The default is 0.707q and gives a Butterworth response.
  3776. @item mix, m
  3777. How much to use filtered signal in output. Default is 1.
  3778. Range is between 0 and 1.
  3779. @item channels, c
  3780. Specify which channels to filter, by default all available are filtered.
  3781. @item normalize, n
  3782. Normalize biquad coefficients, by default is disabled.
  3783. Enabling it will normalize magnitude response at DC to 0dB.
  3784. @item transform, a
  3785. Set transform type of IIR filter.
  3786. @table @option
  3787. @item di
  3788. @item dii
  3789. @item tdii
  3790. @item latt
  3791. @end table
  3792. @item precision, r
  3793. Set precison of filtering.
  3794. @table @option
  3795. @item auto
  3796. Pick automatic sample format depending on surround filters.
  3797. @item s16
  3798. Always use signed 16-bit.
  3799. @item s32
  3800. Always use signed 32-bit.
  3801. @item f32
  3802. Always use float 32-bit.
  3803. @item f64
  3804. Always use float 64-bit.
  3805. @end table
  3806. @end table
  3807. @subsection Examples
  3808. @itemize
  3809. @item
  3810. Lowpass only LFE channel, it LFE is not present it does nothing:
  3811. @example
  3812. lowpass=c=LFE
  3813. @end example
  3814. @end itemize
  3815. @subsection Commands
  3816. This filter supports the following commands:
  3817. @table @option
  3818. @item frequency, f
  3819. Change lowpass frequency.
  3820. Syntax for the command is : "@var{frequency}"
  3821. @item width_type, t
  3822. Change lowpass width_type.
  3823. Syntax for the command is : "@var{width_type}"
  3824. @item width, w
  3825. Change lowpass width.
  3826. Syntax for the command is : "@var{width}"
  3827. @item mix, m
  3828. Change lowpass mix.
  3829. Syntax for the command is : "@var{mix}"
  3830. @end table
  3831. @section lv2
  3832. Load a LV2 (LADSPA Version 2) plugin.
  3833. To enable compilation of this filter you need to configure FFmpeg with
  3834. @code{--enable-lv2}.
  3835. @table @option
  3836. @item plugin, p
  3837. Specifies the plugin URI. You may need to escape ':'.
  3838. @item controls, c
  3839. Set the '|' separated list of controls which are zero or more floating point
  3840. values that determine the behavior of the loaded plugin (for example delay,
  3841. threshold or gain).
  3842. If @option{controls} is set to @code{help}, all available controls and
  3843. their valid ranges are printed.
  3844. @item sample_rate, s
  3845. Specify the sample rate, default to 44100. Only used if plugin have
  3846. zero inputs.
  3847. @item nb_samples, n
  3848. Set the number of samples per channel per each output frame, default
  3849. is 1024. Only used if plugin have zero inputs.
  3850. @item duration, d
  3851. Set the minimum duration of the sourced audio. See
  3852. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3853. for the accepted syntax.
  3854. Note that the resulting duration may be greater than the specified duration,
  3855. as the generated audio is always cut at the end of a complete frame.
  3856. If not specified, or the expressed duration is negative, the audio is
  3857. supposed to be generated forever.
  3858. Only used if plugin have zero inputs.
  3859. @end table
  3860. @subsection Examples
  3861. @itemize
  3862. @item
  3863. Apply bass enhancer plugin from Calf:
  3864. @example
  3865. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3866. @end example
  3867. @item
  3868. Apply vinyl plugin from Calf:
  3869. @example
  3870. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3871. @end example
  3872. @item
  3873. Apply bit crusher plugin from ArtyFX:
  3874. @example
  3875. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3876. @end example
  3877. @end itemize
  3878. @section mcompand
  3879. Multiband Compress or expand the audio's dynamic range.
  3880. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3881. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3882. response when absent compander action.
  3883. It accepts the following parameters:
  3884. @table @option
  3885. @item args
  3886. This option syntax is:
  3887. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3888. For explanation of each item refer to compand filter documentation.
  3889. @end table
  3890. @anchor{pan}
  3891. @section pan
  3892. Mix channels with specific gain levels. The filter accepts the output
  3893. channel layout followed by a set of channels definitions.
  3894. This filter is also designed to efficiently remap the channels of an audio
  3895. stream.
  3896. The filter accepts parameters of the form:
  3897. "@var{l}|@var{outdef}|@var{outdef}|..."
  3898. @table @option
  3899. @item l
  3900. output channel layout or number of channels
  3901. @item outdef
  3902. output channel specification, of the form:
  3903. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3904. @item out_name
  3905. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3906. number (c0, c1, etc.)
  3907. @item gain
  3908. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3909. @item in_name
  3910. input channel to use, see out_name for details; it is not possible to mix
  3911. named and numbered input channels
  3912. @end table
  3913. If the `=' in a channel specification is replaced by `<', then the gains for
  3914. that specification will be renormalized so that the total is 1, thus
  3915. avoiding clipping noise.
  3916. @subsection Mixing examples
  3917. For example, if you want to down-mix from stereo to mono, but with a bigger
  3918. factor for the left channel:
  3919. @example
  3920. pan=1c|c0=0.9*c0+0.1*c1
  3921. @end example
  3922. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3923. 7-channels surround:
  3924. @example
  3925. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3926. @end example
  3927. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3928. that should be preferred (see "-ac" option) unless you have very specific
  3929. needs.
  3930. @subsection Remapping examples
  3931. The channel remapping will be effective if, and only if:
  3932. @itemize
  3933. @item gain coefficients are zeroes or ones,
  3934. @item only one input per channel output,
  3935. @end itemize
  3936. If all these conditions are satisfied, the filter will notify the user ("Pure
  3937. channel mapping detected"), and use an optimized and lossless method to do the
  3938. remapping.
  3939. For example, if you have a 5.1 source and want a stereo audio stream by
  3940. dropping the extra channels:
  3941. @example
  3942. pan="stereo| c0=FL | c1=FR"
  3943. @end example
  3944. Given the same source, you can also switch front left and front right channels
  3945. and keep the input channel layout:
  3946. @example
  3947. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3948. @end example
  3949. If the input is a stereo audio stream, you can mute the front left channel (and
  3950. still keep the stereo channel layout) with:
  3951. @example
  3952. pan="stereo|c1=c1"
  3953. @end example
  3954. Still with a stereo audio stream input, you can copy the right channel in both
  3955. front left and right:
  3956. @example
  3957. pan="stereo| c0=FR | c1=FR"
  3958. @end example
  3959. @section replaygain
  3960. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3961. outputs it unchanged.
  3962. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3963. @section resample
  3964. Convert the audio sample format, sample rate and channel layout. It is
  3965. not meant to be used directly.
  3966. @section rubberband
  3967. Apply time-stretching and pitch-shifting with librubberband.
  3968. To enable compilation of this filter, you need to configure FFmpeg with
  3969. @code{--enable-librubberband}.
  3970. The filter accepts the following options:
  3971. @table @option
  3972. @item tempo
  3973. Set tempo scale factor.
  3974. @item pitch
  3975. Set pitch scale factor.
  3976. @item transients
  3977. Set transients detector.
  3978. Possible values are:
  3979. @table @var
  3980. @item crisp
  3981. @item mixed
  3982. @item smooth
  3983. @end table
  3984. @item detector
  3985. Set detector.
  3986. Possible values are:
  3987. @table @var
  3988. @item compound
  3989. @item percussive
  3990. @item soft
  3991. @end table
  3992. @item phase
  3993. Set phase.
  3994. Possible values are:
  3995. @table @var
  3996. @item laminar
  3997. @item independent
  3998. @end table
  3999. @item window
  4000. Set processing window size.
  4001. Possible values are:
  4002. @table @var
  4003. @item standard
  4004. @item short
  4005. @item long
  4006. @end table
  4007. @item smoothing
  4008. Set smoothing.
  4009. Possible values are:
  4010. @table @var
  4011. @item off
  4012. @item on
  4013. @end table
  4014. @item formant
  4015. Enable formant preservation when shift pitching.
  4016. Possible values are:
  4017. @table @var
  4018. @item shifted
  4019. @item preserved
  4020. @end table
  4021. @item pitchq
  4022. Set pitch quality.
  4023. Possible values are:
  4024. @table @var
  4025. @item quality
  4026. @item speed
  4027. @item consistency
  4028. @end table
  4029. @item channels
  4030. Set channels.
  4031. Possible values are:
  4032. @table @var
  4033. @item apart
  4034. @item together
  4035. @end table
  4036. @end table
  4037. @subsection Commands
  4038. This filter supports the following commands:
  4039. @table @option
  4040. @item tempo
  4041. Change filter tempo scale factor.
  4042. Syntax for the command is : "@var{tempo}"
  4043. @item pitch
  4044. Change filter pitch scale factor.
  4045. Syntax for the command is : "@var{pitch}"
  4046. @end table
  4047. @section sidechaincompress
  4048. This filter acts like normal compressor but has the ability to compress
  4049. detected signal using second input signal.
  4050. It needs two input streams and returns one output stream.
  4051. First input stream will be processed depending on second stream signal.
  4052. The filtered signal then can be filtered with other filters in later stages of
  4053. processing. See @ref{pan} and @ref{amerge} filter.
  4054. The filter accepts the following options:
  4055. @table @option
  4056. @item level_in
  4057. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4058. @item mode
  4059. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4060. Default is @code{downward}.
  4061. @item threshold
  4062. If a signal of second stream raises above this level it will affect the gain
  4063. reduction of first stream.
  4064. By default is 0.125. Range is between 0.00097563 and 1.
  4065. @item ratio
  4066. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4067. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4068. Default is 2. Range is between 1 and 20.
  4069. @item attack
  4070. Amount of milliseconds the signal has to rise above the threshold before gain
  4071. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4072. @item release
  4073. Amount of milliseconds the signal has to fall below the threshold before
  4074. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4075. @item makeup
  4076. Set the amount by how much signal will be amplified after processing.
  4077. Default is 1. Range is from 1 to 64.
  4078. @item knee
  4079. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4080. Default is 2.82843. Range is between 1 and 8.
  4081. @item link
  4082. Choose if the @code{average} level between all channels of side-chain stream
  4083. or the louder(@code{maximum}) channel of side-chain stream affects the
  4084. reduction. Default is @code{average}.
  4085. @item detection
  4086. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4087. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4088. @item level_sc
  4089. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4090. @item mix
  4091. How much to use compressed signal in output. Default is 1.
  4092. Range is between 0 and 1.
  4093. @end table
  4094. @subsection Commands
  4095. This filter supports the all above options as @ref{commands}.
  4096. @subsection Examples
  4097. @itemize
  4098. @item
  4099. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4100. depending on the signal of 2nd input and later compressed signal to be
  4101. merged with 2nd input:
  4102. @example
  4103. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4104. @end example
  4105. @end itemize
  4106. @section sidechaingate
  4107. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4108. filter the detected signal before sending it to the gain reduction stage.
  4109. Normally a gate uses the full range signal to detect a level above the
  4110. threshold.
  4111. For example: If you cut all lower frequencies from your sidechain signal
  4112. the gate will decrease the volume of your track only if not enough highs
  4113. appear. With this technique you are able to reduce the resonation of a
  4114. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4115. guitar.
  4116. It needs two input streams and returns one output stream.
  4117. First input stream will be processed depending on second stream signal.
  4118. The filter accepts the following options:
  4119. @table @option
  4120. @item level_in
  4121. Set input level before filtering.
  4122. Default is 1. Allowed range is from 0.015625 to 64.
  4123. @item mode
  4124. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4125. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4126. will be amplified, expanding dynamic range in upward direction.
  4127. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4128. @item range
  4129. Set the level of gain reduction when the signal is below the threshold.
  4130. Default is 0.06125. Allowed range is from 0 to 1.
  4131. Setting this to 0 disables reduction and then filter behaves like expander.
  4132. @item threshold
  4133. If a signal rises above this level the gain reduction is released.
  4134. Default is 0.125. Allowed range is from 0 to 1.
  4135. @item ratio
  4136. Set a ratio about which the signal is reduced.
  4137. Default is 2. Allowed range is from 1 to 9000.
  4138. @item attack
  4139. Amount of milliseconds the signal has to rise above the threshold before gain
  4140. reduction stops.
  4141. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4142. @item release
  4143. Amount of milliseconds the signal has to fall below the threshold before the
  4144. reduction is increased again. Default is 250 milliseconds.
  4145. Allowed range is from 0.01 to 9000.
  4146. @item makeup
  4147. Set amount of amplification of signal after processing.
  4148. Default is 1. Allowed range is from 1 to 64.
  4149. @item knee
  4150. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4151. Default is 2.828427125. Allowed range is from 1 to 8.
  4152. @item detection
  4153. Choose if exact signal should be taken for detection or an RMS like one.
  4154. Default is rms. Can be peak or rms.
  4155. @item link
  4156. Choose if the average level between all channels or the louder channel affects
  4157. the reduction.
  4158. Default is average. Can be average or maximum.
  4159. @item level_sc
  4160. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4161. @end table
  4162. @subsection Commands
  4163. This filter supports the all above options as @ref{commands}.
  4164. @section silencedetect
  4165. Detect silence in an audio stream.
  4166. This filter logs a message when it detects that the input audio volume is less
  4167. or equal to a noise tolerance value for a duration greater or equal to the
  4168. minimum detected noise duration.
  4169. The printed times and duration are expressed in seconds. The
  4170. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4171. is set on the first frame whose timestamp equals or exceeds the detection
  4172. duration and it contains the timestamp of the first frame of the silence.
  4173. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4174. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4175. keys are set on the first frame after the silence. If @option{mono} is
  4176. enabled, and each channel is evaluated separately, the @code{.X}
  4177. suffixed keys are used, and @code{X} corresponds to the channel number.
  4178. The filter accepts the following options:
  4179. @table @option
  4180. @item noise, n
  4181. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4182. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4183. @item duration, d
  4184. Set silence duration until notification (default is 2 seconds). See
  4185. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4186. for the accepted syntax.
  4187. @item mono, m
  4188. Process each channel separately, instead of combined. By default is disabled.
  4189. @end table
  4190. @subsection Examples
  4191. @itemize
  4192. @item
  4193. Detect 5 seconds of silence with -50dB noise tolerance:
  4194. @example
  4195. silencedetect=n=-50dB:d=5
  4196. @end example
  4197. @item
  4198. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4199. tolerance in @file{silence.mp3}:
  4200. @example
  4201. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4202. @end example
  4203. @end itemize
  4204. @section silenceremove
  4205. Remove silence from the beginning, middle or end of the audio.
  4206. The filter accepts the following options:
  4207. @table @option
  4208. @item start_periods
  4209. This value is used to indicate if audio should be trimmed at beginning of
  4210. the audio. A value of zero indicates no silence should be trimmed from the
  4211. beginning. When specifying a non-zero value, it trims audio up until it
  4212. finds non-silence. Normally, when trimming silence from beginning of audio
  4213. the @var{start_periods} will be @code{1} but it can be increased to higher
  4214. values to trim all audio up to specific count of non-silence periods.
  4215. Default value is @code{0}.
  4216. @item start_duration
  4217. Specify the amount of time that non-silence must be detected before it stops
  4218. trimming audio. By increasing the duration, bursts of noises can be treated
  4219. as silence and trimmed off. Default value is @code{0}.
  4220. @item start_threshold
  4221. This indicates what sample value should be treated as silence. For digital
  4222. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4223. you may wish to increase the value to account for background noise.
  4224. Can be specified in dB (in case "dB" is appended to the specified value)
  4225. or amplitude ratio. Default value is @code{0}.
  4226. @item start_silence
  4227. Specify max duration of silence at beginning that will be kept after
  4228. trimming. Default is 0, which is equal to trimming all samples detected
  4229. as silence.
  4230. @item start_mode
  4231. Specify mode of detection of silence end in start of multi-channel audio.
  4232. Can be @var{any} or @var{all}. Default is @var{any}.
  4233. With @var{any}, any sample that is detected as non-silence will cause
  4234. stopped trimming of silence.
  4235. With @var{all}, only if all channels are detected as non-silence will cause
  4236. stopped trimming of silence.
  4237. @item stop_periods
  4238. Set the count for trimming silence from the end of audio.
  4239. To remove silence from the middle of a file, specify a @var{stop_periods}
  4240. that is negative. This value is then treated as a positive value and is
  4241. used to indicate the effect should restart processing as specified by
  4242. @var{start_periods}, making it suitable for removing periods of silence
  4243. in the middle of the audio.
  4244. Default value is @code{0}.
  4245. @item stop_duration
  4246. Specify a duration of silence that must exist before audio is not copied any
  4247. more. By specifying a higher duration, silence that is wanted can be left in
  4248. the audio.
  4249. Default value is @code{0}.
  4250. @item stop_threshold
  4251. This is the same as @option{start_threshold} but for trimming silence from
  4252. the end of audio.
  4253. Can be specified in dB (in case "dB" is appended to the specified value)
  4254. or amplitude ratio. Default value is @code{0}.
  4255. @item stop_silence
  4256. Specify max duration of silence at end that will be kept after
  4257. trimming. Default is 0, which is equal to trimming all samples detected
  4258. as silence.
  4259. @item stop_mode
  4260. Specify mode of detection of silence start in end of multi-channel audio.
  4261. Can be @var{any} or @var{all}. Default is @var{any}.
  4262. With @var{any}, any sample that is detected as non-silence will cause
  4263. stopped trimming of silence.
  4264. With @var{all}, only if all channels are detected as non-silence will cause
  4265. stopped trimming of silence.
  4266. @item detection
  4267. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4268. and works better with digital silence which is exactly 0.
  4269. Default value is @code{rms}.
  4270. @item window
  4271. Set duration in number of seconds used to calculate size of window in number
  4272. of samples for detecting silence.
  4273. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4274. @end table
  4275. @subsection Examples
  4276. @itemize
  4277. @item
  4278. The following example shows how this filter can be used to start a recording
  4279. that does not contain the delay at the start which usually occurs between
  4280. pressing the record button and the start of the performance:
  4281. @example
  4282. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4283. @end example
  4284. @item
  4285. Trim all silence encountered from beginning to end where there is more than 1
  4286. second of silence in audio:
  4287. @example
  4288. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4289. @end example
  4290. @item
  4291. Trim all digital silence samples, using peak detection, from beginning to end
  4292. where there is more than 0 samples of digital silence in audio and digital
  4293. silence is detected in all channels at same positions in stream:
  4294. @example
  4295. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4296. @end example
  4297. @end itemize
  4298. @section sofalizer
  4299. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4300. loudspeakers around the user for binaural listening via headphones (audio
  4301. formats up to 9 channels supported).
  4302. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4303. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4304. Austrian Academy of Sciences.
  4305. To enable compilation of this filter you need to configure FFmpeg with
  4306. @code{--enable-libmysofa}.
  4307. The filter accepts the following options:
  4308. @table @option
  4309. @item sofa
  4310. Set the SOFA file used for rendering.
  4311. @item gain
  4312. Set gain applied to audio. Value is in dB. Default is 0.
  4313. @item rotation
  4314. Set rotation of virtual loudspeakers in deg. Default is 0.
  4315. @item elevation
  4316. Set elevation of virtual speakers in deg. Default is 0.
  4317. @item radius
  4318. Set distance in meters between loudspeakers and the listener with near-field
  4319. HRTFs. Default is 1.
  4320. @item type
  4321. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4322. processing audio in time domain which is slow.
  4323. @var{freq} is processing audio in frequency domain which is fast.
  4324. Default is @var{freq}.
  4325. @item speakers
  4326. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4327. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4328. Each virtual loudspeaker is described with short channel name following with
  4329. azimuth and elevation in degrees.
  4330. Each virtual loudspeaker description is separated by '|'.
  4331. For example to override front left and front right channel positions use:
  4332. 'speakers=FL 45 15|FR 345 15'.
  4333. Descriptions with unrecognised channel names are ignored.
  4334. @item lfegain
  4335. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4336. @item framesize
  4337. Set custom frame size in number of samples. Default is 1024.
  4338. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4339. is set to @var{freq}.
  4340. @item normalize
  4341. Should all IRs be normalized upon importing SOFA file.
  4342. By default is enabled.
  4343. @item interpolate
  4344. Should nearest IRs be interpolated with neighbor IRs if exact position
  4345. does not match. By default is disabled.
  4346. @item minphase
  4347. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4348. @item anglestep
  4349. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4350. @item radstep
  4351. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4352. @end table
  4353. @subsection Examples
  4354. @itemize
  4355. @item
  4356. Using ClubFritz6 sofa file:
  4357. @example
  4358. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4359. @end example
  4360. @item
  4361. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4362. @example
  4363. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4364. @end example
  4365. @item
  4366. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4367. and also with custom gain:
  4368. @example
  4369. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4370. @end example
  4371. @end itemize
  4372. @section speechnorm
  4373. Speech Normalizer.
  4374. This filter expands or compresses each half-cycle of audio samples
  4375. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4376. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4377. The filter accepts the following options:
  4378. @table @option
  4379. @item peak, p
  4380. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4381. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4382. @item expansion, e
  4383. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4384. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4385. would be such that local peak value reaches target peak value but never to surpass it and that
  4386. ratio between new and previous peak value does not surpass this option value.
  4387. @item compression, c
  4388. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4389. This option controls maximum local half-cycle of samples compression. This option is used
  4390. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4391. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4392. that peak's half-cycle will be compressed by current compression factor.
  4393. @item threshold, t
  4394. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4395. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4396. Any half-cycle samples with their local peak value below or same as this option value will be
  4397. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4398. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4399. @item raise, r
  4400. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4401. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4402. each new half-cycle until it reaches @option{expansion} value.
  4403. Setting this options too high may lead to distortions.
  4404. @item fall, f
  4405. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4406. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4407. each new half-cycle until it reaches @option{compression} value.
  4408. @item channels, h
  4409. Specify which channels to filter, by default all available channels are filtered.
  4410. @item invert, i
  4411. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4412. option. When enabled any half-cycle of samples with their local peak value below or same as
  4413. @option{threshold} option will be expanded otherwise it will be compressed.
  4414. @item link, l
  4415. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4416. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4417. is enabled the minimum of all possible gains for each filtered channel is used.
  4418. @end table
  4419. @subsection Commands
  4420. This filter supports the all above options as @ref{commands}.
  4421. @section stereotools
  4422. This filter has some handy utilities to manage stereo signals, for converting
  4423. M/S stereo recordings to L/R signal while having control over the parameters
  4424. or spreading the stereo image of master track.
  4425. The filter accepts the following options:
  4426. @table @option
  4427. @item level_in
  4428. Set input level before filtering for both channels. Defaults is 1.
  4429. Allowed range is from 0.015625 to 64.
  4430. @item level_out
  4431. Set output level after filtering for both channels. Defaults is 1.
  4432. Allowed range is from 0.015625 to 64.
  4433. @item balance_in
  4434. Set input balance between both channels. Default is 0.
  4435. Allowed range is from -1 to 1.
  4436. @item balance_out
  4437. Set output balance between both channels. Default is 0.
  4438. Allowed range is from -1 to 1.
  4439. @item softclip
  4440. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4441. clipping. Disabled by default.
  4442. @item mutel
  4443. Mute the left channel. Disabled by default.
  4444. @item muter
  4445. Mute the right channel. Disabled by default.
  4446. @item phasel
  4447. Change the phase of the left channel. Disabled by default.
  4448. @item phaser
  4449. Change the phase of the right channel. Disabled by default.
  4450. @item mode
  4451. Set stereo mode. Available values are:
  4452. @table @samp
  4453. @item lr>lr
  4454. Left/Right to Left/Right, this is default.
  4455. @item lr>ms
  4456. Left/Right to Mid/Side.
  4457. @item ms>lr
  4458. Mid/Side to Left/Right.
  4459. @item lr>ll
  4460. Left/Right to Left/Left.
  4461. @item lr>rr
  4462. Left/Right to Right/Right.
  4463. @item lr>l+r
  4464. Left/Right to Left + Right.
  4465. @item lr>rl
  4466. Left/Right to Right/Left.
  4467. @item ms>ll
  4468. Mid/Side to Left/Left.
  4469. @item ms>rr
  4470. Mid/Side to Right/Right.
  4471. @item ms>rl
  4472. Mid/Side to Right/Left.
  4473. @item lr>l-r
  4474. Left/Right to Left - Right.
  4475. @end table
  4476. @item slev
  4477. Set level of side signal. Default is 1.
  4478. Allowed range is from 0.015625 to 64.
  4479. @item sbal
  4480. Set balance of side signal. Default is 0.
  4481. Allowed range is from -1 to 1.
  4482. @item mlev
  4483. Set level of the middle signal. Default is 1.
  4484. Allowed range is from 0.015625 to 64.
  4485. @item mpan
  4486. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4487. @item base
  4488. Set stereo base between mono and inversed channels. Default is 0.
  4489. Allowed range is from -1 to 1.
  4490. @item delay
  4491. Set delay in milliseconds how much to delay left from right channel and
  4492. vice versa. Default is 0. Allowed range is from -20 to 20.
  4493. @item sclevel
  4494. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4495. @item phase
  4496. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4497. @item bmode_in, bmode_out
  4498. Set balance mode for balance_in/balance_out option.
  4499. Can be one of the following:
  4500. @table @samp
  4501. @item balance
  4502. Classic balance mode. Attenuate one channel at time.
  4503. Gain is raised up to 1.
  4504. @item amplitude
  4505. Similar as classic mode above but gain is raised up to 2.
  4506. @item power
  4507. Equal power distribution, from -6dB to +6dB range.
  4508. @end table
  4509. @end table
  4510. @subsection Commands
  4511. This filter supports the all above options as @ref{commands}.
  4512. @subsection Examples
  4513. @itemize
  4514. @item
  4515. Apply karaoke like effect:
  4516. @example
  4517. stereotools=mlev=0.015625
  4518. @end example
  4519. @item
  4520. Convert M/S signal to L/R:
  4521. @example
  4522. "stereotools=mode=ms>lr"
  4523. @end example
  4524. @end itemize
  4525. @section stereowiden
  4526. This filter enhance the stereo effect by suppressing signal common to both
  4527. channels and by delaying the signal of left into right and vice versa,
  4528. thereby widening the stereo effect.
  4529. The filter accepts the following options:
  4530. @table @option
  4531. @item delay
  4532. Time in milliseconds of the delay of left signal into right and vice versa.
  4533. Default is 20 milliseconds.
  4534. @item feedback
  4535. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4536. effect of left signal in right output and vice versa which gives widening
  4537. effect. Default is 0.3.
  4538. @item crossfeed
  4539. Cross feed of left into right with inverted phase. This helps in suppressing
  4540. the mono. If the value is 1 it will cancel all the signal common to both
  4541. channels. Default is 0.3.
  4542. @item drymix
  4543. Set level of input signal of original channel. Default is 0.8.
  4544. @end table
  4545. @subsection Commands
  4546. This filter supports the all above options except @code{delay} as @ref{commands}.
  4547. @section superequalizer
  4548. Apply 18 band equalizer.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item 1b
  4552. Set 65Hz band gain.
  4553. @item 2b
  4554. Set 92Hz band gain.
  4555. @item 3b
  4556. Set 131Hz band gain.
  4557. @item 4b
  4558. Set 185Hz band gain.
  4559. @item 5b
  4560. Set 262Hz band gain.
  4561. @item 6b
  4562. Set 370Hz band gain.
  4563. @item 7b
  4564. Set 523Hz band gain.
  4565. @item 8b
  4566. Set 740Hz band gain.
  4567. @item 9b
  4568. Set 1047Hz band gain.
  4569. @item 10b
  4570. Set 1480Hz band gain.
  4571. @item 11b
  4572. Set 2093Hz band gain.
  4573. @item 12b
  4574. Set 2960Hz band gain.
  4575. @item 13b
  4576. Set 4186Hz band gain.
  4577. @item 14b
  4578. Set 5920Hz band gain.
  4579. @item 15b
  4580. Set 8372Hz band gain.
  4581. @item 16b
  4582. Set 11840Hz band gain.
  4583. @item 17b
  4584. Set 16744Hz band gain.
  4585. @item 18b
  4586. Set 20000Hz band gain.
  4587. @end table
  4588. @section surround
  4589. Apply audio surround upmix filter.
  4590. This filter allows to produce multichannel output from audio stream.
  4591. The filter accepts the following options:
  4592. @table @option
  4593. @item chl_out
  4594. Set output channel layout. By default, this is @var{5.1}.
  4595. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4596. for the required syntax.
  4597. @item chl_in
  4598. Set input channel layout. By default, this is @var{stereo}.
  4599. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4600. for the required syntax.
  4601. @item level_in
  4602. Set input volume level. By default, this is @var{1}.
  4603. @item level_out
  4604. Set output volume level. By default, this is @var{1}.
  4605. @item lfe
  4606. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4607. @item lfe_low
  4608. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4609. @item lfe_high
  4610. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4611. @item lfe_mode
  4612. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4613. In @var{add} mode, LFE channel is created from input audio and added to output.
  4614. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4615. also all non-LFE output channels are subtracted with output LFE channel.
  4616. @item angle
  4617. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4618. Default is @var{90}.
  4619. @item fc_in
  4620. Set front center input volume. By default, this is @var{1}.
  4621. @item fc_out
  4622. Set front center output volume. By default, this is @var{1}.
  4623. @item fl_in
  4624. Set front left input volume. By default, this is @var{1}.
  4625. @item fl_out
  4626. Set front left output volume. By default, this is @var{1}.
  4627. @item fr_in
  4628. Set front right input volume. By default, this is @var{1}.
  4629. @item fr_out
  4630. Set front right output volume. By default, this is @var{1}.
  4631. @item sl_in
  4632. Set side left input volume. By default, this is @var{1}.
  4633. @item sl_out
  4634. Set side left output volume. By default, this is @var{1}.
  4635. @item sr_in
  4636. Set side right input volume. By default, this is @var{1}.
  4637. @item sr_out
  4638. Set side right output volume. By default, this is @var{1}.
  4639. @item bl_in
  4640. Set back left input volume. By default, this is @var{1}.
  4641. @item bl_out
  4642. Set back left output volume. By default, this is @var{1}.
  4643. @item br_in
  4644. Set back right input volume. By default, this is @var{1}.
  4645. @item br_out
  4646. Set back right output volume. By default, this is @var{1}.
  4647. @item bc_in
  4648. Set back center input volume. By default, this is @var{1}.
  4649. @item bc_out
  4650. Set back center output volume. By default, this is @var{1}.
  4651. @item lfe_in
  4652. Set LFE input volume. By default, this is @var{1}.
  4653. @item lfe_out
  4654. Set LFE output volume. By default, this is @var{1}.
  4655. @item allx
  4656. Set spread usage of stereo image across X axis for all channels.
  4657. @item ally
  4658. Set spread usage of stereo image across Y axis for all channels.
  4659. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4660. Set spread usage of stereo image across X axis for each channel.
  4661. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4662. Set spread usage of stereo image across Y axis for each channel.
  4663. @item win_size
  4664. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4665. @item win_func
  4666. Set window function.
  4667. It accepts the following values:
  4668. @table @samp
  4669. @item rect
  4670. @item bartlett
  4671. @item hann, hanning
  4672. @item hamming
  4673. @item blackman
  4674. @item welch
  4675. @item flattop
  4676. @item bharris
  4677. @item bnuttall
  4678. @item bhann
  4679. @item sine
  4680. @item nuttall
  4681. @item lanczos
  4682. @item gauss
  4683. @item tukey
  4684. @item dolph
  4685. @item cauchy
  4686. @item parzen
  4687. @item poisson
  4688. @item bohman
  4689. @end table
  4690. Default is @code{hann}.
  4691. @item overlap
  4692. Set window overlap. If set to 1, the recommended overlap for selected
  4693. window function will be picked. Default is @code{0.5}.
  4694. @end table
  4695. @section treble, highshelf
  4696. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4697. shelving filter with a response similar to that of a standard
  4698. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4699. The filter accepts the following options:
  4700. @table @option
  4701. @item gain, g
  4702. Give the gain at whichever is the lower of ~22 kHz and the
  4703. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4704. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4705. @item frequency, f
  4706. Set the filter's central frequency and so can be used
  4707. to extend or reduce the frequency range to be boosted or cut.
  4708. The default value is @code{3000} Hz.
  4709. @item width_type, t
  4710. Set method to specify band-width of filter.
  4711. @table @option
  4712. @item h
  4713. Hz
  4714. @item q
  4715. Q-Factor
  4716. @item o
  4717. octave
  4718. @item s
  4719. slope
  4720. @item k
  4721. kHz
  4722. @end table
  4723. @item width, w
  4724. Determine how steep is the filter's shelf transition.
  4725. @item poles, p
  4726. Set number of poles. Default is 2.
  4727. @item mix, m
  4728. How much to use filtered signal in output. Default is 1.
  4729. Range is between 0 and 1.
  4730. @item channels, c
  4731. Specify which channels to filter, by default all available are filtered.
  4732. @item normalize, n
  4733. Normalize biquad coefficients, by default is disabled.
  4734. Enabling it will normalize magnitude response at DC to 0dB.
  4735. @item transform, a
  4736. Set transform type of IIR filter.
  4737. @table @option
  4738. @item di
  4739. @item dii
  4740. @item tdii
  4741. @item latt
  4742. @end table
  4743. @item precision, r
  4744. Set precison of filtering.
  4745. @table @option
  4746. @item auto
  4747. Pick automatic sample format depending on surround filters.
  4748. @item s16
  4749. Always use signed 16-bit.
  4750. @item s32
  4751. Always use signed 32-bit.
  4752. @item f32
  4753. Always use float 32-bit.
  4754. @item f64
  4755. Always use float 64-bit.
  4756. @end table
  4757. @end table
  4758. @subsection Commands
  4759. This filter supports the following commands:
  4760. @table @option
  4761. @item frequency, f
  4762. Change treble frequency.
  4763. Syntax for the command is : "@var{frequency}"
  4764. @item width_type, t
  4765. Change treble width_type.
  4766. Syntax for the command is : "@var{width_type}"
  4767. @item width, w
  4768. Change treble width.
  4769. Syntax for the command is : "@var{width}"
  4770. @item gain, g
  4771. Change treble gain.
  4772. Syntax for the command is : "@var{gain}"
  4773. @item mix, m
  4774. Change treble mix.
  4775. Syntax for the command is : "@var{mix}"
  4776. @end table
  4777. @section tremolo
  4778. Sinusoidal amplitude modulation.
  4779. The filter accepts the following options:
  4780. @table @option
  4781. @item f
  4782. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4783. (20 Hz or lower) will result in a tremolo effect.
  4784. This filter may also be used as a ring modulator by specifying
  4785. a modulation frequency higher than 20 Hz.
  4786. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4787. @item d
  4788. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4789. Default value is 0.5.
  4790. @end table
  4791. @section vibrato
  4792. Sinusoidal phase modulation.
  4793. The filter accepts the following options:
  4794. @table @option
  4795. @item f
  4796. Modulation frequency in Hertz.
  4797. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4798. @item d
  4799. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4800. Default value is 0.5.
  4801. @end table
  4802. @section volume
  4803. Adjust the input audio volume.
  4804. It accepts the following parameters:
  4805. @table @option
  4806. @item volume
  4807. Set audio volume expression.
  4808. Output values are clipped to the maximum value.
  4809. The output audio volume is given by the relation:
  4810. @example
  4811. @var{output_volume} = @var{volume} * @var{input_volume}
  4812. @end example
  4813. The default value for @var{volume} is "1.0".
  4814. @item precision
  4815. This parameter represents the mathematical precision.
  4816. It determines which input sample formats will be allowed, which affects the
  4817. precision of the volume scaling.
  4818. @table @option
  4819. @item fixed
  4820. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4821. @item float
  4822. 32-bit floating-point; this limits input sample format to FLT. (default)
  4823. @item double
  4824. 64-bit floating-point; this limits input sample format to DBL.
  4825. @end table
  4826. @item replaygain
  4827. Choose the behaviour on encountering ReplayGain side data in input frames.
  4828. @table @option
  4829. @item drop
  4830. Remove ReplayGain side data, ignoring its contents (the default).
  4831. @item ignore
  4832. Ignore ReplayGain side data, but leave it in the frame.
  4833. @item track
  4834. Prefer the track gain, if present.
  4835. @item album
  4836. Prefer the album gain, if present.
  4837. @end table
  4838. @item replaygain_preamp
  4839. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4840. Default value for @var{replaygain_preamp} is 0.0.
  4841. @item replaygain_noclip
  4842. Prevent clipping by limiting the gain applied.
  4843. Default value for @var{replaygain_noclip} is 1.
  4844. @item eval
  4845. Set when the volume expression is evaluated.
  4846. It accepts the following values:
  4847. @table @samp
  4848. @item once
  4849. only evaluate expression once during the filter initialization, or
  4850. when the @samp{volume} command is sent
  4851. @item frame
  4852. evaluate expression for each incoming frame
  4853. @end table
  4854. Default value is @samp{once}.
  4855. @end table
  4856. The volume expression can contain the following parameters.
  4857. @table @option
  4858. @item n
  4859. frame number (starting at zero)
  4860. @item nb_channels
  4861. number of channels
  4862. @item nb_consumed_samples
  4863. number of samples consumed by the filter
  4864. @item nb_samples
  4865. number of samples in the current frame
  4866. @item pos
  4867. original frame position in the file
  4868. @item pts
  4869. frame PTS
  4870. @item sample_rate
  4871. sample rate
  4872. @item startpts
  4873. PTS at start of stream
  4874. @item startt
  4875. time at start of stream
  4876. @item t
  4877. frame time
  4878. @item tb
  4879. timestamp timebase
  4880. @item volume
  4881. last set volume value
  4882. @end table
  4883. Note that when @option{eval} is set to @samp{once} only the
  4884. @var{sample_rate} and @var{tb} variables are available, all other
  4885. variables will evaluate to NAN.
  4886. @subsection Commands
  4887. This filter supports the following commands:
  4888. @table @option
  4889. @item volume
  4890. Modify the volume expression.
  4891. The command accepts the same syntax of the corresponding option.
  4892. If the specified expression is not valid, it is kept at its current
  4893. value.
  4894. @end table
  4895. @subsection Examples
  4896. @itemize
  4897. @item
  4898. Halve the input audio volume:
  4899. @example
  4900. volume=volume=0.5
  4901. volume=volume=1/2
  4902. volume=volume=-6.0206dB
  4903. @end example
  4904. In all the above example the named key for @option{volume} can be
  4905. omitted, for example like in:
  4906. @example
  4907. volume=0.5
  4908. @end example
  4909. @item
  4910. Increase input audio power by 6 decibels using fixed-point precision:
  4911. @example
  4912. volume=volume=6dB:precision=fixed
  4913. @end example
  4914. @item
  4915. Fade volume after time 10 with an annihilation period of 5 seconds:
  4916. @example
  4917. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4918. @end example
  4919. @end itemize
  4920. @section volumedetect
  4921. Detect the volume of the input video.
  4922. The filter has no parameters. The input is not modified. Statistics about
  4923. the volume will be printed in the log when the input stream end is reached.
  4924. In particular it will show the mean volume (root mean square), maximum
  4925. volume (on a per-sample basis), and the beginning of a histogram of the
  4926. registered volume values (from the maximum value to a cumulated 1/1000 of
  4927. the samples).
  4928. All volumes are in decibels relative to the maximum PCM value.
  4929. @subsection Examples
  4930. Here is an excerpt of the output:
  4931. @example
  4932. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4933. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4934. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4935. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4936. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4937. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4938. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4939. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4940. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4941. @end example
  4942. It means that:
  4943. @itemize
  4944. @item
  4945. The mean square energy is approximately -27 dB, or 10^-2.7.
  4946. @item
  4947. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4948. @item
  4949. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4950. @end itemize
  4951. In other words, raising the volume by +4 dB does not cause any clipping,
  4952. raising it by +5 dB causes clipping for 6 samples, etc.
  4953. @c man end AUDIO FILTERS
  4954. @chapter Audio Sources
  4955. @c man begin AUDIO SOURCES
  4956. Below is a description of the currently available audio sources.
  4957. @section abuffer
  4958. Buffer audio frames, and make them available to the filter chain.
  4959. This source is mainly intended for a programmatic use, in particular
  4960. through the interface defined in @file{libavfilter/buffersrc.h}.
  4961. It accepts the following parameters:
  4962. @table @option
  4963. @item time_base
  4964. The timebase which will be used for timestamps of submitted frames. It must be
  4965. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4966. @item sample_rate
  4967. The sample rate of the incoming audio buffers.
  4968. @item sample_fmt
  4969. The sample format of the incoming audio buffers.
  4970. Either a sample format name or its corresponding integer representation from
  4971. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4972. @item channel_layout
  4973. The channel layout of the incoming audio buffers.
  4974. Either a channel layout name from channel_layout_map in
  4975. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4976. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4977. @item channels
  4978. The number of channels of the incoming audio buffers.
  4979. If both @var{channels} and @var{channel_layout} are specified, then they
  4980. must be consistent.
  4981. @end table
  4982. @subsection Examples
  4983. @example
  4984. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4985. @end example
  4986. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4987. Since the sample format with name "s16p" corresponds to the number
  4988. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4989. equivalent to:
  4990. @example
  4991. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4992. @end example
  4993. @section aevalsrc
  4994. Generate an audio signal specified by an expression.
  4995. This source accepts in input one or more expressions (one for each
  4996. channel), which are evaluated and used to generate a corresponding
  4997. audio signal.
  4998. This source accepts the following options:
  4999. @table @option
  5000. @item exprs
  5001. Set the '|'-separated expressions list for each separate channel. In case the
  5002. @option{channel_layout} option is not specified, the selected channel layout
  5003. depends on the number of provided expressions. Otherwise the last
  5004. specified expression is applied to the remaining output channels.
  5005. @item channel_layout, c
  5006. Set the channel layout. The number of channels in the specified layout
  5007. must be equal to the number of specified expressions.
  5008. @item duration, d
  5009. Set the minimum duration of the sourced audio. See
  5010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5011. for the accepted syntax.
  5012. Note that the resulting duration may be greater than the specified
  5013. duration, as the generated audio is always cut at the end of a
  5014. complete frame.
  5015. If not specified, or the expressed duration is negative, the audio is
  5016. supposed to be generated forever.
  5017. @item nb_samples, n
  5018. Set the number of samples per channel per each output frame,
  5019. default to 1024.
  5020. @item sample_rate, s
  5021. Specify the sample rate, default to 44100.
  5022. @end table
  5023. Each expression in @var{exprs} can contain the following constants:
  5024. @table @option
  5025. @item n
  5026. number of the evaluated sample, starting from 0
  5027. @item t
  5028. time of the evaluated sample expressed in seconds, starting from 0
  5029. @item s
  5030. sample rate
  5031. @end table
  5032. @subsection Examples
  5033. @itemize
  5034. @item
  5035. Generate silence:
  5036. @example
  5037. aevalsrc=0
  5038. @end example
  5039. @item
  5040. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5041. 8000 Hz:
  5042. @example
  5043. aevalsrc="sin(440*2*PI*t):s=8000"
  5044. @end example
  5045. @item
  5046. Generate a two channels signal, specify the channel layout (Front
  5047. Center + Back Center) explicitly:
  5048. @example
  5049. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5050. @end example
  5051. @item
  5052. Generate white noise:
  5053. @example
  5054. aevalsrc="-2+random(0)"
  5055. @end example
  5056. @item
  5057. Generate an amplitude modulated signal:
  5058. @example
  5059. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5060. @end example
  5061. @item
  5062. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5063. @example
  5064. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5065. @end example
  5066. @end itemize
  5067. @section afirsrc
  5068. Generate a FIR coefficients using frequency sampling method.
  5069. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5070. The filter accepts the following options:
  5071. @table @option
  5072. @item taps, t
  5073. Set number of filter coefficents in output audio stream.
  5074. Default value is 1025.
  5075. @item frequency, f
  5076. Set frequency points from where magnitude and phase are set.
  5077. This must be in non decreasing order, and first element must be 0, while last element
  5078. must be 1. Elements are separated by white spaces.
  5079. @item magnitude, m
  5080. Set magnitude value for every frequency point set by @option{frequency}.
  5081. Number of values must be same as number of frequency points.
  5082. Values are separated by white spaces.
  5083. @item phase, p
  5084. Set phase value for every frequency point set by @option{frequency}.
  5085. Number of values must be same as number of frequency points.
  5086. Values are separated by white spaces.
  5087. @item sample_rate, r
  5088. Set sample rate, default is 44100.
  5089. @item nb_samples, n
  5090. Set number of samples per each frame. Default is 1024.
  5091. @item win_func, w
  5092. Set window function. Default is blackman.
  5093. @end table
  5094. @section anullsrc
  5095. The null audio source, return unprocessed audio frames. It is mainly useful
  5096. as a template and to be employed in analysis / debugging tools, or as
  5097. the source for filters which ignore the input data (for example the sox
  5098. synth filter).
  5099. This source accepts the following options:
  5100. @table @option
  5101. @item channel_layout, cl
  5102. Specifies the channel layout, and can be either an integer or a string
  5103. representing a channel layout. The default value of @var{channel_layout}
  5104. is "stereo".
  5105. Check the channel_layout_map definition in
  5106. @file{libavutil/channel_layout.c} for the mapping between strings and
  5107. channel layout values.
  5108. @item sample_rate, r
  5109. Specifies the sample rate, and defaults to 44100.
  5110. @item nb_samples, n
  5111. Set the number of samples per requested frames.
  5112. @item duration, d
  5113. Set the duration of the sourced audio. See
  5114. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5115. for the accepted syntax.
  5116. If not specified, or the expressed duration is negative, the audio is
  5117. supposed to be generated forever.
  5118. @end table
  5119. @subsection Examples
  5120. @itemize
  5121. @item
  5122. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5123. @example
  5124. anullsrc=r=48000:cl=4
  5125. @end example
  5126. @item
  5127. Do the same operation with a more obvious syntax:
  5128. @example
  5129. anullsrc=r=48000:cl=mono
  5130. @end example
  5131. @end itemize
  5132. All the parameters need to be explicitly defined.
  5133. @section flite
  5134. Synthesize a voice utterance using the libflite library.
  5135. To enable compilation of this filter you need to configure FFmpeg with
  5136. @code{--enable-libflite}.
  5137. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5138. The filter accepts the following options:
  5139. @table @option
  5140. @item list_voices
  5141. If set to 1, list the names of the available voices and exit
  5142. immediately. Default value is 0.
  5143. @item nb_samples, n
  5144. Set the maximum number of samples per frame. Default value is 512.
  5145. @item textfile
  5146. Set the filename containing the text to speak.
  5147. @item text
  5148. Set the text to speak.
  5149. @item voice, v
  5150. Set the voice to use for the speech synthesis. Default value is
  5151. @code{kal}. See also the @var{list_voices} option.
  5152. @end table
  5153. @subsection Examples
  5154. @itemize
  5155. @item
  5156. Read from file @file{speech.txt}, and synthesize the text using the
  5157. standard flite voice:
  5158. @example
  5159. flite=textfile=speech.txt
  5160. @end example
  5161. @item
  5162. Read the specified text selecting the @code{slt} voice:
  5163. @example
  5164. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5165. @end example
  5166. @item
  5167. Input text to ffmpeg:
  5168. @example
  5169. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5170. @end example
  5171. @item
  5172. Make @file{ffplay} speak the specified text, using @code{flite} and
  5173. the @code{lavfi} device:
  5174. @example
  5175. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5176. @end example
  5177. @end itemize
  5178. For more information about libflite, check:
  5179. @url{http://www.festvox.org/flite/}
  5180. @section anoisesrc
  5181. Generate a noise audio signal.
  5182. The filter accepts the following options:
  5183. @table @option
  5184. @item sample_rate, r
  5185. Specify the sample rate. Default value is 48000 Hz.
  5186. @item amplitude, a
  5187. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5188. is 1.0.
  5189. @item duration, d
  5190. Specify the duration of the generated audio stream. Not specifying this option
  5191. results in noise with an infinite length.
  5192. @item color, colour, c
  5193. Specify the color of noise. Available noise colors are white, pink, brown,
  5194. blue, violet and velvet. Default color is white.
  5195. @item seed, s
  5196. Specify a value used to seed the PRNG.
  5197. @item nb_samples, n
  5198. Set the number of samples per each output frame, default is 1024.
  5199. @end table
  5200. @subsection Examples
  5201. @itemize
  5202. @item
  5203. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5204. @example
  5205. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5206. @end example
  5207. @end itemize
  5208. @section hilbert
  5209. Generate odd-tap Hilbert transform FIR coefficients.
  5210. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5211. the signal by 90 degrees.
  5212. This is used in many matrix coding schemes and for analytic signal generation.
  5213. The process is often written as a multiplication by i (or j), the imaginary unit.
  5214. The filter accepts the following options:
  5215. @table @option
  5216. @item sample_rate, s
  5217. Set sample rate, default is 44100.
  5218. @item taps, t
  5219. Set length of FIR filter, default is 22051.
  5220. @item nb_samples, n
  5221. Set number of samples per each frame.
  5222. @item win_func, w
  5223. Set window function to be used when generating FIR coefficients.
  5224. @end table
  5225. @section sinc
  5226. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5227. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5228. The filter accepts the following options:
  5229. @table @option
  5230. @item sample_rate, r
  5231. Set sample rate, default is 44100.
  5232. @item nb_samples, n
  5233. Set number of samples per each frame. Default is 1024.
  5234. @item hp
  5235. Set high-pass frequency. Default is 0.
  5236. @item lp
  5237. Set low-pass frequency. Default is 0.
  5238. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5239. is higher than 0 then filter will create band-pass filter coefficients,
  5240. otherwise band-reject filter coefficients.
  5241. @item phase
  5242. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5243. @item beta
  5244. Set Kaiser window beta.
  5245. @item att
  5246. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5247. @item round
  5248. Enable rounding, by default is disabled.
  5249. @item hptaps
  5250. Set number of taps for high-pass filter.
  5251. @item lptaps
  5252. Set number of taps for low-pass filter.
  5253. @end table
  5254. @section sine
  5255. Generate an audio signal made of a sine wave with amplitude 1/8.
  5256. The audio signal is bit-exact.
  5257. The filter accepts the following options:
  5258. @table @option
  5259. @item frequency, f
  5260. Set the carrier frequency. Default is 440 Hz.
  5261. @item beep_factor, b
  5262. Enable a periodic beep every second with frequency @var{beep_factor} times
  5263. the carrier frequency. Default is 0, meaning the beep is disabled.
  5264. @item sample_rate, r
  5265. Specify the sample rate, default is 44100.
  5266. @item duration, d
  5267. Specify the duration of the generated audio stream.
  5268. @item samples_per_frame
  5269. Set the number of samples per output frame.
  5270. The expression can contain the following constants:
  5271. @table @option
  5272. @item n
  5273. The (sequential) number of the output audio frame, starting from 0.
  5274. @item pts
  5275. The PTS (Presentation TimeStamp) of the output audio frame,
  5276. expressed in @var{TB} units.
  5277. @item t
  5278. The PTS of the output audio frame, expressed in seconds.
  5279. @item TB
  5280. The timebase of the output audio frames.
  5281. @end table
  5282. Default is @code{1024}.
  5283. @end table
  5284. @subsection Examples
  5285. @itemize
  5286. @item
  5287. Generate a simple 440 Hz sine wave:
  5288. @example
  5289. sine
  5290. @end example
  5291. @item
  5292. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5293. @example
  5294. sine=220:4:d=5
  5295. sine=f=220:b=4:d=5
  5296. sine=frequency=220:beep_factor=4:duration=5
  5297. @end example
  5298. @item
  5299. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5300. pattern:
  5301. @example
  5302. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5303. @end example
  5304. @end itemize
  5305. @c man end AUDIO SOURCES
  5306. @chapter Audio Sinks
  5307. @c man begin AUDIO SINKS
  5308. Below is a description of the currently available audio sinks.
  5309. @section abuffersink
  5310. Buffer audio frames, and make them available to the end of filter chain.
  5311. This sink is mainly intended for programmatic use, in particular
  5312. through the interface defined in @file{libavfilter/buffersink.h}
  5313. or the options system.
  5314. It accepts a pointer to an AVABufferSinkContext structure, which
  5315. defines the incoming buffers' formats, to be passed as the opaque
  5316. parameter to @code{avfilter_init_filter} for initialization.
  5317. @section anullsink
  5318. Null audio sink; do absolutely nothing with the input audio. It is
  5319. mainly useful as a template and for use in analysis / debugging
  5320. tools.
  5321. @c man end AUDIO SINKS
  5322. @chapter Video Filters
  5323. @c man begin VIDEO FILTERS
  5324. When you configure your FFmpeg build, you can disable any of the
  5325. existing filters using @code{--disable-filters}.
  5326. The configure output will show the video filters included in your
  5327. build.
  5328. Below is a description of the currently available video filters.
  5329. @section addroi
  5330. Mark a region of interest in a video frame.
  5331. The frame data is passed through unchanged, but metadata is attached
  5332. to the frame indicating regions of interest which can affect the
  5333. behaviour of later encoding. Multiple regions can be marked by
  5334. applying the filter multiple times.
  5335. @table @option
  5336. @item x
  5337. Region distance in pixels from the left edge of the frame.
  5338. @item y
  5339. Region distance in pixels from the top edge of the frame.
  5340. @item w
  5341. Region width in pixels.
  5342. @item h
  5343. Region height in pixels.
  5344. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5345. and may contain the following variables:
  5346. @table @option
  5347. @item iw
  5348. Width of the input frame.
  5349. @item ih
  5350. Height of the input frame.
  5351. @end table
  5352. @item qoffset
  5353. Quantisation offset to apply within the region.
  5354. This must be a real value in the range -1 to +1. A value of zero
  5355. indicates no quality change. A negative value asks for better quality
  5356. (less quantisation), while a positive value asks for worse quality
  5357. (greater quantisation).
  5358. The range is calibrated so that the extreme values indicate the
  5359. largest possible offset - if the rest of the frame is encoded with the
  5360. worst possible quality, an offset of -1 indicates that this region
  5361. should be encoded with the best possible quality anyway. Intermediate
  5362. values are then interpolated in some codec-dependent way.
  5363. For example, in 10-bit H.264 the quantisation parameter varies between
  5364. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5365. this region should be encoded with a QP around one-tenth of the full
  5366. range better than the rest of the frame. So, if most of the frame
  5367. were to be encoded with a QP of around 30, this region would get a QP
  5368. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5369. An extreme value of -1 would indicate that this region should be
  5370. encoded with the best possible quality regardless of the treatment of
  5371. the rest of the frame - that is, should be encoded at a QP of -12.
  5372. @item clear
  5373. If set to true, remove any existing regions of interest marked on the
  5374. frame before adding the new one.
  5375. @end table
  5376. @subsection Examples
  5377. @itemize
  5378. @item
  5379. Mark the centre quarter of the frame as interesting.
  5380. @example
  5381. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5382. @end example
  5383. @item
  5384. Mark the 100-pixel-wide region on the left edge of the frame as very
  5385. uninteresting (to be encoded at much lower quality than the rest of
  5386. the frame).
  5387. @example
  5388. addroi=0:0:100:ih:+1/5
  5389. @end example
  5390. @end itemize
  5391. @section alphaextract
  5392. Extract the alpha component from the input as a grayscale video. This
  5393. is especially useful with the @var{alphamerge} filter.
  5394. @section alphamerge
  5395. Add or replace the alpha component of the primary input with the
  5396. grayscale value of a second input. This is intended for use with
  5397. @var{alphaextract} to allow the transmission or storage of frame
  5398. sequences that have alpha in a format that doesn't support an alpha
  5399. channel.
  5400. For example, to reconstruct full frames from a normal YUV-encoded video
  5401. and a separate video created with @var{alphaextract}, you might use:
  5402. @example
  5403. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5404. @end example
  5405. @section amplify
  5406. Amplify differences between current pixel and pixels of adjacent frames in
  5407. same pixel location.
  5408. This filter accepts the following options:
  5409. @table @option
  5410. @item radius
  5411. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5412. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5413. @item factor
  5414. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5415. @item threshold
  5416. Set threshold for difference amplification. Any difference greater or equal to
  5417. this value will not alter source pixel. Default is 10.
  5418. Allowed range is from 0 to 65535.
  5419. @item tolerance
  5420. Set tolerance for difference amplification. Any difference lower to
  5421. this value will not alter source pixel. Default is 0.
  5422. Allowed range is from 0 to 65535.
  5423. @item low
  5424. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5425. This option controls maximum possible value that will decrease source pixel value.
  5426. @item high
  5427. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5428. This option controls maximum possible value that will increase source pixel value.
  5429. @item planes
  5430. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5431. @end table
  5432. @subsection Commands
  5433. This filter supports the following @ref{commands} that corresponds to option of same name:
  5434. @table @option
  5435. @item factor
  5436. @item threshold
  5437. @item tolerance
  5438. @item low
  5439. @item high
  5440. @item planes
  5441. @end table
  5442. @section ass
  5443. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5444. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5445. Substation Alpha) subtitles files.
  5446. This filter accepts the following option in addition to the common options from
  5447. the @ref{subtitles} filter:
  5448. @table @option
  5449. @item shaping
  5450. Set the shaping engine
  5451. Available values are:
  5452. @table @samp
  5453. @item auto
  5454. The default libass shaping engine, which is the best available.
  5455. @item simple
  5456. Fast, font-agnostic shaper that can do only substitutions
  5457. @item complex
  5458. Slower shaper using OpenType for substitutions and positioning
  5459. @end table
  5460. The default is @code{auto}.
  5461. @end table
  5462. @section atadenoise
  5463. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5464. The filter accepts the following options:
  5465. @table @option
  5466. @item 0a
  5467. Set threshold A for 1st plane. Default is 0.02.
  5468. Valid range is 0 to 0.3.
  5469. @item 0b
  5470. Set threshold B for 1st plane. Default is 0.04.
  5471. Valid range is 0 to 5.
  5472. @item 1a
  5473. Set threshold A for 2nd plane. Default is 0.02.
  5474. Valid range is 0 to 0.3.
  5475. @item 1b
  5476. Set threshold B for 2nd plane. Default is 0.04.
  5477. Valid range is 0 to 5.
  5478. @item 2a
  5479. Set threshold A for 3rd plane. Default is 0.02.
  5480. Valid range is 0 to 0.3.
  5481. @item 2b
  5482. Set threshold B for 3rd plane. Default is 0.04.
  5483. Valid range is 0 to 5.
  5484. Threshold A is designed to react on abrupt changes in the input signal and
  5485. threshold B is designed to react on continuous changes in the input signal.
  5486. @item s
  5487. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5488. number in range [5, 129].
  5489. @item p
  5490. Set what planes of frame filter will use for averaging. Default is all.
  5491. @item a
  5492. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5493. Alternatively can be set to @code{s} serial.
  5494. Parallel can be faster then serial, while other way around is never true.
  5495. Parallel will abort early on first change being greater then thresholds, while serial
  5496. will continue processing other side of frames if they are equal or below thresholds.
  5497. @item 0s
  5498. @item 1s
  5499. @item 2s
  5500. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5501. Valid range is from 0 to 32767.
  5502. This options controls weight for each pixel in radius defined by size.
  5503. Default value means every pixel have same weight.
  5504. Setting this option to 0 effectively disables filtering.
  5505. @end table
  5506. @subsection Commands
  5507. This filter supports same @ref{commands} as options except option @code{s}.
  5508. The command accepts the same syntax of the corresponding option.
  5509. @section avgblur
  5510. Apply average blur filter.
  5511. The filter accepts the following options:
  5512. @table @option
  5513. @item sizeX
  5514. Set horizontal radius size.
  5515. @item planes
  5516. Set which planes to filter. By default all planes are filtered.
  5517. @item sizeY
  5518. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5519. Default is @code{0}.
  5520. @end table
  5521. @subsection Commands
  5522. This filter supports same commands as options.
  5523. The command accepts the same syntax of the corresponding option.
  5524. If the specified expression is not valid, it is kept at its current
  5525. value.
  5526. @section bbox
  5527. Compute the bounding box for the non-black pixels in the input frame
  5528. luminance plane.
  5529. This filter computes the bounding box containing all the pixels with a
  5530. luminance value greater than the minimum allowed value.
  5531. The parameters describing the bounding box are printed on the filter
  5532. log.
  5533. The filter accepts the following option:
  5534. @table @option
  5535. @item min_val
  5536. Set the minimal luminance value. Default is @code{16}.
  5537. @end table
  5538. @subsection Commands
  5539. This filter supports the all above options as @ref{commands}.
  5540. @section bilateral
  5541. Apply bilateral filter, spatial smoothing while preserving edges.
  5542. The filter accepts the following options:
  5543. @table @option
  5544. @item sigmaS
  5545. Set sigma of gaussian function to calculate spatial weight.
  5546. Allowed range is 0 to 512. Default is 0.1.
  5547. @item sigmaR
  5548. Set sigma of gaussian function to calculate range weight.
  5549. Allowed range is 0 to 1. Default is 0.1.
  5550. @item planes
  5551. Set planes to filter. Default is first only.
  5552. @end table
  5553. @subsection Commands
  5554. This filter supports the all above options as @ref{commands}.
  5555. @section bitplanenoise
  5556. Show and measure bit plane noise.
  5557. The filter accepts the following options:
  5558. @table @option
  5559. @item bitplane
  5560. Set which plane to analyze. Default is @code{1}.
  5561. @item filter
  5562. Filter out noisy pixels from @code{bitplane} set above.
  5563. Default is disabled.
  5564. @end table
  5565. @section blackdetect
  5566. Detect video intervals that are (almost) completely black. Can be
  5567. useful to detect chapter transitions, commercials, or invalid
  5568. recordings.
  5569. The filter outputs its detection analysis to both the log as well as
  5570. frame metadata. If a black segment of at least the specified minimum
  5571. duration is found, a line with the start and end timestamps as well
  5572. as duration is printed to the log with level @code{info}. In addition,
  5573. a log line with level @code{debug} is printed per frame showing the
  5574. black amount detected for that frame.
  5575. The filter also attaches metadata to the first frame of a black
  5576. segment with key @code{lavfi.black_start} and to the first frame
  5577. after the black segment ends with key @code{lavfi.black_end}. The
  5578. value is the frame's timestamp. This metadata is added regardless
  5579. of the minimum duration specified.
  5580. The filter accepts the following options:
  5581. @table @option
  5582. @item black_min_duration, d
  5583. Set the minimum detected black duration expressed in seconds. It must
  5584. be a non-negative floating point number.
  5585. Default value is 2.0.
  5586. @item picture_black_ratio_th, pic_th
  5587. Set the threshold for considering a picture "black".
  5588. Express the minimum value for the ratio:
  5589. @example
  5590. @var{nb_black_pixels} / @var{nb_pixels}
  5591. @end example
  5592. for which a picture is considered black.
  5593. Default value is 0.98.
  5594. @item pixel_black_th, pix_th
  5595. Set the threshold for considering a pixel "black".
  5596. The threshold expresses the maximum pixel luminance value for which a
  5597. pixel is considered "black". The provided value is scaled according to
  5598. the following equation:
  5599. @example
  5600. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5601. @end example
  5602. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5603. the input video format, the range is [0-255] for YUV full-range
  5604. formats and [16-235] for YUV non full-range formats.
  5605. Default value is 0.10.
  5606. @end table
  5607. The following example sets the maximum pixel threshold to the minimum
  5608. value, and detects only black intervals of 2 or more seconds:
  5609. @example
  5610. blackdetect=d=2:pix_th=0.00
  5611. @end example
  5612. @section blackframe
  5613. Detect frames that are (almost) completely black. Can be useful to
  5614. detect chapter transitions or commercials. Output lines consist of
  5615. the frame number of the detected frame, the percentage of blackness,
  5616. the position in the file if known or -1 and the timestamp in seconds.
  5617. In order to display the output lines, you need to set the loglevel at
  5618. least to the AV_LOG_INFO value.
  5619. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5620. The value represents the percentage of pixels in the picture that
  5621. are below the threshold value.
  5622. It accepts the following parameters:
  5623. @table @option
  5624. @item amount
  5625. The percentage of the pixels that have to be below the threshold; it defaults to
  5626. @code{98}.
  5627. @item threshold, thresh
  5628. The threshold below which a pixel value is considered black; it defaults to
  5629. @code{32}.
  5630. @end table
  5631. @anchor{blend}
  5632. @section blend
  5633. Blend two video frames into each other.
  5634. The @code{blend} filter takes two input streams and outputs one
  5635. stream, the first input is the "top" layer and second input is
  5636. "bottom" layer. By default, the output terminates when the longest input terminates.
  5637. The @code{tblend} (time blend) filter takes two consecutive frames
  5638. from one single stream, and outputs the result obtained by blending
  5639. the new frame on top of the old frame.
  5640. A description of the accepted options follows.
  5641. @table @option
  5642. @item c0_mode
  5643. @item c1_mode
  5644. @item c2_mode
  5645. @item c3_mode
  5646. @item all_mode
  5647. Set blend mode for specific pixel component or all pixel components in case
  5648. of @var{all_mode}. Default value is @code{normal}.
  5649. Available values for component modes are:
  5650. @table @samp
  5651. @item addition
  5652. @item grainmerge
  5653. @item and
  5654. @item average
  5655. @item burn
  5656. @item darken
  5657. @item difference
  5658. @item grainextract
  5659. @item divide
  5660. @item dodge
  5661. @item freeze
  5662. @item exclusion
  5663. @item extremity
  5664. @item glow
  5665. @item hardlight
  5666. @item hardmix
  5667. @item heat
  5668. @item lighten
  5669. @item linearlight
  5670. @item multiply
  5671. @item multiply128
  5672. @item negation
  5673. @item normal
  5674. @item or
  5675. @item overlay
  5676. @item phoenix
  5677. @item pinlight
  5678. @item reflect
  5679. @item screen
  5680. @item softlight
  5681. @item subtract
  5682. @item vividlight
  5683. @item xor
  5684. @end table
  5685. @item c0_opacity
  5686. @item c1_opacity
  5687. @item c2_opacity
  5688. @item c3_opacity
  5689. @item all_opacity
  5690. Set blend opacity for specific pixel component or all pixel components in case
  5691. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5692. @item c0_expr
  5693. @item c1_expr
  5694. @item c2_expr
  5695. @item c3_expr
  5696. @item all_expr
  5697. Set blend expression for specific pixel component or all pixel components in case
  5698. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5699. The expressions can use the following variables:
  5700. @table @option
  5701. @item N
  5702. The sequential number of the filtered frame, starting from @code{0}.
  5703. @item X
  5704. @item Y
  5705. the coordinates of the current sample
  5706. @item W
  5707. @item H
  5708. the width and height of currently filtered plane
  5709. @item SW
  5710. @item SH
  5711. Width and height scale for the plane being filtered. It is the
  5712. ratio between the dimensions of the current plane to the luma plane,
  5713. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5714. the luma plane and @code{0.5,0.5} for the chroma planes.
  5715. @item T
  5716. Time of the current frame, expressed in seconds.
  5717. @item TOP, A
  5718. Value of pixel component at current location for first video frame (top layer).
  5719. @item BOTTOM, B
  5720. Value of pixel component at current location for second video frame (bottom layer).
  5721. @end table
  5722. @end table
  5723. The @code{blend} filter also supports the @ref{framesync} options.
  5724. @subsection Examples
  5725. @itemize
  5726. @item
  5727. Apply transition from bottom layer to top layer in first 10 seconds:
  5728. @example
  5729. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5730. @end example
  5731. @item
  5732. Apply linear horizontal transition from top layer to bottom layer:
  5733. @example
  5734. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5735. @end example
  5736. @item
  5737. Apply 1x1 checkerboard effect:
  5738. @example
  5739. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5740. @end example
  5741. @item
  5742. Apply uncover left effect:
  5743. @example
  5744. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5745. @end example
  5746. @item
  5747. Apply uncover down effect:
  5748. @example
  5749. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5750. @end example
  5751. @item
  5752. Apply uncover up-left effect:
  5753. @example
  5754. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5755. @end example
  5756. @item
  5757. Split diagonally video and shows top and bottom layer on each side:
  5758. @example
  5759. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5760. @end example
  5761. @item
  5762. Display differences between the current and the previous frame:
  5763. @example
  5764. tblend=all_mode=grainextract
  5765. @end example
  5766. @end itemize
  5767. @subsection Commands
  5768. This filter supports same @ref{commands} as options.
  5769. @section bm3d
  5770. Denoise frames using Block-Matching 3D algorithm.
  5771. The filter accepts the following options.
  5772. @table @option
  5773. @item sigma
  5774. Set denoising strength. Default value is 1.
  5775. Allowed range is from 0 to 999.9.
  5776. The denoising algorithm is very sensitive to sigma, so adjust it
  5777. according to the source.
  5778. @item block
  5779. Set local patch size. This sets dimensions in 2D.
  5780. @item bstep
  5781. Set sliding step for processing blocks. Default value is 4.
  5782. Allowed range is from 1 to 64.
  5783. Smaller values allows processing more reference blocks and is slower.
  5784. @item group
  5785. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5786. When set to 1, no block matching is done. Larger values allows more blocks
  5787. in single group.
  5788. Allowed range is from 1 to 256.
  5789. @item range
  5790. Set radius for search block matching. Default is 9.
  5791. Allowed range is from 1 to INT32_MAX.
  5792. @item mstep
  5793. Set step between two search locations for block matching. Default is 1.
  5794. Allowed range is from 1 to 64. Smaller is slower.
  5795. @item thmse
  5796. Set threshold of mean square error for block matching. Valid range is 0 to
  5797. INT32_MAX.
  5798. @item hdthr
  5799. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5800. Larger values results in stronger hard-thresholding filtering in frequency
  5801. domain.
  5802. @item estim
  5803. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5804. Default is @code{basic}.
  5805. @item ref
  5806. If enabled, filter will use 2nd stream for block matching.
  5807. Default is disabled for @code{basic} value of @var{estim} option,
  5808. and always enabled if value of @var{estim} is @code{final}.
  5809. @item planes
  5810. Set planes to filter. Default is all available except alpha.
  5811. @end table
  5812. @subsection Examples
  5813. @itemize
  5814. @item
  5815. Basic filtering with bm3d:
  5816. @example
  5817. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5818. @end example
  5819. @item
  5820. Same as above, but filtering only luma:
  5821. @example
  5822. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5823. @end example
  5824. @item
  5825. Same as above, but with both estimation modes:
  5826. @example
  5827. 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
  5828. @end example
  5829. @item
  5830. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5831. @example
  5832. 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
  5833. @end example
  5834. @end itemize
  5835. @section boxblur
  5836. Apply a boxblur algorithm to the input video.
  5837. It accepts the following parameters:
  5838. @table @option
  5839. @item luma_radius, lr
  5840. @item luma_power, lp
  5841. @item chroma_radius, cr
  5842. @item chroma_power, cp
  5843. @item alpha_radius, ar
  5844. @item alpha_power, ap
  5845. @end table
  5846. A description of the accepted options follows.
  5847. @table @option
  5848. @item luma_radius, lr
  5849. @item chroma_radius, cr
  5850. @item alpha_radius, ar
  5851. Set an expression for the box radius in pixels used for blurring the
  5852. corresponding input plane.
  5853. The radius value must be a non-negative number, and must not be
  5854. greater than the value of the expression @code{min(w,h)/2} for the
  5855. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5856. planes.
  5857. Default value for @option{luma_radius} is "2". If not specified,
  5858. @option{chroma_radius} and @option{alpha_radius} default to the
  5859. corresponding value set for @option{luma_radius}.
  5860. The expressions can contain the following constants:
  5861. @table @option
  5862. @item w
  5863. @item h
  5864. The input width and height in pixels.
  5865. @item cw
  5866. @item ch
  5867. The input chroma image width and height in pixels.
  5868. @item hsub
  5869. @item vsub
  5870. The horizontal and vertical chroma subsample values. For example, for the
  5871. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5872. @end table
  5873. @item luma_power, lp
  5874. @item chroma_power, cp
  5875. @item alpha_power, ap
  5876. Specify how many times the boxblur filter is applied to the
  5877. corresponding plane.
  5878. Default value for @option{luma_power} is 2. If not specified,
  5879. @option{chroma_power} and @option{alpha_power} default to the
  5880. corresponding value set for @option{luma_power}.
  5881. A value of 0 will disable the effect.
  5882. @end table
  5883. @subsection Examples
  5884. @itemize
  5885. @item
  5886. Apply a boxblur filter with the luma, chroma, and alpha radii
  5887. set to 2:
  5888. @example
  5889. boxblur=luma_radius=2:luma_power=1
  5890. boxblur=2:1
  5891. @end example
  5892. @item
  5893. Set the luma radius to 2, and alpha and chroma radius to 0:
  5894. @example
  5895. boxblur=2:1:cr=0:ar=0
  5896. @end example
  5897. @item
  5898. Set the luma and chroma radii to a fraction of the video dimension:
  5899. @example
  5900. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5901. @end example
  5902. @end itemize
  5903. @section bwdif
  5904. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5905. Deinterlacing Filter").
  5906. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5907. interpolation algorithms.
  5908. It accepts the following parameters:
  5909. @table @option
  5910. @item mode
  5911. The interlacing mode to adopt. It accepts one of the following values:
  5912. @table @option
  5913. @item 0, send_frame
  5914. Output one frame for each frame.
  5915. @item 1, send_field
  5916. Output one frame for each field.
  5917. @end table
  5918. The default value is @code{send_field}.
  5919. @item parity
  5920. The picture field parity assumed for the input interlaced video. It accepts one
  5921. of the following values:
  5922. @table @option
  5923. @item 0, tff
  5924. Assume the top field is first.
  5925. @item 1, bff
  5926. Assume the bottom field is first.
  5927. @item -1, auto
  5928. Enable automatic detection of field parity.
  5929. @end table
  5930. The default value is @code{auto}.
  5931. If the interlacing is unknown or the decoder does not export this information,
  5932. top field first will be assumed.
  5933. @item deint
  5934. Specify which frames to deinterlace. Accepts one of the following
  5935. values:
  5936. @table @option
  5937. @item 0, all
  5938. Deinterlace all frames.
  5939. @item 1, interlaced
  5940. Only deinterlace frames marked as interlaced.
  5941. @end table
  5942. The default value is @code{all}.
  5943. @end table
  5944. @section cas
  5945. Apply Contrast Adaptive Sharpen filter to video stream.
  5946. The filter accepts the following options:
  5947. @table @option
  5948. @item strength
  5949. Set the sharpening strength. Default value is 0.
  5950. @item planes
  5951. Set planes to filter. Default value is to filter all
  5952. planes except alpha plane.
  5953. @end table
  5954. @subsection Commands
  5955. This filter supports same @ref{commands} as options.
  5956. @section chromahold
  5957. Remove all color information for all colors except for certain one.
  5958. The filter accepts the following options:
  5959. @table @option
  5960. @item color
  5961. The color which will not be replaced with neutral chroma.
  5962. @item similarity
  5963. Similarity percentage with the above color.
  5964. 0.01 matches only the exact key color, while 1.0 matches everything.
  5965. @item blend
  5966. Blend percentage.
  5967. 0.0 makes pixels either fully gray, or not gray at all.
  5968. Higher values result in more preserved color.
  5969. @item yuv
  5970. Signals that the color passed is already in YUV instead of RGB.
  5971. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5972. This can be used to pass exact YUV values as hexadecimal numbers.
  5973. @end table
  5974. @subsection Commands
  5975. This filter supports same @ref{commands} as options.
  5976. The command accepts the same syntax of the corresponding option.
  5977. If the specified expression is not valid, it is kept at its current
  5978. value.
  5979. @section chromakey
  5980. YUV colorspace color/chroma keying.
  5981. The filter accepts the following options:
  5982. @table @option
  5983. @item color
  5984. The color which will be replaced with transparency.
  5985. @item similarity
  5986. Similarity percentage with the key color.
  5987. 0.01 matches only the exact key color, while 1.0 matches everything.
  5988. @item blend
  5989. Blend percentage.
  5990. 0.0 makes pixels either fully transparent, or not transparent at all.
  5991. Higher values result in semi-transparent pixels, with a higher transparency
  5992. the more similar the pixels color is to the key color.
  5993. @item yuv
  5994. Signals that the color passed is already in YUV instead of RGB.
  5995. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5996. This can be used to pass exact YUV values as hexadecimal numbers.
  5997. @end table
  5998. @subsection Commands
  5999. This filter supports same @ref{commands} as options.
  6000. The command accepts the same syntax of the corresponding option.
  6001. If the specified expression is not valid, it is kept at its current
  6002. value.
  6003. @subsection Examples
  6004. @itemize
  6005. @item
  6006. Make every green pixel in the input image transparent:
  6007. @example
  6008. ffmpeg -i input.png -vf chromakey=green out.png
  6009. @end example
  6010. @item
  6011. Overlay a greenscreen-video on top of a static black background.
  6012. @example
  6013. 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
  6014. @end example
  6015. @end itemize
  6016. @section chromanr
  6017. Reduce chrominance noise.
  6018. The filter accepts the following options:
  6019. @table @option
  6020. @item thres
  6021. Set threshold for averaging chrominance values.
  6022. Sum of absolute difference of Y, U and V pixel components of current
  6023. pixel and neighbour pixels lower than this threshold will be used in
  6024. averaging. Luma component is left unchanged and is copied to output.
  6025. Default value is 30. Allowed range is from 1 to 200.
  6026. @item sizew
  6027. Set horizontal radius of rectangle used for averaging.
  6028. Allowed range is from 1 to 100. Default value is 5.
  6029. @item sizeh
  6030. Set vertical radius of rectangle used for averaging.
  6031. Allowed range is from 1 to 100. Default value is 5.
  6032. @item stepw
  6033. Set horizontal step when averaging. Default value is 1.
  6034. Allowed range is from 1 to 50.
  6035. Mostly useful to speed-up filtering.
  6036. @item steph
  6037. Set vertical step when averaging. Default value is 1.
  6038. Allowed range is from 1 to 50.
  6039. Mostly useful to speed-up filtering.
  6040. @item threy
  6041. Set Y threshold for averaging chrominance values.
  6042. Set finer control for max allowed difference between Y components
  6043. of current pixel and neigbour pixels.
  6044. Default value is 200. Allowed range is from 1 to 200.
  6045. @item threu
  6046. Set U threshold for averaging chrominance values.
  6047. Set finer control for max allowed difference between U components
  6048. of current pixel and neigbour pixels.
  6049. Default value is 200. Allowed range is from 1 to 200.
  6050. @item threv
  6051. Set V threshold for averaging chrominance values.
  6052. Set finer control for max allowed difference between V components
  6053. of current pixel and neigbour pixels.
  6054. Default value is 200. Allowed range is from 1 to 200.
  6055. @end table
  6056. @subsection Commands
  6057. This filter supports same @ref{commands} as options.
  6058. The command accepts the same syntax of the corresponding option.
  6059. @section chromashift
  6060. Shift chroma pixels horizontally and/or vertically.
  6061. The filter accepts the following options:
  6062. @table @option
  6063. @item cbh
  6064. Set amount to shift chroma-blue horizontally.
  6065. @item cbv
  6066. Set amount to shift chroma-blue vertically.
  6067. @item crh
  6068. Set amount to shift chroma-red horizontally.
  6069. @item crv
  6070. Set amount to shift chroma-red vertically.
  6071. @item edge
  6072. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6073. @end table
  6074. @subsection Commands
  6075. This filter supports the all above options as @ref{commands}.
  6076. @section ciescope
  6077. Display CIE color diagram with pixels overlaid onto it.
  6078. The filter accepts the following options:
  6079. @table @option
  6080. @item system
  6081. Set color system.
  6082. @table @samp
  6083. @item ntsc, 470m
  6084. @item ebu, 470bg
  6085. @item smpte
  6086. @item 240m
  6087. @item apple
  6088. @item widergb
  6089. @item cie1931
  6090. @item rec709, hdtv
  6091. @item uhdtv, rec2020
  6092. @item dcip3
  6093. @end table
  6094. @item cie
  6095. Set CIE system.
  6096. @table @samp
  6097. @item xyy
  6098. @item ucs
  6099. @item luv
  6100. @end table
  6101. @item gamuts
  6102. Set what gamuts to draw.
  6103. See @code{system} option for available values.
  6104. @item size, s
  6105. Set ciescope size, by default set to 512.
  6106. @item intensity, i
  6107. Set intensity used to map input pixel values to CIE diagram.
  6108. @item contrast
  6109. Set contrast used to draw tongue colors that are out of active color system gamut.
  6110. @item corrgamma
  6111. Correct gamma displayed on scope, by default enabled.
  6112. @item showwhite
  6113. Show white point on CIE diagram, by default disabled.
  6114. @item gamma
  6115. Set input gamma. Used only with XYZ input color space.
  6116. @end table
  6117. @section codecview
  6118. Visualize information exported by some codecs.
  6119. Some codecs can export information through frames using side-data or other
  6120. means. For example, some MPEG based codecs export motion vectors through the
  6121. @var{export_mvs} flag in the codec @option{flags2} option.
  6122. The filter accepts the following option:
  6123. @table @option
  6124. @item mv
  6125. Set motion vectors to visualize.
  6126. Available flags for @var{mv} are:
  6127. @table @samp
  6128. @item pf
  6129. forward predicted MVs of P-frames
  6130. @item bf
  6131. forward predicted MVs of B-frames
  6132. @item bb
  6133. backward predicted MVs of B-frames
  6134. @end table
  6135. @item qp
  6136. Display quantization parameters using the chroma planes.
  6137. @item mv_type, mvt
  6138. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6139. Available flags for @var{mv_type} are:
  6140. @table @samp
  6141. @item fp
  6142. forward predicted MVs
  6143. @item bp
  6144. backward predicted MVs
  6145. @end table
  6146. @item frame_type, ft
  6147. Set frame type to visualize motion vectors of.
  6148. Available flags for @var{frame_type} are:
  6149. @table @samp
  6150. @item if
  6151. intra-coded frames (I-frames)
  6152. @item pf
  6153. predicted frames (P-frames)
  6154. @item bf
  6155. bi-directionally predicted frames (B-frames)
  6156. @end table
  6157. @end table
  6158. @subsection Examples
  6159. @itemize
  6160. @item
  6161. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6162. @example
  6163. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6164. @end example
  6165. @item
  6166. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6167. @example
  6168. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6169. @end example
  6170. @end itemize
  6171. @section colorbalance
  6172. Modify intensity of primary colors (red, green and blue) of input frames.
  6173. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6174. regions for the red-cyan, green-magenta or blue-yellow balance.
  6175. A positive adjustment value shifts the balance towards the primary color, a negative
  6176. value towards the complementary color.
  6177. The filter accepts the following options:
  6178. @table @option
  6179. @item rs
  6180. @item gs
  6181. @item bs
  6182. Adjust red, green and blue shadows (darkest pixels).
  6183. @item rm
  6184. @item gm
  6185. @item bm
  6186. Adjust red, green and blue midtones (medium pixels).
  6187. @item rh
  6188. @item gh
  6189. @item bh
  6190. Adjust red, green and blue highlights (brightest pixels).
  6191. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6192. @item pl
  6193. Preserve lightness when changing color balance. Default is disabled.
  6194. @end table
  6195. @subsection Examples
  6196. @itemize
  6197. @item
  6198. Add red color cast to shadows:
  6199. @example
  6200. colorbalance=rs=.3
  6201. @end example
  6202. @end itemize
  6203. @subsection Commands
  6204. This filter supports the all above options as @ref{commands}.
  6205. @section colorcontrast
  6206. Adjust color contrast between RGB components.
  6207. The filter accepts the following options:
  6208. @table @option
  6209. @item rc
  6210. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6211. @item gm
  6212. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6213. @item by
  6214. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6215. @item rcw
  6216. @item gmw
  6217. @item byw
  6218. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6219. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6220. @item pl
  6221. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6222. @end table
  6223. @subsection Commands
  6224. This filter supports the all above options as @ref{commands}.
  6225. @section colorcorrect
  6226. Adjust color white balance selectively for blacks and whites.
  6227. This filter operates in YUV colorspace.
  6228. The filter accepts the following options:
  6229. @table @option
  6230. @item rl
  6231. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6232. Default value is 0.
  6233. @item bl
  6234. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6235. Default value is 0.
  6236. @item rh
  6237. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6238. Default value is 0.
  6239. @item bh
  6240. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6241. Default value is 0.
  6242. @item saturation
  6243. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6244. Default value is 1.
  6245. @end table
  6246. @subsection Commands
  6247. This filter supports the all above options as @ref{commands}.
  6248. @section colorchannelmixer
  6249. Adjust video input frames by re-mixing color channels.
  6250. This filter modifies a color channel by adding the values associated to
  6251. the other channels of the same pixels. For example if the value to
  6252. modify is red, the output value will be:
  6253. @example
  6254. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6255. @end example
  6256. The filter accepts the following options:
  6257. @table @option
  6258. @item rr
  6259. @item rg
  6260. @item rb
  6261. @item ra
  6262. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6263. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6264. @item gr
  6265. @item gg
  6266. @item gb
  6267. @item ga
  6268. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6269. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6270. @item br
  6271. @item bg
  6272. @item bb
  6273. @item ba
  6274. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6275. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6276. @item ar
  6277. @item ag
  6278. @item ab
  6279. @item aa
  6280. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6281. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6282. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6283. @item pl
  6284. Preserve lightness when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6285. Default is @code{0.0}, thus disabled.
  6286. @end table
  6287. @subsection Examples
  6288. @itemize
  6289. @item
  6290. Convert source to grayscale:
  6291. @example
  6292. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6293. @end example
  6294. @item
  6295. Simulate sepia tones:
  6296. @example
  6297. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6298. @end example
  6299. @end itemize
  6300. @subsection Commands
  6301. This filter supports the all above options as @ref{commands}.
  6302. @section colorize
  6303. Overlay a solid color on the video stream.
  6304. The filter accepts the following options:
  6305. @table @option
  6306. @item hue
  6307. Set the color hue. Allowed range is from 0 to 360.
  6308. Default value is 0.
  6309. @item saturation
  6310. Set the color saturation. Allowed range is from 0 to 1.
  6311. Default value is 0.5.
  6312. @item lightness
  6313. Set the color lightness. Allowed range is from 0 to 1.
  6314. Default value is 0.5.
  6315. @item mix
  6316. Set the mix of source lightness. By default is set to 1.0.
  6317. Allowed range is from 0.0 to 1.0.
  6318. @end table
  6319. @subsection Commands
  6320. This filter supports the all above options as @ref{commands}.
  6321. @section colorkey
  6322. RGB colorspace color keying.
  6323. The filter accepts the following options:
  6324. @table @option
  6325. @item color
  6326. The color which will be replaced with transparency.
  6327. @item similarity
  6328. Similarity percentage with the key color.
  6329. 0.01 matches only the exact key color, while 1.0 matches everything.
  6330. @item blend
  6331. Blend percentage.
  6332. 0.0 makes pixels either fully transparent, or not transparent at all.
  6333. Higher values result in semi-transparent pixels, with a higher transparency
  6334. the more similar the pixels color is to the key color.
  6335. @end table
  6336. @subsection Examples
  6337. @itemize
  6338. @item
  6339. Make every green pixel in the input image transparent:
  6340. @example
  6341. ffmpeg -i input.png -vf colorkey=green out.png
  6342. @end example
  6343. @item
  6344. Overlay a greenscreen-video on top of a static background image.
  6345. @example
  6346. 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
  6347. @end example
  6348. @end itemize
  6349. @subsection Commands
  6350. This filter supports same @ref{commands} as options.
  6351. The command accepts the same syntax of the corresponding option.
  6352. If the specified expression is not valid, it is kept at its current
  6353. value.
  6354. @section colorhold
  6355. Remove all color information for all RGB colors except for certain one.
  6356. The filter accepts the following options:
  6357. @table @option
  6358. @item color
  6359. The color which will not be replaced with neutral gray.
  6360. @item similarity
  6361. Similarity percentage with the above color.
  6362. 0.01 matches only the exact key color, while 1.0 matches everything.
  6363. @item blend
  6364. Blend percentage. 0.0 makes pixels fully gray.
  6365. Higher values result in more preserved color.
  6366. @end table
  6367. @subsection Commands
  6368. This filter supports same @ref{commands} as options.
  6369. The command accepts the same syntax of the corresponding option.
  6370. If the specified expression is not valid, it is kept at its current
  6371. value.
  6372. @section colorlevels
  6373. Adjust video input frames using levels.
  6374. The filter accepts the following options:
  6375. @table @option
  6376. @item rimin
  6377. @item gimin
  6378. @item bimin
  6379. @item aimin
  6380. Adjust red, green, blue and alpha input black point.
  6381. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6382. @item rimax
  6383. @item gimax
  6384. @item bimax
  6385. @item aimax
  6386. Adjust red, green, blue and alpha input white point.
  6387. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6388. Input levels are used to lighten highlights (bright tones), darken shadows
  6389. (dark tones), change the balance of bright and dark tones.
  6390. @item romin
  6391. @item gomin
  6392. @item bomin
  6393. @item aomin
  6394. Adjust red, green, blue and alpha output black point.
  6395. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6396. @item romax
  6397. @item gomax
  6398. @item bomax
  6399. @item aomax
  6400. Adjust red, green, blue and alpha output white point.
  6401. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6402. Output levels allows manual selection of a constrained output level range.
  6403. @end table
  6404. @subsection Examples
  6405. @itemize
  6406. @item
  6407. Make video output darker:
  6408. @example
  6409. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6410. @end example
  6411. @item
  6412. Increase contrast:
  6413. @example
  6414. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6415. @end example
  6416. @item
  6417. Make video output lighter:
  6418. @example
  6419. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6420. @end example
  6421. @item
  6422. Increase brightness:
  6423. @example
  6424. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6425. @end example
  6426. @end itemize
  6427. @subsection Commands
  6428. This filter supports the all above options as @ref{commands}.
  6429. @section colormatrix
  6430. Convert color matrix.
  6431. The filter accepts the following options:
  6432. @table @option
  6433. @item src
  6434. @item dst
  6435. Specify the source and destination color matrix. Both values must be
  6436. specified.
  6437. The accepted values are:
  6438. @table @samp
  6439. @item bt709
  6440. BT.709
  6441. @item fcc
  6442. FCC
  6443. @item bt601
  6444. BT.601
  6445. @item bt470
  6446. BT.470
  6447. @item bt470bg
  6448. BT.470BG
  6449. @item smpte170m
  6450. SMPTE-170M
  6451. @item smpte240m
  6452. SMPTE-240M
  6453. @item bt2020
  6454. BT.2020
  6455. @end table
  6456. @end table
  6457. For example to convert from BT.601 to SMPTE-240M, use the command:
  6458. @example
  6459. colormatrix=bt601:smpte240m
  6460. @end example
  6461. @section colorspace
  6462. Convert colorspace, transfer characteristics or color primaries.
  6463. Input video needs to have an even size.
  6464. The filter accepts the following options:
  6465. @table @option
  6466. @anchor{all}
  6467. @item all
  6468. Specify all color properties at once.
  6469. The accepted values are:
  6470. @table @samp
  6471. @item bt470m
  6472. BT.470M
  6473. @item bt470bg
  6474. BT.470BG
  6475. @item bt601-6-525
  6476. BT.601-6 525
  6477. @item bt601-6-625
  6478. BT.601-6 625
  6479. @item bt709
  6480. BT.709
  6481. @item smpte170m
  6482. SMPTE-170M
  6483. @item smpte240m
  6484. SMPTE-240M
  6485. @item bt2020
  6486. BT.2020
  6487. @end table
  6488. @anchor{space}
  6489. @item space
  6490. Specify output colorspace.
  6491. The accepted values are:
  6492. @table @samp
  6493. @item bt709
  6494. BT.709
  6495. @item fcc
  6496. FCC
  6497. @item bt470bg
  6498. BT.470BG or BT.601-6 625
  6499. @item smpte170m
  6500. SMPTE-170M or BT.601-6 525
  6501. @item smpte240m
  6502. SMPTE-240M
  6503. @item ycgco
  6504. YCgCo
  6505. @item bt2020ncl
  6506. BT.2020 with non-constant luminance
  6507. @end table
  6508. @anchor{trc}
  6509. @item trc
  6510. Specify output transfer characteristics.
  6511. The accepted values are:
  6512. @table @samp
  6513. @item bt709
  6514. BT.709
  6515. @item bt470m
  6516. BT.470M
  6517. @item bt470bg
  6518. BT.470BG
  6519. @item gamma22
  6520. Constant gamma of 2.2
  6521. @item gamma28
  6522. Constant gamma of 2.8
  6523. @item smpte170m
  6524. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6525. @item smpte240m
  6526. SMPTE-240M
  6527. @item srgb
  6528. SRGB
  6529. @item iec61966-2-1
  6530. iec61966-2-1
  6531. @item iec61966-2-4
  6532. iec61966-2-4
  6533. @item xvycc
  6534. xvycc
  6535. @item bt2020-10
  6536. BT.2020 for 10-bits content
  6537. @item bt2020-12
  6538. BT.2020 for 12-bits content
  6539. @end table
  6540. @anchor{primaries}
  6541. @item primaries
  6542. Specify output color primaries.
  6543. The accepted values are:
  6544. @table @samp
  6545. @item bt709
  6546. BT.709
  6547. @item bt470m
  6548. BT.470M
  6549. @item bt470bg
  6550. BT.470BG or BT.601-6 625
  6551. @item smpte170m
  6552. SMPTE-170M or BT.601-6 525
  6553. @item smpte240m
  6554. SMPTE-240M
  6555. @item film
  6556. film
  6557. @item smpte431
  6558. SMPTE-431
  6559. @item smpte432
  6560. SMPTE-432
  6561. @item bt2020
  6562. BT.2020
  6563. @item jedec-p22
  6564. JEDEC P22 phosphors
  6565. @end table
  6566. @anchor{range}
  6567. @item range
  6568. Specify output color range.
  6569. The accepted values are:
  6570. @table @samp
  6571. @item tv
  6572. TV (restricted) range
  6573. @item mpeg
  6574. MPEG (restricted) range
  6575. @item pc
  6576. PC (full) range
  6577. @item jpeg
  6578. JPEG (full) range
  6579. @end table
  6580. @item format
  6581. Specify output color format.
  6582. The accepted values are:
  6583. @table @samp
  6584. @item yuv420p
  6585. YUV 4:2:0 planar 8-bits
  6586. @item yuv420p10
  6587. YUV 4:2:0 planar 10-bits
  6588. @item yuv420p12
  6589. YUV 4:2:0 planar 12-bits
  6590. @item yuv422p
  6591. YUV 4:2:2 planar 8-bits
  6592. @item yuv422p10
  6593. YUV 4:2:2 planar 10-bits
  6594. @item yuv422p12
  6595. YUV 4:2:2 planar 12-bits
  6596. @item yuv444p
  6597. YUV 4:4:4 planar 8-bits
  6598. @item yuv444p10
  6599. YUV 4:4:4 planar 10-bits
  6600. @item yuv444p12
  6601. YUV 4:4:4 planar 12-bits
  6602. @end table
  6603. @item fast
  6604. Do a fast conversion, which skips gamma/primary correction. This will take
  6605. significantly less CPU, but will be mathematically incorrect. To get output
  6606. compatible with that produced by the colormatrix filter, use fast=1.
  6607. @item dither
  6608. Specify dithering mode.
  6609. The accepted values are:
  6610. @table @samp
  6611. @item none
  6612. No dithering
  6613. @item fsb
  6614. Floyd-Steinberg dithering
  6615. @end table
  6616. @item wpadapt
  6617. Whitepoint adaptation mode.
  6618. The accepted values are:
  6619. @table @samp
  6620. @item bradford
  6621. Bradford whitepoint adaptation
  6622. @item vonkries
  6623. von Kries whitepoint adaptation
  6624. @item identity
  6625. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6626. @end table
  6627. @item iall
  6628. Override all input properties at once. Same accepted values as @ref{all}.
  6629. @item ispace
  6630. Override input colorspace. Same accepted values as @ref{space}.
  6631. @item iprimaries
  6632. Override input color primaries. Same accepted values as @ref{primaries}.
  6633. @item itrc
  6634. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6635. @item irange
  6636. Override input color range. Same accepted values as @ref{range}.
  6637. @end table
  6638. The filter converts the transfer characteristics, color space and color
  6639. primaries to the specified user values. The output value, if not specified,
  6640. is set to a default value based on the "all" property. If that property is
  6641. also not specified, the filter will log an error. The output color range and
  6642. format default to the same value as the input color range and format. The
  6643. input transfer characteristics, color space, color primaries and color range
  6644. should be set on the input data. If any of these are missing, the filter will
  6645. log an error and no conversion will take place.
  6646. For example to convert the input to SMPTE-240M, use the command:
  6647. @example
  6648. colorspace=smpte240m
  6649. @end example
  6650. @section colortemperature
  6651. Adjust color temperature in video to simulate variations in ambient color temperature.
  6652. The filter accepts the following options:
  6653. @table @option
  6654. @item temperature
  6655. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  6656. Default value is 6500 K.
  6657. @item mix
  6658. Set mixing with filtered output. Allowed range is from 0 to 1.
  6659. Default value is 1.
  6660. @item pl
  6661. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  6662. Default value is 0.
  6663. @end table
  6664. @subsection Commands
  6665. This filter supports same @ref{commands} as options.
  6666. @section convolution
  6667. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6668. The filter accepts the following options:
  6669. @table @option
  6670. @item 0m
  6671. @item 1m
  6672. @item 2m
  6673. @item 3m
  6674. Set matrix for each plane.
  6675. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6676. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6677. @item 0rdiv
  6678. @item 1rdiv
  6679. @item 2rdiv
  6680. @item 3rdiv
  6681. Set multiplier for calculated value for each plane.
  6682. If unset or 0, it will be sum of all matrix elements.
  6683. @item 0bias
  6684. @item 1bias
  6685. @item 2bias
  6686. @item 3bias
  6687. Set bias for each plane. This value is added to the result of the multiplication.
  6688. Useful for making the overall image brighter or darker. Default is 0.0.
  6689. @item 0mode
  6690. @item 1mode
  6691. @item 2mode
  6692. @item 3mode
  6693. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6694. Default is @var{square}.
  6695. @end table
  6696. @subsection Commands
  6697. This filter supports the all above options as @ref{commands}.
  6698. @subsection Examples
  6699. @itemize
  6700. @item
  6701. Apply sharpen:
  6702. @example
  6703. 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"
  6704. @end example
  6705. @item
  6706. Apply blur:
  6707. @example
  6708. 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"
  6709. @end example
  6710. @item
  6711. Apply edge enhance:
  6712. @example
  6713. 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"
  6714. @end example
  6715. @item
  6716. Apply edge detect:
  6717. @example
  6718. 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"
  6719. @end example
  6720. @item
  6721. Apply laplacian edge detector which includes diagonals:
  6722. @example
  6723. 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"
  6724. @end example
  6725. @item
  6726. Apply emboss:
  6727. @example
  6728. 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"
  6729. @end example
  6730. @end itemize
  6731. @section convolve
  6732. Apply 2D convolution of video stream in frequency domain using second stream
  6733. as impulse.
  6734. The filter accepts the following options:
  6735. @table @option
  6736. @item planes
  6737. Set which planes to process.
  6738. @item impulse
  6739. Set which impulse video frames will be processed, can be @var{first}
  6740. or @var{all}. Default is @var{all}.
  6741. @end table
  6742. The @code{convolve} filter also supports the @ref{framesync} options.
  6743. @section copy
  6744. Copy the input video source unchanged to the output. This is mainly useful for
  6745. testing purposes.
  6746. @anchor{coreimage}
  6747. @section coreimage
  6748. Video filtering on GPU using Apple's CoreImage API on OSX.
  6749. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6750. processed by video hardware. However, software-based OpenGL implementations
  6751. exist which means there is no guarantee for hardware processing. It depends on
  6752. the respective OSX.
  6753. There are many filters and image generators provided by Apple that come with a
  6754. large variety of options. The filter has to be referenced by its name along
  6755. with its options.
  6756. The coreimage filter accepts the following options:
  6757. @table @option
  6758. @item list_filters
  6759. List all available filters and generators along with all their respective
  6760. options as well as possible minimum and maximum values along with the default
  6761. values.
  6762. @example
  6763. list_filters=true
  6764. @end example
  6765. @item filter
  6766. Specify all filters by their respective name and options.
  6767. Use @var{list_filters} to determine all valid filter names and options.
  6768. Numerical options are specified by a float value and are automatically clamped
  6769. to their respective value range. Vector and color options have to be specified
  6770. by a list of space separated float values. Character escaping has to be done.
  6771. A special option name @code{default} is available to use default options for a
  6772. filter.
  6773. It is required to specify either @code{default} or at least one of the filter options.
  6774. All omitted options are used with their default values.
  6775. The syntax of the filter string is as follows:
  6776. @example
  6777. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6778. @end example
  6779. @item output_rect
  6780. Specify a rectangle where the output of the filter chain is copied into the
  6781. input image. It is given by a list of space separated float values:
  6782. @example
  6783. output_rect=x\ y\ width\ height
  6784. @end example
  6785. If not given, the output rectangle equals the dimensions of the input image.
  6786. The output rectangle is automatically cropped at the borders of the input
  6787. image. Negative values are valid for each component.
  6788. @example
  6789. output_rect=25\ 25\ 100\ 100
  6790. @end example
  6791. @end table
  6792. Several filters can be chained for successive processing without GPU-HOST
  6793. transfers allowing for fast processing of complex filter chains.
  6794. Currently, only filters with zero (generators) or exactly one (filters) input
  6795. image and one output image are supported. Also, transition filters are not yet
  6796. usable as intended.
  6797. Some filters generate output images with additional padding depending on the
  6798. respective filter kernel. The padding is automatically removed to ensure the
  6799. filter output has the same size as the input image.
  6800. For image generators, the size of the output image is determined by the
  6801. previous output image of the filter chain or the input image of the whole
  6802. filterchain, respectively. The generators do not use the pixel information of
  6803. this image to generate their output. However, the generated output is
  6804. blended onto this image, resulting in partial or complete coverage of the
  6805. output image.
  6806. The @ref{coreimagesrc} video source can be used for generating input images
  6807. which are directly fed into the filter chain. By using it, providing input
  6808. images by another video source or an input video is not required.
  6809. @subsection Examples
  6810. @itemize
  6811. @item
  6812. List all filters available:
  6813. @example
  6814. coreimage=list_filters=true
  6815. @end example
  6816. @item
  6817. Use the CIBoxBlur filter with default options to blur an image:
  6818. @example
  6819. coreimage=filter=CIBoxBlur@@default
  6820. @end example
  6821. @item
  6822. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6823. its center at 100x100 and a radius of 50 pixels:
  6824. @example
  6825. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6826. @end example
  6827. @item
  6828. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6829. given as complete and escaped command-line for Apple's standard bash shell:
  6830. @example
  6831. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6832. @end example
  6833. @end itemize
  6834. @section cover_rect
  6835. Cover a rectangular object
  6836. It accepts the following options:
  6837. @table @option
  6838. @item cover
  6839. Filepath of the optional cover image, needs to be in yuv420.
  6840. @item mode
  6841. Set covering mode.
  6842. It accepts the following values:
  6843. @table @samp
  6844. @item cover
  6845. cover it by the supplied image
  6846. @item blur
  6847. cover it by interpolating the surrounding pixels
  6848. @end table
  6849. Default value is @var{blur}.
  6850. @end table
  6851. @subsection Examples
  6852. @itemize
  6853. @item
  6854. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6855. @example
  6856. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6857. @end example
  6858. @end itemize
  6859. @section crop
  6860. Crop the input video to given dimensions.
  6861. It accepts the following parameters:
  6862. @table @option
  6863. @item w, out_w
  6864. The width of the output video. It defaults to @code{iw}.
  6865. This expression is evaluated only once during the filter
  6866. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6867. @item h, out_h
  6868. The height of the output video. It defaults to @code{ih}.
  6869. This expression is evaluated only once during the filter
  6870. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6871. @item x
  6872. The horizontal position, in the input video, of the left edge of the output
  6873. video. It defaults to @code{(in_w-out_w)/2}.
  6874. This expression is evaluated per-frame.
  6875. @item y
  6876. The vertical position, in the input video, of the top edge of the output video.
  6877. It defaults to @code{(in_h-out_h)/2}.
  6878. This expression is evaluated per-frame.
  6879. @item keep_aspect
  6880. If set to 1 will force the output display aspect ratio
  6881. to be the same of the input, by changing the output sample aspect
  6882. ratio. It defaults to 0.
  6883. @item exact
  6884. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6885. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6886. It defaults to 0.
  6887. @end table
  6888. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6889. expressions containing the following constants:
  6890. @table @option
  6891. @item x
  6892. @item y
  6893. The computed values for @var{x} and @var{y}. They are evaluated for
  6894. each new frame.
  6895. @item in_w
  6896. @item in_h
  6897. The input width and height.
  6898. @item iw
  6899. @item ih
  6900. These are the same as @var{in_w} and @var{in_h}.
  6901. @item out_w
  6902. @item out_h
  6903. The output (cropped) width and height.
  6904. @item ow
  6905. @item oh
  6906. These are the same as @var{out_w} and @var{out_h}.
  6907. @item a
  6908. same as @var{iw} / @var{ih}
  6909. @item sar
  6910. input sample aspect ratio
  6911. @item dar
  6912. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6913. @item hsub
  6914. @item vsub
  6915. horizontal and vertical chroma subsample values. For example for the
  6916. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6917. @item n
  6918. The number of the input frame, starting from 0.
  6919. @item pos
  6920. the position in the file of the input frame, NAN if unknown
  6921. @item t
  6922. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6923. @end table
  6924. The expression for @var{out_w} may depend on the value of @var{out_h},
  6925. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6926. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6927. evaluated after @var{out_w} and @var{out_h}.
  6928. The @var{x} and @var{y} parameters specify the expressions for the
  6929. position of the top-left corner of the output (non-cropped) area. They
  6930. are evaluated for each frame. If the evaluated value is not valid, it
  6931. is approximated to the nearest valid value.
  6932. The expression for @var{x} may depend on @var{y}, and the expression
  6933. for @var{y} may depend on @var{x}.
  6934. @subsection Examples
  6935. @itemize
  6936. @item
  6937. Crop area with size 100x100 at position (12,34).
  6938. @example
  6939. crop=100:100:12:34
  6940. @end example
  6941. Using named options, the example above becomes:
  6942. @example
  6943. crop=w=100:h=100:x=12:y=34
  6944. @end example
  6945. @item
  6946. Crop the central input area with size 100x100:
  6947. @example
  6948. crop=100:100
  6949. @end example
  6950. @item
  6951. Crop the central input area with size 2/3 of the input video:
  6952. @example
  6953. crop=2/3*in_w:2/3*in_h
  6954. @end example
  6955. @item
  6956. Crop the input video central square:
  6957. @example
  6958. crop=out_w=in_h
  6959. crop=in_h
  6960. @end example
  6961. @item
  6962. Delimit the rectangle with the top-left corner placed at position
  6963. 100:100 and the right-bottom corner corresponding to the right-bottom
  6964. corner of the input image.
  6965. @example
  6966. crop=in_w-100:in_h-100:100:100
  6967. @end example
  6968. @item
  6969. Crop 10 pixels from the left and right borders, and 20 pixels from
  6970. the top and bottom borders
  6971. @example
  6972. crop=in_w-2*10:in_h-2*20
  6973. @end example
  6974. @item
  6975. Keep only the bottom right quarter of the input image:
  6976. @example
  6977. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6978. @end example
  6979. @item
  6980. Crop height for getting Greek harmony:
  6981. @example
  6982. crop=in_w:1/PHI*in_w
  6983. @end example
  6984. @item
  6985. Apply trembling effect:
  6986. @example
  6987. 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)
  6988. @end example
  6989. @item
  6990. Apply erratic camera effect depending on timestamp:
  6991. @example
  6992. 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)"
  6993. @end example
  6994. @item
  6995. Set x depending on the value of y:
  6996. @example
  6997. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6998. @end example
  6999. @end itemize
  7000. @subsection Commands
  7001. This filter supports the following commands:
  7002. @table @option
  7003. @item w, out_w
  7004. @item h, out_h
  7005. @item x
  7006. @item y
  7007. Set width/height of the output video and the horizontal/vertical position
  7008. in the input video.
  7009. The command accepts the same syntax of the corresponding option.
  7010. If the specified expression is not valid, it is kept at its current
  7011. value.
  7012. @end table
  7013. @section cropdetect
  7014. Auto-detect the crop size.
  7015. It calculates the necessary cropping parameters and prints the
  7016. recommended parameters via the logging system. The detected dimensions
  7017. correspond to the non-black area of the input video.
  7018. It accepts the following parameters:
  7019. @table @option
  7020. @item limit
  7021. Set higher black value threshold, which can be optionally specified
  7022. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7023. value greater to the set value is considered non-black. It defaults to 24.
  7024. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7025. on the bitdepth of the pixel format.
  7026. @item round
  7027. The value which the width/height should be divisible by. It defaults to
  7028. 16. The offset is automatically adjusted to center the video. Use 2 to
  7029. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7030. encoding to most video codecs.
  7031. @item skip
  7032. Set the number of initial frames for which evaluation is skipped.
  7033. Default is 2. Range is 0 to INT_MAX.
  7034. @item reset_count, reset
  7035. Set the counter that determines after how many frames cropdetect will
  7036. reset the previously detected largest video area and start over to
  7037. detect the current optimal crop area. Default value is 0.
  7038. This can be useful when channel logos distort the video area. 0
  7039. indicates 'never reset', and returns the largest area encountered during
  7040. playback.
  7041. @end table
  7042. @anchor{cue}
  7043. @section cue
  7044. Delay video filtering until a given wallclock timestamp. The filter first
  7045. passes on @option{preroll} amount of frames, then it buffers at most
  7046. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7047. it forwards the buffered frames and also any subsequent frames coming in its
  7048. input.
  7049. The filter can be used synchronize the output of multiple ffmpeg processes for
  7050. realtime output devices like decklink. By putting the delay in the filtering
  7051. chain and pre-buffering frames the process can pass on data to output almost
  7052. immediately after the target wallclock timestamp is reached.
  7053. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7054. some use cases.
  7055. @table @option
  7056. @item cue
  7057. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7058. @item preroll
  7059. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7060. @item buffer
  7061. The maximum duration of content to buffer before waiting for the cue expressed
  7062. in seconds. Default is 0.
  7063. @end table
  7064. @anchor{curves}
  7065. @section curves
  7066. Apply color adjustments using curves.
  7067. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7068. component (red, green and blue) has its values defined by @var{N} key points
  7069. tied from each other using a smooth curve. The x-axis represents the pixel
  7070. values from the input frame, and the y-axis the new pixel values to be set for
  7071. the output frame.
  7072. By default, a component curve is defined by the two points @var{(0;0)} and
  7073. @var{(1;1)}. This creates a straight line where each original pixel value is
  7074. "adjusted" to its own value, which means no change to the image.
  7075. The filter allows you to redefine these two points and add some more. A new
  7076. curve (using a natural cubic spline interpolation) will be define to pass
  7077. smoothly through all these new coordinates. The new defined points needs to be
  7078. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7079. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7080. the vector spaces, the values will be clipped accordingly.
  7081. The filter accepts the following options:
  7082. @table @option
  7083. @item preset
  7084. Select one of the available color presets. This option can be used in addition
  7085. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7086. options takes priority on the preset values.
  7087. Available presets are:
  7088. @table @samp
  7089. @item none
  7090. @item color_negative
  7091. @item cross_process
  7092. @item darker
  7093. @item increase_contrast
  7094. @item lighter
  7095. @item linear_contrast
  7096. @item medium_contrast
  7097. @item negative
  7098. @item strong_contrast
  7099. @item vintage
  7100. @end table
  7101. Default is @code{none}.
  7102. @item master, m
  7103. Set the master key points. These points will define a second pass mapping. It
  7104. is sometimes called a "luminance" or "value" mapping. It can be used with
  7105. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7106. post-processing LUT.
  7107. @item red, r
  7108. Set the key points for the red component.
  7109. @item green, g
  7110. Set the key points for the green component.
  7111. @item blue, b
  7112. Set the key points for the blue component.
  7113. @item all
  7114. Set the key points for all components (not including master).
  7115. Can be used in addition to the other key points component
  7116. options. In this case, the unset component(s) will fallback on this
  7117. @option{all} setting.
  7118. @item psfile
  7119. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7120. @item plot
  7121. Save Gnuplot script of the curves in specified file.
  7122. @end table
  7123. To avoid some filtergraph syntax conflicts, each key points list need to be
  7124. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7125. @subsection Examples
  7126. @itemize
  7127. @item
  7128. Increase slightly the middle level of blue:
  7129. @example
  7130. curves=blue='0/0 0.5/0.58 1/1'
  7131. @end example
  7132. @item
  7133. Vintage effect:
  7134. @example
  7135. 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'
  7136. @end example
  7137. Here we obtain the following coordinates for each components:
  7138. @table @var
  7139. @item red
  7140. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7141. @item green
  7142. @code{(0;0) (0.50;0.48) (1;1)}
  7143. @item blue
  7144. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7145. @end table
  7146. @item
  7147. The previous example can also be achieved with the associated built-in preset:
  7148. @example
  7149. curves=preset=vintage
  7150. @end example
  7151. @item
  7152. Or simply:
  7153. @example
  7154. curves=vintage
  7155. @end example
  7156. @item
  7157. Use a Photoshop preset and redefine the points of the green component:
  7158. @example
  7159. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7160. @end example
  7161. @item
  7162. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7163. and @command{gnuplot}:
  7164. @example
  7165. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7166. gnuplot -p /tmp/curves.plt
  7167. @end example
  7168. @end itemize
  7169. @section datascope
  7170. Video data analysis filter.
  7171. This filter shows hexadecimal pixel values of part of video.
  7172. The filter accepts the following options:
  7173. @table @option
  7174. @item size, s
  7175. Set output video size.
  7176. @item x
  7177. Set x offset from where to pick pixels.
  7178. @item y
  7179. Set y offset from where to pick pixels.
  7180. @item mode
  7181. Set scope mode, can be one of the following:
  7182. @table @samp
  7183. @item mono
  7184. Draw hexadecimal pixel values with white color on black background.
  7185. @item color
  7186. Draw hexadecimal pixel values with input video pixel color on black
  7187. background.
  7188. @item color2
  7189. Draw hexadecimal pixel values on color background picked from input video,
  7190. the text color is picked in such way so its always visible.
  7191. @end table
  7192. @item axis
  7193. Draw rows and columns numbers on left and top of video.
  7194. @item opacity
  7195. Set background opacity.
  7196. @item format
  7197. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7198. @item components
  7199. Set pixel components to display. By default all pixel components are displayed.
  7200. @end table
  7201. @section dblur
  7202. Apply Directional blur filter.
  7203. The filter accepts the following options:
  7204. @table @option
  7205. @item angle
  7206. Set angle of directional blur. Default is @code{45}.
  7207. @item radius
  7208. Set radius of directional blur. Default is @code{5}.
  7209. @item planes
  7210. Set which planes to filter. By default all planes are filtered.
  7211. @end table
  7212. @subsection Commands
  7213. This filter supports same @ref{commands} as options.
  7214. The command accepts the same syntax of the corresponding option.
  7215. If the specified expression is not valid, it is kept at its current
  7216. value.
  7217. @section dctdnoiz
  7218. Denoise frames using 2D DCT (frequency domain filtering).
  7219. This filter is not designed for real time.
  7220. The filter accepts the following options:
  7221. @table @option
  7222. @item sigma, s
  7223. Set the noise sigma constant.
  7224. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7225. coefficient (absolute value) below this threshold with be dropped.
  7226. If you need a more advanced filtering, see @option{expr}.
  7227. Default is @code{0}.
  7228. @item overlap
  7229. Set number overlapping pixels for each block. Since the filter can be slow, you
  7230. may want to reduce this value, at the cost of a less effective filter and the
  7231. risk of various artefacts.
  7232. If the overlapping value doesn't permit processing the whole input width or
  7233. height, a warning will be displayed and according borders won't be denoised.
  7234. Default value is @var{blocksize}-1, which is the best possible setting.
  7235. @item expr, e
  7236. Set the coefficient factor expression.
  7237. For each coefficient of a DCT block, this expression will be evaluated as a
  7238. multiplier value for the coefficient.
  7239. If this is option is set, the @option{sigma} option will be ignored.
  7240. The absolute value of the coefficient can be accessed through the @var{c}
  7241. variable.
  7242. @item n
  7243. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7244. @var{blocksize}, which is the width and height of the processed blocks.
  7245. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7246. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7247. on the speed processing. Also, a larger block size does not necessarily means a
  7248. better de-noising.
  7249. @end table
  7250. @subsection Examples
  7251. Apply a denoise with a @option{sigma} of @code{4.5}:
  7252. @example
  7253. dctdnoiz=4.5
  7254. @end example
  7255. The same operation can be achieved using the expression system:
  7256. @example
  7257. dctdnoiz=e='gte(c, 4.5*3)'
  7258. @end example
  7259. Violent denoise using a block size of @code{16x16}:
  7260. @example
  7261. dctdnoiz=15:n=4
  7262. @end example
  7263. @section deband
  7264. Remove banding artifacts from input video.
  7265. It works by replacing banded pixels with average value of referenced pixels.
  7266. The filter accepts the following options:
  7267. @table @option
  7268. @item 1thr
  7269. @item 2thr
  7270. @item 3thr
  7271. @item 4thr
  7272. Set banding detection threshold for each plane. Default is 0.02.
  7273. Valid range is 0.00003 to 0.5.
  7274. If difference between current pixel and reference pixel is less than threshold,
  7275. it will be considered as banded.
  7276. @item range, r
  7277. Banding detection range in pixels. Default is 16. If positive, random number
  7278. in range 0 to set value will be used. If negative, exact absolute value
  7279. will be used.
  7280. The range defines square of four pixels around current pixel.
  7281. @item direction, d
  7282. Set direction in radians from which four pixel will be compared. If positive,
  7283. random direction from 0 to set direction will be picked. If negative, exact of
  7284. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7285. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7286. column.
  7287. @item blur, b
  7288. If enabled, current pixel is compared with average value of all four
  7289. surrounding pixels. The default is enabled. If disabled current pixel is
  7290. compared with all four surrounding pixels. The pixel is considered banded
  7291. if only all four differences with surrounding pixels are less than threshold.
  7292. @item coupling, c
  7293. If enabled, current pixel is changed if and only if all pixel components are banded,
  7294. e.g. banding detection threshold is triggered for all color components.
  7295. The default is disabled.
  7296. @end table
  7297. @subsection Commands
  7298. This filter supports the all above options as @ref{commands}.
  7299. @section deblock
  7300. Remove blocking artifacts from input video.
  7301. The filter accepts the following options:
  7302. @table @option
  7303. @item filter
  7304. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7305. This controls what kind of deblocking is applied.
  7306. @item block
  7307. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7308. @item alpha
  7309. @item beta
  7310. @item gamma
  7311. @item delta
  7312. Set blocking detection thresholds. Allowed range is 0 to 1.
  7313. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7314. Using higher threshold gives more deblocking strength.
  7315. Setting @var{alpha} controls threshold detection at exact edge of block.
  7316. Remaining options controls threshold detection near the edge. Each one for
  7317. below/above or left/right. Setting any of those to @var{0} disables
  7318. deblocking.
  7319. @item planes
  7320. Set planes to filter. Default is to filter all available planes.
  7321. @end table
  7322. @subsection Examples
  7323. @itemize
  7324. @item
  7325. Deblock using weak filter and block size of 4 pixels.
  7326. @example
  7327. deblock=filter=weak:block=4
  7328. @end example
  7329. @item
  7330. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7331. deblocking more edges.
  7332. @example
  7333. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7334. @end example
  7335. @item
  7336. Similar as above, but filter only first plane.
  7337. @example
  7338. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7339. @end example
  7340. @item
  7341. Similar as above, but filter only second and third plane.
  7342. @example
  7343. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7344. @end example
  7345. @end itemize
  7346. @subsection Commands
  7347. This filter supports the all above options as @ref{commands}.
  7348. @anchor{decimate}
  7349. @section decimate
  7350. Drop duplicated frames at regular intervals.
  7351. The filter accepts the following options:
  7352. @table @option
  7353. @item cycle
  7354. Set the number of frames from which one will be dropped. Setting this to
  7355. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7356. Default is @code{5}.
  7357. @item dupthresh
  7358. Set the threshold for duplicate detection. If the difference metric for a frame
  7359. is less than or equal to this value, then it is declared as duplicate. Default
  7360. is @code{1.1}
  7361. @item scthresh
  7362. Set scene change threshold. Default is @code{15}.
  7363. @item blockx
  7364. @item blocky
  7365. Set the size of the x and y-axis blocks used during metric calculations.
  7366. Larger blocks give better noise suppression, but also give worse detection of
  7367. small movements. Must be a power of two. Default is @code{32}.
  7368. @item ppsrc
  7369. Mark main input as a pre-processed input and activate clean source input
  7370. stream. This allows the input to be pre-processed with various filters to help
  7371. the metrics calculation while keeping the frame selection lossless. When set to
  7372. @code{1}, the first stream is for the pre-processed input, and the second
  7373. stream is the clean source from where the kept frames are chosen. Default is
  7374. @code{0}.
  7375. @item chroma
  7376. Set whether or not chroma is considered in the metric calculations. Default is
  7377. @code{1}.
  7378. @end table
  7379. @section deconvolve
  7380. Apply 2D deconvolution of video stream in frequency domain using second stream
  7381. as impulse.
  7382. The filter accepts the following options:
  7383. @table @option
  7384. @item planes
  7385. Set which planes to process.
  7386. @item impulse
  7387. Set which impulse video frames will be processed, can be @var{first}
  7388. or @var{all}. Default is @var{all}.
  7389. @item noise
  7390. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7391. and height are not same and not power of 2 or if stream prior to convolving
  7392. had noise.
  7393. @end table
  7394. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7395. @section dedot
  7396. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7397. It accepts the following options:
  7398. @table @option
  7399. @item m
  7400. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7401. @var{rainbows} for cross-color reduction.
  7402. @item lt
  7403. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7404. @item tl
  7405. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7406. @item tc
  7407. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7408. @item ct
  7409. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7410. @end table
  7411. @section deflate
  7412. Apply deflate effect to the video.
  7413. This filter replaces the pixel by the local(3x3) average by taking into account
  7414. only values lower than the pixel.
  7415. It accepts the following options:
  7416. @table @option
  7417. @item threshold0
  7418. @item threshold1
  7419. @item threshold2
  7420. @item threshold3
  7421. Limit the maximum change for each plane, default is 65535.
  7422. If 0, plane will remain unchanged.
  7423. @end table
  7424. @subsection Commands
  7425. This filter supports the all above options as @ref{commands}.
  7426. @section deflicker
  7427. Remove temporal frame luminance variations.
  7428. It accepts the following options:
  7429. @table @option
  7430. @item size, s
  7431. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7432. @item mode, m
  7433. Set averaging mode to smooth temporal luminance variations.
  7434. Available values are:
  7435. @table @samp
  7436. @item am
  7437. Arithmetic mean
  7438. @item gm
  7439. Geometric mean
  7440. @item hm
  7441. Harmonic mean
  7442. @item qm
  7443. Quadratic mean
  7444. @item cm
  7445. Cubic mean
  7446. @item pm
  7447. Power mean
  7448. @item median
  7449. Median
  7450. @end table
  7451. @item bypass
  7452. Do not actually modify frame. Useful when one only wants metadata.
  7453. @end table
  7454. @section dejudder
  7455. Remove judder produced by partially interlaced telecined content.
  7456. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7457. source was partially telecined content then the output of @code{pullup,dejudder}
  7458. will have a variable frame rate. May change the recorded frame rate of the
  7459. container. Aside from that change, this filter will not affect constant frame
  7460. rate video.
  7461. The option available in this filter is:
  7462. @table @option
  7463. @item cycle
  7464. Specify the length of the window over which the judder repeats.
  7465. Accepts any integer greater than 1. Useful values are:
  7466. @table @samp
  7467. @item 4
  7468. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7469. @item 5
  7470. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7471. @item 20
  7472. If a mixture of the two.
  7473. @end table
  7474. The default is @samp{4}.
  7475. @end table
  7476. @section delogo
  7477. Suppress a TV station logo by a simple interpolation of the surrounding
  7478. pixels. Just set a rectangle covering the logo and watch it disappear
  7479. (and sometimes something even uglier appear - your mileage may vary).
  7480. It accepts the following parameters:
  7481. @table @option
  7482. @item x
  7483. @item y
  7484. Specify the top left corner coordinates of the logo. They must be
  7485. specified.
  7486. @item w
  7487. @item h
  7488. Specify the width and height of the logo to clear. They must be
  7489. specified.
  7490. @item band, t
  7491. Specify the thickness of the fuzzy edge of the rectangle (added to
  7492. @var{w} and @var{h}). The default value is 1. This option is
  7493. deprecated, setting higher values should no longer be necessary and
  7494. is not recommended.
  7495. @item show
  7496. When set to 1, a green rectangle is drawn on the screen to simplify
  7497. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7498. The default value is 0.
  7499. The rectangle is drawn on the outermost pixels which will be (partly)
  7500. replaced with interpolated values. The values of the next pixels
  7501. immediately outside this rectangle in each direction will be used to
  7502. compute the interpolated pixel values inside the rectangle.
  7503. @end table
  7504. @subsection Examples
  7505. @itemize
  7506. @item
  7507. Set a rectangle covering the area with top left corner coordinates 0,0
  7508. and size 100x77, and a band of size 10:
  7509. @example
  7510. delogo=x=0:y=0:w=100:h=77:band=10
  7511. @end example
  7512. @end itemize
  7513. @anchor{derain}
  7514. @section derain
  7515. Remove the rain in the input image/video by applying the derain methods based on
  7516. convolutional neural networks. Supported models:
  7517. @itemize
  7518. @item
  7519. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7520. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7521. @end itemize
  7522. Training as well as model generation scripts are provided in
  7523. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7524. Native model files (.model) can be generated from TensorFlow model
  7525. files (.pb) by using tools/python/convert.py
  7526. The filter accepts the following options:
  7527. @table @option
  7528. @item filter_type
  7529. Specify which filter to use. This option accepts the following values:
  7530. @table @samp
  7531. @item derain
  7532. Derain filter. To conduct derain filter, you need to use a derain model.
  7533. @item dehaze
  7534. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7535. @end table
  7536. Default value is @samp{derain}.
  7537. @item dnn_backend
  7538. Specify which DNN backend to use for model loading and execution. This option accepts
  7539. the following values:
  7540. @table @samp
  7541. @item native
  7542. Native implementation of DNN loading and execution.
  7543. @item tensorflow
  7544. TensorFlow backend. To enable this backend you
  7545. need to install the TensorFlow for C library (see
  7546. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7547. @code{--enable-libtensorflow}
  7548. @end table
  7549. Default value is @samp{native}.
  7550. @item model
  7551. Set path to model file specifying network architecture and its parameters.
  7552. Note that different backends use different file formats. TensorFlow and native
  7553. backend can load files for only its format.
  7554. @end table
  7555. It can also be finished with @ref{dnn_processing} filter.
  7556. @section deshake
  7557. Attempt to fix small changes in horizontal and/or vertical shift. This
  7558. filter helps remove camera shake from hand-holding a camera, bumping a
  7559. tripod, moving on a vehicle, etc.
  7560. The filter accepts the following options:
  7561. @table @option
  7562. @item x
  7563. @item y
  7564. @item w
  7565. @item h
  7566. Specify a rectangular area where to limit the search for motion
  7567. vectors.
  7568. If desired the search for motion vectors can be limited to a
  7569. rectangular area of the frame defined by its top left corner, width
  7570. and height. These parameters have the same meaning as the drawbox
  7571. filter which can be used to visualise the position of the bounding
  7572. box.
  7573. This is useful when simultaneous movement of subjects within the frame
  7574. might be confused for camera motion by the motion vector search.
  7575. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7576. then the full frame is used. This allows later options to be set
  7577. without specifying the bounding box for the motion vector search.
  7578. Default - search the whole frame.
  7579. @item rx
  7580. @item ry
  7581. Specify the maximum extent of movement in x and y directions in the
  7582. range 0-64 pixels. Default 16.
  7583. @item edge
  7584. Specify how to generate pixels to fill blanks at the edge of the
  7585. frame. Available values are:
  7586. @table @samp
  7587. @item blank, 0
  7588. Fill zeroes at blank locations
  7589. @item original, 1
  7590. Original image at blank locations
  7591. @item clamp, 2
  7592. Extruded edge value at blank locations
  7593. @item mirror, 3
  7594. Mirrored edge at blank locations
  7595. @end table
  7596. Default value is @samp{mirror}.
  7597. @item blocksize
  7598. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7599. default 8.
  7600. @item contrast
  7601. Specify the contrast threshold for blocks. Only blocks with more than
  7602. the specified contrast (difference between darkest and lightest
  7603. pixels) will be considered. Range 1-255, default 125.
  7604. @item search
  7605. Specify the search strategy. Available values are:
  7606. @table @samp
  7607. @item exhaustive, 0
  7608. Set exhaustive search
  7609. @item less, 1
  7610. Set less exhaustive search.
  7611. @end table
  7612. Default value is @samp{exhaustive}.
  7613. @item filename
  7614. If set then a detailed log of the motion search is written to the
  7615. specified file.
  7616. @end table
  7617. @section despill
  7618. Remove unwanted contamination of foreground colors, caused by reflected color of
  7619. greenscreen or bluescreen.
  7620. This filter accepts the following options:
  7621. @table @option
  7622. @item type
  7623. Set what type of despill to use.
  7624. @item mix
  7625. Set how spillmap will be generated.
  7626. @item expand
  7627. Set how much to get rid of still remaining spill.
  7628. @item red
  7629. Controls amount of red in spill area.
  7630. @item green
  7631. Controls amount of green in spill area.
  7632. Should be -1 for greenscreen.
  7633. @item blue
  7634. Controls amount of blue in spill area.
  7635. Should be -1 for bluescreen.
  7636. @item brightness
  7637. Controls brightness of spill area, preserving colors.
  7638. @item alpha
  7639. Modify alpha from generated spillmap.
  7640. @end table
  7641. @subsection Commands
  7642. This filter supports the all above options as @ref{commands}.
  7643. @section detelecine
  7644. Apply an exact inverse of the telecine operation. It requires a predefined
  7645. pattern specified using the pattern option which must be the same as that passed
  7646. to the telecine filter.
  7647. This filter accepts the following options:
  7648. @table @option
  7649. @item first_field
  7650. @table @samp
  7651. @item top, t
  7652. top field first
  7653. @item bottom, b
  7654. bottom field first
  7655. The default value is @code{top}.
  7656. @end table
  7657. @item pattern
  7658. A string of numbers representing the pulldown pattern you wish to apply.
  7659. The default value is @code{23}.
  7660. @item start_frame
  7661. A number representing position of the first frame with respect to the telecine
  7662. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7663. @end table
  7664. @section dilation
  7665. Apply dilation effect to the video.
  7666. This filter replaces the pixel by the local(3x3) maximum.
  7667. It accepts the following options:
  7668. @table @option
  7669. @item threshold0
  7670. @item threshold1
  7671. @item threshold2
  7672. @item threshold3
  7673. Limit the maximum change for each plane, default is 65535.
  7674. If 0, plane will remain unchanged.
  7675. @item coordinates
  7676. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7677. pixels are used.
  7678. Flags to local 3x3 coordinates maps like this:
  7679. 1 2 3
  7680. 4 5
  7681. 6 7 8
  7682. @end table
  7683. @subsection Commands
  7684. This filter supports the all above options as @ref{commands}.
  7685. @section displace
  7686. Displace pixels as indicated by second and third input stream.
  7687. It takes three input streams and outputs one stream, the first input is the
  7688. source, and second and third input are displacement maps.
  7689. The second input specifies how much to displace pixels along the
  7690. x-axis, while the third input specifies how much to displace pixels
  7691. along the y-axis.
  7692. If one of displacement map streams terminates, last frame from that
  7693. displacement map will be used.
  7694. Note that once generated, displacements maps can be reused over and over again.
  7695. A description of the accepted options follows.
  7696. @table @option
  7697. @item edge
  7698. Set displace behavior for pixels that are out of range.
  7699. Available values are:
  7700. @table @samp
  7701. @item blank
  7702. Missing pixels are replaced by black pixels.
  7703. @item smear
  7704. Adjacent pixels will spread out to replace missing pixels.
  7705. @item wrap
  7706. Out of range pixels are wrapped so they point to pixels of other side.
  7707. @item mirror
  7708. Out of range pixels will be replaced with mirrored pixels.
  7709. @end table
  7710. Default is @samp{smear}.
  7711. @end table
  7712. @subsection Examples
  7713. @itemize
  7714. @item
  7715. Add ripple effect to rgb input of video size hd720:
  7716. @example
  7717. 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
  7718. @end example
  7719. @item
  7720. Add wave effect to rgb input of video size hd720:
  7721. @example
  7722. 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
  7723. @end example
  7724. @end itemize
  7725. @anchor{dnn_processing}
  7726. @section dnn_processing
  7727. Do image processing with deep neural networks. It works together with another filter
  7728. which converts the pixel format of the Frame to what the dnn network requires.
  7729. The filter accepts the following options:
  7730. @table @option
  7731. @item dnn_backend
  7732. Specify which DNN backend to use for model loading and execution. This option accepts
  7733. the following values:
  7734. @table @samp
  7735. @item native
  7736. Native implementation of DNN loading and execution.
  7737. @item tensorflow
  7738. TensorFlow backend. To enable this backend you
  7739. need to install the TensorFlow for C library (see
  7740. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7741. @code{--enable-libtensorflow}
  7742. @item openvino
  7743. OpenVINO backend. To enable this backend you
  7744. need to build and install the OpenVINO for C library (see
  7745. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7746. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7747. be needed if the header files and libraries are not installed into system path)
  7748. @end table
  7749. Default value is @samp{native}.
  7750. @item model
  7751. Set path to model file specifying network architecture and its parameters.
  7752. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7753. backend can load files for only its format.
  7754. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7755. @item input
  7756. Set the input name of the dnn network.
  7757. @item output
  7758. Set the output name of the dnn network.
  7759. @item async
  7760. use DNN async execution if set (default: set),
  7761. roll back to sync execution if the backend does not support async.
  7762. @end table
  7763. @subsection Examples
  7764. @itemize
  7765. @item
  7766. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7767. @example
  7768. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7769. @end example
  7770. @item
  7771. Halve the pixel value of the frame with format gray32f:
  7772. @example
  7773. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  7774. @end example
  7775. @item
  7776. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7777. @example
  7778. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  7779. @end example
  7780. @item
  7781. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7782. @example
  7783. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7784. @end example
  7785. @end itemize
  7786. @section drawbox
  7787. Draw a colored box on the input image.
  7788. It accepts the following parameters:
  7789. @table @option
  7790. @item x
  7791. @item y
  7792. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7793. @item width, w
  7794. @item height, h
  7795. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7796. the input width and height. It defaults to 0.
  7797. @item color, c
  7798. Specify the color of the box to write. For the general syntax of this option,
  7799. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7800. value @code{invert} is used, the box edge color is the same as the
  7801. video with inverted luma.
  7802. @item thickness, t
  7803. The expression which sets the thickness of the box edge.
  7804. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7805. See below for the list of accepted constants.
  7806. @item replace
  7807. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7808. will overwrite the video's color and alpha pixels.
  7809. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7810. @end table
  7811. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7812. following constants:
  7813. @table @option
  7814. @item dar
  7815. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7816. @item hsub
  7817. @item vsub
  7818. horizontal and vertical chroma subsample values. For example for the
  7819. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7820. @item in_h, ih
  7821. @item in_w, iw
  7822. The input width and height.
  7823. @item sar
  7824. The input sample aspect ratio.
  7825. @item x
  7826. @item y
  7827. The x and y offset coordinates where the box is drawn.
  7828. @item w
  7829. @item h
  7830. The width and height of the drawn box.
  7831. @item t
  7832. The thickness of the drawn box.
  7833. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7834. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7835. @end table
  7836. @subsection Examples
  7837. @itemize
  7838. @item
  7839. Draw a black box around the edge of the input image:
  7840. @example
  7841. drawbox
  7842. @end example
  7843. @item
  7844. Draw a box with color red and an opacity of 50%:
  7845. @example
  7846. drawbox=10:20:200:60:red@@0.5
  7847. @end example
  7848. The previous example can be specified as:
  7849. @example
  7850. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7851. @end example
  7852. @item
  7853. Fill the box with pink color:
  7854. @example
  7855. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7856. @end example
  7857. @item
  7858. Draw a 2-pixel red 2.40:1 mask:
  7859. @example
  7860. 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
  7861. @end example
  7862. @end itemize
  7863. @subsection Commands
  7864. This filter supports same commands as options.
  7865. The command accepts the same syntax of the corresponding option.
  7866. If the specified expression is not valid, it is kept at its current
  7867. value.
  7868. @anchor{drawgraph}
  7869. @section drawgraph
  7870. Draw a graph using input video metadata.
  7871. It accepts the following parameters:
  7872. @table @option
  7873. @item m1
  7874. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7875. @item fg1
  7876. Set 1st foreground color expression.
  7877. @item m2
  7878. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7879. @item fg2
  7880. Set 2nd foreground color expression.
  7881. @item m3
  7882. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7883. @item fg3
  7884. Set 3rd foreground color expression.
  7885. @item m4
  7886. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7887. @item fg4
  7888. Set 4th foreground color expression.
  7889. @item min
  7890. Set minimal value of metadata value.
  7891. @item max
  7892. Set maximal value of metadata value.
  7893. @item bg
  7894. Set graph background color. Default is white.
  7895. @item mode
  7896. Set graph mode.
  7897. Available values for mode is:
  7898. @table @samp
  7899. @item bar
  7900. @item dot
  7901. @item line
  7902. @end table
  7903. Default is @code{line}.
  7904. @item slide
  7905. Set slide mode.
  7906. Available values for slide is:
  7907. @table @samp
  7908. @item frame
  7909. Draw new frame when right border is reached.
  7910. @item replace
  7911. Replace old columns with new ones.
  7912. @item scroll
  7913. Scroll from right to left.
  7914. @item rscroll
  7915. Scroll from left to right.
  7916. @item picture
  7917. Draw single picture.
  7918. @end table
  7919. Default is @code{frame}.
  7920. @item size
  7921. Set size of graph video. For the syntax of this option, check the
  7922. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7923. The default value is @code{900x256}.
  7924. @item rate, r
  7925. Set the output frame rate. Default value is @code{25}.
  7926. The foreground color expressions can use the following variables:
  7927. @table @option
  7928. @item MIN
  7929. Minimal value of metadata value.
  7930. @item MAX
  7931. Maximal value of metadata value.
  7932. @item VAL
  7933. Current metadata key value.
  7934. @end table
  7935. The color is defined as 0xAABBGGRR.
  7936. @end table
  7937. Example using metadata from @ref{signalstats} filter:
  7938. @example
  7939. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7940. @end example
  7941. Example using metadata from @ref{ebur128} filter:
  7942. @example
  7943. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7944. @end example
  7945. @section drawgrid
  7946. Draw a grid on the input image.
  7947. It accepts the following parameters:
  7948. @table @option
  7949. @item x
  7950. @item y
  7951. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7952. @item width, w
  7953. @item height, h
  7954. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7955. input width and height, respectively, minus @code{thickness}, so image gets
  7956. framed. Default to 0.
  7957. @item color, c
  7958. Specify the color of the grid. For the general syntax of this option,
  7959. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7960. value @code{invert} is used, the grid color is the same as the
  7961. video with inverted luma.
  7962. @item thickness, t
  7963. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7964. See below for the list of accepted constants.
  7965. @item replace
  7966. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7967. will overwrite the video's color and alpha pixels.
  7968. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7969. @end table
  7970. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7971. following constants:
  7972. @table @option
  7973. @item dar
  7974. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7975. @item hsub
  7976. @item vsub
  7977. horizontal and vertical chroma subsample values. For example for the
  7978. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7979. @item in_h, ih
  7980. @item in_w, iw
  7981. The input grid cell width and height.
  7982. @item sar
  7983. The input sample aspect ratio.
  7984. @item x
  7985. @item y
  7986. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7987. @item w
  7988. @item h
  7989. The width and height of the drawn cell.
  7990. @item t
  7991. The thickness of the drawn cell.
  7992. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7993. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7994. @end table
  7995. @subsection Examples
  7996. @itemize
  7997. @item
  7998. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7999. @example
  8000. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  8001. @end example
  8002. @item
  8003. Draw a white 3x3 grid with an opacity of 50%:
  8004. @example
  8005. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  8006. @end example
  8007. @end itemize
  8008. @subsection Commands
  8009. This filter supports same commands as options.
  8010. The command accepts the same syntax of the corresponding option.
  8011. If the specified expression is not valid, it is kept at its current
  8012. value.
  8013. @anchor{drawtext}
  8014. @section drawtext
  8015. Draw a text string or text from a specified file on top of a video, using the
  8016. libfreetype library.
  8017. To enable compilation of this filter, you need to configure FFmpeg with
  8018. @code{--enable-libfreetype}.
  8019. To enable default font fallback and the @var{font} option you need to
  8020. configure FFmpeg with @code{--enable-libfontconfig}.
  8021. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  8022. @code{--enable-libfribidi}.
  8023. @subsection Syntax
  8024. It accepts the following parameters:
  8025. @table @option
  8026. @item box
  8027. Used to draw a box around text using the background color.
  8028. The value must be either 1 (enable) or 0 (disable).
  8029. The default value of @var{box} is 0.
  8030. @item boxborderw
  8031. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8032. The default value of @var{boxborderw} is 0.
  8033. @item boxcolor
  8034. The color to be used for drawing box around text. For the syntax of this
  8035. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8036. The default value of @var{boxcolor} is "white".
  8037. @item line_spacing
  8038. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8039. The default value of @var{line_spacing} is 0.
  8040. @item borderw
  8041. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8042. The default value of @var{borderw} is 0.
  8043. @item bordercolor
  8044. Set the color to be used for drawing border around text. For the syntax of this
  8045. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8046. The default value of @var{bordercolor} is "black".
  8047. @item expansion
  8048. Select how the @var{text} is expanded. Can be either @code{none},
  8049. @code{strftime} (deprecated) or
  8050. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8051. below for details.
  8052. @item basetime
  8053. Set a start time for the count. Value is in microseconds. Only applied
  8054. in the deprecated strftime expansion mode. To emulate in normal expansion
  8055. mode use the @code{pts} function, supplying the start time (in seconds)
  8056. as the second argument.
  8057. @item fix_bounds
  8058. If true, check and fix text coords to avoid clipping.
  8059. @item fontcolor
  8060. The color to be used for drawing fonts. For the syntax of this option, check
  8061. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8062. The default value of @var{fontcolor} is "black".
  8063. @item fontcolor_expr
  8064. String which is expanded the same way as @var{text} to obtain dynamic
  8065. @var{fontcolor} value. By default this option has empty value and is not
  8066. processed. When this option is set, it overrides @var{fontcolor} option.
  8067. @item font
  8068. The font family to be used for drawing text. By default Sans.
  8069. @item fontfile
  8070. The font file to be used for drawing text. The path must be included.
  8071. This parameter is mandatory if the fontconfig support is disabled.
  8072. @item alpha
  8073. Draw the text applying alpha blending. The value can
  8074. be a number between 0.0 and 1.0.
  8075. The expression accepts the same variables @var{x, y} as well.
  8076. The default value is 1.
  8077. Please see @var{fontcolor_expr}.
  8078. @item fontsize
  8079. The font size to be used for drawing text.
  8080. The default value of @var{fontsize} is 16.
  8081. @item text_shaping
  8082. If set to 1, attempt to shape the text (for example, reverse the order of
  8083. right-to-left text and join Arabic characters) before drawing it.
  8084. Otherwise, just draw the text exactly as given.
  8085. By default 1 (if supported).
  8086. @item ft_load_flags
  8087. The flags to be used for loading the fonts.
  8088. The flags map the corresponding flags supported by libfreetype, and are
  8089. a combination of the following values:
  8090. @table @var
  8091. @item default
  8092. @item no_scale
  8093. @item no_hinting
  8094. @item render
  8095. @item no_bitmap
  8096. @item vertical_layout
  8097. @item force_autohint
  8098. @item crop_bitmap
  8099. @item pedantic
  8100. @item ignore_global_advance_width
  8101. @item no_recurse
  8102. @item ignore_transform
  8103. @item monochrome
  8104. @item linear_design
  8105. @item no_autohint
  8106. @end table
  8107. Default value is "default".
  8108. For more information consult the documentation for the FT_LOAD_*
  8109. libfreetype flags.
  8110. @item shadowcolor
  8111. The color to be used for drawing a shadow behind the drawn text. For the
  8112. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8113. ffmpeg-utils manual,ffmpeg-utils}.
  8114. The default value of @var{shadowcolor} is "black".
  8115. @item shadowx
  8116. @item shadowy
  8117. The x and y offsets for the text shadow position with respect to the
  8118. position of the text. They can be either positive or negative
  8119. values. The default value for both is "0".
  8120. @item start_number
  8121. The starting frame number for the n/frame_num variable. The default value
  8122. is "0".
  8123. @item tabsize
  8124. The size in number of spaces to use for rendering the tab.
  8125. Default value is 4.
  8126. @item timecode
  8127. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8128. format. It can be used with or without text parameter. @var{timecode_rate}
  8129. option must be specified.
  8130. @item timecode_rate, rate, r
  8131. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8132. integer. Minimum value is "1".
  8133. Drop-frame timecode is supported for frame rates 30 & 60.
  8134. @item tc24hmax
  8135. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8136. Default is 0 (disabled).
  8137. @item text
  8138. The text string to be drawn. The text must be a sequence of UTF-8
  8139. encoded characters.
  8140. This parameter is mandatory if no file is specified with the parameter
  8141. @var{textfile}.
  8142. @item textfile
  8143. A text file containing text to be drawn. The text must be a sequence
  8144. of UTF-8 encoded characters.
  8145. This parameter is mandatory if no text string is specified with the
  8146. parameter @var{text}.
  8147. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8148. @item reload
  8149. If set to 1, the @var{textfile} will be reloaded before each frame.
  8150. Be sure to update it atomically, or it may be read partially, or even fail.
  8151. @item x
  8152. @item y
  8153. The expressions which specify the offsets where text will be drawn
  8154. within the video frame. They are relative to the top/left border of the
  8155. output image.
  8156. The default value of @var{x} and @var{y} is "0".
  8157. See below for the list of accepted constants and functions.
  8158. @end table
  8159. The parameters for @var{x} and @var{y} are expressions containing the
  8160. following constants and functions:
  8161. @table @option
  8162. @item dar
  8163. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8164. @item hsub
  8165. @item vsub
  8166. horizontal and vertical chroma subsample values. For example for the
  8167. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8168. @item line_h, lh
  8169. the height of each text line
  8170. @item main_h, h, H
  8171. the input height
  8172. @item main_w, w, W
  8173. the input width
  8174. @item max_glyph_a, ascent
  8175. the maximum distance from the baseline to the highest/upper grid
  8176. coordinate used to place a glyph outline point, for all the rendered
  8177. glyphs.
  8178. It is a positive value, due to the grid's orientation with the Y axis
  8179. upwards.
  8180. @item max_glyph_d, descent
  8181. the maximum distance from the baseline to the lowest grid coordinate
  8182. used to place a glyph outline point, for all the rendered glyphs.
  8183. This is a negative value, due to the grid's orientation, with the Y axis
  8184. upwards.
  8185. @item max_glyph_h
  8186. maximum glyph height, that is the maximum height for all the glyphs
  8187. contained in the rendered text, it is equivalent to @var{ascent} -
  8188. @var{descent}.
  8189. @item max_glyph_w
  8190. maximum glyph width, that is the maximum width for all the glyphs
  8191. contained in the rendered text
  8192. @item n
  8193. the number of input frame, starting from 0
  8194. @item rand(min, max)
  8195. return a random number included between @var{min} and @var{max}
  8196. @item sar
  8197. The input sample aspect ratio.
  8198. @item t
  8199. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8200. @item text_h, th
  8201. the height of the rendered text
  8202. @item text_w, tw
  8203. the width of the rendered text
  8204. @item x
  8205. @item y
  8206. the x and y offset coordinates where the text is drawn.
  8207. These parameters allow the @var{x} and @var{y} expressions to refer
  8208. to each other, so you can for example specify @code{y=x/dar}.
  8209. @item pict_type
  8210. A one character description of the current frame's picture type.
  8211. @item pkt_pos
  8212. The current packet's position in the input file or stream
  8213. (in bytes, from the start of the input). A value of -1 indicates
  8214. this info is not available.
  8215. @item pkt_duration
  8216. The current packet's duration, in seconds.
  8217. @item pkt_size
  8218. The current packet's size (in bytes).
  8219. @end table
  8220. @anchor{drawtext_expansion}
  8221. @subsection Text expansion
  8222. If @option{expansion} is set to @code{strftime},
  8223. the filter recognizes strftime() sequences in the provided text and
  8224. expands them accordingly. Check the documentation of strftime(). This
  8225. feature is deprecated.
  8226. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8227. If @option{expansion} is set to @code{normal} (which is the default),
  8228. the following expansion mechanism is used.
  8229. The backslash character @samp{\}, followed by any character, always expands to
  8230. the second character.
  8231. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8232. braces is a function name, possibly followed by arguments separated by ':'.
  8233. If the arguments contain special characters or delimiters (':' or '@}'),
  8234. they should be escaped.
  8235. Note that they probably must also be escaped as the value for the
  8236. @option{text} option in the filter argument string and as the filter
  8237. argument in the filtergraph description, and possibly also for the shell,
  8238. that makes up to four levels of escaping; using a text file avoids these
  8239. problems.
  8240. The following functions are available:
  8241. @table @command
  8242. @item expr, e
  8243. The expression evaluation result.
  8244. It must take one argument specifying the expression to be evaluated,
  8245. which accepts the same constants and functions as the @var{x} and
  8246. @var{y} values. Note that not all constants should be used, for
  8247. example the text size is not known when evaluating the expression, so
  8248. the constants @var{text_w} and @var{text_h} will have an undefined
  8249. value.
  8250. @item expr_int_format, eif
  8251. Evaluate the expression's value and output as formatted integer.
  8252. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8253. The second argument specifies the output format. Allowed values are @samp{x},
  8254. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8255. @code{printf} function.
  8256. The third parameter is optional and sets the number of positions taken by the output.
  8257. It can be used to add padding with zeros from the left.
  8258. @item gmtime
  8259. The time at which the filter is running, expressed in UTC.
  8260. It can accept an argument: a strftime() format string.
  8261. @item localtime
  8262. The time at which the filter is running, expressed in the local time zone.
  8263. It can accept an argument: a strftime() format string.
  8264. @item metadata
  8265. Frame metadata. Takes one or two arguments.
  8266. The first argument is mandatory and specifies the metadata key.
  8267. The second argument is optional and specifies a default value, used when the
  8268. metadata key is not found or empty.
  8269. Available metadata can be identified by inspecting entries
  8270. starting with TAG included within each frame section
  8271. printed by running @code{ffprobe -show_frames}.
  8272. String metadata generated in filters leading to
  8273. the drawtext filter are also available.
  8274. @item n, frame_num
  8275. The frame number, starting from 0.
  8276. @item pict_type
  8277. A one character description of the current picture type.
  8278. @item pts
  8279. The timestamp of the current frame.
  8280. It can take up to three arguments.
  8281. The first argument is the format of the timestamp; it defaults to @code{flt}
  8282. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8283. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8284. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8285. @code{localtime} stands for the timestamp of the frame formatted as
  8286. local time zone time.
  8287. The second argument is an offset added to the timestamp.
  8288. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8289. supplied to present the hour part of the formatted timestamp in 24h format
  8290. (00-23).
  8291. If the format is set to @code{localtime} or @code{gmtime},
  8292. a third argument may be supplied: a strftime() format string.
  8293. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8294. @end table
  8295. @subsection Commands
  8296. This filter supports altering parameters via commands:
  8297. @table @option
  8298. @item reinit
  8299. Alter existing filter parameters.
  8300. Syntax for the argument is the same as for filter invocation, e.g.
  8301. @example
  8302. fontsize=56:fontcolor=green:text='Hello World'
  8303. @end example
  8304. Full filter invocation with sendcmd would look like this:
  8305. @example
  8306. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8307. @end example
  8308. @end table
  8309. If the entire argument can't be parsed or applied as valid values then the filter will
  8310. continue with its existing parameters.
  8311. @subsection Examples
  8312. @itemize
  8313. @item
  8314. Draw "Test Text" with font FreeSerif, using the default values for the
  8315. optional parameters.
  8316. @example
  8317. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8318. @end example
  8319. @item
  8320. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8321. and y=50 (counting from the top-left corner of the screen), text is
  8322. yellow with a red box around it. Both the text and the box have an
  8323. opacity of 20%.
  8324. @example
  8325. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8326. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8327. @end example
  8328. Note that the double quotes are not necessary if spaces are not used
  8329. within the parameter list.
  8330. @item
  8331. Show the text at the center of the video frame:
  8332. @example
  8333. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8334. @end example
  8335. @item
  8336. Show the text at a random position, switching to a new position every 30 seconds:
  8337. @example
  8338. 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)"
  8339. @end example
  8340. @item
  8341. Show a text line sliding from right to left in the last row of the video
  8342. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8343. with no newlines.
  8344. @example
  8345. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8346. @end example
  8347. @item
  8348. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8349. @example
  8350. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8351. @end example
  8352. @item
  8353. Draw a single green letter "g", at the center of the input video.
  8354. The glyph baseline is placed at half screen height.
  8355. @example
  8356. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8357. @end example
  8358. @item
  8359. Show text for 1 second every 3 seconds:
  8360. @example
  8361. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8362. @end example
  8363. @item
  8364. Use fontconfig to set the font. Note that the colons need to be escaped.
  8365. @example
  8366. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8367. @end example
  8368. @item
  8369. Draw "Test Text" with font size dependent on height of the video.
  8370. @example
  8371. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8372. @end example
  8373. @item
  8374. Print the date of a real-time encoding (see strftime(3)):
  8375. @example
  8376. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8377. @end example
  8378. @item
  8379. Show text fading in and out (appearing/disappearing):
  8380. @example
  8381. #!/bin/sh
  8382. DS=1.0 # display start
  8383. DE=10.0 # display end
  8384. FID=1.5 # fade in duration
  8385. FOD=5 # fade out duration
  8386. 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 @}"
  8387. @end example
  8388. @item
  8389. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8390. and the @option{fontsize} value are included in the @option{y} offset.
  8391. @example
  8392. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8393. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8394. @end example
  8395. @item
  8396. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8397. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8398. must have option @option{-export_path_metadata 1} for the special metadata fields
  8399. to be available for filters.
  8400. @example
  8401. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8402. @end example
  8403. @end itemize
  8404. For more information about libfreetype, check:
  8405. @url{http://www.freetype.org/}.
  8406. For more information about fontconfig, check:
  8407. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8408. For more information about libfribidi, check:
  8409. @url{http://fribidi.org/}.
  8410. @section edgedetect
  8411. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8412. The filter accepts the following options:
  8413. @table @option
  8414. @item low
  8415. @item high
  8416. Set low and high threshold values used by the Canny thresholding
  8417. algorithm.
  8418. The high threshold selects the "strong" edge pixels, which are then
  8419. connected through 8-connectivity with the "weak" edge pixels selected
  8420. by the low threshold.
  8421. @var{low} and @var{high} threshold values must be chosen in the range
  8422. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8423. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8424. is @code{50/255}.
  8425. @item mode
  8426. Define the drawing mode.
  8427. @table @samp
  8428. @item wires
  8429. Draw white/gray wires on black background.
  8430. @item colormix
  8431. Mix the colors to create a paint/cartoon effect.
  8432. @item canny
  8433. Apply Canny edge detector on all selected planes.
  8434. @end table
  8435. Default value is @var{wires}.
  8436. @item planes
  8437. Select planes for filtering. By default all available planes are filtered.
  8438. @end table
  8439. @subsection Examples
  8440. @itemize
  8441. @item
  8442. Standard edge detection with custom values for the hysteresis thresholding:
  8443. @example
  8444. edgedetect=low=0.1:high=0.4
  8445. @end example
  8446. @item
  8447. Painting effect without thresholding:
  8448. @example
  8449. edgedetect=mode=colormix:high=0
  8450. @end example
  8451. @end itemize
  8452. @section elbg
  8453. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8454. For each input image, the filter will compute the optimal mapping from
  8455. the input to the output given the codebook length, that is the number
  8456. of distinct output colors.
  8457. This filter accepts the following options.
  8458. @table @option
  8459. @item codebook_length, l
  8460. Set codebook length. The value must be a positive integer, and
  8461. represents the number of distinct output colors. Default value is 256.
  8462. @item nb_steps, n
  8463. Set the maximum number of iterations to apply for computing the optimal
  8464. mapping. The higher the value the better the result and the higher the
  8465. computation time. Default value is 1.
  8466. @item seed, s
  8467. Set a random seed, must be an integer included between 0 and
  8468. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8469. will try to use a good random seed on a best effort basis.
  8470. @item pal8
  8471. Set pal8 output pixel format. This option does not work with codebook
  8472. length greater than 256.
  8473. @end table
  8474. @section entropy
  8475. Measure graylevel entropy in histogram of color channels of video frames.
  8476. It accepts the following parameters:
  8477. @table @option
  8478. @item mode
  8479. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8480. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8481. between neighbour histogram values.
  8482. @end table
  8483. @section epx
  8484. Apply the EPX magnification filter which is designed for pixel art.
  8485. It accepts the following option:
  8486. @table @option
  8487. @item n
  8488. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  8489. @code{3xEPX}.
  8490. Default is @code{3}.
  8491. @end table
  8492. @section eq
  8493. Set brightness, contrast, saturation and approximate gamma adjustment.
  8494. The filter accepts the following options:
  8495. @table @option
  8496. @item contrast
  8497. Set the contrast expression. The value must be a float value in range
  8498. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8499. @item brightness
  8500. Set the brightness expression. The value must be a float value in
  8501. range @code{-1.0} to @code{1.0}. The default value is "0".
  8502. @item saturation
  8503. Set the saturation expression. The value must be a float in
  8504. range @code{0.0} to @code{3.0}. The default value is "1".
  8505. @item gamma
  8506. Set the gamma expression. The value must be a float in range
  8507. @code{0.1} to @code{10.0}. The default value is "1".
  8508. @item gamma_r
  8509. Set the gamma expression for red. The value must be a float in
  8510. range @code{0.1} to @code{10.0}. The default value is "1".
  8511. @item gamma_g
  8512. Set the gamma expression for green. The value must be a float in range
  8513. @code{0.1} to @code{10.0}. The default value is "1".
  8514. @item gamma_b
  8515. Set the gamma expression for blue. The value must be a float in range
  8516. @code{0.1} to @code{10.0}. The default value is "1".
  8517. @item gamma_weight
  8518. Set the gamma weight expression. It can be used to reduce the effect
  8519. of a high gamma value on bright image areas, e.g. keep them from
  8520. getting overamplified and just plain white. The value must be a float
  8521. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8522. gamma correction all the way down while @code{1.0} leaves it at its
  8523. full strength. Default is "1".
  8524. @item eval
  8525. Set when the expressions for brightness, contrast, saturation and
  8526. gamma expressions are evaluated.
  8527. It accepts the following values:
  8528. @table @samp
  8529. @item init
  8530. only evaluate expressions once during the filter initialization or
  8531. when a command is processed
  8532. @item frame
  8533. evaluate expressions for each incoming frame
  8534. @end table
  8535. Default value is @samp{init}.
  8536. @end table
  8537. The expressions accept the following parameters:
  8538. @table @option
  8539. @item n
  8540. frame count of the input frame starting from 0
  8541. @item pos
  8542. byte position of the corresponding packet in the input file, NAN if
  8543. unspecified
  8544. @item r
  8545. frame rate of the input video, NAN if the input frame rate is unknown
  8546. @item t
  8547. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8548. @end table
  8549. @subsection Commands
  8550. The filter supports the following commands:
  8551. @table @option
  8552. @item contrast
  8553. Set the contrast expression.
  8554. @item brightness
  8555. Set the brightness expression.
  8556. @item saturation
  8557. Set the saturation expression.
  8558. @item gamma
  8559. Set the gamma expression.
  8560. @item gamma_r
  8561. Set the gamma_r expression.
  8562. @item gamma_g
  8563. Set gamma_g expression.
  8564. @item gamma_b
  8565. Set gamma_b expression.
  8566. @item gamma_weight
  8567. Set gamma_weight expression.
  8568. The command accepts the same syntax of the corresponding option.
  8569. If the specified expression is not valid, it is kept at its current
  8570. value.
  8571. @end table
  8572. @section erosion
  8573. Apply erosion effect to the video.
  8574. This filter replaces the pixel by the local(3x3) minimum.
  8575. It accepts the following options:
  8576. @table @option
  8577. @item threshold0
  8578. @item threshold1
  8579. @item threshold2
  8580. @item threshold3
  8581. Limit the maximum change for each plane, default is 65535.
  8582. If 0, plane will remain unchanged.
  8583. @item coordinates
  8584. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8585. pixels are used.
  8586. Flags to local 3x3 coordinates maps like this:
  8587. 1 2 3
  8588. 4 5
  8589. 6 7 8
  8590. @end table
  8591. @subsection Commands
  8592. This filter supports the all above options as @ref{commands}.
  8593. @section estdif
  8594. Deinterlace the input video ("estdif" stands for "Edge Slope
  8595. Tracing Deinterlacing Filter").
  8596. Spatial only filter that uses edge slope tracing algorithm
  8597. to interpolate missing lines.
  8598. It accepts the following parameters:
  8599. @table @option
  8600. @item mode
  8601. The interlacing mode to adopt. It accepts one of the following values:
  8602. @table @option
  8603. @item frame
  8604. Output one frame for each frame.
  8605. @item field
  8606. Output one frame for each field.
  8607. @end table
  8608. The default value is @code{field}.
  8609. @item parity
  8610. The picture field parity assumed for the input interlaced video. It accepts one
  8611. of the following values:
  8612. @table @option
  8613. @item tff
  8614. Assume the top field is first.
  8615. @item bff
  8616. Assume the bottom field is first.
  8617. @item auto
  8618. Enable automatic detection of field parity.
  8619. @end table
  8620. The default value is @code{auto}.
  8621. If the interlacing is unknown or the decoder does not export this information,
  8622. top field first will be assumed.
  8623. @item deint
  8624. Specify which frames to deinterlace. Accepts one of the following
  8625. values:
  8626. @table @option
  8627. @item all
  8628. Deinterlace all frames.
  8629. @item interlaced
  8630. Only deinterlace frames marked as interlaced.
  8631. @end table
  8632. The default value is @code{all}.
  8633. @item rslope
  8634. Specify the search radius for edge slope tracing. Default value is 1.
  8635. Allowed range is from 1 to 15.
  8636. @item redge
  8637. Specify the search radius for best edge matching. Default value is 2.
  8638. Allowed range is from 0 to 15.
  8639. @item interp
  8640. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  8641. of the following values:
  8642. @table @option
  8643. @item 2p
  8644. Two-point interpolation.
  8645. @item 4p
  8646. Four-point interpolation.
  8647. @item 6p
  8648. Six-point interpolation.
  8649. @end table
  8650. @end table
  8651. @subsection Commands
  8652. This filter supports same @ref{commands} as options.
  8653. @section extractplanes
  8654. Extract color channel components from input video stream into
  8655. separate grayscale video streams.
  8656. The filter accepts the following option:
  8657. @table @option
  8658. @item planes
  8659. Set plane(s) to extract.
  8660. Available values for planes are:
  8661. @table @samp
  8662. @item y
  8663. @item u
  8664. @item v
  8665. @item a
  8666. @item r
  8667. @item g
  8668. @item b
  8669. @end table
  8670. Choosing planes not available in the input will result in an error.
  8671. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8672. with @code{y}, @code{u}, @code{v} planes at same time.
  8673. @end table
  8674. @subsection Examples
  8675. @itemize
  8676. @item
  8677. Extract luma, u and v color channel component from input video frame
  8678. into 3 grayscale outputs:
  8679. @example
  8680. 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
  8681. @end example
  8682. @end itemize
  8683. @section fade
  8684. Apply a fade-in/out effect to the input video.
  8685. It accepts the following parameters:
  8686. @table @option
  8687. @item type, t
  8688. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8689. effect.
  8690. Default is @code{in}.
  8691. @item start_frame, s
  8692. Specify the number of the frame to start applying the fade
  8693. effect at. Default is 0.
  8694. @item nb_frames, n
  8695. The number of frames that the fade effect lasts. At the end of the
  8696. fade-in effect, the output video will have the same intensity as the input video.
  8697. At the end of the fade-out transition, the output video will be filled with the
  8698. selected @option{color}.
  8699. Default is 25.
  8700. @item alpha
  8701. If set to 1, fade only alpha channel, if one exists on the input.
  8702. Default value is 0.
  8703. @item start_time, st
  8704. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8705. effect. If both start_frame and start_time are specified, the fade will start at
  8706. whichever comes last. Default is 0.
  8707. @item duration, d
  8708. The number of seconds for which the fade effect has to last. At the end of the
  8709. fade-in effect the output video will have the same intensity as the input video,
  8710. at the end of the fade-out transition the output video will be filled with the
  8711. selected @option{color}.
  8712. If both duration and nb_frames are specified, duration is used. Default is 0
  8713. (nb_frames is used by default).
  8714. @item color, c
  8715. Specify the color of the fade. Default is "black".
  8716. @end table
  8717. @subsection Examples
  8718. @itemize
  8719. @item
  8720. Fade in the first 30 frames of video:
  8721. @example
  8722. fade=in:0:30
  8723. @end example
  8724. The command above is equivalent to:
  8725. @example
  8726. fade=t=in:s=0:n=30
  8727. @end example
  8728. @item
  8729. Fade out the last 45 frames of a 200-frame video:
  8730. @example
  8731. fade=out:155:45
  8732. fade=type=out:start_frame=155:nb_frames=45
  8733. @end example
  8734. @item
  8735. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8736. @example
  8737. fade=in:0:25, fade=out:975:25
  8738. @end example
  8739. @item
  8740. Make the first 5 frames yellow, then fade in from frame 5-24:
  8741. @example
  8742. fade=in:5:20:color=yellow
  8743. @end example
  8744. @item
  8745. Fade in alpha over first 25 frames of video:
  8746. @example
  8747. fade=in:0:25:alpha=1
  8748. @end example
  8749. @item
  8750. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8751. @example
  8752. fade=t=in:st=5.5:d=0.5
  8753. @end example
  8754. @end itemize
  8755. @section fftdnoiz
  8756. Denoise frames using 3D FFT (frequency domain filtering).
  8757. The filter accepts the following options:
  8758. @table @option
  8759. @item sigma
  8760. Set the noise sigma constant. This sets denoising strength.
  8761. Default value is 1. Allowed range is from 0 to 30.
  8762. Using very high sigma with low overlap may give blocking artifacts.
  8763. @item amount
  8764. Set amount of denoising. By default all detected noise is reduced.
  8765. Default value is 1. Allowed range is from 0 to 1.
  8766. @item block
  8767. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8768. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8769. block size in pixels is 2^4 which is 16.
  8770. @item overlap
  8771. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8772. @item prev
  8773. Set number of previous frames to use for denoising. By default is set to 0.
  8774. @item next
  8775. Set number of next frames to to use for denoising. By default is set to 0.
  8776. @item planes
  8777. Set planes which will be filtered, by default are all available filtered
  8778. except alpha.
  8779. @end table
  8780. @section fftfilt
  8781. Apply arbitrary expressions to samples in frequency domain
  8782. @table @option
  8783. @item dc_Y
  8784. Adjust the dc value (gain) of the luma plane of the image. The filter
  8785. accepts an integer value in range @code{0} to @code{1000}. The default
  8786. value is set to @code{0}.
  8787. @item dc_U
  8788. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8789. filter accepts an integer value in range @code{0} to @code{1000}. The
  8790. default value is set to @code{0}.
  8791. @item dc_V
  8792. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8793. filter accepts an integer value in range @code{0} to @code{1000}. The
  8794. default value is set to @code{0}.
  8795. @item weight_Y
  8796. Set the frequency domain weight expression for the luma plane.
  8797. @item weight_U
  8798. Set the frequency domain weight expression for the 1st chroma plane.
  8799. @item weight_V
  8800. Set the frequency domain weight expression for the 2nd chroma plane.
  8801. @item eval
  8802. Set when the expressions are evaluated.
  8803. It accepts the following values:
  8804. @table @samp
  8805. @item init
  8806. Only evaluate expressions once during the filter initialization.
  8807. @item frame
  8808. Evaluate expressions for each incoming frame.
  8809. @end table
  8810. Default value is @samp{init}.
  8811. The filter accepts the following variables:
  8812. @item X
  8813. @item Y
  8814. The coordinates of the current sample.
  8815. @item W
  8816. @item H
  8817. The width and height of the image.
  8818. @item N
  8819. The number of input frame, starting from 0.
  8820. @end table
  8821. @subsection Examples
  8822. @itemize
  8823. @item
  8824. High-pass:
  8825. @example
  8826. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8827. @end example
  8828. @item
  8829. Low-pass:
  8830. @example
  8831. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8832. @end example
  8833. @item
  8834. Sharpen:
  8835. @example
  8836. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8837. @end example
  8838. @item
  8839. Blur:
  8840. @example
  8841. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8842. @end example
  8843. @end itemize
  8844. @section field
  8845. Extract a single field from an interlaced image using stride
  8846. arithmetic to avoid wasting CPU time. The output frames are marked as
  8847. non-interlaced.
  8848. The filter accepts the following options:
  8849. @table @option
  8850. @item type
  8851. Specify whether to extract the top (if the value is @code{0} or
  8852. @code{top}) or the bottom field (if the value is @code{1} or
  8853. @code{bottom}).
  8854. @end table
  8855. @section fieldhint
  8856. Create new frames by copying the top and bottom fields from surrounding frames
  8857. supplied as numbers by the hint file.
  8858. @table @option
  8859. @item hint
  8860. Set file containing hints: absolute/relative frame numbers.
  8861. There must be one line for each frame in a clip. Each line must contain two
  8862. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8863. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8864. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8865. for @code{relative} mode. First number tells from which frame to pick up top
  8866. field and second number tells from which frame to pick up bottom field.
  8867. If optionally followed by @code{+} output frame will be marked as interlaced,
  8868. else if followed by @code{-} output frame will be marked as progressive, else
  8869. it will be marked same as input frame.
  8870. If optionally followed by @code{t} output frame will use only top field, or in
  8871. case of @code{b} it will use only bottom field.
  8872. If line starts with @code{#} or @code{;} that line is skipped.
  8873. @item mode
  8874. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8875. @end table
  8876. Example of first several lines of @code{hint} file for @code{relative} mode:
  8877. @example
  8878. 0,0 - # first frame
  8879. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8880. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8881. 1,0 -
  8882. 0,0 -
  8883. 0,0 -
  8884. 1,0 -
  8885. 1,0 -
  8886. 1,0 -
  8887. 0,0 -
  8888. 0,0 -
  8889. 1,0 -
  8890. 1,0 -
  8891. 1,0 -
  8892. 0,0 -
  8893. @end example
  8894. @section fieldmatch
  8895. Field matching filter for inverse telecine. It is meant to reconstruct the
  8896. progressive frames from a telecined stream. The filter does not drop duplicated
  8897. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8898. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8899. The separation of the field matching and the decimation is notably motivated by
  8900. the possibility of inserting a de-interlacing filter fallback between the two.
  8901. If the source has mixed telecined and real interlaced content,
  8902. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8903. But these remaining combed frames will be marked as interlaced, and thus can be
  8904. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8905. In addition to the various configuration options, @code{fieldmatch} can take an
  8906. optional second stream, activated through the @option{ppsrc} option. If
  8907. enabled, the frames reconstruction will be based on the fields and frames from
  8908. this second stream. This allows the first input to be pre-processed in order to
  8909. help the various algorithms of the filter, while keeping the output lossless
  8910. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8911. or brightness/contrast adjustments can help.
  8912. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8913. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8914. which @code{fieldmatch} is based on. While the semantic and usage are very
  8915. close, some behaviour and options names can differ.
  8916. The @ref{decimate} filter currently only works for constant frame rate input.
  8917. If your input has mixed telecined (30fps) and progressive content with a lower
  8918. framerate like 24fps use the following filterchain to produce the necessary cfr
  8919. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8920. The filter accepts the following options:
  8921. @table @option
  8922. @item order
  8923. Specify the assumed field order of the input stream. Available values are:
  8924. @table @samp
  8925. @item auto
  8926. Auto detect parity (use FFmpeg's internal parity value).
  8927. @item bff
  8928. Assume bottom field first.
  8929. @item tff
  8930. Assume top field first.
  8931. @end table
  8932. Note that it is sometimes recommended not to trust the parity announced by the
  8933. stream.
  8934. Default value is @var{auto}.
  8935. @item mode
  8936. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8937. sense that it won't risk creating jerkiness due to duplicate frames when
  8938. possible, but if there are bad edits or blended fields it will end up
  8939. outputting combed frames when a good match might actually exist. On the other
  8940. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8941. but will almost always find a good frame if there is one. The other values are
  8942. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8943. jerkiness and creating duplicate frames versus finding good matches in sections
  8944. with bad edits, orphaned fields, blended fields, etc.
  8945. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8946. Available values are:
  8947. @table @samp
  8948. @item pc
  8949. 2-way matching (p/c)
  8950. @item pc_n
  8951. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8952. @item pc_u
  8953. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8954. @item pc_n_ub
  8955. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8956. still combed (p/c + n + u/b)
  8957. @item pcn
  8958. 3-way matching (p/c/n)
  8959. @item pcn_ub
  8960. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8961. detected as combed (p/c/n + u/b)
  8962. @end table
  8963. The parenthesis at the end indicate the matches that would be used for that
  8964. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8965. @var{top}).
  8966. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8967. the slowest.
  8968. Default value is @var{pc_n}.
  8969. @item ppsrc
  8970. Mark the main input stream as a pre-processed input, and enable the secondary
  8971. input stream as the clean source to pick the fields from. See the filter
  8972. introduction for more details. It is similar to the @option{clip2} feature from
  8973. VFM/TFM.
  8974. Default value is @code{0} (disabled).
  8975. @item field
  8976. Set the field to match from. It is recommended to set this to the same value as
  8977. @option{order} unless you experience matching failures with that setting. In
  8978. certain circumstances changing the field that is used to match from can have a
  8979. large impact on matching performance. Available values are:
  8980. @table @samp
  8981. @item auto
  8982. Automatic (same value as @option{order}).
  8983. @item bottom
  8984. Match from the bottom field.
  8985. @item top
  8986. Match from the top field.
  8987. @end table
  8988. Default value is @var{auto}.
  8989. @item mchroma
  8990. Set whether or not chroma is included during the match comparisons. In most
  8991. cases it is recommended to leave this enabled. You should set this to @code{0}
  8992. only if your clip has bad chroma problems such as heavy rainbowing or other
  8993. artifacts. Setting this to @code{0} could also be used to speed things up at
  8994. the cost of some accuracy.
  8995. Default value is @code{1}.
  8996. @item y0
  8997. @item y1
  8998. These define an exclusion band which excludes the lines between @option{y0} and
  8999. @option{y1} from being included in the field matching decision. An exclusion
  9000. band can be used to ignore subtitles, a logo, or other things that may
  9001. interfere with the matching. @option{y0} sets the starting scan line and
  9002. @option{y1} sets the ending line; all lines in between @option{y0} and
  9003. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  9004. @option{y0} and @option{y1} to the same value will disable the feature.
  9005. @option{y0} and @option{y1} defaults to @code{0}.
  9006. @item scthresh
  9007. Set the scene change detection threshold as a percentage of maximum change on
  9008. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  9009. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  9010. @option{scthresh} is @code{[0.0, 100.0]}.
  9011. Default value is @code{12.0}.
  9012. @item combmatch
  9013. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  9014. account the combed scores of matches when deciding what match to use as the
  9015. final match. Available values are:
  9016. @table @samp
  9017. @item none
  9018. No final matching based on combed scores.
  9019. @item sc
  9020. Combed scores are only used when a scene change is detected.
  9021. @item full
  9022. Use combed scores all the time.
  9023. @end table
  9024. Default is @var{sc}.
  9025. @item combdbg
  9026. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  9027. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  9028. Available values are:
  9029. @table @samp
  9030. @item none
  9031. No forced calculation.
  9032. @item pcn
  9033. Force p/c/n calculations.
  9034. @item pcnub
  9035. Force p/c/n/u/b calculations.
  9036. @end table
  9037. Default value is @var{none}.
  9038. @item cthresh
  9039. This is the area combing threshold used for combed frame detection. This
  9040. essentially controls how "strong" or "visible" combing must be to be detected.
  9041. Larger values mean combing must be more visible and smaller values mean combing
  9042. can be less visible or strong and still be detected. Valid settings are from
  9043. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9044. be detected as combed). This is basically a pixel difference value. A good
  9045. range is @code{[8, 12]}.
  9046. Default value is @code{9}.
  9047. @item chroma
  9048. Sets whether or not chroma is considered in the combed frame decision. Only
  9049. disable this if your source has chroma problems (rainbowing, etc.) that are
  9050. causing problems for the combed frame detection with chroma enabled. Actually,
  9051. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9052. where there is chroma only combing in the source.
  9053. Default value is @code{0}.
  9054. @item blockx
  9055. @item blocky
  9056. Respectively set the x-axis and y-axis size of the window used during combed
  9057. frame detection. This has to do with the size of the area in which
  9058. @option{combpel} pixels are required to be detected as combed for a frame to be
  9059. declared combed. See the @option{combpel} parameter description for more info.
  9060. Possible values are any number that is a power of 2 starting at 4 and going up
  9061. to 512.
  9062. Default value is @code{16}.
  9063. @item combpel
  9064. The number of combed pixels inside any of the @option{blocky} by
  9065. @option{blockx} size blocks on the frame for the frame to be detected as
  9066. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9067. setting controls "how much" combing there must be in any localized area (a
  9068. window defined by the @option{blockx} and @option{blocky} settings) on the
  9069. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9070. which point no frames will ever be detected as combed). This setting is known
  9071. as @option{MI} in TFM/VFM vocabulary.
  9072. Default value is @code{80}.
  9073. @end table
  9074. @anchor{p/c/n/u/b meaning}
  9075. @subsection p/c/n/u/b meaning
  9076. @subsubsection p/c/n
  9077. We assume the following telecined stream:
  9078. @example
  9079. Top fields: 1 2 2 3 4
  9080. Bottom fields: 1 2 3 4 4
  9081. @end example
  9082. The numbers correspond to the progressive frame the fields relate to. Here, the
  9083. first two frames are progressive, the 3rd and 4th are combed, and so on.
  9084. When @code{fieldmatch} is configured to run a matching from bottom
  9085. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  9086. @example
  9087. Input stream:
  9088. T 1 2 2 3 4
  9089. B 1 2 3 4 4 <-- matching reference
  9090. Matches: c c n n c
  9091. Output stream:
  9092. T 1 2 3 4 4
  9093. B 1 2 3 4 4
  9094. @end example
  9095. As a result of the field matching, we can see that some frames get duplicated.
  9096. To perform a complete inverse telecine, you need to rely on a decimation filter
  9097. after this operation. See for instance the @ref{decimate} filter.
  9098. The same operation now matching from top fields (@option{field}=@var{top})
  9099. looks like this:
  9100. @example
  9101. Input stream:
  9102. T 1 2 2 3 4 <-- matching reference
  9103. B 1 2 3 4 4
  9104. Matches: c c p p c
  9105. Output stream:
  9106. T 1 2 2 3 4
  9107. B 1 2 2 3 4
  9108. @end example
  9109. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9110. basically, they refer to the frame and field of the opposite parity:
  9111. @itemize
  9112. @item @var{p} matches the field of the opposite parity in the previous frame
  9113. @item @var{c} matches the field of the opposite parity in the current frame
  9114. @item @var{n} matches the field of the opposite parity in the next frame
  9115. @end itemize
  9116. @subsubsection u/b
  9117. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9118. from the opposite parity flag. In the following examples, we assume that we are
  9119. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9120. 'x' is placed above and below each matched fields.
  9121. With bottom matching (@option{field}=@var{bottom}):
  9122. @example
  9123. Match: c p n b u
  9124. x x x x x
  9125. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9126. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9127. x x x x x
  9128. Output frames:
  9129. 2 1 2 2 2
  9130. 2 2 2 1 3
  9131. @end example
  9132. With top matching (@option{field}=@var{top}):
  9133. @example
  9134. Match: c p n b u
  9135. x x x x x
  9136. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9137. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9138. x x x x x
  9139. Output frames:
  9140. 2 2 2 1 2
  9141. 2 1 3 2 2
  9142. @end example
  9143. @subsection Examples
  9144. Simple IVTC of a top field first telecined stream:
  9145. @example
  9146. fieldmatch=order=tff:combmatch=none, decimate
  9147. @end example
  9148. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9149. @example
  9150. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9151. @end example
  9152. @section fieldorder
  9153. Transform the field order of the input video.
  9154. It accepts the following parameters:
  9155. @table @option
  9156. @item order
  9157. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9158. for bottom field first.
  9159. @end table
  9160. The default value is @samp{tff}.
  9161. The transformation is done by shifting the picture content up or down
  9162. by one line, and filling the remaining line with appropriate picture content.
  9163. This method is consistent with most broadcast field order converters.
  9164. If the input video is not flagged as being interlaced, or it is already
  9165. flagged as being of the required output field order, then this filter does
  9166. not alter the incoming video.
  9167. It is very useful when converting to or from PAL DV material,
  9168. which is bottom field first.
  9169. For example:
  9170. @example
  9171. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9172. @end example
  9173. @section fifo, afifo
  9174. Buffer input images and send them when they are requested.
  9175. It is mainly useful when auto-inserted by the libavfilter
  9176. framework.
  9177. It does not take parameters.
  9178. @section fillborders
  9179. Fill borders of the input video, without changing video stream dimensions.
  9180. Sometimes video can have garbage at the four edges and you may not want to
  9181. crop video input to keep size multiple of some number.
  9182. This filter accepts the following options:
  9183. @table @option
  9184. @item left
  9185. Number of pixels to fill from left border.
  9186. @item right
  9187. Number of pixels to fill from right border.
  9188. @item top
  9189. Number of pixels to fill from top border.
  9190. @item bottom
  9191. Number of pixels to fill from bottom border.
  9192. @item mode
  9193. Set fill mode.
  9194. It accepts the following values:
  9195. @table @samp
  9196. @item smear
  9197. fill pixels using outermost pixels
  9198. @item mirror
  9199. fill pixels using mirroring (half sample symmetric)
  9200. @item fixed
  9201. fill pixels with constant value
  9202. @item reflect
  9203. fill pixels using reflecting (whole sample symmetric)
  9204. @item wrap
  9205. fill pixels using wrapping
  9206. @item fade
  9207. fade pixels to constant value
  9208. @end table
  9209. Default is @var{smear}.
  9210. @item color
  9211. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9212. @end table
  9213. @subsection Commands
  9214. This filter supports same @ref{commands} as options.
  9215. The command accepts the same syntax of the corresponding option.
  9216. If the specified expression is not valid, it is kept at its current
  9217. value.
  9218. @section find_rect
  9219. Find a rectangular object
  9220. It accepts the following options:
  9221. @table @option
  9222. @item object
  9223. Filepath of the object image, needs to be in gray8.
  9224. @item threshold
  9225. Detection threshold, default is 0.5.
  9226. @item mipmaps
  9227. Number of mipmaps, default is 3.
  9228. @item xmin, ymin, xmax, ymax
  9229. Specifies the rectangle in which to search.
  9230. @end table
  9231. @subsection Examples
  9232. @itemize
  9233. @item
  9234. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9235. @example
  9236. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9237. @end example
  9238. @end itemize
  9239. @section floodfill
  9240. Flood area with values of same pixel components with another values.
  9241. It accepts the following options:
  9242. @table @option
  9243. @item x
  9244. Set pixel x coordinate.
  9245. @item y
  9246. Set pixel y coordinate.
  9247. @item s0
  9248. Set source #0 component value.
  9249. @item s1
  9250. Set source #1 component value.
  9251. @item s2
  9252. Set source #2 component value.
  9253. @item s3
  9254. Set source #3 component value.
  9255. @item d0
  9256. Set destination #0 component value.
  9257. @item d1
  9258. Set destination #1 component value.
  9259. @item d2
  9260. Set destination #2 component value.
  9261. @item d3
  9262. Set destination #3 component value.
  9263. @end table
  9264. @anchor{format}
  9265. @section format
  9266. Convert the input video to one of the specified pixel formats.
  9267. Libavfilter will try to pick one that is suitable as input to
  9268. the next filter.
  9269. It accepts the following parameters:
  9270. @table @option
  9271. @item pix_fmts
  9272. A '|'-separated list of pixel format names, such as
  9273. "pix_fmts=yuv420p|monow|rgb24".
  9274. @end table
  9275. @subsection Examples
  9276. @itemize
  9277. @item
  9278. Convert the input video to the @var{yuv420p} format
  9279. @example
  9280. format=pix_fmts=yuv420p
  9281. @end example
  9282. Convert the input video to any of the formats in the list
  9283. @example
  9284. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9285. @end example
  9286. @end itemize
  9287. @anchor{fps}
  9288. @section fps
  9289. Convert the video to specified constant frame rate by duplicating or dropping
  9290. frames as necessary.
  9291. It accepts the following parameters:
  9292. @table @option
  9293. @item fps
  9294. The desired output frame rate. The default is @code{25}.
  9295. @item start_time
  9296. Assume the first PTS should be the given value, in seconds. This allows for
  9297. padding/trimming at the start of stream. By default, no assumption is made
  9298. about the first frame's expected PTS, so no padding or trimming is done.
  9299. For example, this could be set to 0 to pad the beginning with duplicates of
  9300. the first frame if a video stream starts after the audio stream or to trim any
  9301. frames with a negative PTS.
  9302. @item round
  9303. Timestamp (PTS) rounding method.
  9304. Possible values are:
  9305. @table @option
  9306. @item zero
  9307. round towards 0
  9308. @item inf
  9309. round away from 0
  9310. @item down
  9311. round towards -infinity
  9312. @item up
  9313. round towards +infinity
  9314. @item near
  9315. round to nearest
  9316. @end table
  9317. The default is @code{near}.
  9318. @item eof_action
  9319. Action performed when reading the last frame.
  9320. Possible values are:
  9321. @table @option
  9322. @item round
  9323. Use same timestamp rounding method as used for other frames.
  9324. @item pass
  9325. Pass through last frame if input duration has not been reached yet.
  9326. @end table
  9327. The default is @code{round}.
  9328. @end table
  9329. Alternatively, the options can be specified as a flat string:
  9330. @var{fps}[:@var{start_time}[:@var{round}]].
  9331. See also the @ref{setpts} filter.
  9332. @subsection Examples
  9333. @itemize
  9334. @item
  9335. A typical usage in order to set the fps to 25:
  9336. @example
  9337. fps=fps=25
  9338. @end example
  9339. @item
  9340. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9341. @example
  9342. fps=fps=film:round=near
  9343. @end example
  9344. @end itemize
  9345. @section framepack
  9346. Pack two different video streams into a stereoscopic video, setting proper
  9347. metadata on supported codecs. The two views should have the same size and
  9348. framerate and processing will stop when the shorter video ends. Please note
  9349. that you may conveniently adjust view properties with the @ref{scale} and
  9350. @ref{fps} filters.
  9351. It accepts the following parameters:
  9352. @table @option
  9353. @item format
  9354. The desired packing format. Supported values are:
  9355. @table @option
  9356. @item sbs
  9357. The views are next to each other (default).
  9358. @item tab
  9359. The views are on top of each other.
  9360. @item lines
  9361. The views are packed by line.
  9362. @item columns
  9363. The views are packed by column.
  9364. @item frameseq
  9365. The views are temporally interleaved.
  9366. @end table
  9367. @end table
  9368. Some examples:
  9369. @example
  9370. # Convert left and right views into a frame-sequential video
  9371. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9372. # Convert views into a side-by-side video with the same output resolution as the input
  9373. 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
  9374. @end example
  9375. @section framerate
  9376. Change the frame rate by interpolating new video output frames from the source
  9377. frames.
  9378. This filter is not designed to function correctly with interlaced media. If
  9379. you wish to change the frame rate of interlaced media then you are required
  9380. to deinterlace before this filter and re-interlace after this filter.
  9381. A description of the accepted options follows.
  9382. @table @option
  9383. @item fps
  9384. Specify the output frames per second. This option can also be specified
  9385. as a value alone. The default is @code{50}.
  9386. @item interp_start
  9387. Specify the start of a range where the output frame will be created as a
  9388. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9389. the default is @code{15}.
  9390. @item interp_end
  9391. Specify the end of a range where the output frame will be created as a
  9392. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9393. the default is @code{240}.
  9394. @item scene
  9395. Specify the level at which a scene change is detected as a value between
  9396. 0 and 100 to indicate a new scene; a low value reflects a low
  9397. probability for the current frame to introduce a new scene, while a higher
  9398. value means the current frame is more likely to be one.
  9399. The default is @code{8.2}.
  9400. @item flags
  9401. Specify flags influencing the filter process.
  9402. Available value for @var{flags} is:
  9403. @table @option
  9404. @item scene_change_detect, scd
  9405. Enable scene change detection using the value of the option @var{scene}.
  9406. This flag is enabled by default.
  9407. @end table
  9408. @end table
  9409. @section framestep
  9410. Select one frame every N-th frame.
  9411. This filter accepts the following option:
  9412. @table @option
  9413. @item step
  9414. Select frame after every @code{step} frames.
  9415. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9416. @end table
  9417. @section freezedetect
  9418. Detect frozen video.
  9419. This filter logs a message and sets frame metadata when it detects that the
  9420. input video has no significant change in content during a specified duration.
  9421. Video freeze detection calculates the mean average absolute difference of all
  9422. the components of video frames and compares it to a noise floor.
  9423. The printed times and duration are expressed in seconds. The
  9424. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9425. whose timestamp equals or exceeds the detection duration and it contains the
  9426. timestamp of the first frame of the freeze. The
  9427. @code{lavfi.freezedetect.freeze_duration} and
  9428. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9429. after the freeze.
  9430. The filter accepts the following options:
  9431. @table @option
  9432. @item noise, n
  9433. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9434. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9435. 0.001.
  9436. @item duration, d
  9437. Set freeze duration until notification (default is 2 seconds).
  9438. @end table
  9439. @section freezeframes
  9440. Freeze video frames.
  9441. This filter freezes video frames using frame from 2nd input.
  9442. The filter accepts the following options:
  9443. @table @option
  9444. @item first
  9445. Set number of first frame from which to start freeze.
  9446. @item last
  9447. Set number of last frame from which to end freeze.
  9448. @item replace
  9449. Set number of frame from 2nd input which will be used instead of replaced frames.
  9450. @end table
  9451. @anchor{frei0r}
  9452. @section frei0r
  9453. Apply a frei0r effect to the input video.
  9454. To enable the compilation of this filter, you need to install the frei0r
  9455. header and configure FFmpeg with @code{--enable-frei0r}.
  9456. It accepts the following parameters:
  9457. @table @option
  9458. @item filter_name
  9459. The name of the frei0r effect to load. If the environment variable
  9460. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9461. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9462. Otherwise, the standard frei0r paths are searched, in this order:
  9463. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9464. @file{/usr/lib/frei0r-1/}.
  9465. @item filter_params
  9466. A '|'-separated list of parameters to pass to the frei0r effect.
  9467. @end table
  9468. A frei0r effect parameter can be a boolean (its value is either
  9469. "y" or "n"), a double, a color (specified as
  9470. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9471. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9472. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9473. a position (specified as @var{X}/@var{Y}, where
  9474. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9475. The number and types of parameters depend on the loaded effect. If an
  9476. effect parameter is not specified, the default value is set.
  9477. @subsection Examples
  9478. @itemize
  9479. @item
  9480. Apply the distort0r effect, setting the first two double parameters:
  9481. @example
  9482. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9483. @end example
  9484. @item
  9485. Apply the colordistance effect, taking a color as the first parameter:
  9486. @example
  9487. frei0r=colordistance:0.2/0.3/0.4
  9488. frei0r=colordistance:violet
  9489. frei0r=colordistance:0x112233
  9490. @end example
  9491. @item
  9492. Apply the perspective effect, specifying the top left and top right image
  9493. positions:
  9494. @example
  9495. frei0r=perspective:0.2/0.2|0.8/0.2
  9496. @end example
  9497. @end itemize
  9498. For more information, see
  9499. @url{http://frei0r.dyne.org}
  9500. @subsection Commands
  9501. This filter supports the @option{filter_params} option as @ref{commands}.
  9502. @section fspp
  9503. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9504. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9505. processing filter, one of them is performed once per block, not per pixel.
  9506. This allows for much higher speed.
  9507. The filter accepts the following options:
  9508. @table @option
  9509. @item quality
  9510. Set quality. This option defines the number of levels for averaging. It accepts
  9511. an integer in the range 4-5. Default value is @code{4}.
  9512. @item qp
  9513. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9514. If not set, the filter will use the QP from the video stream (if available).
  9515. @item strength
  9516. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9517. more details but also more artifacts, while higher values make the image smoother
  9518. but also blurrier. Default value is @code{0} − PSNR optimal.
  9519. @item use_bframe_qp
  9520. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9521. option may cause flicker since the B-Frames have often larger QP. Default is
  9522. @code{0} (not enabled).
  9523. @end table
  9524. @section gblur
  9525. Apply Gaussian blur filter.
  9526. The filter accepts the following options:
  9527. @table @option
  9528. @item sigma
  9529. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9530. @item steps
  9531. Set number of steps for Gaussian approximation. Default is @code{1}.
  9532. @item planes
  9533. Set which planes to filter. By default all planes are filtered.
  9534. @item sigmaV
  9535. Set vertical sigma, if negative it will be same as @code{sigma}.
  9536. Default is @code{-1}.
  9537. @end table
  9538. @subsection Commands
  9539. This filter supports same commands as options.
  9540. The command accepts the same syntax of the corresponding option.
  9541. If the specified expression is not valid, it is kept at its current
  9542. value.
  9543. @section geq
  9544. Apply generic equation to each pixel.
  9545. The filter accepts the following options:
  9546. @table @option
  9547. @item lum_expr, lum
  9548. Set the luminance expression.
  9549. @item cb_expr, cb
  9550. Set the chrominance blue expression.
  9551. @item cr_expr, cr
  9552. Set the chrominance red expression.
  9553. @item alpha_expr, a
  9554. Set the alpha expression.
  9555. @item red_expr, r
  9556. Set the red expression.
  9557. @item green_expr, g
  9558. Set the green expression.
  9559. @item blue_expr, b
  9560. Set the blue expression.
  9561. @end table
  9562. The colorspace is selected according to the specified options. If one
  9563. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9564. options is specified, the filter will automatically select a YCbCr
  9565. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9566. @option{blue_expr} options is specified, it will select an RGB
  9567. colorspace.
  9568. If one of the chrominance expression is not defined, it falls back on the other
  9569. one. If no alpha expression is specified it will evaluate to opaque value.
  9570. If none of chrominance expressions are specified, they will evaluate
  9571. to the luminance expression.
  9572. The expressions can use the following variables and functions:
  9573. @table @option
  9574. @item N
  9575. The sequential number of the filtered frame, starting from @code{0}.
  9576. @item X
  9577. @item Y
  9578. The coordinates of the current sample.
  9579. @item W
  9580. @item H
  9581. The width and height of the image.
  9582. @item SW
  9583. @item SH
  9584. Width and height scale depending on the currently filtered plane. It is the
  9585. ratio between the corresponding luma plane number of pixels and the current
  9586. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9587. @code{0.5,0.5} for chroma planes.
  9588. @item T
  9589. Time of the current frame, expressed in seconds.
  9590. @item p(x, y)
  9591. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9592. plane.
  9593. @item lum(x, y)
  9594. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9595. plane.
  9596. @item cb(x, y)
  9597. Return the value of the pixel at location (@var{x},@var{y}) of the
  9598. blue-difference chroma plane. Return 0 if there is no such plane.
  9599. @item cr(x, y)
  9600. Return the value of the pixel at location (@var{x},@var{y}) of the
  9601. red-difference chroma plane. Return 0 if there is no such plane.
  9602. @item r(x, y)
  9603. @item g(x, y)
  9604. @item b(x, y)
  9605. Return the value of the pixel at location (@var{x},@var{y}) of the
  9606. red/green/blue component. Return 0 if there is no such component.
  9607. @item alpha(x, y)
  9608. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9609. plane. Return 0 if there is no such plane.
  9610. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  9611. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9612. sums of samples within a rectangle. See the functions without the sum postfix.
  9613. @item interpolation
  9614. Set one of interpolation methods:
  9615. @table @option
  9616. @item nearest, n
  9617. @item bilinear, b
  9618. @end table
  9619. Default is bilinear.
  9620. @end table
  9621. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9622. automatically clipped to the closer edge.
  9623. Please note that this filter can use multiple threads in which case each slice
  9624. will have its own expression state. If you want to use only a single expression
  9625. state because your expressions depend on previous state then you should limit
  9626. the number of filter threads to 1.
  9627. @subsection Examples
  9628. @itemize
  9629. @item
  9630. Flip the image horizontally:
  9631. @example
  9632. geq=p(W-X\,Y)
  9633. @end example
  9634. @item
  9635. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9636. wavelength of 100 pixels:
  9637. @example
  9638. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9639. @end example
  9640. @item
  9641. Generate a fancy enigmatic moving light:
  9642. @example
  9643. 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
  9644. @end example
  9645. @item
  9646. Generate a quick emboss effect:
  9647. @example
  9648. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9649. @end example
  9650. @item
  9651. Modify RGB components depending on pixel position:
  9652. @example
  9653. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9654. @end example
  9655. @item
  9656. Create a radial gradient that is the same size as the input (also see
  9657. the @ref{vignette} filter):
  9658. @example
  9659. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9660. @end example
  9661. @end itemize
  9662. @section gradfun
  9663. Fix the banding artifacts that are sometimes introduced into nearly flat
  9664. regions by truncation to 8-bit color depth.
  9665. Interpolate the gradients that should go where the bands are, and
  9666. dither them.
  9667. It is designed for playback only. Do not use it prior to
  9668. lossy compression, because compression tends to lose the dither and
  9669. bring back the bands.
  9670. It accepts the following parameters:
  9671. @table @option
  9672. @item strength
  9673. The maximum amount by which the filter will change any one pixel. This is also
  9674. the threshold for detecting nearly flat regions. Acceptable values range from
  9675. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9676. valid range.
  9677. @item radius
  9678. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9679. gradients, but also prevents the filter from modifying the pixels near detailed
  9680. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9681. values will be clipped to the valid range.
  9682. @end table
  9683. Alternatively, the options can be specified as a flat string:
  9684. @var{strength}[:@var{radius}]
  9685. @subsection Examples
  9686. @itemize
  9687. @item
  9688. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9689. @example
  9690. gradfun=3.5:8
  9691. @end example
  9692. @item
  9693. Specify radius, omitting the strength (which will fall-back to the default
  9694. value):
  9695. @example
  9696. gradfun=radius=8
  9697. @end example
  9698. @end itemize
  9699. @anchor{graphmonitor}
  9700. @section graphmonitor
  9701. Show various filtergraph stats.
  9702. With this filter one can debug complete filtergraph.
  9703. Especially issues with links filling with queued frames.
  9704. The filter accepts the following options:
  9705. @table @option
  9706. @item size, s
  9707. Set video output size. Default is @var{hd720}.
  9708. @item opacity, o
  9709. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9710. @item mode, m
  9711. Set output mode, can be @var{fulll} or @var{compact}.
  9712. In @var{compact} mode only filters with some queued frames have displayed stats.
  9713. @item flags, f
  9714. Set flags which enable which stats are shown in video.
  9715. Available values for flags are:
  9716. @table @samp
  9717. @item queue
  9718. Display number of queued frames in each link.
  9719. @item frame_count_in
  9720. Display number of frames taken from filter.
  9721. @item frame_count_out
  9722. Display number of frames given out from filter.
  9723. @item pts
  9724. Display current filtered frame pts.
  9725. @item time
  9726. Display current filtered frame time.
  9727. @item timebase
  9728. Display time base for filter link.
  9729. @item format
  9730. Display used format for filter link.
  9731. @item size
  9732. Display video size or number of audio channels in case of audio used by filter link.
  9733. @item rate
  9734. Display video frame rate or sample rate in case of audio used by filter link.
  9735. @item eof
  9736. Display link output status.
  9737. @end table
  9738. @item rate, r
  9739. Set upper limit for video rate of output stream, Default value is @var{25}.
  9740. This guarantee that output video frame rate will not be higher than this value.
  9741. @end table
  9742. @section greyedge
  9743. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9744. and corrects the scene colors accordingly.
  9745. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9746. The filter accepts the following options:
  9747. @table @option
  9748. @item difford
  9749. The order of differentiation to be applied on the scene. Must be chosen in the range
  9750. [0,2] and default value is 1.
  9751. @item minknorm
  9752. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9753. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9754. max value instead of calculating Minkowski distance.
  9755. @item sigma
  9756. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9757. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9758. can't be equal to 0 if @var{difford} is greater than 0.
  9759. @end table
  9760. @subsection Examples
  9761. @itemize
  9762. @item
  9763. Grey Edge:
  9764. @example
  9765. greyedge=difford=1:minknorm=5:sigma=2
  9766. @end example
  9767. @item
  9768. Max Edge:
  9769. @example
  9770. greyedge=difford=1:minknorm=0:sigma=2
  9771. @end example
  9772. @end itemize
  9773. @anchor{haldclut}
  9774. @section haldclut
  9775. Apply a Hald CLUT to a video stream.
  9776. First input is the video stream to process, and second one is the Hald CLUT.
  9777. The Hald CLUT input can be a simple picture or a complete video stream.
  9778. The filter accepts the following options:
  9779. @table @option
  9780. @item shortest
  9781. Force termination when the shortest input terminates. Default is @code{0}.
  9782. @item repeatlast
  9783. Continue applying the last CLUT after the end of the stream. A value of
  9784. @code{0} disable the filter after the last frame of the CLUT is reached.
  9785. Default is @code{1}.
  9786. @end table
  9787. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9788. filters share the same internals).
  9789. This filter also supports the @ref{framesync} options.
  9790. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9791. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9792. @subsection Commands
  9793. This filter supports the @code{interp} option as @ref{commands}.
  9794. @subsection Workflow examples
  9795. @subsubsection Hald CLUT video stream
  9796. Generate an identity Hald CLUT stream altered with various effects:
  9797. @example
  9798. 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
  9799. @end example
  9800. Note: make sure you use a lossless codec.
  9801. Then use it with @code{haldclut} to apply it on some random stream:
  9802. @example
  9803. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9804. @end example
  9805. The Hald CLUT will be applied to the 10 first seconds (duration of
  9806. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9807. to the remaining frames of the @code{mandelbrot} stream.
  9808. @subsubsection Hald CLUT with preview
  9809. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9810. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9811. biggest possible square starting at the top left of the picture. The remaining
  9812. padding pixels (bottom or right) will be ignored. This area can be used to add
  9813. a preview of the Hald CLUT.
  9814. Typically, the following generated Hald CLUT will be supported by the
  9815. @code{haldclut} filter:
  9816. @example
  9817. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9818. pad=iw+320 [padded_clut];
  9819. smptebars=s=320x256, split [a][b];
  9820. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9821. [main][b] overlay=W-320" -frames:v 1 clut.png
  9822. @end example
  9823. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9824. bars are displayed on the right-top, and below the same color bars processed by
  9825. the color changes.
  9826. Then, the effect of this Hald CLUT can be visualized with:
  9827. @example
  9828. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9829. @end example
  9830. @section hflip
  9831. Flip the input video horizontally.
  9832. For example, to horizontally flip the input video with @command{ffmpeg}:
  9833. @example
  9834. ffmpeg -i in.avi -vf "hflip" out.avi
  9835. @end example
  9836. @section histeq
  9837. This filter applies a global color histogram equalization on a
  9838. per-frame basis.
  9839. It can be used to correct video that has a compressed range of pixel
  9840. intensities. The filter redistributes the pixel intensities to
  9841. equalize their distribution across the intensity range. It may be
  9842. viewed as an "automatically adjusting contrast filter". This filter is
  9843. useful only for correcting degraded or poorly captured source
  9844. video.
  9845. The filter accepts the following options:
  9846. @table @option
  9847. @item strength
  9848. Determine the amount of equalization to be applied. As the strength
  9849. is reduced, the distribution of pixel intensities more-and-more
  9850. approaches that of the input frame. The value must be a float number
  9851. in the range [0,1] and defaults to 0.200.
  9852. @item intensity
  9853. Set the maximum intensity that can generated and scale the output
  9854. values appropriately. The strength should be set as desired and then
  9855. the intensity can be limited if needed to avoid washing-out. The value
  9856. must be a float number in the range [0,1] and defaults to 0.210.
  9857. @item antibanding
  9858. Set the antibanding level. If enabled the filter will randomly vary
  9859. the luminance of output pixels by a small amount to avoid banding of
  9860. the histogram. Possible values are @code{none}, @code{weak} or
  9861. @code{strong}. It defaults to @code{none}.
  9862. @end table
  9863. @anchor{histogram}
  9864. @section histogram
  9865. Compute and draw a color distribution histogram for the input video.
  9866. The computed histogram is a representation of the color component
  9867. distribution in an image.
  9868. Standard histogram displays the color components distribution in an image.
  9869. Displays color graph for each color component. Shows distribution of
  9870. the Y, U, V, A or R, G, B components, depending on input format, in the
  9871. current frame. Below each graph a color component scale meter is shown.
  9872. The filter accepts the following options:
  9873. @table @option
  9874. @item level_height
  9875. Set height of level. Default value is @code{200}.
  9876. Allowed range is [50, 2048].
  9877. @item scale_height
  9878. Set height of color scale. Default value is @code{12}.
  9879. Allowed range is [0, 40].
  9880. @item display_mode
  9881. Set display mode.
  9882. It accepts the following values:
  9883. @table @samp
  9884. @item stack
  9885. Per color component graphs are placed below each other.
  9886. @item parade
  9887. Per color component graphs are placed side by side.
  9888. @item overlay
  9889. Presents information identical to that in the @code{parade}, except
  9890. that the graphs representing color components are superimposed directly
  9891. over one another.
  9892. @end table
  9893. Default is @code{stack}.
  9894. @item levels_mode
  9895. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9896. Default is @code{linear}.
  9897. @item components
  9898. Set what color components to display.
  9899. Default is @code{7}.
  9900. @item fgopacity
  9901. Set foreground opacity. Default is @code{0.7}.
  9902. @item bgopacity
  9903. Set background opacity. Default is @code{0.5}.
  9904. @end table
  9905. @subsection Examples
  9906. @itemize
  9907. @item
  9908. Calculate and draw histogram:
  9909. @example
  9910. ffplay -i input -vf histogram
  9911. @end example
  9912. @end itemize
  9913. @anchor{hqdn3d}
  9914. @section hqdn3d
  9915. This is a high precision/quality 3d denoise filter. It aims to reduce
  9916. image noise, producing smooth images and making still images really
  9917. still. It should enhance compressibility.
  9918. It accepts the following optional parameters:
  9919. @table @option
  9920. @item luma_spatial
  9921. A non-negative floating point number which specifies spatial luma strength.
  9922. It defaults to 4.0.
  9923. @item chroma_spatial
  9924. A non-negative floating point number which specifies spatial chroma strength.
  9925. It defaults to 3.0*@var{luma_spatial}/4.0.
  9926. @item luma_tmp
  9927. A floating point number which specifies luma temporal strength. It defaults to
  9928. 6.0*@var{luma_spatial}/4.0.
  9929. @item chroma_tmp
  9930. A floating point number which specifies chroma temporal strength. It defaults to
  9931. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9932. @end table
  9933. @subsection Commands
  9934. This filter supports same @ref{commands} as options.
  9935. The command accepts the same syntax of the corresponding option.
  9936. If the specified expression is not valid, it is kept at its current
  9937. value.
  9938. @anchor{hwdownload}
  9939. @section hwdownload
  9940. Download hardware frames to system memory.
  9941. The input must be in hardware frames, and the output a non-hardware format.
  9942. Not all formats will be supported on the output - it may be necessary to insert
  9943. an additional @option{format} filter immediately following in the graph to get
  9944. the output in a supported format.
  9945. @section hwmap
  9946. Map hardware frames to system memory or to another device.
  9947. This filter has several different modes of operation; which one is used depends
  9948. on the input and output formats:
  9949. @itemize
  9950. @item
  9951. Hardware frame input, normal frame output
  9952. Map the input frames to system memory and pass them to the output. If the
  9953. original hardware frame is later required (for example, after overlaying
  9954. something else on part of it), the @option{hwmap} filter can be used again
  9955. in the next mode to retrieve it.
  9956. @item
  9957. Normal frame input, hardware frame output
  9958. If the input is actually a software-mapped hardware frame, then unmap it -
  9959. that is, return the original hardware frame.
  9960. Otherwise, a device must be provided. Create new hardware surfaces on that
  9961. device for the output, then map them back to the software format at the input
  9962. and give those frames to the preceding filter. This will then act like the
  9963. @option{hwupload} filter, but may be able to avoid an additional copy when
  9964. the input is already in a compatible format.
  9965. @item
  9966. Hardware frame input and output
  9967. A device must be supplied for the output, either directly or with the
  9968. @option{derive_device} option. The input and output devices must be of
  9969. different types and compatible - the exact meaning of this is
  9970. system-dependent, but typically it means that they must refer to the same
  9971. underlying hardware context (for example, refer to the same graphics card).
  9972. If the input frames were originally created on the output device, then unmap
  9973. to retrieve the original frames.
  9974. Otherwise, map the frames to the output device - create new hardware frames
  9975. on the output corresponding to the frames on the input.
  9976. @end itemize
  9977. The following additional parameters are accepted:
  9978. @table @option
  9979. @item mode
  9980. Set the frame mapping mode. Some combination of:
  9981. @table @var
  9982. @item read
  9983. The mapped frame should be readable.
  9984. @item write
  9985. The mapped frame should be writeable.
  9986. @item overwrite
  9987. The mapping will always overwrite the entire frame.
  9988. This may improve performance in some cases, as the original contents of the
  9989. frame need not be loaded.
  9990. @item direct
  9991. The mapping must not involve any copying.
  9992. Indirect mappings to copies of frames are created in some cases where either
  9993. direct mapping is not possible or it would have unexpected properties.
  9994. Setting this flag ensures that the mapping is direct and will fail if that is
  9995. not possible.
  9996. @end table
  9997. Defaults to @var{read+write} if not specified.
  9998. @item derive_device @var{type}
  9999. Rather than using the device supplied at initialisation, instead derive a new
  10000. device of type @var{type} from the device the input frames exist on.
  10001. @item reverse
  10002. In a hardware to hardware mapping, map in reverse - create frames in the sink
  10003. and map them back to the source. This may be necessary in some cases where
  10004. a mapping in one direction is required but only the opposite direction is
  10005. supported by the devices being used.
  10006. This option is dangerous - it may break the preceding filter in undefined
  10007. ways if there are any additional constraints on that filter's output.
  10008. Do not use it without fully understanding the implications of its use.
  10009. @end table
  10010. @anchor{hwupload}
  10011. @section hwupload
  10012. Upload system memory frames to hardware surfaces.
  10013. The device to upload to must be supplied when the filter is initialised. If
  10014. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  10015. option or with the @option{derive_device} option. The input and output devices
  10016. must be of different types and compatible - the exact meaning of this is
  10017. system-dependent, but typically it means that they must refer to the same
  10018. underlying hardware context (for example, refer to the same graphics card).
  10019. The following additional parameters are accepted:
  10020. @table @option
  10021. @item derive_device @var{type}
  10022. Rather than using the device supplied at initialisation, instead derive a new
  10023. device of type @var{type} from the device the input frames exist on.
  10024. @end table
  10025. @anchor{hwupload_cuda}
  10026. @section hwupload_cuda
  10027. Upload system memory frames to a CUDA device.
  10028. It accepts the following optional parameters:
  10029. @table @option
  10030. @item device
  10031. The number of the CUDA device to use
  10032. @end table
  10033. @section hqx
  10034. Apply a high-quality magnification filter designed for pixel art. This filter
  10035. was originally created by Maxim Stepin.
  10036. It accepts the following option:
  10037. @table @option
  10038. @item n
  10039. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  10040. @code{hq3x} and @code{4} for @code{hq4x}.
  10041. Default is @code{3}.
  10042. @end table
  10043. @section hstack
  10044. Stack input videos horizontally.
  10045. All streams must be of same pixel format and of same height.
  10046. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10047. to create same output.
  10048. The filter accepts the following option:
  10049. @table @option
  10050. @item inputs
  10051. Set number of input streams. Default is 2.
  10052. @item shortest
  10053. If set to 1, force the output to terminate when the shortest input
  10054. terminates. Default value is 0.
  10055. @end table
  10056. @section hue
  10057. Modify the hue and/or the saturation of the input.
  10058. It accepts the following parameters:
  10059. @table @option
  10060. @item h
  10061. Specify the hue angle as a number of degrees. It accepts an expression,
  10062. and defaults to "0".
  10063. @item s
  10064. Specify the saturation in the [-10,10] range. It accepts an expression and
  10065. defaults to "1".
  10066. @item H
  10067. Specify the hue angle as a number of radians. It accepts an
  10068. expression, and defaults to "0".
  10069. @item b
  10070. Specify the brightness in the [-10,10] range. It accepts an expression and
  10071. defaults to "0".
  10072. @end table
  10073. @option{h} and @option{H} are mutually exclusive, and can't be
  10074. specified at the same time.
  10075. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  10076. expressions containing the following constants:
  10077. @table @option
  10078. @item n
  10079. frame count of the input frame starting from 0
  10080. @item pts
  10081. presentation timestamp of the input frame expressed in time base units
  10082. @item r
  10083. frame rate of the input video, NAN if the input frame rate is unknown
  10084. @item t
  10085. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10086. @item tb
  10087. time base of the input video
  10088. @end table
  10089. @subsection Examples
  10090. @itemize
  10091. @item
  10092. Set the hue to 90 degrees and the saturation to 1.0:
  10093. @example
  10094. hue=h=90:s=1
  10095. @end example
  10096. @item
  10097. Same command but expressing the hue in radians:
  10098. @example
  10099. hue=H=PI/2:s=1
  10100. @end example
  10101. @item
  10102. Rotate hue and make the saturation swing between 0
  10103. and 2 over a period of 1 second:
  10104. @example
  10105. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10106. @end example
  10107. @item
  10108. Apply a 3 seconds saturation fade-in effect starting at 0:
  10109. @example
  10110. hue="s=min(t/3\,1)"
  10111. @end example
  10112. The general fade-in expression can be written as:
  10113. @example
  10114. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10115. @end example
  10116. @item
  10117. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10118. @example
  10119. hue="s=max(0\, min(1\, (8-t)/3))"
  10120. @end example
  10121. The general fade-out expression can be written as:
  10122. @example
  10123. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10124. @end example
  10125. @end itemize
  10126. @subsection Commands
  10127. This filter supports the following commands:
  10128. @table @option
  10129. @item b
  10130. @item s
  10131. @item h
  10132. @item H
  10133. Modify the hue and/or the saturation and/or brightness of the input video.
  10134. The command accepts the same syntax of the corresponding option.
  10135. If the specified expression is not valid, it is kept at its current
  10136. value.
  10137. @end table
  10138. @section hysteresis
  10139. Grow first stream into second stream by connecting components.
  10140. This makes it possible to build more robust edge masks.
  10141. This filter accepts the following options:
  10142. @table @option
  10143. @item planes
  10144. Set which planes will be processed as bitmap, unprocessed planes will be
  10145. copied from first stream.
  10146. By default value 0xf, all planes will be processed.
  10147. @item threshold
  10148. Set threshold which is used in filtering. If pixel component value is higher than
  10149. this value filter algorithm for connecting components is activated.
  10150. By default value is 0.
  10151. @end table
  10152. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10153. @section idet
  10154. Detect video interlacing type.
  10155. This filter tries to detect if the input frames are interlaced, progressive,
  10156. top or bottom field first. It will also try to detect fields that are
  10157. repeated between adjacent frames (a sign of telecine).
  10158. Single frame detection considers only immediately adjacent frames when classifying each frame.
  10159. Multiple frame detection incorporates the classification history of previous frames.
  10160. The filter will log these metadata values:
  10161. @table @option
  10162. @item single.current_frame
  10163. Detected type of current frame using single-frame detection. One of:
  10164. ``tff'' (top field first), ``bff'' (bottom field first),
  10165. ``progressive'', or ``undetermined''
  10166. @item single.tff
  10167. Cumulative number of frames detected as top field first using single-frame detection.
  10168. @item multiple.tff
  10169. Cumulative number of frames detected as top field first using multiple-frame detection.
  10170. @item single.bff
  10171. Cumulative number of frames detected as bottom field first using single-frame detection.
  10172. @item multiple.current_frame
  10173. Detected type of current frame using multiple-frame detection. One of:
  10174. ``tff'' (top field first), ``bff'' (bottom field first),
  10175. ``progressive'', or ``undetermined''
  10176. @item multiple.bff
  10177. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  10178. @item single.progressive
  10179. Cumulative number of frames detected as progressive using single-frame detection.
  10180. @item multiple.progressive
  10181. Cumulative number of frames detected as progressive using multiple-frame detection.
  10182. @item single.undetermined
  10183. Cumulative number of frames that could not be classified using single-frame detection.
  10184. @item multiple.undetermined
  10185. Cumulative number of frames that could not be classified using multiple-frame detection.
  10186. @item repeated.current_frame
  10187. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10188. @item repeated.neither
  10189. Cumulative number of frames with no repeated field.
  10190. @item repeated.top
  10191. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10192. @item repeated.bottom
  10193. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10194. @end table
  10195. The filter accepts the following options:
  10196. @table @option
  10197. @item intl_thres
  10198. Set interlacing threshold.
  10199. @item prog_thres
  10200. Set progressive threshold.
  10201. @item rep_thres
  10202. Threshold for repeated field detection.
  10203. @item half_life
  10204. Number of frames after which a given frame's contribution to the
  10205. statistics is halved (i.e., it contributes only 0.5 to its
  10206. classification). The default of 0 means that all frames seen are given
  10207. full weight of 1.0 forever.
  10208. @item analyze_interlaced_flag
  10209. When this is not 0 then idet will use the specified number of frames to determine
  10210. if the interlaced flag is accurate, it will not count undetermined frames.
  10211. If the flag is found to be accurate it will be used without any further
  10212. computations, if it is found to be inaccurate it will be cleared without any
  10213. further computations. This allows inserting the idet filter as a low computational
  10214. method to clean up the interlaced flag
  10215. @end table
  10216. @section il
  10217. Deinterleave or interleave fields.
  10218. This filter allows one to process interlaced images fields without
  10219. deinterlacing them. Deinterleaving splits the input frame into 2
  10220. fields (so called half pictures). Odd lines are moved to the top
  10221. half of the output image, even lines to the bottom half.
  10222. You can process (filter) them independently and then re-interleave them.
  10223. The filter accepts the following options:
  10224. @table @option
  10225. @item luma_mode, l
  10226. @item chroma_mode, c
  10227. @item alpha_mode, a
  10228. Available values for @var{luma_mode}, @var{chroma_mode} and
  10229. @var{alpha_mode} are:
  10230. @table @samp
  10231. @item none
  10232. Do nothing.
  10233. @item deinterleave, d
  10234. Deinterleave fields, placing one above the other.
  10235. @item interleave, i
  10236. Interleave fields. Reverse the effect of deinterleaving.
  10237. @end table
  10238. Default value is @code{none}.
  10239. @item luma_swap, ls
  10240. @item chroma_swap, cs
  10241. @item alpha_swap, as
  10242. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10243. @end table
  10244. @subsection Commands
  10245. This filter supports the all above options as @ref{commands}.
  10246. @section inflate
  10247. Apply inflate effect to the video.
  10248. This filter replaces the pixel by the local(3x3) average by taking into account
  10249. only values higher than the pixel.
  10250. It accepts the following options:
  10251. @table @option
  10252. @item threshold0
  10253. @item threshold1
  10254. @item threshold2
  10255. @item threshold3
  10256. Limit the maximum change for each plane, default is 65535.
  10257. If 0, plane will remain unchanged.
  10258. @end table
  10259. @subsection Commands
  10260. This filter supports the all above options as @ref{commands}.
  10261. @section interlace
  10262. Simple interlacing filter from progressive contents. This interleaves upper (or
  10263. lower) lines from odd frames with lower (or upper) lines from even frames,
  10264. halving the frame rate and preserving image height.
  10265. @example
  10266. Original Original New Frame
  10267. Frame 'j' Frame 'j+1' (tff)
  10268. ========== =========== ==================
  10269. Line 0 --------------------> Frame 'j' Line 0
  10270. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10271. Line 2 ---------------------> Frame 'j' Line 2
  10272. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10273. ... ... ...
  10274. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10275. @end example
  10276. It accepts the following optional parameters:
  10277. @table @option
  10278. @item scan
  10279. This determines whether the interlaced frame is taken from the even
  10280. (tff - default) or odd (bff) lines of the progressive frame.
  10281. @item lowpass
  10282. Vertical lowpass filter to avoid twitter interlacing and
  10283. reduce moire patterns.
  10284. @table @samp
  10285. @item 0, off
  10286. Disable vertical lowpass filter
  10287. @item 1, linear
  10288. Enable linear filter (default)
  10289. @item 2, complex
  10290. Enable complex filter. This will slightly less reduce twitter and moire
  10291. but better retain detail and subjective sharpness impression.
  10292. @end table
  10293. @end table
  10294. @section kerndeint
  10295. Deinterlace input video by applying Donald Graft's adaptive kernel
  10296. deinterling. Work on interlaced parts of a video to produce
  10297. progressive frames.
  10298. The description of the accepted parameters follows.
  10299. @table @option
  10300. @item thresh
  10301. Set the threshold which affects the filter's tolerance when
  10302. determining if a pixel line must be processed. It must be an integer
  10303. in the range [0,255] and defaults to 10. A value of 0 will result in
  10304. applying the process on every pixels.
  10305. @item map
  10306. Paint pixels exceeding the threshold value to white if set to 1.
  10307. Default is 0.
  10308. @item order
  10309. Set the fields order. Swap fields if set to 1, leave fields alone if
  10310. 0. Default is 0.
  10311. @item sharp
  10312. Enable additional sharpening if set to 1. Default is 0.
  10313. @item twoway
  10314. Enable twoway sharpening if set to 1. Default is 0.
  10315. @end table
  10316. @subsection Examples
  10317. @itemize
  10318. @item
  10319. Apply default values:
  10320. @example
  10321. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10322. @end example
  10323. @item
  10324. Enable additional sharpening:
  10325. @example
  10326. kerndeint=sharp=1
  10327. @end example
  10328. @item
  10329. Paint processed pixels in white:
  10330. @example
  10331. kerndeint=map=1
  10332. @end example
  10333. @end itemize
  10334. @section kirsch
  10335. Apply kirsch operator to input video stream.
  10336. The filter accepts the following option:
  10337. @table @option
  10338. @item planes
  10339. Set which planes will be processed, unprocessed planes will be copied.
  10340. By default value 0xf, all planes will be processed.
  10341. @item scale
  10342. Set value which will be multiplied with filtered result.
  10343. @item delta
  10344. Set value which will be added to filtered result.
  10345. @end table
  10346. @subsection Commands
  10347. This filter supports the all above options as @ref{commands}.
  10348. @section lagfun
  10349. Slowly update darker pixels.
  10350. This filter makes short flashes of light appear longer.
  10351. This filter accepts the following options:
  10352. @table @option
  10353. @item decay
  10354. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10355. @item planes
  10356. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10357. @end table
  10358. @subsection Commands
  10359. This filter supports the all above options as @ref{commands}.
  10360. @section lenscorrection
  10361. Correct radial lens distortion
  10362. This filter can be used to correct for radial distortion as can result from the use
  10363. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10364. one can use tools available for example as part of opencv or simply trial-and-error.
  10365. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10366. and extract the k1 and k2 coefficients from the resulting matrix.
  10367. Note that effectively the same filter is available in the open-source tools Krita and
  10368. Digikam from the KDE project.
  10369. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10370. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10371. brightness distribution, so you may want to use both filters together in certain
  10372. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10373. be applied before or after lens correction.
  10374. @subsection Options
  10375. The filter accepts the following options:
  10376. @table @option
  10377. @item cx
  10378. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10379. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10380. width. Default is 0.5.
  10381. @item cy
  10382. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10383. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10384. height. Default is 0.5.
  10385. @item k1
  10386. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10387. no correction. Default is 0.
  10388. @item k2
  10389. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10390. 0 means no correction. Default is 0.
  10391. @item i
  10392. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  10393. Default is @code{nearest}.
  10394. @item fc
  10395. Specify the color of the unmapped pixels. For the syntax of this option,
  10396. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10397. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  10398. @end table
  10399. The formula that generates the correction is:
  10400. @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)
  10401. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10402. distances from the focal point in the source and target images, respectively.
  10403. @subsection Commands
  10404. This filter supports the all above options as @ref{commands}.
  10405. @section lensfun
  10406. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10407. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10408. to apply the lens correction. The filter will load the lensfun database and
  10409. query it to find the corresponding camera and lens entries in the database. As
  10410. long as these entries can be found with the given options, the filter can
  10411. perform corrections on frames. Note that incomplete strings will result in the
  10412. filter choosing the best match with the given options, and the filter will
  10413. output the chosen camera and lens models (logged with level "info"). You must
  10414. provide the make, camera model, and lens model as they are required.
  10415. The filter accepts the following options:
  10416. @table @option
  10417. @item make
  10418. The make of the camera (for example, "Canon"). This option is required.
  10419. @item model
  10420. The model of the camera (for example, "Canon EOS 100D"). This option is
  10421. required.
  10422. @item lens_model
  10423. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10424. option is required.
  10425. @item mode
  10426. The type of correction to apply. The following values are valid options:
  10427. @table @samp
  10428. @item vignetting
  10429. Enables fixing lens vignetting.
  10430. @item geometry
  10431. Enables fixing lens geometry. This is the default.
  10432. @item subpixel
  10433. Enables fixing chromatic aberrations.
  10434. @item vig_geo
  10435. Enables fixing lens vignetting and lens geometry.
  10436. @item vig_subpixel
  10437. Enables fixing lens vignetting and chromatic aberrations.
  10438. @item distortion
  10439. Enables fixing both lens geometry and chromatic aberrations.
  10440. @item all
  10441. Enables all possible corrections.
  10442. @end table
  10443. @item focal_length
  10444. The focal length of the image/video (zoom; expected constant for video). For
  10445. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10446. range should be chosen when using that lens. Default 18.
  10447. @item aperture
  10448. The aperture of the image/video (expected constant for video). Note that
  10449. aperture is only used for vignetting correction. Default 3.5.
  10450. @item focus_distance
  10451. The focus distance of the image/video (expected constant for video). Note that
  10452. focus distance is only used for vignetting and only slightly affects the
  10453. vignetting correction process. If unknown, leave it at the default value (which
  10454. is 1000).
  10455. @item scale
  10456. The scale factor which is applied after transformation. After correction the
  10457. video is no longer necessarily rectangular. This parameter controls how much of
  10458. the resulting image is visible. The value 0 means that a value will be chosen
  10459. automatically such that there is little or no unmapped area in the output
  10460. image. 1.0 means that no additional scaling is done. Lower values may result
  10461. in more of the corrected image being visible, while higher values may avoid
  10462. unmapped areas in the output.
  10463. @item target_geometry
  10464. The target geometry of the output image/video. The following values are valid
  10465. options:
  10466. @table @samp
  10467. @item rectilinear (default)
  10468. @item fisheye
  10469. @item panoramic
  10470. @item equirectangular
  10471. @item fisheye_orthographic
  10472. @item fisheye_stereographic
  10473. @item fisheye_equisolid
  10474. @item fisheye_thoby
  10475. @end table
  10476. @item reverse
  10477. Apply the reverse of image correction (instead of correcting distortion, apply
  10478. it).
  10479. @item interpolation
  10480. The type of interpolation used when correcting distortion. The following values
  10481. are valid options:
  10482. @table @samp
  10483. @item nearest
  10484. @item linear (default)
  10485. @item lanczos
  10486. @end table
  10487. @end table
  10488. @subsection Examples
  10489. @itemize
  10490. @item
  10491. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10492. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10493. aperture of "8.0".
  10494. @example
  10495. 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
  10496. @end example
  10497. @item
  10498. Apply the same as before, but only for the first 5 seconds of video.
  10499. @example
  10500. 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
  10501. @end example
  10502. @end itemize
  10503. @section libvmaf
  10504. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10505. score between two input videos.
  10506. The obtained VMAF score is printed through the logging system.
  10507. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10508. After installing the library it can be enabled using:
  10509. @code{./configure --enable-libvmaf}.
  10510. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10511. The filter has following options:
  10512. @table @option
  10513. @item model_path
  10514. Set the model path which is to be used for SVM.
  10515. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10516. @item log_path
  10517. Set the file path to be used to store logs.
  10518. @item log_fmt
  10519. Set the format of the log file (csv, json or xml).
  10520. @item enable_transform
  10521. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10522. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10523. Default value: @code{false}
  10524. @item phone_model
  10525. Invokes the phone model which will generate VMAF scores higher than in the
  10526. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10527. Default value: @code{false}
  10528. @item psnr
  10529. Enables computing psnr along with vmaf.
  10530. Default value: @code{false}
  10531. @item ssim
  10532. Enables computing ssim along with vmaf.
  10533. Default value: @code{false}
  10534. @item ms_ssim
  10535. Enables computing ms_ssim along with vmaf.
  10536. Default value: @code{false}
  10537. @item pool
  10538. Set the pool method to be used for computing vmaf.
  10539. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10540. @item n_threads
  10541. Set number of threads to be used when computing vmaf.
  10542. Default value: @code{0}, which makes use of all available logical processors.
  10543. @item n_subsample
  10544. Set interval for frame subsampling used when computing vmaf.
  10545. Default value: @code{1}
  10546. @item enable_conf_interval
  10547. Enables confidence interval.
  10548. Default value: @code{false}
  10549. @end table
  10550. This filter also supports the @ref{framesync} options.
  10551. @subsection Examples
  10552. @itemize
  10553. @item
  10554. On the below examples the input file @file{main.mpg} being processed is
  10555. compared with the reference file @file{ref.mpg}.
  10556. @example
  10557. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10558. @end example
  10559. @item
  10560. Example with options:
  10561. @example
  10562. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10563. @end example
  10564. @item
  10565. Example with options and different containers:
  10566. @example
  10567. 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 -
  10568. @end example
  10569. @end itemize
  10570. @section limiter
  10571. Limits the pixel components values to the specified range [min, max].
  10572. The filter accepts the following options:
  10573. @table @option
  10574. @item min
  10575. Lower bound. Defaults to the lowest allowed value for the input.
  10576. @item max
  10577. Upper bound. Defaults to the highest allowed value for the input.
  10578. @item planes
  10579. Specify which planes will be processed. Defaults to all available.
  10580. @end table
  10581. @subsection Commands
  10582. This filter supports the all above options as @ref{commands}.
  10583. @section loop
  10584. Loop video frames.
  10585. The filter accepts the following options:
  10586. @table @option
  10587. @item loop
  10588. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10589. Default is 0.
  10590. @item size
  10591. Set maximal size in number of frames. Default is 0.
  10592. @item start
  10593. Set first frame of loop. Default is 0.
  10594. @end table
  10595. @subsection Examples
  10596. @itemize
  10597. @item
  10598. Loop single first frame infinitely:
  10599. @example
  10600. loop=loop=-1:size=1:start=0
  10601. @end example
  10602. @item
  10603. Loop single first frame 10 times:
  10604. @example
  10605. loop=loop=10:size=1:start=0
  10606. @end example
  10607. @item
  10608. Loop 10 first frames 5 times:
  10609. @example
  10610. loop=loop=5:size=10:start=0
  10611. @end example
  10612. @end itemize
  10613. @section lut1d
  10614. Apply a 1D LUT to an input video.
  10615. The filter accepts the following options:
  10616. @table @option
  10617. @item file
  10618. Set the 1D LUT file name.
  10619. Currently supported formats:
  10620. @table @samp
  10621. @item cube
  10622. Iridas
  10623. @item csp
  10624. cineSpace
  10625. @end table
  10626. @item interp
  10627. Select interpolation mode.
  10628. Available values are:
  10629. @table @samp
  10630. @item nearest
  10631. Use values from the nearest defined point.
  10632. @item linear
  10633. Interpolate values using the linear interpolation.
  10634. @item cosine
  10635. Interpolate values using the cosine interpolation.
  10636. @item cubic
  10637. Interpolate values using the cubic interpolation.
  10638. @item spline
  10639. Interpolate values using the spline interpolation.
  10640. @end table
  10641. @end table
  10642. @subsection Commands
  10643. This filter supports the all above options as @ref{commands}.
  10644. @anchor{lut3d}
  10645. @section lut3d
  10646. Apply a 3D LUT to an input video.
  10647. The filter accepts the following options:
  10648. @table @option
  10649. @item file
  10650. Set the 3D LUT file name.
  10651. Currently supported formats:
  10652. @table @samp
  10653. @item 3dl
  10654. AfterEffects
  10655. @item cube
  10656. Iridas
  10657. @item dat
  10658. DaVinci
  10659. @item m3d
  10660. Pandora
  10661. @item csp
  10662. cineSpace
  10663. @end table
  10664. @item interp
  10665. Select interpolation mode.
  10666. Available values are:
  10667. @table @samp
  10668. @item nearest
  10669. Use values from the nearest defined point.
  10670. @item trilinear
  10671. Interpolate values using the 8 points defining a cube.
  10672. @item tetrahedral
  10673. Interpolate values using a tetrahedron.
  10674. @item pyramid
  10675. Interpolate values using a pyramid.
  10676. @item prism
  10677. Interpolate values using a prism.
  10678. @end table
  10679. @end table
  10680. @subsection Commands
  10681. This filter supports the @code{interp} option as @ref{commands}.
  10682. @section lumakey
  10683. Turn certain luma values into transparency.
  10684. The filter accepts the following options:
  10685. @table @option
  10686. @item threshold
  10687. Set the luma which will be used as base for transparency.
  10688. Default value is @code{0}.
  10689. @item tolerance
  10690. Set the range of luma values to be keyed out.
  10691. Default value is @code{0.01}.
  10692. @item softness
  10693. Set the range of softness. Default value is @code{0}.
  10694. Use this to control gradual transition from zero to full transparency.
  10695. @end table
  10696. @subsection Commands
  10697. This filter supports same @ref{commands} as options.
  10698. The command accepts the same syntax of the corresponding option.
  10699. If the specified expression is not valid, it is kept at its current
  10700. value.
  10701. @section lut, lutrgb, lutyuv
  10702. Compute a look-up table for binding each pixel component input value
  10703. to an output value, and apply it to the input video.
  10704. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10705. to an RGB input video.
  10706. These filters accept the following parameters:
  10707. @table @option
  10708. @item c0
  10709. set first pixel component expression
  10710. @item c1
  10711. set second pixel component expression
  10712. @item c2
  10713. set third pixel component expression
  10714. @item c3
  10715. set fourth pixel component expression, corresponds to the alpha component
  10716. @item r
  10717. set red component expression
  10718. @item g
  10719. set green component expression
  10720. @item b
  10721. set blue component expression
  10722. @item a
  10723. alpha component expression
  10724. @item y
  10725. set Y/luminance component expression
  10726. @item u
  10727. set U/Cb component expression
  10728. @item v
  10729. set V/Cr component expression
  10730. @end table
  10731. Each of them specifies the expression to use for computing the lookup table for
  10732. the corresponding pixel component values.
  10733. The exact component associated to each of the @var{c*} options depends on the
  10734. format in input.
  10735. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10736. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10737. The expressions can contain the following constants and functions:
  10738. @table @option
  10739. @item w
  10740. @item h
  10741. The input width and height.
  10742. @item val
  10743. The input value for the pixel component.
  10744. @item clipval
  10745. The input value, clipped to the @var{minval}-@var{maxval} range.
  10746. @item maxval
  10747. The maximum value for the pixel component.
  10748. @item minval
  10749. The minimum value for the pixel component.
  10750. @item negval
  10751. The negated value for the pixel component value, clipped to the
  10752. @var{minval}-@var{maxval} range; it corresponds to the expression
  10753. "maxval-clipval+minval".
  10754. @item clip(val)
  10755. The computed value in @var{val}, clipped to the
  10756. @var{minval}-@var{maxval} range.
  10757. @item gammaval(gamma)
  10758. The computed gamma correction value of the pixel component value,
  10759. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10760. expression
  10761. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10762. @end table
  10763. All expressions default to "val".
  10764. @subsection Examples
  10765. @itemize
  10766. @item
  10767. Negate input video:
  10768. @example
  10769. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10770. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10771. @end example
  10772. The above is the same as:
  10773. @example
  10774. lutrgb="r=negval:g=negval:b=negval"
  10775. lutyuv="y=negval:u=negval:v=negval"
  10776. @end example
  10777. @item
  10778. Negate luminance:
  10779. @example
  10780. lutyuv=y=negval
  10781. @end example
  10782. @item
  10783. Remove chroma components, turning the video into a graytone image:
  10784. @example
  10785. lutyuv="u=128:v=128"
  10786. @end example
  10787. @item
  10788. Apply a luma burning effect:
  10789. @example
  10790. lutyuv="y=2*val"
  10791. @end example
  10792. @item
  10793. Remove green and blue components:
  10794. @example
  10795. lutrgb="g=0:b=0"
  10796. @end example
  10797. @item
  10798. Set a constant alpha channel value on input:
  10799. @example
  10800. format=rgba,lutrgb=a="maxval-minval/2"
  10801. @end example
  10802. @item
  10803. Correct luminance gamma by a factor of 0.5:
  10804. @example
  10805. lutyuv=y=gammaval(0.5)
  10806. @end example
  10807. @item
  10808. Discard least significant bits of luma:
  10809. @example
  10810. lutyuv=y='bitand(val, 128+64+32)'
  10811. @end example
  10812. @item
  10813. Technicolor like effect:
  10814. @example
  10815. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10816. @end example
  10817. @end itemize
  10818. @section lut2, tlut2
  10819. The @code{lut2} filter takes two input streams and outputs one
  10820. stream.
  10821. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10822. from one single stream.
  10823. This filter accepts the following parameters:
  10824. @table @option
  10825. @item c0
  10826. set first pixel component expression
  10827. @item c1
  10828. set second pixel component expression
  10829. @item c2
  10830. set third pixel component expression
  10831. @item c3
  10832. set fourth pixel component expression, corresponds to the alpha component
  10833. @item d
  10834. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10835. which means bit depth is automatically picked from first input format.
  10836. @end table
  10837. The @code{lut2} filter also supports the @ref{framesync} options.
  10838. Each of them specifies the expression to use for computing the lookup table for
  10839. the corresponding pixel component values.
  10840. The exact component associated to each of the @var{c*} options depends on the
  10841. format in inputs.
  10842. The expressions can contain the following constants:
  10843. @table @option
  10844. @item w
  10845. @item h
  10846. The input width and height.
  10847. @item x
  10848. The first input value for the pixel component.
  10849. @item y
  10850. The second input value for the pixel component.
  10851. @item bdx
  10852. The first input video bit depth.
  10853. @item bdy
  10854. The second input video bit depth.
  10855. @end table
  10856. All expressions default to "x".
  10857. @subsection Commands
  10858. This filter supports the all above options as @ref{commands} except option @code{d}.
  10859. @subsection Examples
  10860. @itemize
  10861. @item
  10862. Highlight differences between two RGB video streams:
  10863. @example
  10864. 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)'
  10865. @end example
  10866. @item
  10867. Highlight differences between two YUV video streams:
  10868. @example
  10869. 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)'
  10870. @end example
  10871. @item
  10872. Show max difference between two video streams:
  10873. @example
  10874. 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)))'
  10875. @end example
  10876. @end itemize
  10877. @section maskedclamp
  10878. Clamp the first input stream with the second input and third input stream.
  10879. Returns the value of first stream to be between second input
  10880. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10881. This filter accepts the following options:
  10882. @table @option
  10883. @item undershoot
  10884. Default value is @code{0}.
  10885. @item overshoot
  10886. Default value is @code{0}.
  10887. @item planes
  10888. Set which planes will be processed as bitmap, unprocessed planes will be
  10889. copied from first stream.
  10890. By default value 0xf, all planes will be processed.
  10891. @end table
  10892. @subsection Commands
  10893. This filter supports the all above options as @ref{commands}.
  10894. @section maskedmax
  10895. Merge the second and third input stream into output stream using absolute differences
  10896. between second input stream and first input stream and absolute difference between
  10897. third input stream and first input stream. The picked value will be from second input
  10898. stream if second absolute difference is greater than first one or from third input stream
  10899. otherwise.
  10900. This filter accepts the following options:
  10901. @table @option
  10902. @item planes
  10903. Set which planes will be processed as bitmap, unprocessed planes will be
  10904. copied from first stream.
  10905. By default value 0xf, all planes will be processed.
  10906. @end table
  10907. @subsection Commands
  10908. This filter supports the all above options as @ref{commands}.
  10909. @section maskedmerge
  10910. Merge the first input stream with the second input stream using per pixel
  10911. weights in the third input stream.
  10912. A value of 0 in the third stream pixel component means that pixel component
  10913. from first stream is returned unchanged, while maximum value (eg. 255 for
  10914. 8-bit videos) means that pixel component from second stream is returned
  10915. unchanged. Intermediate values define the amount of merging between both
  10916. input stream's pixel components.
  10917. This filter accepts the following options:
  10918. @table @option
  10919. @item planes
  10920. Set which planes will be processed as bitmap, unprocessed planes will be
  10921. copied from first stream.
  10922. By default value 0xf, all planes will be processed.
  10923. @end table
  10924. @subsection Commands
  10925. This filter supports the all above options as @ref{commands}.
  10926. @section maskedmin
  10927. Merge the second and third input stream into output stream using absolute differences
  10928. between second input stream and first input stream and absolute difference between
  10929. third input stream and first input stream. The picked value will be from second input
  10930. stream if second absolute difference is less than first one or from third input stream
  10931. otherwise.
  10932. This filter accepts the following options:
  10933. @table @option
  10934. @item planes
  10935. Set which planes will be processed as bitmap, unprocessed planes will be
  10936. copied from first stream.
  10937. By default value 0xf, all planes will be processed.
  10938. @end table
  10939. @subsection Commands
  10940. This filter supports the all above options as @ref{commands}.
  10941. @section maskedthreshold
  10942. Pick pixels comparing absolute difference of two video streams with fixed
  10943. threshold.
  10944. If absolute difference between pixel component of first and second video
  10945. stream is equal or lower than user supplied threshold than pixel component
  10946. from first video stream is picked, otherwise pixel component from second
  10947. video stream is picked.
  10948. This filter accepts the following options:
  10949. @table @option
  10950. @item threshold
  10951. Set threshold used when picking pixels from absolute difference from two input
  10952. video streams.
  10953. @item planes
  10954. Set which planes will be processed as bitmap, unprocessed planes will be
  10955. copied from second stream.
  10956. By default value 0xf, all planes will be processed.
  10957. @end table
  10958. @subsection Commands
  10959. This filter supports the all above options as @ref{commands}.
  10960. @section maskfun
  10961. Create mask from input video.
  10962. For example it is useful to create motion masks after @code{tblend} filter.
  10963. This filter accepts the following options:
  10964. @table @option
  10965. @item low
  10966. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10967. @item high
  10968. Set high threshold. Any pixel component higher than this value will be set to max value
  10969. allowed for current pixel format.
  10970. @item planes
  10971. Set planes to filter, by default all available planes are filtered.
  10972. @item fill
  10973. Fill all frame pixels with this value.
  10974. @item sum
  10975. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10976. average, output frame will be completely filled with value set by @var{fill} option.
  10977. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10978. @end table
  10979. @section mcdeint
  10980. Apply motion-compensation deinterlacing.
  10981. It needs one field per frame as input and must thus be used together
  10982. with yadif=1/3 or equivalent.
  10983. This filter accepts the following options:
  10984. @table @option
  10985. @item mode
  10986. Set the deinterlacing mode.
  10987. It accepts one of the following values:
  10988. @table @samp
  10989. @item fast
  10990. @item medium
  10991. @item slow
  10992. use iterative motion estimation
  10993. @item extra_slow
  10994. like @samp{slow}, but use multiple reference frames.
  10995. @end table
  10996. Default value is @samp{fast}.
  10997. @item parity
  10998. Set the picture field parity assumed for the input video. It must be
  10999. one of the following values:
  11000. @table @samp
  11001. @item 0, tff
  11002. assume top field first
  11003. @item 1, bff
  11004. assume bottom field first
  11005. @end table
  11006. Default value is @samp{bff}.
  11007. @item qp
  11008. Set per-block quantization parameter (QP) used by the internal
  11009. encoder.
  11010. Higher values should result in a smoother motion vector field but less
  11011. optimal individual vectors. Default value is 1.
  11012. @end table
  11013. @section median
  11014. Pick median pixel from certain rectangle defined by radius.
  11015. This filter accepts the following options:
  11016. @table @option
  11017. @item radius
  11018. Set horizontal radius size. Default value is @code{1}.
  11019. Allowed range is integer from 1 to 127.
  11020. @item planes
  11021. Set which planes to process. Default is @code{15}, which is all available planes.
  11022. @item radiusV
  11023. Set vertical radius size. Default value is @code{0}.
  11024. Allowed range is integer from 0 to 127.
  11025. If it is 0, value will be picked from horizontal @code{radius} option.
  11026. @item percentile
  11027. Set median percentile. Default value is @code{0.5}.
  11028. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  11029. minimum values, and @code{1} maximum values.
  11030. @end table
  11031. @subsection Commands
  11032. This filter supports same @ref{commands} as options.
  11033. The command accepts the same syntax of the corresponding option.
  11034. If the specified expression is not valid, it is kept at its current
  11035. value.
  11036. @section mergeplanes
  11037. Merge color channel components from several video streams.
  11038. The filter accepts up to 4 input streams, and merge selected input
  11039. planes to the output video.
  11040. This filter accepts the following options:
  11041. @table @option
  11042. @item mapping
  11043. Set input to output plane mapping. Default is @code{0}.
  11044. The mappings is specified as a bitmap. It should be specified as a
  11045. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  11046. mapping for the first plane of the output stream. 'A' sets the number of
  11047. the input stream to use (from 0 to 3), and 'a' the plane number of the
  11048. corresponding input to use (from 0 to 3). The rest of the mappings is
  11049. similar, 'Bb' describes the mapping for the output stream second
  11050. plane, 'Cc' describes the mapping for the output stream third plane and
  11051. 'Dd' describes the mapping for the output stream fourth plane.
  11052. @item format
  11053. Set output pixel format. Default is @code{yuva444p}.
  11054. @end table
  11055. @subsection Examples
  11056. @itemize
  11057. @item
  11058. Merge three gray video streams of same width and height into single video stream:
  11059. @example
  11060. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  11061. @end example
  11062. @item
  11063. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  11064. @example
  11065. [a0][a1]mergeplanes=0x00010210:yuva444p
  11066. @end example
  11067. @item
  11068. Swap Y and A plane in yuva444p stream:
  11069. @example
  11070. format=yuva444p,mergeplanes=0x03010200:yuva444p
  11071. @end example
  11072. @item
  11073. Swap U and V plane in yuv420p stream:
  11074. @example
  11075. format=yuv420p,mergeplanes=0x000201:yuv420p
  11076. @end example
  11077. @item
  11078. Cast a rgb24 clip to yuv444p:
  11079. @example
  11080. format=rgb24,mergeplanes=0x000102:yuv444p
  11081. @end example
  11082. @end itemize
  11083. @section mestimate
  11084. Estimate and export motion vectors using block matching algorithms.
  11085. Motion vectors are stored in frame side data to be used by other filters.
  11086. This filter accepts the following options:
  11087. @table @option
  11088. @item method
  11089. Specify the motion estimation method. Accepts one of the following values:
  11090. @table @samp
  11091. @item esa
  11092. Exhaustive search algorithm.
  11093. @item tss
  11094. Three step search algorithm.
  11095. @item tdls
  11096. Two dimensional logarithmic search algorithm.
  11097. @item ntss
  11098. New three step search algorithm.
  11099. @item fss
  11100. Four step search algorithm.
  11101. @item ds
  11102. Diamond search algorithm.
  11103. @item hexbs
  11104. Hexagon-based search algorithm.
  11105. @item epzs
  11106. Enhanced predictive zonal search algorithm.
  11107. @item umh
  11108. Uneven multi-hexagon search algorithm.
  11109. @end table
  11110. Default value is @samp{esa}.
  11111. @item mb_size
  11112. Macroblock size. Default @code{16}.
  11113. @item search_param
  11114. Search parameter. Default @code{7}.
  11115. @end table
  11116. @section midequalizer
  11117. Apply Midway Image Equalization effect using two video streams.
  11118. Midway Image Equalization adjusts a pair of images to have the same
  11119. histogram, while maintaining their dynamics as much as possible. It's
  11120. useful for e.g. matching exposures from a pair of stereo cameras.
  11121. This filter has two inputs and one output, which must be of same pixel format, but
  11122. may be of different sizes. The output of filter is first input adjusted with
  11123. midway histogram of both inputs.
  11124. This filter accepts the following option:
  11125. @table @option
  11126. @item planes
  11127. Set which planes to process. Default is @code{15}, which is all available planes.
  11128. @end table
  11129. @section minterpolate
  11130. Convert the video to specified frame rate using motion interpolation.
  11131. This filter accepts the following options:
  11132. @table @option
  11133. @item fps
  11134. 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}.
  11135. @item mi_mode
  11136. Motion interpolation mode. Following values are accepted:
  11137. @table @samp
  11138. @item dup
  11139. Duplicate previous or next frame for interpolating new ones.
  11140. @item blend
  11141. Blend source frames. Interpolated frame is mean of previous and next frames.
  11142. @item mci
  11143. Motion compensated interpolation. Following options are effective when this mode is selected:
  11144. @table @samp
  11145. @item mc_mode
  11146. Motion compensation mode. Following values are accepted:
  11147. @table @samp
  11148. @item obmc
  11149. Overlapped block motion compensation.
  11150. @item aobmc
  11151. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  11152. @end table
  11153. Default mode is @samp{obmc}.
  11154. @item me_mode
  11155. Motion estimation mode. Following values are accepted:
  11156. @table @samp
  11157. @item bidir
  11158. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  11159. @item bilat
  11160. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  11161. @end table
  11162. Default mode is @samp{bilat}.
  11163. @item me
  11164. The algorithm to be used for motion estimation. Following values are accepted:
  11165. @table @samp
  11166. @item esa
  11167. Exhaustive search algorithm.
  11168. @item tss
  11169. Three step search algorithm.
  11170. @item tdls
  11171. Two dimensional logarithmic search algorithm.
  11172. @item ntss
  11173. New three step search algorithm.
  11174. @item fss
  11175. Four step search algorithm.
  11176. @item ds
  11177. Diamond search algorithm.
  11178. @item hexbs
  11179. Hexagon-based search algorithm.
  11180. @item epzs
  11181. Enhanced predictive zonal search algorithm.
  11182. @item umh
  11183. Uneven multi-hexagon search algorithm.
  11184. @end table
  11185. Default algorithm is @samp{epzs}.
  11186. @item mb_size
  11187. Macroblock size. Default @code{16}.
  11188. @item search_param
  11189. Motion estimation search parameter. Default @code{32}.
  11190. @item vsbmc
  11191. 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).
  11192. @end table
  11193. @end table
  11194. @item scd
  11195. 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:
  11196. @table @samp
  11197. @item none
  11198. Disable scene change detection.
  11199. @item fdiff
  11200. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  11201. @end table
  11202. Default method is @samp{fdiff}.
  11203. @item scd_threshold
  11204. Scene change detection threshold. Default is @code{10.}.
  11205. @end table
  11206. @section mix
  11207. Mix several video input streams into one video stream.
  11208. A description of the accepted options follows.
  11209. @table @option
  11210. @item nb_inputs
  11211. The number of inputs. If unspecified, it defaults to 2.
  11212. @item weights
  11213. Specify weight of each input video stream as sequence.
  11214. Each weight is separated by space. If number of weights
  11215. is smaller than number of @var{frames} last specified
  11216. weight will be used for all remaining unset weights.
  11217. @item scale
  11218. Specify scale, if it is set it will be multiplied with sum
  11219. of each weight multiplied with pixel values to give final destination
  11220. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11221. @item duration
  11222. Specify how end of stream is determined.
  11223. @table @samp
  11224. @item longest
  11225. The duration of the longest input. (default)
  11226. @item shortest
  11227. The duration of the shortest input.
  11228. @item first
  11229. The duration of the first input.
  11230. @end table
  11231. @end table
  11232. @subsection Commands
  11233. This filter supports the following commands:
  11234. @table @option
  11235. @item weights
  11236. @item scale
  11237. Syntax is same as option with same name.
  11238. @end table
  11239. @section mpdecimate
  11240. Drop frames that do not differ greatly from the previous frame in
  11241. order to reduce frame rate.
  11242. The main use of this filter is for very-low-bitrate encoding
  11243. (e.g. streaming over dialup modem), but it could in theory be used for
  11244. fixing movies that were inverse-telecined incorrectly.
  11245. A description of the accepted options follows.
  11246. @table @option
  11247. @item max
  11248. Set the maximum number of consecutive frames which can be dropped (if
  11249. positive), or the minimum interval between dropped frames (if
  11250. negative). If the value is 0, the frame is dropped disregarding the
  11251. number of previous sequentially dropped frames.
  11252. Default value is 0.
  11253. @item hi
  11254. @item lo
  11255. @item frac
  11256. Set the dropping threshold values.
  11257. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  11258. represent actual pixel value differences, so a threshold of 64
  11259. corresponds to 1 unit of difference for each pixel, or the same spread
  11260. out differently over the block.
  11261. A frame is a candidate for dropping if no 8x8 blocks differ by more
  11262. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  11263. meaning the whole image) differ by more than a threshold of @option{lo}.
  11264. Default value for @option{hi} is 64*12, default value for @option{lo} is
  11265. 64*5, and default value for @option{frac} is 0.33.
  11266. @end table
  11267. @section negate
  11268. Negate (invert) the input video.
  11269. It accepts the following option:
  11270. @table @option
  11271. @item negate_alpha
  11272. With value 1, it negates the alpha component, if present. Default value is 0.
  11273. @end table
  11274. @anchor{nlmeans}
  11275. @section nlmeans
  11276. Denoise frames using Non-Local Means algorithm.
  11277. Each pixel is adjusted by looking for other pixels with similar contexts. This
  11278. context similarity is defined by comparing their surrounding patches of size
  11279. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  11280. around the pixel.
  11281. Note that the research area defines centers for patches, which means some
  11282. patches will be made of pixels outside that research area.
  11283. The filter accepts the following options.
  11284. @table @option
  11285. @item s
  11286. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  11287. @item p
  11288. Set patch size. Default is 7. Must be odd number in range [0, 99].
  11289. @item pc
  11290. Same as @option{p} but for chroma planes.
  11291. The default value is @var{0} and means automatic.
  11292. @item r
  11293. Set research size. Default is 15. Must be odd number in range [0, 99].
  11294. @item rc
  11295. Same as @option{r} but for chroma planes.
  11296. The default value is @var{0} and means automatic.
  11297. @end table
  11298. @section nnedi
  11299. Deinterlace video using neural network edge directed interpolation.
  11300. This filter accepts the following options:
  11301. @table @option
  11302. @item weights
  11303. Mandatory option, without binary file filter can not work.
  11304. Currently file can be found here:
  11305. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  11306. @item deint
  11307. Set which frames to deinterlace, by default it is @code{all}.
  11308. Can be @code{all} or @code{interlaced}.
  11309. @item field
  11310. Set mode of operation.
  11311. Can be one of the following:
  11312. @table @samp
  11313. @item af
  11314. Use frame flags, both fields.
  11315. @item a
  11316. Use frame flags, single field.
  11317. @item t
  11318. Use top field only.
  11319. @item b
  11320. Use bottom field only.
  11321. @item tf
  11322. Use both fields, top first.
  11323. @item bf
  11324. Use both fields, bottom first.
  11325. @end table
  11326. @item planes
  11327. Set which planes to process, by default filter process all frames.
  11328. @item nsize
  11329. Set size of local neighborhood around each pixel, used by the predictor neural
  11330. network.
  11331. Can be one of the following:
  11332. @table @samp
  11333. @item s8x6
  11334. @item s16x6
  11335. @item s32x6
  11336. @item s48x6
  11337. @item s8x4
  11338. @item s16x4
  11339. @item s32x4
  11340. @end table
  11341. @item nns
  11342. Set the number of neurons in predictor neural network.
  11343. Can be one of the following:
  11344. @table @samp
  11345. @item n16
  11346. @item n32
  11347. @item n64
  11348. @item n128
  11349. @item n256
  11350. @end table
  11351. @item qual
  11352. Controls the number of different neural network predictions that are blended
  11353. together to compute the final output value. Can be @code{fast}, default or
  11354. @code{slow}.
  11355. @item etype
  11356. Set which set of weights to use in the predictor.
  11357. Can be one of the following:
  11358. @table @samp
  11359. @item a, abs
  11360. weights trained to minimize absolute error
  11361. @item s, mse
  11362. weights trained to minimize squared error
  11363. @end table
  11364. @item pscrn
  11365. Controls whether or not the prescreener neural network is used to decide
  11366. which pixels should be processed by the predictor neural network and which
  11367. can be handled by simple cubic interpolation.
  11368. The prescreener is trained to know whether cubic interpolation will be
  11369. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11370. The computational complexity of the prescreener nn is much less than that of
  11371. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11372. using the prescreener generally results in much faster processing.
  11373. The prescreener is pretty accurate, so the difference between using it and not
  11374. using it is almost always unnoticeable.
  11375. Can be one of the following:
  11376. @table @samp
  11377. @item none
  11378. @item original
  11379. @item new
  11380. @item new2
  11381. @item new3
  11382. @end table
  11383. Default is @code{new}.
  11384. @end table
  11385. @subsection Commands
  11386. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  11387. @section noformat
  11388. Force libavfilter not to use any of the specified pixel formats for the
  11389. input to the next filter.
  11390. It accepts the following parameters:
  11391. @table @option
  11392. @item pix_fmts
  11393. A '|'-separated list of pixel format names, such as
  11394. pix_fmts=yuv420p|monow|rgb24".
  11395. @end table
  11396. @subsection Examples
  11397. @itemize
  11398. @item
  11399. Force libavfilter to use a format different from @var{yuv420p} for the
  11400. input to the vflip filter:
  11401. @example
  11402. noformat=pix_fmts=yuv420p,vflip
  11403. @end example
  11404. @item
  11405. Convert the input video to any of the formats not contained in the list:
  11406. @example
  11407. noformat=yuv420p|yuv444p|yuv410p
  11408. @end example
  11409. @end itemize
  11410. @section noise
  11411. Add noise on video input frame.
  11412. The filter accepts the following options:
  11413. @table @option
  11414. @item all_seed
  11415. @item c0_seed
  11416. @item c1_seed
  11417. @item c2_seed
  11418. @item c3_seed
  11419. Set noise seed for specific pixel component or all pixel components in case
  11420. of @var{all_seed}. Default value is @code{123457}.
  11421. @item all_strength, alls
  11422. @item c0_strength, c0s
  11423. @item c1_strength, c1s
  11424. @item c2_strength, c2s
  11425. @item c3_strength, c3s
  11426. Set noise strength for specific pixel component or all pixel components in case
  11427. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11428. @item all_flags, allf
  11429. @item c0_flags, c0f
  11430. @item c1_flags, c1f
  11431. @item c2_flags, c2f
  11432. @item c3_flags, c3f
  11433. Set pixel component flags or set flags for all components if @var{all_flags}.
  11434. Available values for component flags are:
  11435. @table @samp
  11436. @item a
  11437. averaged temporal noise (smoother)
  11438. @item p
  11439. mix random noise with a (semi)regular pattern
  11440. @item t
  11441. temporal noise (noise pattern changes between frames)
  11442. @item u
  11443. uniform noise (gaussian otherwise)
  11444. @end table
  11445. @end table
  11446. @subsection Examples
  11447. Add temporal and uniform noise to input video:
  11448. @example
  11449. noise=alls=20:allf=t+u
  11450. @end example
  11451. @section normalize
  11452. Normalize RGB video (aka histogram stretching, contrast stretching).
  11453. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11454. For each channel of each frame, the filter computes the input range and maps
  11455. it linearly to the user-specified output range. The output range defaults
  11456. to the full dynamic range from pure black to pure white.
  11457. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11458. changes in brightness) caused when small dark or bright objects enter or leave
  11459. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11460. video camera, and, like a video camera, it may cause a period of over- or
  11461. under-exposure of the video.
  11462. The R,G,B channels can be normalized independently, which may cause some
  11463. color shifting, or linked together as a single channel, which prevents
  11464. color shifting. Linked normalization preserves hue. Independent normalization
  11465. does not, so it can be used to remove some color casts. Independent and linked
  11466. normalization can be combined in any ratio.
  11467. The normalize filter accepts the following options:
  11468. @table @option
  11469. @item blackpt
  11470. @item whitept
  11471. Colors which define the output range. The minimum input value is mapped to
  11472. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11473. The defaults are black and white respectively. Specifying white for
  11474. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11475. normalized video. Shades of grey can be used to reduce the dynamic range
  11476. (contrast). Specifying saturated colors here can create some interesting
  11477. effects.
  11478. @item smoothing
  11479. The number of previous frames to use for temporal smoothing. The input range
  11480. of each channel is smoothed using a rolling average over the current frame
  11481. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11482. smoothing).
  11483. @item independence
  11484. Controls the ratio of independent (color shifting) channel normalization to
  11485. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11486. independent. Defaults to 1.0 (fully independent).
  11487. @item strength
  11488. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11489. expensive no-op. Defaults to 1.0 (full strength).
  11490. @end table
  11491. @subsection Commands
  11492. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11493. The command accepts the same syntax of the corresponding option.
  11494. If the specified expression is not valid, it is kept at its current
  11495. value.
  11496. @subsection Examples
  11497. Stretch video contrast to use the full dynamic range, with no temporal
  11498. smoothing; may flicker depending on the source content:
  11499. @example
  11500. normalize=blackpt=black:whitept=white:smoothing=0
  11501. @end example
  11502. As above, but with 50 frames of temporal smoothing; flicker should be
  11503. reduced, depending on the source content:
  11504. @example
  11505. normalize=blackpt=black:whitept=white:smoothing=50
  11506. @end example
  11507. As above, but with hue-preserving linked channel normalization:
  11508. @example
  11509. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11510. @end example
  11511. As above, but with half strength:
  11512. @example
  11513. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11514. @end example
  11515. Map the darkest input color to red, the brightest input color to cyan:
  11516. @example
  11517. normalize=blackpt=red:whitept=cyan
  11518. @end example
  11519. @section null
  11520. Pass the video source unchanged to the output.
  11521. @section ocr
  11522. Optical Character Recognition
  11523. This filter uses Tesseract for optical character recognition. To enable
  11524. compilation of this filter, you need to configure FFmpeg with
  11525. @code{--enable-libtesseract}.
  11526. It accepts the following options:
  11527. @table @option
  11528. @item datapath
  11529. Set datapath to tesseract data. Default is to use whatever was
  11530. set at installation.
  11531. @item language
  11532. Set language, default is "eng".
  11533. @item whitelist
  11534. Set character whitelist.
  11535. @item blacklist
  11536. Set character blacklist.
  11537. @end table
  11538. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11539. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11540. @section ocv
  11541. Apply a video transform using libopencv.
  11542. To enable this filter, install the libopencv library and headers and
  11543. configure FFmpeg with @code{--enable-libopencv}.
  11544. It accepts the following parameters:
  11545. @table @option
  11546. @item filter_name
  11547. The name of the libopencv filter to apply.
  11548. @item filter_params
  11549. The parameters to pass to the libopencv filter. If not specified, the default
  11550. values are assumed.
  11551. @end table
  11552. Refer to the official libopencv documentation for more precise
  11553. information:
  11554. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11555. Several libopencv filters are supported; see the following subsections.
  11556. @anchor{dilate}
  11557. @subsection dilate
  11558. Dilate an image by using a specific structuring element.
  11559. It corresponds to the libopencv function @code{cvDilate}.
  11560. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11561. @var{struct_el} represents a structuring element, and has the syntax:
  11562. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11563. @var{cols} and @var{rows} represent the number of columns and rows of
  11564. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11565. point, and @var{shape} the shape for the structuring element. @var{shape}
  11566. must be "rect", "cross", "ellipse", or "custom".
  11567. If the value for @var{shape} is "custom", it must be followed by a
  11568. string of the form "=@var{filename}". The file with name
  11569. @var{filename} is assumed to represent a binary image, with each
  11570. printable character corresponding to a bright pixel. When a custom
  11571. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11572. or columns and rows of the read file are assumed instead.
  11573. The default value for @var{struct_el} is "3x3+0x0/rect".
  11574. @var{nb_iterations} specifies the number of times the transform is
  11575. applied to the image, and defaults to 1.
  11576. Some examples:
  11577. @example
  11578. # Use the default values
  11579. ocv=dilate
  11580. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11581. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11582. # Read the shape from the file diamond.shape, iterating two times.
  11583. # The file diamond.shape may contain a pattern of characters like this
  11584. # *
  11585. # ***
  11586. # *****
  11587. # ***
  11588. # *
  11589. # The specified columns and rows are ignored
  11590. # but the anchor point coordinates are not
  11591. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11592. @end example
  11593. @subsection erode
  11594. Erode an image by using a specific structuring element.
  11595. It corresponds to the libopencv function @code{cvErode}.
  11596. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11597. with the same syntax and semantics as the @ref{dilate} filter.
  11598. @subsection smooth
  11599. Smooth the input video.
  11600. The filter takes the following parameters:
  11601. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11602. @var{type} is the type of smooth filter to apply, and must be one of
  11603. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11604. or "bilateral". The default value is "gaussian".
  11605. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11606. depends on the smooth type. @var{param1} and
  11607. @var{param2} accept integer positive values or 0. @var{param3} and
  11608. @var{param4} accept floating point values.
  11609. The default value for @var{param1} is 3. The default value for the
  11610. other parameters is 0.
  11611. These parameters correspond to the parameters assigned to the
  11612. libopencv function @code{cvSmooth}.
  11613. @section oscilloscope
  11614. 2D Video Oscilloscope.
  11615. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11616. It accepts the following parameters:
  11617. @table @option
  11618. @item x
  11619. Set scope center x position.
  11620. @item y
  11621. Set scope center y position.
  11622. @item s
  11623. Set scope size, relative to frame diagonal.
  11624. @item t
  11625. Set scope tilt/rotation.
  11626. @item o
  11627. Set trace opacity.
  11628. @item tx
  11629. Set trace center x position.
  11630. @item ty
  11631. Set trace center y position.
  11632. @item tw
  11633. Set trace width, relative to width of frame.
  11634. @item th
  11635. Set trace height, relative to height of frame.
  11636. @item c
  11637. Set which components to trace. By default it traces first three components.
  11638. @item g
  11639. Draw trace grid. By default is enabled.
  11640. @item st
  11641. Draw some statistics. By default is enabled.
  11642. @item sc
  11643. Draw scope. By default is enabled.
  11644. @end table
  11645. @subsection Commands
  11646. This filter supports same @ref{commands} as options.
  11647. The command accepts the same syntax of the corresponding option.
  11648. If the specified expression is not valid, it is kept at its current
  11649. value.
  11650. @subsection Examples
  11651. @itemize
  11652. @item
  11653. Inspect full first row of video frame.
  11654. @example
  11655. oscilloscope=x=0.5:y=0:s=1
  11656. @end example
  11657. @item
  11658. Inspect full last row of video frame.
  11659. @example
  11660. oscilloscope=x=0.5:y=1:s=1
  11661. @end example
  11662. @item
  11663. Inspect full 5th line of video frame of height 1080.
  11664. @example
  11665. oscilloscope=x=0.5:y=5/1080:s=1
  11666. @end example
  11667. @item
  11668. Inspect full last column of video frame.
  11669. @example
  11670. oscilloscope=x=1:y=0.5:s=1:t=1
  11671. @end example
  11672. @end itemize
  11673. @anchor{overlay}
  11674. @section overlay
  11675. Overlay one video on top of another.
  11676. It takes two inputs and has one output. The first input is the "main"
  11677. video on which the second input is overlaid.
  11678. It accepts the following parameters:
  11679. A description of the accepted options follows.
  11680. @table @option
  11681. @item x
  11682. @item y
  11683. Set the expression for the x and y coordinates of the overlaid video
  11684. on the main video. Default value is "0" for both expressions. In case
  11685. the expression is invalid, it is set to a huge value (meaning that the
  11686. overlay will not be displayed within the output visible area).
  11687. @item eof_action
  11688. See @ref{framesync}.
  11689. @item eval
  11690. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11691. It accepts the following values:
  11692. @table @samp
  11693. @item init
  11694. only evaluate expressions once during the filter initialization or
  11695. when a command is processed
  11696. @item frame
  11697. evaluate expressions for each incoming frame
  11698. @end table
  11699. Default value is @samp{frame}.
  11700. @item shortest
  11701. See @ref{framesync}.
  11702. @item format
  11703. Set the format for the output video.
  11704. It accepts the following values:
  11705. @table @samp
  11706. @item yuv420
  11707. force YUV420 output
  11708. @item yuv420p10
  11709. force YUV420p10 output
  11710. @item yuv422
  11711. force YUV422 output
  11712. @item yuv422p10
  11713. force YUV422p10 output
  11714. @item yuv444
  11715. force YUV444 output
  11716. @item rgb
  11717. force packed RGB output
  11718. @item gbrp
  11719. force planar RGB output
  11720. @item auto
  11721. automatically pick format
  11722. @end table
  11723. Default value is @samp{yuv420}.
  11724. @item repeatlast
  11725. See @ref{framesync}.
  11726. @item alpha
  11727. Set format of alpha of the overlaid video, it can be @var{straight} or
  11728. @var{premultiplied}. Default is @var{straight}.
  11729. @end table
  11730. The @option{x}, and @option{y} expressions can contain the following
  11731. parameters.
  11732. @table @option
  11733. @item main_w, W
  11734. @item main_h, H
  11735. The main input width and height.
  11736. @item overlay_w, w
  11737. @item overlay_h, h
  11738. The overlay input width and height.
  11739. @item x
  11740. @item y
  11741. The computed values for @var{x} and @var{y}. They are evaluated for
  11742. each new frame.
  11743. @item hsub
  11744. @item vsub
  11745. horizontal and vertical chroma subsample values of the output
  11746. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11747. @var{vsub} is 1.
  11748. @item n
  11749. the number of input frame, starting from 0
  11750. @item pos
  11751. the position in the file of the input frame, NAN if unknown
  11752. @item t
  11753. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11754. @end table
  11755. This filter also supports the @ref{framesync} options.
  11756. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11757. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11758. when @option{eval} is set to @samp{init}.
  11759. Be aware that frames are taken from each input video in timestamp
  11760. order, hence, if their initial timestamps differ, it is a good idea
  11761. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11762. have them begin in the same zero timestamp, as the example for
  11763. the @var{movie} filter does.
  11764. You can chain together more overlays but you should test the
  11765. efficiency of such approach.
  11766. @subsection Commands
  11767. This filter supports the following commands:
  11768. @table @option
  11769. @item x
  11770. @item y
  11771. Modify the x and y of the overlay input.
  11772. The command accepts the same syntax of the corresponding option.
  11773. If the specified expression is not valid, it is kept at its current
  11774. value.
  11775. @end table
  11776. @subsection Examples
  11777. @itemize
  11778. @item
  11779. Draw the overlay at 10 pixels from the bottom right corner of the main
  11780. video:
  11781. @example
  11782. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11783. @end example
  11784. Using named options the example above becomes:
  11785. @example
  11786. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11787. @end example
  11788. @item
  11789. Insert a transparent PNG logo in the bottom left corner of the input,
  11790. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11791. @example
  11792. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11793. @end example
  11794. @item
  11795. Insert 2 different transparent PNG logos (second logo on bottom
  11796. right corner) using the @command{ffmpeg} tool:
  11797. @example
  11798. 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
  11799. @end example
  11800. @item
  11801. Add a transparent color layer on top of the main video; @code{WxH}
  11802. must specify the size of the main input to the overlay filter:
  11803. @example
  11804. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11805. @end example
  11806. @item
  11807. Play an original video and a filtered version (here with the deshake
  11808. filter) side by side using the @command{ffplay} tool:
  11809. @example
  11810. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11811. @end example
  11812. The above command is the same as:
  11813. @example
  11814. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11815. @end example
  11816. @item
  11817. Make a sliding overlay appearing from the left to the right top part of the
  11818. screen starting since time 2:
  11819. @example
  11820. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11821. @end example
  11822. @item
  11823. Compose output by putting two input videos side to side:
  11824. @example
  11825. ffmpeg -i left.avi -i right.avi -filter_complex "
  11826. nullsrc=size=200x100 [background];
  11827. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11828. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11829. [background][left] overlay=shortest=1 [background+left];
  11830. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11831. "
  11832. @end example
  11833. @item
  11834. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11835. @example
  11836. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11837. -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]'
  11838. masked.avi
  11839. @end example
  11840. @item
  11841. Chain several overlays in cascade:
  11842. @example
  11843. nullsrc=s=200x200 [bg];
  11844. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11845. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11846. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11847. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11848. [in3] null, [mid2] overlay=100:100 [out0]
  11849. @end example
  11850. @end itemize
  11851. @anchor{overlay_cuda}
  11852. @section overlay_cuda
  11853. Overlay one video on top of another.
  11854. This is the CUDA variant of the @ref{overlay} filter.
  11855. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11856. It takes two inputs and has one output. The first input is the "main"
  11857. video on which the second input is overlaid.
  11858. It accepts the following parameters:
  11859. @table @option
  11860. @item x
  11861. @item y
  11862. Set the x and y coordinates of the overlaid video on the main video.
  11863. Default value is "0" for both expressions.
  11864. @item eof_action
  11865. See @ref{framesync}.
  11866. @item shortest
  11867. See @ref{framesync}.
  11868. @item repeatlast
  11869. See @ref{framesync}.
  11870. @end table
  11871. This filter also supports the @ref{framesync} options.
  11872. @section owdenoise
  11873. Apply Overcomplete Wavelet denoiser.
  11874. The filter accepts the following options:
  11875. @table @option
  11876. @item depth
  11877. Set depth.
  11878. Larger depth values will denoise lower frequency components more, but
  11879. slow down filtering.
  11880. Must be an int in the range 8-16, default is @code{8}.
  11881. @item luma_strength, ls
  11882. Set luma strength.
  11883. Must be a double value in the range 0-1000, default is @code{1.0}.
  11884. @item chroma_strength, cs
  11885. Set chroma strength.
  11886. Must be a double value in the range 0-1000, default is @code{1.0}.
  11887. @end table
  11888. @anchor{pad}
  11889. @section pad
  11890. Add paddings to the input image, and place the original input at the
  11891. provided @var{x}, @var{y} coordinates.
  11892. It accepts the following parameters:
  11893. @table @option
  11894. @item width, w
  11895. @item height, h
  11896. Specify an expression for the size of the output image with the
  11897. paddings added. If the value for @var{width} or @var{height} is 0, the
  11898. corresponding input size is used for the output.
  11899. The @var{width} expression can reference the value set by the
  11900. @var{height} expression, and vice versa.
  11901. The default value of @var{width} and @var{height} is 0.
  11902. @item x
  11903. @item y
  11904. Specify the offsets to place the input image at within the padded area,
  11905. with respect to the top/left border of the output image.
  11906. The @var{x} expression can reference the value set by the @var{y}
  11907. expression, and vice versa.
  11908. The default value of @var{x} and @var{y} is 0.
  11909. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11910. so the input image is centered on the padded area.
  11911. @item color
  11912. Specify the color of the padded area. For the syntax of this option,
  11913. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11914. manual,ffmpeg-utils}.
  11915. The default value of @var{color} is "black".
  11916. @item eval
  11917. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11918. It accepts the following values:
  11919. @table @samp
  11920. @item init
  11921. Only evaluate expressions once during the filter initialization or when
  11922. a command is processed.
  11923. @item frame
  11924. Evaluate expressions for each incoming frame.
  11925. @end table
  11926. Default value is @samp{init}.
  11927. @item aspect
  11928. Pad to aspect instead to a resolution.
  11929. @end table
  11930. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11931. options are expressions containing the following constants:
  11932. @table @option
  11933. @item in_w
  11934. @item in_h
  11935. The input video width and height.
  11936. @item iw
  11937. @item ih
  11938. These are the same as @var{in_w} and @var{in_h}.
  11939. @item out_w
  11940. @item out_h
  11941. The output width and height (the size of the padded area), as
  11942. specified by the @var{width} and @var{height} expressions.
  11943. @item ow
  11944. @item oh
  11945. These are the same as @var{out_w} and @var{out_h}.
  11946. @item x
  11947. @item y
  11948. The x and y offsets as specified by the @var{x} and @var{y}
  11949. expressions, or NAN if not yet specified.
  11950. @item a
  11951. same as @var{iw} / @var{ih}
  11952. @item sar
  11953. input sample aspect ratio
  11954. @item dar
  11955. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11956. @item hsub
  11957. @item vsub
  11958. The horizontal and vertical chroma subsample values. For example for the
  11959. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11960. @end table
  11961. @subsection Examples
  11962. @itemize
  11963. @item
  11964. Add paddings with the color "violet" to the input video. The output video
  11965. size is 640x480, and the top-left corner of the input video is placed at
  11966. column 0, row 40
  11967. @example
  11968. pad=640:480:0:40:violet
  11969. @end example
  11970. The example above is equivalent to the following command:
  11971. @example
  11972. pad=width=640:height=480:x=0:y=40:color=violet
  11973. @end example
  11974. @item
  11975. Pad the input to get an output with dimensions increased by 3/2,
  11976. and put the input video at the center of the padded area:
  11977. @example
  11978. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11979. @end example
  11980. @item
  11981. Pad the input to get a squared output with size equal to the maximum
  11982. value between the input width and height, and put the input video at
  11983. the center of the padded area:
  11984. @example
  11985. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11986. @end example
  11987. @item
  11988. Pad the input to get a final w/h ratio of 16:9:
  11989. @example
  11990. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11991. @end example
  11992. @item
  11993. In case of anamorphic video, in order to set the output display aspect
  11994. correctly, it is necessary to use @var{sar} in the expression,
  11995. according to the relation:
  11996. @example
  11997. (ih * X / ih) * sar = output_dar
  11998. X = output_dar / sar
  11999. @end example
  12000. Thus the previous example needs to be modified to:
  12001. @example
  12002. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  12003. @end example
  12004. @item
  12005. Double the output size and put the input video in the bottom-right
  12006. corner of the output padded area:
  12007. @example
  12008. pad="2*iw:2*ih:ow-iw:oh-ih"
  12009. @end example
  12010. @end itemize
  12011. @anchor{palettegen}
  12012. @section palettegen
  12013. Generate one palette for a whole video stream.
  12014. It accepts the following options:
  12015. @table @option
  12016. @item max_colors
  12017. Set the maximum number of colors to quantize in the palette.
  12018. Note: the palette will still contain 256 colors; the unused palette entries
  12019. will be black.
  12020. @item reserve_transparent
  12021. Create a palette of 255 colors maximum and reserve the last one for
  12022. transparency. Reserving the transparency color is useful for GIF optimization.
  12023. If not set, the maximum of colors in the palette will be 256. You probably want
  12024. to disable this option for a standalone image.
  12025. Set by default.
  12026. @item transparency_color
  12027. Set the color that will be used as background for transparency.
  12028. @item stats_mode
  12029. Set statistics mode.
  12030. It accepts the following values:
  12031. @table @samp
  12032. @item full
  12033. Compute full frame histograms.
  12034. @item diff
  12035. Compute histograms only for the part that differs from previous frame. This
  12036. might be relevant to give more importance to the moving part of your input if
  12037. the background is static.
  12038. @item single
  12039. Compute new histogram for each frame.
  12040. @end table
  12041. Default value is @var{full}.
  12042. @end table
  12043. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  12044. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  12045. color quantization of the palette. This information is also visible at
  12046. @var{info} logging level.
  12047. @subsection Examples
  12048. @itemize
  12049. @item
  12050. Generate a representative palette of a given video using @command{ffmpeg}:
  12051. @example
  12052. ffmpeg -i input.mkv -vf palettegen palette.png
  12053. @end example
  12054. @end itemize
  12055. @section paletteuse
  12056. Use a palette to downsample an input video stream.
  12057. The filter takes two inputs: one video stream and a palette. The palette must
  12058. be a 256 pixels image.
  12059. It accepts the following options:
  12060. @table @option
  12061. @item dither
  12062. Select dithering mode. Available algorithms are:
  12063. @table @samp
  12064. @item bayer
  12065. Ordered 8x8 bayer dithering (deterministic)
  12066. @item heckbert
  12067. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  12068. Note: this dithering is sometimes considered "wrong" and is included as a
  12069. reference.
  12070. @item floyd_steinberg
  12071. Floyd and Steingberg dithering (error diffusion)
  12072. @item sierra2
  12073. Frankie Sierra dithering v2 (error diffusion)
  12074. @item sierra2_4a
  12075. Frankie Sierra dithering v2 "Lite" (error diffusion)
  12076. @end table
  12077. Default is @var{sierra2_4a}.
  12078. @item bayer_scale
  12079. When @var{bayer} dithering is selected, this option defines the scale of the
  12080. pattern (how much the crosshatch pattern is visible). A low value means more
  12081. visible pattern for less banding, and higher value means less visible pattern
  12082. at the cost of more banding.
  12083. The option must be an integer value in the range [0,5]. Default is @var{2}.
  12084. @item diff_mode
  12085. If set, define the zone to process
  12086. @table @samp
  12087. @item rectangle
  12088. Only the changing rectangle will be reprocessed. This is similar to GIF
  12089. cropping/offsetting compression mechanism. This option can be useful for speed
  12090. if only a part of the image is changing, and has use cases such as limiting the
  12091. scope of the error diffusal @option{dither} to the rectangle that bounds the
  12092. moving scene (it leads to more deterministic output if the scene doesn't change
  12093. much, and as a result less moving noise and better GIF compression).
  12094. @end table
  12095. Default is @var{none}.
  12096. @item new
  12097. Take new palette for each output frame.
  12098. @item alpha_threshold
  12099. Sets the alpha threshold for transparency. Alpha values above this threshold
  12100. will be treated as completely opaque, and values below this threshold will be
  12101. treated as completely transparent.
  12102. The option must be an integer value in the range [0,255]. Default is @var{128}.
  12103. @end table
  12104. @subsection Examples
  12105. @itemize
  12106. @item
  12107. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  12108. using @command{ffmpeg}:
  12109. @example
  12110. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  12111. @end example
  12112. @end itemize
  12113. @section perspective
  12114. Correct perspective of video not recorded perpendicular to the screen.
  12115. A description of the accepted parameters follows.
  12116. @table @option
  12117. @item x0
  12118. @item y0
  12119. @item x1
  12120. @item y1
  12121. @item x2
  12122. @item y2
  12123. @item x3
  12124. @item y3
  12125. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  12126. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  12127. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  12128. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  12129. then the corners of the source will be sent to the specified coordinates.
  12130. The expressions can use the following variables:
  12131. @table @option
  12132. @item W
  12133. @item H
  12134. the width and height of video frame.
  12135. @item in
  12136. Input frame count.
  12137. @item on
  12138. Output frame count.
  12139. @end table
  12140. @item interpolation
  12141. Set interpolation for perspective correction.
  12142. It accepts the following values:
  12143. @table @samp
  12144. @item linear
  12145. @item cubic
  12146. @end table
  12147. Default value is @samp{linear}.
  12148. @item sense
  12149. Set interpretation of coordinate options.
  12150. It accepts the following values:
  12151. @table @samp
  12152. @item 0, source
  12153. Send point in the source specified by the given coordinates to
  12154. the corners of the destination.
  12155. @item 1, destination
  12156. Send the corners of the source to the point in the destination specified
  12157. by the given coordinates.
  12158. Default value is @samp{source}.
  12159. @end table
  12160. @item eval
  12161. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  12162. It accepts the following values:
  12163. @table @samp
  12164. @item init
  12165. only evaluate expressions once during the filter initialization or
  12166. when a command is processed
  12167. @item frame
  12168. evaluate expressions for each incoming frame
  12169. @end table
  12170. Default value is @samp{init}.
  12171. @end table
  12172. @section phase
  12173. Delay interlaced video by one field time so that the field order changes.
  12174. The intended use is to fix PAL movies that have been captured with the
  12175. opposite field order to the film-to-video transfer.
  12176. A description of the accepted parameters follows.
  12177. @table @option
  12178. @item mode
  12179. Set phase mode.
  12180. It accepts the following values:
  12181. @table @samp
  12182. @item t
  12183. Capture field order top-first, transfer bottom-first.
  12184. Filter will delay the bottom field.
  12185. @item b
  12186. Capture field order bottom-first, transfer top-first.
  12187. Filter will delay the top field.
  12188. @item p
  12189. Capture and transfer with the same field order. This mode only exists
  12190. for the documentation of the other options to refer to, but if you
  12191. actually select it, the filter will faithfully do nothing.
  12192. @item a
  12193. Capture field order determined automatically by field flags, transfer
  12194. opposite.
  12195. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  12196. basis using field flags. If no field information is available,
  12197. then this works just like @samp{u}.
  12198. @item u
  12199. Capture unknown or varying, transfer opposite.
  12200. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  12201. analyzing the images and selecting the alternative that produces best
  12202. match between the fields.
  12203. @item T
  12204. Capture top-first, transfer unknown or varying.
  12205. Filter selects among @samp{t} and @samp{p} using image analysis.
  12206. @item B
  12207. Capture bottom-first, transfer unknown or varying.
  12208. Filter selects among @samp{b} and @samp{p} using image analysis.
  12209. @item A
  12210. Capture determined by field flags, transfer unknown or varying.
  12211. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  12212. image analysis. If no field information is available, then this works just
  12213. like @samp{U}. This is the default mode.
  12214. @item U
  12215. Both capture and transfer unknown or varying.
  12216. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  12217. @end table
  12218. @end table
  12219. @subsection Commands
  12220. This filter supports the all above options as @ref{commands}.
  12221. @section photosensitivity
  12222. Reduce various flashes in video, so to help users with epilepsy.
  12223. It accepts the following options:
  12224. @table @option
  12225. @item frames, f
  12226. Set how many frames to use when filtering. Default is 30.
  12227. @item threshold, t
  12228. Set detection threshold factor. Default is 1.
  12229. Lower is stricter.
  12230. @item skip
  12231. Set how many pixels to skip when sampling frames. Default is 1.
  12232. Allowed range is from 1 to 1024.
  12233. @item bypass
  12234. Leave frames unchanged. Default is disabled.
  12235. @end table
  12236. @section pixdesctest
  12237. Pixel format descriptor test filter, mainly useful for internal
  12238. testing. The output video should be equal to the input video.
  12239. For example:
  12240. @example
  12241. format=monow, pixdesctest
  12242. @end example
  12243. can be used to test the monowhite pixel format descriptor definition.
  12244. @section pixscope
  12245. Display sample values of color channels. Mainly useful for checking color
  12246. and levels. Minimum supported resolution is 640x480.
  12247. The filters accept the following options:
  12248. @table @option
  12249. @item x
  12250. Set scope X position, relative offset on X axis.
  12251. @item y
  12252. Set scope Y position, relative offset on Y axis.
  12253. @item w
  12254. Set scope width.
  12255. @item h
  12256. Set scope height.
  12257. @item o
  12258. Set window opacity. This window also holds statistics about pixel area.
  12259. @item wx
  12260. Set window X position, relative offset on X axis.
  12261. @item wy
  12262. Set window Y position, relative offset on Y axis.
  12263. @end table
  12264. @section pp
  12265. Enable the specified chain of postprocessing subfilters using libpostproc. This
  12266. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  12267. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  12268. Each subfilter and some options have a short and a long name that can be used
  12269. interchangeably, i.e. dr/dering are the same.
  12270. The filters accept the following options:
  12271. @table @option
  12272. @item subfilters
  12273. Set postprocessing subfilters string.
  12274. @end table
  12275. All subfilters share common options to determine their scope:
  12276. @table @option
  12277. @item a/autoq
  12278. Honor the quality commands for this subfilter.
  12279. @item c/chrom
  12280. Do chrominance filtering, too (default).
  12281. @item y/nochrom
  12282. Do luminance filtering only (no chrominance).
  12283. @item n/noluma
  12284. Do chrominance filtering only (no luminance).
  12285. @end table
  12286. These options can be appended after the subfilter name, separated by a '|'.
  12287. Available subfilters are:
  12288. @table @option
  12289. @item hb/hdeblock[|difference[|flatness]]
  12290. Horizontal deblocking filter
  12291. @table @option
  12292. @item difference
  12293. Difference factor where higher values mean more deblocking (default: @code{32}).
  12294. @item flatness
  12295. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12296. @end table
  12297. @item vb/vdeblock[|difference[|flatness]]
  12298. Vertical deblocking filter
  12299. @table @option
  12300. @item difference
  12301. Difference factor where higher values mean more deblocking (default: @code{32}).
  12302. @item flatness
  12303. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12304. @end table
  12305. @item ha/hadeblock[|difference[|flatness]]
  12306. Accurate horizontal deblocking filter
  12307. @table @option
  12308. @item difference
  12309. Difference factor where higher values mean more deblocking (default: @code{32}).
  12310. @item flatness
  12311. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12312. @end table
  12313. @item va/vadeblock[|difference[|flatness]]
  12314. Accurate vertical deblocking filter
  12315. @table @option
  12316. @item difference
  12317. Difference factor where higher values mean more deblocking (default: @code{32}).
  12318. @item flatness
  12319. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12320. @end table
  12321. @end table
  12322. The horizontal and vertical deblocking filters share the difference and
  12323. flatness values so you cannot set different horizontal and vertical
  12324. thresholds.
  12325. @table @option
  12326. @item h1/x1hdeblock
  12327. Experimental horizontal deblocking filter
  12328. @item v1/x1vdeblock
  12329. Experimental vertical deblocking filter
  12330. @item dr/dering
  12331. Deringing filter
  12332. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12333. @table @option
  12334. @item threshold1
  12335. larger -> stronger filtering
  12336. @item threshold2
  12337. larger -> stronger filtering
  12338. @item threshold3
  12339. larger -> stronger filtering
  12340. @end table
  12341. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12342. @table @option
  12343. @item f/fullyrange
  12344. Stretch luminance to @code{0-255}.
  12345. @end table
  12346. @item lb/linblenddeint
  12347. Linear blend deinterlacing filter that deinterlaces the given block by
  12348. filtering all lines with a @code{(1 2 1)} filter.
  12349. @item li/linipoldeint
  12350. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12351. linearly interpolating every second line.
  12352. @item ci/cubicipoldeint
  12353. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12354. cubically interpolating every second line.
  12355. @item md/mediandeint
  12356. Median deinterlacing filter that deinterlaces the given block by applying a
  12357. median filter to every second line.
  12358. @item fd/ffmpegdeint
  12359. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12360. second line with a @code{(-1 4 2 4 -1)} filter.
  12361. @item l5/lowpass5
  12362. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12363. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12364. @item fq/forceQuant[|quantizer]
  12365. Overrides the quantizer table from the input with the constant quantizer you
  12366. specify.
  12367. @table @option
  12368. @item quantizer
  12369. Quantizer to use
  12370. @end table
  12371. @item de/default
  12372. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12373. @item fa/fast
  12374. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12375. @item ac
  12376. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12377. @end table
  12378. @subsection Examples
  12379. @itemize
  12380. @item
  12381. Apply horizontal and vertical deblocking, deringing and automatic
  12382. brightness/contrast:
  12383. @example
  12384. pp=hb/vb/dr/al
  12385. @end example
  12386. @item
  12387. Apply default filters without brightness/contrast correction:
  12388. @example
  12389. pp=de/-al
  12390. @end example
  12391. @item
  12392. Apply default filters and temporal denoiser:
  12393. @example
  12394. pp=default/tmpnoise|1|2|3
  12395. @end example
  12396. @item
  12397. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12398. automatically depending on available CPU time:
  12399. @example
  12400. pp=hb|y/vb|a
  12401. @end example
  12402. @end itemize
  12403. @section pp7
  12404. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12405. similar to spp = 6 with 7 point DCT, where only the center sample is
  12406. used after IDCT.
  12407. The filter accepts the following options:
  12408. @table @option
  12409. @item qp
  12410. Force a constant quantization parameter. It accepts an integer in range
  12411. 0 to 63. If not set, the filter will use the QP from the video stream
  12412. (if available).
  12413. @item mode
  12414. Set thresholding mode. Available modes are:
  12415. @table @samp
  12416. @item hard
  12417. Set hard thresholding.
  12418. @item soft
  12419. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12420. @item medium
  12421. Set medium thresholding (good results, default).
  12422. @end table
  12423. @end table
  12424. @section premultiply
  12425. Apply alpha premultiply effect to input video stream using first plane
  12426. of second stream as alpha.
  12427. Both streams must have same dimensions and same pixel format.
  12428. The filter accepts the following option:
  12429. @table @option
  12430. @item planes
  12431. Set which planes will be processed, unprocessed planes will be copied.
  12432. By default value 0xf, all planes will be processed.
  12433. @item inplace
  12434. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12435. @end table
  12436. @section prewitt
  12437. Apply prewitt operator to input video stream.
  12438. The filter accepts the following option:
  12439. @table @option
  12440. @item planes
  12441. Set which planes will be processed, unprocessed planes will be copied.
  12442. By default value 0xf, all planes will be processed.
  12443. @item scale
  12444. Set value which will be multiplied with filtered result.
  12445. @item delta
  12446. Set value which will be added to filtered result.
  12447. @end table
  12448. @subsection Commands
  12449. This filter supports the all above options as @ref{commands}.
  12450. @section pseudocolor
  12451. Alter frame colors in video with pseudocolors.
  12452. This filter accepts the following options:
  12453. @table @option
  12454. @item c0
  12455. set pixel first component expression
  12456. @item c1
  12457. set pixel second component expression
  12458. @item c2
  12459. set pixel third component expression
  12460. @item c3
  12461. set pixel fourth component expression, corresponds to the alpha component
  12462. @item i
  12463. set component to use as base for altering colors
  12464. @item p
  12465. Pick one of built-in LUTs. By default is set to none.
  12466. Available LUTs:
  12467. @table @samp
  12468. @item magma
  12469. @item inferno
  12470. @item plasma
  12471. @item viridis
  12472. @item turbo
  12473. @item cividis
  12474. @item range1
  12475. @item range2
  12476. @end table
  12477. @end table
  12478. Each of them specifies the expression to use for computing the lookup table for
  12479. the corresponding pixel component values.
  12480. The expressions can contain the following constants and functions:
  12481. @table @option
  12482. @item w
  12483. @item h
  12484. The input width and height.
  12485. @item val
  12486. The input value for the pixel component.
  12487. @item ymin, umin, vmin, amin
  12488. The minimum allowed component value.
  12489. @item ymax, umax, vmax, amax
  12490. The maximum allowed component value.
  12491. @end table
  12492. All expressions default to "val".
  12493. @subsection Commands
  12494. This filter supports the all above options as @ref{commands}.
  12495. @subsection Examples
  12496. @itemize
  12497. @item
  12498. Change too high luma values to gradient:
  12499. @example
  12500. 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'"
  12501. @end example
  12502. @end itemize
  12503. @section psnr
  12504. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12505. Ratio) between two input videos.
  12506. This filter takes in input two input videos, the first input is
  12507. considered the "main" source and is passed unchanged to the
  12508. output. The second input is used as a "reference" video for computing
  12509. the PSNR.
  12510. Both video inputs must have the same resolution and pixel format for
  12511. this filter to work correctly. Also it assumes that both inputs
  12512. have the same number of frames, which are compared one by one.
  12513. The obtained average PSNR is printed through the logging system.
  12514. The filter stores the accumulated MSE (mean squared error) of each
  12515. frame, and at the end of the processing it is averaged across all frames
  12516. equally, and the following formula is applied to obtain the PSNR:
  12517. @example
  12518. PSNR = 10*log10(MAX^2/MSE)
  12519. @end example
  12520. Where MAX is the average of the maximum values of each component of the
  12521. image.
  12522. The description of the accepted parameters follows.
  12523. @table @option
  12524. @item stats_file, f
  12525. If specified the filter will use the named file to save the PSNR of
  12526. each individual frame. When filename equals "-" the data is sent to
  12527. standard output.
  12528. @item stats_version
  12529. Specifies which version of the stats file format to use. Details of
  12530. each format are written below.
  12531. Default value is 1.
  12532. @item stats_add_max
  12533. Determines whether the max value is output to the stats log.
  12534. Default value is 0.
  12535. Requires stats_version >= 2. If this is set and stats_version < 2,
  12536. the filter will return an error.
  12537. @end table
  12538. This filter also supports the @ref{framesync} options.
  12539. The file printed if @var{stats_file} is selected, contains a sequence of
  12540. key/value pairs of the form @var{key}:@var{value} for each compared
  12541. couple of frames.
  12542. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12543. the list of per-frame-pair stats, with key value pairs following the frame
  12544. format with the following parameters:
  12545. @table @option
  12546. @item psnr_log_version
  12547. The version of the log file format. Will match @var{stats_version}.
  12548. @item fields
  12549. A comma separated list of the per-frame-pair parameters included in
  12550. the log.
  12551. @end table
  12552. A description of each shown per-frame-pair parameter follows:
  12553. @table @option
  12554. @item n
  12555. sequential number of the input frame, starting from 1
  12556. @item mse_avg
  12557. Mean Square Error pixel-by-pixel average difference of the compared
  12558. frames, averaged over all the image components.
  12559. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12560. Mean Square Error pixel-by-pixel average difference of the compared
  12561. frames for the component specified by the suffix.
  12562. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12563. Peak Signal to Noise ratio of the compared frames for the component
  12564. specified by the suffix.
  12565. @item max_avg, max_y, max_u, max_v
  12566. Maximum allowed value for each channel, and average over all
  12567. channels.
  12568. @end table
  12569. @subsection Examples
  12570. @itemize
  12571. @item
  12572. For example:
  12573. @example
  12574. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12575. [main][ref] psnr="stats_file=stats.log" [out]
  12576. @end example
  12577. On this example the input file being processed is compared with the
  12578. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12579. is stored in @file{stats.log}.
  12580. @item
  12581. Another example with different containers:
  12582. @example
  12583. 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 -
  12584. @end example
  12585. @end itemize
  12586. @anchor{pullup}
  12587. @section pullup
  12588. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12589. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12590. content.
  12591. The pullup filter is designed to take advantage of future context in making
  12592. its decisions. This filter is stateless in the sense that it does not lock
  12593. onto a pattern to follow, but it instead looks forward to the following
  12594. fields in order to identify matches and rebuild progressive frames.
  12595. To produce content with an even framerate, insert the fps filter after
  12596. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12597. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12598. The filter accepts the following options:
  12599. @table @option
  12600. @item jl
  12601. @item jr
  12602. @item jt
  12603. @item jb
  12604. These options set the amount of "junk" to ignore at the left, right, top, and
  12605. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12606. while top and bottom are in units of 2 lines.
  12607. The default is 8 pixels on each side.
  12608. @item sb
  12609. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12610. filter generating an occasional mismatched frame, but it may also cause an
  12611. excessive number of frames to be dropped during high motion sequences.
  12612. Conversely, setting it to -1 will make filter match fields more easily.
  12613. This may help processing of video where there is slight blurring between
  12614. the fields, but may also cause there to be interlaced frames in the output.
  12615. Default value is @code{0}.
  12616. @item mp
  12617. Set the metric plane to use. It accepts the following values:
  12618. @table @samp
  12619. @item l
  12620. Use luma plane.
  12621. @item u
  12622. Use chroma blue plane.
  12623. @item v
  12624. Use chroma red plane.
  12625. @end table
  12626. This option may be set to use chroma plane instead of the default luma plane
  12627. for doing filter's computations. This may improve accuracy on very clean
  12628. source material, but more likely will decrease accuracy, especially if there
  12629. is chroma noise (rainbow effect) or any grayscale video.
  12630. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12631. load and make pullup usable in realtime on slow machines.
  12632. @end table
  12633. For best results (without duplicated frames in the output file) it is
  12634. necessary to change the output frame rate. For example, to inverse
  12635. telecine NTSC input:
  12636. @example
  12637. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12638. @end example
  12639. @section qp
  12640. Change video quantization parameters (QP).
  12641. The filter accepts the following option:
  12642. @table @option
  12643. @item qp
  12644. Set expression for quantization parameter.
  12645. @end table
  12646. The expression is evaluated through the eval API and can contain, among others,
  12647. the following constants:
  12648. @table @var
  12649. @item known
  12650. 1 if index is not 129, 0 otherwise.
  12651. @item qp
  12652. Sequential index starting from -129 to 128.
  12653. @end table
  12654. @subsection Examples
  12655. @itemize
  12656. @item
  12657. Some equation like:
  12658. @example
  12659. qp=2+2*sin(PI*qp)
  12660. @end example
  12661. @end itemize
  12662. @section random
  12663. Flush video frames from internal cache of frames into a random order.
  12664. No frame is discarded.
  12665. Inspired by @ref{frei0r} nervous filter.
  12666. @table @option
  12667. @item frames
  12668. Set size in number of frames of internal cache, in range from @code{2} to
  12669. @code{512}. Default is @code{30}.
  12670. @item seed
  12671. Set seed for random number generator, must be an integer included between
  12672. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12673. less than @code{0}, the filter will try to use a good random seed on a
  12674. best effort basis.
  12675. @end table
  12676. @section readeia608
  12677. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12678. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12679. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12680. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12681. @table @option
  12682. @item lavfi.readeia608.X.cc
  12683. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12684. @item lavfi.readeia608.X.line
  12685. The number of the line on which the EIA-608 data was identified and read.
  12686. @end table
  12687. This filter accepts the following options:
  12688. @table @option
  12689. @item scan_min
  12690. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12691. @item scan_max
  12692. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12693. @item spw
  12694. Set the ratio of width reserved for sync code detection.
  12695. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12696. @item chp
  12697. Enable checking the parity bit. In the event of a parity error, the filter will output
  12698. @code{0x00} for that character. Default is false.
  12699. @item lp
  12700. Lowpass lines prior to further processing. Default is enabled.
  12701. @end table
  12702. @subsection Commands
  12703. This filter supports the all above options as @ref{commands}.
  12704. @subsection Examples
  12705. @itemize
  12706. @item
  12707. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12708. @example
  12709. 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
  12710. @end example
  12711. @end itemize
  12712. @section readvitc
  12713. Read vertical interval timecode (VITC) information from the top lines of a
  12714. video frame.
  12715. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12716. timecode value, if a valid timecode has been detected. Further metadata key
  12717. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12718. timecode data has been found or not.
  12719. This filter accepts the following options:
  12720. @table @option
  12721. @item scan_max
  12722. Set the maximum number of lines to scan for VITC data. If the value is set to
  12723. @code{-1} the full video frame is scanned. Default is @code{45}.
  12724. @item thr_b
  12725. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12726. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12727. @item thr_w
  12728. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12729. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12730. @end table
  12731. @subsection Examples
  12732. @itemize
  12733. @item
  12734. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12735. draw @code{--:--:--:--} as a placeholder:
  12736. @example
  12737. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12738. @end example
  12739. @end itemize
  12740. @section remap
  12741. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12742. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12743. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12744. value for pixel will be used for destination pixel.
  12745. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12746. will have Xmap/Ymap video stream dimensions.
  12747. Xmap and Ymap input video streams are 16bit depth, single channel.
  12748. @table @option
  12749. @item format
  12750. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12751. Default is @code{color}.
  12752. @item fill
  12753. Specify the color of the unmapped pixels. For the syntax of this option,
  12754. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12755. manual,ffmpeg-utils}. Default color is @code{black}.
  12756. @end table
  12757. @section removegrain
  12758. The removegrain filter is a spatial denoiser for progressive video.
  12759. @table @option
  12760. @item m0
  12761. Set mode for the first plane.
  12762. @item m1
  12763. Set mode for the second plane.
  12764. @item m2
  12765. Set mode for the third plane.
  12766. @item m3
  12767. Set mode for the fourth plane.
  12768. @end table
  12769. Range of mode is from 0 to 24. Description of each mode follows:
  12770. @table @var
  12771. @item 0
  12772. Leave input plane unchanged. Default.
  12773. @item 1
  12774. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12775. @item 2
  12776. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12777. @item 3
  12778. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12779. @item 4
  12780. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12781. This is equivalent to a median filter.
  12782. @item 5
  12783. Line-sensitive clipping giving the minimal change.
  12784. @item 6
  12785. Line-sensitive clipping, intermediate.
  12786. @item 7
  12787. Line-sensitive clipping, intermediate.
  12788. @item 8
  12789. Line-sensitive clipping, intermediate.
  12790. @item 9
  12791. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12792. @item 10
  12793. Replaces the target pixel with the closest neighbour.
  12794. @item 11
  12795. [1 2 1] horizontal and vertical kernel blur.
  12796. @item 12
  12797. Same as mode 11.
  12798. @item 13
  12799. Bob mode, interpolates top field from the line where the neighbours
  12800. pixels are the closest.
  12801. @item 14
  12802. Bob mode, interpolates bottom field from the line where the neighbours
  12803. pixels are the closest.
  12804. @item 15
  12805. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12806. interpolation formula.
  12807. @item 16
  12808. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12809. interpolation formula.
  12810. @item 17
  12811. Clips the pixel with the minimum and maximum of respectively the maximum and
  12812. minimum of each pair of opposite neighbour pixels.
  12813. @item 18
  12814. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12815. the current pixel is minimal.
  12816. @item 19
  12817. Replaces the pixel with the average of its 8 neighbours.
  12818. @item 20
  12819. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12820. @item 21
  12821. Clips pixels using the averages of opposite neighbour.
  12822. @item 22
  12823. Same as mode 21 but simpler and faster.
  12824. @item 23
  12825. Small edge and halo removal, but reputed useless.
  12826. @item 24
  12827. Similar as 23.
  12828. @end table
  12829. @section removelogo
  12830. Suppress a TV station logo, using an image file to determine which
  12831. pixels comprise the logo. It works by filling in the pixels that
  12832. comprise the logo with neighboring pixels.
  12833. The filter accepts the following options:
  12834. @table @option
  12835. @item filename, f
  12836. Set the filter bitmap file, which can be any image format supported by
  12837. libavformat. The width and height of the image file must match those of the
  12838. video stream being processed.
  12839. @end table
  12840. Pixels in the provided bitmap image with a value of zero are not
  12841. considered part of the logo, non-zero pixels are considered part of
  12842. the logo. If you use white (255) for the logo and black (0) for the
  12843. rest, you will be safe. For making the filter bitmap, it is
  12844. recommended to take a screen capture of a black frame with the logo
  12845. visible, and then using a threshold filter followed by the erode
  12846. filter once or twice.
  12847. If needed, little splotches can be fixed manually. Remember that if
  12848. logo pixels are not covered, the filter quality will be much
  12849. reduced. Marking too many pixels as part of the logo does not hurt as
  12850. much, but it will increase the amount of blurring needed to cover over
  12851. the image and will destroy more information than necessary, and extra
  12852. pixels will slow things down on a large logo.
  12853. @section repeatfields
  12854. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12855. fields based on its value.
  12856. @section reverse
  12857. Reverse a video clip.
  12858. Warning: This filter requires memory to buffer the entire clip, so trimming
  12859. is suggested.
  12860. @subsection Examples
  12861. @itemize
  12862. @item
  12863. Take the first 5 seconds of a clip, and reverse it.
  12864. @example
  12865. trim=end=5,reverse
  12866. @end example
  12867. @end itemize
  12868. @section rgbashift
  12869. Shift R/G/B/A pixels horizontally and/or vertically.
  12870. The filter accepts the following options:
  12871. @table @option
  12872. @item rh
  12873. Set amount to shift red horizontally.
  12874. @item rv
  12875. Set amount to shift red vertically.
  12876. @item gh
  12877. Set amount to shift green horizontally.
  12878. @item gv
  12879. Set amount to shift green vertically.
  12880. @item bh
  12881. Set amount to shift blue horizontally.
  12882. @item bv
  12883. Set amount to shift blue vertically.
  12884. @item ah
  12885. Set amount to shift alpha horizontally.
  12886. @item av
  12887. Set amount to shift alpha vertically.
  12888. @item edge
  12889. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12890. @end table
  12891. @subsection Commands
  12892. This filter supports the all above options as @ref{commands}.
  12893. @section roberts
  12894. Apply roberts cross operator to input video stream.
  12895. The filter accepts the following option:
  12896. @table @option
  12897. @item planes
  12898. Set which planes will be processed, unprocessed planes will be copied.
  12899. By default value 0xf, all planes will be processed.
  12900. @item scale
  12901. Set value which will be multiplied with filtered result.
  12902. @item delta
  12903. Set value which will be added to filtered result.
  12904. @end table
  12905. @subsection Commands
  12906. This filter supports the all above options as @ref{commands}.
  12907. @section rotate
  12908. Rotate video by an arbitrary angle expressed in radians.
  12909. The filter accepts the following options:
  12910. A description of the optional parameters follows.
  12911. @table @option
  12912. @item angle, a
  12913. Set an expression for the angle by which to rotate the input video
  12914. clockwise, expressed as a number of radians. A negative value will
  12915. result in a counter-clockwise rotation. By default it is set to "0".
  12916. This expression is evaluated for each frame.
  12917. @item out_w, ow
  12918. Set the output width expression, default value is "iw".
  12919. This expression is evaluated just once during configuration.
  12920. @item out_h, oh
  12921. Set the output height expression, default value is "ih".
  12922. This expression is evaluated just once during configuration.
  12923. @item bilinear
  12924. Enable bilinear interpolation if set to 1, a value of 0 disables
  12925. it. Default value is 1.
  12926. @item fillcolor, c
  12927. Set the color used to fill the output area not covered by the rotated
  12928. image. For the general syntax of this option, check the
  12929. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12930. If the special value "none" is selected then no
  12931. background is printed (useful for example if the background is never shown).
  12932. Default value is "black".
  12933. @end table
  12934. The expressions for the angle and the output size can contain the
  12935. following constants and functions:
  12936. @table @option
  12937. @item n
  12938. sequential number of the input frame, starting from 0. It is always NAN
  12939. before the first frame is filtered.
  12940. @item t
  12941. time in seconds of the input frame, it is set to 0 when the filter is
  12942. configured. It is always NAN before the first frame is filtered.
  12943. @item hsub
  12944. @item vsub
  12945. horizontal and vertical chroma subsample values. For example for the
  12946. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12947. @item in_w, iw
  12948. @item in_h, ih
  12949. the input video width and height
  12950. @item out_w, ow
  12951. @item out_h, oh
  12952. the output width and height, that is the size of the padded area as
  12953. specified by the @var{width} and @var{height} expressions
  12954. @item rotw(a)
  12955. @item roth(a)
  12956. the minimal width/height required for completely containing the input
  12957. video rotated by @var{a} radians.
  12958. These are only available when computing the @option{out_w} and
  12959. @option{out_h} expressions.
  12960. @end table
  12961. @subsection Examples
  12962. @itemize
  12963. @item
  12964. Rotate the input by PI/6 radians clockwise:
  12965. @example
  12966. rotate=PI/6
  12967. @end example
  12968. @item
  12969. Rotate the input by PI/6 radians counter-clockwise:
  12970. @example
  12971. rotate=-PI/6
  12972. @end example
  12973. @item
  12974. Rotate the input by 45 degrees clockwise:
  12975. @example
  12976. rotate=45*PI/180
  12977. @end example
  12978. @item
  12979. Apply a constant rotation with period T, starting from an angle of PI/3:
  12980. @example
  12981. rotate=PI/3+2*PI*t/T
  12982. @end example
  12983. @item
  12984. Make the input video rotation oscillating with a period of T
  12985. seconds and an amplitude of A radians:
  12986. @example
  12987. rotate=A*sin(2*PI/T*t)
  12988. @end example
  12989. @item
  12990. Rotate the video, output size is chosen so that the whole rotating
  12991. input video is always completely contained in the output:
  12992. @example
  12993. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12994. @end example
  12995. @item
  12996. Rotate the video, reduce the output size so that no background is ever
  12997. shown:
  12998. @example
  12999. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  13000. @end example
  13001. @end itemize
  13002. @subsection Commands
  13003. The filter supports the following commands:
  13004. @table @option
  13005. @item a, angle
  13006. Set the angle expression.
  13007. The command accepts the same syntax of the corresponding option.
  13008. If the specified expression is not valid, it is kept at its current
  13009. value.
  13010. @end table
  13011. @section sab
  13012. Apply Shape Adaptive Blur.
  13013. The filter accepts the following options:
  13014. @table @option
  13015. @item luma_radius, lr
  13016. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  13017. value is 1.0. A greater value will result in a more blurred image, and
  13018. in slower processing.
  13019. @item luma_pre_filter_radius, lpfr
  13020. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  13021. value is 1.0.
  13022. @item luma_strength, ls
  13023. Set luma maximum difference between pixels to still be considered, must
  13024. be a value in the 0.1-100.0 range, default value is 1.0.
  13025. @item chroma_radius, cr
  13026. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  13027. greater value will result in a more blurred image, and in slower
  13028. processing.
  13029. @item chroma_pre_filter_radius, cpfr
  13030. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  13031. @item chroma_strength, cs
  13032. Set chroma maximum difference between pixels to still be considered,
  13033. must be a value in the -0.9-100.0 range.
  13034. @end table
  13035. Each chroma option value, if not explicitly specified, is set to the
  13036. corresponding luma option value.
  13037. @anchor{scale}
  13038. @section scale
  13039. Scale (resize) the input video, using the libswscale library.
  13040. The scale filter forces the output display aspect ratio to be the same
  13041. of the input, by changing the output sample aspect ratio.
  13042. If the input image format is different from the format requested by
  13043. the next filter, the scale filter will convert the input to the
  13044. requested format.
  13045. @subsection Options
  13046. The filter accepts the following options, or any of the options
  13047. supported by the libswscale scaler.
  13048. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  13049. the complete list of scaler options.
  13050. @table @option
  13051. @item width, w
  13052. @item height, h
  13053. Set the output video dimension expression. Default value is the input
  13054. dimension.
  13055. If the @var{width} or @var{w} value is 0, the input width is used for
  13056. the output. If the @var{height} or @var{h} value is 0, the input height
  13057. is used for the output.
  13058. If one and only one of the values is -n with n >= 1, the scale filter
  13059. will use a value that maintains the aspect ratio of the input image,
  13060. calculated from the other specified dimension. After that it will,
  13061. however, make sure that the calculated dimension is divisible by n and
  13062. adjust the value if necessary.
  13063. If both values are -n with n >= 1, the behavior will be identical to
  13064. both values being set to 0 as previously detailed.
  13065. See below for the list of accepted constants for use in the dimension
  13066. expression.
  13067. @item eval
  13068. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  13069. @table @samp
  13070. @item init
  13071. Only evaluate expressions once during the filter initialization or when a command is processed.
  13072. @item frame
  13073. Evaluate expressions for each incoming frame.
  13074. @end table
  13075. Default value is @samp{init}.
  13076. @item interl
  13077. Set the interlacing mode. It accepts the following values:
  13078. @table @samp
  13079. @item 1
  13080. Force interlaced aware scaling.
  13081. @item 0
  13082. Do not apply interlaced scaling.
  13083. @item -1
  13084. Select interlaced aware scaling depending on whether the source frames
  13085. are flagged as interlaced or not.
  13086. @end table
  13087. Default value is @samp{0}.
  13088. @item flags
  13089. Set libswscale scaling flags. See
  13090. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13091. complete list of values. If not explicitly specified the filter applies
  13092. the default flags.
  13093. @item param0, param1
  13094. Set libswscale input parameters for scaling algorithms that need them. See
  13095. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13096. complete documentation. If not explicitly specified the filter applies
  13097. empty parameters.
  13098. @item size, s
  13099. Set the video size. For the syntax of this option, check the
  13100. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13101. @item in_color_matrix
  13102. @item out_color_matrix
  13103. Set in/output YCbCr color space type.
  13104. This allows the autodetected value to be overridden as well as allows forcing
  13105. a specific value used for the output and encoder.
  13106. If not specified, the color space type depends on the pixel format.
  13107. Possible values:
  13108. @table @samp
  13109. @item auto
  13110. Choose automatically.
  13111. @item bt709
  13112. Format conforming to International Telecommunication Union (ITU)
  13113. Recommendation BT.709.
  13114. @item fcc
  13115. Set color space conforming to the United States Federal Communications
  13116. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  13117. @item bt601
  13118. @item bt470
  13119. @item smpte170m
  13120. Set color space conforming to:
  13121. @itemize
  13122. @item
  13123. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  13124. @item
  13125. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  13126. @item
  13127. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  13128. @end itemize
  13129. @item smpte240m
  13130. Set color space conforming to SMPTE ST 240:1999.
  13131. @item bt2020
  13132. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  13133. @end table
  13134. @item in_range
  13135. @item out_range
  13136. Set in/output YCbCr sample range.
  13137. This allows the autodetected value to be overridden as well as allows forcing
  13138. a specific value used for the output and encoder. If not specified, the
  13139. range depends on the pixel format. Possible values:
  13140. @table @samp
  13141. @item auto/unknown
  13142. Choose automatically.
  13143. @item jpeg/full/pc
  13144. Set full range (0-255 in case of 8-bit luma).
  13145. @item mpeg/limited/tv
  13146. Set "MPEG" range (16-235 in case of 8-bit luma).
  13147. @end table
  13148. @item force_original_aspect_ratio
  13149. Enable decreasing or increasing output video width or height if necessary to
  13150. keep the original aspect ratio. Possible values:
  13151. @table @samp
  13152. @item disable
  13153. Scale the video as specified and disable this feature.
  13154. @item decrease
  13155. The output video dimensions will automatically be decreased if needed.
  13156. @item increase
  13157. The output video dimensions will automatically be increased if needed.
  13158. @end table
  13159. One useful instance of this option is that when you know a specific device's
  13160. maximum allowed resolution, you can use this to limit the output video to
  13161. that, while retaining the aspect ratio. For example, device A allows
  13162. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13163. decrease) and specifying 1280x720 to the command line makes the output
  13164. 1280x533.
  13165. Please note that this is a different thing than specifying -1 for @option{w}
  13166. or @option{h}, you still need to specify the output resolution for this option
  13167. to work.
  13168. @item force_divisible_by
  13169. Ensures that both the output dimensions, width and height, are divisible by the
  13170. given integer when used together with @option{force_original_aspect_ratio}. This
  13171. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13172. This option respects the value set for @option{force_original_aspect_ratio},
  13173. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13174. may be slightly modified.
  13175. This option can be handy if you need to have a video fit within or exceed
  13176. a defined resolution using @option{force_original_aspect_ratio} but also have
  13177. encoder restrictions on width or height divisibility.
  13178. @end table
  13179. The values of the @option{w} and @option{h} options are expressions
  13180. containing the following constants:
  13181. @table @var
  13182. @item in_w
  13183. @item in_h
  13184. The input width and height
  13185. @item iw
  13186. @item ih
  13187. These are the same as @var{in_w} and @var{in_h}.
  13188. @item out_w
  13189. @item out_h
  13190. The output (scaled) width and height
  13191. @item ow
  13192. @item oh
  13193. These are the same as @var{out_w} and @var{out_h}
  13194. @item a
  13195. The same as @var{iw} / @var{ih}
  13196. @item sar
  13197. input sample aspect ratio
  13198. @item dar
  13199. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13200. @item hsub
  13201. @item vsub
  13202. horizontal and vertical input chroma subsample values. For example for the
  13203. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13204. @item ohsub
  13205. @item ovsub
  13206. horizontal and vertical output chroma subsample values. For example for the
  13207. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13208. @item n
  13209. The (sequential) number of the input frame, starting from 0.
  13210. Only available with @code{eval=frame}.
  13211. @item t
  13212. The presentation timestamp of the input frame, expressed as a number of
  13213. seconds. Only available with @code{eval=frame}.
  13214. @item pos
  13215. The position (byte offset) of the frame in the input stream, or NaN if
  13216. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13217. Only available with @code{eval=frame}.
  13218. @end table
  13219. @subsection Examples
  13220. @itemize
  13221. @item
  13222. Scale the input video to a size of 200x100
  13223. @example
  13224. scale=w=200:h=100
  13225. @end example
  13226. This is equivalent to:
  13227. @example
  13228. scale=200:100
  13229. @end example
  13230. or:
  13231. @example
  13232. scale=200x100
  13233. @end example
  13234. @item
  13235. Specify a size abbreviation for the output size:
  13236. @example
  13237. scale=qcif
  13238. @end example
  13239. which can also be written as:
  13240. @example
  13241. scale=size=qcif
  13242. @end example
  13243. @item
  13244. Scale the input to 2x:
  13245. @example
  13246. scale=w=2*iw:h=2*ih
  13247. @end example
  13248. @item
  13249. The above is the same as:
  13250. @example
  13251. scale=2*in_w:2*in_h
  13252. @end example
  13253. @item
  13254. Scale the input to 2x with forced interlaced scaling:
  13255. @example
  13256. scale=2*iw:2*ih:interl=1
  13257. @end example
  13258. @item
  13259. Scale the input to half size:
  13260. @example
  13261. scale=w=iw/2:h=ih/2
  13262. @end example
  13263. @item
  13264. Increase the width, and set the height to the same size:
  13265. @example
  13266. scale=3/2*iw:ow
  13267. @end example
  13268. @item
  13269. Seek Greek harmony:
  13270. @example
  13271. scale=iw:1/PHI*iw
  13272. scale=ih*PHI:ih
  13273. @end example
  13274. @item
  13275. Increase the height, and set the width to 3/2 of the height:
  13276. @example
  13277. scale=w=3/2*oh:h=3/5*ih
  13278. @end example
  13279. @item
  13280. Increase the size, making the size a multiple of the chroma
  13281. subsample values:
  13282. @example
  13283. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  13284. @end example
  13285. @item
  13286. Increase the width to a maximum of 500 pixels,
  13287. keeping the same aspect ratio as the input:
  13288. @example
  13289. scale=w='min(500\, iw*3/2):h=-1'
  13290. @end example
  13291. @item
  13292. Make pixels square by combining scale and setsar:
  13293. @example
  13294. scale='trunc(ih*dar):ih',setsar=1/1
  13295. @end example
  13296. @item
  13297. Make pixels square by combining scale and setsar,
  13298. making sure the resulting resolution is even (required by some codecs):
  13299. @example
  13300. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  13301. @end example
  13302. @end itemize
  13303. @subsection Commands
  13304. This filter supports the following commands:
  13305. @table @option
  13306. @item width, w
  13307. @item height, h
  13308. Set the output video dimension expression.
  13309. The command accepts the same syntax of the corresponding option.
  13310. If the specified expression is not valid, it is kept at its current
  13311. value.
  13312. @end table
  13313. @section scale_npp
  13314. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  13315. format conversion on CUDA video frames. Setting the output width and height
  13316. works in the same way as for the @var{scale} filter.
  13317. The following additional options are accepted:
  13318. @table @option
  13319. @item format
  13320. The pixel format of the output CUDA frames. If set to the string "same" (the
  13321. default), the input format will be kept. Note that automatic format negotiation
  13322. and conversion is not yet supported for hardware frames
  13323. @item interp_algo
  13324. The interpolation algorithm used for resizing. One of the following:
  13325. @table @option
  13326. @item nn
  13327. Nearest neighbour.
  13328. @item linear
  13329. @item cubic
  13330. @item cubic2p_bspline
  13331. 2-parameter cubic (B=1, C=0)
  13332. @item cubic2p_catmullrom
  13333. 2-parameter cubic (B=0, C=1/2)
  13334. @item cubic2p_b05c03
  13335. 2-parameter cubic (B=1/2, C=3/10)
  13336. @item super
  13337. Supersampling
  13338. @item lanczos
  13339. @end table
  13340. @item force_original_aspect_ratio
  13341. Enable decreasing or increasing output video width or height if necessary to
  13342. keep the original aspect ratio. Possible values:
  13343. @table @samp
  13344. @item disable
  13345. Scale the video as specified and disable this feature.
  13346. @item decrease
  13347. The output video dimensions will automatically be decreased if needed.
  13348. @item increase
  13349. The output video dimensions will automatically be increased if needed.
  13350. @end table
  13351. One useful instance of this option is that when you know a specific device's
  13352. maximum allowed resolution, you can use this to limit the output video to
  13353. that, while retaining the aspect ratio. For example, device A allows
  13354. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13355. decrease) and specifying 1280x720 to the command line makes the output
  13356. 1280x533.
  13357. Please note that this is a different thing than specifying -1 for @option{w}
  13358. or @option{h}, you still need to specify the output resolution for this option
  13359. to work.
  13360. @item force_divisible_by
  13361. Ensures that both the output dimensions, width and height, are divisible by the
  13362. given integer when used together with @option{force_original_aspect_ratio}. This
  13363. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13364. This option respects the value set for @option{force_original_aspect_ratio},
  13365. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13366. may be slightly modified.
  13367. This option can be handy if you need to have a video fit within or exceed
  13368. a defined resolution using @option{force_original_aspect_ratio} but also have
  13369. encoder restrictions on width or height divisibility.
  13370. @end table
  13371. @section scale2ref
  13372. Scale (resize) the input video, based on a reference video.
  13373. See the scale filter for available options, scale2ref supports the same but
  13374. uses the reference video instead of the main input as basis. scale2ref also
  13375. supports the following additional constants for the @option{w} and
  13376. @option{h} options:
  13377. @table @var
  13378. @item main_w
  13379. @item main_h
  13380. The main input video's width and height
  13381. @item main_a
  13382. The same as @var{main_w} / @var{main_h}
  13383. @item main_sar
  13384. The main input video's sample aspect ratio
  13385. @item main_dar, mdar
  13386. The main input video's display aspect ratio. Calculated from
  13387. @code{(main_w / main_h) * main_sar}.
  13388. @item main_hsub
  13389. @item main_vsub
  13390. The main input video's horizontal and vertical chroma subsample values.
  13391. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13392. is 1.
  13393. @item main_n
  13394. The (sequential) number of the main input frame, starting from 0.
  13395. Only available with @code{eval=frame}.
  13396. @item main_t
  13397. The presentation timestamp of the main input frame, expressed as a number of
  13398. seconds. Only available with @code{eval=frame}.
  13399. @item main_pos
  13400. The position (byte offset) of the frame in the main input stream, or NaN if
  13401. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13402. Only available with @code{eval=frame}.
  13403. @end table
  13404. @subsection Examples
  13405. @itemize
  13406. @item
  13407. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13408. @example
  13409. 'scale2ref[b][a];[a][b]overlay'
  13410. @end example
  13411. @item
  13412. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13413. @example
  13414. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13415. @end example
  13416. @end itemize
  13417. @subsection Commands
  13418. This filter supports the following commands:
  13419. @table @option
  13420. @item width, w
  13421. @item height, h
  13422. Set the output video dimension expression.
  13423. The command accepts the same syntax of the corresponding option.
  13424. If the specified expression is not valid, it is kept at its current
  13425. value.
  13426. @end table
  13427. @section scroll
  13428. Scroll input video horizontally and/or vertically by constant speed.
  13429. The filter accepts the following options:
  13430. @table @option
  13431. @item horizontal, h
  13432. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13433. Negative values changes scrolling direction.
  13434. @item vertical, v
  13435. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13436. Negative values changes scrolling direction.
  13437. @item hpos
  13438. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13439. @item vpos
  13440. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13441. @end table
  13442. @subsection Commands
  13443. This filter supports the following @ref{commands}:
  13444. @table @option
  13445. @item horizontal, h
  13446. Set the horizontal scrolling speed.
  13447. @item vertical, v
  13448. Set the vertical scrolling speed.
  13449. @end table
  13450. @anchor{scdet}
  13451. @section scdet
  13452. Detect video scene change.
  13453. This filter sets frame metadata with mafd between frame, the scene score, and
  13454. forward the frame to the next filter, so they can use these metadata to detect
  13455. scene change or others.
  13456. In addition, this filter logs a message and sets frame metadata when it detects
  13457. a scene change by @option{threshold}.
  13458. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13459. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13460. to detect scene change.
  13461. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13462. detect scene change with @option{threshold}.
  13463. The filter accepts the following options:
  13464. @table @option
  13465. @item threshold, t
  13466. Set the scene change detection threshold as a percentage of maximum change. Good
  13467. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13468. @code{[0., 100.]}.
  13469. Default value is @code{10.}.
  13470. @item sc_pass, s
  13471. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13472. You can enable it if you want to get snapshot of scene change frames only.
  13473. @end table
  13474. @anchor{selectivecolor}
  13475. @section selectivecolor
  13476. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13477. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13478. by the "purity" of the color (that is, how saturated it already is).
  13479. This filter is similar to the Adobe Photoshop Selective Color tool.
  13480. The filter accepts the following options:
  13481. @table @option
  13482. @item correction_method
  13483. Select color correction method.
  13484. Available values are:
  13485. @table @samp
  13486. @item absolute
  13487. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13488. component value).
  13489. @item relative
  13490. Specified adjustments are relative to the original component value.
  13491. @end table
  13492. Default is @code{absolute}.
  13493. @item reds
  13494. Adjustments for red pixels (pixels where the red component is the maximum)
  13495. @item yellows
  13496. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13497. @item greens
  13498. Adjustments for green pixels (pixels where the green component is the maximum)
  13499. @item cyans
  13500. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13501. @item blues
  13502. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13503. @item magentas
  13504. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13505. @item whites
  13506. Adjustments for white pixels (pixels where all components are greater than 128)
  13507. @item neutrals
  13508. Adjustments for all pixels except pure black and pure white
  13509. @item blacks
  13510. Adjustments for black pixels (pixels where all components are lesser than 128)
  13511. @item psfile
  13512. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13513. @end table
  13514. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13515. 4 space separated floating point adjustment values in the [-1,1] range,
  13516. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13517. pixels of its range.
  13518. @subsection Examples
  13519. @itemize
  13520. @item
  13521. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13522. increase magenta by 27% in blue areas:
  13523. @example
  13524. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13525. @end example
  13526. @item
  13527. Use a Photoshop selective color preset:
  13528. @example
  13529. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13530. @end example
  13531. @end itemize
  13532. @anchor{separatefields}
  13533. @section separatefields
  13534. The @code{separatefields} takes a frame-based video input and splits
  13535. each frame into its components fields, producing a new half height clip
  13536. with twice the frame rate and twice the frame count.
  13537. This filter use field-dominance information in frame to decide which
  13538. of each pair of fields to place first in the output.
  13539. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13540. @section setdar, setsar
  13541. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13542. output video.
  13543. This is done by changing the specified Sample (aka Pixel) Aspect
  13544. Ratio, according to the following equation:
  13545. @example
  13546. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13547. @end example
  13548. Keep in mind that the @code{setdar} filter does not modify the pixel
  13549. dimensions of the video frame. Also, the display aspect ratio set by
  13550. this filter may be changed by later filters in the filterchain,
  13551. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13552. applied.
  13553. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13554. the filter output video.
  13555. Note that as a consequence of the application of this filter, the
  13556. output display aspect ratio will change according to the equation
  13557. above.
  13558. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13559. filter may be changed by later filters in the filterchain, e.g. if
  13560. another "setsar" or a "setdar" filter is applied.
  13561. It accepts the following parameters:
  13562. @table @option
  13563. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13564. Set the aspect ratio used by the filter.
  13565. The parameter can be a floating point number string, an expression, or
  13566. a string of the form @var{num}:@var{den}, where @var{num} and
  13567. @var{den} are the numerator and denominator of the aspect ratio. If
  13568. the parameter is not specified, it is assumed the value "0".
  13569. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13570. should be escaped.
  13571. @item max
  13572. Set the maximum integer value to use for expressing numerator and
  13573. denominator when reducing the expressed aspect ratio to a rational.
  13574. Default value is @code{100}.
  13575. @end table
  13576. The parameter @var{sar} is an expression containing
  13577. the following constants:
  13578. @table @option
  13579. @item E, PI, PHI
  13580. These are approximated values for the mathematical constants e
  13581. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13582. @item w, h
  13583. The input width and height.
  13584. @item a
  13585. These are the same as @var{w} / @var{h}.
  13586. @item sar
  13587. The input sample aspect ratio.
  13588. @item dar
  13589. The input display aspect ratio. It is the same as
  13590. (@var{w} / @var{h}) * @var{sar}.
  13591. @item hsub, vsub
  13592. Horizontal and vertical chroma subsample values. For example, for the
  13593. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13594. @end table
  13595. @subsection Examples
  13596. @itemize
  13597. @item
  13598. To change the display aspect ratio to 16:9, specify one of the following:
  13599. @example
  13600. setdar=dar=1.77777
  13601. setdar=dar=16/9
  13602. @end example
  13603. @item
  13604. To change the sample aspect ratio to 10:11, specify:
  13605. @example
  13606. setsar=sar=10/11
  13607. @end example
  13608. @item
  13609. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13610. 1000 in the aspect ratio reduction, use the command:
  13611. @example
  13612. setdar=ratio=16/9:max=1000
  13613. @end example
  13614. @end itemize
  13615. @anchor{setfield}
  13616. @section setfield
  13617. Force field for the output video frame.
  13618. The @code{setfield} filter marks the interlace type field for the
  13619. output frames. It does not change the input frame, but only sets the
  13620. corresponding property, which affects how the frame is treated by
  13621. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13622. The filter accepts the following options:
  13623. @table @option
  13624. @item mode
  13625. Available values are:
  13626. @table @samp
  13627. @item auto
  13628. Keep the same field property.
  13629. @item bff
  13630. Mark the frame as bottom-field-first.
  13631. @item tff
  13632. Mark the frame as top-field-first.
  13633. @item prog
  13634. Mark the frame as progressive.
  13635. @end table
  13636. @end table
  13637. @anchor{setparams}
  13638. @section setparams
  13639. Force frame parameter for the output video frame.
  13640. The @code{setparams} filter marks interlace and color range for the
  13641. output frames. It does not change the input frame, but only sets the
  13642. corresponding property, which affects how the frame is treated by
  13643. filters/encoders.
  13644. @table @option
  13645. @item field_mode
  13646. Available values are:
  13647. @table @samp
  13648. @item auto
  13649. Keep the same field property (default).
  13650. @item bff
  13651. Mark the frame as bottom-field-first.
  13652. @item tff
  13653. Mark the frame as top-field-first.
  13654. @item prog
  13655. Mark the frame as progressive.
  13656. @end table
  13657. @item range
  13658. Available values are:
  13659. @table @samp
  13660. @item auto
  13661. Keep the same color range property (default).
  13662. @item unspecified, unknown
  13663. Mark the frame as unspecified color range.
  13664. @item limited, tv, mpeg
  13665. Mark the frame as limited range.
  13666. @item full, pc, jpeg
  13667. Mark the frame as full range.
  13668. @end table
  13669. @item color_primaries
  13670. Set the color primaries.
  13671. Available values are:
  13672. @table @samp
  13673. @item auto
  13674. Keep the same color primaries property (default).
  13675. @item bt709
  13676. @item unknown
  13677. @item bt470m
  13678. @item bt470bg
  13679. @item smpte170m
  13680. @item smpte240m
  13681. @item film
  13682. @item bt2020
  13683. @item smpte428
  13684. @item smpte431
  13685. @item smpte432
  13686. @item jedec-p22
  13687. @end table
  13688. @item color_trc
  13689. Set the color transfer.
  13690. Available values are:
  13691. @table @samp
  13692. @item auto
  13693. Keep the same color trc property (default).
  13694. @item bt709
  13695. @item unknown
  13696. @item bt470m
  13697. @item bt470bg
  13698. @item smpte170m
  13699. @item smpte240m
  13700. @item linear
  13701. @item log100
  13702. @item log316
  13703. @item iec61966-2-4
  13704. @item bt1361e
  13705. @item iec61966-2-1
  13706. @item bt2020-10
  13707. @item bt2020-12
  13708. @item smpte2084
  13709. @item smpte428
  13710. @item arib-std-b67
  13711. @end table
  13712. @item colorspace
  13713. Set the colorspace.
  13714. Available values are:
  13715. @table @samp
  13716. @item auto
  13717. Keep the same colorspace property (default).
  13718. @item gbr
  13719. @item bt709
  13720. @item unknown
  13721. @item fcc
  13722. @item bt470bg
  13723. @item smpte170m
  13724. @item smpte240m
  13725. @item ycgco
  13726. @item bt2020nc
  13727. @item bt2020c
  13728. @item smpte2085
  13729. @item chroma-derived-nc
  13730. @item chroma-derived-c
  13731. @item ictcp
  13732. @end table
  13733. @end table
  13734. @section shear
  13735. Apply shear transform to input video.
  13736. This filter supports the following options:
  13737. @table @option
  13738. @item shx
  13739. Shear factor in X-direction. Default value is 0.
  13740. Allowed range is from -2 to 2.
  13741. @item shy
  13742. Shear factor in Y-direction. Default value is 0.
  13743. Allowed range is from -2 to 2.
  13744. @item fillcolor, c
  13745. Set the color used to fill the output area not covered by the transformed
  13746. video. For the general syntax of this option, check the
  13747. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13748. If the special value "none" is selected then no
  13749. background is printed (useful for example if the background is never shown).
  13750. Default value is "black".
  13751. @item interp
  13752. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  13753. @end table
  13754. @subsection Commands
  13755. This filter supports the all above options as @ref{commands}.
  13756. @section showinfo
  13757. Show a line containing various information for each input video frame.
  13758. The input video is not modified.
  13759. This filter supports the following options:
  13760. @table @option
  13761. @item checksum
  13762. Calculate checksums of each plane. By default enabled.
  13763. @end table
  13764. The shown line contains a sequence of key/value pairs of the form
  13765. @var{key}:@var{value}.
  13766. The following values are shown in the output:
  13767. @table @option
  13768. @item n
  13769. The (sequential) number of the input frame, starting from 0.
  13770. @item pts
  13771. The Presentation TimeStamp of the input frame, expressed as a number of
  13772. time base units. The time base unit depends on the filter input pad.
  13773. @item pts_time
  13774. The Presentation TimeStamp of the input frame, expressed as a number of
  13775. seconds.
  13776. @item pos
  13777. The position of the frame in the input stream, or -1 if this information is
  13778. unavailable and/or meaningless (for example in case of synthetic video).
  13779. @item fmt
  13780. The pixel format name.
  13781. @item sar
  13782. The sample aspect ratio of the input frame, expressed in the form
  13783. @var{num}/@var{den}.
  13784. @item s
  13785. The size of the input frame. For the syntax of this option, check the
  13786. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13787. @item i
  13788. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13789. for bottom field first).
  13790. @item iskey
  13791. This is 1 if the frame is a key frame, 0 otherwise.
  13792. @item type
  13793. The picture type of the input frame ("I" for an I-frame, "P" for a
  13794. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13795. Also refer to the documentation of the @code{AVPictureType} enum and of
  13796. the @code{av_get_picture_type_char} function defined in
  13797. @file{libavutil/avutil.h}.
  13798. @item checksum
  13799. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13800. @item plane_checksum
  13801. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13802. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13803. @item mean
  13804. The mean value of pixels in each plane of the input frame, expressed in the form
  13805. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13806. @item stdev
  13807. The standard deviation of pixel values in each plane of the input frame, expressed
  13808. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13809. @end table
  13810. @section showpalette
  13811. Displays the 256 colors palette of each frame. This filter is only relevant for
  13812. @var{pal8} pixel format frames.
  13813. It accepts the following option:
  13814. @table @option
  13815. @item s
  13816. Set the size of the box used to represent one palette color entry. Default is
  13817. @code{30} (for a @code{30x30} pixel box).
  13818. @end table
  13819. @section shuffleframes
  13820. Reorder and/or duplicate and/or drop video frames.
  13821. It accepts the following parameters:
  13822. @table @option
  13823. @item mapping
  13824. Set the destination indexes of input frames.
  13825. This is space or '|' separated list of indexes that maps input frames to output
  13826. frames. Number of indexes also sets maximal value that each index may have.
  13827. '-1' index have special meaning and that is to drop frame.
  13828. @end table
  13829. The first frame has the index 0. The default is to keep the input unchanged.
  13830. @subsection Examples
  13831. @itemize
  13832. @item
  13833. Swap second and third frame of every three frames of the input:
  13834. @example
  13835. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13836. @end example
  13837. @item
  13838. Swap 10th and 1st frame of every ten frames of the input:
  13839. @example
  13840. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13841. @end example
  13842. @end itemize
  13843. @section shufflepixels
  13844. Reorder pixels in video frames.
  13845. This filter accepts the following options:
  13846. @table @option
  13847. @item direction, d
  13848. Set shuffle direction. Can be forward or inverse direction.
  13849. Default direction is forward.
  13850. @item mode, m
  13851. Set shuffle mode. Can be horizontal, vertical or block mode.
  13852. @item width, w
  13853. @item height, h
  13854. Set shuffle block_size. In case of horizontal shuffle mode only width
  13855. part of size is used, and in case of vertical shuffle mode only height
  13856. part of size is used.
  13857. @item seed, s
  13858. Set random seed used with shuffling pixels. Mainly useful to set to be able
  13859. to reverse filtering process to get original input.
  13860. For example, to reverse forward shuffle you need to use same parameters
  13861. and exact same seed and to set direction to inverse.
  13862. @end table
  13863. @section shuffleplanes
  13864. Reorder and/or duplicate video planes.
  13865. It accepts the following parameters:
  13866. @table @option
  13867. @item map0
  13868. The index of the input plane to be used as the first output plane.
  13869. @item map1
  13870. The index of the input plane to be used as the second output plane.
  13871. @item map2
  13872. The index of the input plane to be used as the third output plane.
  13873. @item map3
  13874. The index of the input plane to be used as the fourth output plane.
  13875. @end table
  13876. The first plane has the index 0. The default is to keep the input unchanged.
  13877. @subsection Examples
  13878. @itemize
  13879. @item
  13880. Swap the second and third planes of the input:
  13881. @example
  13882. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13883. @end example
  13884. @end itemize
  13885. @anchor{signalstats}
  13886. @section signalstats
  13887. Evaluate various visual metrics that assist in determining issues associated
  13888. with the digitization of analog video media.
  13889. By default the filter will log these metadata values:
  13890. @table @option
  13891. @item YMIN
  13892. Display the minimal Y value contained within the input frame. Expressed in
  13893. range of [0-255].
  13894. @item YLOW
  13895. Display the Y value at the 10% percentile within the input frame. Expressed in
  13896. range of [0-255].
  13897. @item YAVG
  13898. Display the average Y value within the input frame. Expressed in range of
  13899. [0-255].
  13900. @item YHIGH
  13901. Display the Y value at the 90% percentile within the input frame. Expressed in
  13902. range of [0-255].
  13903. @item YMAX
  13904. Display the maximum Y value contained within the input frame. Expressed in
  13905. range of [0-255].
  13906. @item UMIN
  13907. Display the minimal U value contained within the input frame. Expressed in
  13908. range of [0-255].
  13909. @item ULOW
  13910. Display the U value at the 10% percentile within the input frame. Expressed in
  13911. range of [0-255].
  13912. @item UAVG
  13913. Display the average U value within the input frame. Expressed in range of
  13914. [0-255].
  13915. @item UHIGH
  13916. Display the U value at the 90% percentile within the input frame. Expressed in
  13917. range of [0-255].
  13918. @item UMAX
  13919. Display the maximum U value contained within the input frame. Expressed in
  13920. range of [0-255].
  13921. @item VMIN
  13922. Display the minimal V value contained within the input frame. Expressed in
  13923. range of [0-255].
  13924. @item VLOW
  13925. Display the V value at the 10% percentile within the input frame. Expressed in
  13926. range of [0-255].
  13927. @item VAVG
  13928. Display the average V value within the input frame. Expressed in range of
  13929. [0-255].
  13930. @item VHIGH
  13931. Display the V value at the 90% percentile within the input frame. Expressed in
  13932. range of [0-255].
  13933. @item VMAX
  13934. Display the maximum V value contained within the input frame. Expressed in
  13935. range of [0-255].
  13936. @item SATMIN
  13937. Display the minimal saturation value contained within the input frame.
  13938. Expressed in range of [0-~181.02].
  13939. @item SATLOW
  13940. Display the saturation value at the 10% percentile within the input frame.
  13941. Expressed in range of [0-~181.02].
  13942. @item SATAVG
  13943. Display the average saturation value within the input frame. Expressed in range
  13944. of [0-~181.02].
  13945. @item SATHIGH
  13946. Display the saturation value at the 90% percentile within the input frame.
  13947. Expressed in range of [0-~181.02].
  13948. @item SATMAX
  13949. Display the maximum saturation value contained within the input frame.
  13950. Expressed in range of [0-~181.02].
  13951. @item HUEMED
  13952. Display the median value for hue within the input frame. Expressed in range of
  13953. [0-360].
  13954. @item HUEAVG
  13955. Display the average value for hue within the input frame. Expressed in range of
  13956. [0-360].
  13957. @item YDIF
  13958. Display the average of sample value difference between all values of the Y
  13959. plane in the current frame and corresponding values of the previous input frame.
  13960. Expressed in range of [0-255].
  13961. @item UDIF
  13962. Display the average of sample value difference between all values of the U
  13963. plane in the current frame and corresponding values of the previous input frame.
  13964. Expressed in range of [0-255].
  13965. @item VDIF
  13966. Display the average of sample value difference between all values of the V
  13967. plane in the current frame and corresponding values of the previous input frame.
  13968. Expressed in range of [0-255].
  13969. @item YBITDEPTH
  13970. Display bit depth of Y plane in current frame.
  13971. Expressed in range of [0-16].
  13972. @item UBITDEPTH
  13973. Display bit depth of U plane in current frame.
  13974. Expressed in range of [0-16].
  13975. @item VBITDEPTH
  13976. Display bit depth of V plane in current frame.
  13977. Expressed in range of [0-16].
  13978. @end table
  13979. The filter accepts the following options:
  13980. @table @option
  13981. @item stat
  13982. @item out
  13983. @option{stat} specify an additional form of image analysis.
  13984. @option{out} output video with the specified type of pixel highlighted.
  13985. Both options accept the following values:
  13986. @table @samp
  13987. @item tout
  13988. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13989. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13990. include the results of video dropouts, head clogs, or tape tracking issues.
  13991. @item vrep
  13992. Identify @var{vertical line repetition}. Vertical line repetition includes
  13993. similar rows of pixels within a frame. In born-digital video vertical line
  13994. repetition is common, but this pattern is uncommon in video digitized from an
  13995. analog source. When it occurs in video that results from the digitization of an
  13996. analog source it can indicate concealment from a dropout compensator.
  13997. @item brng
  13998. Identify pixels that fall outside of legal broadcast range.
  13999. @end table
  14000. @item color, c
  14001. Set the highlight color for the @option{out} option. The default color is
  14002. yellow.
  14003. @end table
  14004. @subsection Examples
  14005. @itemize
  14006. @item
  14007. Output data of various video metrics:
  14008. @example
  14009. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  14010. @end example
  14011. @item
  14012. Output specific data about the minimum and maximum values of the Y plane per frame:
  14013. @example
  14014. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  14015. @end example
  14016. @item
  14017. Playback video while highlighting pixels that are outside of broadcast range in red.
  14018. @example
  14019. ffplay example.mov -vf signalstats="out=brng:color=red"
  14020. @end example
  14021. @item
  14022. Playback video with signalstats metadata drawn over the frame.
  14023. @example
  14024. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  14025. @end example
  14026. The contents of signalstat_drawtext.txt used in the command are:
  14027. @example
  14028. time %@{pts:hms@}
  14029. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  14030. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  14031. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  14032. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  14033. @end example
  14034. @end itemize
  14035. @anchor{signature}
  14036. @section signature
  14037. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  14038. input. In this case the matching between the inputs can be calculated additionally.
  14039. The filter always passes through the first input. The signature of each stream can
  14040. be written into a file.
  14041. It accepts the following options:
  14042. @table @option
  14043. @item detectmode
  14044. Enable or disable the matching process.
  14045. Available values are:
  14046. @table @samp
  14047. @item off
  14048. Disable the calculation of a matching (default).
  14049. @item full
  14050. Calculate the matching for the whole video and output whether the whole video
  14051. matches or only parts.
  14052. @item fast
  14053. Calculate only until a matching is found or the video ends. Should be faster in
  14054. some cases.
  14055. @end table
  14056. @item nb_inputs
  14057. Set the number of inputs. The option value must be a non negative integer.
  14058. Default value is 1.
  14059. @item filename
  14060. Set the path to which the output is written. If there is more than one input,
  14061. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  14062. integer), that will be replaced with the input number. If no filename is
  14063. specified, no output will be written. This is the default.
  14064. @item format
  14065. Choose the output format.
  14066. Available values are:
  14067. @table @samp
  14068. @item binary
  14069. Use the specified binary representation (default).
  14070. @item xml
  14071. Use the specified xml representation.
  14072. @end table
  14073. @item th_d
  14074. Set threshold to detect one word as similar. The option value must be an integer
  14075. greater than zero. The default value is 9000.
  14076. @item th_dc
  14077. Set threshold to detect all words as similar. The option value must be an integer
  14078. greater than zero. The default value is 60000.
  14079. @item th_xh
  14080. Set threshold to detect frames as similar. The option value must be an integer
  14081. greater than zero. The default value is 116.
  14082. @item th_di
  14083. Set the minimum length of a sequence in frames to recognize it as matching
  14084. sequence. The option value must be a non negative integer value.
  14085. The default value is 0.
  14086. @item th_it
  14087. Set the minimum relation, that matching frames to all frames must have.
  14088. The option value must be a double value between 0 and 1. The default value is 0.5.
  14089. @end table
  14090. @subsection Examples
  14091. @itemize
  14092. @item
  14093. To calculate the signature of an input video and store it in signature.bin:
  14094. @example
  14095. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  14096. @end example
  14097. @item
  14098. To detect whether two videos match and store the signatures in XML format in
  14099. signature0.xml and signature1.xml:
  14100. @example
  14101. 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 -
  14102. @end example
  14103. @end itemize
  14104. @anchor{smartblur}
  14105. @section smartblur
  14106. Blur the input video without impacting the outlines.
  14107. It accepts the following options:
  14108. @table @option
  14109. @item luma_radius, lr
  14110. Set the luma radius. The option value must be a float number in
  14111. the range [0.1,5.0] that specifies the variance of the gaussian filter
  14112. used to blur the image (slower if larger). Default value is 1.0.
  14113. @item luma_strength, ls
  14114. Set the luma strength. The option value must be a float number
  14115. in the range [-1.0,1.0] that configures the blurring. A value included
  14116. in [0.0,1.0] will blur the image whereas a value included in
  14117. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  14118. @item luma_threshold, lt
  14119. Set the luma threshold used as a coefficient to determine
  14120. whether a pixel should be blurred or not. The option value must be an
  14121. integer in the range [-30,30]. A value of 0 will filter all the image,
  14122. a value included in [0,30] will filter flat areas and a value included
  14123. in [-30,0] will filter edges. Default value is 0.
  14124. @item chroma_radius, cr
  14125. Set the chroma radius. The option value must be a float number in
  14126. the range [0.1,5.0] that specifies the variance of the gaussian filter
  14127. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  14128. @item chroma_strength, cs
  14129. Set the chroma strength. The option value must be a float number
  14130. in the range [-1.0,1.0] that configures the blurring. A value included
  14131. in [0.0,1.0] will blur the image whereas a value included in
  14132. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  14133. @item chroma_threshold, ct
  14134. Set the chroma threshold used as a coefficient to determine
  14135. whether a pixel should be blurred or not. The option value must be an
  14136. integer in the range [-30,30]. A value of 0 will filter all the image,
  14137. a value included in [0,30] will filter flat areas and a value included
  14138. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  14139. @end table
  14140. If a chroma option is not explicitly set, the corresponding luma value
  14141. is set.
  14142. @section sobel
  14143. Apply sobel operator to input video stream.
  14144. The filter accepts the following option:
  14145. @table @option
  14146. @item planes
  14147. Set which planes will be processed, unprocessed planes will be copied.
  14148. By default value 0xf, all planes will be processed.
  14149. @item scale
  14150. Set value which will be multiplied with filtered result.
  14151. @item delta
  14152. Set value which will be added to filtered result.
  14153. @end table
  14154. @subsection Commands
  14155. This filter supports the all above options as @ref{commands}.
  14156. @anchor{spp}
  14157. @section spp
  14158. Apply a simple postprocessing filter that compresses and decompresses the image
  14159. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  14160. and average the results.
  14161. The filter accepts the following options:
  14162. @table @option
  14163. @item quality
  14164. Set quality. This option defines the number of levels for averaging. It accepts
  14165. an integer in the range 0-6. If set to @code{0}, the filter will have no
  14166. effect. A value of @code{6} means the higher quality. For each increment of
  14167. that value the speed drops by a factor of approximately 2. Default value is
  14168. @code{3}.
  14169. @item qp
  14170. Force a constant quantization parameter. If not set, the filter will use the QP
  14171. from the video stream (if available).
  14172. @item mode
  14173. Set thresholding mode. Available modes are:
  14174. @table @samp
  14175. @item hard
  14176. Set hard thresholding (default).
  14177. @item soft
  14178. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14179. @end table
  14180. @item use_bframe_qp
  14181. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  14182. option may cause flicker since the B-Frames have often larger QP. Default is
  14183. @code{0} (not enabled).
  14184. @end table
  14185. @subsection Commands
  14186. This filter supports the following commands:
  14187. @table @option
  14188. @item quality, level
  14189. Set quality level. The value @code{max} can be used to set the maximum level,
  14190. currently @code{6}.
  14191. @end table
  14192. @anchor{sr}
  14193. @section sr
  14194. Scale the input by applying one of the super-resolution methods based on
  14195. convolutional neural networks. Supported models:
  14196. @itemize
  14197. @item
  14198. Super-Resolution Convolutional Neural Network model (SRCNN).
  14199. See @url{https://arxiv.org/abs/1501.00092}.
  14200. @item
  14201. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  14202. See @url{https://arxiv.org/abs/1609.05158}.
  14203. @end itemize
  14204. Training scripts as well as scripts for model file (.pb) saving can be found at
  14205. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  14206. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  14207. Native model files (.model) can be generated from TensorFlow model
  14208. files (.pb) by using tools/python/convert.py
  14209. The filter accepts the following options:
  14210. @table @option
  14211. @item dnn_backend
  14212. Specify which DNN backend to use for model loading and execution. This option accepts
  14213. the following values:
  14214. @table @samp
  14215. @item native
  14216. Native implementation of DNN loading and execution.
  14217. @item tensorflow
  14218. TensorFlow backend. To enable this backend you
  14219. need to install the TensorFlow for C library (see
  14220. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  14221. @code{--enable-libtensorflow}
  14222. @end table
  14223. Default value is @samp{native}.
  14224. @item model
  14225. Set path to model file specifying network architecture and its parameters.
  14226. Note that different backends use different file formats. TensorFlow backend
  14227. can load files for both formats, while native backend can load files for only
  14228. its format.
  14229. @item scale_factor
  14230. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  14231. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  14232. input upscaled using bicubic upscaling with proper scale factor.
  14233. @end table
  14234. This feature can also be finished with @ref{dnn_processing} filter.
  14235. @section ssim
  14236. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  14237. This filter takes in input two input videos, the first input is
  14238. considered the "main" source and is passed unchanged to the
  14239. output. The second input is used as a "reference" video for computing
  14240. the SSIM.
  14241. Both video inputs must have the same resolution and pixel format for
  14242. this filter to work correctly. Also it assumes that both inputs
  14243. have the same number of frames, which are compared one by one.
  14244. The filter stores the calculated SSIM of each frame.
  14245. The description of the accepted parameters follows.
  14246. @table @option
  14247. @item stats_file, f
  14248. If specified the filter will use the named file to save the SSIM of
  14249. each individual frame. When filename equals "-" the data is sent to
  14250. standard output.
  14251. @end table
  14252. The file printed if @var{stats_file} is selected, contains a sequence of
  14253. key/value pairs of the form @var{key}:@var{value} for each compared
  14254. couple of frames.
  14255. A description of each shown parameter follows:
  14256. @table @option
  14257. @item n
  14258. sequential number of the input frame, starting from 1
  14259. @item Y, U, V, R, G, B
  14260. SSIM of the compared frames for the component specified by the suffix.
  14261. @item All
  14262. SSIM of the compared frames for the whole frame.
  14263. @item dB
  14264. Same as above but in dB representation.
  14265. @end table
  14266. This filter also supports the @ref{framesync} options.
  14267. @subsection Examples
  14268. @itemize
  14269. @item
  14270. For example:
  14271. @example
  14272. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14273. [main][ref] ssim="stats_file=stats.log" [out]
  14274. @end example
  14275. On this example the input file being processed is compared with the
  14276. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  14277. is stored in @file{stats.log}.
  14278. @item
  14279. Another example with both psnr and ssim at same time:
  14280. @example
  14281. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  14282. @end example
  14283. @item
  14284. Another example with different containers:
  14285. @example
  14286. 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 -
  14287. @end example
  14288. @end itemize
  14289. @section stereo3d
  14290. Convert between different stereoscopic image formats.
  14291. The filters accept the following options:
  14292. @table @option
  14293. @item in
  14294. Set stereoscopic image format of input.
  14295. Available values for input image formats are:
  14296. @table @samp
  14297. @item sbsl
  14298. side by side parallel (left eye left, right eye right)
  14299. @item sbsr
  14300. side by side crosseye (right eye left, left eye right)
  14301. @item sbs2l
  14302. side by side parallel with half width resolution
  14303. (left eye left, right eye right)
  14304. @item sbs2r
  14305. side by side crosseye with half width resolution
  14306. (right eye left, left eye right)
  14307. @item abl
  14308. @item tbl
  14309. above-below (left eye above, right eye below)
  14310. @item abr
  14311. @item tbr
  14312. above-below (right eye above, left eye below)
  14313. @item ab2l
  14314. @item tb2l
  14315. above-below with half height resolution
  14316. (left eye above, right eye below)
  14317. @item ab2r
  14318. @item tb2r
  14319. above-below with half height resolution
  14320. (right eye above, left eye below)
  14321. @item al
  14322. alternating frames (left eye first, right eye second)
  14323. @item ar
  14324. alternating frames (right eye first, left eye second)
  14325. @item irl
  14326. interleaved rows (left eye has top row, right eye starts on next row)
  14327. @item irr
  14328. interleaved rows (right eye has top row, left eye starts on next row)
  14329. @item icl
  14330. interleaved columns, left eye first
  14331. @item icr
  14332. interleaved columns, right eye first
  14333. Default value is @samp{sbsl}.
  14334. @end table
  14335. @item out
  14336. Set stereoscopic image format of output.
  14337. @table @samp
  14338. @item sbsl
  14339. side by side parallel (left eye left, right eye right)
  14340. @item sbsr
  14341. side by side crosseye (right eye left, left eye right)
  14342. @item sbs2l
  14343. side by side parallel with half width resolution
  14344. (left eye left, right eye right)
  14345. @item sbs2r
  14346. side by side crosseye with half width resolution
  14347. (right eye left, left eye right)
  14348. @item abl
  14349. @item tbl
  14350. above-below (left eye above, right eye below)
  14351. @item abr
  14352. @item tbr
  14353. above-below (right eye above, left eye below)
  14354. @item ab2l
  14355. @item tb2l
  14356. above-below with half height resolution
  14357. (left eye above, right eye below)
  14358. @item ab2r
  14359. @item tb2r
  14360. above-below with half height resolution
  14361. (right eye above, left eye below)
  14362. @item al
  14363. alternating frames (left eye first, right eye second)
  14364. @item ar
  14365. alternating frames (right eye first, left eye second)
  14366. @item irl
  14367. interleaved rows (left eye has top row, right eye starts on next row)
  14368. @item irr
  14369. interleaved rows (right eye has top row, left eye starts on next row)
  14370. @item arbg
  14371. anaglyph red/blue gray
  14372. (red filter on left eye, blue filter on right eye)
  14373. @item argg
  14374. anaglyph red/green gray
  14375. (red filter on left eye, green filter on right eye)
  14376. @item arcg
  14377. anaglyph red/cyan gray
  14378. (red filter on left eye, cyan filter on right eye)
  14379. @item arch
  14380. anaglyph red/cyan half colored
  14381. (red filter on left eye, cyan filter on right eye)
  14382. @item arcc
  14383. anaglyph red/cyan color
  14384. (red filter on left eye, cyan filter on right eye)
  14385. @item arcd
  14386. anaglyph red/cyan color optimized with the least squares projection of dubois
  14387. (red filter on left eye, cyan filter on right eye)
  14388. @item agmg
  14389. anaglyph green/magenta gray
  14390. (green filter on left eye, magenta filter on right eye)
  14391. @item agmh
  14392. anaglyph green/magenta half colored
  14393. (green filter on left eye, magenta filter on right eye)
  14394. @item agmc
  14395. anaglyph green/magenta colored
  14396. (green filter on left eye, magenta filter on right eye)
  14397. @item agmd
  14398. anaglyph green/magenta color optimized with the least squares projection of dubois
  14399. (green filter on left eye, magenta filter on right eye)
  14400. @item aybg
  14401. anaglyph yellow/blue gray
  14402. (yellow filter on left eye, blue filter on right eye)
  14403. @item aybh
  14404. anaglyph yellow/blue half colored
  14405. (yellow filter on left eye, blue filter on right eye)
  14406. @item aybc
  14407. anaglyph yellow/blue colored
  14408. (yellow filter on left eye, blue filter on right eye)
  14409. @item aybd
  14410. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14411. (yellow filter on left eye, blue filter on right eye)
  14412. @item ml
  14413. mono output (left eye only)
  14414. @item mr
  14415. mono output (right eye only)
  14416. @item chl
  14417. checkerboard, left eye first
  14418. @item chr
  14419. checkerboard, right eye first
  14420. @item icl
  14421. interleaved columns, left eye first
  14422. @item icr
  14423. interleaved columns, right eye first
  14424. @item hdmi
  14425. HDMI frame pack
  14426. @end table
  14427. Default value is @samp{arcd}.
  14428. @end table
  14429. @subsection Examples
  14430. @itemize
  14431. @item
  14432. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14433. @example
  14434. stereo3d=sbsl:aybd
  14435. @end example
  14436. @item
  14437. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14438. @example
  14439. stereo3d=abl:sbsr
  14440. @end example
  14441. @end itemize
  14442. @section streamselect, astreamselect
  14443. Select video or audio streams.
  14444. The filter accepts the following options:
  14445. @table @option
  14446. @item inputs
  14447. Set number of inputs. Default is 2.
  14448. @item map
  14449. Set input indexes to remap to outputs.
  14450. @end table
  14451. @subsection Commands
  14452. The @code{streamselect} and @code{astreamselect} filter supports the following
  14453. commands:
  14454. @table @option
  14455. @item map
  14456. Set input indexes to remap to outputs.
  14457. @end table
  14458. @subsection Examples
  14459. @itemize
  14460. @item
  14461. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14462. @example
  14463. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14464. @end example
  14465. @item
  14466. Same as above, but for audio:
  14467. @example
  14468. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14469. @end example
  14470. @end itemize
  14471. @anchor{subtitles}
  14472. @section subtitles
  14473. Draw subtitles on top of input video using the libass library.
  14474. To enable compilation of this filter you need to configure FFmpeg with
  14475. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14476. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14477. Alpha) subtitles format.
  14478. The filter accepts the following options:
  14479. @table @option
  14480. @item filename, f
  14481. Set the filename of the subtitle file to read. It must be specified.
  14482. @item original_size
  14483. Specify the size of the original video, the video for which the ASS file
  14484. was composed. For the syntax of this option, check the
  14485. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14486. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14487. correctly scale the fonts if the aspect ratio has been changed.
  14488. @item fontsdir
  14489. Set a directory path containing fonts that can be used by the filter.
  14490. These fonts will be used in addition to whatever the font provider uses.
  14491. @item alpha
  14492. Process alpha channel, by default alpha channel is untouched.
  14493. @item charenc
  14494. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14495. useful if not UTF-8.
  14496. @item stream_index, si
  14497. Set subtitles stream index. @code{subtitles} filter only.
  14498. @item force_style
  14499. Override default style or script info parameters of the subtitles. It accepts a
  14500. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14501. @end table
  14502. If the first key is not specified, it is assumed that the first value
  14503. specifies the @option{filename}.
  14504. For example, to render the file @file{sub.srt} on top of the input
  14505. video, use the command:
  14506. @example
  14507. subtitles=sub.srt
  14508. @end example
  14509. which is equivalent to:
  14510. @example
  14511. subtitles=filename=sub.srt
  14512. @end example
  14513. To render the default subtitles stream from file @file{video.mkv}, use:
  14514. @example
  14515. subtitles=video.mkv
  14516. @end example
  14517. To render the second subtitles stream from that file, use:
  14518. @example
  14519. subtitles=video.mkv:si=1
  14520. @end example
  14521. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14522. @code{DejaVu Serif}, use:
  14523. @example
  14524. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14525. @end example
  14526. @section super2xsai
  14527. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14528. Interpolate) pixel art scaling algorithm.
  14529. Useful for enlarging pixel art images without reducing sharpness.
  14530. @section swaprect
  14531. Swap two rectangular objects in video.
  14532. This filter accepts the following options:
  14533. @table @option
  14534. @item w
  14535. Set object width.
  14536. @item h
  14537. Set object height.
  14538. @item x1
  14539. Set 1st rect x coordinate.
  14540. @item y1
  14541. Set 1st rect y coordinate.
  14542. @item x2
  14543. Set 2nd rect x coordinate.
  14544. @item y2
  14545. Set 2nd rect y coordinate.
  14546. All expressions are evaluated once for each frame.
  14547. @end table
  14548. The all options are expressions containing the following constants:
  14549. @table @option
  14550. @item w
  14551. @item h
  14552. The input width and height.
  14553. @item a
  14554. same as @var{w} / @var{h}
  14555. @item sar
  14556. input sample aspect ratio
  14557. @item dar
  14558. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14559. @item n
  14560. The number of the input frame, starting from 0.
  14561. @item t
  14562. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14563. @item pos
  14564. the position in the file of the input frame, NAN if unknown
  14565. @end table
  14566. @section swapuv
  14567. Swap U & V plane.
  14568. @section tblend
  14569. Blend successive video frames.
  14570. See @ref{blend}
  14571. @section telecine
  14572. Apply telecine process to the video.
  14573. This filter accepts the following options:
  14574. @table @option
  14575. @item first_field
  14576. @table @samp
  14577. @item top, t
  14578. top field first
  14579. @item bottom, b
  14580. bottom field first
  14581. The default value is @code{top}.
  14582. @end table
  14583. @item pattern
  14584. A string of numbers representing the pulldown pattern you wish to apply.
  14585. The default value is @code{23}.
  14586. @end table
  14587. @example
  14588. Some typical patterns:
  14589. NTSC output (30i):
  14590. 27.5p: 32222
  14591. 24p: 23 (classic)
  14592. 24p: 2332 (preferred)
  14593. 20p: 33
  14594. 18p: 334
  14595. 16p: 3444
  14596. PAL output (25i):
  14597. 27.5p: 12222
  14598. 24p: 222222222223 ("Euro pulldown")
  14599. 16.67p: 33
  14600. 16p: 33333334
  14601. @end example
  14602. @section thistogram
  14603. Compute and draw a color distribution histogram for the input video across time.
  14604. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14605. at certain time, this filter shows also past histograms of number of frames defined
  14606. by @code{width} option.
  14607. The computed histogram is a representation of the color component
  14608. distribution in an image.
  14609. The filter accepts the following options:
  14610. @table @option
  14611. @item width, w
  14612. Set width of single color component output. Default value is @code{0}.
  14613. Value of @code{0} means width will be picked from input video.
  14614. This also set number of passed histograms to keep.
  14615. Allowed range is [0, 8192].
  14616. @item display_mode, d
  14617. Set display mode.
  14618. It accepts the following values:
  14619. @table @samp
  14620. @item stack
  14621. Per color component graphs are placed below each other.
  14622. @item parade
  14623. Per color component graphs are placed side by side.
  14624. @item overlay
  14625. Presents information identical to that in the @code{parade}, except
  14626. that the graphs representing color components are superimposed directly
  14627. over one another.
  14628. @end table
  14629. Default is @code{stack}.
  14630. @item levels_mode, m
  14631. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14632. Default is @code{linear}.
  14633. @item components, c
  14634. Set what color components to display.
  14635. Default is @code{7}.
  14636. @item bgopacity, b
  14637. Set background opacity. Default is @code{0.9}.
  14638. @item envelope, e
  14639. Show envelope. Default is disabled.
  14640. @item ecolor, ec
  14641. Set envelope color. Default is @code{gold}.
  14642. @item slide
  14643. Set slide mode.
  14644. Available values for slide is:
  14645. @table @samp
  14646. @item frame
  14647. Draw new frame when right border is reached.
  14648. @item replace
  14649. Replace old columns with new ones.
  14650. @item scroll
  14651. Scroll from right to left.
  14652. @item rscroll
  14653. Scroll from left to right.
  14654. @item picture
  14655. Draw single picture.
  14656. @end table
  14657. Default is @code{replace}.
  14658. @end table
  14659. @section threshold
  14660. Apply threshold effect to video stream.
  14661. This filter needs four video streams to perform thresholding.
  14662. First stream is stream we are filtering.
  14663. Second stream is holding threshold values, third stream is holding min values,
  14664. and last, fourth stream is holding max values.
  14665. The filter accepts the following option:
  14666. @table @option
  14667. @item planes
  14668. Set which planes will be processed, unprocessed planes will be copied.
  14669. By default value 0xf, all planes will be processed.
  14670. @end table
  14671. For example if first stream pixel's component value is less then threshold value
  14672. of pixel component from 2nd threshold stream, third stream value will picked,
  14673. otherwise fourth stream pixel component value will be picked.
  14674. Using color source filter one can perform various types of thresholding:
  14675. @subsection Examples
  14676. @itemize
  14677. @item
  14678. Binary threshold, using gray color as threshold:
  14679. @example
  14680. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14681. @end example
  14682. @item
  14683. Inverted binary threshold, using gray color as threshold:
  14684. @example
  14685. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14686. @end example
  14687. @item
  14688. Truncate binary threshold, using gray color as threshold:
  14689. @example
  14690. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14691. @end example
  14692. @item
  14693. Threshold to zero, using gray color as threshold:
  14694. @example
  14695. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14696. @end example
  14697. @item
  14698. Inverted threshold to zero, using gray color as threshold:
  14699. @example
  14700. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14701. @end example
  14702. @end itemize
  14703. @section thumbnail
  14704. Select the most representative frame in a given sequence of consecutive frames.
  14705. The filter accepts the following options:
  14706. @table @option
  14707. @item n
  14708. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14709. will pick one of them, and then handle the next batch of @var{n} frames until
  14710. the end. Default is @code{100}.
  14711. @end table
  14712. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14713. value will result in a higher memory usage, so a high value is not recommended.
  14714. @subsection Examples
  14715. @itemize
  14716. @item
  14717. Extract one picture each 50 frames:
  14718. @example
  14719. thumbnail=50
  14720. @end example
  14721. @item
  14722. Complete example of a thumbnail creation with @command{ffmpeg}:
  14723. @example
  14724. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14725. @end example
  14726. @end itemize
  14727. @anchor{tile}
  14728. @section tile
  14729. Tile several successive frames together.
  14730. The @ref{untile} filter can do the reverse.
  14731. The filter accepts the following options:
  14732. @table @option
  14733. @item layout
  14734. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14735. this option, check the
  14736. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14737. @item nb_frames
  14738. Set the maximum number of frames to render in the given area. It must be less
  14739. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14740. the area will be used.
  14741. @item margin
  14742. Set the outer border margin in pixels.
  14743. @item padding
  14744. Set the inner border thickness (i.e. the number of pixels between frames). For
  14745. more advanced padding options (such as having different values for the edges),
  14746. refer to the pad video filter.
  14747. @item color
  14748. Specify the color of the unused area. For the syntax of this option, check the
  14749. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14750. The default value of @var{color} is "black".
  14751. @item overlap
  14752. Set the number of frames to overlap when tiling several successive frames together.
  14753. The value must be between @code{0} and @var{nb_frames - 1}.
  14754. @item init_padding
  14755. Set the number of frames to initially be empty before displaying first output frame.
  14756. This controls how soon will one get first output frame.
  14757. The value must be between @code{0} and @var{nb_frames - 1}.
  14758. @end table
  14759. @subsection Examples
  14760. @itemize
  14761. @item
  14762. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14763. @example
  14764. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14765. @end example
  14766. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14767. duplicating each output frame to accommodate the originally detected frame
  14768. rate.
  14769. @item
  14770. Display @code{5} pictures in an area of @code{3x2} frames,
  14771. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14772. mixed flat and named options:
  14773. @example
  14774. tile=3x2:nb_frames=5:padding=7:margin=2
  14775. @end example
  14776. @end itemize
  14777. @section tinterlace
  14778. Perform various types of temporal field interlacing.
  14779. Frames are counted starting from 1, so the first input frame is
  14780. considered odd.
  14781. The filter accepts the following options:
  14782. @table @option
  14783. @item mode
  14784. Specify the mode of the interlacing. This option can also be specified
  14785. as a value alone. See below for a list of values for this option.
  14786. Available values are:
  14787. @table @samp
  14788. @item merge, 0
  14789. Move odd frames into the upper field, even into the lower field,
  14790. generating a double height frame at half frame rate.
  14791. @example
  14792. ------> time
  14793. Input:
  14794. Frame 1 Frame 2 Frame 3 Frame 4
  14795. 11111 22222 33333 44444
  14796. 11111 22222 33333 44444
  14797. 11111 22222 33333 44444
  14798. 11111 22222 33333 44444
  14799. Output:
  14800. 11111 33333
  14801. 22222 44444
  14802. 11111 33333
  14803. 22222 44444
  14804. 11111 33333
  14805. 22222 44444
  14806. 11111 33333
  14807. 22222 44444
  14808. @end example
  14809. @item drop_even, 1
  14810. Only output odd frames, even frames are dropped, generating a frame with
  14811. unchanged height at half frame rate.
  14812. @example
  14813. ------> time
  14814. Input:
  14815. Frame 1 Frame 2 Frame 3 Frame 4
  14816. 11111 22222 33333 44444
  14817. 11111 22222 33333 44444
  14818. 11111 22222 33333 44444
  14819. 11111 22222 33333 44444
  14820. Output:
  14821. 11111 33333
  14822. 11111 33333
  14823. 11111 33333
  14824. 11111 33333
  14825. @end example
  14826. @item drop_odd, 2
  14827. Only output even frames, odd frames are dropped, generating a frame with
  14828. unchanged height at half frame rate.
  14829. @example
  14830. ------> time
  14831. Input:
  14832. Frame 1 Frame 2 Frame 3 Frame 4
  14833. 11111 22222 33333 44444
  14834. 11111 22222 33333 44444
  14835. 11111 22222 33333 44444
  14836. 11111 22222 33333 44444
  14837. Output:
  14838. 22222 44444
  14839. 22222 44444
  14840. 22222 44444
  14841. 22222 44444
  14842. @end example
  14843. @item pad, 3
  14844. Expand each frame to full height, but pad alternate lines with black,
  14845. generating a frame with double height at the same input frame rate.
  14846. @example
  14847. ------> time
  14848. Input:
  14849. Frame 1 Frame 2 Frame 3 Frame 4
  14850. 11111 22222 33333 44444
  14851. 11111 22222 33333 44444
  14852. 11111 22222 33333 44444
  14853. 11111 22222 33333 44444
  14854. Output:
  14855. 11111 ..... 33333 .....
  14856. ..... 22222 ..... 44444
  14857. 11111 ..... 33333 .....
  14858. ..... 22222 ..... 44444
  14859. 11111 ..... 33333 .....
  14860. ..... 22222 ..... 44444
  14861. 11111 ..... 33333 .....
  14862. ..... 22222 ..... 44444
  14863. @end example
  14864. @item interleave_top, 4
  14865. Interleave the upper field from odd frames with the lower field from
  14866. even frames, generating a frame with unchanged height at half frame rate.
  14867. @example
  14868. ------> time
  14869. Input:
  14870. Frame 1 Frame 2 Frame 3 Frame 4
  14871. 11111<- 22222 33333<- 44444
  14872. 11111 22222<- 33333 44444<-
  14873. 11111<- 22222 33333<- 44444
  14874. 11111 22222<- 33333 44444<-
  14875. Output:
  14876. 11111 33333
  14877. 22222 44444
  14878. 11111 33333
  14879. 22222 44444
  14880. @end example
  14881. @item interleave_bottom, 5
  14882. Interleave the lower field from odd frames with the upper field from
  14883. even frames, generating a frame with unchanged height at half frame rate.
  14884. @example
  14885. ------> time
  14886. Input:
  14887. Frame 1 Frame 2 Frame 3 Frame 4
  14888. 11111 22222<- 33333 44444<-
  14889. 11111<- 22222 33333<- 44444
  14890. 11111 22222<- 33333 44444<-
  14891. 11111<- 22222 33333<- 44444
  14892. Output:
  14893. 22222 44444
  14894. 11111 33333
  14895. 22222 44444
  14896. 11111 33333
  14897. @end example
  14898. @item interlacex2, 6
  14899. Double frame rate with unchanged height. Frames are inserted each
  14900. containing the second temporal field from the previous input frame and
  14901. the first temporal field from the next input frame. This mode relies on
  14902. the top_field_first flag. Useful for interlaced video displays with no
  14903. field synchronisation.
  14904. @example
  14905. ------> time
  14906. Input:
  14907. Frame 1 Frame 2 Frame 3 Frame 4
  14908. 11111 22222 33333 44444
  14909. 11111 22222 33333 44444
  14910. 11111 22222 33333 44444
  14911. 11111 22222 33333 44444
  14912. Output:
  14913. 11111 22222 22222 33333 33333 44444 44444
  14914. 11111 11111 22222 22222 33333 33333 44444
  14915. 11111 22222 22222 33333 33333 44444 44444
  14916. 11111 11111 22222 22222 33333 33333 44444
  14917. @end example
  14918. @item mergex2, 7
  14919. Move odd frames into the upper field, even into the lower field,
  14920. generating a double height frame at same frame rate.
  14921. @example
  14922. ------> time
  14923. Input:
  14924. Frame 1 Frame 2 Frame 3 Frame 4
  14925. 11111 22222 33333 44444
  14926. 11111 22222 33333 44444
  14927. 11111 22222 33333 44444
  14928. 11111 22222 33333 44444
  14929. Output:
  14930. 11111 33333 33333 55555
  14931. 22222 22222 44444 44444
  14932. 11111 33333 33333 55555
  14933. 22222 22222 44444 44444
  14934. 11111 33333 33333 55555
  14935. 22222 22222 44444 44444
  14936. 11111 33333 33333 55555
  14937. 22222 22222 44444 44444
  14938. @end example
  14939. @end table
  14940. Numeric values are deprecated but are accepted for backward
  14941. compatibility reasons.
  14942. Default mode is @code{merge}.
  14943. @item flags
  14944. Specify flags influencing the filter process.
  14945. Available value for @var{flags} is:
  14946. @table @option
  14947. @item low_pass_filter, vlpf
  14948. Enable linear vertical low-pass filtering in the filter.
  14949. Vertical low-pass filtering is required when creating an interlaced
  14950. destination from a progressive source which contains high-frequency
  14951. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14952. patterning.
  14953. @item complex_filter, cvlpf
  14954. Enable complex vertical low-pass filtering.
  14955. This will slightly less reduce interlace 'twitter' and Moire
  14956. patterning but better retain detail and subjective sharpness impression.
  14957. @item bypass_il
  14958. Bypass already interlaced frames, only adjust the frame rate.
  14959. @end table
  14960. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14961. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14962. @end table
  14963. @section tmedian
  14964. Pick median pixels from several successive input video frames.
  14965. The filter accepts the following options:
  14966. @table @option
  14967. @item radius
  14968. Set radius of median filter.
  14969. Default is 1. Allowed range is from 1 to 127.
  14970. @item planes
  14971. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14972. @item percentile
  14973. Set median percentile. Default value is @code{0.5}.
  14974. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14975. minimum values, and @code{1} maximum values.
  14976. @end table
  14977. @subsection Commands
  14978. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  14979. @section tmidequalizer
  14980. Apply Temporal Midway Video Equalization effect.
  14981. Midway Video Equalization adjusts a sequence of video frames to have the same
  14982. histograms, while maintaining their dynamics as much as possible. It's
  14983. useful for e.g. matching exposures from a video frames sequence.
  14984. This filter accepts the following option:
  14985. @table @option
  14986. @item radius
  14987. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  14988. @item sigma
  14989. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  14990. Setting this option to 0 effectively does nothing.
  14991. @item planes
  14992. Set which planes to process. Default is @code{15}, which is all available planes.
  14993. @end table
  14994. @section tmix
  14995. Mix successive video frames.
  14996. A description of the accepted options follows.
  14997. @table @option
  14998. @item frames
  14999. The number of successive frames to mix. If unspecified, it defaults to 3.
  15000. @item weights
  15001. Specify weight of each input video frame.
  15002. Each weight is separated by space. If number of weights is smaller than
  15003. number of @var{frames} last specified weight will be used for all remaining
  15004. unset weights.
  15005. @item scale
  15006. Specify scale, if it is set it will be multiplied with sum
  15007. of each weight multiplied with pixel values to give final destination
  15008. pixel value. By default @var{scale} is auto scaled to sum of weights.
  15009. @end table
  15010. @subsection Examples
  15011. @itemize
  15012. @item
  15013. Average 7 successive frames:
  15014. @example
  15015. tmix=frames=7:weights="1 1 1 1 1 1 1"
  15016. @end example
  15017. @item
  15018. Apply simple temporal convolution:
  15019. @example
  15020. tmix=frames=3:weights="-1 3 -1"
  15021. @end example
  15022. @item
  15023. Similar as above but only showing temporal differences:
  15024. @example
  15025. tmix=frames=3:weights="-1 2 -1":scale=1
  15026. @end example
  15027. @end itemize
  15028. @subsection Commands
  15029. This filter supports the following commands:
  15030. @table @option
  15031. @item weights
  15032. @item scale
  15033. Syntax is same as option with same name.
  15034. @end table
  15035. @anchor{tonemap}
  15036. @section tonemap
  15037. Tone map colors from different dynamic ranges.
  15038. This filter expects data in single precision floating point, as it needs to
  15039. operate on (and can output) out-of-range values. Another filter, such as
  15040. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  15041. The tonemapping algorithms implemented only work on linear light, so input
  15042. data should be linearized beforehand (and possibly correctly tagged).
  15043. @example
  15044. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  15045. @end example
  15046. @subsection Options
  15047. The filter accepts the following options.
  15048. @table @option
  15049. @item tonemap
  15050. Set the tone map algorithm to use.
  15051. Possible values are:
  15052. @table @var
  15053. @item none
  15054. Do not apply any tone map, only desaturate overbright pixels.
  15055. @item clip
  15056. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  15057. in-range values, while distorting out-of-range values.
  15058. @item linear
  15059. Stretch the entire reference gamut to a linear multiple of the display.
  15060. @item gamma
  15061. Fit a logarithmic transfer between the tone curves.
  15062. @item reinhard
  15063. Preserve overall image brightness with a simple curve, using nonlinear
  15064. contrast, which results in flattening details and degrading color accuracy.
  15065. @item hable
  15066. Preserve both dark and bright details better than @var{reinhard}, at the cost
  15067. of slightly darkening everything. Use it when detail preservation is more
  15068. important than color and brightness accuracy.
  15069. @item mobius
  15070. Smoothly map out-of-range values, while retaining contrast and colors for
  15071. in-range material as much as possible. Use it when color accuracy is more
  15072. important than detail preservation.
  15073. @end table
  15074. Default is none.
  15075. @item param
  15076. Tune the tone mapping algorithm.
  15077. This affects the following algorithms:
  15078. @table @var
  15079. @item none
  15080. Ignored.
  15081. @item linear
  15082. Specifies the scale factor to use while stretching.
  15083. Default to 1.0.
  15084. @item gamma
  15085. Specifies the exponent of the function.
  15086. Default to 1.8.
  15087. @item clip
  15088. Specify an extra linear coefficient to multiply into the signal before clipping.
  15089. Default to 1.0.
  15090. @item reinhard
  15091. Specify the local contrast coefficient at the display peak.
  15092. Default to 0.5, which means that in-gamut values will be about half as bright
  15093. as when clipping.
  15094. @item hable
  15095. Ignored.
  15096. @item mobius
  15097. Specify the transition point from linear to mobius transform. Every value
  15098. below this point is guaranteed to be mapped 1:1. The higher the value, the
  15099. more accurate the result will be, at the cost of losing bright details.
  15100. Default to 0.3, which due to the steep initial slope still preserves in-range
  15101. colors fairly accurately.
  15102. @end table
  15103. @item desat
  15104. Apply desaturation for highlights that exceed this level of brightness. The
  15105. higher the parameter, the more color information will be preserved. This
  15106. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15107. (smoothly) turning into white instead. This makes images feel more natural,
  15108. at the cost of reducing information about out-of-range colors.
  15109. The default of 2.0 is somewhat conservative and will mostly just apply to
  15110. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  15111. This option works only if the input frame has a supported color tag.
  15112. @item peak
  15113. Override signal/nominal/reference peak with this value. Useful when the
  15114. embedded peak information in display metadata is not reliable or when tone
  15115. mapping from a lower range to a higher range.
  15116. @end table
  15117. @section tpad
  15118. Temporarily pad video frames.
  15119. The filter accepts the following options:
  15120. @table @option
  15121. @item start
  15122. Specify number of delay frames before input video stream. Default is 0.
  15123. @item stop
  15124. Specify number of padding frames after input video stream.
  15125. Set to -1 to pad indefinitely. Default is 0.
  15126. @item start_mode
  15127. Set kind of frames added to beginning of stream.
  15128. Can be either @var{add} or @var{clone}.
  15129. With @var{add} frames of solid-color are added.
  15130. With @var{clone} frames are clones of first frame.
  15131. Default is @var{add}.
  15132. @item stop_mode
  15133. Set kind of frames added to end of stream.
  15134. Can be either @var{add} or @var{clone}.
  15135. With @var{add} frames of solid-color are added.
  15136. With @var{clone} frames are clones of last frame.
  15137. Default is @var{add}.
  15138. @item start_duration, stop_duration
  15139. Specify the duration of the start/stop delay. See
  15140. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15141. for the accepted syntax.
  15142. These options override @var{start} and @var{stop}. Default is 0.
  15143. @item color
  15144. Specify the color of the padded area. For the syntax of this option,
  15145. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15146. manual,ffmpeg-utils}.
  15147. The default value of @var{color} is "black".
  15148. @end table
  15149. @anchor{transpose}
  15150. @section transpose
  15151. Transpose rows with columns in the input video and optionally flip it.
  15152. It accepts the following parameters:
  15153. @table @option
  15154. @item dir
  15155. Specify the transposition direction.
  15156. Can assume the following values:
  15157. @table @samp
  15158. @item 0, 4, cclock_flip
  15159. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  15160. @example
  15161. L.R L.l
  15162. . . -> . .
  15163. l.r R.r
  15164. @end example
  15165. @item 1, 5, clock
  15166. Rotate by 90 degrees clockwise, that is:
  15167. @example
  15168. L.R l.L
  15169. . . -> . .
  15170. l.r r.R
  15171. @end example
  15172. @item 2, 6, cclock
  15173. Rotate by 90 degrees counterclockwise, that is:
  15174. @example
  15175. L.R R.r
  15176. . . -> . .
  15177. l.r L.l
  15178. @end example
  15179. @item 3, 7, clock_flip
  15180. Rotate by 90 degrees clockwise and vertically flip, that is:
  15181. @example
  15182. L.R r.R
  15183. . . -> . .
  15184. l.r l.L
  15185. @end example
  15186. @end table
  15187. For values between 4-7, the transposition is only done if the input
  15188. video geometry is portrait and not landscape. These values are
  15189. deprecated, the @code{passthrough} option should be used instead.
  15190. Numerical values are deprecated, and should be dropped in favor of
  15191. symbolic constants.
  15192. @item passthrough
  15193. Do not apply the transposition if the input geometry matches the one
  15194. specified by the specified value. It accepts the following values:
  15195. @table @samp
  15196. @item none
  15197. Always apply transposition.
  15198. @item portrait
  15199. Preserve portrait geometry (when @var{height} >= @var{width}).
  15200. @item landscape
  15201. Preserve landscape geometry (when @var{width} >= @var{height}).
  15202. @end table
  15203. Default value is @code{none}.
  15204. @end table
  15205. For example to rotate by 90 degrees clockwise and preserve portrait
  15206. layout:
  15207. @example
  15208. transpose=dir=1:passthrough=portrait
  15209. @end example
  15210. The command above can also be specified as:
  15211. @example
  15212. transpose=1:portrait
  15213. @end example
  15214. @section transpose_npp
  15215. Transpose rows with columns in the input video and optionally flip it.
  15216. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  15217. It accepts the following parameters:
  15218. @table @option
  15219. @item dir
  15220. Specify the transposition direction.
  15221. Can assume the following values:
  15222. @table @samp
  15223. @item cclock_flip
  15224. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  15225. @item clock
  15226. Rotate by 90 degrees clockwise.
  15227. @item cclock
  15228. Rotate by 90 degrees counterclockwise.
  15229. @item clock_flip
  15230. Rotate by 90 degrees clockwise and vertically flip.
  15231. @end table
  15232. @item passthrough
  15233. Do not apply the transposition if the input geometry matches the one
  15234. specified by the specified value. It accepts the following values:
  15235. @table @samp
  15236. @item none
  15237. Always apply transposition. (default)
  15238. @item portrait
  15239. Preserve portrait geometry (when @var{height} >= @var{width}).
  15240. @item landscape
  15241. Preserve landscape geometry (when @var{width} >= @var{height}).
  15242. @end table
  15243. @end table
  15244. @section trim
  15245. Trim the input so that the output contains one continuous subpart of the input.
  15246. It accepts the following parameters:
  15247. @table @option
  15248. @item start
  15249. Specify the time of the start of the kept section, i.e. the frame with the
  15250. timestamp @var{start} will be the first frame in the output.
  15251. @item end
  15252. Specify the time of the first frame that will be dropped, i.e. the frame
  15253. immediately preceding the one with the timestamp @var{end} will be the last
  15254. frame in the output.
  15255. @item start_pts
  15256. This is the same as @var{start}, except this option sets the start timestamp
  15257. in timebase units instead of seconds.
  15258. @item end_pts
  15259. This is the same as @var{end}, except this option sets the end timestamp
  15260. in timebase units instead of seconds.
  15261. @item duration
  15262. The maximum duration of the output in seconds.
  15263. @item start_frame
  15264. The number of the first frame that should be passed to the output.
  15265. @item end_frame
  15266. The number of the first frame that should be dropped.
  15267. @end table
  15268. @option{start}, @option{end}, and @option{duration} are expressed as time
  15269. duration specifications; see
  15270. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15271. for the accepted syntax.
  15272. Note that the first two sets of the start/end options and the @option{duration}
  15273. option look at the frame timestamp, while the _frame variants simply count the
  15274. frames that pass through the filter. Also note that this filter does not modify
  15275. the timestamps. If you wish for the output timestamps to start at zero, insert a
  15276. setpts filter after the trim filter.
  15277. If multiple start or end options are set, this filter tries to be greedy and
  15278. keep all the frames that match at least one of the specified constraints. To keep
  15279. only the part that matches all the constraints at once, chain multiple trim
  15280. filters.
  15281. The defaults are such that all the input is kept. So it is possible to set e.g.
  15282. just the end values to keep everything before the specified time.
  15283. Examples:
  15284. @itemize
  15285. @item
  15286. Drop everything except the second minute of input:
  15287. @example
  15288. ffmpeg -i INPUT -vf trim=60:120
  15289. @end example
  15290. @item
  15291. Keep only the first second:
  15292. @example
  15293. ffmpeg -i INPUT -vf trim=duration=1
  15294. @end example
  15295. @end itemize
  15296. @section unpremultiply
  15297. Apply alpha unpremultiply effect to input video stream using first plane
  15298. of second stream as alpha.
  15299. Both streams must have same dimensions and same pixel format.
  15300. The filter accepts the following option:
  15301. @table @option
  15302. @item planes
  15303. Set which planes will be processed, unprocessed planes will be copied.
  15304. By default value 0xf, all planes will be processed.
  15305. If the format has 1 or 2 components, then luma is bit 0.
  15306. If the format has 3 or 4 components:
  15307. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  15308. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  15309. If present, the alpha channel is always the last bit.
  15310. @item inplace
  15311. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15312. @end table
  15313. @anchor{unsharp}
  15314. @section unsharp
  15315. Sharpen or blur the input video.
  15316. It accepts the following parameters:
  15317. @table @option
  15318. @item luma_msize_x, lx
  15319. Set the luma matrix horizontal size. It must be an odd integer between
  15320. 3 and 23. The default value is 5.
  15321. @item luma_msize_y, ly
  15322. Set the luma matrix vertical size. It must be an odd integer between 3
  15323. and 23. The default value is 5.
  15324. @item luma_amount, la
  15325. Set the luma effect strength. It must be a floating point number, reasonable
  15326. values lay between -1.5 and 1.5.
  15327. Negative values will blur the input video, while positive values will
  15328. sharpen it, a value of zero will disable the effect.
  15329. Default value is 1.0.
  15330. @item chroma_msize_x, cx
  15331. Set the chroma matrix horizontal size. It must be an odd integer
  15332. between 3 and 23. The default value is 5.
  15333. @item chroma_msize_y, cy
  15334. Set the chroma matrix vertical size. It must be an odd integer
  15335. between 3 and 23. The default value is 5.
  15336. @item chroma_amount, ca
  15337. Set the chroma effect strength. It must be a floating point number, reasonable
  15338. values lay between -1.5 and 1.5.
  15339. Negative values will blur the input video, while positive values will
  15340. sharpen it, a value of zero will disable the effect.
  15341. Default value is 0.0.
  15342. @end table
  15343. All parameters are optional and default to the equivalent of the
  15344. string '5:5:1.0:5:5:0.0'.
  15345. @subsection Examples
  15346. @itemize
  15347. @item
  15348. Apply strong luma sharpen effect:
  15349. @example
  15350. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  15351. @end example
  15352. @item
  15353. Apply a strong blur of both luma and chroma parameters:
  15354. @example
  15355. unsharp=7:7:-2:7:7:-2
  15356. @end example
  15357. @end itemize
  15358. @anchor{untile}
  15359. @section untile
  15360. Decompose a video made of tiled images into the individual images.
  15361. The frame rate of the output video is the frame rate of the input video
  15362. multiplied by the number of tiles.
  15363. This filter does the reverse of @ref{tile}.
  15364. The filter accepts the following options:
  15365. @table @option
  15366. @item layout
  15367. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15368. this option, check the
  15369. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15370. @end table
  15371. @subsection Examples
  15372. @itemize
  15373. @item
  15374. Produce a 1-second video from a still image file made of 25 frames stacked
  15375. vertically, like an analogic film reel:
  15376. @example
  15377. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  15378. @end example
  15379. @end itemize
  15380. @section uspp
  15381. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  15382. the image at several (or - in the case of @option{quality} level @code{8} - all)
  15383. shifts and average the results.
  15384. The way this differs from the behavior of spp is that uspp actually encodes &
  15385. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  15386. DCT similar to MJPEG.
  15387. The filter accepts the following options:
  15388. @table @option
  15389. @item quality
  15390. Set quality. This option defines the number of levels for averaging. It accepts
  15391. an integer in the range 0-8. If set to @code{0}, the filter will have no
  15392. effect. A value of @code{8} means the higher quality. For each increment of
  15393. that value the speed drops by a factor of approximately 2. Default value is
  15394. @code{3}.
  15395. @item qp
  15396. Force a constant quantization parameter. If not set, the filter will use the QP
  15397. from the video stream (if available).
  15398. @end table
  15399. @section v360
  15400. Convert 360 videos between various formats.
  15401. The filter accepts the following options:
  15402. @table @option
  15403. @item input
  15404. @item output
  15405. Set format of the input/output video.
  15406. Available formats:
  15407. @table @samp
  15408. @item e
  15409. @item equirect
  15410. Equirectangular projection.
  15411. @item c3x2
  15412. @item c6x1
  15413. @item c1x6
  15414. Cubemap with 3x2/6x1/1x6 layout.
  15415. Format specific options:
  15416. @table @option
  15417. @item in_pad
  15418. @item out_pad
  15419. Set padding proportion for the input/output cubemap. Values in decimals.
  15420. Example values:
  15421. @table @samp
  15422. @item 0
  15423. No padding.
  15424. @item 0.01
  15425. 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)
  15426. @end table
  15427. Default value is @b{@samp{0}}.
  15428. Maximum value is @b{@samp{0.1}}.
  15429. @item fin_pad
  15430. @item fout_pad
  15431. Set fixed padding for the input/output cubemap. Values in pixels.
  15432. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15433. @item in_forder
  15434. @item out_forder
  15435. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15436. Designation of directions:
  15437. @table @samp
  15438. @item r
  15439. right
  15440. @item l
  15441. left
  15442. @item u
  15443. up
  15444. @item d
  15445. down
  15446. @item f
  15447. forward
  15448. @item b
  15449. back
  15450. @end table
  15451. Default value is @b{@samp{rludfb}}.
  15452. @item in_frot
  15453. @item out_frot
  15454. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15455. Designation of angles:
  15456. @table @samp
  15457. @item 0
  15458. 0 degrees clockwise
  15459. @item 1
  15460. 90 degrees clockwise
  15461. @item 2
  15462. 180 degrees clockwise
  15463. @item 3
  15464. 270 degrees clockwise
  15465. @end table
  15466. Default value is @b{@samp{000000}}.
  15467. @end table
  15468. @item eac
  15469. Equi-Angular Cubemap.
  15470. @item flat
  15471. @item gnomonic
  15472. @item rectilinear
  15473. Regular video.
  15474. Format specific options:
  15475. @table @option
  15476. @item h_fov
  15477. @item v_fov
  15478. @item d_fov
  15479. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15480. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15481. @item ih_fov
  15482. @item iv_fov
  15483. @item id_fov
  15484. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15485. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15486. @end table
  15487. @item dfisheye
  15488. Dual fisheye.
  15489. Format specific options:
  15490. @table @option
  15491. @item h_fov
  15492. @item v_fov
  15493. @item d_fov
  15494. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15495. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15496. @item ih_fov
  15497. @item iv_fov
  15498. @item id_fov
  15499. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15500. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15501. @end table
  15502. @item barrel
  15503. @item fb
  15504. @item barrelsplit
  15505. Facebook's 360 formats.
  15506. @item sg
  15507. Stereographic format.
  15508. Format specific options:
  15509. @table @option
  15510. @item h_fov
  15511. @item v_fov
  15512. @item d_fov
  15513. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15514. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15515. @item ih_fov
  15516. @item iv_fov
  15517. @item id_fov
  15518. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15519. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15520. @end table
  15521. @item mercator
  15522. Mercator format.
  15523. @item ball
  15524. Ball format, gives significant distortion toward the back.
  15525. @item hammer
  15526. Hammer-Aitoff map projection format.
  15527. @item sinusoidal
  15528. Sinusoidal map projection format.
  15529. @item fisheye
  15530. Fisheye projection.
  15531. Format specific options:
  15532. @table @option
  15533. @item h_fov
  15534. @item v_fov
  15535. @item d_fov
  15536. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15537. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15538. @item ih_fov
  15539. @item iv_fov
  15540. @item id_fov
  15541. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15542. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15543. @end table
  15544. @item pannini
  15545. Pannini projection.
  15546. Format specific options:
  15547. @table @option
  15548. @item h_fov
  15549. Set output pannini parameter.
  15550. @item ih_fov
  15551. Set input pannini parameter.
  15552. @end table
  15553. @item cylindrical
  15554. Cylindrical projection.
  15555. Format specific options:
  15556. @table @option
  15557. @item h_fov
  15558. @item v_fov
  15559. @item d_fov
  15560. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15561. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15562. @item ih_fov
  15563. @item iv_fov
  15564. @item id_fov
  15565. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15566. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15567. @end table
  15568. @item perspective
  15569. Perspective projection. @i{(output only)}
  15570. Format specific options:
  15571. @table @option
  15572. @item v_fov
  15573. Set perspective parameter.
  15574. @end table
  15575. @item tetrahedron
  15576. Tetrahedron projection.
  15577. @item tsp
  15578. Truncated square pyramid projection.
  15579. @item he
  15580. @item hequirect
  15581. Half equirectangular projection.
  15582. @item equisolid
  15583. Equisolid format.
  15584. Format specific options:
  15585. @table @option
  15586. @item h_fov
  15587. @item v_fov
  15588. @item d_fov
  15589. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15590. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15591. @item ih_fov
  15592. @item iv_fov
  15593. @item id_fov
  15594. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15595. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15596. @end table
  15597. @item og
  15598. Orthographic format.
  15599. Format specific options:
  15600. @table @option
  15601. @item h_fov
  15602. @item v_fov
  15603. @item d_fov
  15604. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15605. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15606. @item ih_fov
  15607. @item iv_fov
  15608. @item id_fov
  15609. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15610. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15611. @end table
  15612. @item octahedron
  15613. Octahedron projection.
  15614. @end table
  15615. @item interp
  15616. Set interpolation method.@*
  15617. @i{Note: more complex interpolation methods require much more memory to run.}
  15618. Available methods:
  15619. @table @samp
  15620. @item near
  15621. @item nearest
  15622. Nearest neighbour.
  15623. @item line
  15624. @item linear
  15625. Bilinear interpolation.
  15626. @item lagrange9
  15627. Lagrange9 interpolation.
  15628. @item cube
  15629. @item cubic
  15630. Bicubic interpolation.
  15631. @item lanc
  15632. @item lanczos
  15633. Lanczos interpolation.
  15634. @item sp16
  15635. @item spline16
  15636. Spline16 interpolation.
  15637. @item gauss
  15638. @item gaussian
  15639. Gaussian interpolation.
  15640. @item mitchell
  15641. Mitchell interpolation.
  15642. @end table
  15643. Default value is @b{@samp{line}}.
  15644. @item w
  15645. @item h
  15646. Set the output video resolution.
  15647. Default resolution depends on formats.
  15648. @item in_stereo
  15649. @item out_stereo
  15650. Set the input/output stereo format.
  15651. @table @samp
  15652. @item 2d
  15653. 2D mono
  15654. @item sbs
  15655. Side by side
  15656. @item tb
  15657. Top bottom
  15658. @end table
  15659. Default value is @b{@samp{2d}} for input and output format.
  15660. @item yaw
  15661. @item pitch
  15662. @item roll
  15663. Set rotation for the output video. Values in degrees.
  15664. @item rorder
  15665. Set rotation order for the output video. Choose one item for each position.
  15666. @table @samp
  15667. @item y, Y
  15668. yaw
  15669. @item p, P
  15670. pitch
  15671. @item r, R
  15672. roll
  15673. @end table
  15674. Default value is @b{@samp{ypr}}.
  15675. @item h_flip
  15676. @item v_flip
  15677. @item d_flip
  15678. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15679. @item ih_flip
  15680. @item iv_flip
  15681. Set if input video is flipped horizontally/vertically. Boolean values.
  15682. @item in_trans
  15683. Set if input video is transposed. Boolean value, by default disabled.
  15684. @item out_trans
  15685. Set if output video needs to be transposed. Boolean value, by default disabled.
  15686. @item alpha_mask
  15687. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15688. @end table
  15689. @subsection Examples
  15690. @itemize
  15691. @item
  15692. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15693. @example
  15694. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15695. @end example
  15696. @item
  15697. Extract back view of Equi-Angular Cubemap:
  15698. @example
  15699. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15700. @end example
  15701. @item
  15702. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15703. @example
  15704. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15705. @end example
  15706. @end itemize
  15707. @subsection Commands
  15708. This filter supports subset of above options as @ref{commands}.
  15709. @section vaguedenoiser
  15710. Apply a wavelet based denoiser.
  15711. It transforms each frame from the video input into the wavelet domain,
  15712. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15713. the obtained coefficients. It does an inverse wavelet transform after.
  15714. Due to wavelet properties, it should give a nice smoothed result, and
  15715. reduced noise, without blurring picture features.
  15716. This filter accepts the following options:
  15717. @table @option
  15718. @item threshold
  15719. The filtering strength. The higher, the more filtered the video will be.
  15720. Hard thresholding can use a higher threshold than soft thresholding
  15721. before the video looks overfiltered. Default value is 2.
  15722. @item method
  15723. The filtering method the filter will use.
  15724. It accepts the following values:
  15725. @table @samp
  15726. @item hard
  15727. All values under the threshold will be zeroed.
  15728. @item soft
  15729. All values under the threshold will be zeroed. All values above will be
  15730. reduced by the threshold.
  15731. @item garrote
  15732. Scales or nullifies coefficients - intermediary between (more) soft and
  15733. (less) hard thresholding.
  15734. @end table
  15735. Default is garrote.
  15736. @item nsteps
  15737. Number of times, the wavelet will decompose the picture. Picture can't
  15738. be decomposed beyond a particular point (typically, 8 for a 640x480
  15739. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15740. @item percent
  15741. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15742. @item planes
  15743. A list of the planes to process. By default all planes are processed.
  15744. @item type
  15745. The threshold type the filter will use.
  15746. It accepts the following values:
  15747. @table @samp
  15748. @item universal
  15749. Threshold used is same for all decompositions.
  15750. @item bayes
  15751. Threshold used depends also on each decomposition coefficients.
  15752. @end table
  15753. Default is universal.
  15754. @end table
  15755. @section vectorscope
  15756. Display 2 color component values in the two dimensional graph (which is called
  15757. a vectorscope).
  15758. This filter accepts the following options:
  15759. @table @option
  15760. @item mode, m
  15761. Set vectorscope mode.
  15762. It accepts the following values:
  15763. @table @samp
  15764. @item gray
  15765. @item tint
  15766. Gray values are displayed on graph, higher brightness means more pixels have
  15767. same component color value on location in graph. This is the default mode.
  15768. @item color
  15769. Gray values are displayed on graph. Surrounding pixels values which are not
  15770. present in video frame are drawn in gradient of 2 color components which are
  15771. set by option @code{x} and @code{y}. The 3rd color component is static.
  15772. @item color2
  15773. Actual color components values present in video frame are displayed on graph.
  15774. @item color3
  15775. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15776. on graph increases value of another color component, which is luminance by
  15777. default values of @code{x} and @code{y}.
  15778. @item color4
  15779. Actual colors present in video frame are displayed on graph. If two different
  15780. colors map to same position on graph then color with higher value of component
  15781. not present in graph is picked.
  15782. @item color5
  15783. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15784. component picked from radial gradient.
  15785. @end table
  15786. @item x
  15787. Set which color component will be represented on X-axis. Default is @code{1}.
  15788. @item y
  15789. Set which color component will be represented on Y-axis. Default is @code{2}.
  15790. @item intensity, i
  15791. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15792. of color component which represents frequency of (X, Y) location in graph.
  15793. @item envelope, e
  15794. @table @samp
  15795. @item none
  15796. No envelope, this is default.
  15797. @item instant
  15798. Instant envelope, even darkest single pixel will be clearly highlighted.
  15799. @item peak
  15800. Hold maximum and minimum values presented in graph over time. This way you
  15801. can still spot out of range values without constantly looking at vectorscope.
  15802. @item peak+instant
  15803. Peak and instant envelope combined together.
  15804. @end table
  15805. @item graticule, g
  15806. Set what kind of graticule to draw.
  15807. @table @samp
  15808. @item none
  15809. @item green
  15810. @item color
  15811. @item invert
  15812. @end table
  15813. @item opacity, o
  15814. Set graticule opacity.
  15815. @item flags, f
  15816. Set graticule flags.
  15817. @table @samp
  15818. @item white
  15819. Draw graticule for white point.
  15820. @item black
  15821. Draw graticule for black point.
  15822. @item name
  15823. Draw color points short names.
  15824. @end table
  15825. @item bgopacity, b
  15826. Set background opacity.
  15827. @item lthreshold, l
  15828. Set low threshold for color component not represented on X or Y axis.
  15829. Values lower than this value will be ignored. Default is 0.
  15830. Note this value is multiplied with actual max possible value one pixel component
  15831. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15832. is 0.1 * 255 = 25.
  15833. @item hthreshold, h
  15834. Set high threshold for color component not represented on X or Y axis.
  15835. Values higher than this value will be ignored. Default is 1.
  15836. Note this value is multiplied with actual max possible value one pixel component
  15837. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15838. is 0.9 * 255 = 230.
  15839. @item colorspace, c
  15840. Set what kind of colorspace to use when drawing graticule.
  15841. @table @samp
  15842. @item auto
  15843. @item 601
  15844. @item 709
  15845. @end table
  15846. Default is auto.
  15847. @item tint0, t0
  15848. @item tint1, t1
  15849. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15850. This means no tint, and output will remain gray.
  15851. @end table
  15852. @anchor{vidstabdetect}
  15853. @section vidstabdetect
  15854. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15855. @ref{vidstabtransform} for pass 2.
  15856. This filter generates a file with relative translation and rotation
  15857. transform information about subsequent frames, which is then used by
  15858. the @ref{vidstabtransform} filter.
  15859. To enable compilation of this filter you need to configure FFmpeg with
  15860. @code{--enable-libvidstab}.
  15861. This filter accepts the following options:
  15862. @table @option
  15863. @item result
  15864. Set the path to the file used to write the transforms information.
  15865. Default value is @file{transforms.trf}.
  15866. @item shakiness
  15867. Set how shaky the video is and how quick the camera is. It accepts an
  15868. integer in the range 1-10, a value of 1 means little shakiness, a
  15869. value of 10 means strong shakiness. Default value is 5.
  15870. @item accuracy
  15871. Set the accuracy of the detection process. It must be a value in the
  15872. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15873. accuracy. Default value is 15.
  15874. @item stepsize
  15875. Set stepsize of the search process. The region around minimum is
  15876. scanned with 1 pixel resolution. Default value is 6.
  15877. @item mincontrast
  15878. Set minimum contrast. Below this value a local measurement field is
  15879. discarded. Must be a floating point value in the range 0-1. Default
  15880. value is 0.3.
  15881. @item tripod
  15882. Set reference frame number for tripod mode.
  15883. If enabled, the motion of the frames is compared to a reference frame
  15884. in the filtered stream, identified by the specified number. The idea
  15885. is to compensate all movements in a more-or-less static scene and keep
  15886. the camera view absolutely still.
  15887. If set to 0, it is disabled. The frames are counted starting from 1.
  15888. @item show
  15889. Show fields and transforms in the resulting frames. It accepts an
  15890. integer in the range 0-2. Default value is 0, which disables any
  15891. visualization.
  15892. @end table
  15893. @subsection Examples
  15894. @itemize
  15895. @item
  15896. Use default values:
  15897. @example
  15898. vidstabdetect
  15899. @end example
  15900. @item
  15901. Analyze strongly shaky movie and put the results in file
  15902. @file{mytransforms.trf}:
  15903. @example
  15904. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15905. @end example
  15906. @item
  15907. Visualize the result of internal transformations in the resulting
  15908. video:
  15909. @example
  15910. vidstabdetect=show=1
  15911. @end example
  15912. @item
  15913. Analyze a video with medium shakiness using @command{ffmpeg}:
  15914. @example
  15915. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15916. @end example
  15917. @end itemize
  15918. @anchor{vidstabtransform}
  15919. @section vidstabtransform
  15920. Video stabilization/deshaking: pass 2 of 2,
  15921. see @ref{vidstabdetect} for pass 1.
  15922. Read a file with transform information for each frame and
  15923. apply/compensate them. Together with the @ref{vidstabdetect}
  15924. filter this can be used to deshake videos. See also
  15925. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15926. the @ref{unsharp} filter, see below.
  15927. To enable compilation of this filter you need to configure FFmpeg with
  15928. @code{--enable-libvidstab}.
  15929. @subsection Options
  15930. @table @option
  15931. @item input
  15932. Set path to the file used to read the transforms. Default value is
  15933. @file{transforms.trf}.
  15934. @item smoothing
  15935. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15936. camera movements. Default value is 10.
  15937. For example a number of 10 means that 21 frames are used (10 in the
  15938. past and 10 in the future) to smoothen the motion in the video. A
  15939. larger value leads to a smoother video, but limits the acceleration of
  15940. the camera (pan/tilt movements). 0 is a special case where a static
  15941. camera is simulated.
  15942. @item optalgo
  15943. Set the camera path optimization algorithm.
  15944. Accepted values are:
  15945. @table @samp
  15946. @item gauss
  15947. gaussian kernel low-pass filter on camera motion (default)
  15948. @item avg
  15949. averaging on transformations
  15950. @end table
  15951. @item maxshift
  15952. Set maximal number of pixels to translate frames. Default value is -1,
  15953. meaning no limit.
  15954. @item maxangle
  15955. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15956. value is -1, meaning no limit.
  15957. @item crop
  15958. Specify how to deal with borders that may be visible due to movement
  15959. compensation.
  15960. Available values are:
  15961. @table @samp
  15962. @item keep
  15963. keep image information from previous frame (default)
  15964. @item black
  15965. fill the border black
  15966. @end table
  15967. @item invert
  15968. Invert transforms if set to 1. Default value is 0.
  15969. @item relative
  15970. Consider transforms as relative to previous frame if set to 1,
  15971. absolute if set to 0. Default value is 0.
  15972. @item zoom
  15973. Set percentage to zoom. A positive value will result in a zoom-in
  15974. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15975. zoom).
  15976. @item optzoom
  15977. Set optimal zooming to avoid borders.
  15978. Accepted values are:
  15979. @table @samp
  15980. @item 0
  15981. disabled
  15982. @item 1
  15983. optimal static zoom value is determined (only very strong movements
  15984. will lead to visible borders) (default)
  15985. @item 2
  15986. optimal adaptive zoom value is determined (no borders will be
  15987. visible), see @option{zoomspeed}
  15988. @end table
  15989. Note that the value given at zoom is added to the one calculated here.
  15990. @item zoomspeed
  15991. Set percent to zoom maximally each frame (enabled when
  15992. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15993. 0.25.
  15994. @item interpol
  15995. Specify type of interpolation.
  15996. Available values are:
  15997. @table @samp
  15998. @item no
  15999. no interpolation
  16000. @item linear
  16001. linear only horizontal
  16002. @item bilinear
  16003. linear in both directions (default)
  16004. @item bicubic
  16005. cubic in both directions (slow)
  16006. @end table
  16007. @item tripod
  16008. Enable virtual tripod mode if set to 1, which is equivalent to
  16009. @code{relative=0:smoothing=0}. Default value is 0.
  16010. Use also @code{tripod} option of @ref{vidstabdetect}.
  16011. @item debug
  16012. Increase log verbosity if set to 1. Also the detected global motions
  16013. are written to the temporary file @file{global_motions.trf}. Default
  16014. value is 0.
  16015. @end table
  16016. @subsection Examples
  16017. @itemize
  16018. @item
  16019. Use @command{ffmpeg} for a typical stabilization with default values:
  16020. @example
  16021. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  16022. @end example
  16023. Note the use of the @ref{unsharp} filter which is always recommended.
  16024. @item
  16025. Zoom in a bit more and load transform data from a given file:
  16026. @example
  16027. vidstabtransform=zoom=5:input="mytransforms.trf"
  16028. @end example
  16029. @item
  16030. Smoothen the video even more:
  16031. @example
  16032. vidstabtransform=smoothing=30
  16033. @end example
  16034. @end itemize
  16035. @section vflip
  16036. Flip the input video vertically.
  16037. For example, to vertically flip a video with @command{ffmpeg}:
  16038. @example
  16039. ffmpeg -i in.avi -vf "vflip" out.avi
  16040. @end example
  16041. @section vfrdet
  16042. Detect variable frame rate video.
  16043. This filter tries to detect if the input is variable or constant frame rate.
  16044. At end it will output number of frames detected as having variable delta pts,
  16045. and ones with constant delta pts.
  16046. If there was frames with variable delta, than it will also show min, max and
  16047. average delta encountered.
  16048. @section vibrance
  16049. Boost or alter saturation.
  16050. The filter accepts the following options:
  16051. @table @option
  16052. @item intensity
  16053. Set strength of boost if positive value or strength of alter if negative value.
  16054. Default is 0. Allowed range is from -2 to 2.
  16055. @item rbal
  16056. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  16057. @item gbal
  16058. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  16059. @item bbal
  16060. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  16061. @item rlum
  16062. Set the red luma coefficient.
  16063. @item glum
  16064. Set the green luma coefficient.
  16065. @item blum
  16066. Set the blue luma coefficient.
  16067. @item alternate
  16068. If @code{intensity} is negative and this is set to 1, colors will change,
  16069. otherwise colors will be less saturated, more towards gray.
  16070. @end table
  16071. @subsection Commands
  16072. This filter supports the all above options as @ref{commands}.
  16073. @anchor{vignette}
  16074. @section vignette
  16075. Make or reverse a natural vignetting effect.
  16076. The filter accepts the following options:
  16077. @table @option
  16078. @item angle, a
  16079. Set lens angle expression as a number of radians.
  16080. The value is clipped in the @code{[0,PI/2]} range.
  16081. Default value: @code{"PI/5"}
  16082. @item x0
  16083. @item y0
  16084. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  16085. by default.
  16086. @item mode
  16087. Set forward/backward mode.
  16088. Available modes are:
  16089. @table @samp
  16090. @item forward
  16091. The larger the distance from the central point, the darker the image becomes.
  16092. @item backward
  16093. The larger the distance from the central point, the brighter the image becomes.
  16094. This can be used to reverse a vignette effect, though there is no automatic
  16095. detection to extract the lens @option{angle} and other settings (yet). It can
  16096. also be used to create a burning effect.
  16097. @end table
  16098. Default value is @samp{forward}.
  16099. @item eval
  16100. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  16101. It accepts the following values:
  16102. @table @samp
  16103. @item init
  16104. Evaluate expressions only once during the filter initialization.
  16105. @item frame
  16106. Evaluate expressions for each incoming frame. This is way slower than the
  16107. @samp{init} mode since it requires all the scalers to be re-computed, but it
  16108. allows advanced dynamic expressions.
  16109. @end table
  16110. Default value is @samp{init}.
  16111. @item dither
  16112. Set dithering to reduce the circular banding effects. Default is @code{1}
  16113. (enabled).
  16114. @item aspect
  16115. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  16116. Setting this value to the SAR of the input will make a rectangular vignetting
  16117. following the dimensions of the video.
  16118. Default is @code{1/1}.
  16119. @end table
  16120. @subsection Expressions
  16121. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  16122. following parameters.
  16123. @table @option
  16124. @item w
  16125. @item h
  16126. input width and height
  16127. @item n
  16128. the number of input frame, starting from 0
  16129. @item pts
  16130. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  16131. @var{TB} units, NAN if undefined
  16132. @item r
  16133. frame rate of the input video, NAN if the input frame rate is unknown
  16134. @item t
  16135. the PTS (Presentation TimeStamp) of the filtered video frame,
  16136. expressed in seconds, NAN if undefined
  16137. @item tb
  16138. time base of the input video
  16139. @end table
  16140. @subsection Examples
  16141. @itemize
  16142. @item
  16143. Apply simple strong vignetting effect:
  16144. @example
  16145. vignette=PI/4
  16146. @end example
  16147. @item
  16148. Make a flickering vignetting:
  16149. @example
  16150. vignette='PI/4+random(1)*PI/50':eval=frame
  16151. @end example
  16152. @end itemize
  16153. @section vmafmotion
  16154. Obtain the average VMAF motion score of a video.
  16155. It is one of the component metrics of VMAF.
  16156. The obtained average motion score is printed through the logging system.
  16157. The filter accepts the following options:
  16158. @table @option
  16159. @item stats_file
  16160. If specified, the filter will use the named file to save the motion score of
  16161. each frame with respect to the previous frame.
  16162. When filename equals "-" the data is sent to standard output.
  16163. @end table
  16164. Example:
  16165. @example
  16166. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  16167. @end example
  16168. @section vstack
  16169. Stack input videos vertically.
  16170. All streams must be of same pixel format and of same width.
  16171. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  16172. to create same output.
  16173. The filter accepts the following options:
  16174. @table @option
  16175. @item inputs
  16176. Set number of input streams. Default is 2.
  16177. @item shortest
  16178. If set to 1, force the output to terminate when the shortest input
  16179. terminates. Default value is 0.
  16180. @end table
  16181. @section w3fdif
  16182. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  16183. Deinterlacing Filter").
  16184. Based on the process described by Martin Weston for BBC R&D, and
  16185. implemented based on the de-interlace algorithm written by Jim
  16186. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  16187. uses filter coefficients calculated by BBC R&D.
  16188. This filter uses field-dominance information in frame to decide which
  16189. of each pair of fields to place first in the output.
  16190. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  16191. There are two sets of filter coefficients, so called "simple"
  16192. and "complex". Which set of filter coefficients is used can
  16193. be set by passing an optional parameter:
  16194. @table @option
  16195. @item filter
  16196. Set the interlacing filter coefficients. Accepts one of the following values:
  16197. @table @samp
  16198. @item simple
  16199. Simple filter coefficient set.
  16200. @item complex
  16201. More-complex filter coefficient set.
  16202. @end table
  16203. Default value is @samp{complex}.
  16204. @item mode
  16205. The interlacing mode to adopt. It accepts one of the following values:
  16206. @table @option
  16207. @item frame
  16208. Output one frame for each frame.
  16209. @item field
  16210. Output one frame for each field.
  16211. @end table
  16212. The default value is @code{field}.
  16213. @item parity
  16214. The picture field parity assumed for the input interlaced video. It accepts one
  16215. of the following values:
  16216. @table @option
  16217. @item tff
  16218. Assume the top field is first.
  16219. @item bff
  16220. Assume the bottom field is first.
  16221. @item auto
  16222. Enable automatic detection of field parity.
  16223. @end table
  16224. The default value is @code{auto}.
  16225. If the interlacing is unknown or the decoder does not export this information,
  16226. top field first will be assumed.
  16227. @item deint
  16228. Specify which frames to deinterlace. Accepts one of the following values:
  16229. @table @samp
  16230. @item all
  16231. Deinterlace all frames,
  16232. @item interlaced
  16233. Only deinterlace frames marked as interlaced.
  16234. @end table
  16235. Default value is @samp{all}.
  16236. @end table
  16237. @subsection Commands
  16238. This filter supports same @ref{commands} as options.
  16239. @section waveform
  16240. Video waveform monitor.
  16241. The waveform monitor plots color component intensity. By default luminance
  16242. only. Each column of the waveform corresponds to a column of pixels in the
  16243. source video.
  16244. It accepts the following options:
  16245. @table @option
  16246. @item mode, m
  16247. Can be either @code{row}, or @code{column}. Default is @code{column}.
  16248. In row mode, the graph on the left side represents color component value 0 and
  16249. the right side represents value = 255. In column mode, the top side represents
  16250. color component value = 0 and bottom side represents value = 255.
  16251. @item intensity, i
  16252. Set intensity. Smaller values are useful to find out how many values of the same
  16253. luminance are distributed across input rows/columns.
  16254. Default value is @code{0.04}. Allowed range is [0, 1].
  16255. @item mirror, r
  16256. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  16257. In mirrored mode, higher values will be represented on the left
  16258. side for @code{row} mode and at the top for @code{column} mode. Default is
  16259. @code{1} (mirrored).
  16260. @item display, d
  16261. Set display mode.
  16262. It accepts the following values:
  16263. @table @samp
  16264. @item overlay
  16265. Presents information identical to that in the @code{parade}, except
  16266. that the graphs representing color components are superimposed directly
  16267. over one another.
  16268. This display mode makes it easier to spot relative differences or similarities
  16269. in overlapping areas of the color components that are supposed to be identical,
  16270. such as neutral whites, grays, or blacks.
  16271. @item stack
  16272. Display separate graph for the color components side by side in
  16273. @code{row} mode or one below the other in @code{column} mode.
  16274. @item parade
  16275. Display separate graph for the color components side by side in
  16276. @code{column} mode or one below the other in @code{row} mode.
  16277. Using this display mode makes it easy to spot color casts in the highlights
  16278. and shadows of an image, by comparing the contours of the top and the bottom
  16279. graphs of each waveform. Since whites, grays, and blacks are characterized
  16280. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  16281. should display three waveforms of roughly equal width/height. If not, the
  16282. correction is easy to perform by making level adjustments the three waveforms.
  16283. @end table
  16284. Default is @code{stack}.
  16285. @item components, c
  16286. Set which color components to display. Default is 1, which means only luminance
  16287. or red color component if input is in RGB colorspace. If is set for example to
  16288. 7 it will display all 3 (if) available color components.
  16289. @item envelope, e
  16290. @table @samp
  16291. @item none
  16292. No envelope, this is default.
  16293. @item instant
  16294. Instant envelope, minimum and maximum values presented in graph will be easily
  16295. visible even with small @code{step} value.
  16296. @item peak
  16297. Hold minimum and maximum values presented in graph across time. This way you
  16298. can still spot out of range values without constantly looking at waveforms.
  16299. @item peak+instant
  16300. Peak and instant envelope combined together.
  16301. @end table
  16302. @item filter, f
  16303. @table @samp
  16304. @item lowpass
  16305. No filtering, this is default.
  16306. @item flat
  16307. Luma and chroma combined together.
  16308. @item aflat
  16309. Similar as above, but shows difference between blue and red chroma.
  16310. @item xflat
  16311. Similar as above, but use different colors.
  16312. @item yflat
  16313. Similar as above, but again with different colors.
  16314. @item chroma
  16315. Displays only chroma.
  16316. @item color
  16317. Displays actual color value on waveform.
  16318. @item acolor
  16319. Similar as above, but with luma showing frequency of chroma values.
  16320. @end table
  16321. @item graticule, g
  16322. Set which graticule to display.
  16323. @table @samp
  16324. @item none
  16325. Do not display graticule.
  16326. @item green
  16327. Display green graticule showing legal broadcast ranges.
  16328. @item orange
  16329. Display orange graticule showing legal broadcast ranges.
  16330. @item invert
  16331. Display invert graticule showing legal broadcast ranges.
  16332. @end table
  16333. @item opacity, o
  16334. Set graticule opacity.
  16335. @item flags, fl
  16336. Set graticule flags.
  16337. @table @samp
  16338. @item numbers
  16339. Draw numbers above lines. By default enabled.
  16340. @item dots
  16341. Draw dots instead of lines.
  16342. @end table
  16343. @item scale, s
  16344. Set scale used for displaying graticule.
  16345. @table @samp
  16346. @item digital
  16347. @item millivolts
  16348. @item ire
  16349. @end table
  16350. Default is digital.
  16351. @item bgopacity, b
  16352. Set background opacity.
  16353. @item tint0, t0
  16354. @item tint1, t1
  16355. Set tint for output.
  16356. Only used with lowpass filter and when display is not overlay and input
  16357. pixel formats are not RGB.
  16358. @end table
  16359. @section weave, doubleweave
  16360. The @code{weave} takes a field-based video input and join
  16361. each two sequential fields into single frame, producing a new double
  16362. height clip with half the frame rate and half the frame count.
  16363. The @code{doubleweave} works same as @code{weave} but without
  16364. halving frame rate and frame count.
  16365. It accepts the following option:
  16366. @table @option
  16367. @item first_field
  16368. Set first field. Available values are:
  16369. @table @samp
  16370. @item top, t
  16371. Set the frame as top-field-first.
  16372. @item bottom, b
  16373. Set the frame as bottom-field-first.
  16374. @end table
  16375. @end table
  16376. @subsection Examples
  16377. @itemize
  16378. @item
  16379. Interlace video using @ref{select} and @ref{separatefields} filter:
  16380. @example
  16381. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  16382. @end example
  16383. @end itemize
  16384. @section xbr
  16385. Apply the xBR high-quality magnification filter which is designed for pixel
  16386. art. It follows a set of edge-detection rules, see
  16387. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  16388. It accepts the following option:
  16389. @table @option
  16390. @item n
  16391. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  16392. @code{3xBR} and @code{4} for @code{4xBR}.
  16393. Default is @code{3}.
  16394. @end table
  16395. @section xfade
  16396. Apply cross fade from one input video stream to another input video stream.
  16397. The cross fade is applied for specified duration.
  16398. The filter accepts the following options:
  16399. @table @option
  16400. @item transition
  16401. Set one of available transition effects:
  16402. @table @samp
  16403. @item custom
  16404. @item fade
  16405. @item wipeleft
  16406. @item wiperight
  16407. @item wipeup
  16408. @item wipedown
  16409. @item slideleft
  16410. @item slideright
  16411. @item slideup
  16412. @item slidedown
  16413. @item circlecrop
  16414. @item rectcrop
  16415. @item distance
  16416. @item fadeblack
  16417. @item fadewhite
  16418. @item radial
  16419. @item smoothleft
  16420. @item smoothright
  16421. @item smoothup
  16422. @item smoothdown
  16423. @item circleopen
  16424. @item circleclose
  16425. @item vertopen
  16426. @item vertclose
  16427. @item horzopen
  16428. @item horzclose
  16429. @item dissolve
  16430. @item pixelize
  16431. @item diagtl
  16432. @item diagtr
  16433. @item diagbl
  16434. @item diagbr
  16435. @item hlslice
  16436. @item hrslice
  16437. @item vuslice
  16438. @item vdslice
  16439. @item hblur
  16440. @item fadegrays
  16441. @item wipetl
  16442. @item wipetr
  16443. @item wipebl
  16444. @item wipebr
  16445. @item squeezeh
  16446. @item squeezev
  16447. @end table
  16448. Default transition effect is fade.
  16449. @item duration
  16450. Set cross fade duration in seconds.
  16451. Default duration is 1 second.
  16452. @item offset
  16453. Set cross fade start relative to first input stream in seconds.
  16454. Default offset is 0.
  16455. @item expr
  16456. Set expression for custom transition effect.
  16457. The expressions can use the following variables and functions:
  16458. @table @option
  16459. @item X
  16460. @item Y
  16461. The coordinates of the current sample.
  16462. @item W
  16463. @item H
  16464. The width and height of the image.
  16465. @item P
  16466. Progress of transition effect.
  16467. @item PLANE
  16468. Currently processed plane.
  16469. @item A
  16470. Return value of first input at current location and plane.
  16471. @item B
  16472. Return value of second input at current location and plane.
  16473. @item a0(x, y)
  16474. @item a1(x, y)
  16475. @item a2(x, y)
  16476. @item a3(x, y)
  16477. Return the value of the pixel at location (@var{x},@var{y}) of the
  16478. first/second/third/fourth component of first input.
  16479. @item b0(x, y)
  16480. @item b1(x, y)
  16481. @item b2(x, y)
  16482. @item b3(x, y)
  16483. Return the value of the pixel at location (@var{x},@var{y}) of the
  16484. first/second/third/fourth component of second input.
  16485. @end table
  16486. @end table
  16487. @subsection Examples
  16488. @itemize
  16489. @item
  16490. Cross fade from one input video to another input video, with fade transition and duration of transition
  16491. of 2 seconds starting at offset of 5 seconds:
  16492. @example
  16493. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16494. @end example
  16495. @end itemize
  16496. @section xmedian
  16497. Pick median pixels from several input videos.
  16498. The filter accepts the following options:
  16499. @table @option
  16500. @item inputs
  16501. Set number of inputs.
  16502. Default is 3. Allowed range is from 3 to 255.
  16503. If number of inputs is even number, than result will be mean value between two median values.
  16504. @item planes
  16505. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16506. @item percentile
  16507. Set median percentile. Default value is @code{0.5}.
  16508. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16509. minimum values, and @code{1} maximum values.
  16510. @end table
  16511. @subsection Commands
  16512. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  16513. @section xstack
  16514. Stack video inputs into custom layout.
  16515. All streams must be of same pixel format.
  16516. The filter accepts the following options:
  16517. @table @option
  16518. @item inputs
  16519. Set number of input streams. Default is 2.
  16520. @item layout
  16521. Specify layout of inputs.
  16522. This option requires the desired layout configuration to be explicitly set by the user.
  16523. This sets position of each video input in output. Each input
  16524. is separated by '|'.
  16525. The first number represents the column, and the second number represents the row.
  16526. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16527. where X is video input from which to take width or height.
  16528. Multiple values can be used when separated by '+'. In such
  16529. case values are summed together.
  16530. Note that if inputs are of different sizes gaps may appear, as not all of
  16531. the output video frame will be filled. Similarly, videos can overlap each
  16532. other if their position doesn't leave enough space for the full frame of
  16533. adjoining videos.
  16534. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16535. a layout must be set by the user.
  16536. @item shortest
  16537. If set to 1, force the output to terminate when the shortest input
  16538. terminates. Default value is 0.
  16539. @item fill
  16540. If set to valid color, all unused pixels will be filled with that color.
  16541. By default fill is set to none, so it is disabled.
  16542. @end table
  16543. @subsection Examples
  16544. @itemize
  16545. @item
  16546. Display 4 inputs into 2x2 grid.
  16547. Layout:
  16548. @example
  16549. input1(0, 0) | input3(w0, 0)
  16550. input2(0, h0) | input4(w0, h0)
  16551. @end example
  16552. @example
  16553. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16554. @end example
  16555. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16556. @item
  16557. Display 4 inputs into 1x4 grid.
  16558. Layout:
  16559. @example
  16560. input1(0, 0)
  16561. input2(0, h0)
  16562. input3(0, h0+h1)
  16563. input4(0, h0+h1+h2)
  16564. @end example
  16565. @example
  16566. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16567. @end example
  16568. Note that if inputs are of different widths, unused space will appear.
  16569. @item
  16570. Display 9 inputs into 3x3 grid.
  16571. Layout:
  16572. @example
  16573. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16574. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16575. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16576. @end example
  16577. @example
  16578. 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
  16579. @end example
  16580. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16581. @item
  16582. Display 16 inputs into 4x4 grid.
  16583. Layout:
  16584. @example
  16585. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16586. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16587. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16588. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16589. @end example
  16590. @example
  16591. 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|
  16592. 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
  16593. @end example
  16594. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16595. @end itemize
  16596. @anchor{yadif}
  16597. @section yadif
  16598. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16599. filter").
  16600. It accepts the following parameters:
  16601. @table @option
  16602. @item mode
  16603. The interlacing mode to adopt. It accepts one of the following values:
  16604. @table @option
  16605. @item 0, send_frame
  16606. Output one frame for each frame.
  16607. @item 1, send_field
  16608. Output one frame for each field.
  16609. @item 2, send_frame_nospatial
  16610. Like @code{send_frame}, but it skips the spatial interlacing check.
  16611. @item 3, send_field_nospatial
  16612. Like @code{send_field}, but it skips the spatial interlacing check.
  16613. @end table
  16614. The default value is @code{send_frame}.
  16615. @item parity
  16616. The picture field parity assumed for the input interlaced video. It accepts one
  16617. of the following values:
  16618. @table @option
  16619. @item 0, tff
  16620. Assume the top field is first.
  16621. @item 1, bff
  16622. Assume the bottom field is first.
  16623. @item -1, auto
  16624. Enable automatic detection of field parity.
  16625. @end table
  16626. The default value is @code{auto}.
  16627. If the interlacing is unknown or the decoder does not export this information,
  16628. top field first will be assumed.
  16629. @item deint
  16630. Specify which frames to deinterlace. Accepts one of the following
  16631. values:
  16632. @table @option
  16633. @item 0, all
  16634. Deinterlace all frames.
  16635. @item 1, interlaced
  16636. Only deinterlace frames marked as interlaced.
  16637. @end table
  16638. The default value is @code{all}.
  16639. @end table
  16640. @section yadif_cuda
  16641. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16642. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16643. and/or nvenc.
  16644. It accepts the following parameters:
  16645. @table @option
  16646. @item mode
  16647. The interlacing mode to adopt. It accepts one of the following values:
  16648. @table @option
  16649. @item 0, send_frame
  16650. Output one frame for each frame.
  16651. @item 1, send_field
  16652. Output one frame for each field.
  16653. @item 2, send_frame_nospatial
  16654. Like @code{send_frame}, but it skips the spatial interlacing check.
  16655. @item 3, send_field_nospatial
  16656. Like @code{send_field}, but it skips the spatial interlacing check.
  16657. @end table
  16658. The default value is @code{send_frame}.
  16659. @item parity
  16660. The picture field parity assumed for the input interlaced video. It accepts one
  16661. of the following values:
  16662. @table @option
  16663. @item 0, tff
  16664. Assume the top field is first.
  16665. @item 1, bff
  16666. Assume the bottom field is first.
  16667. @item -1, auto
  16668. Enable automatic detection of field parity.
  16669. @end table
  16670. The default value is @code{auto}.
  16671. If the interlacing is unknown or the decoder does not export this information,
  16672. top field first will be assumed.
  16673. @item deint
  16674. Specify which frames to deinterlace. Accepts one of the following
  16675. values:
  16676. @table @option
  16677. @item 0, all
  16678. Deinterlace all frames.
  16679. @item 1, interlaced
  16680. Only deinterlace frames marked as interlaced.
  16681. @end table
  16682. The default value is @code{all}.
  16683. @end table
  16684. @section yaepblur
  16685. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16686. The algorithm is described in
  16687. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16688. It accepts the following parameters:
  16689. @table @option
  16690. @item radius, r
  16691. Set the window radius. Default value is 3.
  16692. @item planes, p
  16693. Set which planes to filter. Default is only the first plane.
  16694. @item sigma, s
  16695. Set blur strength. Default value is 128.
  16696. @end table
  16697. @subsection Commands
  16698. This filter supports same @ref{commands} as options.
  16699. @section zoompan
  16700. Apply Zoom & Pan effect.
  16701. This filter accepts the following options:
  16702. @table @option
  16703. @item zoom, z
  16704. Set the zoom expression. Range is 1-10. Default is 1.
  16705. @item x
  16706. @item y
  16707. Set the x and y expression. Default is 0.
  16708. @item d
  16709. Set the duration expression in number of frames.
  16710. This sets for how many number of frames effect will last for
  16711. single input image.
  16712. @item s
  16713. Set the output image size, default is 'hd720'.
  16714. @item fps
  16715. Set the output frame rate, default is '25'.
  16716. @end table
  16717. Each expression can contain the following constants:
  16718. @table @option
  16719. @item in_w, iw
  16720. Input width.
  16721. @item in_h, ih
  16722. Input height.
  16723. @item out_w, ow
  16724. Output width.
  16725. @item out_h, oh
  16726. Output height.
  16727. @item in
  16728. Input frame count.
  16729. @item on
  16730. Output frame count.
  16731. @item in_time, it
  16732. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16733. @item out_time, time, ot
  16734. The output timestamp expressed in seconds.
  16735. @item x
  16736. @item y
  16737. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16738. for current input frame.
  16739. @item px
  16740. @item py
  16741. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16742. not yet such frame (first input frame).
  16743. @item zoom
  16744. Last calculated zoom from 'z' expression for current input frame.
  16745. @item pzoom
  16746. Last calculated zoom of last output frame of previous input frame.
  16747. @item duration
  16748. Number of output frames for current input frame. Calculated from 'd' expression
  16749. for each input frame.
  16750. @item pduration
  16751. number of output frames created for previous input frame
  16752. @item a
  16753. Rational number: input width / input height
  16754. @item sar
  16755. sample aspect ratio
  16756. @item dar
  16757. display aspect ratio
  16758. @end table
  16759. @subsection Examples
  16760. @itemize
  16761. @item
  16762. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16763. @example
  16764. 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
  16765. @end example
  16766. @item
  16767. Zoom in up to 1.5x and pan always at center of picture:
  16768. @example
  16769. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16770. @end example
  16771. @item
  16772. Same as above but without pausing:
  16773. @example
  16774. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16775. @end example
  16776. @item
  16777. Zoom in 2x into center of picture only for the first second of the input video:
  16778. @example
  16779. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16780. @end example
  16781. @end itemize
  16782. @anchor{zscale}
  16783. @section zscale
  16784. Scale (resize) the input video, using the z.lib library:
  16785. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16786. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16787. The zscale filter forces the output display aspect ratio to be the same
  16788. as the input, by changing the output sample aspect ratio.
  16789. If the input image format is different from the format requested by
  16790. the next filter, the zscale filter will convert the input to the
  16791. requested format.
  16792. @subsection Options
  16793. The filter accepts the following options.
  16794. @table @option
  16795. @item width, w
  16796. @item height, h
  16797. Set the output video dimension expression. Default value is the input
  16798. dimension.
  16799. If the @var{width} or @var{w} value is 0, the input width is used for
  16800. the output. If the @var{height} or @var{h} value is 0, the input height
  16801. is used for the output.
  16802. If one and only one of the values is -n with n >= 1, the zscale filter
  16803. will use a value that maintains the aspect ratio of the input image,
  16804. calculated from the other specified dimension. After that it will,
  16805. however, make sure that the calculated dimension is divisible by n and
  16806. adjust the value if necessary.
  16807. If both values are -n with n >= 1, the behavior will be identical to
  16808. both values being set to 0 as previously detailed.
  16809. See below for the list of accepted constants for use in the dimension
  16810. expression.
  16811. @item size, s
  16812. Set the video size. For the syntax of this option, check the
  16813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16814. @item dither, d
  16815. Set the dither type.
  16816. Possible values are:
  16817. @table @var
  16818. @item none
  16819. @item ordered
  16820. @item random
  16821. @item error_diffusion
  16822. @end table
  16823. Default is none.
  16824. @item filter, f
  16825. Set the resize filter type.
  16826. Possible values are:
  16827. @table @var
  16828. @item point
  16829. @item bilinear
  16830. @item bicubic
  16831. @item spline16
  16832. @item spline36
  16833. @item lanczos
  16834. @end table
  16835. Default is bilinear.
  16836. @item range, r
  16837. Set the color range.
  16838. Possible values are:
  16839. @table @var
  16840. @item input
  16841. @item limited
  16842. @item full
  16843. @end table
  16844. Default is same as input.
  16845. @item primaries, p
  16846. Set the color primaries.
  16847. Possible values are:
  16848. @table @var
  16849. @item input
  16850. @item 709
  16851. @item unspecified
  16852. @item 170m
  16853. @item 240m
  16854. @item 2020
  16855. @end table
  16856. Default is same as input.
  16857. @item transfer, t
  16858. Set the transfer characteristics.
  16859. Possible values are:
  16860. @table @var
  16861. @item input
  16862. @item 709
  16863. @item unspecified
  16864. @item 601
  16865. @item linear
  16866. @item 2020_10
  16867. @item 2020_12
  16868. @item smpte2084
  16869. @item iec61966-2-1
  16870. @item arib-std-b67
  16871. @end table
  16872. Default is same as input.
  16873. @item matrix, m
  16874. Set the colorspace matrix.
  16875. Possible value are:
  16876. @table @var
  16877. @item input
  16878. @item 709
  16879. @item unspecified
  16880. @item 470bg
  16881. @item 170m
  16882. @item 2020_ncl
  16883. @item 2020_cl
  16884. @end table
  16885. Default is same as input.
  16886. @item rangein, rin
  16887. Set the input color range.
  16888. Possible values are:
  16889. @table @var
  16890. @item input
  16891. @item limited
  16892. @item full
  16893. @end table
  16894. Default is same as input.
  16895. @item primariesin, pin
  16896. Set the input color primaries.
  16897. Possible values are:
  16898. @table @var
  16899. @item input
  16900. @item 709
  16901. @item unspecified
  16902. @item 170m
  16903. @item 240m
  16904. @item 2020
  16905. @end table
  16906. Default is same as input.
  16907. @item transferin, tin
  16908. Set the input transfer characteristics.
  16909. Possible values are:
  16910. @table @var
  16911. @item input
  16912. @item 709
  16913. @item unspecified
  16914. @item 601
  16915. @item linear
  16916. @item 2020_10
  16917. @item 2020_12
  16918. @end table
  16919. Default is same as input.
  16920. @item matrixin, min
  16921. Set the input colorspace matrix.
  16922. Possible value are:
  16923. @table @var
  16924. @item input
  16925. @item 709
  16926. @item unspecified
  16927. @item 470bg
  16928. @item 170m
  16929. @item 2020_ncl
  16930. @item 2020_cl
  16931. @end table
  16932. @item chromal, c
  16933. Set the output chroma location.
  16934. Possible values are:
  16935. @table @var
  16936. @item input
  16937. @item left
  16938. @item center
  16939. @item topleft
  16940. @item top
  16941. @item bottomleft
  16942. @item bottom
  16943. @end table
  16944. @item chromalin, cin
  16945. Set the input chroma location.
  16946. Possible values are:
  16947. @table @var
  16948. @item input
  16949. @item left
  16950. @item center
  16951. @item topleft
  16952. @item top
  16953. @item bottomleft
  16954. @item bottom
  16955. @end table
  16956. @item npl
  16957. Set the nominal peak luminance.
  16958. @end table
  16959. The values of the @option{w} and @option{h} options are expressions
  16960. containing the following constants:
  16961. @table @var
  16962. @item in_w
  16963. @item in_h
  16964. The input width and height
  16965. @item iw
  16966. @item ih
  16967. These are the same as @var{in_w} and @var{in_h}.
  16968. @item out_w
  16969. @item out_h
  16970. The output (scaled) width and height
  16971. @item ow
  16972. @item oh
  16973. These are the same as @var{out_w} and @var{out_h}
  16974. @item a
  16975. The same as @var{iw} / @var{ih}
  16976. @item sar
  16977. input sample aspect ratio
  16978. @item dar
  16979. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16980. @item hsub
  16981. @item vsub
  16982. horizontal and vertical input chroma subsample values. For example for the
  16983. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16984. @item ohsub
  16985. @item ovsub
  16986. horizontal and vertical output chroma subsample values. For example for the
  16987. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16988. @end table
  16989. @subsection Commands
  16990. This filter supports the following commands:
  16991. @table @option
  16992. @item width, w
  16993. @item height, h
  16994. Set the output video dimension expression.
  16995. The command accepts the same syntax of the corresponding option.
  16996. If the specified expression is not valid, it is kept at its current
  16997. value.
  16998. @end table
  16999. @c man end VIDEO FILTERS
  17000. @chapter OpenCL Video Filters
  17001. @c man begin OPENCL VIDEO FILTERS
  17002. Below is a description of the currently available OpenCL video filters.
  17003. To enable compilation of these filters you need to configure FFmpeg with
  17004. @code{--enable-opencl}.
  17005. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  17006. @table @option
  17007. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  17008. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  17009. given device parameters.
  17010. @item -filter_hw_device @var{name}
  17011. Pass the hardware device called @var{name} to all filters in any filter graph.
  17012. @end table
  17013. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  17014. @itemize
  17015. @item
  17016. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  17017. @example
  17018. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  17019. @end example
  17020. @end itemize
  17021. 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.
  17022. @section avgblur_opencl
  17023. Apply average blur filter.
  17024. The filter accepts the following options:
  17025. @table @option
  17026. @item sizeX
  17027. Set horizontal radius size.
  17028. Range is @code{[1, 1024]} and default value is @code{1}.
  17029. @item planes
  17030. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17031. @item sizeY
  17032. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  17033. @end table
  17034. @subsection Example
  17035. @itemize
  17036. @item
  17037. 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.
  17038. @example
  17039. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  17040. @end example
  17041. @end itemize
  17042. @section boxblur_opencl
  17043. Apply a boxblur algorithm to the input video.
  17044. It accepts the following parameters:
  17045. @table @option
  17046. @item luma_radius, lr
  17047. @item luma_power, lp
  17048. @item chroma_radius, cr
  17049. @item chroma_power, cp
  17050. @item alpha_radius, ar
  17051. @item alpha_power, ap
  17052. @end table
  17053. A description of the accepted options follows.
  17054. @table @option
  17055. @item luma_radius, lr
  17056. @item chroma_radius, cr
  17057. @item alpha_radius, ar
  17058. Set an expression for the box radius in pixels used for blurring the
  17059. corresponding input plane.
  17060. The radius value must be a non-negative number, and must not be
  17061. greater than the value of the expression @code{min(w,h)/2} for the
  17062. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  17063. planes.
  17064. Default value for @option{luma_radius} is "2". If not specified,
  17065. @option{chroma_radius} and @option{alpha_radius} default to the
  17066. corresponding value set for @option{luma_radius}.
  17067. The expressions can contain the following constants:
  17068. @table @option
  17069. @item w
  17070. @item h
  17071. The input width and height in pixels.
  17072. @item cw
  17073. @item ch
  17074. The input chroma image width and height in pixels.
  17075. @item hsub
  17076. @item vsub
  17077. The horizontal and vertical chroma subsample values. For example, for the
  17078. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  17079. @end table
  17080. @item luma_power, lp
  17081. @item chroma_power, cp
  17082. @item alpha_power, ap
  17083. Specify how many times the boxblur filter is applied to the
  17084. corresponding plane.
  17085. Default value for @option{luma_power} is 2. If not specified,
  17086. @option{chroma_power} and @option{alpha_power} default to the
  17087. corresponding value set for @option{luma_power}.
  17088. A value of 0 will disable the effect.
  17089. @end table
  17090. @subsection Examples
  17091. 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.
  17092. @itemize
  17093. @item
  17094. Apply a boxblur filter with the luma, chroma, and alpha radius
  17095. 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.
  17096. @example
  17097. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  17098. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  17099. @end example
  17100. @item
  17101. 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.
  17102. For the luma plane, a 2x2 box radius will be run once.
  17103. For the chroma plane, a 4x4 box radius will be run 5 times.
  17104. For the alpha plane, a 3x3 box radius will be run 7 times.
  17105. @example
  17106. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  17107. @end example
  17108. @end itemize
  17109. @section colorkey_opencl
  17110. RGB colorspace color keying.
  17111. The filter accepts the following options:
  17112. @table @option
  17113. @item color
  17114. The color which will be replaced with transparency.
  17115. @item similarity
  17116. Similarity percentage with the key color.
  17117. 0.01 matches only the exact key color, while 1.0 matches everything.
  17118. @item blend
  17119. Blend percentage.
  17120. 0.0 makes pixels either fully transparent, or not transparent at all.
  17121. Higher values result in semi-transparent pixels, with a higher transparency
  17122. the more similar the pixels color is to the key color.
  17123. @end table
  17124. @subsection Examples
  17125. @itemize
  17126. @item
  17127. Make every semi-green pixel in the input transparent with some slight blending:
  17128. @example
  17129. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  17130. @end example
  17131. @end itemize
  17132. @section convolution_opencl
  17133. Apply convolution of 3x3, 5x5, 7x7 matrix.
  17134. The filter accepts the following options:
  17135. @table @option
  17136. @item 0m
  17137. @item 1m
  17138. @item 2m
  17139. @item 3m
  17140. Set matrix for each plane.
  17141. Matrix is sequence of 9, 25 or 49 signed numbers.
  17142. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  17143. @item 0rdiv
  17144. @item 1rdiv
  17145. @item 2rdiv
  17146. @item 3rdiv
  17147. Set multiplier for calculated value for each plane.
  17148. If unset or 0, it will be sum of all matrix elements.
  17149. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  17150. @item 0bias
  17151. @item 1bias
  17152. @item 2bias
  17153. @item 3bias
  17154. Set bias for each plane. This value is added to the result of the multiplication.
  17155. Useful for making the overall image brighter or darker.
  17156. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  17157. @end table
  17158. @subsection Examples
  17159. @itemize
  17160. @item
  17161. Apply sharpen:
  17162. @example
  17163. -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
  17164. @end example
  17165. @item
  17166. Apply blur:
  17167. @example
  17168. -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
  17169. @end example
  17170. @item
  17171. Apply edge enhance:
  17172. @example
  17173. -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
  17174. @end example
  17175. @item
  17176. Apply edge detect:
  17177. @example
  17178. -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
  17179. @end example
  17180. @item
  17181. Apply laplacian edge detector which includes diagonals:
  17182. @example
  17183. -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
  17184. @end example
  17185. @item
  17186. Apply emboss:
  17187. @example
  17188. -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
  17189. @end example
  17190. @end itemize
  17191. @section erosion_opencl
  17192. Apply erosion effect to the video.
  17193. This filter replaces the pixel by the local(3x3) minimum.
  17194. It accepts the following options:
  17195. @table @option
  17196. @item threshold0
  17197. @item threshold1
  17198. @item threshold2
  17199. @item threshold3
  17200. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17201. If @code{0}, plane will remain unchanged.
  17202. @item coordinates
  17203. Flag which specifies the pixel to refer to.
  17204. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17205. Flags to local 3x3 coordinates region centered on @code{x}:
  17206. 1 2 3
  17207. 4 x 5
  17208. 6 7 8
  17209. @end table
  17210. @subsection Example
  17211. @itemize
  17212. @item
  17213. 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.
  17214. @example
  17215. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17216. @end example
  17217. @end itemize
  17218. @section deshake_opencl
  17219. Feature-point based video stabilization filter.
  17220. The filter accepts the following options:
  17221. @table @option
  17222. @item tripod
  17223. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  17224. @item debug
  17225. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  17226. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  17227. Viewing point matches in the output video is only supported for RGB input.
  17228. Defaults to @code{0}.
  17229. @item adaptive_crop
  17230. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  17231. Defaults to @code{1}.
  17232. @item refine_features
  17233. Whether or not feature points should be refined at a sub-pixel level.
  17234. This can be turned off for a slight performance gain at the cost of precision.
  17235. Defaults to @code{1}.
  17236. @item smooth_strength
  17237. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  17238. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  17239. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  17240. Defaults to @code{0.0}.
  17241. @item smooth_window_multiplier
  17242. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  17243. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  17244. Acceptable values range from @code{0.1} to @code{10.0}.
  17245. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  17246. potentially improving smoothness, but also increase latency and memory usage.
  17247. Defaults to @code{2.0}.
  17248. @end table
  17249. @subsection Examples
  17250. @itemize
  17251. @item
  17252. Stabilize a video with a fixed, medium smoothing strength:
  17253. @example
  17254. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  17255. @end example
  17256. @item
  17257. Stabilize a video with debugging (both in console and in rendered video):
  17258. @example
  17259. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  17260. @end example
  17261. @end itemize
  17262. @section dilation_opencl
  17263. Apply dilation effect to the video.
  17264. This filter replaces the pixel by the local(3x3) maximum.
  17265. It accepts the following options:
  17266. @table @option
  17267. @item threshold0
  17268. @item threshold1
  17269. @item threshold2
  17270. @item threshold3
  17271. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17272. If @code{0}, plane will remain unchanged.
  17273. @item coordinates
  17274. Flag which specifies the pixel to refer to.
  17275. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17276. Flags to local 3x3 coordinates region centered on @code{x}:
  17277. 1 2 3
  17278. 4 x 5
  17279. 6 7 8
  17280. @end table
  17281. @subsection Example
  17282. @itemize
  17283. @item
  17284. 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.
  17285. @example
  17286. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17287. @end example
  17288. @end itemize
  17289. @section nlmeans_opencl
  17290. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  17291. @section overlay_opencl
  17292. Overlay one video on top of another.
  17293. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  17294. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  17295. The filter accepts the following options:
  17296. @table @option
  17297. @item x
  17298. Set the x coordinate of the overlaid video on the main video.
  17299. Default value is @code{0}.
  17300. @item y
  17301. Set the y coordinate of the overlaid video on the main video.
  17302. Default value is @code{0}.
  17303. @end table
  17304. @subsection Examples
  17305. @itemize
  17306. @item
  17307. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  17308. @example
  17309. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17310. @end example
  17311. @item
  17312. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  17313. @example
  17314. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17315. @end example
  17316. @end itemize
  17317. @section pad_opencl
  17318. Add paddings to the input image, and place the original input at the
  17319. provided @var{x}, @var{y} coordinates.
  17320. It accepts the following options:
  17321. @table @option
  17322. @item width, w
  17323. @item height, h
  17324. Specify an expression for the size of the output image with the
  17325. paddings added. If the value for @var{width} or @var{height} is 0, the
  17326. corresponding input size is used for the output.
  17327. The @var{width} expression can reference the value set by the
  17328. @var{height} expression, and vice versa.
  17329. The default value of @var{width} and @var{height} is 0.
  17330. @item x
  17331. @item y
  17332. Specify the offsets to place the input image at within the padded area,
  17333. with respect to the top/left border of the output image.
  17334. The @var{x} expression can reference the value set by the @var{y}
  17335. expression, and vice versa.
  17336. The default value of @var{x} and @var{y} is 0.
  17337. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  17338. so the input image is centered on the padded area.
  17339. @item color
  17340. Specify the color of the padded area. For the syntax of this option,
  17341. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17342. manual,ffmpeg-utils}.
  17343. @item aspect
  17344. Pad to an aspect instead to a resolution.
  17345. @end table
  17346. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  17347. options are expressions containing the following constants:
  17348. @table @option
  17349. @item in_w
  17350. @item in_h
  17351. The input video width and height.
  17352. @item iw
  17353. @item ih
  17354. These are the same as @var{in_w} and @var{in_h}.
  17355. @item out_w
  17356. @item out_h
  17357. The output width and height (the size of the padded area), as
  17358. specified by the @var{width} and @var{height} expressions.
  17359. @item ow
  17360. @item oh
  17361. These are the same as @var{out_w} and @var{out_h}.
  17362. @item x
  17363. @item y
  17364. The x and y offsets as specified by the @var{x} and @var{y}
  17365. expressions, or NAN if not yet specified.
  17366. @item a
  17367. same as @var{iw} / @var{ih}
  17368. @item sar
  17369. input sample aspect ratio
  17370. @item dar
  17371. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  17372. @end table
  17373. @section prewitt_opencl
  17374. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  17375. The filter accepts the following option:
  17376. @table @option
  17377. @item planes
  17378. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17379. @item scale
  17380. Set value which will be multiplied with filtered result.
  17381. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17382. @item delta
  17383. Set value which will be added to filtered result.
  17384. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17385. @end table
  17386. @subsection Example
  17387. @itemize
  17388. @item
  17389. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  17390. @example
  17391. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17392. @end example
  17393. @end itemize
  17394. @anchor{program_opencl}
  17395. @section program_opencl
  17396. Filter video using an OpenCL program.
  17397. @table @option
  17398. @item source
  17399. OpenCL program source file.
  17400. @item kernel
  17401. Kernel name in program.
  17402. @item inputs
  17403. Number of inputs to the filter. Defaults to 1.
  17404. @item size, s
  17405. Size of output frames. Defaults to the same as the first input.
  17406. @end table
  17407. The @code{program_opencl} filter also supports the @ref{framesync} options.
  17408. The program source file must contain a kernel function with the given name,
  17409. which will be run once for each plane of the output. Each run on a plane
  17410. gets enqueued as a separate 2D global NDRange with one work-item for each
  17411. pixel to be generated. The global ID offset for each work-item is therefore
  17412. the coordinates of a pixel in the destination image.
  17413. The kernel function needs to take the following arguments:
  17414. @itemize
  17415. @item
  17416. Destination image, @var{__write_only image2d_t}.
  17417. This image will become the output; the kernel should write all of it.
  17418. @item
  17419. Frame index, @var{unsigned int}.
  17420. This is a counter starting from zero and increasing by one for each frame.
  17421. @item
  17422. Source images, @var{__read_only image2d_t}.
  17423. These are the most recent images on each input. The kernel may read from
  17424. them to generate the output, but they can't be written to.
  17425. @end itemize
  17426. Example programs:
  17427. @itemize
  17428. @item
  17429. Copy the input to the output (output must be the same size as the input).
  17430. @verbatim
  17431. __kernel void copy(__write_only image2d_t destination,
  17432. unsigned int index,
  17433. __read_only image2d_t source)
  17434. {
  17435. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17436. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17437. float4 value = read_imagef(source, sampler, location);
  17438. write_imagef(destination, location, value);
  17439. }
  17440. @end verbatim
  17441. @item
  17442. Apply a simple transformation, rotating the input by an amount increasing
  17443. with the index counter. Pixel values are linearly interpolated by the
  17444. sampler, and the output need not have the same dimensions as the input.
  17445. @verbatim
  17446. __kernel void rotate_image(__write_only image2d_t dst,
  17447. unsigned int index,
  17448. __read_only image2d_t src)
  17449. {
  17450. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17451. CLK_FILTER_LINEAR);
  17452. float angle = (float)index / 100.0f;
  17453. float2 dst_dim = convert_float2(get_image_dim(dst));
  17454. float2 src_dim = convert_float2(get_image_dim(src));
  17455. float2 dst_cen = dst_dim / 2.0f;
  17456. float2 src_cen = src_dim / 2.0f;
  17457. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17458. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17459. float2 src_pos = {
  17460. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17461. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17462. };
  17463. src_pos = src_pos * src_dim / dst_dim;
  17464. float2 src_loc = src_pos + src_cen;
  17465. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17466. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17467. write_imagef(dst, dst_loc, 0.5f);
  17468. else
  17469. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17470. }
  17471. @end verbatim
  17472. @item
  17473. Blend two inputs together, with the amount of each input used varying
  17474. with the index counter.
  17475. @verbatim
  17476. __kernel void blend_images(__write_only image2d_t dst,
  17477. unsigned int index,
  17478. __read_only image2d_t src1,
  17479. __read_only image2d_t src2)
  17480. {
  17481. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17482. CLK_FILTER_LINEAR);
  17483. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17484. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17485. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17486. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17487. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17488. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17489. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17490. }
  17491. @end verbatim
  17492. @end itemize
  17493. @section roberts_opencl
  17494. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17495. The filter accepts the following option:
  17496. @table @option
  17497. @item planes
  17498. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17499. @item scale
  17500. Set value which will be multiplied with filtered result.
  17501. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17502. @item delta
  17503. Set value which will be added to filtered result.
  17504. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17505. @end table
  17506. @subsection Example
  17507. @itemize
  17508. @item
  17509. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17510. @example
  17511. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17512. @end example
  17513. @end itemize
  17514. @section sobel_opencl
  17515. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17516. The filter accepts the following option:
  17517. @table @option
  17518. @item planes
  17519. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17520. @item scale
  17521. Set value which will be multiplied with filtered result.
  17522. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17523. @item delta
  17524. Set value which will be added to filtered result.
  17525. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17526. @end table
  17527. @subsection Example
  17528. @itemize
  17529. @item
  17530. Apply sobel operator with scale set to 2 and delta set to 10
  17531. @example
  17532. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17533. @end example
  17534. @end itemize
  17535. @section tonemap_opencl
  17536. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17537. It accepts the following parameters:
  17538. @table @option
  17539. @item tonemap
  17540. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17541. @item param
  17542. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17543. @item desat
  17544. Apply desaturation for highlights that exceed this level of brightness. The
  17545. higher the parameter, the more color information will be preserved. This
  17546. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17547. (smoothly) turning into white instead. This makes images feel more natural,
  17548. at the cost of reducing information about out-of-range colors.
  17549. The default value is 0.5, and the algorithm here is a little different from
  17550. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17551. @item threshold
  17552. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17553. is used to detect whether the scene has changed or not. If the distance between
  17554. the current frame average brightness and the current running average exceeds
  17555. a threshold value, we would re-calculate scene average and peak brightness.
  17556. The default value is 0.2.
  17557. @item format
  17558. Specify the output pixel format.
  17559. Currently supported formats are:
  17560. @table @var
  17561. @item p010
  17562. @item nv12
  17563. @end table
  17564. @item range, r
  17565. Set the output color range.
  17566. Possible values are:
  17567. @table @var
  17568. @item tv/mpeg
  17569. @item pc/jpeg
  17570. @end table
  17571. Default is same as input.
  17572. @item primaries, p
  17573. Set the output color primaries.
  17574. Possible values are:
  17575. @table @var
  17576. @item bt709
  17577. @item bt2020
  17578. @end table
  17579. Default is same as input.
  17580. @item transfer, t
  17581. Set the output transfer characteristics.
  17582. Possible values are:
  17583. @table @var
  17584. @item bt709
  17585. @item bt2020
  17586. @end table
  17587. Default is bt709.
  17588. @item matrix, m
  17589. Set the output colorspace matrix.
  17590. Possible value are:
  17591. @table @var
  17592. @item bt709
  17593. @item bt2020
  17594. @end table
  17595. Default is same as input.
  17596. @end table
  17597. @subsection Example
  17598. @itemize
  17599. @item
  17600. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17601. @example
  17602. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17603. @end example
  17604. @end itemize
  17605. @section unsharp_opencl
  17606. Sharpen or blur the input video.
  17607. It accepts the following parameters:
  17608. @table @option
  17609. @item luma_msize_x, lx
  17610. Set the luma matrix horizontal size.
  17611. Range is @code{[1, 23]} and default value is @code{5}.
  17612. @item luma_msize_y, ly
  17613. Set the luma matrix vertical size.
  17614. Range is @code{[1, 23]} and default value is @code{5}.
  17615. @item luma_amount, la
  17616. Set the luma effect strength.
  17617. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17618. Negative values will blur the input video, while positive values will
  17619. sharpen it, a value of zero will disable the effect.
  17620. @item chroma_msize_x, cx
  17621. Set the chroma matrix horizontal size.
  17622. Range is @code{[1, 23]} and default value is @code{5}.
  17623. @item chroma_msize_y, cy
  17624. Set the chroma matrix vertical size.
  17625. Range is @code{[1, 23]} and default value is @code{5}.
  17626. @item chroma_amount, ca
  17627. Set the chroma effect strength.
  17628. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17629. Negative values will blur the input video, while positive values will
  17630. sharpen it, a value of zero will disable the effect.
  17631. @end table
  17632. All parameters are optional and default to the equivalent of the
  17633. string '5:5:1.0:5:5:0.0'.
  17634. @subsection Examples
  17635. @itemize
  17636. @item
  17637. Apply strong luma sharpen effect:
  17638. @example
  17639. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17640. @end example
  17641. @item
  17642. Apply a strong blur of both luma and chroma parameters:
  17643. @example
  17644. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17645. @end example
  17646. @end itemize
  17647. @section xfade_opencl
  17648. Cross fade two videos with custom transition effect by using OpenCL.
  17649. It accepts the following options:
  17650. @table @option
  17651. @item transition
  17652. Set one of possible transition effects.
  17653. @table @option
  17654. @item custom
  17655. Select custom transition effect, the actual transition description
  17656. will be picked from source and kernel options.
  17657. @item fade
  17658. @item wipeleft
  17659. @item wiperight
  17660. @item wipeup
  17661. @item wipedown
  17662. @item slideleft
  17663. @item slideright
  17664. @item slideup
  17665. @item slidedown
  17666. Default transition is fade.
  17667. @end table
  17668. @item source
  17669. OpenCL program source file for custom transition.
  17670. @item kernel
  17671. Set name of kernel to use for custom transition from program source file.
  17672. @item duration
  17673. Set duration of video transition.
  17674. @item offset
  17675. Set time of start of transition relative to first video.
  17676. @end table
  17677. The program source file must contain a kernel function with the given name,
  17678. which will be run once for each plane of the output. Each run on a plane
  17679. gets enqueued as a separate 2D global NDRange with one work-item for each
  17680. pixel to be generated. The global ID offset for each work-item is therefore
  17681. the coordinates of a pixel in the destination image.
  17682. The kernel function needs to take the following arguments:
  17683. @itemize
  17684. @item
  17685. Destination image, @var{__write_only image2d_t}.
  17686. This image will become the output; the kernel should write all of it.
  17687. @item
  17688. First Source image, @var{__read_only image2d_t}.
  17689. Second Source image, @var{__read_only image2d_t}.
  17690. These are the most recent images on each input. The kernel may read from
  17691. them to generate the output, but they can't be written to.
  17692. @item
  17693. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17694. @end itemize
  17695. Example programs:
  17696. @itemize
  17697. @item
  17698. Apply dots curtain transition effect:
  17699. @verbatim
  17700. __kernel void blend_images(__write_only image2d_t dst,
  17701. __read_only image2d_t src1,
  17702. __read_only image2d_t src2,
  17703. float progress)
  17704. {
  17705. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17706. CLK_FILTER_LINEAR);
  17707. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17708. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17709. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17710. rp = rp / dim;
  17711. float2 dots = (float2)(20.0, 20.0);
  17712. float2 center = (float2)(0,0);
  17713. float2 unused;
  17714. float4 val1 = read_imagef(src1, sampler, p);
  17715. float4 val2 = read_imagef(src2, sampler, p);
  17716. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17717. write_imagef(dst, p, next ? val1 : val2);
  17718. }
  17719. @end verbatim
  17720. @end itemize
  17721. @c man end OPENCL VIDEO FILTERS
  17722. @chapter VAAPI Video Filters
  17723. @c man begin VAAPI VIDEO FILTERS
  17724. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17725. To enable compilation of these filters you need to configure FFmpeg with
  17726. @code{--enable-vaapi}.
  17727. 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}
  17728. @section tonemap_vaapi
  17729. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17730. It maps the dynamic range of HDR10 content to the SDR content.
  17731. It currently only accepts HDR10 as input.
  17732. It accepts the following parameters:
  17733. @table @option
  17734. @item format
  17735. Specify the output pixel format.
  17736. Currently supported formats are:
  17737. @table @var
  17738. @item p010
  17739. @item nv12
  17740. @end table
  17741. Default is nv12.
  17742. @item primaries, p
  17743. Set the output color primaries.
  17744. Default is same as input.
  17745. @item transfer, t
  17746. Set the output transfer characteristics.
  17747. Default is bt709.
  17748. @item matrix, m
  17749. Set the output colorspace matrix.
  17750. Default is same as input.
  17751. @end table
  17752. @subsection Example
  17753. @itemize
  17754. @item
  17755. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17756. @example
  17757. tonemap_vaapi=format=p010:t=bt2020-10
  17758. @end example
  17759. @end itemize
  17760. @c man end VAAPI VIDEO FILTERS
  17761. @chapter Video Sources
  17762. @c man begin VIDEO SOURCES
  17763. Below is a description of the currently available video sources.
  17764. @section buffer
  17765. Buffer video frames, and make them available to the filter chain.
  17766. This source is mainly intended for a programmatic use, in particular
  17767. through the interface defined in @file{libavfilter/buffersrc.h}.
  17768. It accepts the following parameters:
  17769. @table @option
  17770. @item video_size
  17771. Specify the size (width and height) of the buffered video frames. For the
  17772. syntax of this option, check the
  17773. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17774. @item width
  17775. The input video width.
  17776. @item height
  17777. The input video height.
  17778. @item pix_fmt
  17779. A string representing the pixel format of the buffered video frames.
  17780. It may be a number corresponding to a pixel format, or a pixel format
  17781. name.
  17782. @item time_base
  17783. Specify the timebase assumed by the timestamps of the buffered frames.
  17784. @item frame_rate
  17785. Specify the frame rate expected for the video stream.
  17786. @item pixel_aspect, sar
  17787. The sample (pixel) aspect ratio of the input video.
  17788. @item sws_param
  17789. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17790. to the filtergraph description to specify swscale flags for automatically
  17791. inserted scalers. See @ref{Filtergraph syntax}.
  17792. @item hw_frames_ctx
  17793. When using a hardware pixel format, this should be a reference to an
  17794. AVHWFramesContext describing input frames.
  17795. @end table
  17796. For example:
  17797. @example
  17798. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17799. @end example
  17800. will instruct the source to accept video frames with size 320x240 and
  17801. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17802. square pixels (1:1 sample aspect ratio).
  17803. Since the pixel format with name "yuv410p" corresponds to the number 6
  17804. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17805. this example corresponds to:
  17806. @example
  17807. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17808. @end example
  17809. Alternatively, the options can be specified as a flat string, but this
  17810. syntax is deprecated:
  17811. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17812. @section cellauto
  17813. Create a pattern generated by an elementary cellular automaton.
  17814. The initial state of the cellular automaton can be defined through the
  17815. @option{filename} and @option{pattern} options. If such options are
  17816. not specified an initial state is created randomly.
  17817. At each new frame a new row in the video is filled with the result of
  17818. the cellular automaton next generation. The behavior when the whole
  17819. frame is filled is defined by the @option{scroll} option.
  17820. This source accepts the following options:
  17821. @table @option
  17822. @item filename, f
  17823. Read the initial cellular automaton state, i.e. the starting row, from
  17824. the specified file.
  17825. In the file, each non-whitespace character is considered an alive
  17826. cell, a newline will terminate the row, and further characters in the
  17827. file will be ignored.
  17828. @item pattern, p
  17829. Read the initial cellular automaton state, i.e. the starting row, from
  17830. the specified string.
  17831. Each non-whitespace character in the string is considered an alive
  17832. cell, a newline will terminate the row, and further characters in the
  17833. string will be ignored.
  17834. @item rate, r
  17835. Set the video rate, that is the number of frames generated per second.
  17836. Default is 25.
  17837. @item random_fill_ratio, ratio
  17838. Set the random fill ratio for the initial cellular automaton row. It
  17839. is a floating point number value ranging from 0 to 1, defaults to
  17840. 1/PHI.
  17841. This option is ignored when a file or a pattern is specified.
  17842. @item random_seed, seed
  17843. Set the seed for filling randomly the initial row, must be an integer
  17844. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17845. set to -1, the filter will try to use a good random seed on a best
  17846. effort basis.
  17847. @item rule
  17848. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17849. Default value is 110.
  17850. @item size, s
  17851. Set the size of the output video. For the syntax of this option, check the
  17852. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17853. If @option{filename} or @option{pattern} is specified, the size is set
  17854. by default to the width of the specified initial state row, and the
  17855. height is set to @var{width} * PHI.
  17856. If @option{size} is set, it must contain the width of the specified
  17857. pattern string, and the specified pattern will be centered in the
  17858. larger row.
  17859. If a filename or a pattern string is not specified, the size value
  17860. defaults to "320x518" (used for a randomly generated initial state).
  17861. @item scroll
  17862. If set to 1, scroll the output upward when all the rows in the output
  17863. have been already filled. If set to 0, the new generated row will be
  17864. written over the top row just after the bottom row is filled.
  17865. Defaults to 1.
  17866. @item start_full, full
  17867. If set to 1, completely fill the output with generated rows before
  17868. outputting the first frame.
  17869. This is the default behavior, for disabling set the value to 0.
  17870. @item stitch
  17871. If set to 1, stitch the left and right row edges together.
  17872. This is the default behavior, for disabling set the value to 0.
  17873. @end table
  17874. @subsection Examples
  17875. @itemize
  17876. @item
  17877. Read the initial state from @file{pattern}, and specify an output of
  17878. size 200x400.
  17879. @example
  17880. cellauto=f=pattern:s=200x400
  17881. @end example
  17882. @item
  17883. Generate a random initial row with a width of 200 cells, with a fill
  17884. ratio of 2/3:
  17885. @example
  17886. cellauto=ratio=2/3:s=200x200
  17887. @end example
  17888. @item
  17889. Create a pattern generated by rule 18 starting by a single alive cell
  17890. centered on an initial row with width 100:
  17891. @example
  17892. cellauto=p=@@:s=100x400:full=0:rule=18
  17893. @end example
  17894. @item
  17895. Specify a more elaborated initial pattern:
  17896. @example
  17897. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17898. @end example
  17899. @end itemize
  17900. @anchor{coreimagesrc}
  17901. @section coreimagesrc
  17902. Video source generated on GPU using Apple's CoreImage API on OSX.
  17903. This video source is a specialized version of the @ref{coreimage} video filter.
  17904. Use a core image generator at the beginning of the applied filterchain to
  17905. generate the content.
  17906. The coreimagesrc video source accepts the following options:
  17907. @table @option
  17908. @item list_generators
  17909. List all available generators along with all their respective options as well as
  17910. possible minimum and maximum values along with the default values.
  17911. @example
  17912. list_generators=true
  17913. @end example
  17914. @item size, s
  17915. Specify the size of the sourced video. For the syntax of this option, check the
  17916. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17917. The default value is @code{320x240}.
  17918. @item rate, r
  17919. Specify the frame rate of the sourced video, as the number of frames
  17920. generated per second. It has to be a string in the format
  17921. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17922. number or a valid video frame rate abbreviation. The default value is
  17923. "25".
  17924. @item sar
  17925. Set the sample aspect ratio of the sourced video.
  17926. @item duration, d
  17927. Set the duration of the sourced video. See
  17928. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17929. for the accepted syntax.
  17930. If not specified, or the expressed duration is negative, the video is
  17931. supposed to be generated forever.
  17932. @end table
  17933. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17934. A complete filterchain can be used for further processing of the
  17935. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17936. and examples for details.
  17937. @subsection Examples
  17938. @itemize
  17939. @item
  17940. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17941. given as complete and escaped command-line for Apple's standard bash shell:
  17942. @example
  17943. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17944. @end example
  17945. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17946. need for a nullsrc video source.
  17947. @end itemize
  17948. @section gradients
  17949. Generate several gradients.
  17950. @table @option
  17951. @item size, s
  17952. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17953. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17954. @item rate, r
  17955. Set frame rate, expressed as number of frames per second. Default
  17956. value is "25".
  17957. @item c0, c1, c2, c3, c4, c5, c6, c7
  17958. Set 8 colors. Default values for colors is to pick random one.
  17959. @item x0, y0, y0, y1
  17960. Set gradient line source and destination points. If negative or out of range, random ones
  17961. are picked.
  17962. @item nb_colors, n
  17963. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17964. @item seed
  17965. Set seed for picking gradient line points.
  17966. @item duration, d
  17967. Set the duration of the sourced video. See
  17968. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17969. for the accepted syntax.
  17970. If not specified, or the expressed duration is negative, the video is
  17971. supposed to be generated forever.
  17972. @item speed
  17973. Set speed of gradients rotation.
  17974. @end table
  17975. @section mandelbrot
  17976. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17977. point specified with @var{start_x} and @var{start_y}.
  17978. This source accepts the following options:
  17979. @table @option
  17980. @item end_pts
  17981. Set the terminal pts value. Default value is 400.
  17982. @item end_scale
  17983. Set the terminal scale value.
  17984. Must be a floating point value. Default value is 0.3.
  17985. @item inner
  17986. Set the inner coloring mode, that is the algorithm used to draw the
  17987. Mandelbrot fractal internal region.
  17988. It shall assume one of the following values:
  17989. @table @option
  17990. @item black
  17991. Set black mode.
  17992. @item convergence
  17993. Show time until convergence.
  17994. @item mincol
  17995. Set color based on point closest to the origin of the iterations.
  17996. @item period
  17997. Set period mode.
  17998. @end table
  17999. Default value is @var{mincol}.
  18000. @item bailout
  18001. Set the bailout value. Default value is 10.0.
  18002. @item maxiter
  18003. Set the maximum of iterations performed by the rendering
  18004. algorithm. Default value is 7189.
  18005. @item outer
  18006. Set outer coloring mode.
  18007. It shall assume one of following values:
  18008. @table @option
  18009. @item iteration_count
  18010. Set iteration count mode.
  18011. @item normalized_iteration_count
  18012. set normalized iteration count mode.
  18013. @end table
  18014. Default value is @var{normalized_iteration_count}.
  18015. @item rate, r
  18016. Set frame rate, expressed as number of frames per second. Default
  18017. value is "25".
  18018. @item size, s
  18019. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18020. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18021. @item start_scale
  18022. Set the initial scale value. Default value is 3.0.
  18023. @item start_x
  18024. Set the initial x position. Must be a floating point value between
  18025. -100 and 100. Default value is -0.743643887037158704752191506114774.
  18026. @item start_y
  18027. Set the initial y position. Must be a floating point value between
  18028. -100 and 100. Default value is -0.131825904205311970493132056385139.
  18029. @end table
  18030. @section mptestsrc
  18031. Generate various test patterns, as generated by the MPlayer test filter.
  18032. The size of the generated video is fixed, and is 256x256.
  18033. This source is useful in particular for testing encoding features.
  18034. This source accepts the following options:
  18035. @table @option
  18036. @item rate, r
  18037. Specify the frame rate of the sourced video, as the number of frames
  18038. generated per second. It has to be a string in the format
  18039. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18040. number or a valid video frame rate abbreviation. The default value is
  18041. "25".
  18042. @item duration, d
  18043. Set the duration of the sourced video. See
  18044. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18045. for the accepted syntax.
  18046. If not specified, or the expressed duration is negative, the video is
  18047. supposed to be generated forever.
  18048. @item test, t
  18049. Set the number or the name of the test to perform. Supported tests are:
  18050. @table @option
  18051. @item dc_luma
  18052. @item dc_chroma
  18053. @item freq_luma
  18054. @item freq_chroma
  18055. @item amp_luma
  18056. @item amp_chroma
  18057. @item cbp
  18058. @item mv
  18059. @item ring1
  18060. @item ring2
  18061. @item all
  18062. @item max_frames, m
  18063. Set the maximum number of frames generated for each test, default value is 30.
  18064. @end table
  18065. Default value is "all", which will cycle through the list of all tests.
  18066. @end table
  18067. Some examples:
  18068. @example
  18069. mptestsrc=t=dc_luma
  18070. @end example
  18071. will generate a "dc_luma" test pattern.
  18072. @section frei0r_src
  18073. Provide a frei0r source.
  18074. To enable compilation of this filter you need to install the frei0r
  18075. header and configure FFmpeg with @code{--enable-frei0r}.
  18076. This source accepts the following parameters:
  18077. @table @option
  18078. @item size
  18079. The size of the video to generate. For the syntax of this option, check the
  18080. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18081. @item framerate
  18082. The framerate of the generated video. It may be a string of the form
  18083. @var{num}/@var{den} or a frame rate abbreviation.
  18084. @item filter_name
  18085. The name to the frei0r source to load. For more information regarding frei0r and
  18086. how to set the parameters, read the @ref{frei0r} section in the video filters
  18087. documentation.
  18088. @item filter_params
  18089. A '|'-separated list of parameters to pass to the frei0r source.
  18090. @end table
  18091. For example, to generate a frei0r partik0l source with size 200x200
  18092. and frame rate 10 which is overlaid on the overlay filter main input:
  18093. @example
  18094. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  18095. @end example
  18096. @section life
  18097. Generate a life pattern.
  18098. This source is based on a generalization of John Conway's life game.
  18099. The sourced input represents a life grid, each pixel represents a cell
  18100. which can be in one of two possible states, alive or dead. Every cell
  18101. interacts with its eight neighbours, which are the cells that are
  18102. horizontally, vertically, or diagonally adjacent.
  18103. At each interaction the grid evolves according to the adopted rule,
  18104. which specifies the number of neighbor alive cells which will make a
  18105. cell stay alive or born. The @option{rule} option allows one to specify
  18106. the rule to adopt.
  18107. This source accepts the following options:
  18108. @table @option
  18109. @item filename, f
  18110. Set the file from which to read the initial grid state. In the file,
  18111. each non-whitespace character is considered an alive cell, and newline
  18112. is used to delimit the end of each row.
  18113. If this option is not specified, the initial grid is generated
  18114. randomly.
  18115. @item rate, r
  18116. Set the video rate, that is the number of frames generated per second.
  18117. Default is 25.
  18118. @item random_fill_ratio, ratio
  18119. Set the random fill ratio for the initial random grid. It is a
  18120. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  18121. It is ignored when a file is specified.
  18122. @item random_seed, seed
  18123. Set the seed for filling the initial random grid, must be an integer
  18124. included between 0 and UINT32_MAX. If not specified, or if explicitly
  18125. set to -1, the filter will try to use a good random seed on a best
  18126. effort basis.
  18127. @item rule
  18128. Set the life rule.
  18129. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  18130. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  18131. @var{NS} specifies the number of alive neighbor cells which make a
  18132. live cell stay alive, and @var{NB} the number of alive neighbor cells
  18133. which make a dead cell to become alive (i.e. to "born").
  18134. "s" and "b" can be used in place of "S" and "B", respectively.
  18135. Alternatively a rule can be specified by an 18-bits integer. The 9
  18136. high order bits are used to encode the next cell state if it is alive
  18137. for each number of neighbor alive cells, the low order bits specify
  18138. the rule for "borning" new cells. Higher order bits encode for an
  18139. higher number of neighbor cells.
  18140. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  18141. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  18142. Default value is "S23/B3", which is the original Conway's game of life
  18143. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  18144. cells, and will born a new cell if there are three alive cells around
  18145. a dead cell.
  18146. @item size, s
  18147. Set the size of the output video. For the syntax of this option, check the
  18148. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18149. If @option{filename} is specified, the size is set by default to the
  18150. same size of the input file. If @option{size} is set, it must contain
  18151. the size specified in the input file, and the initial grid defined in
  18152. that file is centered in the larger resulting area.
  18153. If a filename is not specified, the size value defaults to "320x240"
  18154. (used for a randomly generated initial grid).
  18155. @item stitch
  18156. If set to 1, stitch the left and right grid edges together, and the
  18157. top and bottom edges also. Defaults to 1.
  18158. @item mold
  18159. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  18160. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  18161. value from 0 to 255.
  18162. @item life_color
  18163. Set the color of living (or new born) cells.
  18164. @item death_color
  18165. Set the color of dead cells. If @option{mold} is set, this is the first color
  18166. used to represent a dead cell.
  18167. @item mold_color
  18168. Set mold color, for definitely dead and moldy cells.
  18169. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  18170. ffmpeg-utils manual,ffmpeg-utils}.
  18171. @end table
  18172. @subsection Examples
  18173. @itemize
  18174. @item
  18175. Read a grid from @file{pattern}, and center it on a grid of size
  18176. 300x300 pixels:
  18177. @example
  18178. life=f=pattern:s=300x300
  18179. @end example
  18180. @item
  18181. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  18182. @example
  18183. life=ratio=2/3:s=200x200
  18184. @end example
  18185. @item
  18186. Specify a custom rule for evolving a randomly generated grid:
  18187. @example
  18188. life=rule=S14/B34
  18189. @end example
  18190. @item
  18191. Full example with slow death effect (mold) using @command{ffplay}:
  18192. @example
  18193. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  18194. @end example
  18195. @end itemize
  18196. @anchor{allrgb}
  18197. @anchor{allyuv}
  18198. @anchor{color}
  18199. @anchor{haldclutsrc}
  18200. @anchor{nullsrc}
  18201. @anchor{pal75bars}
  18202. @anchor{pal100bars}
  18203. @anchor{rgbtestsrc}
  18204. @anchor{smptebars}
  18205. @anchor{smptehdbars}
  18206. @anchor{testsrc}
  18207. @anchor{testsrc2}
  18208. @anchor{yuvtestsrc}
  18209. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  18210. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  18211. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  18212. The @code{color} source provides an uniformly colored input.
  18213. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  18214. @ref{haldclut} filter.
  18215. The @code{nullsrc} source returns unprocessed video frames. It is
  18216. mainly useful to be employed in analysis / debugging tools, or as the
  18217. source for filters which ignore the input data.
  18218. The @code{pal75bars} source generates a color bars pattern, based on
  18219. EBU PAL recommendations with 75% color levels.
  18220. The @code{pal100bars} source generates a color bars pattern, based on
  18221. EBU PAL recommendations with 100% color levels.
  18222. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  18223. detecting RGB vs BGR issues. You should see a red, green and blue
  18224. stripe from top to bottom.
  18225. The @code{smptebars} source generates a color bars pattern, based on
  18226. the SMPTE Engineering Guideline EG 1-1990.
  18227. The @code{smptehdbars} source generates a color bars pattern, based on
  18228. the SMPTE RP 219-2002.
  18229. The @code{testsrc} source generates a test video pattern, showing a
  18230. color pattern, a scrolling gradient and a timestamp. This is mainly
  18231. intended for testing purposes.
  18232. The @code{testsrc2} source is similar to testsrc, but supports more
  18233. pixel formats instead of just @code{rgb24}. This allows using it as an
  18234. input for other tests without requiring a format conversion.
  18235. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  18236. see a y, cb and cr stripe from top to bottom.
  18237. The sources accept the following parameters:
  18238. @table @option
  18239. @item level
  18240. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  18241. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  18242. pixels to be used as identity matrix for 3D lookup tables. Each component is
  18243. coded on a @code{1/(N*N)} scale.
  18244. @item color, c
  18245. Specify the color of the source, only available in the @code{color}
  18246. source. For the syntax of this option, check the
  18247. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18248. @item size, s
  18249. Specify the size of the sourced video. For the syntax of this option, check the
  18250. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18251. The default value is @code{320x240}.
  18252. This option is not available with the @code{allrgb}, @code{allyuv}, and
  18253. @code{haldclutsrc} filters.
  18254. @item rate, r
  18255. Specify the frame rate of the sourced video, as the number of frames
  18256. generated per second. It has to be a string in the format
  18257. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18258. number or a valid video frame rate abbreviation. The default value is
  18259. "25".
  18260. @item duration, d
  18261. Set the duration of the sourced video. See
  18262. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18263. for the accepted syntax.
  18264. If not specified, or the expressed duration is negative, the video is
  18265. supposed to be generated forever.
  18266. Since the frame rate is used as time base, all frames including the last one
  18267. will have their full duration. If the specified duration is not a multiple
  18268. of the frame duration, it will be rounded up.
  18269. @item sar
  18270. Set the sample aspect ratio of the sourced video.
  18271. @item alpha
  18272. Specify the alpha (opacity) of the background, only available in the
  18273. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  18274. 255 (fully opaque, the default).
  18275. @item decimals, n
  18276. Set the number of decimals to show in the timestamp, only available in the
  18277. @code{testsrc} source.
  18278. The displayed timestamp value will correspond to the original
  18279. timestamp value multiplied by the power of 10 of the specified
  18280. value. Default value is 0.
  18281. @end table
  18282. @subsection Examples
  18283. @itemize
  18284. @item
  18285. Generate a video with a duration of 5.3 seconds, with size
  18286. 176x144 and a frame rate of 10 frames per second:
  18287. @example
  18288. testsrc=duration=5.3:size=qcif:rate=10
  18289. @end example
  18290. @item
  18291. The following graph description will generate a red source
  18292. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  18293. frames per second:
  18294. @example
  18295. color=c=red@@0.2:s=qcif:r=10
  18296. @end example
  18297. @item
  18298. If the input content is to be ignored, @code{nullsrc} can be used. The
  18299. following command generates noise in the luminance plane by employing
  18300. the @code{geq} filter:
  18301. @example
  18302. nullsrc=s=256x256, geq=random(1)*255:128:128
  18303. @end example
  18304. @end itemize
  18305. @subsection Commands
  18306. The @code{color} source supports the following commands:
  18307. @table @option
  18308. @item c, color
  18309. Set the color of the created image. Accepts the same syntax of the
  18310. corresponding @option{color} option.
  18311. @end table
  18312. @section openclsrc
  18313. Generate video using an OpenCL program.
  18314. @table @option
  18315. @item source
  18316. OpenCL program source file.
  18317. @item kernel
  18318. Kernel name in program.
  18319. @item size, s
  18320. Size of frames to generate. This must be set.
  18321. @item format
  18322. Pixel format to use for the generated frames. This must be set.
  18323. @item rate, r
  18324. Number of frames generated every second. Default value is '25'.
  18325. @end table
  18326. For details of how the program loading works, see the @ref{program_opencl}
  18327. filter.
  18328. Example programs:
  18329. @itemize
  18330. @item
  18331. Generate a colour ramp by setting pixel values from the position of the pixel
  18332. in the output image. (Note that this will work with all pixel formats, but
  18333. the generated output will not be the same.)
  18334. @verbatim
  18335. __kernel void ramp(__write_only image2d_t dst,
  18336. unsigned int index)
  18337. {
  18338. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18339. float4 val;
  18340. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  18341. write_imagef(dst, loc, val);
  18342. }
  18343. @end verbatim
  18344. @item
  18345. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  18346. @verbatim
  18347. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  18348. unsigned int index)
  18349. {
  18350. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18351. float4 value = 0.0f;
  18352. int x = loc.x + index;
  18353. int y = loc.y + index;
  18354. while (x > 0 || y > 0) {
  18355. if (x % 3 == 1 && y % 3 == 1) {
  18356. value = 1.0f;
  18357. break;
  18358. }
  18359. x /= 3;
  18360. y /= 3;
  18361. }
  18362. write_imagef(dst, loc, value);
  18363. }
  18364. @end verbatim
  18365. @end itemize
  18366. @section sierpinski
  18367. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  18368. This source accepts the following options:
  18369. @table @option
  18370. @item size, s
  18371. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18372. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18373. @item rate, r
  18374. Set frame rate, expressed as number of frames per second. Default
  18375. value is "25".
  18376. @item seed
  18377. Set seed which is used for random panning.
  18378. @item jump
  18379. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  18380. @item type
  18381. Set fractal type, can be default @code{carpet} or @code{triangle}.
  18382. @end table
  18383. @c man end VIDEO SOURCES
  18384. @chapter Video Sinks
  18385. @c man begin VIDEO SINKS
  18386. Below is a description of the currently available video sinks.
  18387. @section buffersink
  18388. Buffer video frames, and make them available to the end of the filter
  18389. graph.
  18390. This sink is mainly intended for programmatic use, in particular
  18391. through the interface defined in @file{libavfilter/buffersink.h}
  18392. or the options system.
  18393. It accepts a pointer to an AVBufferSinkContext structure, which
  18394. defines the incoming buffers' formats, to be passed as the opaque
  18395. parameter to @code{avfilter_init_filter} for initialization.
  18396. @section nullsink
  18397. Null video sink: do absolutely nothing with the input video. It is
  18398. mainly useful as a template and for use in analysis / debugging
  18399. tools.
  18400. @c man end VIDEO SINKS
  18401. @chapter Multimedia Filters
  18402. @c man begin MULTIMEDIA FILTERS
  18403. Below is a description of the currently available multimedia filters.
  18404. @section abitscope
  18405. Convert input audio to a video output, displaying the audio bit scope.
  18406. The filter accepts the following options:
  18407. @table @option
  18408. @item rate, r
  18409. Set frame rate, expressed as number of frames per second. Default
  18410. value is "25".
  18411. @item size, s
  18412. Specify the video size for the output. For the syntax of this option, check the
  18413. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18414. Default value is @code{1024x256}.
  18415. @item colors
  18416. Specify list of colors separated by space or by '|' which will be used to
  18417. draw channels. Unrecognized or missing colors will be replaced
  18418. by white color.
  18419. @end table
  18420. @section adrawgraph
  18421. Draw a graph using input audio metadata.
  18422. See @ref{drawgraph}
  18423. @section agraphmonitor
  18424. See @ref{graphmonitor}.
  18425. @section ahistogram
  18426. Convert input audio to a video output, displaying the volume histogram.
  18427. The filter accepts the following options:
  18428. @table @option
  18429. @item dmode
  18430. Specify how histogram is calculated.
  18431. It accepts the following values:
  18432. @table @samp
  18433. @item single
  18434. Use single histogram for all channels.
  18435. @item separate
  18436. Use separate histogram for each channel.
  18437. @end table
  18438. Default is @code{single}.
  18439. @item rate, r
  18440. Set frame rate, expressed as number of frames per second. Default
  18441. value is "25".
  18442. @item size, s
  18443. Specify the video size for the output. For the syntax of this option, check the
  18444. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18445. Default value is @code{hd720}.
  18446. @item scale
  18447. Set display scale.
  18448. It accepts the following values:
  18449. @table @samp
  18450. @item log
  18451. logarithmic
  18452. @item sqrt
  18453. square root
  18454. @item cbrt
  18455. cubic root
  18456. @item lin
  18457. linear
  18458. @item rlog
  18459. reverse logarithmic
  18460. @end table
  18461. Default is @code{log}.
  18462. @item ascale
  18463. Set amplitude scale.
  18464. It accepts the following values:
  18465. @table @samp
  18466. @item log
  18467. logarithmic
  18468. @item lin
  18469. linear
  18470. @end table
  18471. Default is @code{log}.
  18472. @item acount
  18473. Set how much frames to accumulate in histogram.
  18474. Default is 1. Setting this to -1 accumulates all frames.
  18475. @item rheight
  18476. Set histogram ratio of window height.
  18477. @item slide
  18478. Set sonogram sliding.
  18479. It accepts the following values:
  18480. @table @samp
  18481. @item replace
  18482. replace old rows with new ones.
  18483. @item scroll
  18484. scroll from top to bottom.
  18485. @end table
  18486. Default is @code{replace}.
  18487. @end table
  18488. @section aphasemeter
  18489. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18490. representing mean phase of current audio frame. A video output can also be produced and is
  18491. enabled by default. The audio is passed through as first output.
  18492. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18493. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18494. and @code{1} means channels are in phase.
  18495. The filter accepts the following options, all related to its video output:
  18496. @table @option
  18497. @item rate, r
  18498. Set the output frame rate. Default value is @code{25}.
  18499. @item size, s
  18500. Set the video size for the output. For the syntax of this option, check the
  18501. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18502. Default value is @code{800x400}.
  18503. @item rc
  18504. @item gc
  18505. @item bc
  18506. Specify the red, green, blue contrast. Default values are @code{2},
  18507. @code{7} and @code{1}.
  18508. Allowed range is @code{[0, 255]}.
  18509. @item mpc
  18510. Set color which will be used for drawing median phase. If color is
  18511. @code{none} which is default, no median phase value will be drawn.
  18512. @item video
  18513. Enable video output. Default is enabled.
  18514. @end table
  18515. @subsection phasing detection
  18516. The filter also detects out of phase and mono sequences in stereo streams.
  18517. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18518. The filter accepts the following options for this detection:
  18519. @table @option
  18520. @item phasing
  18521. Enable mono and out of phase detection. Default is disabled.
  18522. @item tolerance, t
  18523. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18524. Allowed range is @code{[0, 1]}.
  18525. @item angle, a
  18526. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18527. Allowed range is @code{[90, 180]}.
  18528. @item duration, d
  18529. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18530. @end table
  18531. @subsection Examples
  18532. @itemize
  18533. @item
  18534. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18535. @example
  18536. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18537. @end example
  18538. @end itemize
  18539. @section avectorscope
  18540. Convert input audio to a video output, representing the audio vector
  18541. scope.
  18542. The filter is used to measure the difference between channels of stereo
  18543. audio stream. A monaural signal, consisting of identical left and right
  18544. signal, results in straight vertical line. Any stereo separation is visible
  18545. as a deviation from this line, creating a Lissajous figure.
  18546. If the straight (or deviation from it) but horizontal line appears this
  18547. indicates that the left and right channels are out of phase.
  18548. The filter accepts the following options:
  18549. @table @option
  18550. @item mode, m
  18551. Set the vectorscope mode.
  18552. Available values are:
  18553. @table @samp
  18554. @item lissajous
  18555. Lissajous rotated by 45 degrees.
  18556. @item lissajous_xy
  18557. Same as above but not rotated.
  18558. @item polar
  18559. Shape resembling half of circle.
  18560. @end table
  18561. Default value is @samp{lissajous}.
  18562. @item size, s
  18563. Set the video size for the output. For the syntax of this option, check the
  18564. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18565. Default value is @code{400x400}.
  18566. @item rate, r
  18567. Set the output frame rate. Default value is @code{25}.
  18568. @item rc
  18569. @item gc
  18570. @item bc
  18571. @item ac
  18572. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18573. @code{160}, @code{80} and @code{255}.
  18574. Allowed range is @code{[0, 255]}.
  18575. @item rf
  18576. @item gf
  18577. @item bf
  18578. @item af
  18579. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18580. @code{10}, @code{5} and @code{5}.
  18581. Allowed range is @code{[0, 255]}.
  18582. @item zoom
  18583. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18584. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18585. @item draw
  18586. Set the vectorscope drawing mode.
  18587. Available values are:
  18588. @table @samp
  18589. @item dot
  18590. Draw dot for each sample.
  18591. @item line
  18592. Draw line between previous and current sample.
  18593. @end table
  18594. Default value is @samp{dot}.
  18595. @item scale
  18596. Specify amplitude scale of audio samples.
  18597. Available values are:
  18598. @table @samp
  18599. @item lin
  18600. Linear.
  18601. @item sqrt
  18602. Square root.
  18603. @item cbrt
  18604. Cubic root.
  18605. @item log
  18606. Logarithmic.
  18607. @end table
  18608. @item swap
  18609. Swap left channel axis with right channel axis.
  18610. @item mirror
  18611. Mirror axis.
  18612. @table @samp
  18613. @item none
  18614. No mirror.
  18615. @item x
  18616. Mirror only x axis.
  18617. @item y
  18618. Mirror only y axis.
  18619. @item xy
  18620. Mirror both axis.
  18621. @end table
  18622. @end table
  18623. @subsection Examples
  18624. @itemize
  18625. @item
  18626. Complete example using @command{ffplay}:
  18627. @example
  18628. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18629. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18630. @end example
  18631. @end itemize
  18632. @section bench, abench
  18633. Benchmark part of a filtergraph.
  18634. The filter accepts the following options:
  18635. @table @option
  18636. @item action
  18637. Start or stop a timer.
  18638. Available values are:
  18639. @table @samp
  18640. @item start
  18641. Get the current time, set it as frame metadata (using the key
  18642. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18643. @item stop
  18644. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18645. the input frame metadata to get the time difference. Time difference, average,
  18646. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18647. @code{min}) are then printed. The timestamps are expressed in seconds.
  18648. @end table
  18649. @end table
  18650. @subsection Examples
  18651. @itemize
  18652. @item
  18653. Benchmark @ref{selectivecolor} filter:
  18654. @example
  18655. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18656. @end example
  18657. @end itemize
  18658. @section concat
  18659. Concatenate audio and video streams, joining them together one after the
  18660. other.
  18661. The filter works on segments of synchronized video and audio streams. All
  18662. segments must have the same number of streams of each type, and that will
  18663. also be the number of streams at output.
  18664. The filter accepts the following options:
  18665. @table @option
  18666. @item n
  18667. Set the number of segments. Default is 2.
  18668. @item v
  18669. Set the number of output video streams, that is also the number of video
  18670. streams in each segment. Default is 1.
  18671. @item a
  18672. Set the number of output audio streams, that is also the number of audio
  18673. streams in each segment. Default is 0.
  18674. @item unsafe
  18675. Activate unsafe mode: do not fail if segments have a different format.
  18676. @end table
  18677. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18678. @var{a} audio outputs.
  18679. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18680. segment, in the same order as the outputs, then the inputs for the second
  18681. segment, etc.
  18682. Related streams do not always have exactly the same duration, for various
  18683. reasons including codec frame size or sloppy authoring. For that reason,
  18684. related synchronized streams (e.g. a video and its audio track) should be
  18685. concatenated at once. The concat filter will use the duration of the longest
  18686. stream in each segment (except the last one), and if necessary pad shorter
  18687. audio streams with silence.
  18688. For this filter to work correctly, all segments must start at timestamp 0.
  18689. All corresponding streams must have the same parameters in all segments; the
  18690. filtering system will automatically select a common pixel format for video
  18691. streams, and a common sample format, sample rate and channel layout for
  18692. audio streams, but other settings, such as resolution, must be converted
  18693. explicitly by the user.
  18694. Different frame rates are acceptable but will result in variable frame rate
  18695. at output; be sure to configure the output file to handle it.
  18696. @subsection Examples
  18697. @itemize
  18698. @item
  18699. Concatenate an opening, an episode and an ending, all in bilingual version
  18700. (video in stream 0, audio in streams 1 and 2):
  18701. @example
  18702. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18703. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18704. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18705. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18706. @end example
  18707. @item
  18708. Concatenate two parts, handling audio and video separately, using the
  18709. (a)movie sources, and adjusting the resolution:
  18710. @example
  18711. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18712. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18713. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18714. @end example
  18715. Note that a desync will happen at the stitch if the audio and video streams
  18716. do not have exactly the same duration in the first file.
  18717. @end itemize
  18718. @subsection Commands
  18719. This filter supports the following commands:
  18720. @table @option
  18721. @item next
  18722. Close the current segment and step to the next one
  18723. @end table
  18724. @anchor{ebur128}
  18725. @section ebur128
  18726. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18727. level. By default, it logs a message at a frequency of 10Hz with the
  18728. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18729. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18730. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18731. sample format is double-precision floating point. The input stream will be converted to
  18732. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18733. after this filter to obtain the original parameters.
  18734. The filter also has a video output (see the @var{video} option) with a real
  18735. time graph to observe the loudness evolution. The graphic contains the logged
  18736. message mentioned above, so it is not printed anymore when this option is set,
  18737. unless the verbose logging is set. The main graphing area contains the
  18738. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18739. the momentary loudness (400 milliseconds), but can optionally be configured
  18740. to instead display short-term loudness (see @var{gauge}).
  18741. The green area marks a +/- 1LU target range around the target loudness
  18742. (-23LUFS by default, unless modified through @var{target}).
  18743. More information about the Loudness Recommendation EBU R128 on
  18744. @url{http://tech.ebu.ch/loudness}.
  18745. The filter accepts the following options:
  18746. @table @option
  18747. @item video
  18748. Activate the video output. The audio stream is passed unchanged whether this
  18749. option is set or no. The video stream will be the first output stream if
  18750. activated. Default is @code{0}.
  18751. @item size
  18752. Set the video size. This option is for video only. For the syntax of this
  18753. option, check the
  18754. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18755. Default and minimum resolution is @code{640x480}.
  18756. @item meter
  18757. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18758. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18759. other integer value between this range is allowed.
  18760. @item metadata
  18761. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18762. into 100ms output frames, each of them containing various loudness information
  18763. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18764. Default is @code{0}.
  18765. @item framelog
  18766. Force the frame logging level.
  18767. Available values are:
  18768. @table @samp
  18769. @item info
  18770. information logging level
  18771. @item verbose
  18772. verbose logging level
  18773. @end table
  18774. By default, the logging level is set to @var{info}. If the @option{video} or
  18775. the @option{metadata} options are set, it switches to @var{verbose}.
  18776. @item peak
  18777. Set peak mode(s).
  18778. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18779. values are:
  18780. @table @samp
  18781. @item none
  18782. Disable any peak mode (default).
  18783. @item sample
  18784. Enable sample-peak mode.
  18785. Simple peak mode looking for the higher sample value. It logs a message
  18786. for sample-peak (identified by @code{SPK}).
  18787. @item true
  18788. Enable true-peak mode.
  18789. If enabled, the peak lookup is done on an over-sampled version of the input
  18790. stream for better peak accuracy. It logs a message for true-peak.
  18791. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18792. This mode requires a build with @code{libswresample}.
  18793. @end table
  18794. @item dualmono
  18795. Treat mono input files as "dual mono". If a mono file is intended for playback
  18796. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18797. If set to @code{true}, this option will compensate for this effect.
  18798. Multi-channel input files are not affected by this option.
  18799. @item panlaw
  18800. Set a specific pan law to be used for the measurement of dual mono files.
  18801. This parameter is optional, and has a default value of -3.01dB.
  18802. @item target
  18803. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18804. This parameter is optional and has a default value of -23LUFS as specified
  18805. by EBU R128. However, material published online may prefer a level of -16LUFS
  18806. (e.g. for use with podcasts or video platforms).
  18807. @item gauge
  18808. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18809. @code{shortterm}. By default the momentary value will be used, but in certain
  18810. scenarios it may be more useful to observe the short term value instead (e.g.
  18811. live mixing).
  18812. @item scale
  18813. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18814. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18815. video output, not the summary or continuous log output.
  18816. @end table
  18817. @subsection Examples
  18818. @itemize
  18819. @item
  18820. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18821. @example
  18822. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18823. @end example
  18824. @item
  18825. Run an analysis with @command{ffmpeg}:
  18826. @example
  18827. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18828. @end example
  18829. @end itemize
  18830. @section interleave, ainterleave
  18831. Temporally interleave frames from several inputs.
  18832. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18833. These filters read frames from several inputs and send the oldest
  18834. queued frame to the output.
  18835. Input streams must have well defined, monotonically increasing frame
  18836. timestamp values.
  18837. In order to submit one frame to output, these filters need to enqueue
  18838. at least one frame for each input, so they cannot work in case one
  18839. input is not yet terminated and will not receive incoming frames.
  18840. For example consider the case when one input is a @code{select} filter
  18841. which always drops input frames. The @code{interleave} filter will keep
  18842. reading from that input, but it will never be able to send new frames
  18843. to output until the input sends an end-of-stream signal.
  18844. Also, depending on inputs synchronization, the filters will drop
  18845. frames in case one input receives more frames than the other ones, and
  18846. the queue is already filled.
  18847. These filters accept the following options:
  18848. @table @option
  18849. @item nb_inputs, n
  18850. Set the number of different inputs, it is 2 by default.
  18851. @item duration
  18852. How to determine the end-of-stream.
  18853. @table @option
  18854. @item longest
  18855. The duration of the longest input. (default)
  18856. @item shortest
  18857. The duration of the shortest input.
  18858. @item first
  18859. The duration of the first input.
  18860. @end table
  18861. @end table
  18862. @subsection Examples
  18863. @itemize
  18864. @item
  18865. Interleave frames belonging to different streams using @command{ffmpeg}:
  18866. @example
  18867. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18868. @end example
  18869. @item
  18870. Add flickering blur effect:
  18871. @example
  18872. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18873. @end example
  18874. @end itemize
  18875. @section metadata, ametadata
  18876. Manipulate frame metadata.
  18877. This filter accepts the following options:
  18878. @table @option
  18879. @item mode
  18880. Set mode of operation of the filter.
  18881. Can be one of the following:
  18882. @table @samp
  18883. @item select
  18884. If both @code{value} and @code{key} is set, select frames
  18885. which have such metadata. If only @code{key} is set, select
  18886. every frame that has such key in metadata.
  18887. @item add
  18888. Add new metadata @code{key} and @code{value}. If key is already available
  18889. do nothing.
  18890. @item modify
  18891. Modify value of already present key.
  18892. @item delete
  18893. If @code{value} is set, delete only keys that have such value.
  18894. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18895. the frame.
  18896. @item print
  18897. Print key and its value if metadata was found. If @code{key} is not set print all
  18898. metadata values available in frame.
  18899. @end table
  18900. @item key
  18901. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18902. @item value
  18903. Set metadata value which will be used. This option is mandatory for
  18904. @code{modify} and @code{add} mode.
  18905. @item function
  18906. Which function to use when comparing metadata value and @code{value}.
  18907. Can be one of following:
  18908. @table @samp
  18909. @item same_str
  18910. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18911. @item starts_with
  18912. Values are interpreted as strings, returns true if metadata value starts with
  18913. the @code{value} option string.
  18914. @item less
  18915. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18916. @item equal
  18917. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18918. @item greater
  18919. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18920. @item expr
  18921. Values are interpreted as floats, returns true if expression from option @code{expr}
  18922. evaluates to true.
  18923. @item ends_with
  18924. Values are interpreted as strings, returns true if metadata value ends with
  18925. the @code{value} option string.
  18926. @end table
  18927. @item expr
  18928. Set expression which is used when @code{function} is set to @code{expr}.
  18929. The expression is evaluated through the eval API and can contain the following
  18930. constants:
  18931. @table @option
  18932. @item VALUE1
  18933. Float representation of @code{value} from metadata key.
  18934. @item VALUE2
  18935. Float representation of @code{value} as supplied by user in @code{value} option.
  18936. @end table
  18937. @item file
  18938. If specified in @code{print} mode, output is written to the named file. Instead of
  18939. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18940. for standard output. If @code{file} option is not set, output is written to the log
  18941. with AV_LOG_INFO loglevel.
  18942. @item direct
  18943. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18944. @end table
  18945. @subsection Examples
  18946. @itemize
  18947. @item
  18948. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18949. between 0 and 1.
  18950. @example
  18951. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18952. @end example
  18953. @item
  18954. Print silencedetect output to file @file{metadata.txt}.
  18955. @example
  18956. silencedetect,ametadata=mode=print:file=metadata.txt
  18957. @end example
  18958. @item
  18959. Direct all metadata to a pipe with file descriptor 4.
  18960. @example
  18961. metadata=mode=print:file='pipe\:4'
  18962. @end example
  18963. @end itemize
  18964. @section perms, aperms
  18965. Set read/write permissions for the output frames.
  18966. These filters are mainly aimed at developers to test direct path in the
  18967. following filter in the filtergraph.
  18968. The filters accept the following options:
  18969. @table @option
  18970. @item mode
  18971. Select the permissions mode.
  18972. It accepts the following values:
  18973. @table @samp
  18974. @item none
  18975. Do nothing. This is the default.
  18976. @item ro
  18977. Set all the output frames read-only.
  18978. @item rw
  18979. Set all the output frames directly writable.
  18980. @item toggle
  18981. Make the frame read-only if writable, and writable if read-only.
  18982. @item random
  18983. Set each output frame read-only or writable randomly.
  18984. @end table
  18985. @item seed
  18986. Set the seed for the @var{random} mode, must be an integer included between
  18987. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18988. @code{-1}, the filter will try to use a good random seed on a best effort
  18989. basis.
  18990. @end table
  18991. Note: in case of auto-inserted filter between the permission filter and the
  18992. following one, the permission might not be received as expected in that
  18993. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18994. perms/aperms filter can avoid this problem.
  18995. @section realtime, arealtime
  18996. Slow down filtering to match real time approximately.
  18997. These filters will pause the filtering for a variable amount of time to
  18998. match the output rate with the input timestamps.
  18999. They are similar to the @option{re} option to @code{ffmpeg}.
  19000. They accept the following options:
  19001. @table @option
  19002. @item limit
  19003. Time limit for the pauses. Any pause longer than that will be considered
  19004. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  19005. @item speed
  19006. Speed factor for processing. The value must be a float larger than zero.
  19007. Values larger than 1.0 will result in faster than realtime processing,
  19008. smaller will slow processing down. The @var{limit} is automatically adapted
  19009. accordingly. Default is 1.0.
  19010. A processing speed faster than what is possible without these filters cannot
  19011. be achieved.
  19012. @end table
  19013. @anchor{select}
  19014. @section select, aselect
  19015. Select frames to pass in output.
  19016. This filter accepts the following options:
  19017. @table @option
  19018. @item expr, e
  19019. Set expression, which is evaluated for each input frame.
  19020. If the expression is evaluated to zero, the frame is discarded.
  19021. If the evaluation result is negative or NaN, the frame is sent to the
  19022. first output; otherwise it is sent to the output with index
  19023. @code{ceil(val)-1}, assuming that the input index starts from 0.
  19024. For example a value of @code{1.2} corresponds to the output with index
  19025. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  19026. @item outputs, n
  19027. Set the number of outputs. The output to which to send the selected
  19028. frame is based on the result of the evaluation. Default value is 1.
  19029. @end table
  19030. The expression can contain the following constants:
  19031. @table @option
  19032. @item n
  19033. The (sequential) number of the filtered frame, starting from 0.
  19034. @item selected_n
  19035. The (sequential) number of the selected frame, starting from 0.
  19036. @item prev_selected_n
  19037. The sequential number of the last selected frame. It's NAN if undefined.
  19038. @item TB
  19039. The timebase of the input timestamps.
  19040. @item pts
  19041. The PTS (Presentation TimeStamp) of the filtered video frame,
  19042. expressed in @var{TB} units. It's NAN if undefined.
  19043. @item t
  19044. The PTS of the filtered video frame,
  19045. expressed in seconds. It's NAN if undefined.
  19046. @item prev_pts
  19047. The PTS of the previously filtered video frame. It's NAN if undefined.
  19048. @item prev_selected_pts
  19049. The PTS of the last previously filtered video frame. It's NAN if undefined.
  19050. @item prev_selected_t
  19051. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  19052. @item start_pts
  19053. The PTS of the first video frame in the video. It's NAN if undefined.
  19054. @item start_t
  19055. The time of the first video frame in the video. It's NAN if undefined.
  19056. @item pict_type @emph{(video only)}
  19057. The type of the filtered frame. It can assume one of the following
  19058. values:
  19059. @table @option
  19060. @item I
  19061. @item P
  19062. @item B
  19063. @item S
  19064. @item SI
  19065. @item SP
  19066. @item BI
  19067. @end table
  19068. @item interlace_type @emph{(video only)}
  19069. The frame interlace type. It can assume one of the following values:
  19070. @table @option
  19071. @item PROGRESSIVE
  19072. The frame is progressive (not interlaced).
  19073. @item TOPFIRST
  19074. The frame is top-field-first.
  19075. @item BOTTOMFIRST
  19076. The frame is bottom-field-first.
  19077. @end table
  19078. @item consumed_sample_n @emph{(audio only)}
  19079. the number of selected samples before the current frame
  19080. @item samples_n @emph{(audio only)}
  19081. the number of samples in the current frame
  19082. @item sample_rate @emph{(audio only)}
  19083. the input sample rate
  19084. @item key
  19085. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  19086. @item pos
  19087. the position in the file of the filtered frame, -1 if the information
  19088. is not available (e.g. for synthetic video)
  19089. @item scene @emph{(video only)}
  19090. value between 0 and 1 to indicate a new scene; a low value reflects a low
  19091. probability for the current frame to introduce a new scene, while a higher
  19092. value means the current frame is more likely to be one (see the example below)
  19093. @item concatdec_select
  19094. The concat demuxer can select only part of a concat input file by setting an
  19095. inpoint and an outpoint, but the output packets may not be entirely contained
  19096. in the selected interval. By using this variable, it is possible to skip frames
  19097. generated by the concat demuxer which are not exactly contained in the selected
  19098. interval.
  19099. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  19100. and the @var{lavf.concat.duration} packet metadata values which are also
  19101. present in the decoded frames.
  19102. The @var{concatdec_select} variable is -1 if the frame pts is at least
  19103. start_time and either the duration metadata is missing or the frame pts is less
  19104. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  19105. missing.
  19106. That basically means that an input frame is selected if its pts is within the
  19107. interval set by the concat demuxer.
  19108. @end table
  19109. The default value of the select expression is "1".
  19110. @subsection Examples
  19111. @itemize
  19112. @item
  19113. Select all frames in input:
  19114. @example
  19115. select
  19116. @end example
  19117. The example above is the same as:
  19118. @example
  19119. select=1
  19120. @end example
  19121. @item
  19122. Skip all frames:
  19123. @example
  19124. select=0
  19125. @end example
  19126. @item
  19127. Select only I-frames:
  19128. @example
  19129. select='eq(pict_type\,I)'
  19130. @end example
  19131. @item
  19132. Select one frame every 100:
  19133. @example
  19134. select='not(mod(n\,100))'
  19135. @end example
  19136. @item
  19137. Select only frames contained in the 10-20 time interval:
  19138. @example
  19139. select=between(t\,10\,20)
  19140. @end example
  19141. @item
  19142. Select only I-frames contained in the 10-20 time interval:
  19143. @example
  19144. select=between(t\,10\,20)*eq(pict_type\,I)
  19145. @end example
  19146. @item
  19147. Select frames with a minimum distance of 10 seconds:
  19148. @example
  19149. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  19150. @end example
  19151. @item
  19152. Use aselect to select only audio frames with samples number > 100:
  19153. @example
  19154. aselect='gt(samples_n\,100)'
  19155. @end example
  19156. @item
  19157. Create a mosaic of the first scenes:
  19158. @example
  19159. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  19160. @end example
  19161. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  19162. choice.
  19163. @item
  19164. Send even and odd frames to separate outputs, and compose them:
  19165. @example
  19166. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  19167. @end example
  19168. @item
  19169. Select useful frames from an ffconcat file which is using inpoints and
  19170. outpoints but where the source files are not intra frame only.
  19171. @example
  19172. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  19173. @end example
  19174. @end itemize
  19175. @section sendcmd, asendcmd
  19176. Send commands to filters in the filtergraph.
  19177. These filters read commands to be sent to other filters in the
  19178. filtergraph.
  19179. @code{sendcmd} must be inserted between two video filters,
  19180. @code{asendcmd} must be inserted between two audio filters, but apart
  19181. from that they act the same way.
  19182. The specification of commands can be provided in the filter arguments
  19183. with the @var{commands} option, or in a file specified by the
  19184. @var{filename} option.
  19185. These filters accept the following options:
  19186. @table @option
  19187. @item commands, c
  19188. Set the commands to be read and sent to the other filters.
  19189. @item filename, f
  19190. Set the filename of the commands to be read and sent to the other
  19191. filters.
  19192. @end table
  19193. @subsection Commands syntax
  19194. A commands description consists of a sequence of interval
  19195. specifications, comprising a list of commands to be executed when a
  19196. particular event related to that interval occurs. The occurring event
  19197. is typically the current frame time entering or leaving a given time
  19198. interval.
  19199. An interval is specified by the following syntax:
  19200. @example
  19201. @var{START}[-@var{END}] @var{COMMANDS};
  19202. @end example
  19203. The time interval is specified by the @var{START} and @var{END} times.
  19204. @var{END} is optional and defaults to the maximum time.
  19205. The current frame time is considered within the specified interval if
  19206. it is included in the interval [@var{START}, @var{END}), that is when
  19207. the time is greater or equal to @var{START} and is lesser than
  19208. @var{END}.
  19209. @var{COMMANDS} consists of a sequence of one or more command
  19210. specifications, separated by ",", relating to that interval. The
  19211. syntax of a command specification is given by:
  19212. @example
  19213. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  19214. @end example
  19215. @var{FLAGS} is optional and specifies the type of events relating to
  19216. the time interval which enable sending the specified command, and must
  19217. be a non-null sequence of identifier flags separated by "+" or "|" and
  19218. enclosed between "[" and "]".
  19219. The following flags are recognized:
  19220. @table @option
  19221. @item enter
  19222. The command is sent when the current frame timestamp enters the
  19223. specified interval. In other words, the command is sent when the
  19224. previous frame timestamp was not in the given interval, and the
  19225. current is.
  19226. @item leave
  19227. The command is sent when the current frame timestamp leaves the
  19228. specified interval. In other words, the command is sent when the
  19229. previous frame timestamp was in the given interval, and the
  19230. current is not.
  19231. @item expr
  19232. The command @var{ARG} is interpreted as expression and result of
  19233. expression is passed as @var{ARG}.
  19234. The expression is evaluated through the eval API and can contain the following
  19235. constants:
  19236. @table @option
  19237. @item POS
  19238. Original position in the file of the frame, or undefined if undefined
  19239. for the current frame.
  19240. @item PTS
  19241. The presentation timestamp in input.
  19242. @item N
  19243. The count of the input frame for video or audio, starting from 0.
  19244. @item T
  19245. The time in seconds of the current frame.
  19246. @item TS
  19247. The start time in seconds of the current command interval.
  19248. @item TE
  19249. The end time in seconds of the current command interval.
  19250. @item TI
  19251. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  19252. @end table
  19253. @end table
  19254. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  19255. assumed.
  19256. @var{TARGET} specifies the target of the command, usually the name of
  19257. the filter class or a specific filter instance name.
  19258. @var{COMMAND} specifies the name of the command for the target filter.
  19259. @var{ARG} is optional and specifies the optional list of argument for
  19260. the given @var{COMMAND}.
  19261. Between one interval specification and another, whitespaces, or
  19262. sequences of characters starting with @code{#} until the end of line,
  19263. are ignored and can be used to annotate comments.
  19264. A simplified BNF description of the commands specification syntax
  19265. follows:
  19266. @example
  19267. @var{COMMAND_FLAG} ::= "enter" | "leave"
  19268. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  19269. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  19270. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  19271. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  19272. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  19273. @end example
  19274. @subsection Examples
  19275. @itemize
  19276. @item
  19277. Specify audio tempo change at second 4:
  19278. @example
  19279. asendcmd=c='4.0 atempo tempo 1.5',atempo
  19280. @end example
  19281. @item
  19282. Target a specific filter instance:
  19283. @example
  19284. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  19285. @end example
  19286. @item
  19287. Specify a list of drawtext and hue commands in a file.
  19288. @example
  19289. # show text in the interval 5-10
  19290. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  19291. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  19292. # desaturate the image in the interval 15-20
  19293. 15.0-20.0 [enter] hue s 0,
  19294. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  19295. [leave] hue s 1,
  19296. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  19297. # apply an exponential saturation fade-out effect, starting from time 25
  19298. 25 [enter] hue s exp(25-t)
  19299. @end example
  19300. A filtergraph allowing to read and process the above command list
  19301. stored in a file @file{test.cmd}, can be specified with:
  19302. @example
  19303. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  19304. @end example
  19305. @end itemize
  19306. @anchor{setpts}
  19307. @section setpts, asetpts
  19308. Change the PTS (presentation timestamp) of the input frames.
  19309. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  19310. This filter accepts the following options:
  19311. @table @option
  19312. @item expr
  19313. The expression which is evaluated for each frame to construct its timestamp.
  19314. @end table
  19315. The expression is evaluated through the eval API and can contain the following
  19316. constants:
  19317. @table @option
  19318. @item FRAME_RATE, FR
  19319. frame rate, only defined for constant frame-rate video
  19320. @item PTS
  19321. The presentation timestamp in input
  19322. @item N
  19323. The count of the input frame for video or the number of consumed samples,
  19324. not including the current frame for audio, starting from 0.
  19325. @item NB_CONSUMED_SAMPLES
  19326. The number of consumed samples, not including the current frame (only
  19327. audio)
  19328. @item NB_SAMPLES, S
  19329. The number of samples in the current frame (only audio)
  19330. @item SAMPLE_RATE, SR
  19331. The audio sample rate.
  19332. @item STARTPTS
  19333. The PTS of the first frame.
  19334. @item STARTT
  19335. the time in seconds of the first frame
  19336. @item INTERLACED
  19337. State whether the current frame is interlaced.
  19338. @item T
  19339. the time in seconds of the current frame
  19340. @item POS
  19341. original position in the file of the frame, or undefined if undefined
  19342. for the current frame
  19343. @item PREV_INPTS
  19344. The previous input PTS.
  19345. @item PREV_INT
  19346. previous input time in seconds
  19347. @item PREV_OUTPTS
  19348. The previous output PTS.
  19349. @item PREV_OUTT
  19350. previous output time in seconds
  19351. @item RTCTIME
  19352. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  19353. instead.
  19354. @item RTCSTART
  19355. The wallclock (RTC) time at the start of the movie in microseconds.
  19356. @item TB
  19357. The timebase of the input timestamps.
  19358. @end table
  19359. @subsection Examples
  19360. @itemize
  19361. @item
  19362. Start counting PTS from zero
  19363. @example
  19364. setpts=PTS-STARTPTS
  19365. @end example
  19366. @item
  19367. Apply fast motion effect:
  19368. @example
  19369. setpts=0.5*PTS
  19370. @end example
  19371. @item
  19372. Apply slow motion effect:
  19373. @example
  19374. setpts=2.0*PTS
  19375. @end example
  19376. @item
  19377. Set fixed rate of 25 frames per second:
  19378. @example
  19379. setpts=N/(25*TB)
  19380. @end example
  19381. @item
  19382. Set fixed rate 25 fps with some jitter:
  19383. @example
  19384. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  19385. @end example
  19386. @item
  19387. Apply an offset of 10 seconds to the input PTS:
  19388. @example
  19389. setpts=PTS+10/TB
  19390. @end example
  19391. @item
  19392. Generate timestamps from a "live source" and rebase onto the current timebase:
  19393. @example
  19394. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  19395. @end example
  19396. @item
  19397. Generate timestamps by counting samples:
  19398. @example
  19399. asetpts=N/SR/TB
  19400. @end example
  19401. @end itemize
  19402. @section setrange
  19403. Force color range for the output video frame.
  19404. The @code{setrange} filter marks the color range property for the
  19405. output frames. It does not change the input frame, but only sets the
  19406. corresponding property, which affects how the frame is treated by
  19407. following filters.
  19408. The filter accepts the following options:
  19409. @table @option
  19410. @item range
  19411. Available values are:
  19412. @table @samp
  19413. @item auto
  19414. Keep the same color range property.
  19415. @item unspecified, unknown
  19416. Set the color range as unspecified.
  19417. @item limited, tv, mpeg
  19418. Set the color range as limited.
  19419. @item full, pc, jpeg
  19420. Set the color range as full.
  19421. @end table
  19422. @end table
  19423. @section settb, asettb
  19424. Set the timebase to use for the output frames timestamps.
  19425. It is mainly useful for testing timebase configuration.
  19426. It accepts the following parameters:
  19427. @table @option
  19428. @item expr, tb
  19429. The expression which is evaluated into the output timebase.
  19430. @end table
  19431. The value for @option{tb} is an arithmetic expression representing a
  19432. rational. The expression can contain the constants "AVTB" (the default
  19433. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19434. audio only). Default value is "intb".
  19435. @subsection Examples
  19436. @itemize
  19437. @item
  19438. Set the timebase to 1/25:
  19439. @example
  19440. settb=expr=1/25
  19441. @end example
  19442. @item
  19443. Set the timebase to 1/10:
  19444. @example
  19445. settb=expr=0.1
  19446. @end example
  19447. @item
  19448. Set the timebase to 1001/1000:
  19449. @example
  19450. settb=1+0.001
  19451. @end example
  19452. @item
  19453. Set the timebase to 2*intb:
  19454. @example
  19455. settb=2*intb
  19456. @end example
  19457. @item
  19458. Set the default timebase value:
  19459. @example
  19460. settb=AVTB
  19461. @end example
  19462. @end itemize
  19463. @section showcqt
  19464. Convert input audio to a video output representing frequency spectrum
  19465. logarithmically using Brown-Puckette constant Q transform algorithm with
  19466. direct frequency domain coefficient calculation (but the transform itself
  19467. is not really constant Q, instead the Q factor is actually variable/clamped),
  19468. with musical tone scale, from E0 to D#10.
  19469. The filter accepts the following options:
  19470. @table @option
  19471. @item size, s
  19472. Specify the video size for the output. It must be even. For the syntax of this option,
  19473. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19474. Default value is @code{1920x1080}.
  19475. @item fps, rate, r
  19476. Set the output frame rate. Default value is @code{25}.
  19477. @item bar_h
  19478. Set the bargraph height. It must be even. Default value is @code{-1} which
  19479. computes the bargraph height automatically.
  19480. @item axis_h
  19481. Set the axis height. It must be even. Default value is @code{-1} which computes
  19482. the axis height automatically.
  19483. @item sono_h
  19484. Set the sonogram height. It must be even. Default value is @code{-1} which
  19485. computes the sonogram height automatically.
  19486. @item fullhd
  19487. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19488. instead. Default value is @code{1}.
  19489. @item sono_v, volume
  19490. Specify the sonogram volume expression. It can contain variables:
  19491. @table @option
  19492. @item bar_v
  19493. the @var{bar_v} evaluated expression
  19494. @item frequency, freq, f
  19495. the frequency where it is evaluated
  19496. @item timeclamp, tc
  19497. the value of @var{timeclamp} option
  19498. @end table
  19499. and functions:
  19500. @table @option
  19501. @item a_weighting(f)
  19502. A-weighting of equal loudness
  19503. @item b_weighting(f)
  19504. B-weighting of equal loudness
  19505. @item c_weighting(f)
  19506. C-weighting of equal loudness.
  19507. @end table
  19508. Default value is @code{16}.
  19509. @item bar_v, volume2
  19510. Specify the bargraph volume expression. It can contain variables:
  19511. @table @option
  19512. @item sono_v
  19513. the @var{sono_v} evaluated expression
  19514. @item frequency, freq, f
  19515. the frequency where it is evaluated
  19516. @item timeclamp, tc
  19517. the value of @var{timeclamp} option
  19518. @end table
  19519. and functions:
  19520. @table @option
  19521. @item a_weighting(f)
  19522. A-weighting of equal loudness
  19523. @item b_weighting(f)
  19524. B-weighting of equal loudness
  19525. @item c_weighting(f)
  19526. C-weighting of equal loudness.
  19527. @end table
  19528. Default value is @code{sono_v}.
  19529. @item sono_g, gamma
  19530. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19531. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19532. Acceptable range is @code{[1, 7]}.
  19533. @item bar_g, gamma2
  19534. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19535. @code{[1, 7]}.
  19536. @item bar_t
  19537. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19538. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19539. @item timeclamp, tc
  19540. Specify the transform timeclamp. At low frequency, there is trade-off between
  19541. accuracy in time domain and frequency domain. If timeclamp is lower,
  19542. event in time domain is represented more accurately (such as fast bass drum),
  19543. otherwise event in frequency domain is represented more accurately
  19544. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19545. @item attack
  19546. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19547. limits future samples by applying asymmetric windowing in time domain, useful
  19548. when low latency is required. Accepted range is @code{[0, 1]}.
  19549. @item basefreq
  19550. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19551. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19552. @item endfreq
  19553. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19554. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19555. @item coeffclamp
  19556. This option is deprecated and ignored.
  19557. @item tlength
  19558. Specify the transform length in time domain. Use this option to control accuracy
  19559. trade-off between time domain and frequency domain at every frequency sample.
  19560. It can contain variables:
  19561. @table @option
  19562. @item frequency, freq, f
  19563. the frequency where it is evaluated
  19564. @item timeclamp, tc
  19565. the value of @var{timeclamp} option.
  19566. @end table
  19567. Default value is @code{384*tc/(384+tc*f)}.
  19568. @item count
  19569. Specify the transform count for every video frame. Default value is @code{6}.
  19570. Acceptable range is @code{[1, 30]}.
  19571. @item fcount
  19572. Specify the transform count for every single pixel. Default value is @code{0},
  19573. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19574. @item fontfile
  19575. Specify font file for use with freetype to draw the axis. If not specified,
  19576. use embedded font. Note that drawing with font file or embedded font is not
  19577. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19578. option instead.
  19579. @item font
  19580. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19581. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19582. escaping.
  19583. @item fontcolor
  19584. Specify font color expression. This is arithmetic expression that should return
  19585. integer value 0xRRGGBB. It can contain variables:
  19586. @table @option
  19587. @item frequency, freq, f
  19588. the frequency where it is evaluated
  19589. @item timeclamp, tc
  19590. the value of @var{timeclamp} option
  19591. @end table
  19592. and functions:
  19593. @table @option
  19594. @item midi(f)
  19595. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19596. @item r(x), g(x), b(x)
  19597. red, green, and blue value of intensity x.
  19598. @end table
  19599. Default value is @code{st(0, (midi(f)-59.5)/12);
  19600. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19601. r(1-ld(1)) + b(ld(1))}.
  19602. @item axisfile
  19603. Specify image file to draw the axis. This option override @var{fontfile} and
  19604. @var{fontcolor} option.
  19605. @item axis, text
  19606. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19607. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19608. Default value is @code{1}.
  19609. @item csp
  19610. Set colorspace. The accepted values are:
  19611. @table @samp
  19612. @item unspecified
  19613. Unspecified (default)
  19614. @item bt709
  19615. BT.709
  19616. @item fcc
  19617. FCC
  19618. @item bt470bg
  19619. BT.470BG or BT.601-6 625
  19620. @item smpte170m
  19621. SMPTE-170M or BT.601-6 525
  19622. @item smpte240m
  19623. SMPTE-240M
  19624. @item bt2020ncl
  19625. BT.2020 with non-constant luminance
  19626. @end table
  19627. @item cscheme
  19628. Set spectrogram color scheme. This is list of floating point values with format
  19629. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19630. The default is @code{1|0.5|0|0|0.5|1}.
  19631. @end table
  19632. @subsection Examples
  19633. @itemize
  19634. @item
  19635. Playing audio while showing the spectrum:
  19636. @example
  19637. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19638. @end example
  19639. @item
  19640. Same as above, but with frame rate 30 fps:
  19641. @example
  19642. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19643. @end example
  19644. @item
  19645. Playing at 1280x720:
  19646. @example
  19647. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19648. @end example
  19649. @item
  19650. Disable sonogram display:
  19651. @example
  19652. sono_h=0
  19653. @end example
  19654. @item
  19655. A1 and its harmonics: A1, A2, (near)E3, A3:
  19656. @example
  19657. 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),
  19658. asplit[a][out1]; [a] showcqt [out0]'
  19659. @end example
  19660. @item
  19661. Same as above, but with more accuracy in frequency domain:
  19662. @example
  19663. 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),
  19664. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19665. @end example
  19666. @item
  19667. Custom volume:
  19668. @example
  19669. bar_v=10:sono_v=bar_v*a_weighting(f)
  19670. @end example
  19671. @item
  19672. Custom gamma, now spectrum is linear to the amplitude.
  19673. @example
  19674. bar_g=2:sono_g=2
  19675. @end example
  19676. @item
  19677. Custom tlength equation:
  19678. @example
  19679. 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)))'
  19680. @end example
  19681. @item
  19682. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19683. @example
  19684. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19685. @end example
  19686. @item
  19687. Custom font using fontconfig:
  19688. @example
  19689. font='Courier New,Monospace,mono|bold'
  19690. @end example
  19691. @item
  19692. Custom frequency range with custom axis using image file:
  19693. @example
  19694. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19695. @end example
  19696. @end itemize
  19697. @section showfreqs
  19698. Convert input audio to video output representing the audio power spectrum.
  19699. Audio amplitude is on Y-axis while frequency is on X-axis.
  19700. The filter accepts the following options:
  19701. @table @option
  19702. @item size, s
  19703. Specify size of video. For the syntax of this option, check the
  19704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19705. Default is @code{1024x512}.
  19706. @item mode
  19707. Set display mode.
  19708. This set how each frequency bin will be represented.
  19709. It accepts the following values:
  19710. @table @samp
  19711. @item line
  19712. @item bar
  19713. @item dot
  19714. @end table
  19715. Default is @code{bar}.
  19716. @item ascale
  19717. Set amplitude scale.
  19718. It accepts the following values:
  19719. @table @samp
  19720. @item lin
  19721. Linear scale.
  19722. @item sqrt
  19723. Square root scale.
  19724. @item cbrt
  19725. Cubic root scale.
  19726. @item log
  19727. Logarithmic scale.
  19728. @end table
  19729. Default is @code{log}.
  19730. @item fscale
  19731. Set frequency scale.
  19732. It accepts the following values:
  19733. @table @samp
  19734. @item lin
  19735. Linear scale.
  19736. @item log
  19737. Logarithmic scale.
  19738. @item rlog
  19739. Reverse logarithmic scale.
  19740. @end table
  19741. Default is @code{lin}.
  19742. @item win_size
  19743. Set window size. Allowed range is from 16 to 65536.
  19744. Default is @code{2048}
  19745. @item win_func
  19746. Set windowing function.
  19747. It accepts the following values:
  19748. @table @samp
  19749. @item rect
  19750. @item bartlett
  19751. @item hanning
  19752. @item hamming
  19753. @item blackman
  19754. @item welch
  19755. @item flattop
  19756. @item bharris
  19757. @item bnuttall
  19758. @item bhann
  19759. @item sine
  19760. @item nuttall
  19761. @item lanczos
  19762. @item gauss
  19763. @item tukey
  19764. @item dolph
  19765. @item cauchy
  19766. @item parzen
  19767. @item poisson
  19768. @item bohman
  19769. @end table
  19770. Default is @code{hanning}.
  19771. @item overlap
  19772. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19773. which means optimal overlap for selected window function will be picked.
  19774. @item averaging
  19775. Set time averaging. Setting this to 0 will display current maximal peaks.
  19776. Default is @code{1}, which means time averaging is disabled.
  19777. @item colors
  19778. Specify list of colors separated by space or by '|' which will be used to
  19779. draw channel frequencies. Unrecognized or missing colors will be replaced
  19780. by white color.
  19781. @item cmode
  19782. Set channel display mode.
  19783. It accepts the following values:
  19784. @table @samp
  19785. @item combined
  19786. @item separate
  19787. @end table
  19788. Default is @code{combined}.
  19789. @item minamp
  19790. Set minimum amplitude used in @code{log} amplitude scaler.
  19791. @item data
  19792. Set data display mode.
  19793. It accepts the following values:
  19794. @table @samp
  19795. @item magnitude
  19796. @item phase
  19797. @item delay
  19798. @end table
  19799. Default is @code{magnitude}.
  19800. @end table
  19801. @section showspatial
  19802. Convert stereo input audio to a video output, representing the spatial relationship
  19803. between two channels.
  19804. The filter accepts the following options:
  19805. @table @option
  19806. @item size, s
  19807. Specify the video size for the output. For the syntax of this option, check the
  19808. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19809. Default value is @code{512x512}.
  19810. @item win_size
  19811. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19812. @item win_func
  19813. Set window function.
  19814. It accepts the following values:
  19815. @table @samp
  19816. @item rect
  19817. @item bartlett
  19818. @item hann
  19819. @item hanning
  19820. @item hamming
  19821. @item blackman
  19822. @item welch
  19823. @item flattop
  19824. @item bharris
  19825. @item bnuttall
  19826. @item bhann
  19827. @item sine
  19828. @item nuttall
  19829. @item lanczos
  19830. @item gauss
  19831. @item tukey
  19832. @item dolph
  19833. @item cauchy
  19834. @item parzen
  19835. @item poisson
  19836. @item bohman
  19837. @end table
  19838. Default value is @code{hann}.
  19839. @item overlap
  19840. Set ratio of overlap window. Default value is @code{0.5}.
  19841. When value is @code{1} overlap is set to recommended size for specific
  19842. window function currently used.
  19843. @end table
  19844. @anchor{showspectrum}
  19845. @section showspectrum
  19846. Convert input audio to a video output, representing the audio frequency
  19847. spectrum.
  19848. The filter accepts the following options:
  19849. @table @option
  19850. @item size, s
  19851. Specify the video size for the output. For the syntax of this option, check the
  19852. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19853. Default value is @code{640x512}.
  19854. @item slide
  19855. Specify how the spectrum should slide along the window.
  19856. It accepts the following values:
  19857. @table @samp
  19858. @item replace
  19859. the samples start again on the left when they reach the right
  19860. @item scroll
  19861. the samples scroll from right to left
  19862. @item fullframe
  19863. frames are only produced when the samples reach the right
  19864. @item rscroll
  19865. the samples scroll from left to right
  19866. @end table
  19867. Default value is @code{replace}.
  19868. @item mode
  19869. Specify display mode.
  19870. It accepts the following values:
  19871. @table @samp
  19872. @item combined
  19873. all channels are displayed in the same row
  19874. @item separate
  19875. all channels are displayed in separate rows
  19876. @end table
  19877. Default value is @samp{combined}.
  19878. @item color
  19879. Specify display color mode.
  19880. It accepts the following values:
  19881. @table @samp
  19882. @item channel
  19883. each channel is displayed in a separate color
  19884. @item intensity
  19885. each channel is displayed using the same color scheme
  19886. @item rainbow
  19887. each channel is displayed using the rainbow color scheme
  19888. @item moreland
  19889. each channel is displayed using the moreland color scheme
  19890. @item nebulae
  19891. each channel is displayed using the nebulae color scheme
  19892. @item fire
  19893. each channel is displayed using the fire color scheme
  19894. @item fiery
  19895. each channel is displayed using the fiery color scheme
  19896. @item fruit
  19897. each channel is displayed using the fruit color scheme
  19898. @item cool
  19899. each channel is displayed using the cool color scheme
  19900. @item magma
  19901. each channel is displayed using the magma color scheme
  19902. @item green
  19903. each channel is displayed using the green color scheme
  19904. @item viridis
  19905. each channel is displayed using the viridis color scheme
  19906. @item plasma
  19907. each channel is displayed using the plasma color scheme
  19908. @item cividis
  19909. each channel is displayed using the cividis color scheme
  19910. @item terrain
  19911. each channel is displayed using the terrain color scheme
  19912. @end table
  19913. Default value is @samp{channel}.
  19914. @item scale
  19915. Specify scale used for calculating intensity color values.
  19916. It accepts the following values:
  19917. @table @samp
  19918. @item lin
  19919. linear
  19920. @item sqrt
  19921. square root, default
  19922. @item cbrt
  19923. cubic root
  19924. @item log
  19925. logarithmic
  19926. @item 4thrt
  19927. 4th root
  19928. @item 5thrt
  19929. 5th root
  19930. @end table
  19931. Default value is @samp{sqrt}.
  19932. @item fscale
  19933. Specify frequency scale.
  19934. It accepts the following values:
  19935. @table @samp
  19936. @item lin
  19937. linear
  19938. @item log
  19939. logarithmic
  19940. @end table
  19941. Default value is @samp{lin}.
  19942. @item saturation
  19943. Set saturation modifier for displayed colors. Negative values provide
  19944. alternative color scheme. @code{0} is no saturation at all.
  19945. Saturation must be in [-10.0, 10.0] range.
  19946. Default value is @code{1}.
  19947. @item win_func
  19948. Set window function.
  19949. It accepts the following values:
  19950. @table @samp
  19951. @item rect
  19952. @item bartlett
  19953. @item hann
  19954. @item hanning
  19955. @item hamming
  19956. @item blackman
  19957. @item welch
  19958. @item flattop
  19959. @item bharris
  19960. @item bnuttall
  19961. @item bhann
  19962. @item sine
  19963. @item nuttall
  19964. @item lanczos
  19965. @item gauss
  19966. @item tukey
  19967. @item dolph
  19968. @item cauchy
  19969. @item parzen
  19970. @item poisson
  19971. @item bohman
  19972. @end table
  19973. Default value is @code{hann}.
  19974. @item orientation
  19975. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19976. @code{horizontal}. Default is @code{vertical}.
  19977. @item overlap
  19978. Set ratio of overlap window. Default value is @code{0}.
  19979. When value is @code{1} overlap is set to recommended size for specific
  19980. window function currently used.
  19981. @item gain
  19982. Set scale gain for calculating intensity color values.
  19983. Default value is @code{1}.
  19984. @item data
  19985. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19986. @item rotation
  19987. Set color rotation, must be in [-1.0, 1.0] range.
  19988. Default value is @code{0}.
  19989. @item start
  19990. Set start frequency from which to display spectrogram. Default is @code{0}.
  19991. @item stop
  19992. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19993. @item fps
  19994. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19995. @item legend
  19996. Draw time and frequency axes and legends. Default is disabled.
  19997. @end table
  19998. The usage is very similar to the showwaves filter; see the examples in that
  19999. section.
  20000. @subsection Examples
  20001. @itemize
  20002. @item
  20003. Large window with logarithmic color scaling:
  20004. @example
  20005. showspectrum=s=1280x480:scale=log
  20006. @end example
  20007. @item
  20008. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  20009. @example
  20010. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  20011. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  20012. @end example
  20013. @end itemize
  20014. @section showspectrumpic
  20015. Convert input audio to a single video frame, representing the audio frequency
  20016. spectrum.
  20017. The filter accepts the following options:
  20018. @table @option
  20019. @item size, s
  20020. Specify the video size for the output. For the syntax of this option, check the
  20021. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20022. Default value is @code{4096x2048}.
  20023. @item mode
  20024. Specify display mode.
  20025. It accepts the following values:
  20026. @table @samp
  20027. @item combined
  20028. all channels are displayed in the same row
  20029. @item separate
  20030. all channels are displayed in separate rows
  20031. @end table
  20032. Default value is @samp{combined}.
  20033. @item color
  20034. Specify display color mode.
  20035. It accepts the following values:
  20036. @table @samp
  20037. @item channel
  20038. each channel is displayed in a separate color
  20039. @item intensity
  20040. each channel is displayed using the same color scheme
  20041. @item rainbow
  20042. each channel is displayed using the rainbow color scheme
  20043. @item moreland
  20044. each channel is displayed using the moreland color scheme
  20045. @item nebulae
  20046. each channel is displayed using the nebulae color scheme
  20047. @item fire
  20048. each channel is displayed using the fire color scheme
  20049. @item fiery
  20050. each channel is displayed using the fiery color scheme
  20051. @item fruit
  20052. each channel is displayed using the fruit color scheme
  20053. @item cool
  20054. each channel is displayed using the cool color scheme
  20055. @item magma
  20056. each channel is displayed using the magma color scheme
  20057. @item green
  20058. each channel is displayed using the green color scheme
  20059. @item viridis
  20060. each channel is displayed using the viridis color scheme
  20061. @item plasma
  20062. each channel is displayed using the plasma color scheme
  20063. @item cividis
  20064. each channel is displayed using the cividis color scheme
  20065. @item terrain
  20066. each channel is displayed using the terrain color scheme
  20067. @end table
  20068. Default value is @samp{intensity}.
  20069. @item scale
  20070. Specify scale used for calculating intensity color values.
  20071. It accepts the following values:
  20072. @table @samp
  20073. @item lin
  20074. linear
  20075. @item sqrt
  20076. square root, default
  20077. @item cbrt
  20078. cubic root
  20079. @item log
  20080. logarithmic
  20081. @item 4thrt
  20082. 4th root
  20083. @item 5thrt
  20084. 5th root
  20085. @end table
  20086. Default value is @samp{log}.
  20087. @item fscale
  20088. Specify frequency scale.
  20089. It accepts the following values:
  20090. @table @samp
  20091. @item lin
  20092. linear
  20093. @item log
  20094. logarithmic
  20095. @end table
  20096. Default value is @samp{lin}.
  20097. @item saturation
  20098. Set saturation modifier for displayed colors. Negative values provide
  20099. alternative color scheme. @code{0} is no saturation at all.
  20100. Saturation must be in [-10.0, 10.0] range.
  20101. Default value is @code{1}.
  20102. @item win_func
  20103. Set window function.
  20104. It accepts the following values:
  20105. @table @samp
  20106. @item rect
  20107. @item bartlett
  20108. @item hann
  20109. @item hanning
  20110. @item hamming
  20111. @item blackman
  20112. @item welch
  20113. @item flattop
  20114. @item bharris
  20115. @item bnuttall
  20116. @item bhann
  20117. @item sine
  20118. @item nuttall
  20119. @item lanczos
  20120. @item gauss
  20121. @item tukey
  20122. @item dolph
  20123. @item cauchy
  20124. @item parzen
  20125. @item poisson
  20126. @item bohman
  20127. @end table
  20128. Default value is @code{hann}.
  20129. @item orientation
  20130. Set orientation of time vs frequency axis. Can be @code{vertical} or
  20131. @code{horizontal}. Default is @code{vertical}.
  20132. @item gain
  20133. Set scale gain for calculating intensity color values.
  20134. Default value is @code{1}.
  20135. @item legend
  20136. Draw time and frequency axes and legends. Default is enabled.
  20137. @item rotation
  20138. Set color rotation, must be in [-1.0, 1.0] range.
  20139. Default value is @code{0}.
  20140. @item start
  20141. Set start frequency from which to display spectrogram. Default is @code{0}.
  20142. @item stop
  20143. Set stop frequency to which to display spectrogram. Default is @code{0}.
  20144. @end table
  20145. @subsection Examples
  20146. @itemize
  20147. @item
  20148. Extract an audio spectrogram of a whole audio track
  20149. in a 1024x1024 picture using @command{ffmpeg}:
  20150. @example
  20151. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  20152. @end example
  20153. @end itemize
  20154. @section showvolume
  20155. Convert input audio volume to a video output.
  20156. The filter accepts the following options:
  20157. @table @option
  20158. @item rate, r
  20159. Set video rate.
  20160. @item b
  20161. Set border width, allowed range is [0, 5]. Default is 1.
  20162. @item w
  20163. Set channel width, allowed range is [80, 8192]. Default is 400.
  20164. @item h
  20165. Set channel height, allowed range is [1, 900]. Default is 20.
  20166. @item f
  20167. Set fade, allowed range is [0, 1]. Default is 0.95.
  20168. @item c
  20169. Set volume color expression.
  20170. The expression can use the following variables:
  20171. @table @option
  20172. @item VOLUME
  20173. Current max volume of channel in dB.
  20174. @item PEAK
  20175. Current peak.
  20176. @item CHANNEL
  20177. Current channel number, starting from 0.
  20178. @end table
  20179. @item t
  20180. If set, displays channel names. Default is enabled.
  20181. @item v
  20182. If set, displays volume values. Default is enabled.
  20183. @item o
  20184. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  20185. default is @code{h}.
  20186. @item s
  20187. Set step size, allowed range is [0, 5]. Default is 0, which means
  20188. step is disabled.
  20189. @item p
  20190. Set background opacity, allowed range is [0, 1]. Default is 0.
  20191. @item m
  20192. Set metering mode, can be peak: @code{p} or rms: @code{r},
  20193. default is @code{p}.
  20194. @item ds
  20195. Set display scale, can be linear: @code{lin} or log: @code{log},
  20196. default is @code{lin}.
  20197. @item dm
  20198. In second.
  20199. If set to > 0., display a line for the max level
  20200. in the previous seconds.
  20201. default is disabled: @code{0.}
  20202. @item dmc
  20203. The color of the max line. Use when @code{dm} option is set to > 0.
  20204. default is: @code{orange}
  20205. @end table
  20206. @section showwaves
  20207. Convert input audio to a video output, representing the samples waves.
  20208. The filter accepts the following options:
  20209. @table @option
  20210. @item size, s
  20211. Specify the video size for the output. For the syntax of this option, check the
  20212. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20213. Default value is @code{600x240}.
  20214. @item mode
  20215. Set display mode.
  20216. Available values are:
  20217. @table @samp
  20218. @item point
  20219. Draw a point for each sample.
  20220. @item line
  20221. Draw a vertical line for each sample.
  20222. @item p2p
  20223. Draw a point for each sample and a line between them.
  20224. @item cline
  20225. Draw a centered vertical line for each sample.
  20226. @end table
  20227. Default value is @code{point}.
  20228. @item n
  20229. Set the number of samples which are printed on the same column. A
  20230. larger value will decrease the frame rate. Must be a positive
  20231. integer. This option can be set only if the value for @var{rate}
  20232. is not explicitly specified.
  20233. @item rate, r
  20234. Set the (approximate) output frame rate. This is done by setting the
  20235. option @var{n}. Default value is "25".
  20236. @item split_channels
  20237. Set if channels should be drawn separately or overlap. Default value is 0.
  20238. @item colors
  20239. Set colors separated by '|' which are going to be used for drawing of each channel.
  20240. @item scale
  20241. Set amplitude scale.
  20242. Available values are:
  20243. @table @samp
  20244. @item lin
  20245. Linear.
  20246. @item log
  20247. Logarithmic.
  20248. @item sqrt
  20249. Square root.
  20250. @item cbrt
  20251. Cubic root.
  20252. @end table
  20253. Default is linear.
  20254. @item draw
  20255. Set the draw mode. This is mostly useful to set for high @var{n}.
  20256. Available values are:
  20257. @table @samp
  20258. @item scale
  20259. Scale pixel values for each drawn sample.
  20260. @item full
  20261. Draw every sample directly.
  20262. @end table
  20263. Default value is @code{scale}.
  20264. @end table
  20265. @subsection Examples
  20266. @itemize
  20267. @item
  20268. Output the input file audio and the corresponding video representation
  20269. at the same time:
  20270. @example
  20271. amovie=a.mp3,asplit[out0],showwaves[out1]
  20272. @end example
  20273. @item
  20274. Create a synthetic signal and show it with showwaves, forcing a
  20275. frame rate of 30 frames per second:
  20276. @example
  20277. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  20278. @end example
  20279. @end itemize
  20280. @section showwavespic
  20281. Convert input audio to a single video frame, representing the samples waves.
  20282. The filter accepts the following options:
  20283. @table @option
  20284. @item size, s
  20285. Specify the video size for the output. For the syntax of this option, check the
  20286. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20287. Default value is @code{600x240}.
  20288. @item split_channels
  20289. Set if channels should be drawn separately or overlap. Default value is 0.
  20290. @item colors
  20291. Set colors separated by '|' which are going to be used for drawing of each channel.
  20292. @item scale
  20293. Set amplitude scale.
  20294. Available values are:
  20295. @table @samp
  20296. @item lin
  20297. Linear.
  20298. @item log
  20299. Logarithmic.
  20300. @item sqrt
  20301. Square root.
  20302. @item cbrt
  20303. Cubic root.
  20304. @end table
  20305. Default is linear.
  20306. @item draw
  20307. Set the draw mode.
  20308. Available values are:
  20309. @table @samp
  20310. @item scale
  20311. Scale pixel values for each drawn sample.
  20312. @item full
  20313. Draw every sample directly.
  20314. @end table
  20315. Default value is @code{scale}.
  20316. @item filter
  20317. Set the filter mode.
  20318. Available values are:
  20319. @table @samp
  20320. @item average
  20321. Use average samples values for each drawn sample.
  20322. @item peak
  20323. Use peak samples values for each drawn sample.
  20324. @end table
  20325. Default value is @code{average}.
  20326. @end table
  20327. @subsection Examples
  20328. @itemize
  20329. @item
  20330. Extract a channel split representation of the wave form of a whole audio track
  20331. in a 1024x800 picture using @command{ffmpeg}:
  20332. @example
  20333. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  20334. @end example
  20335. @end itemize
  20336. @section sidedata, asidedata
  20337. Delete frame side data, or select frames based on it.
  20338. This filter accepts the following options:
  20339. @table @option
  20340. @item mode
  20341. Set mode of operation of the filter.
  20342. Can be one of the following:
  20343. @table @samp
  20344. @item select
  20345. Select every frame with side data of @code{type}.
  20346. @item delete
  20347. Delete side data of @code{type}. If @code{type} is not set, delete all side
  20348. data in the frame.
  20349. @end table
  20350. @item type
  20351. Set side data type used with all modes. Must be set for @code{select} mode. For
  20352. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  20353. in @file{libavutil/frame.h}. For example, to choose
  20354. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  20355. @end table
  20356. @section spectrumsynth
  20357. Synthesize audio from 2 input video spectrums, first input stream represents
  20358. magnitude across time and second represents phase across time.
  20359. The filter will transform from frequency domain as displayed in videos back
  20360. to time domain as presented in audio output.
  20361. This filter is primarily created for reversing processed @ref{showspectrum}
  20362. filter outputs, but can synthesize sound from other spectrograms too.
  20363. But in such case results are going to be poor if the phase data is not
  20364. available, because in such cases phase data need to be recreated, usually
  20365. it's just recreated from random noise.
  20366. For best results use gray only output (@code{channel} color mode in
  20367. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  20368. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  20369. @code{data} option. Inputs videos should generally use @code{fullframe}
  20370. slide mode as that saves resources needed for decoding video.
  20371. The filter accepts the following options:
  20372. @table @option
  20373. @item sample_rate
  20374. Specify sample rate of output audio, the sample rate of audio from which
  20375. spectrum was generated may differ.
  20376. @item channels
  20377. Set number of channels represented in input video spectrums.
  20378. @item scale
  20379. Set scale which was used when generating magnitude input spectrum.
  20380. Can be @code{lin} or @code{log}. Default is @code{log}.
  20381. @item slide
  20382. Set slide which was used when generating inputs spectrums.
  20383. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  20384. Default is @code{fullframe}.
  20385. @item win_func
  20386. Set window function used for resynthesis.
  20387. @item overlap
  20388. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20389. which means optimal overlap for selected window function will be picked.
  20390. @item orientation
  20391. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  20392. Default is @code{vertical}.
  20393. @end table
  20394. @subsection Examples
  20395. @itemize
  20396. @item
  20397. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  20398. then resynthesize videos back to audio with spectrumsynth:
  20399. @example
  20400. 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
  20401. 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
  20402. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  20403. @end example
  20404. @end itemize
  20405. @section split, asplit
  20406. Split input into several identical outputs.
  20407. @code{asplit} works with audio input, @code{split} with video.
  20408. The filter accepts a single parameter which specifies the number of outputs. If
  20409. unspecified, it defaults to 2.
  20410. @subsection Examples
  20411. @itemize
  20412. @item
  20413. Create two separate outputs from the same input:
  20414. @example
  20415. [in] split [out0][out1]
  20416. @end example
  20417. @item
  20418. To create 3 or more outputs, you need to specify the number of
  20419. outputs, like in:
  20420. @example
  20421. [in] asplit=3 [out0][out1][out2]
  20422. @end example
  20423. @item
  20424. Create two separate outputs from the same input, one cropped and
  20425. one padded:
  20426. @example
  20427. [in] split [splitout1][splitout2];
  20428. [splitout1] crop=100:100:0:0 [cropout];
  20429. [splitout2] pad=200:200:100:100 [padout];
  20430. @end example
  20431. @item
  20432. Create 5 copies of the input audio with @command{ffmpeg}:
  20433. @example
  20434. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20435. @end example
  20436. @end itemize
  20437. @section zmq, azmq
  20438. Receive commands sent through a libzmq client, and forward them to
  20439. filters in the filtergraph.
  20440. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20441. must be inserted between two video filters, @code{azmq} between two
  20442. audio filters. Both are capable to send messages to any filter type.
  20443. To enable these filters you need to install the libzmq library and
  20444. headers and configure FFmpeg with @code{--enable-libzmq}.
  20445. For more information about libzmq see:
  20446. @url{http://www.zeromq.org/}
  20447. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20448. receives messages sent through a network interface defined by the
  20449. @option{bind_address} (or the abbreviation "@option{b}") option.
  20450. Default value of this option is @file{tcp://localhost:5555}. You may
  20451. want to alter this value to your needs, but do not forget to escape any
  20452. ':' signs (see @ref{filtergraph escaping}).
  20453. The received message must be in the form:
  20454. @example
  20455. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20456. @end example
  20457. @var{TARGET} specifies the target of the command, usually the name of
  20458. the filter class or a specific filter instance name. The default
  20459. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20460. but you can override this by using the @samp{filter_name@@id} syntax
  20461. (see @ref{Filtergraph syntax}).
  20462. @var{COMMAND} specifies the name of the command for the target filter.
  20463. @var{ARG} is optional and specifies the optional argument list for the
  20464. given @var{COMMAND}.
  20465. Upon reception, the message is processed and the corresponding command
  20466. is injected into the filtergraph. Depending on the result, the filter
  20467. will send a reply to the client, adopting the format:
  20468. @example
  20469. @var{ERROR_CODE} @var{ERROR_REASON}
  20470. @var{MESSAGE}
  20471. @end example
  20472. @var{MESSAGE} is optional.
  20473. @subsection Examples
  20474. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20475. be used to send commands processed by these filters.
  20476. Consider the following filtergraph generated by @command{ffplay}.
  20477. In this example the last overlay filter has an instance name. All other
  20478. filters will have default instance names.
  20479. @example
  20480. ffplay -dumpgraph 1 -f lavfi "
  20481. color=s=100x100:c=red [l];
  20482. color=s=100x100:c=blue [r];
  20483. nullsrc=s=200x100, zmq [bg];
  20484. [bg][l] overlay [bg+l];
  20485. [bg+l][r] overlay@@my=x=100 "
  20486. @end example
  20487. To change the color of the left side of the video, the following
  20488. command can be used:
  20489. @example
  20490. echo Parsed_color_0 c yellow | tools/zmqsend
  20491. @end example
  20492. To change the right side:
  20493. @example
  20494. echo Parsed_color_1 c pink | tools/zmqsend
  20495. @end example
  20496. To change the position of the right side:
  20497. @example
  20498. echo overlay@@my x 150 | tools/zmqsend
  20499. @end example
  20500. @c man end MULTIMEDIA FILTERS
  20501. @chapter Multimedia Sources
  20502. @c man begin MULTIMEDIA SOURCES
  20503. Below is a description of the currently available multimedia sources.
  20504. @section amovie
  20505. This is the same as @ref{movie} source, except it selects an audio
  20506. stream by default.
  20507. @anchor{movie}
  20508. @section movie
  20509. Read audio and/or video stream(s) from a movie container.
  20510. It accepts the following parameters:
  20511. @table @option
  20512. @item filename
  20513. The name of the resource to read (not necessarily a file; it can also be a
  20514. device or a stream accessed through some protocol).
  20515. @item format_name, f
  20516. Specifies the format assumed for the movie to read, and can be either
  20517. the name of a container or an input device. If not specified, the
  20518. format is guessed from @var{movie_name} or by probing.
  20519. @item seek_point, sp
  20520. Specifies the seek point in seconds. The frames will be output
  20521. starting from this seek point. The parameter is evaluated with
  20522. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20523. postfix. The default value is "0".
  20524. @item streams, s
  20525. Specifies the streams to read. Several streams can be specified,
  20526. separated by "+". The source will then have as many outputs, in the
  20527. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20528. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20529. respectively the default (best suited) video and audio stream. Default
  20530. is "dv", or "da" if the filter is called as "amovie".
  20531. @item stream_index, si
  20532. Specifies the index of the video stream to read. If the value is -1,
  20533. the most suitable video stream will be automatically selected. The default
  20534. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20535. audio instead of video.
  20536. @item loop
  20537. Specifies how many times to read the stream in sequence.
  20538. If the value is 0, the stream will be looped infinitely.
  20539. Default value is "1".
  20540. Note that when the movie is looped the source timestamps are not
  20541. changed, so it will generate non monotonically increasing timestamps.
  20542. @item discontinuity
  20543. Specifies the time difference between frames above which the point is
  20544. considered a timestamp discontinuity which is removed by adjusting the later
  20545. timestamps.
  20546. @end table
  20547. It allows overlaying a second video on top of the main input of
  20548. a filtergraph, as shown in this graph:
  20549. @example
  20550. input -----------> deltapts0 --> overlay --> output
  20551. ^
  20552. |
  20553. movie --> scale--> deltapts1 -------+
  20554. @end example
  20555. @subsection Examples
  20556. @itemize
  20557. @item
  20558. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20559. on top of the input labelled "in":
  20560. @example
  20561. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20562. [in] setpts=PTS-STARTPTS [main];
  20563. [main][over] overlay=16:16 [out]
  20564. @end example
  20565. @item
  20566. Read from a video4linux2 device, and overlay it on top of the input
  20567. labelled "in":
  20568. @example
  20569. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20570. [in] setpts=PTS-STARTPTS [main];
  20571. [main][over] overlay=16:16 [out]
  20572. @end example
  20573. @item
  20574. Read the first video stream and the audio stream with id 0x81 from
  20575. dvd.vob; the video is connected to the pad named "video" and the audio is
  20576. connected to the pad named "audio":
  20577. @example
  20578. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20579. @end example
  20580. @end itemize
  20581. @subsection Commands
  20582. Both movie and amovie support the following commands:
  20583. @table @option
  20584. @item seek
  20585. Perform seek using "av_seek_frame".
  20586. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20587. @itemize
  20588. @item
  20589. @var{stream_index}: If stream_index is -1, a default
  20590. stream is selected, and @var{timestamp} is automatically converted
  20591. from AV_TIME_BASE units to the stream specific time_base.
  20592. @item
  20593. @var{timestamp}: Timestamp in AVStream.time_base units
  20594. or, if no stream is specified, in AV_TIME_BASE units.
  20595. @item
  20596. @var{flags}: Flags which select direction and seeking mode.
  20597. @end itemize
  20598. @item get_duration
  20599. Get movie duration in AV_TIME_BASE units.
  20600. @end table
  20601. @c man end MULTIMEDIA SOURCES