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.

26864 lines
712KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @section acue
  505. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  506. filter.
  507. @section adeclick
  508. Remove impulsive noise from input audio.
  509. Samples detected as impulsive noise are replaced by interpolated samples using
  510. autoregressive modelling.
  511. @table @option
  512. @item w
  513. Set window size, in milliseconds. Allowed range is from @code{10} to
  514. @code{100}. Default value is @code{55} milliseconds.
  515. This sets size of window which will be processed at once.
  516. @item o
  517. Set window overlap, in percentage of window size. Allowed range is from
  518. @code{50} to @code{95}. Default value is @code{75} percent.
  519. Setting this to a very high value increases impulsive noise removal but makes
  520. whole process much slower.
  521. @item a
  522. Set autoregression order, in percentage of window size. Allowed range is from
  523. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  524. controls quality of interpolated samples using neighbour good samples.
  525. @item t
  526. Set threshold value. Allowed range is from @code{1} to @code{100}.
  527. Default value is @code{2}.
  528. This controls the strength of impulsive noise which is going to be removed.
  529. The lower value, the more samples will be detected as impulsive noise.
  530. @item b
  531. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  532. @code{10}. Default value is @code{2}.
  533. If any two samples detected as noise are spaced less than this value then any
  534. sample between those two samples will be also detected as noise.
  535. @item m
  536. Set overlap method.
  537. It accepts the following values:
  538. @table @option
  539. @item a
  540. Select overlap-add method. Even not interpolated samples are slightly
  541. changed with this method.
  542. @item s
  543. Select overlap-save method. Not interpolated samples remain unchanged.
  544. @end table
  545. Default value is @code{a}.
  546. @end table
  547. @section adeclip
  548. Remove clipped samples from input audio.
  549. Samples detected as clipped are replaced by interpolated samples using
  550. autoregressive modelling.
  551. @table @option
  552. @item w
  553. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  554. Default value is @code{55} milliseconds.
  555. This sets size of window which will be processed at once.
  556. @item o
  557. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  558. to @code{95}. Default value is @code{75} percent.
  559. @item a
  560. Set autoregression order, in percentage of window size. Allowed range is from
  561. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  562. quality of interpolated samples using neighbour good samples.
  563. @item t
  564. Set threshold value. Allowed range is from @code{1} to @code{100}.
  565. Default value is @code{10}. Higher values make clip detection less aggressive.
  566. @item n
  567. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  568. Default value is @code{1000}. Higher values make clip detection less aggressive.
  569. @item m
  570. Set overlap method.
  571. It accepts the following values:
  572. @table @option
  573. @item a
  574. Select overlap-add method. Even not interpolated samples are slightly changed
  575. with this method.
  576. @item s
  577. Select overlap-save method. Not interpolated samples remain unchanged.
  578. @end table
  579. Default value is @code{a}.
  580. @end table
  581. @section adelay
  582. Delay one or more audio channels.
  583. Samples in delayed channel are filled with silence.
  584. The filter accepts the following option:
  585. @table @option
  586. @item delays
  587. Set list of delays in milliseconds for each channel separated by '|'.
  588. Unused delays will be silently ignored. If number of given delays is
  589. smaller than number of channels all remaining channels will not be delayed.
  590. If you want to delay exact number of samples, append 'S' to number.
  591. If you want instead to delay in seconds, append 's' to number.
  592. @item all
  593. Use last set delay for all remaining channels. By default is disabled.
  594. This option if enabled changes how option @code{delays} is interpreted.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  600. the second channel (and any other channels that may be present) unchanged.
  601. @example
  602. adelay=1500|0|500
  603. @end example
  604. @item
  605. Delay second channel by 500 samples, the third channel by 700 samples and leave
  606. the first channel (and any other channels that may be present) unchanged.
  607. @example
  608. adelay=0|500S|700S
  609. @end example
  610. @item
  611. Delay all channels by same number of samples:
  612. @example
  613. adelay=delays=64S:all=1
  614. @end example
  615. @end itemize
  616. @section adenorm
  617. Remedy denormals in audio by adding extremely low-level noise.
  618. This filter shall be placed before any filter that can produce denormals.
  619. A description of the accepted parameters follows.
  620. @table @option
  621. @item level
  622. Set level of added noise in dB. Default is @code{-351}.
  623. Allowed range is from -451 to -90.
  624. @item type
  625. Set type of added noise.
  626. @table @option
  627. @item dc
  628. Add DC signal.
  629. @item ac
  630. Add AC signal.
  631. @item square
  632. Add square signal.
  633. @item pulse
  634. Add pulse signal.
  635. @end table
  636. Default is @code{dc}.
  637. @end table
  638. @subsection Commands
  639. This filter supports the all above options as @ref{commands}.
  640. @section aderivative, aintegral
  641. Compute derivative/integral of audio stream.
  642. Applying both filters one after another produces original audio.
  643. @section aecho
  644. Apply echoing to the input audio.
  645. Echoes are reflected sound and can occur naturally amongst mountains
  646. (and sometimes large buildings) when talking or shouting; digital echo
  647. effects emulate this behaviour and are often used to help fill out the
  648. sound of a single instrument or vocal. The time difference between the
  649. original signal and the reflection is the @code{delay}, and the
  650. loudness of the reflected signal is the @code{decay}.
  651. Multiple echoes can have different delays and decays.
  652. A description of the accepted parameters follows.
  653. @table @option
  654. @item in_gain
  655. Set input gain of reflected signal. Default is @code{0.6}.
  656. @item out_gain
  657. Set output gain of reflected signal. Default is @code{0.3}.
  658. @item delays
  659. Set list of time intervals in milliseconds between original signal and reflections
  660. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  661. Default is @code{1000}.
  662. @item decays
  663. Set list of loudness of reflected signals separated by '|'.
  664. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  665. Default is @code{0.5}.
  666. @end table
  667. @subsection Examples
  668. @itemize
  669. @item
  670. Make it sound as if there are twice as many instruments as are actually playing:
  671. @example
  672. aecho=0.8:0.88:60:0.4
  673. @end example
  674. @item
  675. If delay is very short, then it sounds like a (metallic) robot playing music:
  676. @example
  677. aecho=0.8:0.88:6:0.4
  678. @end example
  679. @item
  680. A longer delay will sound like an open air concert in the mountains:
  681. @example
  682. aecho=0.8:0.9:1000:0.3
  683. @end example
  684. @item
  685. Same as above but with one more mountain:
  686. @example
  687. aecho=0.8:0.9:1000|1800:0.3|0.25
  688. @end example
  689. @end itemize
  690. @section aemphasis
  691. Audio emphasis filter creates or restores material directly taken from LPs or
  692. emphased CDs with different filter curves. E.g. to store music on vinyl the
  693. signal has to be altered by a filter first to even out the disadvantages of
  694. this recording medium.
  695. Once the material is played back the inverse filter has to be applied to
  696. restore the distortion of the frequency response.
  697. The filter accepts the following options:
  698. @table @option
  699. @item level_in
  700. Set input gain.
  701. @item level_out
  702. Set output gain.
  703. @item mode
  704. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  705. use @code{production} mode. Default is @code{reproduction} mode.
  706. @item type
  707. Set filter type. Selects medium. Can be one of the following:
  708. @table @option
  709. @item col
  710. select Columbia.
  711. @item emi
  712. select EMI.
  713. @item bsi
  714. select BSI (78RPM).
  715. @item riaa
  716. select RIAA.
  717. @item cd
  718. select Compact Disc (CD).
  719. @item 50fm
  720. select 50µs (FM).
  721. @item 75fm
  722. select 75µs (FM).
  723. @item 50kf
  724. select 50µs (FM-KF).
  725. @item 75kf
  726. select 75µs (FM-KF).
  727. @end table
  728. @end table
  729. @subsection Commands
  730. This filter supports the all above options as @ref{commands}.
  731. @section aeval
  732. Modify an audio signal according to the specified expressions.
  733. This filter accepts one or more expressions (one for each channel),
  734. which are evaluated and used to modify a corresponding audio signal.
  735. It accepts the following parameters:
  736. @table @option
  737. @item exprs
  738. Set the '|'-separated expressions list for each separate channel. If
  739. the number of input channels is greater than the number of
  740. expressions, the last specified expression is used for the remaining
  741. output channels.
  742. @item channel_layout, c
  743. Set output channel layout. If not specified, the channel layout is
  744. specified by the number of expressions. If set to @samp{same}, it will
  745. use by default the same input channel layout.
  746. @end table
  747. Each expression in @var{exprs} can contain the following constants and functions:
  748. @table @option
  749. @item ch
  750. channel number of the current expression
  751. @item n
  752. number of the evaluated sample, starting from 0
  753. @item s
  754. sample rate
  755. @item t
  756. time of the evaluated sample expressed in seconds
  757. @item nb_in_channels
  758. @item nb_out_channels
  759. input and output number of channels
  760. @item val(CH)
  761. the value of input channel with number @var{CH}
  762. @end table
  763. Note: this filter is slow. For faster processing you should use a
  764. dedicated filter.
  765. @subsection Examples
  766. @itemize
  767. @item
  768. Half volume:
  769. @example
  770. aeval=val(ch)/2:c=same
  771. @end example
  772. @item
  773. Invert phase of the second channel:
  774. @example
  775. aeval=val(0)|-val(1)
  776. @end example
  777. @end itemize
  778. @anchor{afade}
  779. @section afade
  780. Apply fade-in/out effect to input audio.
  781. A description of the accepted parameters follows.
  782. @table @option
  783. @item type, t
  784. Specify the effect type, can be either @code{in} for fade-in, or
  785. @code{out} for a fade-out effect. Default is @code{in}.
  786. @item start_sample, ss
  787. Specify the number of the start sample for starting to apply the fade
  788. effect. Default is 0.
  789. @item nb_samples, ns
  790. Specify the number of samples for which the fade effect has to last. At
  791. the end of the fade-in effect the output audio will have the same
  792. volume as the input audio, at the end of the fade-out transition
  793. the output audio will be silence. Default is 44100.
  794. @item start_time, st
  795. Specify the start time of the fade effect. Default is 0.
  796. The value must be specified as a time duration; see
  797. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  798. for the accepted syntax.
  799. If set this option is used instead of @var{start_sample}.
  800. @item duration, d
  801. Specify the duration of the fade effect. See
  802. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  803. for the accepted syntax.
  804. At the end of the fade-in effect the output audio will have the same
  805. volume as the input audio, at the end of the fade-out transition
  806. the output audio will be silence.
  807. By default the duration is determined by @var{nb_samples}.
  808. If set this option is used instead of @var{nb_samples}.
  809. @item curve
  810. Set curve for fade transition.
  811. It accepts the following values:
  812. @table @option
  813. @item tri
  814. select triangular, linear slope (default)
  815. @item qsin
  816. select quarter of sine wave
  817. @item hsin
  818. select half of sine wave
  819. @item esin
  820. select exponential sine wave
  821. @item log
  822. select logarithmic
  823. @item ipar
  824. select inverted parabola
  825. @item qua
  826. select quadratic
  827. @item cub
  828. select cubic
  829. @item squ
  830. select square root
  831. @item cbr
  832. select cubic root
  833. @item par
  834. select parabola
  835. @item exp
  836. select exponential
  837. @item iqsin
  838. select inverted quarter of sine wave
  839. @item ihsin
  840. select inverted half of sine wave
  841. @item dese
  842. select double-exponential seat
  843. @item desi
  844. select double-exponential sigmoid
  845. @item losi
  846. select logistic sigmoid
  847. @item sinc
  848. select sine cardinal function
  849. @item isinc
  850. select inverted sine cardinal function
  851. @item nofade
  852. no fade applied
  853. @end table
  854. @end table
  855. @subsection Commands
  856. This filter supports the all above options as @ref{commands}.
  857. @subsection Examples
  858. @itemize
  859. @item
  860. Fade in first 15 seconds of audio:
  861. @example
  862. afade=t=in:ss=0:d=15
  863. @end example
  864. @item
  865. Fade out last 25 seconds of a 900 seconds audio:
  866. @example
  867. afade=t=out:st=875:d=25
  868. @end example
  869. @end itemize
  870. @section afftdn
  871. Denoise audio samples with FFT.
  872. A description of the accepted parameters follows.
  873. @table @option
  874. @item nr
  875. Set the noise reduction in dB, allowed range is 0.01 to 97.
  876. Default value is 12 dB.
  877. @item nf
  878. Set the noise floor in dB, allowed range is -80 to -20.
  879. Default value is -50 dB.
  880. @item nt
  881. Set the noise type.
  882. It accepts the following values:
  883. @table @option
  884. @item w
  885. Select white noise.
  886. @item v
  887. Select vinyl noise.
  888. @item s
  889. Select shellac noise.
  890. @item c
  891. Select custom noise, defined in @code{bn} option.
  892. Default value is white noise.
  893. @end table
  894. @item bn
  895. Set custom band noise for every one of 15 bands.
  896. Bands are separated by ' ' or '|'.
  897. @item rf
  898. Set the residual floor in dB, allowed range is -80 to -20.
  899. Default value is -38 dB.
  900. @item tn
  901. Enable noise tracking. By default is disabled.
  902. With this enabled, noise floor is automatically adjusted.
  903. @item tr
  904. Enable residual tracking. By default is disabled.
  905. @item om
  906. Set the output mode.
  907. It accepts the following values:
  908. @table @option
  909. @item i
  910. Pass input unchanged.
  911. @item o
  912. Pass noise filtered out.
  913. @item n
  914. Pass only noise.
  915. Default value is @var{o}.
  916. @end table
  917. @end table
  918. @subsection Commands
  919. This filter supports the following commands:
  920. @table @option
  921. @item sample_noise, sn
  922. Start or stop measuring noise profile.
  923. Syntax for the command is : "start" or "stop" string.
  924. After measuring noise profile is stopped it will be
  925. automatically applied in filtering.
  926. @item noise_reduction, nr
  927. Change noise reduction. Argument is single float number.
  928. Syntax for the command is : "@var{noise_reduction}"
  929. @item noise_floor, nf
  930. Change noise floor. Argument is single float number.
  931. Syntax for the command is : "@var{noise_floor}"
  932. @item output_mode, om
  933. Change output mode operation.
  934. Syntax for the command is : "i", "o" or "n" string.
  935. @end table
  936. @section afftfilt
  937. Apply arbitrary expressions to samples in frequency domain.
  938. @table @option
  939. @item real
  940. Set frequency domain real expression for each separate channel separated
  941. by '|'. Default is "re".
  942. If the number of input channels is greater than the number of
  943. expressions, the last specified expression is used for the remaining
  944. output channels.
  945. @item imag
  946. Set frequency domain imaginary expression for each separate channel
  947. separated by '|'. Default is "im".
  948. Each expression in @var{real} and @var{imag} can contain the following
  949. constants and functions:
  950. @table @option
  951. @item sr
  952. sample rate
  953. @item b
  954. current frequency bin number
  955. @item nb
  956. number of available bins
  957. @item ch
  958. channel number of the current expression
  959. @item chs
  960. number of channels
  961. @item pts
  962. current frame pts
  963. @item re
  964. current real part of frequency bin of current channel
  965. @item im
  966. current imaginary part of frequency bin of current channel
  967. @item real(b, ch)
  968. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  969. @item imag(b, ch)
  970. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  971. @end table
  972. @item win_size
  973. Set window size. Allowed range is from 16 to 131072.
  974. Default is @code{4096}
  975. @item win_func
  976. Set window function. Default is @code{hann}.
  977. @item overlap
  978. Set window overlap. If set to 1, the recommended overlap for selected
  979. window function will be picked. Default is @code{0.75}.
  980. @end table
  981. @subsection Examples
  982. @itemize
  983. @item
  984. Leave almost only low frequencies in audio:
  985. @example
  986. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  987. @end example
  988. @item
  989. Apply robotize effect:
  990. @example
  991. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  992. @end example
  993. @item
  994. Apply whisper effect:
  995. @example
  996. 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"
  997. @end example
  998. @end itemize
  999. @anchor{afir}
  1000. @section afir
  1001. Apply an arbitrary Finite Impulse Response filter.
  1002. This filter is designed for applying long FIR filters,
  1003. up to 60 seconds long.
  1004. It can be used as component for digital crossover filters,
  1005. room equalization, cross talk cancellation, wavefield synthesis,
  1006. auralization, ambiophonics, ambisonics and spatialization.
  1007. This filter uses the streams higher than first one as FIR coefficients.
  1008. If the non-first stream holds a single channel, it will be used
  1009. for all input channels in the first stream, otherwise
  1010. the number of channels in the non-first stream must be same as
  1011. the number of channels in the first stream.
  1012. It accepts the following parameters:
  1013. @table @option
  1014. @item dry
  1015. Set dry gain. This sets input gain.
  1016. @item wet
  1017. Set wet gain. This sets final output gain.
  1018. @item length
  1019. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1020. @item gtype
  1021. Enable applying gain measured from power of IR.
  1022. Set which approach to use for auto gain measurement.
  1023. @table @option
  1024. @item none
  1025. Do not apply any gain.
  1026. @item peak
  1027. select peak gain, very conservative approach. This is default value.
  1028. @item dc
  1029. select DC gain, limited application.
  1030. @item gn
  1031. select gain to noise approach, this is most popular one.
  1032. @end table
  1033. @item irgain
  1034. Set gain to be applied to IR coefficients before filtering.
  1035. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1036. @item irfmt
  1037. Set format of IR stream. Can be @code{mono} or @code{input}.
  1038. Default is @code{input}.
  1039. @item maxir
  1040. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1041. Allowed range is 0.1 to 60 seconds.
  1042. @item response
  1043. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1044. By default it is disabled.
  1045. @item channel
  1046. Set for which IR channel to display frequency response. By default is first channel
  1047. displayed. This option is used only when @var{response} is enabled.
  1048. @item size
  1049. Set video stream size. This option is used only when @var{response} is enabled.
  1050. @item rate
  1051. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1052. @item minp
  1053. Set minimal partition size used for convolution. Default is @var{8192}.
  1054. Allowed range is from @var{1} to @var{32768}.
  1055. Lower values decreases latency at cost of higher CPU usage.
  1056. @item maxp
  1057. Set maximal partition size used for convolution. Default is @var{8192}.
  1058. Allowed range is from @var{8} to @var{32768}.
  1059. Lower values may increase CPU usage.
  1060. @item nbirs
  1061. Set number of input impulse responses streams which will be switchable at runtime.
  1062. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1063. @item ir
  1064. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1065. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1066. This option can be changed at runtime via @ref{commands}.
  1067. @end table
  1068. @subsection Examples
  1069. @itemize
  1070. @item
  1071. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1072. @example
  1073. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1074. @end example
  1075. @end itemize
  1076. @anchor{aformat}
  1077. @section aformat
  1078. Set output format constraints for the input audio. The framework will
  1079. negotiate the most appropriate format to minimize conversions.
  1080. It accepts the following parameters:
  1081. @table @option
  1082. @item sample_fmts, f
  1083. A '|'-separated list of requested sample formats.
  1084. @item sample_rates, r
  1085. A '|'-separated list of requested sample rates.
  1086. @item channel_layouts, cl
  1087. A '|'-separated list of requested channel layouts.
  1088. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1089. for the required syntax.
  1090. @end table
  1091. If a parameter is omitted, all values are allowed.
  1092. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1093. @example
  1094. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1095. @end example
  1096. @section afreqshift
  1097. Apply frequency shift to input audio samples.
  1098. The filter accepts the following options:
  1099. @table @option
  1100. @item shift
  1101. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1102. Default value is 0.0.
  1103. @item level
  1104. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1105. Default value is 1.0.
  1106. @end table
  1107. @subsection Commands
  1108. This filter supports the all above options as @ref{commands}.
  1109. @section agate
  1110. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1111. processing reduces disturbing noise between useful signals.
  1112. Gating is done by detecting the volume below a chosen level @var{threshold}
  1113. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1114. floor is set via @var{range}. Because an exact manipulation of the signal
  1115. would cause distortion of the waveform the reduction can be levelled over
  1116. time. This is done by setting @var{attack} and @var{release}.
  1117. @var{attack} determines how long the signal has to fall below the threshold
  1118. before any reduction will occur and @var{release} sets the time the signal
  1119. has to rise above the threshold to reduce the reduction again.
  1120. Shorter signals than the chosen attack time will be left untouched.
  1121. @table @option
  1122. @item level_in
  1123. Set input level before filtering.
  1124. Default is 1. Allowed range is from 0.015625 to 64.
  1125. @item mode
  1126. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1127. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1128. will be amplified, expanding dynamic range in upward direction.
  1129. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1130. @item range
  1131. Set the level of gain reduction when the signal is below the threshold.
  1132. Default is 0.06125. Allowed range is from 0 to 1.
  1133. Setting this to 0 disables reduction and then filter behaves like expander.
  1134. @item threshold
  1135. If a signal rises above this level the gain reduction is released.
  1136. Default is 0.125. Allowed range is from 0 to 1.
  1137. @item ratio
  1138. Set a ratio by which the signal is reduced.
  1139. Default is 2. Allowed range is from 1 to 9000.
  1140. @item attack
  1141. Amount of milliseconds the signal has to rise above the threshold before gain
  1142. reduction stops.
  1143. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1144. @item release
  1145. Amount of milliseconds the signal has to fall below the threshold before the
  1146. reduction is increased again. Default is 250 milliseconds.
  1147. Allowed range is from 0.01 to 9000.
  1148. @item makeup
  1149. Set amount of amplification of signal after processing.
  1150. Default is 1. Allowed range is from 1 to 64.
  1151. @item knee
  1152. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1153. Default is 2.828427125. Allowed range is from 1 to 8.
  1154. @item detection
  1155. Choose if exact signal should be taken for detection or an RMS like one.
  1156. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1157. @item link
  1158. Choose if the average level between all channels or the louder channel affects
  1159. the reduction.
  1160. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1161. @end table
  1162. @subsection Commands
  1163. This filter supports the all above options as @ref{commands}.
  1164. @section aiir
  1165. Apply an arbitrary Infinite Impulse Response filter.
  1166. It accepts the following parameters:
  1167. @table @option
  1168. @item zeros, z
  1169. Set B/numerator/zeros/reflection coefficients.
  1170. @item poles, p
  1171. Set A/denominator/poles/ladder coefficients.
  1172. @item gains, k
  1173. Set channels gains.
  1174. @item dry_gain
  1175. Set input gain.
  1176. @item wet_gain
  1177. Set output gain.
  1178. @item format, f
  1179. Set coefficients format.
  1180. @table @samp
  1181. @item ll
  1182. lattice-ladder function
  1183. @item sf
  1184. analog transfer function
  1185. @item tf
  1186. digital transfer function
  1187. @item zp
  1188. Z-plane zeros/poles, cartesian (default)
  1189. @item pr
  1190. Z-plane zeros/poles, polar radians
  1191. @item pd
  1192. Z-plane zeros/poles, polar degrees
  1193. @item sp
  1194. S-plane zeros/poles
  1195. @end table
  1196. @item process, r
  1197. Set type of processing.
  1198. @table @samp
  1199. @item d
  1200. direct processing
  1201. @item s
  1202. serial processing
  1203. @item p
  1204. parallel processing
  1205. @end table
  1206. @item precision, e
  1207. Set filtering precision.
  1208. @table @samp
  1209. @item dbl
  1210. double-precision floating-point (default)
  1211. @item flt
  1212. single-precision floating-point
  1213. @item i32
  1214. 32-bit integers
  1215. @item i16
  1216. 16-bit integers
  1217. @end table
  1218. @item normalize, n
  1219. Normalize filter coefficients, by default is enabled.
  1220. Enabling it will normalize magnitude response at DC to 0dB.
  1221. @item mix
  1222. How much to use filtered signal in output. Default is 1.
  1223. Range is between 0 and 1.
  1224. @item response
  1225. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1226. By default it is disabled.
  1227. @item channel
  1228. Set for which IR channel to display frequency response. By default is first channel
  1229. displayed. This option is used only when @var{response} is enabled.
  1230. @item size
  1231. Set video stream size. This option is used only when @var{response} is enabled.
  1232. @end table
  1233. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1234. order.
  1235. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1236. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1237. imaginary unit.
  1238. Different coefficients and gains can be provided for every channel, in such case
  1239. use '|' to separate coefficients or gains. Last provided coefficients will be
  1240. used for all remaining channels.
  1241. @subsection Examples
  1242. @itemize
  1243. @item
  1244. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1245. @example
  1246. 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
  1247. @end example
  1248. @item
  1249. Same as above but in @code{zp} format:
  1250. @example
  1251. 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
  1252. @end example
  1253. @item
  1254. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1255. @example
  1256. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1257. @end example
  1258. @end itemize
  1259. @section alimiter
  1260. The limiter prevents an input signal from rising over a desired threshold.
  1261. This limiter uses lookahead technology to prevent your signal from distorting.
  1262. It means that there is a small delay after the signal is processed. Keep in mind
  1263. that the delay it produces is the attack time you set.
  1264. The filter accepts the following options:
  1265. @table @option
  1266. @item level_in
  1267. Set input gain. Default is 1.
  1268. @item level_out
  1269. Set output gain. Default is 1.
  1270. @item limit
  1271. Don't let signals above this level pass the limiter. Default is 1.
  1272. @item attack
  1273. The limiter will reach its attenuation level in this amount of time in
  1274. milliseconds. Default is 5 milliseconds.
  1275. @item release
  1276. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1277. Default is 50 milliseconds.
  1278. @item asc
  1279. When gain reduction is always needed ASC takes care of releasing to an
  1280. average reduction level rather than reaching a reduction of 0 in the release
  1281. time.
  1282. @item asc_level
  1283. Select how much the release time is affected by ASC, 0 means nearly no changes
  1284. in release time while 1 produces higher release times.
  1285. @item level
  1286. Auto level output signal. Default is enabled.
  1287. This normalizes audio back to 0dB if enabled.
  1288. @end table
  1289. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1290. with @ref{aresample} before applying this filter.
  1291. @section allpass
  1292. Apply a two-pole all-pass filter with central frequency (in Hz)
  1293. @var{frequency}, and filter-width @var{width}.
  1294. An all-pass filter changes the audio's frequency to phase relationship
  1295. without changing its frequency to amplitude relationship.
  1296. The filter accepts the following options:
  1297. @table @option
  1298. @item frequency, f
  1299. Set frequency in Hz.
  1300. @item width_type, t
  1301. Set method to specify band-width of filter.
  1302. @table @option
  1303. @item h
  1304. Hz
  1305. @item q
  1306. Q-Factor
  1307. @item o
  1308. octave
  1309. @item s
  1310. slope
  1311. @item k
  1312. kHz
  1313. @end table
  1314. @item width, w
  1315. Specify the band-width of a filter in width_type units.
  1316. @item mix, m
  1317. How much to use filtered signal in output. Default is 1.
  1318. Range is between 0 and 1.
  1319. @item channels, c
  1320. Specify which channels to filter, by default all available are filtered.
  1321. @item normalize, n
  1322. Normalize biquad coefficients, by default is disabled.
  1323. Enabling it will normalize magnitude response at DC to 0dB.
  1324. @item order, o
  1325. Set the filter order, can be 1 or 2. Default is 2.
  1326. @item transform, a
  1327. Set transform type of IIR filter.
  1328. @table @option
  1329. @item di
  1330. @item dii
  1331. @item tdii
  1332. @item latt
  1333. @end table
  1334. @item precision, r
  1335. Set precison of filtering.
  1336. @table @option
  1337. @item auto
  1338. Pick automatic sample format depending on surround filters.
  1339. @item s16
  1340. Always use signed 16-bit.
  1341. @item s32
  1342. Always use signed 32-bit.
  1343. @item f32
  1344. Always use float 32-bit.
  1345. @item f64
  1346. Always use float 64-bit.
  1347. @end table
  1348. @end table
  1349. @subsection Commands
  1350. This filter supports the following commands:
  1351. @table @option
  1352. @item frequency, f
  1353. Change allpass frequency.
  1354. Syntax for the command is : "@var{frequency}"
  1355. @item width_type, t
  1356. Change allpass width_type.
  1357. Syntax for the command is : "@var{width_type}"
  1358. @item width, w
  1359. Change allpass width.
  1360. Syntax for the command is : "@var{width}"
  1361. @item mix, m
  1362. Change allpass mix.
  1363. Syntax for the command is : "@var{mix}"
  1364. @end table
  1365. @section aloop
  1366. Loop audio samples.
  1367. The filter accepts the following options:
  1368. @table @option
  1369. @item loop
  1370. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1371. Default is 0.
  1372. @item size
  1373. Set maximal number of samples. Default is 0.
  1374. @item start
  1375. Set first sample of loop. Default is 0.
  1376. @end table
  1377. @anchor{amerge}
  1378. @section amerge
  1379. Merge two or more audio streams into a single multi-channel stream.
  1380. The filter accepts the following options:
  1381. @table @option
  1382. @item inputs
  1383. Set the number of inputs. Default is 2.
  1384. @end table
  1385. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1386. the channel layout of the output will be set accordingly and the channels
  1387. will be reordered as necessary. If the channel layouts of the inputs are not
  1388. disjoint, the output will have all the channels of the first input then all
  1389. the channels of the second input, in that order, and the channel layout of
  1390. the output will be the default value corresponding to the total number of
  1391. channels.
  1392. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1393. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1394. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1395. first input, b1 is the first channel of the second input).
  1396. On the other hand, if both input are in stereo, the output channels will be
  1397. in the default order: a1, a2, b1, b2, and the channel layout will be
  1398. arbitrarily set to 4.0, which may or may not be the expected value.
  1399. All inputs must have the same sample rate, and format.
  1400. If inputs do not have the same duration, the output will stop with the
  1401. shortest.
  1402. @subsection Examples
  1403. @itemize
  1404. @item
  1405. Merge two mono files into a stereo stream:
  1406. @example
  1407. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1408. @end example
  1409. @item
  1410. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1411. @example
  1412. 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
  1413. @end example
  1414. @end itemize
  1415. @section amix
  1416. Mixes multiple audio inputs into a single output.
  1417. Note that this filter only supports float samples (the @var{amerge}
  1418. and @var{pan} audio filters support many formats). If the @var{amix}
  1419. input has integer samples then @ref{aresample} will be automatically
  1420. inserted to perform the conversion to float samples.
  1421. For example
  1422. @example
  1423. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1424. @end example
  1425. will mix 3 input audio streams to a single output with the same duration as the
  1426. first input and a dropout transition time of 3 seconds.
  1427. It accepts the following parameters:
  1428. @table @option
  1429. @item inputs
  1430. The number of inputs. If unspecified, it defaults to 2.
  1431. @item duration
  1432. How to determine the end-of-stream.
  1433. @table @option
  1434. @item longest
  1435. The duration of the longest input. (default)
  1436. @item shortest
  1437. The duration of the shortest input.
  1438. @item first
  1439. The duration of the first input.
  1440. @end table
  1441. @item dropout_transition
  1442. The transition time, in seconds, for volume renormalization when an input
  1443. stream ends. The default value is 2 seconds.
  1444. @item weights
  1445. Specify weight of each input audio stream as sequence.
  1446. Each weight is separated by space. By default all inputs have same weight.
  1447. @end table
  1448. @subsection Commands
  1449. This filter supports the following commands:
  1450. @table @option
  1451. @item weights
  1452. Syntax is same as option with same name.
  1453. @end table
  1454. @section amultiply
  1455. Multiply first audio stream with second audio stream and store result
  1456. in output audio stream. Multiplication is done by multiplying each
  1457. sample from first stream with sample at same position from second stream.
  1458. With this element-wise multiplication one can create amplitude fades and
  1459. amplitude modulations.
  1460. @section anequalizer
  1461. High-order parametric multiband equalizer for each channel.
  1462. It accepts the following parameters:
  1463. @table @option
  1464. @item params
  1465. This option string is in format:
  1466. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1467. Each equalizer band is separated by '|'.
  1468. @table @option
  1469. @item chn
  1470. Set channel number to which equalization will be applied.
  1471. If input doesn't have that channel the entry is ignored.
  1472. @item f
  1473. Set central frequency for band.
  1474. If input doesn't have that frequency the entry is ignored.
  1475. @item w
  1476. Set band width in Hertz.
  1477. @item g
  1478. Set band gain in dB.
  1479. @item t
  1480. Set filter type for band, optional, can be:
  1481. @table @samp
  1482. @item 0
  1483. Butterworth, this is default.
  1484. @item 1
  1485. Chebyshev type 1.
  1486. @item 2
  1487. Chebyshev type 2.
  1488. @end table
  1489. @end table
  1490. @item curves
  1491. With this option activated frequency response of anequalizer is displayed
  1492. in video stream.
  1493. @item size
  1494. Set video stream size. Only useful if curves option is activated.
  1495. @item mgain
  1496. Set max gain that will be displayed. Only useful if curves option is activated.
  1497. Setting this to a reasonable value makes it possible to display gain which is derived from
  1498. neighbour bands which are too close to each other and thus produce higher gain
  1499. when both are activated.
  1500. @item fscale
  1501. Set frequency scale used to draw frequency response in video output.
  1502. Can be linear or logarithmic. Default is logarithmic.
  1503. @item colors
  1504. Set color for each channel curve which is going to be displayed in video stream.
  1505. This is list of color names separated by space or by '|'.
  1506. Unrecognised or missing colors will be replaced by white color.
  1507. @end table
  1508. @subsection Examples
  1509. @itemize
  1510. @item
  1511. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1512. for first 2 channels using Chebyshev type 1 filter:
  1513. @example
  1514. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1515. @end example
  1516. @end itemize
  1517. @subsection Commands
  1518. This filter supports the following commands:
  1519. @table @option
  1520. @item change
  1521. Alter existing filter parameters.
  1522. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1523. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1524. error is returned.
  1525. @var{freq} set new frequency parameter.
  1526. @var{width} set new width parameter in Hertz.
  1527. @var{gain} set new gain parameter in dB.
  1528. Full filter invocation with asendcmd may look like this:
  1529. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1530. @end table
  1531. @section anlmdn
  1532. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1533. Each sample is adjusted by looking for other samples with similar contexts. This
  1534. context similarity is defined by comparing their surrounding patches of size
  1535. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1536. The filter accepts the following options:
  1537. @table @option
  1538. @item s
  1539. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1540. @item p
  1541. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1542. Default value is 2 milliseconds.
  1543. @item r
  1544. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1545. Default value is 6 milliseconds.
  1546. @item o
  1547. Set the output mode.
  1548. It accepts the following values:
  1549. @table @option
  1550. @item i
  1551. Pass input unchanged.
  1552. @item o
  1553. Pass noise filtered out.
  1554. @item n
  1555. Pass only noise.
  1556. Default value is @var{o}.
  1557. @end table
  1558. @item m
  1559. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1560. @end table
  1561. @subsection Commands
  1562. This filter supports the all above options as @ref{commands}.
  1563. @section anlms
  1564. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1565. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1566. relate to producing the least mean square of the error signal (difference between the desired,
  1567. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1568. A description of the accepted options follows.
  1569. @table @option
  1570. @item order
  1571. Set filter order.
  1572. @item mu
  1573. Set filter mu.
  1574. @item eps
  1575. Set the filter eps.
  1576. @item leakage
  1577. Set the filter leakage.
  1578. @item out_mode
  1579. It accepts the following values:
  1580. @table @option
  1581. @item i
  1582. Pass the 1st input.
  1583. @item d
  1584. Pass the 2nd input.
  1585. @item o
  1586. Pass filtered samples.
  1587. @item n
  1588. Pass difference between desired and filtered samples.
  1589. Default value is @var{o}.
  1590. @end table
  1591. @end table
  1592. @subsection Examples
  1593. @itemize
  1594. @item
  1595. One of many usages of this filter is noise reduction, input audio is filtered
  1596. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1597. @example
  1598. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1599. @end example
  1600. @end itemize
  1601. @subsection Commands
  1602. This filter supports the same commands as options, excluding option @code{order}.
  1603. @section anull
  1604. Pass the audio source unchanged to the output.
  1605. @section apad
  1606. Pad the end of an audio stream with silence.
  1607. This can be used together with @command{ffmpeg} @option{-shortest} to
  1608. extend audio streams to the same length as the video stream.
  1609. A description of the accepted options follows.
  1610. @table @option
  1611. @item packet_size
  1612. Set silence packet size. Default value is 4096.
  1613. @item pad_len
  1614. Set the number of samples of silence to add to the end. After the
  1615. value is reached, the stream is terminated. This option is mutually
  1616. exclusive with @option{whole_len}.
  1617. @item whole_len
  1618. Set the minimum total number of samples in the output audio stream. If
  1619. the value is longer than the input audio length, silence is added to
  1620. the end, until the value is reached. This option is mutually exclusive
  1621. with @option{pad_len}.
  1622. @item pad_dur
  1623. Specify the duration of samples of silence to add. See
  1624. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1625. for the accepted syntax. Used only if set to non-zero value.
  1626. @item whole_dur
  1627. Specify the minimum total duration in the output audio stream. See
  1628. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1629. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1630. the input audio length, silence is added to the end, until the value is reached.
  1631. This option is mutually exclusive with @option{pad_dur}
  1632. @end table
  1633. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1634. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1635. the input stream indefinitely.
  1636. @subsection Examples
  1637. @itemize
  1638. @item
  1639. Add 1024 samples of silence to the end of the input:
  1640. @example
  1641. apad=pad_len=1024
  1642. @end example
  1643. @item
  1644. Make sure the audio output will contain at least 10000 samples, pad
  1645. the input with silence if required:
  1646. @example
  1647. apad=whole_len=10000
  1648. @end example
  1649. @item
  1650. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1651. video stream will always result the shortest and will be converted
  1652. until the end in the output file when using the @option{shortest}
  1653. option:
  1654. @example
  1655. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1656. @end example
  1657. @end itemize
  1658. @section aphaser
  1659. Add a phasing effect to the input audio.
  1660. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1661. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1662. A description of the accepted parameters follows.
  1663. @table @option
  1664. @item in_gain
  1665. Set input gain. Default is 0.4.
  1666. @item out_gain
  1667. Set output gain. Default is 0.74
  1668. @item delay
  1669. Set delay in milliseconds. Default is 3.0.
  1670. @item decay
  1671. Set decay. Default is 0.4.
  1672. @item speed
  1673. Set modulation speed in Hz. Default is 0.5.
  1674. @item type
  1675. Set modulation type. Default is triangular.
  1676. It accepts the following values:
  1677. @table @samp
  1678. @item triangular, t
  1679. @item sinusoidal, s
  1680. @end table
  1681. @end table
  1682. @section aphaseshift
  1683. Apply phase shift to input audio samples.
  1684. The filter accepts the following options:
  1685. @table @option
  1686. @item shift
  1687. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1688. Default value is 0.0.
  1689. @item level
  1690. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1691. Default value is 1.0.
  1692. @end table
  1693. @subsection Commands
  1694. This filter supports the all above options as @ref{commands}.
  1695. @section apulsator
  1696. Audio pulsator is something between an autopanner and a tremolo.
  1697. But it can produce funny stereo effects as well. Pulsator changes the volume
  1698. of the left and right channel based on a LFO (low frequency oscillator) with
  1699. different waveforms and shifted phases.
  1700. This filter have the ability to define an offset between left and right
  1701. channel. An offset of 0 means that both LFO shapes match each other.
  1702. The left and right channel are altered equally - a conventional tremolo.
  1703. An offset of 50% means that the shape of the right channel is exactly shifted
  1704. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1705. an autopanner. At 1 both curves match again. Every setting in between moves the
  1706. phase shift gapless between all stages and produces some "bypassing" sounds with
  1707. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1708. the 0.5) the faster the signal passes from the left to the right speaker.
  1709. The filter accepts the following options:
  1710. @table @option
  1711. @item level_in
  1712. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1713. @item level_out
  1714. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1715. @item mode
  1716. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1717. sawup or sawdown. Default is sine.
  1718. @item amount
  1719. Set modulation. Define how much of original signal is affected by the LFO.
  1720. @item offset_l
  1721. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1722. @item offset_r
  1723. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1724. @item width
  1725. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1726. @item timing
  1727. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1728. @item bpm
  1729. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1730. is set to bpm.
  1731. @item ms
  1732. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1733. is set to ms.
  1734. @item hz
  1735. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1736. if timing is set to hz.
  1737. @end table
  1738. @anchor{aresample}
  1739. @section aresample
  1740. Resample the input audio to the specified parameters, using the
  1741. libswresample library. If none are specified then the filter will
  1742. automatically convert between its input and output.
  1743. This filter is also able to stretch/squeeze the audio data to make it match
  1744. the timestamps or to inject silence / cut out audio to make it match the
  1745. timestamps, do a combination of both or do neither.
  1746. The filter accepts the syntax
  1747. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1748. expresses a sample rate and @var{resampler_options} is a list of
  1749. @var{key}=@var{value} pairs, separated by ":". See the
  1750. @ref{Resampler Options,,"Resampler Options" section in the
  1751. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1752. for the complete list of supported options.
  1753. @subsection Examples
  1754. @itemize
  1755. @item
  1756. Resample the input audio to 44100Hz:
  1757. @example
  1758. aresample=44100
  1759. @end example
  1760. @item
  1761. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1762. samples per second compensation:
  1763. @example
  1764. aresample=async=1000
  1765. @end example
  1766. @end itemize
  1767. @section areverse
  1768. Reverse an audio clip.
  1769. Warning: This filter requires memory to buffer the entire clip, so trimming
  1770. is suggested.
  1771. @subsection Examples
  1772. @itemize
  1773. @item
  1774. Take the first 5 seconds of a clip, and reverse it.
  1775. @example
  1776. atrim=end=5,areverse
  1777. @end example
  1778. @end itemize
  1779. @section arnndn
  1780. Reduce noise from speech using Recurrent Neural Networks.
  1781. This filter accepts the following options:
  1782. @table @option
  1783. @item model, m
  1784. Set train model file to load. This option is always required.
  1785. @item mix
  1786. Set how much to mix filtered samples into final output.
  1787. Allowed range is from -1 to 1. Default value is 1.
  1788. Negative values are special, they set how much to keep filtered noise
  1789. in the final filter output. Set this option to -1 to hear actual
  1790. noise removed from input signal.
  1791. @end table
  1792. @section asetnsamples
  1793. Set the number of samples per each output audio frame.
  1794. The last output packet may contain a different number of samples, as
  1795. the filter will flush all the remaining samples when the input audio
  1796. signals its end.
  1797. The filter accepts the following options:
  1798. @table @option
  1799. @item nb_out_samples, n
  1800. Set the number of frames per each output audio frame. The number is
  1801. intended as the number of samples @emph{per each channel}.
  1802. Default value is 1024.
  1803. @item pad, p
  1804. If set to 1, the filter will pad the last audio frame with zeroes, so
  1805. that the last frame will contain the same number of samples as the
  1806. previous ones. Default value is 1.
  1807. @end table
  1808. For example, to set the number of per-frame samples to 1234 and
  1809. disable padding for the last frame, use:
  1810. @example
  1811. asetnsamples=n=1234:p=0
  1812. @end example
  1813. @section asetrate
  1814. Set the sample rate without altering the PCM data.
  1815. This will result in a change of speed and pitch.
  1816. The filter accepts the following options:
  1817. @table @option
  1818. @item sample_rate, r
  1819. Set the output sample rate. Default is 44100 Hz.
  1820. @end table
  1821. @section ashowinfo
  1822. Show a line containing various information for each input audio frame.
  1823. The input audio is not modified.
  1824. The shown line contains a sequence of key/value pairs of the form
  1825. @var{key}:@var{value}.
  1826. The following values are shown in the output:
  1827. @table @option
  1828. @item n
  1829. The (sequential) number of the input frame, starting from 0.
  1830. @item pts
  1831. The presentation timestamp of the input frame, in time base units; the time base
  1832. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1833. @item pts_time
  1834. The presentation timestamp of the input frame in seconds.
  1835. @item pos
  1836. position of the frame in the input stream, -1 if this information in
  1837. unavailable and/or meaningless (for example in case of synthetic audio)
  1838. @item fmt
  1839. The sample format.
  1840. @item chlayout
  1841. The channel layout.
  1842. @item rate
  1843. The sample rate for the audio frame.
  1844. @item nb_samples
  1845. The number of samples (per channel) in the frame.
  1846. @item checksum
  1847. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1848. audio, the data is treated as if all the planes were concatenated.
  1849. @item plane_checksums
  1850. A list of Adler-32 checksums for each data plane.
  1851. @end table
  1852. @section asoftclip
  1853. Apply audio soft clipping.
  1854. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1855. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1856. This filter accepts the following options:
  1857. @table @option
  1858. @item type
  1859. Set type of soft-clipping.
  1860. It accepts the following values:
  1861. @table @option
  1862. @item hard
  1863. @item tanh
  1864. @item atan
  1865. @item cubic
  1866. @item exp
  1867. @item alg
  1868. @item quintic
  1869. @item sin
  1870. @item erf
  1871. @end table
  1872. @item threshold
  1873. Set threshold from where to start clipping. Default value is 0dB or 1.
  1874. @item output
  1875. Set gain applied to output. Default value is 0dB or 1.
  1876. @item param
  1877. Set additional parameter which controls sigmoid function.
  1878. @item oversample
  1879. Set oversampling factor.
  1880. @end table
  1881. @subsection Commands
  1882. This filter supports the all above options as @ref{commands}.
  1883. @section asr
  1884. Automatic Speech Recognition
  1885. This filter uses PocketSphinx for speech recognition. To enable
  1886. compilation of this filter, you need to configure FFmpeg with
  1887. @code{--enable-pocketsphinx}.
  1888. It accepts the following options:
  1889. @table @option
  1890. @item rate
  1891. Set sampling rate of input audio. Defaults is @code{16000}.
  1892. This need to match speech models, otherwise one will get poor results.
  1893. @item hmm
  1894. Set dictionary containing acoustic model files.
  1895. @item dict
  1896. Set pronunciation dictionary.
  1897. @item lm
  1898. Set language model file.
  1899. @item lmctl
  1900. Set language model set.
  1901. @item lmname
  1902. Set which language model to use.
  1903. @item logfn
  1904. Set output for log messages.
  1905. @end table
  1906. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1907. @anchor{astats}
  1908. @section astats
  1909. Display time domain statistical information about the audio channels.
  1910. Statistics are calculated and displayed for each audio channel and,
  1911. where applicable, an overall figure is also given.
  1912. It accepts the following option:
  1913. @table @option
  1914. @item length
  1915. Short window length in seconds, used for peak and trough RMS measurement.
  1916. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1917. @item metadata
  1918. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1919. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1920. disabled.
  1921. Available keys for each channel are:
  1922. DC_offset
  1923. Min_level
  1924. Max_level
  1925. Min_difference
  1926. Max_difference
  1927. Mean_difference
  1928. RMS_difference
  1929. Peak_level
  1930. RMS_peak
  1931. RMS_trough
  1932. Crest_factor
  1933. Flat_factor
  1934. Peak_count
  1935. Noise_floor
  1936. Noise_floor_count
  1937. Bit_depth
  1938. Dynamic_range
  1939. Zero_crossings
  1940. Zero_crossings_rate
  1941. Number_of_NaNs
  1942. Number_of_Infs
  1943. Number_of_denormals
  1944. and for Overall:
  1945. DC_offset
  1946. Min_level
  1947. Max_level
  1948. Min_difference
  1949. Max_difference
  1950. Mean_difference
  1951. RMS_difference
  1952. Peak_level
  1953. RMS_level
  1954. RMS_peak
  1955. RMS_trough
  1956. Flat_factor
  1957. Peak_count
  1958. Noise_floor
  1959. Noise_floor_count
  1960. Bit_depth
  1961. Number_of_samples
  1962. Number_of_NaNs
  1963. Number_of_Infs
  1964. Number_of_denormals
  1965. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1966. this @code{lavfi.astats.Overall.Peak_count}.
  1967. For description what each key means read below.
  1968. @item reset
  1969. Set number of frame after which stats are going to be recalculated.
  1970. Default is disabled.
  1971. @item measure_perchannel
  1972. Select the entries which need to be measured per channel. The metadata keys can
  1973. be used as flags, default is @option{all} which measures everything.
  1974. @option{none} disables all per channel measurement.
  1975. @item measure_overall
  1976. Select the entries which need to be measured overall. The metadata keys can
  1977. be used as flags, default is @option{all} which measures everything.
  1978. @option{none} disables all overall measurement.
  1979. @end table
  1980. A description of each shown parameter follows:
  1981. @table @option
  1982. @item DC offset
  1983. Mean amplitude displacement from zero.
  1984. @item Min level
  1985. Minimal sample level.
  1986. @item Max level
  1987. Maximal sample level.
  1988. @item Min difference
  1989. Minimal difference between two consecutive samples.
  1990. @item Max difference
  1991. Maximal difference between two consecutive samples.
  1992. @item Mean difference
  1993. Mean difference between two consecutive samples.
  1994. The average of each difference between two consecutive samples.
  1995. @item RMS difference
  1996. Root Mean Square difference between two consecutive samples.
  1997. @item Peak level dB
  1998. @item RMS level dB
  1999. Standard peak and RMS level measured in dBFS.
  2000. @item RMS peak dB
  2001. @item RMS trough dB
  2002. Peak and trough values for RMS level measured over a short window.
  2003. @item Crest factor
  2004. Standard ratio of peak to RMS level (note: not in dB).
  2005. @item Flat factor
  2006. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2007. (i.e. either @var{Min level} or @var{Max level}).
  2008. @item Peak count
  2009. Number of occasions (not the number of samples) that the signal attained either
  2010. @var{Min level} or @var{Max level}.
  2011. @item Noise floor dB
  2012. Minimum local peak measured in dBFS over a short window.
  2013. @item Noise floor count
  2014. Number of occasions (not the number of samples) that the signal attained
  2015. @var{Noise floor}.
  2016. @item Bit depth
  2017. Overall bit depth of audio. Number of bits used for each sample.
  2018. @item Dynamic range
  2019. Measured dynamic range of audio in dB.
  2020. @item Zero crossings
  2021. Number of points where the waveform crosses the zero level axis.
  2022. @item Zero crossings rate
  2023. Rate of Zero crossings and number of audio samples.
  2024. @end table
  2025. @section asubboost
  2026. Boost subwoofer frequencies.
  2027. The filter accepts the following options:
  2028. @table @option
  2029. @item dry
  2030. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2031. Default value is 0.7.
  2032. @item wet
  2033. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2034. Default value is 0.7.
  2035. @item decay
  2036. Set delay line decay gain value. Allowed range is from 0 to 1.
  2037. Default value is 0.7.
  2038. @item feedback
  2039. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2040. Default value is 0.9.
  2041. @item cutoff
  2042. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2043. Default value is 100.
  2044. @item slope
  2045. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2046. Default value is 0.5.
  2047. @item delay
  2048. Set delay. Allowed range is from 1 to 100.
  2049. Default value is 20.
  2050. @end table
  2051. @subsection Commands
  2052. This filter supports the all above options as @ref{commands}.
  2053. @section asubcut
  2054. Cut subwoofer frequencies.
  2055. This filter allows to set custom, steeper
  2056. roll off than highpass filter, and thus is able to more attenuate
  2057. frequency content in stop-band.
  2058. The filter accepts the following options:
  2059. @table @option
  2060. @item cutoff
  2061. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2062. Default value is 20.
  2063. @item order
  2064. Set filter order. Available values are from 3 to 20.
  2065. Default value is 10.
  2066. @item level
  2067. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2068. @end table
  2069. @subsection Commands
  2070. This filter supports the all above options as @ref{commands}.
  2071. @section asupercut
  2072. Cut super frequencies.
  2073. The filter accepts the following options:
  2074. @table @option
  2075. @item cutoff
  2076. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2077. Default value is 20000.
  2078. @item order
  2079. Set filter order. Available values are from 3 to 20.
  2080. Default value is 10.
  2081. @item level
  2082. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2083. @end table
  2084. @subsection Commands
  2085. This filter supports the all above options as @ref{commands}.
  2086. @section asuperpass
  2087. Apply high order Butterworth band-pass filter.
  2088. The filter accepts the following options:
  2089. @table @option
  2090. @item centerf
  2091. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2092. Default value is 1000.
  2093. @item order
  2094. Set filter order. Available values are from 4 to 20.
  2095. Default value is 4.
  2096. @item qfactor
  2097. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2098. @item level
  2099. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2100. @end table
  2101. @subsection Commands
  2102. This filter supports the all above options as @ref{commands}.
  2103. @section asuperstop
  2104. Apply high order Butterworth band-stop filter.
  2105. The filter accepts the following options:
  2106. @table @option
  2107. @item centerf
  2108. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2109. Default value is 1000.
  2110. @item order
  2111. Set filter order. Available values are from 4 to 20.
  2112. Default value is 4.
  2113. @item qfactor
  2114. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2115. @item level
  2116. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2117. @end table
  2118. @subsection Commands
  2119. This filter supports the all above options as @ref{commands}.
  2120. @section atempo
  2121. Adjust audio tempo.
  2122. The filter accepts exactly one parameter, the audio tempo. If not
  2123. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2124. be in the [0.5, 100.0] range.
  2125. Note that tempo greater than 2 will skip some samples rather than
  2126. blend them in. If for any reason this is a concern it is always
  2127. possible to daisy-chain several instances of atempo to achieve the
  2128. desired product tempo.
  2129. @subsection Examples
  2130. @itemize
  2131. @item
  2132. Slow down audio to 80% tempo:
  2133. @example
  2134. atempo=0.8
  2135. @end example
  2136. @item
  2137. To speed up audio to 300% tempo:
  2138. @example
  2139. atempo=3
  2140. @end example
  2141. @item
  2142. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2143. @example
  2144. atempo=sqrt(3),atempo=sqrt(3)
  2145. @end example
  2146. @end itemize
  2147. @subsection Commands
  2148. This filter supports the following commands:
  2149. @table @option
  2150. @item tempo
  2151. Change filter tempo scale factor.
  2152. Syntax for the command is : "@var{tempo}"
  2153. @end table
  2154. @section atrim
  2155. Trim the input so that the output contains one continuous subpart of the input.
  2156. It accepts the following parameters:
  2157. @table @option
  2158. @item start
  2159. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2160. sample with the timestamp @var{start} will be the first sample in the output.
  2161. @item end
  2162. Specify time of the first audio sample that will be dropped, i.e. the
  2163. audio sample immediately preceding the one with the timestamp @var{end} will be
  2164. the last sample in the output.
  2165. @item start_pts
  2166. Same as @var{start}, except this option sets the start timestamp in samples
  2167. instead of seconds.
  2168. @item end_pts
  2169. Same as @var{end}, except this option sets the end timestamp in samples instead
  2170. of seconds.
  2171. @item duration
  2172. The maximum duration of the output in seconds.
  2173. @item start_sample
  2174. The number of the first sample that should be output.
  2175. @item end_sample
  2176. The number of the first sample that should be dropped.
  2177. @end table
  2178. @option{start}, @option{end}, and @option{duration} are expressed as time
  2179. duration specifications; see
  2180. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2181. Note that the first two sets of the start/end options and the @option{duration}
  2182. option look at the frame timestamp, while the _sample options simply count the
  2183. samples that pass through the filter. So start/end_pts and start/end_sample will
  2184. give different results when the timestamps are wrong, inexact or do not start at
  2185. zero. Also note that this filter does not modify the timestamps. If you wish
  2186. to have the output timestamps start at zero, insert the asetpts filter after the
  2187. atrim filter.
  2188. If multiple start or end options are set, this filter tries to be greedy and
  2189. keep all samples that match at least one of the specified constraints. To keep
  2190. only the part that matches all the constraints at once, chain multiple atrim
  2191. filters.
  2192. The defaults are such that all the input is kept. So it is possible to set e.g.
  2193. just the end values to keep everything before the specified time.
  2194. Examples:
  2195. @itemize
  2196. @item
  2197. Drop everything except the second minute of input:
  2198. @example
  2199. ffmpeg -i INPUT -af atrim=60:120
  2200. @end example
  2201. @item
  2202. Keep only the first 1000 samples:
  2203. @example
  2204. ffmpeg -i INPUT -af atrim=end_sample=1000
  2205. @end example
  2206. @end itemize
  2207. @section axcorrelate
  2208. Calculate normalized cross-correlation between two input audio streams.
  2209. Resulted samples are always between -1 and 1 inclusive.
  2210. If result is 1 it means two input samples are highly correlated in that selected segment.
  2211. Result 0 means they are not correlated at all.
  2212. If result is -1 it means two input samples are out of phase, which means they cancel each
  2213. other.
  2214. The filter accepts the following options:
  2215. @table @option
  2216. @item size
  2217. Set size of segment over which cross-correlation is calculated.
  2218. Default is 256. Allowed range is from 2 to 131072.
  2219. @item algo
  2220. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2221. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2222. are always zero and thus need much less calculations to make.
  2223. This is generally not true, but is valid for typical audio streams.
  2224. @end table
  2225. @subsection Examples
  2226. @itemize
  2227. @item
  2228. Calculate correlation between channels in stereo audio stream:
  2229. @example
  2230. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2231. @end example
  2232. @end itemize
  2233. @section bandpass
  2234. Apply a two-pole Butterworth band-pass filter with central
  2235. frequency @var{frequency}, and (3dB-point) band-width width.
  2236. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2237. instead of the default: constant 0dB peak gain.
  2238. The filter roll off at 6dB per octave (20dB per decade).
  2239. The filter accepts the following options:
  2240. @table @option
  2241. @item frequency, f
  2242. Set the filter's central frequency. Default is @code{3000}.
  2243. @item csg
  2244. Constant skirt gain if set to 1. Defaults to 0.
  2245. @item width_type, t
  2246. Set method to specify band-width of filter.
  2247. @table @option
  2248. @item h
  2249. Hz
  2250. @item q
  2251. Q-Factor
  2252. @item o
  2253. octave
  2254. @item s
  2255. slope
  2256. @item k
  2257. kHz
  2258. @end table
  2259. @item width, w
  2260. Specify the band-width of a filter in width_type units.
  2261. @item mix, m
  2262. How much to use filtered signal in output. Default is 1.
  2263. Range is between 0 and 1.
  2264. @item channels, c
  2265. Specify which channels to filter, by default all available are filtered.
  2266. @item normalize, n
  2267. Normalize biquad coefficients, by default is disabled.
  2268. Enabling it will normalize magnitude response at DC to 0dB.
  2269. @item transform, a
  2270. Set transform type of IIR filter.
  2271. @table @option
  2272. @item di
  2273. @item dii
  2274. @item tdii
  2275. @item latt
  2276. @end table
  2277. @item precision, r
  2278. Set precison of filtering.
  2279. @table @option
  2280. @item auto
  2281. Pick automatic sample format depending on surround filters.
  2282. @item s16
  2283. Always use signed 16-bit.
  2284. @item s32
  2285. Always use signed 32-bit.
  2286. @item f32
  2287. Always use float 32-bit.
  2288. @item f64
  2289. Always use float 64-bit.
  2290. @end table
  2291. @end table
  2292. @subsection Commands
  2293. This filter supports the following commands:
  2294. @table @option
  2295. @item frequency, f
  2296. Change bandpass frequency.
  2297. Syntax for the command is : "@var{frequency}"
  2298. @item width_type, t
  2299. Change bandpass width_type.
  2300. Syntax for the command is : "@var{width_type}"
  2301. @item width, w
  2302. Change bandpass width.
  2303. Syntax for the command is : "@var{width}"
  2304. @item mix, m
  2305. Change bandpass mix.
  2306. Syntax for the command is : "@var{mix}"
  2307. @end table
  2308. @section bandreject
  2309. Apply a two-pole Butterworth band-reject filter with central
  2310. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2311. The filter roll off at 6dB per octave (20dB per decade).
  2312. The filter accepts the following options:
  2313. @table @option
  2314. @item frequency, f
  2315. Set the filter's central frequency. Default is @code{3000}.
  2316. @item width_type, t
  2317. Set method to specify band-width of filter.
  2318. @table @option
  2319. @item h
  2320. Hz
  2321. @item q
  2322. Q-Factor
  2323. @item o
  2324. octave
  2325. @item s
  2326. slope
  2327. @item k
  2328. kHz
  2329. @end table
  2330. @item width, w
  2331. Specify the band-width of a filter in width_type units.
  2332. @item mix, m
  2333. How much to use filtered signal in output. Default is 1.
  2334. Range is between 0 and 1.
  2335. @item channels, c
  2336. Specify which channels to filter, by default all available are filtered.
  2337. @item normalize, n
  2338. Normalize biquad coefficients, by default is disabled.
  2339. Enabling it will normalize magnitude response at DC to 0dB.
  2340. @item transform, a
  2341. Set transform type of IIR filter.
  2342. @table @option
  2343. @item di
  2344. @item dii
  2345. @item tdii
  2346. @item latt
  2347. @end table
  2348. @item precision, r
  2349. Set precison of filtering.
  2350. @table @option
  2351. @item auto
  2352. Pick automatic sample format depending on surround filters.
  2353. @item s16
  2354. Always use signed 16-bit.
  2355. @item s32
  2356. Always use signed 32-bit.
  2357. @item f32
  2358. Always use float 32-bit.
  2359. @item f64
  2360. Always use float 64-bit.
  2361. @end table
  2362. @end table
  2363. @subsection Commands
  2364. This filter supports the following commands:
  2365. @table @option
  2366. @item frequency, f
  2367. Change bandreject frequency.
  2368. Syntax for the command is : "@var{frequency}"
  2369. @item width_type, t
  2370. Change bandreject width_type.
  2371. Syntax for the command is : "@var{width_type}"
  2372. @item width, w
  2373. Change bandreject width.
  2374. Syntax for the command is : "@var{width}"
  2375. @item mix, m
  2376. Change bandreject mix.
  2377. Syntax for the command is : "@var{mix}"
  2378. @end table
  2379. @section bass, lowshelf
  2380. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2381. shelving filter with a response similar to that of a standard
  2382. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item gain, g
  2386. Give the gain at 0 Hz. Its useful range is about -20
  2387. (for a large cut) to +20 (for a large boost).
  2388. Beware of clipping when using a positive gain.
  2389. @item frequency, f
  2390. Set the filter's central frequency and so can be used
  2391. to extend or reduce the frequency range to be boosted or cut.
  2392. The default value is @code{100} Hz.
  2393. @item width_type, t
  2394. Set method to specify band-width of filter.
  2395. @table @option
  2396. @item h
  2397. Hz
  2398. @item q
  2399. Q-Factor
  2400. @item o
  2401. octave
  2402. @item s
  2403. slope
  2404. @item k
  2405. kHz
  2406. @end table
  2407. @item width, w
  2408. Determine how steep is the filter's shelf transition.
  2409. @item poles, p
  2410. Set number of poles. Default is 2.
  2411. @item mix, m
  2412. How much to use filtered signal in output. Default is 1.
  2413. Range is between 0 and 1.
  2414. @item channels, c
  2415. Specify which channels to filter, by default all available are filtered.
  2416. @item normalize, n
  2417. Normalize biquad coefficients, by default is disabled.
  2418. Enabling it will normalize magnitude response at DC to 0dB.
  2419. @item transform, a
  2420. Set transform type of IIR filter.
  2421. @table @option
  2422. @item di
  2423. @item dii
  2424. @item tdii
  2425. @item latt
  2426. @end table
  2427. @item precision, r
  2428. Set precison of filtering.
  2429. @table @option
  2430. @item auto
  2431. Pick automatic sample format depending on surround filters.
  2432. @item s16
  2433. Always use signed 16-bit.
  2434. @item s32
  2435. Always use signed 32-bit.
  2436. @item f32
  2437. Always use float 32-bit.
  2438. @item f64
  2439. Always use float 64-bit.
  2440. @end table
  2441. @end table
  2442. @subsection Commands
  2443. This filter supports the following commands:
  2444. @table @option
  2445. @item frequency, f
  2446. Change bass frequency.
  2447. Syntax for the command is : "@var{frequency}"
  2448. @item width_type, t
  2449. Change bass width_type.
  2450. Syntax for the command is : "@var{width_type}"
  2451. @item width, w
  2452. Change bass width.
  2453. Syntax for the command is : "@var{width}"
  2454. @item gain, g
  2455. Change bass gain.
  2456. Syntax for the command is : "@var{gain}"
  2457. @item mix, m
  2458. Change bass mix.
  2459. Syntax for the command is : "@var{mix}"
  2460. @end table
  2461. @section biquad
  2462. Apply a biquad IIR filter with the given coefficients.
  2463. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2464. are the numerator and denominator coefficients respectively.
  2465. and @var{channels}, @var{c} specify which channels to filter, by default all
  2466. available are filtered.
  2467. @subsection Commands
  2468. This filter supports the following commands:
  2469. @table @option
  2470. @item a0
  2471. @item a1
  2472. @item a2
  2473. @item b0
  2474. @item b1
  2475. @item b2
  2476. Change biquad parameter.
  2477. Syntax for the command is : "@var{value}"
  2478. @item mix, m
  2479. How much to use filtered signal in output. Default is 1.
  2480. Range is between 0 and 1.
  2481. @item channels, c
  2482. Specify which channels to filter, by default all available are filtered.
  2483. @item normalize, n
  2484. Normalize biquad coefficients, by default is disabled.
  2485. Enabling it will normalize magnitude response at DC to 0dB.
  2486. @item transform, a
  2487. Set transform type of IIR filter.
  2488. @table @option
  2489. @item di
  2490. @item dii
  2491. @item tdii
  2492. @item latt
  2493. @end table
  2494. @item precision, r
  2495. Set precison of filtering.
  2496. @table @option
  2497. @item auto
  2498. Pick automatic sample format depending on surround filters.
  2499. @item s16
  2500. Always use signed 16-bit.
  2501. @item s32
  2502. Always use signed 32-bit.
  2503. @item f32
  2504. Always use float 32-bit.
  2505. @item f64
  2506. Always use float 64-bit.
  2507. @end table
  2508. @end table
  2509. @section bs2b
  2510. Bauer stereo to binaural transformation, which improves headphone listening of
  2511. stereo audio records.
  2512. To enable compilation of this filter you need to configure FFmpeg with
  2513. @code{--enable-libbs2b}.
  2514. It accepts the following parameters:
  2515. @table @option
  2516. @item profile
  2517. Pre-defined crossfeed level.
  2518. @table @option
  2519. @item default
  2520. Default level (fcut=700, feed=50).
  2521. @item cmoy
  2522. Chu Moy circuit (fcut=700, feed=60).
  2523. @item jmeier
  2524. Jan Meier circuit (fcut=650, feed=95).
  2525. @end table
  2526. @item fcut
  2527. Cut frequency (in Hz).
  2528. @item feed
  2529. Feed level (in Hz).
  2530. @end table
  2531. @section channelmap
  2532. Remap input channels to new locations.
  2533. It accepts the following parameters:
  2534. @table @option
  2535. @item map
  2536. Map channels from input to output. The argument is a '|'-separated list of
  2537. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2538. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2539. channel (e.g. FL for front left) or its index in the input channel layout.
  2540. @var{out_channel} is the name of the output channel or its index in the output
  2541. channel layout. If @var{out_channel} is not given then it is implicitly an
  2542. index, starting with zero and increasing by one for each mapping.
  2543. @item channel_layout
  2544. The channel layout of the output stream.
  2545. @end table
  2546. If no mapping is present, the filter will implicitly map input channels to
  2547. output channels, preserving indices.
  2548. @subsection Examples
  2549. @itemize
  2550. @item
  2551. For example, assuming a 5.1+downmix input MOV file,
  2552. @example
  2553. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2554. @end example
  2555. will create an output WAV file tagged as stereo from the downmix channels of
  2556. the input.
  2557. @item
  2558. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2559. @example
  2560. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2561. @end example
  2562. @end itemize
  2563. @section channelsplit
  2564. Split each channel from an input audio stream into a separate output stream.
  2565. It accepts the following parameters:
  2566. @table @option
  2567. @item channel_layout
  2568. The channel layout of the input stream. The default is "stereo".
  2569. @item channels
  2570. A channel layout describing the channels to be extracted as separate output streams
  2571. or "all" to extract each input channel as a separate stream. The default is "all".
  2572. Choosing channels not present in channel layout in the input will result in an error.
  2573. @end table
  2574. @subsection Examples
  2575. @itemize
  2576. @item
  2577. For example, assuming a stereo input MP3 file,
  2578. @example
  2579. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2580. @end example
  2581. will create an output Matroska file with two audio streams, one containing only
  2582. the left channel and the other the right channel.
  2583. @item
  2584. Split a 5.1 WAV file into per-channel files:
  2585. @example
  2586. ffmpeg -i in.wav -filter_complex
  2587. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2588. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2589. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2590. side_right.wav
  2591. @end example
  2592. @item
  2593. Extract only LFE from a 5.1 WAV file:
  2594. @example
  2595. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2596. -map '[LFE]' lfe.wav
  2597. @end example
  2598. @end itemize
  2599. @section chorus
  2600. Add a chorus effect to the audio.
  2601. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2602. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2603. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2604. The modulation depth defines the range the modulated delay is played before or after
  2605. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2606. sound tuned around the original one, like in a chorus where some vocals are slightly
  2607. off key.
  2608. It accepts the following parameters:
  2609. @table @option
  2610. @item in_gain
  2611. Set input gain. Default is 0.4.
  2612. @item out_gain
  2613. Set output gain. Default is 0.4.
  2614. @item delays
  2615. Set delays. A typical delay is around 40ms to 60ms.
  2616. @item decays
  2617. Set decays.
  2618. @item speeds
  2619. Set speeds.
  2620. @item depths
  2621. Set depths.
  2622. @end table
  2623. @subsection Examples
  2624. @itemize
  2625. @item
  2626. A single delay:
  2627. @example
  2628. chorus=0.7:0.9:55:0.4:0.25:2
  2629. @end example
  2630. @item
  2631. Two delays:
  2632. @example
  2633. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2634. @end example
  2635. @item
  2636. Fuller sounding chorus with three delays:
  2637. @example
  2638. 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
  2639. @end example
  2640. @end itemize
  2641. @section compand
  2642. Compress or expand the audio's dynamic range.
  2643. It accepts the following parameters:
  2644. @table @option
  2645. @item attacks
  2646. @item decays
  2647. A list of times in seconds for each channel over which the instantaneous level
  2648. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2649. increase of volume and @var{decays} refers to decrease of volume. For most
  2650. situations, the attack time (response to the audio getting louder) should be
  2651. shorter than the decay time, because the human ear is more sensitive to sudden
  2652. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2653. a typical value for decay is 0.8 seconds.
  2654. If specified number of attacks & decays is lower than number of channels, the last
  2655. set attack/decay will be used for all remaining channels.
  2656. @item points
  2657. A list of points for the transfer function, specified in dB relative to the
  2658. maximum possible signal amplitude. Each key points list must be defined using
  2659. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2660. @code{x0/y0 x1/y1 x2/y2 ....}
  2661. The input values must be in strictly increasing order but the transfer function
  2662. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2663. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2664. function are @code{-70/-70|-60/-20|1/0}.
  2665. @item soft-knee
  2666. Set the curve radius in dB for all joints. It defaults to 0.01.
  2667. @item gain
  2668. Set the additional gain in dB to be applied at all points on the transfer
  2669. function. This allows for easy adjustment of the overall gain.
  2670. It defaults to 0.
  2671. @item volume
  2672. Set an initial volume, in dB, to be assumed for each channel when filtering
  2673. starts. This permits the user to supply a nominal level initially, so that, for
  2674. example, a very large gain is not applied to initial signal levels before the
  2675. companding has begun to operate. A typical value for audio which is initially
  2676. quiet is -90 dB. It defaults to 0.
  2677. @item delay
  2678. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2679. delayed before being fed to the volume adjuster. Specifying a delay
  2680. approximately equal to the attack/decay times allows the filter to effectively
  2681. operate in predictive rather than reactive mode. It defaults to 0.
  2682. @end table
  2683. @subsection Examples
  2684. @itemize
  2685. @item
  2686. Make music with both quiet and loud passages suitable for listening to in a
  2687. noisy environment:
  2688. @example
  2689. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2690. @end example
  2691. Another example for audio with whisper and explosion parts:
  2692. @example
  2693. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2694. @end example
  2695. @item
  2696. A noise gate for when the noise is at a lower level than the signal:
  2697. @example
  2698. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2699. @end example
  2700. @item
  2701. Here is another noise gate, this time for when the noise is at a higher level
  2702. than the signal (making it, in some ways, similar to squelch):
  2703. @example
  2704. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2705. @end example
  2706. @item
  2707. 2:1 compression starting at -6dB:
  2708. @example
  2709. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2710. @end example
  2711. @item
  2712. 2:1 compression starting at -9dB:
  2713. @example
  2714. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2715. @end example
  2716. @item
  2717. 2:1 compression starting at -12dB:
  2718. @example
  2719. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2720. @end example
  2721. @item
  2722. 2:1 compression starting at -18dB:
  2723. @example
  2724. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2725. @end example
  2726. @item
  2727. 3:1 compression starting at -15dB:
  2728. @example
  2729. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2730. @end example
  2731. @item
  2732. Compressor/Gate:
  2733. @example
  2734. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2735. @end example
  2736. @item
  2737. Expander:
  2738. @example
  2739. 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
  2740. @end example
  2741. @item
  2742. Hard limiter at -6dB:
  2743. @example
  2744. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2745. @end example
  2746. @item
  2747. Hard limiter at -12dB:
  2748. @example
  2749. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2750. @end example
  2751. @item
  2752. Hard noise gate at -35 dB:
  2753. @example
  2754. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2755. @end example
  2756. @item
  2757. Soft limiter:
  2758. @example
  2759. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2760. @end example
  2761. @end itemize
  2762. @section compensationdelay
  2763. Compensation Delay Line is a metric based delay to compensate differing
  2764. positions of microphones or speakers.
  2765. For example, you have recorded guitar with two microphones placed in
  2766. different locations. Because the front of sound wave has fixed speed in
  2767. normal conditions, the phasing of microphones can vary and depends on
  2768. their location and interposition. The best sound mix can be achieved when
  2769. these microphones are in phase (synchronized). Note that a distance of
  2770. ~30 cm between microphones makes one microphone capture the signal in
  2771. antiphase to the other microphone. That makes the final mix sound moody.
  2772. This filter helps to solve phasing problems by adding different delays
  2773. to each microphone track and make them synchronized.
  2774. The best result can be reached when you take one track as base and
  2775. synchronize other tracks one by one with it.
  2776. Remember that synchronization/delay tolerance depends on sample rate, too.
  2777. Higher sample rates will give more tolerance.
  2778. The filter accepts the following parameters:
  2779. @table @option
  2780. @item mm
  2781. Set millimeters distance. This is compensation distance for fine tuning.
  2782. Default is 0.
  2783. @item cm
  2784. Set cm distance. This is compensation distance for tightening distance setup.
  2785. Default is 0.
  2786. @item m
  2787. Set meters distance. This is compensation distance for hard distance setup.
  2788. Default is 0.
  2789. @item dry
  2790. Set dry amount. Amount of unprocessed (dry) signal.
  2791. Default is 0.
  2792. @item wet
  2793. Set wet amount. Amount of processed (wet) signal.
  2794. Default is 1.
  2795. @item temp
  2796. Set temperature in degrees Celsius. This is the temperature of the environment.
  2797. Default is 20.
  2798. @end table
  2799. @section crossfeed
  2800. Apply headphone crossfeed filter.
  2801. Crossfeed is the process of blending the left and right channels of stereo
  2802. audio recording.
  2803. It is mainly used to reduce extreme stereo separation of low frequencies.
  2804. The intent is to produce more speaker like sound to the listener.
  2805. The filter accepts the following options:
  2806. @table @option
  2807. @item strength
  2808. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2809. This sets gain of low shelf filter for side part of stereo image.
  2810. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2811. @item range
  2812. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2813. This sets cut off frequency of low shelf filter. Default is cut off near
  2814. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2815. @item slope
  2816. Set curve slope of low shelf filter. Default is 0.5.
  2817. Allowed range is from 0.01 to 1.
  2818. @item level_in
  2819. Set input gain. Default is 0.9.
  2820. @item level_out
  2821. Set output gain. Default is 1.
  2822. @end table
  2823. @subsection Commands
  2824. This filter supports the all above options as @ref{commands}.
  2825. @section crystalizer
  2826. Simple algorithm for audio noise sharpening.
  2827. This filter linearly increases differences betweeen each audio sample.
  2828. The filter accepts the following options:
  2829. @table @option
  2830. @item i
  2831. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  2832. (unchanged sound) to 10.0 (maximum effect).
  2833. To inverse filtering use negative value.
  2834. @item c
  2835. Enable clipping. By default is enabled.
  2836. @end table
  2837. @subsection Commands
  2838. This filter supports the all above options as @ref{commands}.
  2839. @section dcshift
  2840. Apply a DC shift to the audio.
  2841. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2842. in the recording chain) from the audio. The effect of a DC offset is reduced
  2843. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2844. a signal has a DC offset.
  2845. @table @option
  2846. @item shift
  2847. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2848. the audio.
  2849. @item limitergain
  2850. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2851. used to prevent clipping.
  2852. @end table
  2853. @section deesser
  2854. Apply de-essing to the audio samples.
  2855. @table @option
  2856. @item i
  2857. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2858. Default is 0.
  2859. @item m
  2860. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2861. Default is 0.5.
  2862. @item f
  2863. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2864. Default is 0.5.
  2865. @item s
  2866. Set the output mode.
  2867. It accepts the following values:
  2868. @table @option
  2869. @item i
  2870. Pass input unchanged.
  2871. @item o
  2872. Pass ess filtered out.
  2873. @item e
  2874. Pass only ess.
  2875. Default value is @var{o}.
  2876. @end table
  2877. @end table
  2878. @section drmeter
  2879. Measure audio dynamic range.
  2880. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2881. is found in transition material. And anything less that 8 have very poor dynamics
  2882. and is very compressed.
  2883. The filter accepts the following options:
  2884. @table @option
  2885. @item length
  2886. Set window length in seconds used to split audio into segments of equal length.
  2887. Default is 3 seconds.
  2888. @end table
  2889. @section dynaudnorm
  2890. Dynamic Audio Normalizer.
  2891. This filter applies a certain amount of gain to the input audio in order
  2892. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2893. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2894. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2895. This allows for applying extra gain to the "quiet" sections of the audio
  2896. while avoiding distortions or clipping the "loud" sections. In other words:
  2897. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2898. sections, in the sense that the volume of each section is brought to the
  2899. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2900. this goal *without* applying "dynamic range compressing". It will retain 100%
  2901. of the dynamic range *within* each section of the audio file.
  2902. @table @option
  2903. @item framelen, f
  2904. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2905. Default is 500 milliseconds.
  2906. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2907. referred to as frames. This is required, because a peak magnitude has no
  2908. meaning for just a single sample value. Instead, we need to determine the
  2909. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2910. normalizer would simply use the peak magnitude of the complete file, the
  2911. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2912. frame. The length of a frame is specified in milliseconds. By default, the
  2913. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2914. been found to give good results with most files.
  2915. Note that the exact frame length, in number of samples, will be determined
  2916. automatically, based on the sampling rate of the individual input audio file.
  2917. @item gausssize, g
  2918. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2919. number. Default is 31.
  2920. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2921. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2922. is specified in frames, centered around the current frame. For the sake of
  2923. simplicity, this must be an odd number. Consequently, the default value of 31
  2924. takes into account the current frame, as well as the 15 preceding frames and
  2925. the 15 subsequent frames. Using a larger window results in a stronger
  2926. smoothing effect and thus in less gain variation, i.e. slower gain
  2927. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2928. effect and thus in more gain variation, i.e. faster gain adaptation.
  2929. In other words, the more you increase this value, the more the Dynamic Audio
  2930. Normalizer will behave like a "traditional" normalization filter. On the
  2931. contrary, the more you decrease this value, the more the Dynamic Audio
  2932. Normalizer will behave like a dynamic range compressor.
  2933. @item peak, p
  2934. Set the target peak value. This specifies the highest permissible magnitude
  2935. level for the normalized audio input. This filter will try to approach the
  2936. target peak magnitude as closely as possible, but at the same time it also
  2937. makes sure that the normalized signal will never exceed the peak magnitude.
  2938. A frame's maximum local gain factor is imposed directly by the target peak
  2939. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2940. It is not recommended to go above this value.
  2941. @item maxgain, m
  2942. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2943. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2944. factor for each input frame, i.e. the maximum gain factor that does not
  2945. result in clipping or distortion. The maximum gain factor is determined by
  2946. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2947. additionally bounds the frame's maximum gain factor by a predetermined
  2948. (global) maximum gain factor. This is done in order to avoid excessive gain
  2949. factors in "silent" or almost silent frames. By default, the maximum gain
  2950. factor is 10.0, For most inputs the default value should be sufficient and
  2951. it usually is not recommended to increase this value. Though, for input
  2952. with an extremely low overall volume level, it may be necessary to allow even
  2953. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2954. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2955. Instead, a "sigmoid" threshold function will be applied. This way, the
  2956. gain factors will smoothly approach the threshold value, but never exceed that
  2957. value.
  2958. @item targetrms, r
  2959. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2960. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2961. This means that the maximum local gain factor for each frame is defined
  2962. (only) by the frame's highest magnitude sample. This way, the samples can
  2963. be amplified as much as possible without exceeding the maximum signal
  2964. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2965. Normalizer can also take into account the frame's root mean square,
  2966. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2967. determine the power of a time-varying signal. It is therefore considered
  2968. that the RMS is a better approximation of the "perceived loudness" than
  2969. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2970. frames to a constant RMS value, a uniform "perceived loudness" can be
  2971. established. If a target RMS value has been specified, a frame's local gain
  2972. factor is defined as the factor that would result in exactly that RMS value.
  2973. Note, however, that the maximum local gain factor is still restricted by the
  2974. frame's highest magnitude sample, in order to prevent clipping.
  2975. @item coupling, n
  2976. Enable channels coupling. By default is enabled.
  2977. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2978. amount. This means the same gain factor will be applied to all channels, i.e.
  2979. the maximum possible gain factor is determined by the "loudest" channel.
  2980. However, in some recordings, it may happen that the volume of the different
  2981. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2982. In this case, this option can be used to disable the channel coupling. This way,
  2983. the gain factor will be determined independently for each channel, depending
  2984. only on the individual channel's highest magnitude sample. This allows for
  2985. harmonizing the volume of the different channels.
  2986. @item correctdc, c
  2987. Enable DC bias correction. By default is disabled.
  2988. An audio signal (in the time domain) is a sequence of sample values.
  2989. In the Dynamic Audio Normalizer these sample values are represented in the
  2990. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2991. audio signal, or "waveform", should be centered around the zero point.
  2992. That means if we calculate the mean value of all samples in a file, or in a
  2993. single frame, then the result should be 0.0 or at least very close to that
  2994. value. If, however, there is a significant deviation of the mean value from
  2995. 0.0, in either positive or negative direction, this is referred to as a
  2996. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2997. Audio Normalizer provides optional DC bias correction.
  2998. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2999. the mean value, or "DC correction" offset, of each input frame and subtract
  3000. that value from all of the frame's sample values which ensures those samples
  3001. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3002. boundaries, the DC correction offset values will be interpolated smoothly
  3003. between neighbouring frames.
  3004. @item altboundary, b
  3005. Enable alternative boundary mode. By default is disabled.
  3006. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3007. around each frame. This includes the preceding frames as well as the
  3008. subsequent frames. However, for the "boundary" frames, located at the very
  3009. beginning and at the very end of the audio file, not all neighbouring
  3010. frames are available. In particular, for the first few frames in the audio
  3011. file, the preceding frames are not known. And, similarly, for the last few
  3012. frames in the audio file, the subsequent frames are not known. Thus, the
  3013. question arises which gain factors should be assumed for the missing frames
  3014. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3015. to deal with this situation. The default boundary mode assumes a gain factor
  3016. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3017. "fade out" at the beginning and at the end of the input, respectively.
  3018. @item compress, s
  3019. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3020. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3021. compression. This means that signal peaks will not be pruned and thus the
  3022. full dynamic range will be retained within each local neighbourhood. However,
  3023. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3024. normalization algorithm with a more "traditional" compression.
  3025. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3026. (thresholding) function. If (and only if) the compression feature is enabled,
  3027. all input frames will be processed by a soft knee thresholding function prior
  3028. to the actual normalization process. Put simply, the thresholding function is
  3029. going to prune all samples whose magnitude exceeds a certain threshold value.
  3030. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3031. value. Instead, the threshold value will be adjusted for each individual
  3032. frame.
  3033. In general, smaller parameters result in stronger compression, and vice versa.
  3034. Values below 3.0 are not recommended, because audible distortion may appear.
  3035. @item threshold, t
  3036. Set the target threshold value. This specifies the lowest permissible
  3037. magnitude level for the audio input which will be normalized.
  3038. If input frame volume is above this value frame will be normalized.
  3039. Otherwise frame may not be normalized at all. The default value is set
  3040. to 0, which means all input frames will be normalized.
  3041. This option is mostly useful if digital noise is not wanted to be amplified.
  3042. @end table
  3043. @subsection Commands
  3044. This filter supports the all above options as @ref{commands}.
  3045. @section earwax
  3046. Make audio easier to listen to on headphones.
  3047. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3048. so that when listened to on headphones the stereo image is moved from
  3049. inside your head (standard for headphones) to outside and in front of
  3050. the listener (standard for speakers).
  3051. Ported from SoX.
  3052. @section equalizer
  3053. Apply a two-pole peaking equalisation (EQ) filter. With this
  3054. filter, the signal-level at and around a selected frequency can
  3055. be increased or decreased, whilst (unlike bandpass and bandreject
  3056. filters) that at all other frequencies is unchanged.
  3057. In order to produce complex equalisation curves, this filter can
  3058. be given several times, each with a different central frequency.
  3059. The filter accepts the following options:
  3060. @table @option
  3061. @item frequency, f
  3062. Set the filter's central frequency in Hz.
  3063. @item width_type, t
  3064. Set method to specify band-width of filter.
  3065. @table @option
  3066. @item h
  3067. Hz
  3068. @item q
  3069. Q-Factor
  3070. @item o
  3071. octave
  3072. @item s
  3073. slope
  3074. @item k
  3075. kHz
  3076. @end table
  3077. @item width, w
  3078. Specify the band-width of a filter in width_type units.
  3079. @item gain, g
  3080. Set the required gain or attenuation in dB.
  3081. Beware of clipping when using a positive gain.
  3082. @item mix, m
  3083. How much to use filtered signal in output. Default is 1.
  3084. Range is between 0 and 1.
  3085. @item channels, c
  3086. Specify which channels to filter, by default all available are filtered.
  3087. @item normalize, n
  3088. Normalize biquad coefficients, by default is disabled.
  3089. Enabling it will normalize magnitude response at DC to 0dB.
  3090. @item transform, a
  3091. Set transform type of IIR filter.
  3092. @table @option
  3093. @item di
  3094. @item dii
  3095. @item tdii
  3096. @item latt
  3097. @end table
  3098. @item precision, r
  3099. Set precison of filtering.
  3100. @table @option
  3101. @item auto
  3102. Pick automatic sample format depending on surround filters.
  3103. @item s16
  3104. Always use signed 16-bit.
  3105. @item s32
  3106. Always use signed 32-bit.
  3107. @item f32
  3108. Always use float 32-bit.
  3109. @item f64
  3110. Always use float 64-bit.
  3111. @end table
  3112. @end table
  3113. @subsection Examples
  3114. @itemize
  3115. @item
  3116. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3117. @example
  3118. equalizer=f=1000:t=h:width=200:g=-10
  3119. @end example
  3120. @item
  3121. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3122. @example
  3123. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3124. @end example
  3125. @end itemize
  3126. @subsection Commands
  3127. This filter supports the following commands:
  3128. @table @option
  3129. @item frequency, f
  3130. Change equalizer frequency.
  3131. Syntax for the command is : "@var{frequency}"
  3132. @item width_type, t
  3133. Change equalizer width_type.
  3134. Syntax for the command is : "@var{width_type}"
  3135. @item width, w
  3136. Change equalizer width.
  3137. Syntax for the command is : "@var{width}"
  3138. @item gain, g
  3139. Change equalizer gain.
  3140. Syntax for the command is : "@var{gain}"
  3141. @item mix, m
  3142. Change equalizer mix.
  3143. Syntax for the command is : "@var{mix}"
  3144. @end table
  3145. @section extrastereo
  3146. Linearly increases the difference between left and right channels which
  3147. adds some sort of "live" effect to playback.
  3148. The filter accepts the following options:
  3149. @table @option
  3150. @item m
  3151. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3152. (average of both channels), with 1.0 sound will be unchanged, with
  3153. -1.0 left and right channels will be swapped.
  3154. @item c
  3155. Enable clipping. By default is enabled.
  3156. @end table
  3157. @subsection Commands
  3158. This filter supports the all above options as @ref{commands}.
  3159. @section firequalizer
  3160. Apply FIR Equalization using arbitrary frequency response.
  3161. The filter accepts the following option:
  3162. @table @option
  3163. @item gain
  3164. Set gain curve equation (in dB). The expression can contain variables:
  3165. @table @option
  3166. @item f
  3167. the evaluated frequency
  3168. @item sr
  3169. sample rate
  3170. @item ch
  3171. channel number, set to 0 when multichannels evaluation is disabled
  3172. @item chid
  3173. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3174. multichannels evaluation is disabled
  3175. @item chs
  3176. number of channels
  3177. @item chlayout
  3178. channel_layout, see libavutil/channel_layout.h
  3179. @end table
  3180. and functions:
  3181. @table @option
  3182. @item gain_interpolate(f)
  3183. interpolate gain on frequency f based on gain_entry
  3184. @item cubic_interpolate(f)
  3185. same as gain_interpolate, but smoother
  3186. @end table
  3187. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3188. @item gain_entry
  3189. Set gain entry for gain_interpolate function. The expression can
  3190. contain functions:
  3191. @table @option
  3192. @item entry(f, g)
  3193. store gain entry at frequency f with value g
  3194. @end table
  3195. This option is also available as command.
  3196. @item delay
  3197. Set filter delay in seconds. Higher value means more accurate.
  3198. Default is @code{0.01}.
  3199. @item accuracy
  3200. Set filter accuracy in Hz. Lower value means more accurate.
  3201. Default is @code{5}.
  3202. @item wfunc
  3203. Set window function. Acceptable values are:
  3204. @table @option
  3205. @item rectangular
  3206. rectangular window, useful when gain curve is already smooth
  3207. @item hann
  3208. hann window (default)
  3209. @item hamming
  3210. hamming window
  3211. @item blackman
  3212. blackman window
  3213. @item nuttall3
  3214. 3-terms continuous 1st derivative nuttall window
  3215. @item mnuttall3
  3216. minimum 3-terms discontinuous nuttall window
  3217. @item nuttall
  3218. 4-terms continuous 1st derivative nuttall window
  3219. @item bnuttall
  3220. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3221. @item bharris
  3222. blackman-harris window
  3223. @item tukey
  3224. tukey window
  3225. @end table
  3226. @item fixed
  3227. If enabled, use fixed number of audio samples. This improves speed when
  3228. filtering with large delay. Default is disabled.
  3229. @item multi
  3230. Enable multichannels evaluation on gain. Default is disabled.
  3231. @item zero_phase
  3232. Enable zero phase mode by subtracting timestamp to compensate delay.
  3233. Default is disabled.
  3234. @item scale
  3235. Set scale used by gain. Acceptable values are:
  3236. @table @option
  3237. @item linlin
  3238. linear frequency, linear gain
  3239. @item linlog
  3240. linear frequency, logarithmic (in dB) gain (default)
  3241. @item loglin
  3242. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3243. @item loglog
  3244. logarithmic frequency, logarithmic gain
  3245. @end table
  3246. @item dumpfile
  3247. Set file for dumping, suitable for gnuplot.
  3248. @item dumpscale
  3249. Set scale for dumpfile. Acceptable values are same with scale option.
  3250. Default is linlog.
  3251. @item fft2
  3252. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3253. Default is disabled.
  3254. @item min_phase
  3255. Enable minimum phase impulse response. Default is disabled.
  3256. @end table
  3257. @subsection Examples
  3258. @itemize
  3259. @item
  3260. lowpass at 1000 Hz:
  3261. @example
  3262. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3263. @end example
  3264. @item
  3265. lowpass at 1000 Hz with gain_entry:
  3266. @example
  3267. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3268. @end example
  3269. @item
  3270. custom equalization:
  3271. @example
  3272. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3273. @end example
  3274. @item
  3275. higher delay with zero phase to compensate delay:
  3276. @example
  3277. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3278. @end example
  3279. @item
  3280. lowpass on left channel, highpass on right channel:
  3281. @example
  3282. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3283. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3284. @end example
  3285. @end itemize
  3286. @section flanger
  3287. Apply a flanging effect to the audio.
  3288. The filter accepts the following options:
  3289. @table @option
  3290. @item delay
  3291. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3292. @item depth
  3293. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3294. @item regen
  3295. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3296. Default value is 0.
  3297. @item width
  3298. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3299. Default value is 71.
  3300. @item speed
  3301. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3302. @item shape
  3303. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3304. Default value is @var{sinusoidal}.
  3305. @item phase
  3306. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3307. Default value is 25.
  3308. @item interp
  3309. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3310. Default is @var{linear}.
  3311. @end table
  3312. @section haas
  3313. Apply Haas effect to audio.
  3314. Note that this makes most sense to apply on mono signals.
  3315. With this filter applied to mono signals it give some directionality and
  3316. stretches its stereo image.
  3317. The filter accepts the following options:
  3318. @table @option
  3319. @item level_in
  3320. Set input level. By default is @var{1}, or 0dB
  3321. @item level_out
  3322. Set output level. By default is @var{1}, or 0dB.
  3323. @item side_gain
  3324. Set gain applied to side part of signal. By default is @var{1}.
  3325. @item middle_source
  3326. Set kind of middle source. Can be one of the following:
  3327. @table @samp
  3328. @item left
  3329. Pick left channel.
  3330. @item right
  3331. Pick right channel.
  3332. @item mid
  3333. Pick middle part signal of stereo image.
  3334. @item side
  3335. Pick side part signal of stereo image.
  3336. @end table
  3337. @item middle_phase
  3338. Change middle phase. By default is disabled.
  3339. @item left_delay
  3340. Set left channel delay. By default is @var{2.05} milliseconds.
  3341. @item left_balance
  3342. Set left channel balance. By default is @var{-1}.
  3343. @item left_gain
  3344. Set left channel gain. By default is @var{1}.
  3345. @item left_phase
  3346. Change left phase. By default is disabled.
  3347. @item right_delay
  3348. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3349. @item right_balance
  3350. Set right channel balance. By default is @var{1}.
  3351. @item right_gain
  3352. Set right channel gain. By default is @var{1}.
  3353. @item right_phase
  3354. Change right phase. By default is enabled.
  3355. @end table
  3356. @section hdcd
  3357. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3358. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3359. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3360. of HDCD, and detects the Transient Filter flag.
  3361. @example
  3362. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3363. @end example
  3364. When using the filter with wav, note the default encoding for wav is 16-bit,
  3365. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3366. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3367. @example
  3368. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3369. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3370. @end example
  3371. The filter accepts the following options:
  3372. @table @option
  3373. @item disable_autoconvert
  3374. Disable any automatic format conversion or resampling in the filter graph.
  3375. @item process_stereo
  3376. Process the stereo channels together. If target_gain does not match between
  3377. channels, consider it invalid and use the last valid target_gain.
  3378. @item cdt_ms
  3379. Set the code detect timer period in ms.
  3380. @item force_pe
  3381. Always extend peaks above -3dBFS even if PE isn't signaled.
  3382. @item analyze_mode
  3383. Replace audio with a solid tone and adjust the amplitude to signal some
  3384. specific aspect of the decoding process. The output file can be loaded in
  3385. an audio editor alongside the original to aid analysis.
  3386. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3387. Modes are:
  3388. @table @samp
  3389. @item 0, off
  3390. Disabled
  3391. @item 1, lle
  3392. Gain adjustment level at each sample
  3393. @item 2, pe
  3394. Samples where peak extend occurs
  3395. @item 3, cdt
  3396. Samples where the code detect timer is active
  3397. @item 4, tgm
  3398. Samples where the target gain does not match between channels
  3399. @end table
  3400. @end table
  3401. @section headphone
  3402. Apply head-related transfer functions (HRTFs) to create virtual
  3403. loudspeakers around the user for binaural listening via headphones.
  3404. The HRIRs are provided via additional streams, for each channel
  3405. one stereo input stream is needed.
  3406. The filter accepts the following options:
  3407. @table @option
  3408. @item map
  3409. Set mapping of input streams for convolution.
  3410. The argument is a '|'-separated list of channel names in order as they
  3411. are given as additional stream inputs for filter.
  3412. This also specify number of input streams. Number of input streams
  3413. must be not less than number of channels in first stream plus one.
  3414. @item gain
  3415. Set gain applied to audio. Value is in dB. Default is 0.
  3416. @item type
  3417. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3418. processing audio in time domain which is slow.
  3419. @var{freq} is processing audio in frequency domain which is fast.
  3420. Default is @var{freq}.
  3421. @item lfe
  3422. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3423. @item size
  3424. Set size of frame in number of samples which will be processed at once.
  3425. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3426. @item hrir
  3427. Set format of hrir stream.
  3428. Default value is @var{stereo}. Alternative value is @var{multich}.
  3429. If value is set to @var{stereo}, number of additional streams should
  3430. be greater or equal to number of input channels in first input stream.
  3431. Also each additional stream should have stereo number of channels.
  3432. If value is set to @var{multich}, number of additional streams should
  3433. be exactly one. Also number of input channels of additional stream
  3434. should be equal or greater than twice number of channels of first input
  3435. stream.
  3436. @end table
  3437. @subsection Examples
  3438. @itemize
  3439. @item
  3440. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3441. each amovie filter use stereo file with IR coefficients as input.
  3442. The files give coefficients for each position of virtual loudspeaker:
  3443. @example
  3444. ffmpeg -i input.wav
  3445. -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"
  3446. output.wav
  3447. @end example
  3448. @item
  3449. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3450. but now in @var{multich} @var{hrir} format.
  3451. @example
  3452. 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"
  3453. output.wav
  3454. @end example
  3455. @end itemize
  3456. @section highpass
  3457. Apply a high-pass filter with 3dB point frequency.
  3458. The filter can be either single-pole, or double-pole (the default).
  3459. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3460. The filter accepts the following options:
  3461. @table @option
  3462. @item frequency, f
  3463. Set frequency in Hz. Default is 3000.
  3464. @item poles, p
  3465. Set number of poles. Default is 2.
  3466. @item width_type, t
  3467. Set method to specify band-width of filter.
  3468. @table @option
  3469. @item h
  3470. Hz
  3471. @item q
  3472. Q-Factor
  3473. @item o
  3474. octave
  3475. @item s
  3476. slope
  3477. @item k
  3478. kHz
  3479. @end table
  3480. @item width, w
  3481. Specify the band-width of a filter in width_type units.
  3482. Applies only to double-pole filter.
  3483. The default is 0.707q and gives a Butterworth response.
  3484. @item mix, m
  3485. How much to use filtered signal in output. Default is 1.
  3486. Range is between 0 and 1.
  3487. @item channels, c
  3488. Specify which channels to filter, by default all available are filtered.
  3489. @item normalize, n
  3490. Normalize biquad coefficients, by default is disabled.
  3491. Enabling it will normalize magnitude response at DC to 0dB.
  3492. @item transform, a
  3493. Set transform type of IIR filter.
  3494. @table @option
  3495. @item di
  3496. @item dii
  3497. @item tdii
  3498. @item latt
  3499. @end table
  3500. @item precision, r
  3501. Set precison of filtering.
  3502. @table @option
  3503. @item auto
  3504. Pick automatic sample format depending on surround filters.
  3505. @item s16
  3506. Always use signed 16-bit.
  3507. @item s32
  3508. Always use signed 32-bit.
  3509. @item f32
  3510. Always use float 32-bit.
  3511. @item f64
  3512. Always use float 64-bit.
  3513. @end table
  3514. @end table
  3515. @subsection Commands
  3516. This filter supports the following commands:
  3517. @table @option
  3518. @item frequency, f
  3519. Change highpass frequency.
  3520. Syntax for the command is : "@var{frequency}"
  3521. @item width_type, t
  3522. Change highpass width_type.
  3523. Syntax for the command is : "@var{width_type}"
  3524. @item width, w
  3525. Change highpass width.
  3526. Syntax for the command is : "@var{width}"
  3527. @item mix, m
  3528. Change highpass mix.
  3529. Syntax for the command is : "@var{mix}"
  3530. @end table
  3531. @section join
  3532. Join multiple input streams into one multi-channel stream.
  3533. It accepts the following parameters:
  3534. @table @option
  3535. @item inputs
  3536. The number of input streams. It defaults to 2.
  3537. @item channel_layout
  3538. The desired output channel layout. It defaults to stereo.
  3539. @item map
  3540. Map channels from inputs to output. The argument is a '|'-separated list of
  3541. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3542. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3543. can be either the name of the input channel (e.g. FL for front left) or its
  3544. index in the specified input stream. @var{out_channel} is the name of the output
  3545. channel.
  3546. @end table
  3547. The filter will attempt to guess the mappings when they are not specified
  3548. explicitly. It does so by first trying to find an unused matching input channel
  3549. and if that fails it picks the first unused input channel.
  3550. Join 3 inputs (with properly set channel layouts):
  3551. @example
  3552. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3553. @end example
  3554. Build a 5.1 output from 6 single-channel streams:
  3555. @example
  3556. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3557. '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'
  3558. out
  3559. @end example
  3560. @section ladspa
  3561. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3562. To enable compilation of this filter you need to configure FFmpeg with
  3563. @code{--enable-ladspa}.
  3564. @table @option
  3565. @item file, f
  3566. Specifies the name of LADSPA plugin library to load. If the environment
  3567. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3568. each one of the directories specified by the colon separated list in
  3569. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3570. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3571. @file{/usr/lib/ladspa/}.
  3572. @item plugin, p
  3573. Specifies the plugin within the library. Some libraries contain only
  3574. one plugin, but others contain many of them. If this is not set filter
  3575. will list all available plugins within the specified library.
  3576. @item controls, c
  3577. Set the '|' separated list of controls which are zero or more floating point
  3578. values that determine the behavior of the loaded plugin (for example delay,
  3579. threshold or gain).
  3580. Controls need to be defined using the following syntax:
  3581. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3582. @var{valuei} is the value set on the @var{i}-th control.
  3583. Alternatively they can be also defined using the following syntax:
  3584. @var{value0}|@var{value1}|@var{value2}|..., where
  3585. @var{valuei} is the value set on the @var{i}-th control.
  3586. If @option{controls} is set to @code{help}, all available controls and
  3587. their valid ranges are printed.
  3588. @item sample_rate, s
  3589. Specify the sample rate, default to 44100. Only used if plugin have
  3590. zero inputs.
  3591. @item nb_samples, n
  3592. Set the number of samples per channel per each output frame, default
  3593. is 1024. Only used if plugin have zero inputs.
  3594. @item duration, d
  3595. Set the minimum duration of the sourced audio. See
  3596. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3597. for the accepted syntax.
  3598. Note that the resulting duration may be greater than the specified duration,
  3599. as the generated audio is always cut at the end of a complete frame.
  3600. If not specified, or the expressed duration is negative, the audio is
  3601. supposed to be generated forever.
  3602. Only used if plugin have zero inputs.
  3603. @item latency, l
  3604. Enable latency compensation, by default is disabled.
  3605. Only used if plugin have inputs.
  3606. @end table
  3607. @subsection Examples
  3608. @itemize
  3609. @item
  3610. List all available plugins within amp (LADSPA example plugin) library:
  3611. @example
  3612. ladspa=file=amp
  3613. @end example
  3614. @item
  3615. List all available controls and their valid ranges for @code{vcf_notch}
  3616. plugin from @code{VCF} library:
  3617. @example
  3618. ladspa=f=vcf:p=vcf_notch:c=help
  3619. @end example
  3620. @item
  3621. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3622. plugin library:
  3623. @example
  3624. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3625. @end example
  3626. @item
  3627. Add reverberation to the audio using TAP-plugins
  3628. (Tom's Audio Processing plugins):
  3629. @example
  3630. ladspa=file=tap_reverb:tap_reverb
  3631. @end example
  3632. @item
  3633. Generate white noise, with 0.2 amplitude:
  3634. @example
  3635. ladspa=file=cmt:noise_source_white:c=c0=.2
  3636. @end example
  3637. @item
  3638. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3639. @code{C* Audio Plugin Suite} (CAPS) library:
  3640. @example
  3641. ladspa=file=caps:Click:c=c1=20'
  3642. @end example
  3643. @item
  3644. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3645. @example
  3646. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3647. @end example
  3648. @item
  3649. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3650. @code{SWH Plugins} collection:
  3651. @example
  3652. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3653. @end example
  3654. @item
  3655. Attenuate low frequencies using Multiband EQ from Steve Harris
  3656. @code{SWH Plugins} collection:
  3657. @example
  3658. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3659. @end example
  3660. @item
  3661. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3662. (CAPS) library:
  3663. @example
  3664. ladspa=caps:Narrower
  3665. @end example
  3666. @item
  3667. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3668. @example
  3669. ladspa=caps:White:.2
  3670. @end example
  3671. @item
  3672. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3673. @example
  3674. ladspa=caps:Fractal:c=c1=1
  3675. @end example
  3676. @item
  3677. Dynamic volume normalization using @code{VLevel} plugin:
  3678. @example
  3679. ladspa=vlevel-ladspa:vlevel_mono
  3680. @end example
  3681. @end itemize
  3682. @subsection Commands
  3683. This filter supports the following commands:
  3684. @table @option
  3685. @item cN
  3686. Modify the @var{N}-th control value.
  3687. If the specified value is not valid, it is ignored and prior one is kept.
  3688. @end table
  3689. @section loudnorm
  3690. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3691. Support for both single pass (livestreams, files) and double pass (files) modes.
  3692. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3693. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3694. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3695. The filter accepts the following options:
  3696. @table @option
  3697. @item I, i
  3698. Set integrated loudness target.
  3699. Range is -70.0 - -5.0. Default value is -24.0.
  3700. @item LRA, lra
  3701. Set loudness range target.
  3702. Range is 1.0 - 20.0. Default value is 7.0.
  3703. @item TP, tp
  3704. Set maximum true peak.
  3705. Range is -9.0 - +0.0. Default value is -2.0.
  3706. @item measured_I, measured_i
  3707. Measured IL of input file.
  3708. Range is -99.0 - +0.0.
  3709. @item measured_LRA, measured_lra
  3710. Measured LRA of input file.
  3711. Range is 0.0 - 99.0.
  3712. @item measured_TP, measured_tp
  3713. Measured true peak of input file.
  3714. Range is -99.0 - +99.0.
  3715. @item measured_thresh
  3716. Measured threshold of input file.
  3717. Range is -99.0 - +0.0.
  3718. @item offset
  3719. Set offset gain. Gain is applied before the true-peak limiter.
  3720. Range is -99.0 - +99.0. Default is +0.0.
  3721. @item linear
  3722. Normalize by linearly scaling the source audio.
  3723. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3724. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3725. be lower than source LRA and the change in integrated loudness shouldn't
  3726. result in a true peak which exceeds the target TP. If any of these
  3727. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3728. Options are @code{true} or @code{false}. Default is @code{true}.
  3729. @item dual_mono
  3730. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3731. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3732. If set to @code{true}, this option will compensate for this effect.
  3733. Multi-channel input files are not affected by this option.
  3734. Options are true or false. Default is false.
  3735. @item print_format
  3736. Set print format for stats. Options are summary, json, or none.
  3737. Default value is none.
  3738. @end table
  3739. @section lowpass
  3740. Apply a low-pass filter with 3dB point frequency.
  3741. The filter can be either single-pole or double-pole (the default).
  3742. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3743. The filter accepts the following options:
  3744. @table @option
  3745. @item frequency, f
  3746. Set frequency in Hz. Default is 500.
  3747. @item poles, p
  3748. Set number of poles. Default is 2.
  3749. @item width_type, t
  3750. Set method to specify band-width of filter.
  3751. @table @option
  3752. @item h
  3753. Hz
  3754. @item q
  3755. Q-Factor
  3756. @item o
  3757. octave
  3758. @item s
  3759. slope
  3760. @item k
  3761. kHz
  3762. @end table
  3763. @item width, w
  3764. Specify the band-width of a filter in width_type units.
  3765. Applies only to double-pole filter.
  3766. The default is 0.707q and gives a Butterworth response.
  3767. @item mix, m
  3768. How much to use filtered signal in output. Default is 1.
  3769. Range is between 0 and 1.
  3770. @item channels, c
  3771. Specify which channels to filter, by default all available are filtered.
  3772. @item normalize, n
  3773. Normalize biquad coefficients, by default is disabled.
  3774. Enabling it will normalize magnitude response at DC to 0dB.
  3775. @item transform, a
  3776. Set transform type of IIR filter.
  3777. @table @option
  3778. @item di
  3779. @item dii
  3780. @item tdii
  3781. @item latt
  3782. @end table
  3783. @item precision, r
  3784. Set precison of filtering.
  3785. @table @option
  3786. @item auto
  3787. Pick automatic sample format depending on surround filters.
  3788. @item s16
  3789. Always use signed 16-bit.
  3790. @item s32
  3791. Always use signed 32-bit.
  3792. @item f32
  3793. Always use float 32-bit.
  3794. @item f64
  3795. Always use float 64-bit.
  3796. @end table
  3797. @end table
  3798. @subsection Examples
  3799. @itemize
  3800. @item
  3801. Lowpass only LFE channel, it LFE is not present it does nothing:
  3802. @example
  3803. lowpass=c=LFE
  3804. @end example
  3805. @end itemize
  3806. @subsection Commands
  3807. This filter supports the following commands:
  3808. @table @option
  3809. @item frequency, f
  3810. Change lowpass frequency.
  3811. Syntax for the command is : "@var{frequency}"
  3812. @item width_type, t
  3813. Change lowpass width_type.
  3814. Syntax for the command is : "@var{width_type}"
  3815. @item width, w
  3816. Change lowpass width.
  3817. Syntax for the command is : "@var{width}"
  3818. @item mix, m
  3819. Change lowpass mix.
  3820. Syntax for the command is : "@var{mix}"
  3821. @end table
  3822. @section lv2
  3823. Load a LV2 (LADSPA Version 2) plugin.
  3824. To enable compilation of this filter you need to configure FFmpeg with
  3825. @code{--enable-lv2}.
  3826. @table @option
  3827. @item plugin, p
  3828. Specifies the plugin URI. You may need to escape ':'.
  3829. @item controls, c
  3830. Set the '|' separated list of controls which are zero or more floating point
  3831. values that determine the behavior of the loaded plugin (for example delay,
  3832. threshold or gain).
  3833. If @option{controls} is set to @code{help}, all available controls and
  3834. their valid ranges are printed.
  3835. @item sample_rate, s
  3836. Specify the sample rate, default to 44100. Only used if plugin have
  3837. zero inputs.
  3838. @item nb_samples, n
  3839. Set the number of samples per channel per each output frame, default
  3840. is 1024. Only used if plugin have zero inputs.
  3841. @item duration, d
  3842. Set the minimum duration of the sourced audio. See
  3843. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3844. for the accepted syntax.
  3845. Note that the resulting duration may be greater than the specified duration,
  3846. as the generated audio is always cut at the end of a complete frame.
  3847. If not specified, or the expressed duration is negative, the audio is
  3848. supposed to be generated forever.
  3849. Only used if plugin have zero inputs.
  3850. @end table
  3851. @subsection Examples
  3852. @itemize
  3853. @item
  3854. Apply bass enhancer plugin from Calf:
  3855. @example
  3856. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3857. @end example
  3858. @item
  3859. Apply vinyl plugin from Calf:
  3860. @example
  3861. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3862. @end example
  3863. @item
  3864. Apply bit crusher plugin from ArtyFX:
  3865. @example
  3866. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3867. @end example
  3868. @end itemize
  3869. @section mcompand
  3870. Multiband Compress or expand the audio's dynamic range.
  3871. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3872. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3873. response when absent compander action.
  3874. It accepts the following parameters:
  3875. @table @option
  3876. @item args
  3877. This option syntax is:
  3878. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3879. For explanation of each item refer to compand filter documentation.
  3880. @end table
  3881. @anchor{pan}
  3882. @section pan
  3883. Mix channels with specific gain levels. The filter accepts the output
  3884. channel layout followed by a set of channels definitions.
  3885. This filter is also designed to efficiently remap the channels of an audio
  3886. stream.
  3887. The filter accepts parameters of the form:
  3888. "@var{l}|@var{outdef}|@var{outdef}|..."
  3889. @table @option
  3890. @item l
  3891. output channel layout or number of channels
  3892. @item outdef
  3893. output channel specification, of the form:
  3894. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3895. @item out_name
  3896. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3897. number (c0, c1, etc.)
  3898. @item gain
  3899. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3900. @item in_name
  3901. input channel to use, see out_name for details; it is not possible to mix
  3902. named and numbered input channels
  3903. @end table
  3904. If the `=' in a channel specification is replaced by `<', then the gains for
  3905. that specification will be renormalized so that the total is 1, thus
  3906. avoiding clipping noise.
  3907. @subsection Mixing examples
  3908. For example, if you want to down-mix from stereo to mono, but with a bigger
  3909. factor for the left channel:
  3910. @example
  3911. pan=1c|c0=0.9*c0+0.1*c1
  3912. @end example
  3913. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3914. 7-channels surround:
  3915. @example
  3916. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3917. @end example
  3918. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3919. that should be preferred (see "-ac" option) unless you have very specific
  3920. needs.
  3921. @subsection Remapping examples
  3922. The channel remapping will be effective if, and only if:
  3923. @itemize
  3924. @item gain coefficients are zeroes or ones,
  3925. @item only one input per channel output,
  3926. @end itemize
  3927. If all these conditions are satisfied, the filter will notify the user ("Pure
  3928. channel mapping detected"), and use an optimized and lossless method to do the
  3929. remapping.
  3930. For example, if you have a 5.1 source and want a stereo audio stream by
  3931. dropping the extra channels:
  3932. @example
  3933. pan="stereo| c0=FL | c1=FR"
  3934. @end example
  3935. Given the same source, you can also switch front left and front right channels
  3936. and keep the input channel layout:
  3937. @example
  3938. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3939. @end example
  3940. If the input is a stereo audio stream, you can mute the front left channel (and
  3941. still keep the stereo channel layout) with:
  3942. @example
  3943. pan="stereo|c1=c1"
  3944. @end example
  3945. Still with a stereo audio stream input, you can copy the right channel in both
  3946. front left and right:
  3947. @example
  3948. pan="stereo| c0=FR | c1=FR"
  3949. @end example
  3950. @section replaygain
  3951. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3952. outputs it unchanged.
  3953. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3954. @section resample
  3955. Convert the audio sample format, sample rate and channel layout. It is
  3956. not meant to be used directly.
  3957. @section rubberband
  3958. Apply time-stretching and pitch-shifting with librubberband.
  3959. To enable compilation of this filter, you need to configure FFmpeg with
  3960. @code{--enable-librubberband}.
  3961. The filter accepts the following options:
  3962. @table @option
  3963. @item tempo
  3964. Set tempo scale factor.
  3965. @item pitch
  3966. Set pitch scale factor.
  3967. @item transients
  3968. Set transients detector.
  3969. Possible values are:
  3970. @table @var
  3971. @item crisp
  3972. @item mixed
  3973. @item smooth
  3974. @end table
  3975. @item detector
  3976. Set detector.
  3977. Possible values are:
  3978. @table @var
  3979. @item compound
  3980. @item percussive
  3981. @item soft
  3982. @end table
  3983. @item phase
  3984. Set phase.
  3985. Possible values are:
  3986. @table @var
  3987. @item laminar
  3988. @item independent
  3989. @end table
  3990. @item window
  3991. Set processing window size.
  3992. Possible values are:
  3993. @table @var
  3994. @item standard
  3995. @item short
  3996. @item long
  3997. @end table
  3998. @item smoothing
  3999. Set smoothing.
  4000. Possible values are:
  4001. @table @var
  4002. @item off
  4003. @item on
  4004. @end table
  4005. @item formant
  4006. Enable formant preservation when shift pitching.
  4007. Possible values are:
  4008. @table @var
  4009. @item shifted
  4010. @item preserved
  4011. @end table
  4012. @item pitchq
  4013. Set pitch quality.
  4014. Possible values are:
  4015. @table @var
  4016. @item quality
  4017. @item speed
  4018. @item consistency
  4019. @end table
  4020. @item channels
  4021. Set channels.
  4022. Possible values are:
  4023. @table @var
  4024. @item apart
  4025. @item together
  4026. @end table
  4027. @end table
  4028. @subsection Commands
  4029. This filter supports the following commands:
  4030. @table @option
  4031. @item tempo
  4032. Change filter tempo scale factor.
  4033. Syntax for the command is : "@var{tempo}"
  4034. @item pitch
  4035. Change filter pitch scale factor.
  4036. Syntax for the command is : "@var{pitch}"
  4037. @end table
  4038. @section sidechaincompress
  4039. This filter acts like normal compressor but has the ability to compress
  4040. detected signal using second input signal.
  4041. It needs two input streams and returns one output stream.
  4042. First input stream will be processed depending on second stream signal.
  4043. The filtered signal then can be filtered with other filters in later stages of
  4044. processing. See @ref{pan} and @ref{amerge} filter.
  4045. The filter accepts the following options:
  4046. @table @option
  4047. @item level_in
  4048. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4049. @item mode
  4050. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4051. Default is @code{downward}.
  4052. @item threshold
  4053. If a signal of second stream raises above this level it will affect the gain
  4054. reduction of first stream.
  4055. By default is 0.125. Range is between 0.00097563 and 1.
  4056. @item ratio
  4057. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4058. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4059. Default is 2. Range is between 1 and 20.
  4060. @item attack
  4061. Amount of milliseconds the signal has to rise above the threshold before gain
  4062. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4063. @item release
  4064. Amount of milliseconds the signal has to fall below the threshold before
  4065. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4066. @item makeup
  4067. Set the amount by how much signal will be amplified after processing.
  4068. Default is 1. Range is from 1 to 64.
  4069. @item knee
  4070. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4071. Default is 2.82843. Range is between 1 and 8.
  4072. @item link
  4073. Choose if the @code{average} level between all channels of side-chain stream
  4074. or the louder(@code{maximum}) channel of side-chain stream affects the
  4075. reduction. Default is @code{average}.
  4076. @item detection
  4077. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4078. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4079. @item level_sc
  4080. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4081. @item mix
  4082. How much to use compressed signal in output. Default is 1.
  4083. Range is between 0 and 1.
  4084. @end table
  4085. @subsection Commands
  4086. This filter supports the all above options as @ref{commands}.
  4087. @subsection Examples
  4088. @itemize
  4089. @item
  4090. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4091. depending on the signal of 2nd input and later compressed signal to be
  4092. merged with 2nd input:
  4093. @example
  4094. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4095. @end example
  4096. @end itemize
  4097. @section sidechaingate
  4098. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4099. filter the detected signal before sending it to the gain reduction stage.
  4100. Normally a gate uses the full range signal to detect a level above the
  4101. threshold.
  4102. For example: If you cut all lower frequencies from your sidechain signal
  4103. the gate will decrease the volume of your track only if not enough highs
  4104. appear. With this technique you are able to reduce the resonation of a
  4105. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4106. guitar.
  4107. It needs two input streams and returns one output stream.
  4108. First input stream will be processed depending on second stream signal.
  4109. The filter accepts the following options:
  4110. @table @option
  4111. @item level_in
  4112. Set input level before filtering.
  4113. Default is 1. Allowed range is from 0.015625 to 64.
  4114. @item mode
  4115. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4116. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4117. will be amplified, expanding dynamic range in upward direction.
  4118. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4119. @item range
  4120. Set the level of gain reduction when the signal is below the threshold.
  4121. Default is 0.06125. Allowed range is from 0 to 1.
  4122. Setting this to 0 disables reduction and then filter behaves like expander.
  4123. @item threshold
  4124. If a signal rises above this level the gain reduction is released.
  4125. Default is 0.125. Allowed range is from 0 to 1.
  4126. @item ratio
  4127. Set a ratio about which the signal is reduced.
  4128. Default is 2. Allowed range is from 1 to 9000.
  4129. @item attack
  4130. Amount of milliseconds the signal has to rise above the threshold before gain
  4131. reduction stops.
  4132. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4133. @item release
  4134. Amount of milliseconds the signal has to fall below the threshold before the
  4135. reduction is increased again. Default is 250 milliseconds.
  4136. Allowed range is from 0.01 to 9000.
  4137. @item makeup
  4138. Set amount of amplification of signal after processing.
  4139. Default is 1. Allowed range is from 1 to 64.
  4140. @item knee
  4141. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4142. Default is 2.828427125. Allowed range is from 1 to 8.
  4143. @item detection
  4144. Choose if exact signal should be taken for detection or an RMS like one.
  4145. Default is rms. Can be peak or rms.
  4146. @item link
  4147. Choose if the average level between all channels or the louder channel affects
  4148. the reduction.
  4149. Default is average. Can be average or maximum.
  4150. @item level_sc
  4151. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4152. @end table
  4153. @subsection Commands
  4154. This filter supports the all above options as @ref{commands}.
  4155. @section silencedetect
  4156. Detect silence in an audio stream.
  4157. This filter logs a message when it detects that the input audio volume is less
  4158. or equal to a noise tolerance value for a duration greater or equal to the
  4159. minimum detected noise duration.
  4160. The printed times and duration are expressed in seconds. The
  4161. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4162. is set on the first frame whose timestamp equals or exceeds the detection
  4163. duration and it contains the timestamp of the first frame of the silence.
  4164. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4165. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4166. keys are set on the first frame after the silence. If @option{mono} is
  4167. enabled, and each channel is evaluated separately, the @code{.X}
  4168. suffixed keys are used, and @code{X} corresponds to the channel number.
  4169. The filter accepts the following options:
  4170. @table @option
  4171. @item noise, n
  4172. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4173. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4174. @item duration, d
  4175. Set silence duration until notification (default is 2 seconds). See
  4176. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4177. for the accepted syntax.
  4178. @item mono, m
  4179. Process each channel separately, instead of combined. By default is disabled.
  4180. @end table
  4181. @subsection Examples
  4182. @itemize
  4183. @item
  4184. Detect 5 seconds of silence with -50dB noise tolerance:
  4185. @example
  4186. silencedetect=n=-50dB:d=5
  4187. @end example
  4188. @item
  4189. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4190. tolerance in @file{silence.mp3}:
  4191. @example
  4192. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4193. @end example
  4194. @end itemize
  4195. @section silenceremove
  4196. Remove silence from the beginning, middle or end of the audio.
  4197. The filter accepts the following options:
  4198. @table @option
  4199. @item start_periods
  4200. This value is used to indicate if audio should be trimmed at beginning of
  4201. the audio. A value of zero indicates no silence should be trimmed from the
  4202. beginning. When specifying a non-zero value, it trims audio up until it
  4203. finds non-silence. Normally, when trimming silence from beginning of audio
  4204. the @var{start_periods} will be @code{1} but it can be increased to higher
  4205. values to trim all audio up to specific count of non-silence periods.
  4206. Default value is @code{0}.
  4207. @item start_duration
  4208. Specify the amount of time that non-silence must be detected before it stops
  4209. trimming audio. By increasing the duration, bursts of noises can be treated
  4210. as silence and trimmed off. Default value is @code{0}.
  4211. @item start_threshold
  4212. This indicates what sample value should be treated as silence. For digital
  4213. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4214. you may wish to increase the value to account for background noise.
  4215. Can be specified in dB (in case "dB" is appended to the specified value)
  4216. or amplitude ratio. Default value is @code{0}.
  4217. @item start_silence
  4218. Specify max duration of silence at beginning that will be kept after
  4219. trimming. Default is 0, which is equal to trimming all samples detected
  4220. as silence.
  4221. @item start_mode
  4222. Specify mode of detection of silence end in start of multi-channel audio.
  4223. Can be @var{any} or @var{all}. Default is @var{any}.
  4224. With @var{any}, any sample that is detected as non-silence will cause
  4225. stopped trimming of silence.
  4226. With @var{all}, only if all channels are detected as non-silence will cause
  4227. stopped trimming of silence.
  4228. @item stop_periods
  4229. Set the count for trimming silence from the end of audio.
  4230. To remove silence from the middle of a file, specify a @var{stop_periods}
  4231. that is negative. This value is then treated as a positive value and is
  4232. used to indicate the effect should restart processing as specified by
  4233. @var{start_periods}, making it suitable for removing periods of silence
  4234. in the middle of the audio.
  4235. Default value is @code{0}.
  4236. @item stop_duration
  4237. Specify a duration of silence that must exist before audio is not copied any
  4238. more. By specifying a higher duration, silence that is wanted can be left in
  4239. the audio.
  4240. Default value is @code{0}.
  4241. @item stop_threshold
  4242. This is the same as @option{start_threshold} but for trimming silence from
  4243. the end of audio.
  4244. Can be specified in dB (in case "dB" is appended to the specified value)
  4245. or amplitude ratio. Default value is @code{0}.
  4246. @item stop_silence
  4247. Specify max duration of silence at end that will be kept after
  4248. trimming. Default is 0, which is equal to trimming all samples detected
  4249. as silence.
  4250. @item stop_mode
  4251. Specify mode of detection of silence start in end of multi-channel audio.
  4252. Can be @var{any} or @var{all}. Default is @var{any}.
  4253. With @var{any}, any sample that is detected as non-silence will cause
  4254. stopped trimming of silence.
  4255. With @var{all}, only if all channels are detected as non-silence will cause
  4256. stopped trimming of silence.
  4257. @item detection
  4258. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4259. and works better with digital silence which is exactly 0.
  4260. Default value is @code{rms}.
  4261. @item window
  4262. Set duration in number of seconds used to calculate size of window in number
  4263. of samples for detecting silence.
  4264. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4265. @end table
  4266. @subsection Examples
  4267. @itemize
  4268. @item
  4269. The following example shows how this filter can be used to start a recording
  4270. that does not contain the delay at the start which usually occurs between
  4271. pressing the record button and the start of the performance:
  4272. @example
  4273. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4274. @end example
  4275. @item
  4276. Trim all silence encountered from beginning to end where there is more than 1
  4277. second of silence in audio:
  4278. @example
  4279. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4280. @end example
  4281. @item
  4282. Trim all digital silence samples, using peak detection, from beginning to end
  4283. where there is more than 0 samples of digital silence in audio and digital
  4284. silence is detected in all channels at same positions in stream:
  4285. @example
  4286. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4287. @end example
  4288. @end itemize
  4289. @section sofalizer
  4290. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4291. loudspeakers around the user for binaural listening via headphones (audio
  4292. formats up to 9 channels supported).
  4293. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4294. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4295. Austrian Academy of Sciences.
  4296. To enable compilation of this filter you need to configure FFmpeg with
  4297. @code{--enable-libmysofa}.
  4298. The filter accepts the following options:
  4299. @table @option
  4300. @item sofa
  4301. Set the SOFA file used for rendering.
  4302. @item gain
  4303. Set gain applied to audio. Value is in dB. Default is 0.
  4304. @item rotation
  4305. Set rotation of virtual loudspeakers in deg. Default is 0.
  4306. @item elevation
  4307. Set elevation of virtual speakers in deg. Default is 0.
  4308. @item radius
  4309. Set distance in meters between loudspeakers and the listener with near-field
  4310. HRTFs. Default is 1.
  4311. @item type
  4312. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4313. processing audio in time domain which is slow.
  4314. @var{freq} is processing audio in frequency domain which is fast.
  4315. Default is @var{freq}.
  4316. @item speakers
  4317. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4318. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4319. Each virtual loudspeaker is described with short channel name following with
  4320. azimuth and elevation in degrees.
  4321. Each virtual loudspeaker description is separated by '|'.
  4322. For example to override front left and front right channel positions use:
  4323. 'speakers=FL 45 15|FR 345 15'.
  4324. Descriptions with unrecognised channel names are ignored.
  4325. @item lfegain
  4326. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4327. @item framesize
  4328. Set custom frame size in number of samples. Default is 1024.
  4329. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4330. is set to @var{freq}.
  4331. @item normalize
  4332. Should all IRs be normalized upon importing SOFA file.
  4333. By default is enabled.
  4334. @item interpolate
  4335. Should nearest IRs be interpolated with neighbor IRs if exact position
  4336. does not match. By default is disabled.
  4337. @item minphase
  4338. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4339. @item anglestep
  4340. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4341. @item radstep
  4342. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4343. @end table
  4344. @subsection Examples
  4345. @itemize
  4346. @item
  4347. Using ClubFritz6 sofa file:
  4348. @example
  4349. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4350. @end example
  4351. @item
  4352. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4353. @example
  4354. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4355. @end example
  4356. @item
  4357. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4358. and also with custom gain:
  4359. @example
  4360. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4361. @end example
  4362. @end itemize
  4363. @section speechnorm
  4364. Speech Normalizer.
  4365. This filter expands or compresses each half-cycle of audio samples
  4366. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4367. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4368. The filter accepts the following options:
  4369. @table @option
  4370. @item peak, p
  4371. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4372. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4373. @item expansion, e
  4374. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4375. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4376. would be such that local peak value reaches target peak value but never to surpass it and that
  4377. ratio between new and previous peak value does not surpass this option value.
  4378. @item compression, c
  4379. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4380. This option controls maximum local half-cycle of samples compression. This option is used
  4381. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4382. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4383. that peak's half-cycle will be compressed by current compression factor.
  4384. @item threshold, t
  4385. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4386. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4387. Any half-cycle samples with their local peak value below or same as this option value will be
  4388. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4389. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4390. @item raise, r
  4391. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4392. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4393. each new half-cycle until it reaches @option{expansion} value.
  4394. Setting this options too high may lead to distortions.
  4395. @item fall, f
  4396. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4397. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4398. each new half-cycle until it reaches @option{compression} value.
  4399. @item channels, h
  4400. Specify which channels to filter, by default all available channels are filtered.
  4401. @item invert, i
  4402. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4403. option. When enabled any half-cycle of samples with their local peak value below or same as
  4404. @option{threshold} option will be expanded otherwise it will be compressed.
  4405. @item link, l
  4406. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4407. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4408. is enabled the minimum of all possible gains for each filtered channel is used.
  4409. @end table
  4410. @subsection Commands
  4411. This filter supports the all above options as @ref{commands}.
  4412. @section stereotools
  4413. This filter has some handy utilities to manage stereo signals, for converting
  4414. M/S stereo recordings to L/R signal while having control over the parameters
  4415. or spreading the stereo image of master track.
  4416. The filter accepts the following options:
  4417. @table @option
  4418. @item level_in
  4419. Set input level before filtering for both channels. Defaults is 1.
  4420. Allowed range is from 0.015625 to 64.
  4421. @item level_out
  4422. Set output level after filtering for both channels. Defaults is 1.
  4423. Allowed range is from 0.015625 to 64.
  4424. @item balance_in
  4425. Set input balance between both channels. Default is 0.
  4426. Allowed range is from -1 to 1.
  4427. @item balance_out
  4428. Set output balance between both channels. Default is 0.
  4429. Allowed range is from -1 to 1.
  4430. @item softclip
  4431. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4432. clipping. Disabled by default.
  4433. @item mutel
  4434. Mute the left channel. Disabled by default.
  4435. @item muter
  4436. Mute the right channel. Disabled by default.
  4437. @item phasel
  4438. Change the phase of the left channel. Disabled by default.
  4439. @item phaser
  4440. Change the phase of the right channel. Disabled by default.
  4441. @item mode
  4442. Set stereo mode. Available values are:
  4443. @table @samp
  4444. @item lr>lr
  4445. Left/Right to Left/Right, this is default.
  4446. @item lr>ms
  4447. Left/Right to Mid/Side.
  4448. @item ms>lr
  4449. Mid/Side to Left/Right.
  4450. @item lr>ll
  4451. Left/Right to Left/Left.
  4452. @item lr>rr
  4453. Left/Right to Right/Right.
  4454. @item lr>l+r
  4455. Left/Right to Left + Right.
  4456. @item lr>rl
  4457. Left/Right to Right/Left.
  4458. @item ms>ll
  4459. Mid/Side to Left/Left.
  4460. @item ms>rr
  4461. Mid/Side to Right/Right.
  4462. @item ms>rl
  4463. Mid/Side to Right/Left.
  4464. @item lr>l-r
  4465. Left/Right to Left - Right.
  4466. @end table
  4467. @item slev
  4468. Set level of side signal. Default is 1.
  4469. Allowed range is from 0.015625 to 64.
  4470. @item sbal
  4471. Set balance of side signal. Default is 0.
  4472. Allowed range is from -1 to 1.
  4473. @item mlev
  4474. Set level of the middle signal. Default is 1.
  4475. Allowed range is from 0.015625 to 64.
  4476. @item mpan
  4477. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4478. @item base
  4479. Set stereo base between mono and inversed channels. Default is 0.
  4480. Allowed range is from -1 to 1.
  4481. @item delay
  4482. Set delay in milliseconds how much to delay left from right channel and
  4483. vice versa. Default is 0. Allowed range is from -20 to 20.
  4484. @item sclevel
  4485. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4486. @item phase
  4487. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4488. @item bmode_in, bmode_out
  4489. Set balance mode for balance_in/balance_out option.
  4490. Can be one of the following:
  4491. @table @samp
  4492. @item balance
  4493. Classic balance mode. Attenuate one channel at time.
  4494. Gain is raised up to 1.
  4495. @item amplitude
  4496. Similar as classic mode above but gain is raised up to 2.
  4497. @item power
  4498. Equal power distribution, from -6dB to +6dB range.
  4499. @end table
  4500. @end table
  4501. @subsection Commands
  4502. This filter supports the all above options as @ref{commands}.
  4503. @subsection Examples
  4504. @itemize
  4505. @item
  4506. Apply karaoke like effect:
  4507. @example
  4508. stereotools=mlev=0.015625
  4509. @end example
  4510. @item
  4511. Convert M/S signal to L/R:
  4512. @example
  4513. "stereotools=mode=ms>lr"
  4514. @end example
  4515. @end itemize
  4516. @section stereowiden
  4517. This filter enhance the stereo effect by suppressing signal common to both
  4518. channels and by delaying the signal of left into right and vice versa,
  4519. thereby widening the stereo effect.
  4520. The filter accepts the following options:
  4521. @table @option
  4522. @item delay
  4523. Time in milliseconds of the delay of left signal into right and vice versa.
  4524. Default is 20 milliseconds.
  4525. @item feedback
  4526. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4527. effect of left signal in right output and vice versa which gives widening
  4528. effect. Default is 0.3.
  4529. @item crossfeed
  4530. Cross feed of left into right with inverted phase. This helps in suppressing
  4531. the mono. If the value is 1 it will cancel all the signal common to both
  4532. channels. Default is 0.3.
  4533. @item drymix
  4534. Set level of input signal of original channel. Default is 0.8.
  4535. @end table
  4536. @subsection Commands
  4537. This filter supports the all above options except @code{delay} as @ref{commands}.
  4538. @section superequalizer
  4539. Apply 18 band equalizer.
  4540. The filter accepts the following options:
  4541. @table @option
  4542. @item 1b
  4543. Set 65Hz band gain.
  4544. @item 2b
  4545. Set 92Hz band gain.
  4546. @item 3b
  4547. Set 131Hz band gain.
  4548. @item 4b
  4549. Set 185Hz band gain.
  4550. @item 5b
  4551. Set 262Hz band gain.
  4552. @item 6b
  4553. Set 370Hz band gain.
  4554. @item 7b
  4555. Set 523Hz band gain.
  4556. @item 8b
  4557. Set 740Hz band gain.
  4558. @item 9b
  4559. Set 1047Hz band gain.
  4560. @item 10b
  4561. Set 1480Hz band gain.
  4562. @item 11b
  4563. Set 2093Hz band gain.
  4564. @item 12b
  4565. Set 2960Hz band gain.
  4566. @item 13b
  4567. Set 4186Hz band gain.
  4568. @item 14b
  4569. Set 5920Hz band gain.
  4570. @item 15b
  4571. Set 8372Hz band gain.
  4572. @item 16b
  4573. Set 11840Hz band gain.
  4574. @item 17b
  4575. Set 16744Hz band gain.
  4576. @item 18b
  4577. Set 20000Hz band gain.
  4578. @end table
  4579. @section surround
  4580. Apply audio surround upmix filter.
  4581. This filter allows to produce multichannel output from audio stream.
  4582. The filter accepts the following options:
  4583. @table @option
  4584. @item chl_out
  4585. Set output channel layout. By default, this is @var{5.1}.
  4586. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4587. for the required syntax.
  4588. @item chl_in
  4589. Set input channel layout. By default, this is @var{stereo}.
  4590. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4591. for the required syntax.
  4592. @item level_in
  4593. Set input volume level. By default, this is @var{1}.
  4594. @item level_out
  4595. Set output volume level. By default, this is @var{1}.
  4596. @item lfe
  4597. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4598. @item lfe_low
  4599. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4600. @item lfe_high
  4601. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4602. @item lfe_mode
  4603. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4604. In @var{add} mode, LFE channel is created from input audio and added to output.
  4605. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4606. also all non-LFE output channels are subtracted with output LFE channel.
  4607. @item angle
  4608. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4609. Default is @var{90}.
  4610. @item fc_in
  4611. Set front center input volume. By default, this is @var{1}.
  4612. @item fc_out
  4613. Set front center output volume. By default, this is @var{1}.
  4614. @item fl_in
  4615. Set front left input volume. By default, this is @var{1}.
  4616. @item fl_out
  4617. Set front left output volume. By default, this is @var{1}.
  4618. @item fr_in
  4619. Set front right input volume. By default, this is @var{1}.
  4620. @item fr_out
  4621. Set front right output volume. By default, this is @var{1}.
  4622. @item sl_in
  4623. Set side left input volume. By default, this is @var{1}.
  4624. @item sl_out
  4625. Set side left output volume. By default, this is @var{1}.
  4626. @item sr_in
  4627. Set side right input volume. By default, this is @var{1}.
  4628. @item sr_out
  4629. Set side right output volume. By default, this is @var{1}.
  4630. @item bl_in
  4631. Set back left input volume. By default, this is @var{1}.
  4632. @item bl_out
  4633. Set back left output volume. By default, this is @var{1}.
  4634. @item br_in
  4635. Set back right input volume. By default, this is @var{1}.
  4636. @item br_out
  4637. Set back right output volume. By default, this is @var{1}.
  4638. @item bc_in
  4639. Set back center input volume. By default, this is @var{1}.
  4640. @item bc_out
  4641. Set back center output volume. By default, this is @var{1}.
  4642. @item lfe_in
  4643. Set LFE input volume. By default, this is @var{1}.
  4644. @item lfe_out
  4645. Set LFE output volume. By default, this is @var{1}.
  4646. @item allx
  4647. Set spread usage of stereo image across X axis for all channels.
  4648. @item ally
  4649. Set spread usage of stereo image across Y axis for all channels.
  4650. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4651. Set spread usage of stereo image across X axis for each channel.
  4652. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4653. Set spread usage of stereo image across Y axis for each channel.
  4654. @item win_size
  4655. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4656. @item win_func
  4657. Set window function.
  4658. It accepts the following values:
  4659. @table @samp
  4660. @item rect
  4661. @item bartlett
  4662. @item hann, hanning
  4663. @item hamming
  4664. @item blackman
  4665. @item welch
  4666. @item flattop
  4667. @item bharris
  4668. @item bnuttall
  4669. @item bhann
  4670. @item sine
  4671. @item nuttall
  4672. @item lanczos
  4673. @item gauss
  4674. @item tukey
  4675. @item dolph
  4676. @item cauchy
  4677. @item parzen
  4678. @item poisson
  4679. @item bohman
  4680. @end table
  4681. Default is @code{hann}.
  4682. @item overlap
  4683. Set window overlap. If set to 1, the recommended overlap for selected
  4684. window function will be picked. Default is @code{0.5}.
  4685. @end table
  4686. @section treble, highshelf
  4687. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4688. shelving filter with a response similar to that of a standard
  4689. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4690. The filter accepts the following options:
  4691. @table @option
  4692. @item gain, g
  4693. Give the gain at whichever is the lower of ~22 kHz and the
  4694. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4695. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4696. @item frequency, f
  4697. Set the filter's central frequency and so can be used
  4698. to extend or reduce the frequency range to be boosted or cut.
  4699. The default value is @code{3000} Hz.
  4700. @item width_type, t
  4701. Set method to specify band-width of filter.
  4702. @table @option
  4703. @item h
  4704. Hz
  4705. @item q
  4706. Q-Factor
  4707. @item o
  4708. octave
  4709. @item s
  4710. slope
  4711. @item k
  4712. kHz
  4713. @end table
  4714. @item width, w
  4715. Determine how steep is the filter's shelf transition.
  4716. @item poles, p
  4717. Set number of poles. Default is 2.
  4718. @item mix, m
  4719. How much to use filtered signal in output. Default is 1.
  4720. Range is between 0 and 1.
  4721. @item channels, c
  4722. Specify which channels to filter, by default all available are filtered.
  4723. @item normalize, n
  4724. Normalize biquad coefficients, by default is disabled.
  4725. Enabling it will normalize magnitude response at DC to 0dB.
  4726. @item transform, a
  4727. Set transform type of IIR filter.
  4728. @table @option
  4729. @item di
  4730. @item dii
  4731. @item tdii
  4732. @item latt
  4733. @end table
  4734. @item precision, r
  4735. Set precison of filtering.
  4736. @table @option
  4737. @item auto
  4738. Pick automatic sample format depending on surround filters.
  4739. @item s16
  4740. Always use signed 16-bit.
  4741. @item s32
  4742. Always use signed 32-bit.
  4743. @item f32
  4744. Always use float 32-bit.
  4745. @item f64
  4746. Always use float 64-bit.
  4747. @end table
  4748. @end table
  4749. @subsection Commands
  4750. This filter supports the following commands:
  4751. @table @option
  4752. @item frequency, f
  4753. Change treble frequency.
  4754. Syntax for the command is : "@var{frequency}"
  4755. @item width_type, t
  4756. Change treble width_type.
  4757. Syntax for the command is : "@var{width_type}"
  4758. @item width, w
  4759. Change treble width.
  4760. Syntax for the command is : "@var{width}"
  4761. @item gain, g
  4762. Change treble gain.
  4763. Syntax for the command is : "@var{gain}"
  4764. @item mix, m
  4765. Change treble mix.
  4766. Syntax for the command is : "@var{mix}"
  4767. @end table
  4768. @section tremolo
  4769. Sinusoidal amplitude modulation.
  4770. The filter accepts the following options:
  4771. @table @option
  4772. @item f
  4773. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4774. (20 Hz or lower) will result in a tremolo effect.
  4775. This filter may also be used as a ring modulator by specifying
  4776. a modulation frequency higher than 20 Hz.
  4777. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4778. @item d
  4779. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4780. Default value is 0.5.
  4781. @end table
  4782. @section vibrato
  4783. Sinusoidal phase modulation.
  4784. The filter accepts the following options:
  4785. @table @option
  4786. @item f
  4787. Modulation frequency in Hertz.
  4788. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4789. @item d
  4790. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4791. Default value is 0.5.
  4792. @end table
  4793. @section volume
  4794. Adjust the input audio volume.
  4795. It accepts the following parameters:
  4796. @table @option
  4797. @item volume
  4798. Set audio volume expression.
  4799. Output values are clipped to the maximum value.
  4800. The output audio volume is given by the relation:
  4801. @example
  4802. @var{output_volume} = @var{volume} * @var{input_volume}
  4803. @end example
  4804. The default value for @var{volume} is "1.0".
  4805. @item precision
  4806. This parameter represents the mathematical precision.
  4807. It determines which input sample formats will be allowed, which affects the
  4808. precision of the volume scaling.
  4809. @table @option
  4810. @item fixed
  4811. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4812. @item float
  4813. 32-bit floating-point; this limits input sample format to FLT. (default)
  4814. @item double
  4815. 64-bit floating-point; this limits input sample format to DBL.
  4816. @end table
  4817. @item replaygain
  4818. Choose the behaviour on encountering ReplayGain side data in input frames.
  4819. @table @option
  4820. @item drop
  4821. Remove ReplayGain side data, ignoring its contents (the default).
  4822. @item ignore
  4823. Ignore ReplayGain side data, but leave it in the frame.
  4824. @item track
  4825. Prefer the track gain, if present.
  4826. @item album
  4827. Prefer the album gain, if present.
  4828. @end table
  4829. @item replaygain_preamp
  4830. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4831. Default value for @var{replaygain_preamp} is 0.0.
  4832. @item replaygain_noclip
  4833. Prevent clipping by limiting the gain applied.
  4834. Default value for @var{replaygain_noclip} is 1.
  4835. @item eval
  4836. Set when the volume expression is evaluated.
  4837. It accepts the following values:
  4838. @table @samp
  4839. @item once
  4840. only evaluate expression once during the filter initialization, or
  4841. when the @samp{volume} command is sent
  4842. @item frame
  4843. evaluate expression for each incoming frame
  4844. @end table
  4845. Default value is @samp{once}.
  4846. @end table
  4847. The volume expression can contain the following parameters.
  4848. @table @option
  4849. @item n
  4850. frame number (starting at zero)
  4851. @item nb_channels
  4852. number of channels
  4853. @item nb_consumed_samples
  4854. number of samples consumed by the filter
  4855. @item nb_samples
  4856. number of samples in the current frame
  4857. @item pos
  4858. original frame position in the file
  4859. @item pts
  4860. frame PTS
  4861. @item sample_rate
  4862. sample rate
  4863. @item startpts
  4864. PTS at start of stream
  4865. @item startt
  4866. time at start of stream
  4867. @item t
  4868. frame time
  4869. @item tb
  4870. timestamp timebase
  4871. @item volume
  4872. last set volume value
  4873. @end table
  4874. Note that when @option{eval} is set to @samp{once} only the
  4875. @var{sample_rate} and @var{tb} variables are available, all other
  4876. variables will evaluate to NAN.
  4877. @subsection Commands
  4878. This filter supports the following commands:
  4879. @table @option
  4880. @item volume
  4881. Modify the volume expression.
  4882. The command accepts the same syntax of the corresponding option.
  4883. If the specified expression is not valid, it is kept at its current
  4884. value.
  4885. @end table
  4886. @subsection Examples
  4887. @itemize
  4888. @item
  4889. Halve the input audio volume:
  4890. @example
  4891. volume=volume=0.5
  4892. volume=volume=1/2
  4893. volume=volume=-6.0206dB
  4894. @end example
  4895. In all the above example the named key for @option{volume} can be
  4896. omitted, for example like in:
  4897. @example
  4898. volume=0.5
  4899. @end example
  4900. @item
  4901. Increase input audio power by 6 decibels using fixed-point precision:
  4902. @example
  4903. volume=volume=6dB:precision=fixed
  4904. @end example
  4905. @item
  4906. Fade volume after time 10 with an annihilation period of 5 seconds:
  4907. @example
  4908. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4909. @end example
  4910. @end itemize
  4911. @section volumedetect
  4912. Detect the volume of the input video.
  4913. The filter has no parameters. The input is not modified. Statistics about
  4914. the volume will be printed in the log when the input stream end is reached.
  4915. In particular it will show the mean volume (root mean square), maximum
  4916. volume (on a per-sample basis), and the beginning of a histogram of the
  4917. registered volume values (from the maximum value to a cumulated 1/1000 of
  4918. the samples).
  4919. All volumes are in decibels relative to the maximum PCM value.
  4920. @subsection Examples
  4921. Here is an excerpt of the output:
  4922. @example
  4923. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4924. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4925. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4926. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4927. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4928. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4929. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4930. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4931. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4932. @end example
  4933. It means that:
  4934. @itemize
  4935. @item
  4936. The mean square energy is approximately -27 dB, or 10^-2.7.
  4937. @item
  4938. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4939. @item
  4940. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4941. @end itemize
  4942. In other words, raising the volume by +4 dB does not cause any clipping,
  4943. raising it by +5 dB causes clipping for 6 samples, etc.
  4944. @c man end AUDIO FILTERS
  4945. @chapter Audio Sources
  4946. @c man begin AUDIO SOURCES
  4947. Below is a description of the currently available audio sources.
  4948. @section abuffer
  4949. Buffer audio frames, and make them available to the filter chain.
  4950. This source is mainly intended for a programmatic use, in particular
  4951. through the interface defined in @file{libavfilter/buffersrc.h}.
  4952. It accepts the following parameters:
  4953. @table @option
  4954. @item time_base
  4955. The timebase which will be used for timestamps of submitted frames. It must be
  4956. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4957. @item sample_rate
  4958. The sample rate of the incoming audio buffers.
  4959. @item sample_fmt
  4960. The sample format of the incoming audio buffers.
  4961. Either a sample format name or its corresponding integer representation from
  4962. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4963. @item channel_layout
  4964. The channel layout of the incoming audio buffers.
  4965. Either a channel layout name from channel_layout_map in
  4966. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4967. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4968. @item channels
  4969. The number of channels of the incoming audio buffers.
  4970. If both @var{channels} and @var{channel_layout} are specified, then they
  4971. must be consistent.
  4972. @end table
  4973. @subsection Examples
  4974. @example
  4975. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4976. @end example
  4977. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4978. Since the sample format with name "s16p" corresponds to the number
  4979. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4980. equivalent to:
  4981. @example
  4982. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4983. @end example
  4984. @section aevalsrc
  4985. Generate an audio signal specified by an expression.
  4986. This source accepts in input one or more expressions (one for each
  4987. channel), which are evaluated and used to generate a corresponding
  4988. audio signal.
  4989. This source accepts the following options:
  4990. @table @option
  4991. @item exprs
  4992. Set the '|'-separated expressions list for each separate channel. In case the
  4993. @option{channel_layout} option is not specified, the selected channel layout
  4994. depends on the number of provided expressions. Otherwise the last
  4995. specified expression is applied to the remaining output channels.
  4996. @item channel_layout, c
  4997. Set the channel layout. The number of channels in the specified layout
  4998. must be equal to the number of specified expressions.
  4999. @item duration, d
  5000. Set the minimum duration of the sourced audio. See
  5001. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5002. for the accepted syntax.
  5003. Note that the resulting duration may be greater than the specified
  5004. duration, as the generated audio is always cut at the end of a
  5005. complete frame.
  5006. If not specified, or the expressed duration is negative, the audio is
  5007. supposed to be generated forever.
  5008. @item nb_samples, n
  5009. Set the number of samples per channel per each output frame,
  5010. default to 1024.
  5011. @item sample_rate, s
  5012. Specify the sample rate, default to 44100.
  5013. @end table
  5014. Each expression in @var{exprs} can contain the following constants:
  5015. @table @option
  5016. @item n
  5017. number of the evaluated sample, starting from 0
  5018. @item t
  5019. time of the evaluated sample expressed in seconds, starting from 0
  5020. @item s
  5021. sample rate
  5022. @end table
  5023. @subsection Examples
  5024. @itemize
  5025. @item
  5026. Generate silence:
  5027. @example
  5028. aevalsrc=0
  5029. @end example
  5030. @item
  5031. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5032. 8000 Hz:
  5033. @example
  5034. aevalsrc="sin(440*2*PI*t):s=8000"
  5035. @end example
  5036. @item
  5037. Generate a two channels signal, specify the channel layout (Front
  5038. Center + Back Center) explicitly:
  5039. @example
  5040. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5041. @end example
  5042. @item
  5043. Generate white noise:
  5044. @example
  5045. aevalsrc="-2+random(0)"
  5046. @end example
  5047. @item
  5048. Generate an amplitude modulated signal:
  5049. @example
  5050. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5051. @end example
  5052. @item
  5053. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5054. @example
  5055. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5056. @end example
  5057. @end itemize
  5058. @section afirsrc
  5059. Generate a FIR coefficients using frequency sampling method.
  5060. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5061. The filter accepts the following options:
  5062. @table @option
  5063. @item taps, t
  5064. Set number of filter coefficents in output audio stream.
  5065. Default value is 1025.
  5066. @item frequency, f
  5067. Set frequency points from where magnitude and phase are set.
  5068. This must be in non decreasing order, and first element must be 0, while last element
  5069. must be 1. Elements are separated by white spaces.
  5070. @item magnitude, m
  5071. Set magnitude value for every frequency point set by @option{frequency}.
  5072. Number of values must be same as number of frequency points.
  5073. Values are separated by white spaces.
  5074. @item phase, p
  5075. Set phase value for every frequency point set by @option{frequency}.
  5076. Number of values must be same as number of frequency points.
  5077. Values are separated by white spaces.
  5078. @item sample_rate, r
  5079. Set sample rate, default is 44100.
  5080. @item nb_samples, n
  5081. Set number of samples per each frame. Default is 1024.
  5082. @item win_func, w
  5083. Set window function. Default is blackman.
  5084. @end table
  5085. @section anullsrc
  5086. The null audio source, return unprocessed audio frames. It is mainly useful
  5087. as a template and to be employed in analysis / debugging tools, or as
  5088. the source for filters which ignore the input data (for example the sox
  5089. synth filter).
  5090. This source accepts the following options:
  5091. @table @option
  5092. @item channel_layout, cl
  5093. Specifies the channel layout, and can be either an integer or a string
  5094. representing a channel layout. The default value of @var{channel_layout}
  5095. is "stereo".
  5096. Check the channel_layout_map definition in
  5097. @file{libavutil/channel_layout.c} for the mapping between strings and
  5098. channel layout values.
  5099. @item sample_rate, r
  5100. Specifies the sample rate, and defaults to 44100.
  5101. @item nb_samples, n
  5102. Set the number of samples per requested frames.
  5103. @item duration, d
  5104. Set the duration of the sourced audio. See
  5105. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5106. for the accepted syntax.
  5107. If not specified, or the expressed duration is negative, the audio is
  5108. supposed to be generated forever.
  5109. @end table
  5110. @subsection Examples
  5111. @itemize
  5112. @item
  5113. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5114. @example
  5115. anullsrc=r=48000:cl=4
  5116. @end example
  5117. @item
  5118. Do the same operation with a more obvious syntax:
  5119. @example
  5120. anullsrc=r=48000:cl=mono
  5121. @end example
  5122. @end itemize
  5123. All the parameters need to be explicitly defined.
  5124. @section flite
  5125. Synthesize a voice utterance using the libflite library.
  5126. To enable compilation of this filter you need to configure FFmpeg with
  5127. @code{--enable-libflite}.
  5128. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5129. The filter accepts the following options:
  5130. @table @option
  5131. @item list_voices
  5132. If set to 1, list the names of the available voices and exit
  5133. immediately. Default value is 0.
  5134. @item nb_samples, n
  5135. Set the maximum number of samples per frame. Default value is 512.
  5136. @item textfile
  5137. Set the filename containing the text to speak.
  5138. @item text
  5139. Set the text to speak.
  5140. @item voice, v
  5141. Set the voice to use for the speech synthesis. Default value is
  5142. @code{kal}. See also the @var{list_voices} option.
  5143. @end table
  5144. @subsection Examples
  5145. @itemize
  5146. @item
  5147. Read from file @file{speech.txt}, and synthesize the text using the
  5148. standard flite voice:
  5149. @example
  5150. flite=textfile=speech.txt
  5151. @end example
  5152. @item
  5153. Read the specified text selecting the @code{slt} voice:
  5154. @example
  5155. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5156. @end example
  5157. @item
  5158. Input text to ffmpeg:
  5159. @example
  5160. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5161. @end example
  5162. @item
  5163. Make @file{ffplay} speak the specified text, using @code{flite} and
  5164. the @code{lavfi} device:
  5165. @example
  5166. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5167. @end example
  5168. @end itemize
  5169. For more information about libflite, check:
  5170. @url{http://www.festvox.org/flite/}
  5171. @section anoisesrc
  5172. Generate a noise audio signal.
  5173. The filter accepts the following options:
  5174. @table @option
  5175. @item sample_rate, r
  5176. Specify the sample rate. Default value is 48000 Hz.
  5177. @item amplitude, a
  5178. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5179. is 1.0.
  5180. @item duration, d
  5181. Specify the duration of the generated audio stream. Not specifying this option
  5182. results in noise with an infinite length.
  5183. @item color, colour, c
  5184. Specify the color of noise. Available noise colors are white, pink, brown,
  5185. blue, violet and velvet. Default color is white.
  5186. @item seed, s
  5187. Specify a value used to seed the PRNG.
  5188. @item nb_samples, n
  5189. Set the number of samples per each output frame, default is 1024.
  5190. @end table
  5191. @subsection Examples
  5192. @itemize
  5193. @item
  5194. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5195. @example
  5196. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5197. @end example
  5198. @end itemize
  5199. @section hilbert
  5200. Generate odd-tap Hilbert transform FIR coefficients.
  5201. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5202. the signal by 90 degrees.
  5203. This is used in many matrix coding schemes and for analytic signal generation.
  5204. The process is often written as a multiplication by i (or j), the imaginary unit.
  5205. The filter accepts the following options:
  5206. @table @option
  5207. @item sample_rate, s
  5208. Set sample rate, default is 44100.
  5209. @item taps, t
  5210. Set length of FIR filter, default is 22051.
  5211. @item nb_samples, n
  5212. Set number of samples per each frame.
  5213. @item win_func, w
  5214. Set window function to be used when generating FIR coefficients.
  5215. @end table
  5216. @section sinc
  5217. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5218. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5219. The filter accepts the following options:
  5220. @table @option
  5221. @item sample_rate, r
  5222. Set sample rate, default is 44100.
  5223. @item nb_samples, n
  5224. Set number of samples per each frame. Default is 1024.
  5225. @item hp
  5226. Set high-pass frequency. Default is 0.
  5227. @item lp
  5228. Set low-pass frequency. Default is 0.
  5229. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5230. is higher than 0 then filter will create band-pass filter coefficients,
  5231. otherwise band-reject filter coefficients.
  5232. @item phase
  5233. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5234. @item beta
  5235. Set Kaiser window beta.
  5236. @item att
  5237. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5238. @item round
  5239. Enable rounding, by default is disabled.
  5240. @item hptaps
  5241. Set number of taps for high-pass filter.
  5242. @item lptaps
  5243. Set number of taps for low-pass filter.
  5244. @end table
  5245. @section sine
  5246. Generate an audio signal made of a sine wave with amplitude 1/8.
  5247. The audio signal is bit-exact.
  5248. The filter accepts the following options:
  5249. @table @option
  5250. @item frequency, f
  5251. Set the carrier frequency. Default is 440 Hz.
  5252. @item beep_factor, b
  5253. Enable a periodic beep every second with frequency @var{beep_factor} times
  5254. the carrier frequency. Default is 0, meaning the beep is disabled.
  5255. @item sample_rate, r
  5256. Specify the sample rate, default is 44100.
  5257. @item duration, d
  5258. Specify the duration of the generated audio stream.
  5259. @item samples_per_frame
  5260. Set the number of samples per output frame.
  5261. The expression can contain the following constants:
  5262. @table @option
  5263. @item n
  5264. The (sequential) number of the output audio frame, starting from 0.
  5265. @item pts
  5266. The PTS (Presentation TimeStamp) of the output audio frame,
  5267. expressed in @var{TB} units.
  5268. @item t
  5269. The PTS of the output audio frame, expressed in seconds.
  5270. @item TB
  5271. The timebase of the output audio frames.
  5272. @end table
  5273. Default is @code{1024}.
  5274. @end table
  5275. @subsection Examples
  5276. @itemize
  5277. @item
  5278. Generate a simple 440 Hz sine wave:
  5279. @example
  5280. sine
  5281. @end example
  5282. @item
  5283. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5284. @example
  5285. sine=220:4:d=5
  5286. sine=f=220:b=4:d=5
  5287. sine=frequency=220:beep_factor=4:duration=5
  5288. @end example
  5289. @item
  5290. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5291. pattern:
  5292. @example
  5293. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5294. @end example
  5295. @end itemize
  5296. @c man end AUDIO SOURCES
  5297. @chapter Audio Sinks
  5298. @c man begin AUDIO SINKS
  5299. Below is a description of the currently available audio sinks.
  5300. @section abuffersink
  5301. Buffer audio frames, and make them available to the end of filter chain.
  5302. This sink is mainly intended for programmatic use, in particular
  5303. through the interface defined in @file{libavfilter/buffersink.h}
  5304. or the options system.
  5305. It accepts a pointer to an AVABufferSinkContext structure, which
  5306. defines the incoming buffers' formats, to be passed as the opaque
  5307. parameter to @code{avfilter_init_filter} for initialization.
  5308. @section anullsink
  5309. Null audio sink; do absolutely nothing with the input audio. It is
  5310. mainly useful as a template and for use in analysis / debugging
  5311. tools.
  5312. @c man end AUDIO SINKS
  5313. @chapter Video Filters
  5314. @c man begin VIDEO FILTERS
  5315. When you configure your FFmpeg build, you can disable any of the
  5316. existing filters using @code{--disable-filters}.
  5317. The configure output will show the video filters included in your
  5318. build.
  5319. Below is a description of the currently available video filters.
  5320. @section addroi
  5321. Mark a region of interest in a video frame.
  5322. The frame data is passed through unchanged, but metadata is attached
  5323. to the frame indicating regions of interest which can affect the
  5324. behaviour of later encoding. Multiple regions can be marked by
  5325. applying the filter multiple times.
  5326. @table @option
  5327. @item x
  5328. Region distance in pixels from the left edge of the frame.
  5329. @item y
  5330. Region distance in pixels from the top edge of the frame.
  5331. @item w
  5332. Region width in pixels.
  5333. @item h
  5334. Region height in pixels.
  5335. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5336. and may contain the following variables:
  5337. @table @option
  5338. @item iw
  5339. Width of the input frame.
  5340. @item ih
  5341. Height of the input frame.
  5342. @end table
  5343. @item qoffset
  5344. Quantisation offset to apply within the region.
  5345. This must be a real value in the range -1 to +1. A value of zero
  5346. indicates no quality change. A negative value asks for better quality
  5347. (less quantisation), while a positive value asks for worse quality
  5348. (greater quantisation).
  5349. The range is calibrated so that the extreme values indicate the
  5350. largest possible offset - if the rest of the frame is encoded with the
  5351. worst possible quality, an offset of -1 indicates that this region
  5352. should be encoded with the best possible quality anyway. Intermediate
  5353. values are then interpolated in some codec-dependent way.
  5354. For example, in 10-bit H.264 the quantisation parameter varies between
  5355. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5356. this region should be encoded with a QP around one-tenth of the full
  5357. range better than the rest of the frame. So, if most of the frame
  5358. were to be encoded with a QP of around 30, this region would get a QP
  5359. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5360. An extreme value of -1 would indicate that this region should be
  5361. encoded with the best possible quality regardless of the treatment of
  5362. the rest of the frame - that is, should be encoded at a QP of -12.
  5363. @item clear
  5364. If set to true, remove any existing regions of interest marked on the
  5365. frame before adding the new one.
  5366. @end table
  5367. @subsection Examples
  5368. @itemize
  5369. @item
  5370. Mark the centre quarter of the frame as interesting.
  5371. @example
  5372. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5373. @end example
  5374. @item
  5375. Mark the 100-pixel-wide region on the left edge of the frame as very
  5376. uninteresting (to be encoded at much lower quality than the rest of
  5377. the frame).
  5378. @example
  5379. addroi=0:0:100:ih:+1/5
  5380. @end example
  5381. @end itemize
  5382. @section alphaextract
  5383. Extract the alpha component from the input as a grayscale video. This
  5384. is especially useful with the @var{alphamerge} filter.
  5385. @section alphamerge
  5386. Add or replace the alpha component of the primary input with the
  5387. grayscale value of a second input. This is intended for use with
  5388. @var{alphaextract} to allow the transmission or storage of frame
  5389. sequences that have alpha in a format that doesn't support an alpha
  5390. channel.
  5391. For example, to reconstruct full frames from a normal YUV-encoded video
  5392. and a separate video created with @var{alphaextract}, you might use:
  5393. @example
  5394. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5395. @end example
  5396. @section amplify
  5397. Amplify differences between current pixel and pixels of adjacent frames in
  5398. same pixel location.
  5399. This filter accepts the following options:
  5400. @table @option
  5401. @item radius
  5402. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5403. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5404. @item factor
  5405. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5406. @item threshold
  5407. Set threshold for difference amplification. Any difference greater or equal to
  5408. this value will not alter source pixel. Default is 10.
  5409. Allowed range is from 0 to 65535.
  5410. @item tolerance
  5411. Set tolerance for difference amplification. Any difference lower to
  5412. this value will not alter source pixel. Default is 0.
  5413. Allowed range is from 0 to 65535.
  5414. @item low
  5415. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5416. This option controls maximum possible value that will decrease source pixel value.
  5417. @item high
  5418. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5419. This option controls maximum possible value that will increase source pixel value.
  5420. @item planes
  5421. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5422. @end table
  5423. @subsection Commands
  5424. This filter supports the following @ref{commands} that corresponds to option of same name:
  5425. @table @option
  5426. @item factor
  5427. @item threshold
  5428. @item tolerance
  5429. @item low
  5430. @item high
  5431. @item planes
  5432. @end table
  5433. @section ass
  5434. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5435. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5436. Substation Alpha) subtitles files.
  5437. This filter accepts the following option in addition to the common options from
  5438. the @ref{subtitles} filter:
  5439. @table @option
  5440. @item shaping
  5441. Set the shaping engine
  5442. Available values are:
  5443. @table @samp
  5444. @item auto
  5445. The default libass shaping engine, which is the best available.
  5446. @item simple
  5447. Fast, font-agnostic shaper that can do only substitutions
  5448. @item complex
  5449. Slower shaper using OpenType for substitutions and positioning
  5450. @end table
  5451. The default is @code{auto}.
  5452. @end table
  5453. @section atadenoise
  5454. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5455. The filter accepts the following options:
  5456. @table @option
  5457. @item 0a
  5458. Set threshold A for 1st plane. Default is 0.02.
  5459. Valid range is 0 to 0.3.
  5460. @item 0b
  5461. Set threshold B for 1st plane. Default is 0.04.
  5462. Valid range is 0 to 5.
  5463. @item 1a
  5464. Set threshold A for 2nd plane. Default is 0.02.
  5465. Valid range is 0 to 0.3.
  5466. @item 1b
  5467. Set threshold B for 2nd plane. Default is 0.04.
  5468. Valid range is 0 to 5.
  5469. @item 2a
  5470. Set threshold A for 3rd plane. Default is 0.02.
  5471. Valid range is 0 to 0.3.
  5472. @item 2b
  5473. Set threshold B for 3rd plane. Default is 0.04.
  5474. Valid range is 0 to 5.
  5475. Threshold A is designed to react on abrupt changes in the input signal and
  5476. threshold B is designed to react on continuous changes in the input signal.
  5477. @item s
  5478. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5479. number in range [5, 129].
  5480. @item p
  5481. Set what planes of frame filter will use for averaging. Default is all.
  5482. @item a
  5483. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5484. Alternatively can be set to @code{s} serial.
  5485. Parallel can be faster then serial, while other way around is never true.
  5486. Parallel will abort early on first change being greater then thresholds, while serial
  5487. will continue processing other side of frames if they are equal or below thresholds.
  5488. @item 0s
  5489. @item 1s
  5490. @item 2s
  5491. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5492. Valid range is from 0 to 32767.
  5493. This options controls weight for each pixel in radius defined by size.
  5494. Default value means every pixel have same weight.
  5495. Setting this option to 0 effectively disables filtering.
  5496. @end table
  5497. @subsection Commands
  5498. This filter supports same @ref{commands} as options except option @code{s}.
  5499. The command accepts the same syntax of the corresponding option.
  5500. @section avgblur
  5501. Apply average blur filter.
  5502. The filter accepts the following options:
  5503. @table @option
  5504. @item sizeX
  5505. Set horizontal radius size.
  5506. @item planes
  5507. Set which planes to filter. By default all planes are filtered.
  5508. @item sizeY
  5509. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5510. Default is @code{0}.
  5511. @end table
  5512. @subsection Commands
  5513. This filter supports same commands as options.
  5514. The command accepts the same syntax of the corresponding option.
  5515. If the specified expression is not valid, it is kept at its current
  5516. value.
  5517. @section bbox
  5518. Compute the bounding box for the non-black pixels in the input frame
  5519. luminance plane.
  5520. This filter computes the bounding box containing all the pixels with a
  5521. luminance value greater than the minimum allowed value.
  5522. The parameters describing the bounding box are printed on the filter
  5523. log.
  5524. The filter accepts the following option:
  5525. @table @option
  5526. @item min_val
  5527. Set the minimal luminance value. Default is @code{16}.
  5528. @end table
  5529. @subsection Commands
  5530. This filter supports the all above options as @ref{commands}.
  5531. @section bilateral
  5532. Apply bilateral filter, spatial smoothing while preserving edges.
  5533. The filter accepts the following options:
  5534. @table @option
  5535. @item sigmaS
  5536. Set sigma of gaussian function to calculate spatial weight.
  5537. Allowed range is 0 to 512. Default is 0.1.
  5538. @item sigmaR
  5539. Set sigma of gaussian function to calculate range weight.
  5540. Allowed range is 0 to 1. Default is 0.1.
  5541. @item planes
  5542. Set planes to filter. Default is first only.
  5543. @end table
  5544. @subsection Commands
  5545. This filter supports the all above options as @ref{commands}.
  5546. @section bitplanenoise
  5547. Show and measure bit plane noise.
  5548. The filter accepts the following options:
  5549. @table @option
  5550. @item bitplane
  5551. Set which plane to analyze. Default is @code{1}.
  5552. @item filter
  5553. Filter out noisy pixels from @code{bitplane} set above.
  5554. Default is disabled.
  5555. @end table
  5556. @section blackdetect
  5557. Detect video intervals that are (almost) completely black. Can be
  5558. useful to detect chapter transitions, commercials, or invalid
  5559. recordings.
  5560. The filter outputs its detection analysis to both the log as well as
  5561. frame metadata. If a black segment of at least the specified minimum
  5562. duration is found, a line with the start and end timestamps as well
  5563. as duration is printed to the log with level @code{info}. In addition,
  5564. a log line with level @code{debug} is printed per frame showing the
  5565. black amount detected for that frame.
  5566. The filter also attaches metadata to the first frame of a black
  5567. segment with key @code{lavfi.black_start} and to the first frame
  5568. after the black segment ends with key @code{lavfi.black_end}. The
  5569. value is the frame's timestamp. This metadata is added regardless
  5570. of the minimum duration specified.
  5571. The filter accepts the following options:
  5572. @table @option
  5573. @item black_min_duration, d
  5574. Set the minimum detected black duration expressed in seconds. It must
  5575. be a non-negative floating point number.
  5576. Default value is 2.0.
  5577. @item picture_black_ratio_th, pic_th
  5578. Set the threshold for considering a picture "black".
  5579. Express the minimum value for the ratio:
  5580. @example
  5581. @var{nb_black_pixels} / @var{nb_pixels}
  5582. @end example
  5583. for which a picture is considered black.
  5584. Default value is 0.98.
  5585. @item pixel_black_th, pix_th
  5586. Set the threshold for considering a pixel "black".
  5587. The threshold expresses the maximum pixel luminance value for which a
  5588. pixel is considered "black". The provided value is scaled according to
  5589. the following equation:
  5590. @example
  5591. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5592. @end example
  5593. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5594. the input video format, the range is [0-255] for YUV full-range
  5595. formats and [16-235] for YUV non full-range formats.
  5596. Default value is 0.10.
  5597. @end table
  5598. The following example sets the maximum pixel threshold to the minimum
  5599. value, and detects only black intervals of 2 or more seconds:
  5600. @example
  5601. blackdetect=d=2:pix_th=0.00
  5602. @end example
  5603. @section blackframe
  5604. Detect frames that are (almost) completely black. Can be useful to
  5605. detect chapter transitions or commercials. Output lines consist of
  5606. the frame number of the detected frame, the percentage of blackness,
  5607. the position in the file if known or -1 and the timestamp in seconds.
  5608. In order to display the output lines, you need to set the loglevel at
  5609. least to the AV_LOG_INFO value.
  5610. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5611. The value represents the percentage of pixels in the picture that
  5612. are below the threshold value.
  5613. It accepts the following parameters:
  5614. @table @option
  5615. @item amount
  5616. The percentage of the pixels that have to be below the threshold; it defaults to
  5617. @code{98}.
  5618. @item threshold, thresh
  5619. The threshold below which a pixel value is considered black; it defaults to
  5620. @code{32}.
  5621. @end table
  5622. @anchor{blend}
  5623. @section blend
  5624. Blend two video frames into each other.
  5625. The @code{blend} filter takes two input streams and outputs one
  5626. stream, the first input is the "top" layer and second input is
  5627. "bottom" layer. By default, the output terminates when the longest input terminates.
  5628. The @code{tblend} (time blend) filter takes two consecutive frames
  5629. from one single stream, and outputs the result obtained by blending
  5630. the new frame on top of the old frame.
  5631. A description of the accepted options follows.
  5632. @table @option
  5633. @item c0_mode
  5634. @item c1_mode
  5635. @item c2_mode
  5636. @item c3_mode
  5637. @item all_mode
  5638. Set blend mode for specific pixel component or all pixel components in case
  5639. of @var{all_mode}. Default value is @code{normal}.
  5640. Available values for component modes are:
  5641. @table @samp
  5642. @item addition
  5643. @item grainmerge
  5644. @item and
  5645. @item average
  5646. @item burn
  5647. @item darken
  5648. @item difference
  5649. @item grainextract
  5650. @item divide
  5651. @item dodge
  5652. @item freeze
  5653. @item exclusion
  5654. @item extremity
  5655. @item glow
  5656. @item hardlight
  5657. @item hardmix
  5658. @item heat
  5659. @item lighten
  5660. @item linearlight
  5661. @item multiply
  5662. @item multiply128
  5663. @item negation
  5664. @item normal
  5665. @item or
  5666. @item overlay
  5667. @item phoenix
  5668. @item pinlight
  5669. @item reflect
  5670. @item screen
  5671. @item softlight
  5672. @item subtract
  5673. @item vividlight
  5674. @item xor
  5675. @end table
  5676. @item c0_opacity
  5677. @item c1_opacity
  5678. @item c2_opacity
  5679. @item c3_opacity
  5680. @item all_opacity
  5681. Set blend opacity for specific pixel component or all pixel components in case
  5682. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5683. @item c0_expr
  5684. @item c1_expr
  5685. @item c2_expr
  5686. @item c3_expr
  5687. @item all_expr
  5688. Set blend expression for specific pixel component or all pixel components in case
  5689. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5690. The expressions can use the following variables:
  5691. @table @option
  5692. @item N
  5693. The sequential number of the filtered frame, starting from @code{0}.
  5694. @item X
  5695. @item Y
  5696. the coordinates of the current sample
  5697. @item W
  5698. @item H
  5699. the width and height of currently filtered plane
  5700. @item SW
  5701. @item SH
  5702. Width and height scale for the plane being filtered. It is the
  5703. ratio between the dimensions of the current plane to the luma plane,
  5704. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5705. the luma plane and @code{0.5,0.5} for the chroma planes.
  5706. @item T
  5707. Time of the current frame, expressed in seconds.
  5708. @item TOP, A
  5709. Value of pixel component at current location for first video frame (top layer).
  5710. @item BOTTOM, B
  5711. Value of pixel component at current location for second video frame (bottom layer).
  5712. @end table
  5713. @end table
  5714. The @code{blend} filter also supports the @ref{framesync} options.
  5715. @subsection Examples
  5716. @itemize
  5717. @item
  5718. Apply transition from bottom layer to top layer in first 10 seconds:
  5719. @example
  5720. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5721. @end example
  5722. @item
  5723. Apply linear horizontal transition from top layer to bottom layer:
  5724. @example
  5725. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5726. @end example
  5727. @item
  5728. Apply 1x1 checkerboard effect:
  5729. @example
  5730. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5731. @end example
  5732. @item
  5733. Apply uncover left effect:
  5734. @example
  5735. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5736. @end example
  5737. @item
  5738. Apply uncover down effect:
  5739. @example
  5740. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5741. @end example
  5742. @item
  5743. Apply uncover up-left effect:
  5744. @example
  5745. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5746. @end example
  5747. @item
  5748. Split diagonally video and shows top and bottom layer on each side:
  5749. @example
  5750. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5751. @end example
  5752. @item
  5753. Display differences between the current and the previous frame:
  5754. @example
  5755. tblend=all_mode=grainextract
  5756. @end example
  5757. @end itemize
  5758. @section bm3d
  5759. Denoise frames using Block-Matching 3D algorithm.
  5760. The filter accepts the following options.
  5761. @table @option
  5762. @item sigma
  5763. Set denoising strength. Default value is 1.
  5764. Allowed range is from 0 to 999.9.
  5765. The denoising algorithm is very sensitive to sigma, so adjust it
  5766. according to the source.
  5767. @item block
  5768. Set local patch size. This sets dimensions in 2D.
  5769. @item bstep
  5770. Set sliding step for processing blocks. Default value is 4.
  5771. Allowed range is from 1 to 64.
  5772. Smaller values allows processing more reference blocks and is slower.
  5773. @item group
  5774. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5775. When set to 1, no block matching is done. Larger values allows more blocks
  5776. in single group.
  5777. Allowed range is from 1 to 256.
  5778. @item range
  5779. Set radius for search block matching. Default is 9.
  5780. Allowed range is from 1 to INT32_MAX.
  5781. @item mstep
  5782. Set step between two search locations for block matching. Default is 1.
  5783. Allowed range is from 1 to 64. Smaller is slower.
  5784. @item thmse
  5785. Set threshold of mean square error for block matching. Valid range is 0 to
  5786. INT32_MAX.
  5787. @item hdthr
  5788. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5789. Larger values results in stronger hard-thresholding filtering in frequency
  5790. domain.
  5791. @item estim
  5792. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5793. Default is @code{basic}.
  5794. @item ref
  5795. If enabled, filter will use 2nd stream for block matching.
  5796. Default is disabled for @code{basic} value of @var{estim} option,
  5797. and always enabled if value of @var{estim} is @code{final}.
  5798. @item planes
  5799. Set planes to filter. Default is all available except alpha.
  5800. @end table
  5801. @subsection Examples
  5802. @itemize
  5803. @item
  5804. Basic filtering with bm3d:
  5805. @example
  5806. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5807. @end example
  5808. @item
  5809. Same as above, but filtering only luma:
  5810. @example
  5811. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5812. @end example
  5813. @item
  5814. Same as above, but with both estimation modes:
  5815. @example
  5816. 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
  5817. @end example
  5818. @item
  5819. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5820. @example
  5821. 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
  5822. @end example
  5823. @end itemize
  5824. @section boxblur
  5825. Apply a boxblur algorithm to the input video.
  5826. It accepts the following parameters:
  5827. @table @option
  5828. @item luma_radius, lr
  5829. @item luma_power, lp
  5830. @item chroma_radius, cr
  5831. @item chroma_power, cp
  5832. @item alpha_radius, ar
  5833. @item alpha_power, ap
  5834. @end table
  5835. A description of the accepted options follows.
  5836. @table @option
  5837. @item luma_radius, lr
  5838. @item chroma_radius, cr
  5839. @item alpha_radius, ar
  5840. Set an expression for the box radius in pixels used for blurring the
  5841. corresponding input plane.
  5842. The radius value must be a non-negative number, and must not be
  5843. greater than the value of the expression @code{min(w,h)/2} for the
  5844. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5845. planes.
  5846. Default value for @option{luma_radius} is "2". If not specified,
  5847. @option{chroma_radius} and @option{alpha_radius} default to the
  5848. corresponding value set for @option{luma_radius}.
  5849. The expressions can contain the following constants:
  5850. @table @option
  5851. @item w
  5852. @item h
  5853. The input width and height in pixels.
  5854. @item cw
  5855. @item ch
  5856. The input chroma image width and height in pixels.
  5857. @item hsub
  5858. @item vsub
  5859. The horizontal and vertical chroma subsample values. For example, for the
  5860. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5861. @end table
  5862. @item luma_power, lp
  5863. @item chroma_power, cp
  5864. @item alpha_power, ap
  5865. Specify how many times the boxblur filter is applied to the
  5866. corresponding plane.
  5867. Default value for @option{luma_power} is 2. If not specified,
  5868. @option{chroma_power} and @option{alpha_power} default to the
  5869. corresponding value set for @option{luma_power}.
  5870. A value of 0 will disable the effect.
  5871. @end table
  5872. @subsection Examples
  5873. @itemize
  5874. @item
  5875. Apply a boxblur filter with the luma, chroma, and alpha radii
  5876. set to 2:
  5877. @example
  5878. boxblur=luma_radius=2:luma_power=1
  5879. boxblur=2:1
  5880. @end example
  5881. @item
  5882. Set the luma radius to 2, and alpha and chroma radius to 0:
  5883. @example
  5884. boxblur=2:1:cr=0:ar=0
  5885. @end example
  5886. @item
  5887. Set the luma and chroma radii to a fraction of the video dimension:
  5888. @example
  5889. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5890. @end example
  5891. @end itemize
  5892. @section bwdif
  5893. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5894. Deinterlacing Filter").
  5895. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5896. interpolation algorithms.
  5897. It accepts the following parameters:
  5898. @table @option
  5899. @item mode
  5900. The interlacing mode to adopt. It accepts one of the following values:
  5901. @table @option
  5902. @item 0, send_frame
  5903. Output one frame for each frame.
  5904. @item 1, send_field
  5905. Output one frame for each field.
  5906. @end table
  5907. The default value is @code{send_field}.
  5908. @item parity
  5909. The picture field parity assumed for the input interlaced video. It accepts one
  5910. of the following values:
  5911. @table @option
  5912. @item 0, tff
  5913. Assume the top field is first.
  5914. @item 1, bff
  5915. Assume the bottom field is first.
  5916. @item -1, auto
  5917. Enable automatic detection of field parity.
  5918. @end table
  5919. The default value is @code{auto}.
  5920. If the interlacing is unknown or the decoder does not export this information,
  5921. top field first will be assumed.
  5922. @item deint
  5923. Specify which frames to deinterlace. Accepts one of the following
  5924. values:
  5925. @table @option
  5926. @item 0, all
  5927. Deinterlace all frames.
  5928. @item 1, interlaced
  5929. Only deinterlace frames marked as interlaced.
  5930. @end table
  5931. The default value is @code{all}.
  5932. @end table
  5933. @section cas
  5934. Apply Contrast Adaptive Sharpen filter to video stream.
  5935. The filter accepts the following options:
  5936. @table @option
  5937. @item strength
  5938. Set the sharpening strength. Default value is 0.
  5939. @item planes
  5940. Set planes to filter. Default value is to filter all
  5941. planes except alpha plane.
  5942. @end table
  5943. @subsection Commands
  5944. This filter supports same @ref{commands} as options.
  5945. @section chromahold
  5946. Remove all color information for all colors except for certain one.
  5947. The filter accepts the following options:
  5948. @table @option
  5949. @item color
  5950. The color which will not be replaced with neutral chroma.
  5951. @item similarity
  5952. Similarity percentage with the above color.
  5953. 0.01 matches only the exact key color, while 1.0 matches everything.
  5954. @item blend
  5955. Blend percentage.
  5956. 0.0 makes pixels either fully gray, or not gray at all.
  5957. Higher values result in more preserved color.
  5958. @item yuv
  5959. Signals that the color passed is already in YUV instead of RGB.
  5960. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5961. This can be used to pass exact YUV values as hexadecimal numbers.
  5962. @end table
  5963. @subsection Commands
  5964. This filter supports same @ref{commands} as options.
  5965. The command accepts the same syntax of the corresponding option.
  5966. If the specified expression is not valid, it is kept at its current
  5967. value.
  5968. @section chromakey
  5969. YUV colorspace color/chroma keying.
  5970. The filter accepts the following options:
  5971. @table @option
  5972. @item color
  5973. The color which will be replaced with transparency.
  5974. @item similarity
  5975. Similarity percentage with the key color.
  5976. 0.01 matches only the exact key color, while 1.0 matches everything.
  5977. @item blend
  5978. Blend percentage.
  5979. 0.0 makes pixels either fully transparent, or not transparent at all.
  5980. Higher values result in semi-transparent pixels, with a higher transparency
  5981. the more similar the pixels color is to the key color.
  5982. @item yuv
  5983. Signals that the color passed is already in YUV instead of RGB.
  5984. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5985. This can be used to pass exact YUV values as hexadecimal numbers.
  5986. @end table
  5987. @subsection Commands
  5988. This filter supports same @ref{commands} as options.
  5989. The command accepts the same syntax of the corresponding option.
  5990. If the specified expression is not valid, it is kept at its current
  5991. value.
  5992. @subsection Examples
  5993. @itemize
  5994. @item
  5995. Make every green pixel in the input image transparent:
  5996. @example
  5997. ffmpeg -i input.png -vf chromakey=green out.png
  5998. @end example
  5999. @item
  6000. Overlay a greenscreen-video on top of a static black background.
  6001. @example
  6002. 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
  6003. @end example
  6004. @end itemize
  6005. @section chromanr
  6006. Reduce chrominance noise.
  6007. The filter accepts the following options:
  6008. @table @option
  6009. @item thres
  6010. Set threshold for averaging chrominance values.
  6011. Sum of absolute difference of Y, U and V pixel components of current
  6012. pixel and neighbour pixels lower than this threshold will be used in
  6013. averaging. Luma component is left unchanged and is copied to output.
  6014. Default value is 30. Allowed range is from 1 to 200.
  6015. @item sizew
  6016. Set horizontal radius of rectangle used for averaging.
  6017. Allowed range is from 1 to 100. Default value is 5.
  6018. @item sizeh
  6019. Set vertical radius of rectangle used for averaging.
  6020. Allowed range is from 1 to 100. Default value is 5.
  6021. @item stepw
  6022. Set horizontal step when averaging. Default value is 1.
  6023. Allowed range is from 1 to 50.
  6024. Mostly useful to speed-up filtering.
  6025. @item steph
  6026. Set vertical step when averaging. Default value is 1.
  6027. Allowed range is from 1 to 50.
  6028. Mostly useful to speed-up filtering.
  6029. @item threy
  6030. Set Y threshold for averaging chrominance values.
  6031. Set finer control for max allowed difference between Y components
  6032. of current pixel and neigbour pixels.
  6033. Default value is 200. Allowed range is from 1 to 200.
  6034. @item threu
  6035. Set U threshold for averaging chrominance values.
  6036. Set finer control for max allowed difference between U components
  6037. of current pixel and neigbour pixels.
  6038. Default value is 200. Allowed range is from 1 to 200.
  6039. @item threv
  6040. Set V threshold for averaging chrominance values.
  6041. Set finer control for max allowed difference between V components
  6042. of current pixel and neigbour pixels.
  6043. Default value is 200. Allowed range is from 1 to 200.
  6044. @end table
  6045. @subsection Commands
  6046. This filter supports same @ref{commands} as options.
  6047. The command accepts the same syntax of the corresponding option.
  6048. @section chromashift
  6049. Shift chroma pixels horizontally and/or vertically.
  6050. The filter accepts the following options:
  6051. @table @option
  6052. @item cbh
  6053. Set amount to shift chroma-blue horizontally.
  6054. @item cbv
  6055. Set amount to shift chroma-blue vertically.
  6056. @item crh
  6057. Set amount to shift chroma-red horizontally.
  6058. @item crv
  6059. Set amount to shift chroma-red vertically.
  6060. @item edge
  6061. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6062. @end table
  6063. @subsection Commands
  6064. This filter supports the all above options as @ref{commands}.
  6065. @section ciescope
  6066. Display CIE color diagram with pixels overlaid onto it.
  6067. The filter accepts the following options:
  6068. @table @option
  6069. @item system
  6070. Set color system.
  6071. @table @samp
  6072. @item ntsc, 470m
  6073. @item ebu, 470bg
  6074. @item smpte
  6075. @item 240m
  6076. @item apple
  6077. @item widergb
  6078. @item cie1931
  6079. @item rec709, hdtv
  6080. @item uhdtv, rec2020
  6081. @item dcip3
  6082. @end table
  6083. @item cie
  6084. Set CIE system.
  6085. @table @samp
  6086. @item xyy
  6087. @item ucs
  6088. @item luv
  6089. @end table
  6090. @item gamuts
  6091. Set what gamuts to draw.
  6092. See @code{system} option for available values.
  6093. @item size, s
  6094. Set ciescope size, by default set to 512.
  6095. @item intensity, i
  6096. Set intensity used to map input pixel values to CIE diagram.
  6097. @item contrast
  6098. Set contrast used to draw tongue colors that are out of active color system gamut.
  6099. @item corrgamma
  6100. Correct gamma displayed on scope, by default enabled.
  6101. @item showwhite
  6102. Show white point on CIE diagram, by default disabled.
  6103. @item gamma
  6104. Set input gamma. Used only with XYZ input color space.
  6105. @end table
  6106. @section codecview
  6107. Visualize information exported by some codecs.
  6108. Some codecs can export information through frames using side-data or other
  6109. means. For example, some MPEG based codecs export motion vectors through the
  6110. @var{export_mvs} flag in the codec @option{flags2} option.
  6111. The filter accepts the following option:
  6112. @table @option
  6113. @item mv
  6114. Set motion vectors to visualize.
  6115. Available flags for @var{mv} are:
  6116. @table @samp
  6117. @item pf
  6118. forward predicted MVs of P-frames
  6119. @item bf
  6120. forward predicted MVs of B-frames
  6121. @item bb
  6122. backward predicted MVs of B-frames
  6123. @end table
  6124. @item qp
  6125. Display quantization parameters using the chroma planes.
  6126. @item mv_type, mvt
  6127. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6128. Available flags for @var{mv_type} are:
  6129. @table @samp
  6130. @item fp
  6131. forward predicted MVs
  6132. @item bp
  6133. backward predicted MVs
  6134. @end table
  6135. @item frame_type, ft
  6136. Set frame type to visualize motion vectors of.
  6137. Available flags for @var{frame_type} are:
  6138. @table @samp
  6139. @item if
  6140. intra-coded frames (I-frames)
  6141. @item pf
  6142. predicted frames (P-frames)
  6143. @item bf
  6144. bi-directionally predicted frames (B-frames)
  6145. @end table
  6146. @end table
  6147. @subsection Examples
  6148. @itemize
  6149. @item
  6150. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6151. @example
  6152. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6153. @end example
  6154. @item
  6155. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6156. @example
  6157. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6158. @end example
  6159. @end itemize
  6160. @section colorbalance
  6161. Modify intensity of primary colors (red, green and blue) of input frames.
  6162. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6163. regions for the red-cyan, green-magenta or blue-yellow balance.
  6164. A positive adjustment value shifts the balance towards the primary color, a negative
  6165. value towards the complementary color.
  6166. The filter accepts the following options:
  6167. @table @option
  6168. @item rs
  6169. @item gs
  6170. @item bs
  6171. Adjust red, green and blue shadows (darkest pixels).
  6172. @item rm
  6173. @item gm
  6174. @item bm
  6175. Adjust red, green and blue midtones (medium pixels).
  6176. @item rh
  6177. @item gh
  6178. @item bh
  6179. Adjust red, green and blue highlights (brightest pixels).
  6180. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6181. @item pl
  6182. Preserve lightness when changing color balance. Default is disabled.
  6183. @end table
  6184. @subsection Examples
  6185. @itemize
  6186. @item
  6187. Add red color cast to shadows:
  6188. @example
  6189. colorbalance=rs=.3
  6190. @end example
  6191. @end itemize
  6192. @subsection Commands
  6193. This filter supports the all above options as @ref{commands}.
  6194. @section colorchannelmixer
  6195. Adjust video input frames by re-mixing color channels.
  6196. This filter modifies a color channel by adding the values associated to
  6197. the other channels of the same pixels. For example if the value to
  6198. modify is red, the output value will be:
  6199. @example
  6200. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6201. @end example
  6202. The filter accepts the following options:
  6203. @table @option
  6204. @item rr
  6205. @item rg
  6206. @item rb
  6207. @item ra
  6208. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6209. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6210. @item gr
  6211. @item gg
  6212. @item gb
  6213. @item ga
  6214. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6215. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6216. @item br
  6217. @item bg
  6218. @item bb
  6219. @item ba
  6220. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6221. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6222. @item ar
  6223. @item ag
  6224. @item ab
  6225. @item aa
  6226. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6227. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6228. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6229. @item pl
  6230. Preserve lightness when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6231. Default is @code{0.0}, thus disabled.
  6232. @end table
  6233. @subsection Examples
  6234. @itemize
  6235. @item
  6236. Convert source to grayscale:
  6237. @example
  6238. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6239. @end example
  6240. @item
  6241. Simulate sepia tones:
  6242. @example
  6243. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6244. @end example
  6245. @end itemize
  6246. @subsection Commands
  6247. This filter supports the all above options as @ref{commands}.
  6248. @section colorkey
  6249. RGB colorspace color keying.
  6250. The filter accepts the following options:
  6251. @table @option
  6252. @item color
  6253. The color which will be replaced with transparency.
  6254. @item similarity
  6255. Similarity percentage with the key color.
  6256. 0.01 matches only the exact key color, while 1.0 matches everything.
  6257. @item blend
  6258. Blend percentage.
  6259. 0.0 makes pixels either fully transparent, or not transparent at all.
  6260. Higher values result in semi-transparent pixels, with a higher transparency
  6261. the more similar the pixels color is to the key color.
  6262. @end table
  6263. @subsection Examples
  6264. @itemize
  6265. @item
  6266. Make every green pixel in the input image transparent:
  6267. @example
  6268. ffmpeg -i input.png -vf colorkey=green out.png
  6269. @end example
  6270. @item
  6271. Overlay a greenscreen-video on top of a static background image.
  6272. @example
  6273. 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
  6274. @end example
  6275. @end itemize
  6276. @subsection Commands
  6277. This filter supports same @ref{commands} as options.
  6278. The command accepts the same syntax of the corresponding option.
  6279. If the specified expression is not valid, it is kept at its current
  6280. value.
  6281. @section colorhold
  6282. Remove all color information for all RGB colors except for certain one.
  6283. The filter accepts the following options:
  6284. @table @option
  6285. @item color
  6286. The color which will not be replaced with neutral gray.
  6287. @item similarity
  6288. Similarity percentage with the above color.
  6289. 0.01 matches only the exact key color, while 1.0 matches everything.
  6290. @item blend
  6291. Blend percentage. 0.0 makes pixels fully gray.
  6292. Higher values result in more preserved color.
  6293. @end table
  6294. @subsection Commands
  6295. This filter supports same @ref{commands} as options.
  6296. The command accepts the same syntax of the corresponding option.
  6297. If the specified expression is not valid, it is kept at its current
  6298. value.
  6299. @section colorlevels
  6300. Adjust video input frames using levels.
  6301. The filter accepts the following options:
  6302. @table @option
  6303. @item rimin
  6304. @item gimin
  6305. @item bimin
  6306. @item aimin
  6307. Adjust red, green, blue and alpha input black point.
  6308. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6309. @item rimax
  6310. @item gimax
  6311. @item bimax
  6312. @item aimax
  6313. Adjust red, green, blue and alpha input white point.
  6314. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6315. Input levels are used to lighten highlights (bright tones), darken shadows
  6316. (dark tones), change the balance of bright and dark tones.
  6317. @item romin
  6318. @item gomin
  6319. @item bomin
  6320. @item aomin
  6321. Adjust red, green, blue and alpha output black point.
  6322. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6323. @item romax
  6324. @item gomax
  6325. @item bomax
  6326. @item aomax
  6327. Adjust red, green, blue and alpha output white point.
  6328. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6329. Output levels allows manual selection of a constrained output level range.
  6330. @end table
  6331. @subsection Examples
  6332. @itemize
  6333. @item
  6334. Make video output darker:
  6335. @example
  6336. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6337. @end example
  6338. @item
  6339. Increase contrast:
  6340. @example
  6341. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6342. @end example
  6343. @item
  6344. Make video output lighter:
  6345. @example
  6346. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6347. @end example
  6348. @item
  6349. Increase brightness:
  6350. @example
  6351. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6352. @end example
  6353. @end itemize
  6354. @subsection Commands
  6355. This filter supports the all above options as @ref{commands}.
  6356. @section colormatrix
  6357. Convert color matrix.
  6358. The filter accepts the following options:
  6359. @table @option
  6360. @item src
  6361. @item dst
  6362. Specify the source and destination color matrix. Both values must be
  6363. specified.
  6364. The accepted values are:
  6365. @table @samp
  6366. @item bt709
  6367. BT.709
  6368. @item fcc
  6369. FCC
  6370. @item bt601
  6371. BT.601
  6372. @item bt470
  6373. BT.470
  6374. @item bt470bg
  6375. BT.470BG
  6376. @item smpte170m
  6377. SMPTE-170M
  6378. @item smpte240m
  6379. SMPTE-240M
  6380. @item bt2020
  6381. BT.2020
  6382. @end table
  6383. @end table
  6384. For example to convert from BT.601 to SMPTE-240M, use the command:
  6385. @example
  6386. colormatrix=bt601:smpte240m
  6387. @end example
  6388. @section colorspace
  6389. Convert colorspace, transfer characteristics or color primaries.
  6390. Input video needs to have an even size.
  6391. The filter accepts the following options:
  6392. @table @option
  6393. @anchor{all}
  6394. @item all
  6395. Specify all color properties at once.
  6396. The accepted values are:
  6397. @table @samp
  6398. @item bt470m
  6399. BT.470M
  6400. @item bt470bg
  6401. BT.470BG
  6402. @item bt601-6-525
  6403. BT.601-6 525
  6404. @item bt601-6-625
  6405. BT.601-6 625
  6406. @item bt709
  6407. BT.709
  6408. @item smpte170m
  6409. SMPTE-170M
  6410. @item smpte240m
  6411. SMPTE-240M
  6412. @item bt2020
  6413. BT.2020
  6414. @end table
  6415. @anchor{space}
  6416. @item space
  6417. Specify output colorspace.
  6418. The accepted values are:
  6419. @table @samp
  6420. @item bt709
  6421. BT.709
  6422. @item fcc
  6423. FCC
  6424. @item bt470bg
  6425. BT.470BG or BT.601-6 625
  6426. @item smpte170m
  6427. SMPTE-170M or BT.601-6 525
  6428. @item smpte240m
  6429. SMPTE-240M
  6430. @item ycgco
  6431. YCgCo
  6432. @item bt2020ncl
  6433. BT.2020 with non-constant luminance
  6434. @end table
  6435. @anchor{trc}
  6436. @item trc
  6437. Specify output transfer characteristics.
  6438. The accepted values are:
  6439. @table @samp
  6440. @item bt709
  6441. BT.709
  6442. @item bt470m
  6443. BT.470M
  6444. @item bt470bg
  6445. BT.470BG
  6446. @item gamma22
  6447. Constant gamma of 2.2
  6448. @item gamma28
  6449. Constant gamma of 2.8
  6450. @item smpte170m
  6451. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6452. @item smpte240m
  6453. SMPTE-240M
  6454. @item srgb
  6455. SRGB
  6456. @item iec61966-2-1
  6457. iec61966-2-1
  6458. @item iec61966-2-4
  6459. iec61966-2-4
  6460. @item xvycc
  6461. xvycc
  6462. @item bt2020-10
  6463. BT.2020 for 10-bits content
  6464. @item bt2020-12
  6465. BT.2020 for 12-bits content
  6466. @end table
  6467. @anchor{primaries}
  6468. @item primaries
  6469. Specify output color primaries.
  6470. The accepted values are:
  6471. @table @samp
  6472. @item bt709
  6473. BT.709
  6474. @item bt470m
  6475. BT.470M
  6476. @item bt470bg
  6477. BT.470BG or BT.601-6 625
  6478. @item smpte170m
  6479. SMPTE-170M or BT.601-6 525
  6480. @item smpte240m
  6481. SMPTE-240M
  6482. @item film
  6483. film
  6484. @item smpte431
  6485. SMPTE-431
  6486. @item smpte432
  6487. SMPTE-432
  6488. @item bt2020
  6489. BT.2020
  6490. @item jedec-p22
  6491. JEDEC P22 phosphors
  6492. @end table
  6493. @anchor{range}
  6494. @item range
  6495. Specify output color range.
  6496. The accepted values are:
  6497. @table @samp
  6498. @item tv
  6499. TV (restricted) range
  6500. @item mpeg
  6501. MPEG (restricted) range
  6502. @item pc
  6503. PC (full) range
  6504. @item jpeg
  6505. JPEG (full) range
  6506. @end table
  6507. @item format
  6508. Specify output color format.
  6509. The accepted values are:
  6510. @table @samp
  6511. @item yuv420p
  6512. YUV 4:2:0 planar 8-bits
  6513. @item yuv420p10
  6514. YUV 4:2:0 planar 10-bits
  6515. @item yuv420p12
  6516. YUV 4:2:0 planar 12-bits
  6517. @item yuv422p
  6518. YUV 4:2:2 planar 8-bits
  6519. @item yuv422p10
  6520. YUV 4:2:2 planar 10-bits
  6521. @item yuv422p12
  6522. YUV 4:2:2 planar 12-bits
  6523. @item yuv444p
  6524. YUV 4:4:4 planar 8-bits
  6525. @item yuv444p10
  6526. YUV 4:4:4 planar 10-bits
  6527. @item yuv444p12
  6528. YUV 4:4:4 planar 12-bits
  6529. @end table
  6530. @item fast
  6531. Do a fast conversion, which skips gamma/primary correction. This will take
  6532. significantly less CPU, but will be mathematically incorrect. To get output
  6533. compatible with that produced by the colormatrix filter, use fast=1.
  6534. @item dither
  6535. Specify dithering mode.
  6536. The accepted values are:
  6537. @table @samp
  6538. @item none
  6539. No dithering
  6540. @item fsb
  6541. Floyd-Steinberg dithering
  6542. @end table
  6543. @item wpadapt
  6544. Whitepoint adaptation mode.
  6545. The accepted values are:
  6546. @table @samp
  6547. @item bradford
  6548. Bradford whitepoint adaptation
  6549. @item vonkries
  6550. von Kries whitepoint adaptation
  6551. @item identity
  6552. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6553. @end table
  6554. @item iall
  6555. Override all input properties at once. Same accepted values as @ref{all}.
  6556. @item ispace
  6557. Override input colorspace. Same accepted values as @ref{space}.
  6558. @item iprimaries
  6559. Override input color primaries. Same accepted values as @ref{primaries}.
  6560. @item itrc
  6561. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6562. @item irange
  6563. Override input color range. Same accepted values as @ref{range}.
  6564. @end table
  6565. The filter converts the transfer characteristics, color space and color
  6566. primaries to the specified user values. The output value, if not specified,
  6567. is set to a default value based on the "all" property. If that property is
  6568. also not specified, the filter will log an error. The output color range and
  6569. format default to the same value as the input color range and format. The
  6570. input transfer characteristics, color space, color primaries and color range
  6571. should be set on the input data. If any of these are missing, the filter will
  6572. log an error and no conversion will take place.
  6573. For example to convert the input to SMPTE-240M, use the command:
  6574. @example
  6575. colorspace=smpte240m
  6576. @end example
  6577. @section convolution
  6578. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6579. The filter accepts the following options:
  6580. @table @option
  6581. @item 0m
  6582. @item 1m
  6583. @item 2m
  6584. @item 3m
  6585. Set matrix for each plane.
  6586. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6587. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6588. @item 0rdiv
  6589. @item 1rdiv
  6590. @item 2rdiv
  6591. @item 3rdiv
  6592. Set multiplier for calculated value for each plane.
  6593. If unset or 0, it will be sum of all matrix elements.
  6594. @item 0bias
  6595. @item 1bias
  6596. @item 2bias
  6597. @item 3bias
  6598. Set bias for each plane. This value is added to the result of the multiplication.
  6599. Useful for making the overall image brighter or darker. Default is 0.0.
  6600. @item 0mode
  6601. @item 1mode
  6602. @item 2mode
  6603. @item 3mode
  6604. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6605. Default is @var{square}.
  6606. @end table
  6607. @subsection Commands
  6608. This filter supports the all above options as @ref{commands}.
  6609. @subsection Examples
  6610. @itemize
  6611. @item
  6612. Apply sharpen:
  6613. @example
  6614. 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"
  6615. @end example
  6616. @item
  6617. Apply blur:
  6618. @example
  6619. 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"
  6620. @end example
  6621. @item
  6622. Apply edge enhance:
  6623. @example
  6624. 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"
  6625. @end example
  6626. @item
  6627. Apply edge detect:
  6628. @example
  6629. 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"
  6630. @end example
  6631. @item
  6632. Apply laplacian edge detector which includes diagonals:
  6633. @example
  6634. 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"
  6635. @end example
  6636. @item
  6637. Apply emboss:
  6638. @example
  6639. 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"
  6640. @end example
  6641. @end itemize
  6642. @section convolve
  6643. Apply 2D convolution of video stream in frequency domain using second stream
  6644. as impulse.
  6645. The filter accepts the following options:
  6646. @table @option
  6647. @item planes
  6648. Set which planes to process.
  6649. @item impulse
  6650. Set which impulse video frames will be processed, can be @var{first}
  6651. or @var{all}. Default is @var{all}.
  6652. @end table
  6653. The @code{convolve} filter also supports the @ref{framesync} options.
  6654. @section copy
  6655. Copy the input video source unchanged to the output. This is mainly useful for
  6656. testing purposes.
  6657. @anchor{coreimage}
  6658. @section coreimage
  6659. Video filtering on GPU using Apple's CoreImage API on OSX.
  6660. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6661. processed by video hardware. However, software-based OpenGL implementations
  6662. exist which means there is no guarantee for hardware processing. It depends on
  6663. the respective OSX.
  6664. There are many filters and image generators provided by Apple that come with a
  6665. large variety of options. The filter has to be referenced by its name along
  6666. with its options.
  6667. The coreimage filter accepts the following options:
  6668. @table @option
  6669. @item list_filters
  6670. List all available filters and generators along with all their respective
  6671. options as well as possible minimum and maximum values along with the default
  6672. values.
  6673. @example
  6674. list_filters=true
  6675. @end example
  6676. @item filter
  6677. Specify all filters by their respective name and options.
  6678. Use @var{list_filters} to determine all valid filter names and options.
  6679. Numerical options are specified by a float value and are automatically clamped
  6680. to their respective value range. Vector and color options have to be specified
  6681. by a list of space separated float values. Character escaping has to be done.
  6682. A special option name @code{default} is available to use default options for a
  6683. filter.
  6684. It is required to specify either @code{default} or at least one of the filter options.
  6685. All omitted options are used with their default values.
  6686. The syntax of the filter string is as follows:
  6687. @example
  6688. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6689. @end example
  6690. @item output_rect
  6691. Specify a rectangle where the output of the filter chain is copied into the
  6692. input image. It is given by a list of space separated float values:
  6693. @example
  6694. output_rect=x\ y\ width\ height
  6695. @end example
  6696. If not given, the output rectangle equals the dimensions of the input image.
  6697. The output rectangle is automatically cropped at the borders of the input
  6698. image. Negative values are valid for each component.
  6699. @example
  6700. output_rect=25\ 25\ 100\ 100
  6701. @end example
  6702. @end table
  6703. Several filters can be chained for successive processing without GPU-HOST
  6704. transfers allowing for fast processing of complex filter chains.
  6705. Currently, only filters with zero (generators) or exactly one (filters) input
  6706. image and one output image are supported. Also, transition filters are not yet
  6707. usable as intended.
  6708. Some filters generate output images with additional padding depending on the
  6709. respective filter kernel. The padding is automatically removed to ensure the
  6710. filter output has the same size as the input image.
  6711. For image generators, the size of the output image is determined by the
  6712. previous output image of the filter chain or the input image of the whole
  6713. filterchain, respectively. The generators do not use the pixel information of
  6714. this image to generate their output. However, the generated output is
  6715. blended onto this image, resulting in partial or complete coverage of the
  6716. output image.
  6717. The @ref{coreimagesrc} video source can be used for generating input images
  6718. which are directly fed into the filter chain. By using it, providing input
  6719. images by another video source or an input video is not required.
  6720. @subsection Examples
  6721. @itemize
  6722. @item
  6723. List all filters available:
  6724. @example
  6725. coreimage=list_filters=true
  6726. @end example
  6727. @item
  6728. Use the CIBoxBlur filter with default options to blur an image:
  6729. @example
  6730. coreimage=filter=CIBoxBlur@@default
  6731. @end example
  6732. @item
  6733. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6734. its center at 100x100 and a radius of 50 pixels:
  6735. @example
  6736. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6737. @end example
  6738. @item
  6739. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6740. given as complete and escaped command-line for Apple's standard bash shell:
  6741. @example
  6742. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6743. @end example
  6744. @end itemize
  6745. @section cover_rect
  6746. Cover a rectangular object
  6747. It accepts the following options:
  6748. @table @option
  6749. @item cover
  6750. Filepath of the optional cover image, needs to be in yuv420.
  6751. @item mode
  6752. Set covering mode.
  6753. It accepts the following values:
  6754. @table @samp
  6755. @item cover
  6756. cover it by the supplied image
  6757. @item blur
  6758. cover it by interpolating the surrounding pixels
  6759. @end table
  6760. Default value is @var{blur}.
  6761. @end table
  6762. @subsection Examples
  6763. @itemize
  6764. @item
  6765. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6766. @example
  6767. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6768. @end example
  6769. @end itemize
  6770. @section crop
  6771. Crop the input video to given dimensions.
  6772. It accepts the following parameters:
  6773. @table @option
  6774. @item w, out_w
  6775. The width of the output video. It defaults to @code{iw}.
  6776. This expression is evaluated only once during the filter
  6777. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6778. @item h, out_h
  6779. The height of the output video. It defaults to @code{ih}.
  6780. This expression is evaluated only once during the filter
  6781. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6782. @item x
  6783. The horizontal position, in the input video, of the left edge of the output
  6784. video. It defaults to @code{(in_w-out_w)/2}.
  6785. This expression is evaluated per-frame.
  6786. @item y
  6787. The vertical position, in the input video, of the top edge of the output video.
  6788. It defaults to @code{(in_h-out_h)/2}.
  6789. This expression is evaluated per-frame.
  6790. @item keep_aspect
  6791. If set to 1 will force the output display aspect ratio
  6792. to be the same of the input, by changing the output sample aspect
  6793. ratio. It defaults to 0.
  6794. @item exact
  6795. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6796. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6797. It defaults to 0.
  6798. @end table
  6799. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6800. expressions containing the following constants:
  6801. @table @option
  6802. @item x
  6803. @item y
  6804. The computed values for @var{x} and @var{y}. They are evaluated for
  6805. each new frame.
  6806. @item in_w
  6807. @item in_h
  6808. The input width and height.
  6809. @item iw
  6810. @item ih
  6811. These are the same as @var{in_w} and @var{in_h}.
  6812. @item out_w
  6813. @item out_h
  6814. The output (cropped) width and height.
  6815. @item ow
  6816. @item oh
  6817. These are the same as @var{out_w} and @var{out_h}.
  6818. @item a
  6819. same as @var{iw} / @var{ih}
  6820. @item sar
  6821. input sample aspect ratio
  6822. @item dar
  6823. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6824. @item hsub
  6825. @item vsub
  6826. horizontal and vertical chroma subsample values. For example for the
  6827. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6828. @item n
  6829. The number of the input frame, starting from 0.
  6830. @item pos
  6831. the position in the file of the input frame, NAN if unknown
  6832. @item t
  6833. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6834. @end table
  6835. The expression for @var{out_w} may depend on the value of @var{out_h},
  6836. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6837. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6838. evaluated after @var{out_w} and @var{out_h}.
  6839. The @var{x} and @var{y} parameters specify the expressions for the
  6840. position of the top-left corner of the output (non-cropped) area. They
  6841. are evaluated for each frame. If the evaluated value is not valid, it
  6842. is approximated to the nearest valid value.
  6843. The expression for @var{x} may depend on @var{y}, and the expression
  6844. for @var{y} may depend on @var{x}.
  6845. @subsection Examples
  6846. @itemize
  6847. @item
  6848. Crop area with size 100x100 at position (12,34).
  6849. @example
  6850. crop=100:100:12:34
  6851. @end example
  6852. Using named options, the example above becomes:
  6853. @example
  6854. crop=w=100:h=100:x=12:y=34
  6855. @end example
  6856. @item
  6857. Crop the central input area with size 100x100:
  6858. @example
  6859. crop=100:100
  6860. @end example
  6861. @item
  6862. Crop the central input area with size 2/3 of the input video:
  6863. @example
  6864. crop=2/3*in_w:2/3*in_h
  6865. @end example
  6866. @item
  6867. Crop the input video central square:
  6868. @example
  6869. crop=out_w=in_h
  6870. crop=in_h
  6871. @end example
  6872. @item
  6873. Delimit the rectangle with the top-left corner placed at position
  6874. 100:100 and the right-bottom corner corresponding to the right-bottom
  6875. corner of the input image.
  6876. @example
  6877. crop=in_w-100:in_h-100:100:100
  6878. @end example
  6879. @item
  6880. Crop 10 pixels from the left and right borders, and 20 pixels from
  6881. the top and bottom borders
  6882. @example
  6883. crop=in_w-2*10:in_h-2*20
  6884. @end example
  6885. @item
  6886. Keep only the bottom right quarter of the input image:
  6887. @example
  6888. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6889. @end example
  6890. @item
  6891. Crop height for getting Greek harmony:
  6892. @example
  6893. crop=in_w:1/PHI*in_w
  6894. @end example
  6895. @item
  6896. Apply trembling effect:
  6897. @example
  6898. 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)
  6899. @end example
  6900. @item
  6901. Apply erratic camera effect depending on timestamp:
  6902. @example
  6903. 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)"
  6904. @end example
  6905. @item
  6906. Set x depending on the value of y:
  6907. @example
  6908. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6909. @end example
  6910. @end itemize
  6911. @subsection Commands
  6912. This filter supports the following commands:
  6913. @table @option
  6914. @item w, out_w
  6915. @item h, out_h
  6916. @item x
  6917. @item y
  6918. Set width/height of the output video and the horizontal/vertical position
  6919. in the input video.
  6920. The command accepts the same syntax of the corresponding option.
  6921. If the specified expression is not valid, it is kept at its current
  6922. value.
  6923. @end table
  6924. @section cropdetect
  6925. Auto-detect the crop size.
  6926. It calculates the necessary cropping parameters and prints the
  6927. recommended parameters via the logging system. The detected dimensions
  6928. correspond to the non-black area of the input video.
  6929. It accepts the following parameters:
  6930. @table @option
  6931. @item limit
  6932. Set higher black value threshold, which can be optionally specified
  6933. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6934. value greater to the set value is considered non-black. It defaults to 24.
  6935. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6936. on the bitdepth of the pixel format.
  6937. @item round
  6938. The value which the width/height should be divisible by. It defaults to
  6939. 16. The offset is automatically adjusted to center the video. Use 2 to
  6940. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6941. encoding to most video codecs.
  6942. @item skip
  6943. Set the number of initial frames for which evaluation is skipped.
  6944. Default is 2. Range is 0 to INT_MAX.
  6945. @item reset_count, reset
  6946. Set the counter that determines after how many frames cropdetect will
  6947. reset the previously detected largest video area and start over to
  6948. detect the current optimal crop area. Default value is 0.
  6949. This can be useful when channel logos distort the video area. 0
  6950. indicates 'never reset', and returns the largest area encountered during
  6951. playback.
  6952. @end table
  6953. @anchor{cue}
  6954. @section cue
  6955. Delay video filtering until a given wallclock timestamp. The filter first
  6956. passes on @option{preroll} amount of frames, then it buffers at most
  6957. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6958. it forwards the buffered frames and also any subsequent frames coming in its
  6959. input.
  6960. The filter can be used synchronize the output of multiple ffmpeg processes for
  6961. realtime output devices like decklink. By putting the delay in the filtering
  6962. chain and pre-buffering frames the process can pass on data to output almost
  6963. immediately after the target wallclock timestamp is reached.
  6964. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6965. some use cases.
  6966. @table @option
  6967. @item cue
  6968. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6969. @item preroll
  6970. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6971. @item buffer
  6972. The maximum duration of content to buffer before waiting for the cue expressed
  6973. in seconds. Default is 0.
  6974. @end table
  6975. @anchor{curves}
  6976. @section curves
  6977. Apply color adjustments using curves.
  6978. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6979. component (red, green and blue) has its values defined by @var{N} key points
  6980. tied from each other using a smooth curve. The x-axis represents the pixel
  6981. values from the input frame, and the y-axis the new pixel values to be set for
  6982. the output frame.
  6983. By default, a component curve is defined by the two points @var{(0;0)} and
  6984. @var{(1;1)}. This creates a straight line where each original pixel value is
  6985. "adjusted" to its own value, which means no change to the image.
  6986. The filter allows you to redefine these two points and add some more. A new
  6987. curve (using a natural cubic spline interpolation) will be define to pass
  6988. smoothly through all these new coordinates. The new defined points needs to be
  6989. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6990. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6991. the vector spaces, the values will be clipped accordingly.
  6992. The filter accepts the following options:
  6993. @table @option
  6994. @item preset
  6995. Select one of the available color presets. This option can be used in addition
  6996. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6997. options takes priority on the preset values.
  6998. Available presets are:
  6999. @table @samp
  7000. @item none
  7001. @item color_negative
  7002. @item cross_process
  7003. @item darker
  7004. @item increase_contrast
  7005. @item lighter
  7006. @item linear_contrast
  7007. @item medium_contrast
  7008. @item negative
  7009. @item strong_contrast
  7010. @item vintage
  7011. @end table
  7012. Default is @code{none}.
  7013. @item master, m
  7014. Set the master key points. These points will define a second pass mapping. It
  7015. is sometimes called a "luminance" or "value" mapping. It can be used with
  7016. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7017. post-processing LUT.
  7018. @item red, r
  7019. Set the key points for the red component.
  7020. @item green, g
  7021. Set the key points for the green component.
  7022. @item blue, b
  7023. Set the key points for the blue component.
  7024. @item all
  7025. Set the key points for all components (not including master).
  7026. Can be used in addition to the other key points component
  7027. options. In this case, the unset component(s) will fallback on this
  7028. @option{all} setting.
  7029. @item psfile
  7030. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7031. @item plot
  7032. Save Gnuplot script of the curves in specified file.
  7033. @end table
  7034. To avoid some filtergraph syntax conflicts, each key points list need to be
  7035. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7036. @subsection Examples
  7037. @itemize
  7038. @item
  7039. Increase slightly the middle level of blue:
  7040. @example
  7041. curves=blue='0/0 0.5/0.58 1/1'
  7042. @end example
  7043. @item
  7044. Vintage effect:
  7045. @example
  7046. 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'
  7047. @end example
  7048. Here we obtain the following coordinates for each components:
  7049. @table @var
  7050. @item red
  7051. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7052. @item green
  7053. @code{(0;0) (0.50;0.48) (1;1)}
  7054. @item blue
  7055. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7056. @end table
  7057. @item
  7058. The previous example can also be achieved with the associated built-in preset:
  7059. @example
  7060. curves=preset=vintage
  7061. @end example
  7062. @item
  7063. Or simply:
  7064. @example
  7065. curves=vintage
  7066. @end example
  7067. @item
  7068. Use a Photoshop preset and redefine the points of the green component:
  7069. @example
  7070. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7071. @end example
  7072. @item
  7073. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7074. and @command{gnuplot}:
  7075. @example
  7076. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7077. gnuplot -p /tmp/curves.plt
  7078. @end example
  7079. @end itemize
  7080. @section datascope
  7081. Video data analysis filter.
  7082. This filter shows hexadecimal pixel values of part of video.
  7083. The filter accepts the following options:
  7084. @table @option
  7085. @item size, s
  7086. Set output video size.
  7087. @item x
  7088. Set x offset from where to pick pixels.
  7089. @item y
  7090. Set y offset from where to pick pixels.
  7091. @item mode
  7092. Set scope mode, can be one of the following:
  7093. @table @samp
  7094. @item mono
  7095. Draw hexadecimal pixel values with white color on black background.
  7096. @item color
  7097. Draw hexadecimal pixel values with input video pixel color on black
  7098. background.
  7099. @item color2
  7100. Draw hexadecimal pixel values on color background picked from input video,
  7101. the text color is picked in such way so its always visible.
  7102. @end table
  7103. @item axis
  7104. Draw rows and columns numbers on left and top of video.
  7105. @item opacity
  7106. Set background opacity.
  7107. @item format
  7108. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7109. @item components
  7110. Set pixel components to display. By default all pixel components are displayed.
  7111. @end table
  7112. @section dblur
  7113. Apply Directional blur filter.
  7114. The filter accepts the following options:
  7115. @table @option
  7116. @item angle
  7117. Set angle of directional blur. Default is @code{45}.
  7118. @item radius
  7119. Set radius of directional blur. Default is @code{5}.
  7120. @item planes
  7121. Set which planes to filter. By default all planes are filtered.
  7122. @end table
  7123. @subsection Commands
  7124. This filter supports same @ref{commands} as options.
  7125. The command accepts the same syntax of the corresponding option.
  7126. If the specified expression is not valid, it is kept at its current
  7127. value.
  7128. @section dctdnoiz
  7129. Denoise frames using 2D DCT (frequency domain filtering).
  7130. This filter is not designed for real time.
  7131. The filter accepts the following options:
  7132. @table @option
  7133. @item sigma, s
  7134. Set the noise sigma constant.
  7135. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7136. coefficient (absolute value) below this threshold with be dropped.
  7137. If you need a more advanced filtering, see @option{expr}.
  7138. Default is @code{0}.
  7139. @item overlap
  7140. Set number overlapping pixels for each block. Since the filter can be slow, you
  7141. may want to reduce this value, at the cost of a less effective filter and the
  7142. risk of various artefacts.
  7143. If the overlapping value doesn't permit processing the whole input width or
  7144. height, a warning will be displayed and according borders won't be denoised.
  7145. Default value is @var{blocksize}-1, which is the best possible setting.
  7146. @item expr, e
  7147. Set the coefficient factor expression.
  7148. For each coefficient of a DCT block, this expression will be evaluated as a
  7149. multiplier value for the coefficient.
  7150. If this is option is set, the @option{sigma} option will be ignored.
  7151. The absolute value of the coefficient can be accessed through the @var{c}
  7152. variable.
  7153. @item n
  7154. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7155. @var{blocksize}, which is the width and height of the processed blocks.
  7156. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7157. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7158. on the speed processing. Also, a larger block size does not necessarily means a
  7159. better de-noising.
  7160. @end table
  7161. @subsection Examples
  7162. Apply a denoise with a @option{sigma} of @code{4.5}:
  7163. @example
  7164. dctdnoiz=4.5
  7165. @end example
  7166. The same operation can be achieved using the expression system:
  7167. @example
  7168. dctdnoiz=e='gte(c, 4.5*3)'
  7169. @end example
  7170. Violent denoise using a block size of @code{16x16}:
  7171. @example
  7172. dctdnoiz=15:n=4
  7173. @end example
  7174. @section deband
  7175. Remove banding artifacts from input video.
  7176. It works by replacing banded pixels with average value of referenced pixels.
  7177. The filter accepts the following options:
  7178. @table @option
  7179. @item 1thr
  7180. @item 2thr
  7181. @item 3thr
  7182. @item 4thr
  7183. Set banding detection threshold for each plane. Default is 0.02.
  7184. Valid range is 0.00003 to 0.5.
  7185. If difference between current pixel and reference pixel is less than threshold,
  7186. it will be considered as banded.
  7187. @item range, r
  7188. Banding detection range in pixels. Default is 16. If positive, random number
  7189. in range 0 to set value will be used. If negative, exact absolute value
  7190. will be used.
  7191. The range defines square of four pixels around current pixel.
  7192. @item direction, d
  7193. Set direction in radians from which four pixel will be compared. If positive,
  7194. random direction from 0 to set direction will be picked. If negative, exact of
  7195. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7196. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7197. column.
  7198. @item blur, b
  7199. If enabled, current pixel is compared with average value of all four
  7200. surrounding pixels. The default is enabled. If disabled current pixel is
  7201. compared with all four surrounding pixels. The pixel is considered banded
  7202. if only all four differences with surrounding pixels are less than threshold.
  7203. @item coupling, c
  7204. If enabled, current pixel is changed if and only if all pixel components are banded,
  7205. e.g. banding detection threshold is triggered for all color components.
  7206. The default is disabled.
  7207. @end table
  7208. @section deblock
  7209. Remove blocking artifacts from input video.
  7210. The filter accepts the following options:
  7211. @table @option
  7212. @item filter
  7213. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7214. This controls what kind of deblocking is applied.
  7215. @item block
  7216. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7217. @item alpha
  7218. @item beta
  7219. @item gamma
  7220. @item delta
  7221. Set blocking detection thresholds. Allowed range is 0 to 1.
  7222. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7223. Using higher threshold gives more deblocking strength.
  7224. Setting @var{alpha} controls threshold detection at exact edge of block.
  7225. Remaining options controls threshold detection near the edge. Each one for
  7226. below/above or left/right. Setting any of those to @var{0} disables
  7227. deblocking.
  7228. @item planes
  7229. Set planes to filter. Default is to filter all available planes.
  7230. @end table
  7231. @subsection Examples
  7232. @itemize
  7233. @item
  7234. Deblock using weak filter and block size of 4 pixels.
  7235. @example
  7236. deblock=filter=weak:block=4
  7237. @end example
  7238. @item
  7239. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7240. deblocking more edges.
  7241. @example
  7242. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7243. @end example
  7244. @item
  7245. Similar as above, but filter only first plane.
  7246. @example
  7247. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7248. @end example
  7249. @item
  7250. Similar as above, but filter only second and third plane.
  7251. @example
  7252. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7253. @end example
  7254. @end itemize
  7255. @anchor{decimate}
  7256. @section decimate
  7257. Drop duplicated frames at regular intervals.
  7258. The filter accepts the following options:
  7259. @table @option
  7260. @item cycle
  7261. Set the number of frames from which one will be dropped. Setting this to
  7262. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7263. Default is @code{5}.
  7264. @item dupthresh
  7265. Set the threshold for duplicate detection. If the difference metric for a frame
  7266. is less than or equal to this value, then it is declared as duplicate. Default
  7267. is @code{1.1}
  7268. @item scthresh
  7269. Set scene change threshold. Default is @code{15}.
  7270. @item blockx
  7271. @item blocky
  7272. Set the size of the x and y-axis blocks used during metric calculations.
  7273. Larger blocks give better noise suppression, but also give worse detection of
  7274. small movements. Must be a power of two. Default is @code{32}.
  7275. @item ppsrc
  7276. Mark main input as a pre-processed input and activate clean source input
  7277. stream. This allows the input to be pre-processed with various filters to help
  7278. the metrics calculation while keeping the frame selection lossless. When set to
  7279. @code{1}, the first stream is for the pre-processed input, and the second
  7280. stream is the clean source from where the kept frames are chosen. Default is
  7281. @code{0}.
  7282. @item chroma
  7283. Set whether or not chroma is considered in the metric calculations. Default is
  7284. @code{1}.
  7285. @end table
  7286. @section deconvolve
  7287. Apply 2D deconvolution of video stream in frequency domain using second stream
  7288. as impulse.
  7289. The filter accepts the following options:
  7290. @table @option
  7291. @item planes
  7292. Set which planes to process.
  7293. @item impulse
  7294. Set which impulse video frames will be processed, can be @var{first}
  7295. or @var{all}. Default is @var{all}.
  7296. @item noise
  7297. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7298. and height are not same and not power of 2 or if stream prior to convolving
  7299. had noise.
  7300. @end table
  7301. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7302. @section dedot
  7303. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7304. It accepts the following options:
  7305. @table @option
  7306. @item m
  7307. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7308. @var{rainbows} for cross-color reduction.
  7309. @item lt
  7310. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7311. @item tl
  7312. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7313. @item tc
  7314. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7315. @item ct
  7316. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7317. @end table
  7318. @section deflate
  7319. Apply deflate effect to the video.
  7320. This filter replaces the pixel by the local(3x3) average by taking into account
  7321. only values lower than the pixel.
  7322. It accepts the following options:
  7323. @table @option
  7324. @item threshold0
  7325. @item threshold1
  7326. @item threshold2
  7327. @item threshold3
  7328. Limit the maximum change for each plane, default is 65535.
  7329. If 0, plane will remain unchanged.
  7330. @end table
  7331. @subsection Commands
  7332. This filter supports the all above options as @ref{commands}.
  7333. @section deflicker
  7334. Remove temporal frame luminance variations.
  7335. It accepts the following options:
  7336. @table @option
  7337. @item size, s
  7338. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7339. @item mode, m
  7340. Set averaging mode to smooth temporal luminance variations.
  7341. Available values are:
  7342. @table @samp
  7343. @item am
  7344. Arithmetic mean
  7345. @item gm
  7346. Geometric mean
  7347. @item hm
  7348. Harmonic mean
  7349. @item qm
  7350. Quadratic mean
  7351. @item cm
  7352. Cubic mean
  7353. @item pm
  7354. Power mean
  7355. @item median
  7356. Median
  7357. @end table
  7358. @item bypass
  7359. Do not actually modify frame. Useful when one only wants metadata.
  7360. @end table
  7361. @section dejudder
  7362. Remove judder produced by partially interlaced telecined content.
  7363. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7364. source was partially telecined content then the output of @code{pullup,dejudder}
  7365. will have a variable frame rate. May change the recorded frame rate of the
  7366. container. Aside from that change, this filter will not affect constant frame
  7367. rate video.
  7368. The option available in this filter is:
  7369. @table @option
  7370. @item cycle
  7371. Specify the length of the window over which the judder repeats.
  7372. Accepts any integer greater than 1. Useful values are:
  7373. @table @samp
  7374. @item 4
  7375. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7376. @item 5
  7377. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7378. @item 20
  7379. If a mixture of the two.
  7380. @end table
  7381. The default is @samp{4}.
  7382. @end table
  7383. @section delogo
  7384. Suppress a TV station logo by a simple interpolation of the surrounding
  7385. pixels. Just set a rectangle covering the logo and watch it disappear
  7386. (and sometimes something even uglier appear - your mileage may vary).
  7387. It accepts the following parameters:
  7388. @table @option
  7389. @item x
  7390. @item y
  7391. Specify the top left corner coordinates of the logo. They must be
  7392. specified.
  7393. @item w
  7394. @item h
  7395. Specify the width and height of the logo to clear. They must be
  7396. specified.
  7397. @item band, t
  7398. Specify the thickness of the fuzzy edge of the rectangle (added to
  7399. @var{w} and @var{h}). The default value is 1. This option is
  7400. deprecated, setting higher values should no longer be necessary and
  7401. is not recommended.
  7402. @item show
  7403. When set to 1, a green rectangle is drawn on the screen to simplify
  7404. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7405. The default value is 0.
  7406. The rectangle is drawn on the outermost pixels which will be (partly)
  7407. replaced with interpolated values. The values of the next pixels
  7408. immediately outside this rectangle in each direction will be used to
  7409. compute the interpolated pixel values inside the rectangle.
  7410. @end table
  7411. @subsection Examples
  7412. @itemize
  7413. @item
  7414. Set a rectangle covering the area with top left corner coordinates 0,0
  7415. and size 100x77, and a band of size 10:
  7416. @example
  7417. delogo=x=0:y=0:w=100:h=77:band=10
  7418. @end example
  7419. @end itemize
  7420. @anchor{derain}
  7421. @section derain
  7422. Remove the rain in the input image/video by applying the derain methods based on
  7423. convolutional neural networks. Supported models:
  7424. @itemize
  7425. @item
  7426. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7427. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7428. @end itemize
  7429. Training as well as model generation scripts are provided in
  7430. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7431. Native model files (.model) can be generated from TensorFlow model
  7432. files (.pb) by using tools/python/convert.py
  7433. The filter accepts the following options:
  7434. @table @option
  7435. @item filter_type
  7436. Specify which filter to use. This option accepts the following values:
  7437. @table @samp
  7438. @item derain
  7439. Derain filter. To conduct derain filter, you need to use a derain model.
  7440. @item dehaze
  7441. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7442. @end table
  7443. Default value is @samp{derain}.
  7444. @item dnn_backend
  7445. Specify which DNN backend to use for model loading and execution. This option accepts
  7446. the following values:
  7447. @table @samp
  7448. @item native
  7449. Native implementation of DNN loading and execution.
  7450. @item tensorflow
  7451. TensorFlow backend. To enable this backend you
  7452. need to install the TensorFlow for C library (see
  7453. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7454. @code{--enable-libtensorflow}
  7455. @end table
  7456. Default value is @samp{native}.
  7457. @item model
  7458. Set path to model file specifying network architecture and its parameters.
  7459. Note that different backends use different file formats. TensorFlow and native
  7460. backend can load files for only its format.
  7461. @end table
  7462. It can also be finished with @ref{dnn_processing} filter.
  7463. @section deshake
  7464. Attempt to fix small changes in horizontal and/or vertical shift. This
  7465. filter helps remove camera shake from hand-holding a camera, bumping a
  7466. tripod, moving on a vehicle, etc.
  7467. The filter accepts the following options:
  7468. @table @option
  7469. @item x
  7470. @item y
  7471. @item w
  7472. @item h
  7473. Specify a rectangular area where to limit the search for motion
  7474. vectors.
  7475. If desired the search for motion vectors can be limited to a
  7476. rectangular area of the frame defined by its top left corner, width
  7477. and height. These parameters have the same meaning as the drawbox
  7478. filter which can be used to visualise the position of the bounding
  7479. box.
  7480. This is useful when simultaneous movement of subjects within the frame
  7481. might be confused for camera motion by the motion vector search.
  7482. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7483. then the full frame is used. This allows later options to be set
  7484. without specifying the bounding box for the motion vector search.
  7485. Default - search the whole frame.
  7486. @item rx
  7487. @item ry
  7488. Specify the maximum extent of movement in x and y directions in the
  7489. range 0-64 pixels. Default 16.
  7490. @item edge
  7491. Specify how to generate pixels to fill blanks at the edge of the
  7492. frame. Available values are:
  7493. @table @samp
  7494. @item blank, 0
  7495. Fill zeroes at blank locations
  7496. @item original, 1
  7497. Original image at blank locations
  7498. @item clamp, 2
  7499. Extruded edge value at blank locations
  7500. @item mirror, 3
  7501. Mirrored edge at blank locations
  7502. @end table
  7503. Default value is @samp{mirror}.
  7504. @item blocksize
  7505. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7506. default 8.
  7507. @item contrast
  7508. Specify the contrast threshold for blocks. Only blocks with more than
  7509. the specified contrast (difference between darkest and lightest
  7510. pixels) will be considered. Range 1-255, default 125.
  7511. @item search
  7512. Specify the search strategy. Available values are:
  7513. @table @samp
  7514. @item exhaustive, 0
  7515. Set exhaustive search
  7516. @item less, 1
  7517. Set less exhaustive search.
  7518. @end table
  7519. Default value is @samp{exhaustive}.
  7520. @item filename
  7521. If set then a detailed log of the motion search is written to the
  7522. specified file.
  7523. @end table
  7524. @section despill
  7525. Remove unwanted contamination of foreground colors, caused by reflected color of
  7526. greenscreen or bluescreen.
  7527. This filter accepts the following options:
  7528. @table @option
  7529. @item type
  7530. Set what type of despill to use.
  7531. @item mix
  7532. Set how spillmap will be generated.
  7533. @item expand
  7534. Set how much to get rid of still remaining spill.
  7535. @item red
  7536. Controls amount of red in spill area.
  7537. @item green
  7538. Controls amount of green in spill area.
  7539. Should be -1 for greenscreen.
  7540. @item blue
  7541. Controls amount of blue in spill area.
  7542. Should be -1 for bluescreen.
  7543. @item brightness
  7544. Controls brightness of spill area, preserving colors.
  7545. @item alpha
  7546. Modify alpha from generated spillmap.
  7547. @end table
  7548. @subsection Commands
  7549. This filter supports the all above options as @ref{commands}.
  7550. @section detelecine
  7551. Apply an exact inverse of the telecine operation. It requires a predefined
  7552. pattern specified using the pattern option which must be the same as that passed
  7553. to the telecine filter.
  7554. This filter accepts the following options:
  7555. @table @option
  7556. @item first_field
  7557. @table @samp
  7558. @item top, t
  7559. top field first
  7560. @item bottom, b
  7561. bottom field first
  7562. The default value is @code{top}.
  7563. @end table
  7564. @item pattern
  7565. A string of numbers representing the pulldown pattern you wish to apply.
  7566. The default value is @code{23}.
  7567. @item start_frame
  7568. A number representing position of the first frame with respect to the telecine
  7569. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7570. @end table
  7571. @section dilation
  7572. Apply dilation effect to the video.
  7573. This filter replaces the pixel by the local(3x3) maximum.
  7574. It accepts the following options:
  7575. @table @option
  7576. @item threshold0
  7577. @item threshold1
  7578. @item threshold2
  7579. @item threshold3
  7580. Limit the maximum change for each plane, default is 65535.
  7581. If 0, plane will remain unchanged.
  7582. @item coordinates
  7583. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7584. pixels are used.
  7585. Flags to local 3x3 coordinates maps like this:
  7586. 1 2 3
  7587. 4 5
  7588. 6 7 8
  7589. @end table
  7590. @subsection Commands
  7591. This filter supports the all above options as @ref{commands}.
  7592. @section displace
  7593. Displace pixels as indicated by second and third input stream.
  7594. It takes three input streams and outputs one stream, the first input is the
  7595. source, and second and third input are displacement maps.
  7596. The second input specifies how much to displace pixels along the
  7597. x-axis, while the third input specifies how much to displace pixels
  7598. along the y-axis.
  7599. If one of displacement map streams terminates, last frame from that
  7600. displacement map will be used.
  7601. Note that once generated, displacements maps can be reused over and over again.
  7602. A description of the accepted options follows.
  7603. @table @option
  7604. @item edge
  7605. Set displace behavior for pixels that are out of range.
  7606. Available values are:
  7607. @table @samp
  7608. @item blank
  7609. Missing pixels are replaced by black pixels.
  7610. @item smear
  7611. Adjacent pixels will spread out to replace missing pixels.
  7612. @item wrap
  7613. Out of range pixels are wrapped so they point to pixels of other side.
  7614. @item mirror
  7615. Out of range pixels will be replaced with mirrored pixels.
  7616. @end table
  7617. Default is @samp{smear}.
  7618. @end table
  7619. @subsection Examples
  7620. @itemize
  7621. @item
  7622. Add ripple effect to rgb input of video size hd720:
  7623. @example
  7624. 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
  7625. @end example
  7626. @item
  7627. Add wave effect to rgb input of video size hd720:
  7628. @example
  7629. 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
  7630. @end example
  7631. @end itemize
  7632. @anchor{dnn_processing}
  7633. @section dnn_processing
  7634. Do image processing with deep neural networks. It works together with another filter
  7635. which converts the pixel format of the Frame to what the dnn network requires.
  7636. The filter accepts the following options:
  7637. @table @option
  7638. @item dnn_backend
  7639. Specify which DNN backend to use for model loading and execution. This option accepts
  7640. the following values:
  7641. @table @samp
  7642. @item native
  7643. Native implementation of DNN loading and execution.
  7644. @item tensorflow
  7645. TensorFlow backend. To enable this backend you
  7646. need to install the TensorFlow for C library (see
  7647. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7648. @code{--enable-libtensorflow}
  7649. @item openvino
  7650. OpenVINO backend. To enable this backend you
  7651. need to build and install the OpenVINO for C library (see
  7652. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7653. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7654. be needed if the header files and libraries are not installed into system path)
  7655. @end table
  7656. Default value is @samp{native}.
  7657. @item model
  7658. Set path to model file specifying network architecture and its parameters.
  7659. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7660. backend can load files for only its format.
  7661. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7662. @item input
  7663. Set the input name of the dnn network.
  7664. @item output
  7665. Set the output name of the dnn network.
  7666. @item async
  7667. use DNN async execution if set (default: set),
  7668. roll back to sync execution if the backend does not support async.
  7669. @end table
  7670. @subsection Examples
  7671. @itemize
  7672. @item
  7673. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7674. @example
  7675. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7676. @end example
  7677. @item
  7678. Halve the pixel value of the frame with format gray32f:
  7679. @example
  7680. 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
  7681. @end example
  7682. @item
  7683. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7684. @example
  7685. ./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
  7686. @end example
  7687. @item
  7688. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7689. @example
  7690. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7691. @end example
  7692. @end itemize
  7693. @section drawbox
  7694. Draw a colored box on the input image.
  7695. It accepts the following parameters:
  7696. @table @option
  7697. @item x
  7698. @item y
  7699. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7700. @item width, w
  7701. @item height, h
  7702. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7703. the input width and height. It defaults to 0.
  7704. @item color, c
  7705. Specify the color of the box to write. For the general syntax of this option,
  7706. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7707. value @code{invert} is used, the box edge color is the same as the
  7708. video with inverted luma.
  7709. @item thickness, t
  7710. The expression which sets the thickness of the box edge.
  7711. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7712. See below for the list of accepted constants.
  7713. @item replace
  7714. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7715. will overwrite the video's color and alpha pixels.
  7716. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7717. @end table
  7718. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7719. following constants:
  7720. @table @option
  7721. @item dar
  7722. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7723. @item hsub
  7724. @item vsub
  7725. horizontal and vertical chroma subsample values. For example for the
  7726. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7727. @item in_h, ih
  7728. @item in_w, iw
  7729. The input width and height.
  7730. @item sar
  7731. The input sample aspect ratio.
  7732. @item x
  7733. @item y
  7734. The x and y offset coordinates where the box is drawn.
  7735. @item w
  7736. @item h
  7737. The width and height of the drawn box.
  7738. @item t
  7739. The thickness of the drawn box.
  7740. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7741. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7742. @end table
  7743. @subsection Examples
  7744. @itemize
  7745. @item
  7746. Draw a black box around the edge of the input image:
  7747. @example
  7748. drawbox
  7749. @end example
  7750. @item
  7751. Draw a box with color red and an opacity of 50%:
  7752. @example
  7753. drawbox=10:20:200:60:red@@0.5
  7754. @end example
  7755. The previous example can be specified as:
  7756. @example
  7757. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7758. @end example
  7759. @item
  7760. Fill the box with pink color:
  7761. @example
  7762. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7763. @end example
  7764. @item
  7765. Draw a 2-pixel red 2.40:1 mask:
  7766. @example
  7767. 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
  7768. @end example
  7769. @end itemize
  7770. @subsection Commands
  7771. This filter supports same commands as options.
  7772. The command accepts the same syntax of the corresponding option.
  7773. If the specified expression is not valid, it is kept at its current
  7774. value.
  7775. @anchor{drawgraph}
  7776. @section drawgraph
  7777. Draw a graph using input video metadata.
  7778. It accepts the following parameters:
  7779. @table @option
  7780. @item m1
  7781. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7782. @item fg1
  7783. Set 1st foreground color expression.
  7784. @item m2
  7785. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7786. @item fg2
  7787. Set 2nd foreground color expression.
  7788. @item m3
  7789. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7790. @item fg3
  7791. Set 3rd foreground color expression.
  7792. @item m4
  7793. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7794. @item fg4
  7795. Set 4th foreground color expression.
  7796. @item min
  7797. Set minimal value of metadata value.
  7798. @item max
  7799. Set maximal value of metadata value.
  7800. @item bg
  7801. Set graph background color. Default is white.
  7802. @item mode
  7803. Set graph mode.
  7804. Available values for mode is:
  7805. @table @samp
  7806. @item bar
  7807. @item dot
  7808. @item line
  7809. @end table
  7810. Default is @code{line}.
  7811. @item slide
  7812. Set slide mode.
  7813. Available values for slide is:
  7814. @table @samp
  7815. @item frame
  7816. Draw new frame when right border is reached.
  7817. @item replace
  7818. Replace old columns with new ones.
  7819. @item scroll
  7820. Scroll from right to left.
  7821. @item rscroll
  7822. Scroll from left to right.
  7823. @item picture
  7824. Draw single picture.
  7825. @end table
  7826. Default is @code{frame}.
  7827. @item size
  7828. Set size of graph video. For the syntax of this option, check the
  7829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7830. The default value is @code{900x256}.
  7831. @item rate, r
  7832. Set the output frame rate. Default value is @code{25}.
  7833. The foreground color expressions can use the following variables:
  7834. @table @option
  7835. @item MIN
  7836. Minimal value of metadata value.
  7837. @item MAX
  7838. Maximal value of metadata value.
  7839. @item VAL
  7840. Current metadata key value.
  7841. @end table
  7842. The color is defined as 0xAABBGGRR.
  7843. @end table
  7844. Example using metadata from @ref{signalstats} filter:
  7845. @example
  7846. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7847. @end example
  7848. Example using metadata from @ref{ebur128} filter:
  7849. @example
  7850. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7851. @end example
  7852. @section drawgrid
  7853. Draw a grid on the input image.
  7854. It accepts the following parameters:
  7855. @table @option
  7856. @item x
  7857. @item y
  7858. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7859. @item width, w
  7860. @item height, h
  7861. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7862. input width and height, respectively, minus @code{thickness}, so image gets
  7863. framed. Default to 0.
  7864. @item color, c
  7865. Specify the color of the grid. For the general syntax of this option,
  7866. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7867. value @code{invert} is used, the grid color is the same as the
  7868. video with inverted luma.
  7869. @item thickness, t
  7870. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7871. See below for the list of accepted constants.
  7872. @item replace
  7873. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7874. will overwrite the video's color and alpha pixels.
  7875. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7876. @end table
  7877. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7878. following constants:
  7879. @table @option
  7880. @item dar
  7881. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7882. @item hsub
  7883. @item vsub
  7884. horizontal and vertical chroma subsample values. For example for the
  7885. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7886. @item in_h, ih
  7887. @item in_w, iw
  7888. The input grid cell width and height.
  7889. @item sar
  7890. The input sample aspect ratio.
  7891. @item x
  7892. @item y
  7893. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7894. @item w
  7895. @item h
  7896. The width and height of the drawn cell.
  7897. @item t
  7898. The thickness of the drawn cell.
  7899. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7900. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7901. @end table
  7902. @subsection Examples
  7903. @itemize
  7904. @item
  7905. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7906. @example
  7907. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7908. @end example
  7909. @item
  7910. Draw a white 3x3 grid with an opacity of 50%:
  7911. @example
  7912. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7913. @end example
  7914. @end itemize
  7915. @subsection Commands
  7916. This filter supports same commands as options.
  7917. The command accepts the same syntax of the corresponding option.
  7918. If the specified expression is not valid, it is kept at its current
  7919. value.
  7920. @anchor{drawtext}
  7921. @section drawtext
  7922. Draw a text string or text from a specified file on top of a video, using the
  7923. libfreetype library.
  7924. To enable compilation of this filter, you need to configure FFmpeg with
  7925. @code{--enable-libfreetype}.
  7926. To enable default font fallback and the @var{font} option you need to
  7927. configure FFmpeg with @code{--enable-libfontconfig}.
  7928. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7929. @code{--enable-libfribidi}.
  7930. @subsection Syntax
  7931. It accepts the following parameters:
  7932. @table @option
  7933. @item box
  7934. Used to draw a box around text using the background color.
  7935. The value must be either 1 (enable) or 0 (disable).
  7936. The default value of @var{box} is 0.
  7937. @item boxborderw
  7938. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7939. The default value of @var{boxborderw} is 0.
  7940. @item boxcolor
  7941. The color to be used for drawing box around text. For the syntax of this
  7942. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7943. The default value of @var{boxcolor} is "white".
  7944. @item line_spacing
  7945. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7946. The default value of @var{line_spacing} is 0.
  7947. @item borderw
  7948. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7949. The default value of @var{borderw} is 0.
  7950. @item bordercolor
  7951. Set the color to be used for drawing border around text. For the syntax of this
  7952. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7953. The default value of @var{bordercolor} is "black".
  7954. @item expansion
  7955. Select how the @var{text} is expanded. Can be either @code{none},
  7956. @code{strftime} (deprecated) or
  7957. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7958. below for details.
  7959. @item basetime
  7960. Set a start time for the count. Value is in microseconds. Only applied
  7961. in the deprecated strftime expansion mode. To emulate in normal expansion
  7962. mode use the @code{pts} function, supplying the start time (in seconds)
  7963. as the second argument.
  7964. @item fix_bounds
  7965. If true, check and fix text coords to avoid clipping.
  7966. @item fontcolor
  7967. The color to be used for drawing fonts. For the syntax of this option, check
  7968. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7969. The default value of @var{fontcolor} is "black".
  7970. @item fontcolor_expr
  7971. String which is expanded the same way as @var{text} to obtain dynamic
  7972. @var{fontcolor} value. By default this option has empty value and is not
  7973. processed. When this option is set, it overrides @var{fontcolor} option.
  7974. @item font
  7975. The font family to be used for drawing text. By default Sans.
  7976. @item fontfile
  7977. The font file to be used for drawing text. The path must be included.
  7978. This parameter is mandatory if the fontconfig support is disabled.
  7979. @item alpha
  7980. Draw the text applying alpha blending. The value can
  7981. be a number between 0.0 and 1.0.
  7982. The expression accepts the same variables @var{x, y} as well.
  7983. The default value is 1.
  7984. Please see @var{fontcolor_expr}.
  7985. @item fontsize
  7986. The font size to be used for drawing text.
  7987. The default value of @var{fontsize} is 16.
  7988. @item text_shaping
  7989. If set to 1, attempt to shape the text (for example, reverse the order of
  7990. right-to-left text and join Arabic characters) before drawing it.
  7991. Otherwise, just draw the text exactly as given.
  7992. By default 1 (if supported).
  7993. @item ft_load_flags
  7994. The flags to be used for loading the fonts.
  7995. The flags map the corresponding flags supported by libfreetype, and are
  7996. a combination of the following values:
  7997. @table @var
  7998. @item default
  7999. @item no_scale
  8000. @item no_hinting
  8001. @item render
  8002. @item no_bitmap
  8003. @item vertical_layout
  8004. @item force_autohint
  8005. @item crop_bitmap
  8006. @item pedantic
  8007. @item ignore_global_advance_width
  8008. @item no_recurse
  8009. @item ignore_transform
  8010. @item monochrome
  8011. @item linear_design
  8012. @item no_autohint
  8013. @end table
  8014. Default value is "default".
  8015. For more information consult the documentation for the FT_LOAD_*
  8016. libfreetype flags.
  8017. @item shadowcolor
  8018. The color to be used for drawing a shadow behind the drawn text. For the
  8019. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8020. ffmpeg-utils manual,ffmpeg-utils}.
  8021. The default value of @var{shadowcolor} is "black".
  8022. @item shadowx
  8023. @item shadowy
  8024. The x and y offsets for the text shadow position with respect to the
  8025. position of the text. They can be either positive or negative
  8026. values. The default value for both is "0".
  8027. @item start_number
  8028. The starting frame number for the n/frame_num variable. The default value
  8029. is "0".
  8030. @item tabsize
  8031. The size in number of spaces to use for rendering the tab.
  8032. Default value is 4.
  8033. @item timecode
  8034. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8035. format. It can be used with or without text parameter. @var{timecode_rate}
  8036. option must be specified.
  8037. @item timecode_rate, rate, r
  8038. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8039. integer. Minimum value is "1".
  8040. Drop-frame timecode is supported for frame rates 30 & 60.
  8041. @item tc24hmax
  8042. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8043. Default is 0 (disabled).
  8044. @item text
  8045. The text string to be drawn. The text must be a sequence of UTF-8
  8046. encoded characters.
  8047. This parameter is mandatory if no file is specified with the parameter
  8048. @var{textfile}.
  8049. @item textfile
  8050. A text file containing text to be drawn. The text must be a sequence
  8051. of UTF-8 encoded characters.
  8052. This parameter is mandatory if no text string is specified with the
  8053. parameter @var{text}.
  8054. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8055. @item reload
  8056. If set to 1, the @var{textfile} will be reloaded before each frame.
  8057. Be sure to update it atomically, or it may be read partially, or even fail.
  8058. @item x
  8059. @item y
  8060. The expressions which specify the offsets where text will be drawn
  8061. within the video frame. They are relative to the top/left border of the
  8062. output image.
  8063. The default value of @var{x} and @var{y} is "0".
  8064. See below for the list of accepted constants and functions.
  8065. @end table
  8066. The parameters for @var{x} and @var{y} are expressions containing the
  8067. following constants and functions:
  8068. @table @option
  8069. @item dar
  8070. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8071. @item hsub
  8072. @item vsub
  8073. horizontal and vertical chroma subsample values. For example for the
  8074. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8075. @item line_h, lh
  8076. the height of each text line
  8077. @item main_h, h, H
  8078. the input height
  8079. @item main_w, w, W
  8080. the input width
  8081. @item max_glyph_a, ascent
  8082. the maximum distance from the baseline to the highest/upper grid
  8083. coordinate used to place a glyph outline point, for all the rendered
  8084. glyphs.
  8085. It is a positive value, due to the grid's orientation with the Y axis
  8086. upwards.
  8087. @item max_glyph_d, descent
  8088. the maximum distance from the baseline to the lowest grid coordinate
  8089. used to place a glyph outline point, for all the rendered glyphs.
  8090. This is a negative value, due to the grid's orientation, with the Y axis
  8091. upwards.
  8092. @item max_glyph_h
  8093. maximum glyph height, that is the maximum height for all the glyphs
  8094. contained in the rendered text, it is equivalent to @var{ascent} -
  8095. @var{descent}.
  8096. @item max_glyph_w
  8097. maximum glyph width, that is the maximum width for all the glyphs
  8098. contained in the rendered text
  8099. @item n
  8100. the number of input frame, starting from 0
  8101. @item rand(min, max)
  8102. return a random number included between @var{min} and @var{max}
  8103. @item sar
  8104. The input sample aspect ratio.
  8105. @item t
  8106. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8107. @item text_h, th
  8108. the height of the rendered text
  8109. @item text_w, tw
  8110. the width of the rendered text
  8111. @item x
  8112. @item y
  8113. the x and y offset coordinates where the text is drawn.
  8114. These parameters allow the @var{x} and @var{y} expressions to refer
  8115. to each other, so you can for example specify @code{y=x/dar}.
  8116. @item pict_type
  8117. A one character description of the current frame's picture type.
  8118. @item pkt_pos
  8119. The current packet's position in the input file or stream
  8120. (in bytes, from the start of the input). A value of -1 indicates
  8121. this info is not available.
  8122. @item pkt_duration
  8123. The current packet's duration, in seconds.
  8124. @item pkt_size
  8125. The current packet's size (in bytes).
  8126. @end table
  8127. @anchor{drawtext_expansion}
  8128. @subsection Text expansion
  8129. If @option{expansion} is set to @code{strftime},
  8130. the filter recognizes strftime() sequences in the provided text and
  8131. expands them accordingly. Check the documentation of strftime(). This
  8132. feature is deprecated.
  8133. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8134. If @option{expansion} is set to @code{normal} (which is the default),
  8135. the following expansion mechanism is used.
  8136. The backslash character @samp{\}, followed by any character, always expands to
  8137. the second character.
  8138. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8139. braces is a function name, possibly followed by arguments separated by ':'.
  8140. If the arguments contain special characters or delimiters (':' or '@}'),
  8141. they should be escaped.
  8142. Note that they probably must also be escaped as the value for the
  8143. @option{text} option in the filter argument string and as the filter
  8144. argument in the filtergraph description, and possibly also for the shell,
  8145. that makes up to four levels of escaping; using a text file avoids these
  8146. problems.
  8147. The following functions are available:
  8148. @table @command
  8149. @item expr, e
  8150. The expression evaluation result.
  8151. It must take one argument specifying the expression to be evaluated,
  8152. which accepts the same constants and functions as the @var{x} and
  8153. @var{y} values. Note that not all constants should be used, for
  8154. example the text size is not known when evaluating the expression, so
  8155. the constants @var{text_w} and @var{text_h} will have an undefined
  8156. value.
  8157. @item expr_int_format, eif
  8158. Evaluate the expression's value and output as formatted integer.
  8159. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8160. The second argument specifies the output format. Allowed values are @samp{x},
  8161. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8162. @code{printf} function.
  8163. The third parameter is optional and sets the number of positions taken by the output.
  8164. It can be used to add padding with zeros from the left.
  8165. @item gmtime
  8166. The time at which the filter is running, expressed in UTC.
  8167. It can accept an argument: a strftime() format string.
  8168. @item localtime
  8169. The time at which the filter is running, expressed in the local time zone.
  8170. It can accept an argument: a strftime() format string.
  8171. @item metadata
  8172. Frame metadata. Takes one or two arguments.
  8173. The first argument is mandatory and specifies the metadata key.
  8174. The second argument is optional and specifies a default value, used when the
  8175. metadata key is not found or empty.
  8176. Available metadata can be identified by inspecting entries
  8177. starting with TAG included within each frame section
  8178. printed by running @code{ffprobe -show_frames}.
  8179. String metadata generated in filters leading to
  8180. the drawtext filter are also available.
  8181. @item n, frame_num
  8182. The frame number, starting from 0.
  8183. @item pict_type
  8184. A one character description of the current picture type.
  8185. @item pts
  8186. The timestamp of the current frame.
  8187. It can take up to three arguments.
  8188. The first argument is the format of the timestamp; it defaults to @code{flt}
  8189. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8190. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8191. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8192. @code{localtime} stands for the timestamp of the frame formatted as
  8193. local time zone time.
  8194. The second argument is an offset added to the timestamp.
  8195. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8196. supplied to present the hour part of the formatted timestamp in 24h format
  8197. (00-23).
  8198. If the format is set to @code{localtime} or @code{gmtime},
  8199. a third argument may be supplied: a strftime() format string.
  8200. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8201. @end table
  8202. @subsection Commands
  8203. This filter supports altering parameters via commands:
  8204. @table @option
  8205. @item reinit
  8206. Alter existing filter parameters.
  8207. Syntax for the argument is the same as for filter invocation, e.g.
  8208. @example
  8209. fontsize=56:fontcolor=green:text='Hello World'
  8210. @end example
  8211. Full filter invocation with sendcmd would look like this:
  8212. @example
  8213. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8214. @end example
  8215. @end table
  8216. If the entire argument can't be parsed or applied as valid values then the filter will
  8217. continue with its existing parameters.
  8218. @subsection Examples
  8219. @itemize
  8220. @item
  8221. Draw "Test Text" with font FreeSerif, using the default values for the
  8222. optional parameters.
  8223. @example
  8224. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8225. @end example
  8226. @item
  8227. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8228. and y=50 (counting from the top-left corner of the screen), text is
  8229. yellow with a red box around it. Both the text and the box have an
  8230. opacity of 20%.
  8231. @example
  8232. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8233. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8234. @end example
  8235. Note that the double quotes are not necessary if spaces are not used
  8236. within the parameter list.
  8237. @item
  8238. Show the text at the center of the video frame:
  8239. @example
  8240. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8241. @end example
  8242. @item
  8243. Show the text at a random position, switching to a new position every 30 seconds:
  8244. @example
  8245. 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)"
  8246. @end example
  8247. @item
  8248. Show a text line sliding from right to left in the last row of the video
  8249. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8250. with no newlines.
  8251. @example
  8252. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8253. @end example
  8254. @item
  8255. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8256. @example
  8257. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8258. @end example
  8259. @item
  8260. Draw a single green letter "g", at the center of the input video.
  8261. The glyph baseline is placed at half screen height.
  8262. @example
  8263. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8264. @end example
  8265. @item
  8266. Show text for 1 second every 3 seconds:
  8267. @example
  8268. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8269. @end example
  8270. @item
  8271. Use fontconfig to set the font. Note that the colons need to be escaped.
  8272. @example
  8273. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8274. @end example
  8275. @item
  8276. Draw "Test Text" with font size dependent on height of the video.
  8277. @example
  8278. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8279. @end example
  8280. @item
  8281. Print the date of a real-time encoding (see strftime(3)):
  8282. @example
  8283. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8284. @end example
  8285. @item
  8286. Show text fading in and out (appearing/disappearing):
  8287. @example
  8288. #!/bin/sh
  8289. DS=1.0 # display start
  8290. DE=10.0 # display end
  8291. FID=1.5 # fade in duration
  8292. FOD=5 # fade out duration
  8293. 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 @}"
  8294. @end example
  8295. @item
  8296. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8297. and the @option{fontsize} value are included in the @option{y} offset.
  8298. @example
  8299. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8300. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8301. @end example
  8302. @item
  8303. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8304. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8305. must have option @option{-export_path_metadata 1} for the special metadata fields
  8306. to be available for filters.
  8307. @example
  8308. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8309. @end example
  8310. @end itemize
  8311. For more information about libfreetype, check:
  8312. @url{http://www.freetype.org/}.
  8313. For more information about fontconfig, check:
  8314. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8315. For more information about libfribidi, check:
  8316. @url{http://fribidi.org/}.
  8317. @section edgedetect
  8318. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8319. The filter accepts the following options:
  8320. @table @option
  8321. @item low
  8322. @item high
  8323. Set low and high threshold values used by the Canny thresholding
  8324. algorithm.
  8325. The high threshold selects the "strong" edge pixels, which are then
  8326. connected through 8-connectivity with the "weak" edge pixels selected
  8327. by the low threshold.
  8328. @var{low} and @var{high} threshold values must be chosen in the range
  8329. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8330. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8331. is @code{50/255}.
  8332. @item mode
  8333. Define the drawing mode.
  8334. @table @samp
  8335. @item wires
  8336. Draw white/gray wires on black background.
  8337. @item colormix
  8338. Mix the colors to create a paint/cartoon effect.
  8339. @item canny
  8340. Apply Canny edge detector on all selected planes.
  8341. @end table
  8342. Default value is @var{wires}.
  8343. @item planes
  8344. Select planes for filtering. By default all available planes are filtered.
  8345. @end table
  8346. @subsection Examples
  8347. @itemize
  8348. @item
  8349. Standard edge detection with custom values for the hysteresis thresholding:
  8350. @example
  8351. edgedetect=low=0.1:high=0.4
  8352. @end example
  8353. @item
  8354. Painting effect without thresholding:
  8355. @example
  8356. edgedetect=mode=colormix:high=0
  8357. @end example
  8358. @end itemize
  8359. @section elbg
  8360. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8361. For each input image, the filter will compute the optimal mapping from
  8362. the input to the output given the codebook length, that is the number
  8363. of distinct output colors.
  8364. This filter accepts the following options.
  8365. @table @option
  8366. @item codebook_length, l
  8367. Set codebook length. The value must be a positive integer, and
  8368. represents the number of distinct output colors. Default value is 256.
  8369. @item nb_steps, n
  8370. Set the maximum number of iterations to apply for computing the optimal
  8371. mapping. The higher the value the better the result and the higher the
  8372. computation time. Default value is 1.
  8373. @item seed, s
  8374. Set a random seed, must be an integer included between 0 and
  8375. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8376. will try to use a good random seed on a best effort basis.
  8377. @item pal8
  8378. Set pal8 output pixel format. This option does not work with codebook
  8379. length greater than 256.
  8380. @end table
  8381. @section entropy
  8382. Measure graylevel entropy in histogram of color channels of video frames.
  8383. It accepts the following parameters:
  8384. @table @option
  8385. @item mode
  8386. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8387. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8388. between neighbour histogram values.
  8389. @end table
  8390. @section epx
  8391. Apply the EPX magnification filter which is designed for pixel art.
  8392. It accepts the following option:
  8393. @table @option
  8394. @item n
  8395. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  8396. @code{3xEPX}.
  8397. Default is @code{3}.
  8398. @end table
  8399. @section eq
  8400. Set brightness, contrast, saturation and approximate gamma adjustment.
  8401. The filter accepts the following options:
  8402. @table @option
  8403. @item contrast
  8404. Set the contrast expression. The value must be a float value in range
  8405. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8406. @item brightness
  8407. Set the brightness expression. The value must be a float value in
  8408. range @code{-1.0} to @code{1.0}. The default value is "0".
  8409. @item saturation
  8410. Set the saturation expression. The value must be a float in
  8411. range @code{0.0} to @code{3.0}. The default value is "1".
  8412. @item gamma
  8413. Set the gamma expression. The value must be a float in range
  8414. @code{0.1} to @code{10.0}. The default value is "1".
  8415. @item gamma_r
  8416. Set the gamma expression for red. The value must be a float in
  8417. range @code{0.1} to @code{10.0}. The default value is "1".
  8418. @item gamma_g
  8419. Set the gamma expression for green. The value must be a float in range
  8420. @code{0.1} to @code{10.0}. The default value is "1".
  8421. @item gamma_b
  8422. Set the gamma expression for blue. The value must be a float in range
  8423. @code{0.1} to @code{10.0}. The default value is "1".
  8424. @item gamma_weight
  8425. Set the gamma weight expression. It can be used to reduce the effect
  8426. of a high gamma value on bright image areas, e.g. keep them from
  8427. getting overamplified and just plain white. The value must be a float
  8428. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8429. gamma correction all the way down while @code{1.0} leaves it at its
  8430. full strength. Default is "1".
  8431. @item eval
  8432. Set when the expressions for brightness, contrast, saturation and
  8433. gamma expressions are evaluated.
  8434. It accepts the following values:
  8435. @table @samp
  8436. @item init
  8437. only evaluate expressions once during the filter initialization or
  8438. when a command is processed
  8439. @item frame
  8440. evaluate expressions for each incoming frame
  8441. @end table
  8442. Default value is @samp{init}.
  8443. @end table
  8444. The expressions accept the following parameters:
  8445. @table @option
  8446. @item n
  8447. frame count of the input frame starting from 0
  8448. @item pos
  8449. byte position of the corresponding packet in the input file, NAN if
  8450. unspecified
  8451. @item r
  8452. frame rate of the input video, NAN if the input frame rate is unknown
  8453. @item t
  8454. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8455. @end table
  8456. @subsection Commands
  8457. The filter supports the following commands:
  8458. @table @option
  8459. @item contrast
  8460. Set the contrast expression.
  8461. @item brightness
  8462. Set the brightness expression.
  8463. @item saturation
  8464. Set the saturation expression.
  8465. @item gamma
  8466. Set the gamma expression.
  8467. @item gamma_r
  8468. Set the gamma_r expression.
  8469. @item gamma_g
  8470. Set gamma_g expression.
  8471. @item gamma_b
  8472. Set gamma_b expression.
  8473. @item gamma_weight
  8474. Set gamma_weight expression.
  8475. The command accepts the same syntax of the corresponding option.
  8476. If the specified expression is not valid, it is kept at its current
  8477. value.
  8478. @end table
  8479. @section erosion
  8480. Apply erosion effect to the video.
  8481. This filter replaces the pixel by the local(3x3) minimum.
  8482. It accepts the following options:
  8483. @table @option
  8484. @item threshold0
  8485. @item threshold1
  8486. @item threshold2
  8487. @item threshold3
  8488. Limit the maximum change for each plane, default is 65535.
  8489. If 0, plane will remain unchanged.
  8490. @item coordinates
  8491. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8492. pixels are used.
  8493. Flags to local 3x3 coordinates maps like this:
  8494. 1 2 3
  8495. 4 5
  8496. 6 7 8
  8497. @end table
  8498. @subsection Commands
  8499. This filter supports the all above options as @ref{commands}.
  8500. @section estdif
  8501. Deinterlace the input video ("estdif" stands for "Edge Slope
  8502. Tracing Deinterlacing Filter").
  8503. Spatial only filter that uses edge slope tracing algorithm
  8504. to interpolate missing lines.
  8505. It accepts the following parameters:
  8506. @table @option
  8507. @item mode
  8508. The interlacing mode to adopt. It accepts one of the following values:
  8509. @table @option
  8510. @item frame
  8511. Output one frame for each frame.
  8512. @item field
  8513. Output one frame for each field.
  8514. @end table
  8515. The default value is @code{field}.
  8516. @item parity
  8517. The picture field parity assumed for the input interlaced video. It accepts one
  8518. of the following values:
  8519. @table @option
  8520. @item tff
  8521. Assume the top field is first.
  8522. @item bff
  8523. Assume the bottom field is first.
  8524. @item auto
  8525. Enable automatic detection of field parity.
  8526. @end table
  8527. The default value is @code{auto}.
  8528. If the interlacing is unknown or the decoder does not export this information,
  8529. top field first will be assumed.
  8530. @item deint
  8531. Specify which frames to deinterlace. Accepts one of the following
  8532. values:
  8533. @table @option
  8534. @item all
  8535. Deinterlace all frames.
  8536. @item interlaced
  8537. Only deinterlace frames marked as interlaced.
  8538. @end table
  8539. The default value is @code{all}.
  8540. @item rslope
  8541. Specify the search radius for edge slope tracing. Default value is 1.
  8542. Allowed range is from 1 to 15.
  8543. @item redge
  8544. Specify the search radius for best edge matching. Default value is 2.
  8545. Allowed range is from 0 to 15.
  8546. @item interp
  8547. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  8548. of the following values:
  8549. @table @option
  8550. @item 2p
  8551. Two-point interpolation.
  8552. @item 4p
  8553. Four-point interpolation.
  8554. @item 6p
  8555. Six-point interpolation.
  8556. @end table
  8557. @end table
  8558. @subsection Commands
  8559. This filter supports same @ref{commands} as options.
  8560. @section extractplanes
  8561. Extract color channel components from input video stream into
  8562. separate grayscale video streams.
  8563. The filter accepts the following option:
  8564. @table @option
  8565. @item planes
  8566. Set plane(s) to extract.
  8567. Available values for planes are:
  8568. @table @samp
  8569. @item y
  8570. @item u
  8571. @item v
  8572. @item a
  8573. @item r
  8574. @item g
  8575. @item b
  8576. @end table
  8577. Choosing planes not available in the input will result in an error.
  8578. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8579. with @code{y}, @code{u}, @code{v} planes at same time.
  8580. @end table
  8581. @subsection Examples
  8582. @itemize
  8583. @item
  8584. Extract luma, u and v color channel component from input video frame
  8585. into 3 grayscale outputs:
  8586. @example
  8587. 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
  8588. @end example
  8589. @end itemize
  8590. @section fade
  8591. Apply a fade-in/out effect to the input video.
  8592. It accepts the following parameters:
  8593. @table @option
  8594. @item type, t
  8595. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8596. effect.
  8597. Default is @code{in}.
  8598. @item start_frame, s
  8599. Specify the number of the frame to start applying the fade
  8600. effect at. Default is 0.
  8601. @item nb_frames, n
  8602. The number of frames that the fade effect lasts. At the end of the
  8603. fade-in effect, the output video will have the same intensity as the input video.
  8604. At the end of the fade-out transition, the output video will be filled with the
  8605. selected @option{color}.
  8606. Default is 25.
  8607. @item alpha
  8608. If set to 1, fade only alpha channel, if one exists on the input.
  8609. Default value is 0.
  8610. @item start_time, st
  8611. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8612. effect. If both start_frame and start_time are specified, the fade will start at
  8613. whichever comes last. Default is 0.
  8614. @item duration, d
  8615. The number of seconds for which the fade effect has to last. At the end of the
  8616. fade-in effect the output video will have the same intensity as the input video,
  8617. at the end of the fade-out transition the output video will be filled with the
  8618. selected @option{color}.
  8619. If both duration and nb_frames are specified, duration is used. Default is 0
  8620. (nb_frames is used by default).
  8621. @item color, c
  8622. Specify the color of the fade. Default is "black".
  8623. @end table
  8624. @subsection Examples
  8625. @itemize
  8626. @item
  8627. Fade in the first 30 frames of video:
  8628. @example
  8629. fade=in:0:30
  8630. @end example
  8631. The command above is equivalent to:
  8632. @example
  8633. fade=t=in:s=0:n=30
  8634. @end example
  8635. @item
  8636. Fade out the last 45 frames of a 200-frame video:
  8637. @example
  8638. fade=out:155:45
  8639. fade=type=out:start_frame=155:nb_frames=45
  8640. @end example
  8641. @item
  8642. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8643. @example
  8644. fade=in:0:25, fade=out:975:25
  8645. @end example
  8646. @item
  8647. Make the first 5 frames yellow, then fade in from frame 5-24:
  8648. @example
  8649. fade=in:5:20:color=yellow
  8650. @end example
  8651. @item
  8652. Fade in alpha over first 25 frames of video:
  8653. @example
  8654. fade=in:0:25:alpha=1
  8655. @end example
  8656. @item
  8657. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8658. @example
  8659. fade=t=in:st=5.5:d=0.5
  8660. @end example
  8661. @end itemize
  8662. @section fftdnoiz
  8663. Denoise frames using 3D FFT (frequency domain filtering).
  8664. The filter accepts the following options:
  8665. @table @option
  8666. @item sigma
  8667. Set the noise sigma constant. This sets denoising strength.
  8668. Default value is 1. Allowed range is from 0 to 30.
  8669. Using very high sigma with low overlap may give blocking artifacts.
  8670. @item amount
  8671. Set amount of denoising. By default all detected noise is reduced.
  8672. Default value is 1. Allowed range is from 0 to 1.
  8673. @item block
  8674. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8675. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8676. block size in pixels is 2^4 which is 16.
  8677. @item overlap
  8678. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8679. @item prev
  8680. Set number of previous frames to use for denoising. By default is set to 0.
  8681. @item next
  8682. Set number of next frames to to use for denoising. By default is set to 0.
  8683. @item planes
  8684. Set planes which will be filtered, by default are all available filtered
  8685. except alpha.
  8686. @end table
  8687. @section fftfilt
  8688. Apply arbitrary expressions to samples in frequency domain
  8689. @table @option
  8690. @item dc_Y
  8691. Adjust the dc value (gain) of the luma plane of the image. The filter
  8692. accepts an integer value in range @code{0} to @code{1000}. The default
  8693. value is set to @code{0}.
  8694. @item dc_U
  8695. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8696. filter accepts an integer value in range @code{0} to @code{1000}. The
  8697. default value is set to @code{0}.
  8698. @item dc_V
  8699. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8700. filter accepts an integer value in range @code{0} to @code{1000}. The
  8701. default value is set to @code{0}.
  8702. @item weight_Y
  8703. Set the frequency domain weight expression for the luma plane.
  8704. @item weight_U
  8705. Set the frequency domain weight expression for the 1st chroma plane.
  8706. @item weight_V
  8707. Set the frequency domain weight expression for the 2nd chroma plane.
  8708. @item eval
  8709. Set when the expressions are evaluated.
  8710. It accepts the following values:
  8711. @table @samp
  8712. @item init
  8713. Only evaluate expressions once during the filter initialization.
  8714. @item frame
  8715. Evaluate expressions for each incoming frame.
  8716. @end table
  8717. Default value is @samp{init}.
  8718. The filter accepts the following variables:
  8719. @item X
  8720. @item Y
  8721. The coordinates of the current sample.
  8722. @item W
  8723. @item H
  8724. The width and height of the image.
  8725. @item N
  8726. The number of input frame, starting from 0.
  8727. @end table
  8728. @subsection Examples
  8729. @itemize
  8730. @item
  8731. High-pass:
  8732. @example
  8733. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8734. @end example
  8735. @item
  8736. Low-pass:
  8737. @example
  8738. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8739. @end example
  8740. @item
  8741. Sharpen:
  8742. @example
  8743. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8744. @end example
  8745. @item
  8746. Blur:
  8747. @example
  8748. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8749. @end example
  8750. @end itemize
  8751. @section field
  8752. Extract a single field from an interlaced image using stride
  8753. arithmetic to avoid wasting CPU time. The output frames are marked as
  8754. non-interlaced.
  8755. The filter accepts the following options:
  8756. @table @option
  8757. @item type
  8758. Specify whether to extract the top (if the value is @code{0} or
  8759. @code{top}) or the bottom field (if the value is @code{1} or
  8760. @code{bottom}).
  8761. @end table
  8762. @section fieldhint
  8763. Create new frames by copying the top and bottom fields from surrounding frames
  8764. supplied as numbers by the hint file.
  8765. @table @option
  8766. @item hint
  8767. Set file containing hints: absolute/relative frame numbers.
  8768. There must be one line for each frame in a clip. Each line must contain two
  8769. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8770. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8771. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8772. for @code{relative} mode. First number tells from which frame to pick up top
  8773. field and second number tells from which frame to pick up bottom field.
  8774. If optionally followed by @code{+} output frame will be marked as interlaced,
  8775. else if followed by @code{-} output frame will be marked as progressive, else
  8776. it will be marked same as input frame.
  8777. If optionally followed by @code{t} output frame will use only top field, or in
  8778. case of @code{b} it will use only bottom field.
  8779. If line starts with @code{#} or @code{;} that line is skipped.
  8780. @item mode
  8781. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8782. @end table
  8783. Example of first several lines of @code{hint} file for @code{relative} mode:
  8784. @example
  8785. 0,0 - # first frame
  8786. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8787. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8788. 1,0 -
  8789. 0,0 -
  8790. 0,0 -
  8791. 1,0 -
  8792. 1,0 -
  8793. 1,0 -
  8794. 0,0 -
  8795. 0,0 -
  8796. 1,0 -
  8797. 1,0 -
  8798. 1,0 -
  8799. 0,0 -
  8800. @end example
  8801. @section fieldmatch
  8802. Field matching filter for inverse telecine. It is meant to reconstruct the
  8803. progressive frames from a telecined stream. The filter does not drop duplicated
  8804. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8805. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8806. The separation of the field matching and the decimation is notably motivated by
  8807. the possibility of inserting a de-interlacing filter fallback between the two.
  8808. If the source has mixed telecined and real interlaced content,
  8809. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8810. But these remaining combed frames will be marked as interlaced, and thus can be
  8811. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8812. In addition to the various configuration options, @code{fieldmatch} can take an
  8813. optional second stream, activated through the @option{ppsrc} option. If
  8814. enabled, the frames reconstruction will be based on the fields and frames from
  8815. this second stream. This allows the first input to be pre-processed in order to
  8816. help the various algorithms of the filter, while keeping the output lossless
  8817. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8818. or brightness/contrast adjustments can help.
  8819. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8820. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8821. which @code{fieldmatch} is based on. While the semantic and usage are very
  8822. close, some behaviour and options names can differ.
  8823. The @ref{decimate} filter currently only works for constant frame rate input.
  8824. If your input has mixed telecined (30fps) and progressive content with a lower
  8825. framerate like 24fps use the following filterchain to produce the necessary cfr
  8826. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8827. The filter accepts the following options:
  8828. @table @option
  8829. @item order
  8830. Specify the assumed field order of the input stream. Available values are:
  8831. @table @samp
  8832. @item auto
  8833. Auto detect parity (use FFmpeg's internal parity value).
  8834. @item bff
  8835. Assume bottom field first.
  8836. @item tff
  8837. Assume top field first.
  8838. @end table
  8839. Note that it is sometimes recommended not to trust the parity announced by the
  8840. stream.
  8841. Default value is @var{auto}.
  8842. @item mode
  8843. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8844. sense that it won't risk creating jerkiness due to duplicate frames when
  8845. possible, but if there are bad edits or blended fields it will end up
  8846. outputting combed frames when a good match might actually exist. On the other
  8847. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8848. but will almost always find a good frame if there is one. The other values are
  8849. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8850. jerkiness and creating duplicate frames versus finding good matches in sections
  8851. with bad edits, orphaned fields, blended fields, etc.
  8852. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8853. Available values are:
  8854. @table @samp
  8855. @item pc
  8856. 2-way matching (p/c)
  8857. @item pc_n
  8858. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8859. @item pc_u
  8860. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8861. @item pc_n_ub
  8862. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8863. still combed (p/c + n + u/b)
  8864. @item pcn
  8865. 3-way matching (p/c/n)
  8866. @item pcn_ub
  8867. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8868. detected as combed (p/c/n + u/b)
  8869. @end table
  8870. The parenthesis at the end indicate the matches that would be used for that
  8871. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8872. @var{top}).
  8873. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8874. the slowest.
  8875. Default value is @var{pc_n}.
  8876. @item ppsrc
  8877. Mark the main input stream as a pre-processed input, and enable the secondary
  8878. input stream as the clean source to pick the fields from. See the filter
  8879. introduction for more details. It is similar to the @option{clip2} feature from
  8880. VFM/TFM.
  8881. Default value is @code{0} (disabled).
  8882. @item field
  8883. Set the field to match from. It is recommended to set this to the same value as
  8884. @option{order} unless you experience matching failures with that setting. In
  8885. certain circumstances changing the field that is used to match from can have a
  8886. large impact on matching performance. Available values are:
  8887. @table @samp
  8888. @item auto
  8889. Automatic (same value as @option{order}).
  8890. @item bottom
  8891. Match from the bottom field.
  8892. @item top
  8893. Match from the top field.
  8894. @end table
  8895. Default value is @var{auto}.
  8896. @item mchroma
  8897. Set whether or not chroma is included during the match comparisons. In most
  8898. cases it is recommended to leave this enabled. You should set this to @code{0}
  8899. only if your clip has bad chroma problems such as heavy rainbowing or other
  8900. artifacts. Setting this to @code{0} could also be used to speed things up at
  8901. the cost of some accuracy.
  8902. Default value is @code{1}.
  8903. @item y0
  8904. @item y1
  8905. These define an exclusion band which excludes the lines between @option{y0} and
  8906. @option{y1} from being included in the field matching decision. An exclusion
  8907. band can be used to ignore subtitles, a logo, or other things that may
  8908. interfere with the matching. @option{y0} sets the starting scan line and
  8909. @option{y1} sets the ending line; all lines in between @option{y0} and
  8910. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8911. @option{y0} and @option{y1} to the same value will disable the feature.
  8912. @option{y0} and @option{y1} defaults to @code{0}.
  8913. @item scthresh
  8914. Set the scene change detection threshold as a percentage of maximum change on
  8915. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8916. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8917. @option{scthresh} is @code{[0.0, 100.0]}.
  8918. Default value is @code{12.0}.
  8919. @item combmatch
  8920. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8921. account the combed scores of matches when deciding what match to use as the
  8922. final match. Available values are:
  8923. @table @samp
  8924. @item none
  8925. No final matching based on combed scores.
  8926. @item sc
  8927. Combed scores are only used when a scene change is detected.
  8928. @item full
  8929. Use combed scores all the time.
  8930. @end table
  8931. Default is @var{sc}.
  8932. @item combdbg
  8933. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8934. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8935. Available values are:
  8936. @table @samp
  8937. @item none
  8938. No forced calculation.
  8939. @item pcn
  8940. Force p/c/n calculations.
  8941. @item pcnub
  8942. Force p/c/n/u/b calculations.
  8943. @end table
  8944. Default value is @var{none}.
  8945. @item cthresh
  8946. This is the area combing threshold used for combed frame detection. This
  8947. essentially controls how "strong" or "visible" combing must be to be detected.
  8948. Larger values mean combing must be more visible and smaller values mean combing
  8949. can be less visible or strong and still be detected. Valid settings are from
  8950. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8951. be detected as combed). This is basically a pixel difference value. A good
  8952. range is @code{[8, 12]}.
  8953. Default value is @code{9}.
  8954. @item chroma
  8955. Sets whether or not chroma is considered in the combed frame decision. Only
  8956. disable this if your source has chroma problems (rainbowing, etc.) that are
  8957. causing problems for the combed frame detection with chroma enabled. Actually,
  8958. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8959. where there is chroma only combing in the source.
  8960. Default value is @code{0}.
  8961. @item blockx
  8962. @item blocky
  8963. Respectively set the x-axis and y-axis size of the window used during combed
  8964. frame detection. This has to do with the size of the area in which
  8965. @option{combpel} pixels are required to be detected as combed for a frame to be
  8966. declared combed. See the @option{combpel} parameter description for more info.
  8967. Possible values are any number that is a power of 2 starting at 4 and going up
  8968. to 512.
  8969. Default value is @code{16}.
  8970. @item combpel
  8971. The number of combed pixels inside any of the @option{blocky} by
  8972. @option{blockx} size blocks on the frame for the frame to be detected as
  8973. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8974. setting controls "how much" combing there must be in any localized area (a
  8975. window defined by the @option{blockx} and @option{blocky} settings) on the
  8976. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8977. which point no frames will ever be detected as combed). This setting is known
  8978. as @option{MI} in TFM/VFM vocabulary.
  8979. Default value is @code{80}.
  8980. @end table
  8981. @anchor{p/c/n/u/b meaning}
  8982. @subsection p/c/n/u/b meaning
  8983. @subsubsection p/c/n
  8984. We assume the following telecined stream:
  8985. @example
  8986. Top fields: 1 2 2 3 4
  8987. Bottom fields: 1 2 3 4 4
  8988. @end example
  8989. The numbers correspond to the progressive frame the fields relate to. Here, the
  8990. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8991. When @code{fieldmatch} is configured to run a matching from bottom
  8992. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8993. @example
  8994. Input stream:
  8995. T 1 2 2 3 4
  8996. B 1 2 3 4 4 <-- matching reference
  8997. Matches: c c n n c
  8998. Output stream:
  8999. T 1 2 3 4 4
  9000. B 1 2 3 4 4
  9001. @end example
  9002. As a result of the field matching, we can see that some frames get duplicated.
  9003. To perform a complete inverse telecine, you need to rely on a decimation filter
  9004. after this operation. See for instance the @ref{decimate} filter.
  9005. The same operation now matching from top fields (@option{field}=@var{top})
  9006. looks like this:
  9007. @example
  9008. Input stream:
  9009. T 1 2 2 3 4 <-- matching reference
  9010. B 1 2 3 4 4
  9011. Matches: c c p p c
  9012. Output stream:
  9013. T 1 2 2 3 4
  9014. B 1 2 2 3 4
  9015. @end example
  9016. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9017. basically, they refer to the frame and field of the opposite parity:
  9018. @itemize
  9019. @item @var{p} matches the field of the opposite parity in the previous frame
  9020. @item @var{c} matches the field of the opposite parity in the current frame
  9021. @item @var{n} matches the field of the opposite parity in the next frame
  9022. @end itemize
  9023. @subsubsection u/b
  9024. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9025. from the opposite parity flag. In the following examples, we assume that we are
  9026. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9027. 'x' is placed above and below each matched fields.
  9028. With bottom matching (@option{field}=@var{bottom}):
  9029. @example
  9030. Match: c p n b u
  9031. x x x x x
  9032. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9033. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9034. x x x x x
  9035. Output frames:
  9036. 2 1 2 2 2
  9037. 2 2 2 1 3
  9038. @end example
  9039. With top matching (@option{field}=@var{top}):
  9040. @example
  9041. Match: c p n b u
  9042. x x x x x
  9043. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9044. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9045. x x x x x
  9046. Output frames:
  9047. 2 2 2 1 2
  9048. 2 1 3 2 2
  9049. @end example
  9050. @subsection Examples
  9051. Simple IVTC of a top field first telecined stream:
  9052. @example
  9053. fieldmatch=order=tff:combmatch=none, decimate
  9054. @end example
  9055. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9056. @example
  9057. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9058. @end example
  9059. @section fieldorder
  9060. Transform the field order of the input video.
  9061. It accepts the following parameters:
  9062. @table @option
  9063. @item order
  9064. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9065. for bottom field first.
  9066. @end table
  9067. The default value is @samp{tff}.
  9068. The transformation is done by shifting the picture content up or down
  9069. by one line, and filling the remaining line with appropriate picture content.
  9070. This method is consistent with most broadcast field order converters.
  9071. If the input video is not flagged as being interlaced, or it is already
  9072. flagged as being of the required output field order, then this filter does
  9073. not alter the incoming video.
  9074. It is very useful when converting to or from PAL DV material,
  9075. which is bottom field first.
  9076. For example:
  9077. @example
  9078. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9079. @end example
  9080. @section fifo, afifo
  9081. Buffer input images and send them when they are requested.
  9082. It is mainly useful when auto-inserted by the libavfilter
  9083. framework.
  9084. It does not take parameters.
  9085. @section fillborders
  9086. Fill borders of the input video, without changing video stream dimensions.
  9087. Sometimes video can have garbage at the four edges and you may not want to
  9088. crop video input to keep size multiple of some number.
  9089. This filter accepts the following options:
  9090. @table @option
  9091. @item left
  9092. Number of pixels to fill from left border.
  9093. @item right
  9094. Number of pixels to fill from right border.
  9095. @item top
  9096. Number of pixels to fill from top border.
  9097. @item bottom
  9098. Number of pixels to fill from bottom border.
  9099. @item mode
  9100. Set fill mode.
  9101. It accepts the following values:
  9102. @table @samp
  9103. @item smear
  9104. fill pixels using outermost pixels
  9105. @item mirror
  9106. fill pixels using mirroring (half sample symmetric)
  9107. @item fixed
  9108. fill pixels with constant value
  9109. @item reflect
  9110. fill pixels using reflecting (whole sample symmetric)
  9111. @item wrap
  9112. fill pixels using wrapping
  9113. @item fade
  9114. fade pixels to constant value
  9115. @end table
  9116. Default is @var{smear}.
  9117. @item color
  9118. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9119. @end table
  9120. @subsection Commands
  9121. This filter supports same @ref{commands} as options.
  9122. The command accepts the same syntax of the corresponding option.
  9123. If the specified expression is not valid, it is kept at its current
  9124. value.
  9125. @section find_rect
  9126. Find a rectangular object
  9127. It accepts the following options:
  9128. @table @option
  9129. @item object
  9130. Filepath of the object image, needs to be in gray8.
  9131. @item threshold
  9132. Detection threshold, default is 0.5.
  9133. @item mipmaps
  9134. Number of mipmaps, default is 3.
  9135. @item xmin, ymin, xmax, ymax
  9136. Specifies the rectangle in which to search.
  9137. @end table
  9138. @subsection Examples
  9139. @itemize
  9140. @item
  9141. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9142. @example
  9143. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9144. @end example
  9145. @end itemize
  9146. @section floodfill
  9147. Flood area with values of same pixel components with another values.
  9148. It accepts the following options:
  9149. @table @option
  9150. @item x
  9151. Set pixel x coordinate.
  9152. @item y
  9153. Set pixel y coordinate.
  9154. @item s0
  9155. Set source #0 component value.
  9156. @item s1
  9157. Set source #1 component value.
  9158. @item s2
  9159. Set source #2 component value.
  9160. @item s3
  9161. Set source #3 component value.
  9162. @item d0
  9163. Set destination #0 component value.
  9164. @item d1
  9165. Set destination #1 component value.
  9166. @item d2
  9167. Set destination #2 component value.
  9168. @item d3
  9169. Set destination #3 component value.
  9170. @end table
  9171. @anchor{format}
  9172. @section format
  9173. Convert the input video to one of the specified pixel formats.
  9174. Libavfilter will try to pick one that is suitable as input to
  9175. the next filter.
  9176. It accepts the following parameters:
  9177. @table @option
  9178. @item pix_fmts
  9179. A '|'-separated list of pixel format names, such as
  9180. "pix_fmts=yuv420p|monow|rgb24".
  9181. @end table
  9182. @subsection Examples
  9183. @itemize
  9184. @item
  9185. Convert the input video to the @var{yuv420p} format
  9186. @example
  9187. format=pix_fmts=yuv420p
  9188. @end example
  9189. Convert the input video to any of the formats in the list
  9190. @example
  9191. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9192. @end example
  9193. @end itemize
  9194. @anchor{fps}
  9195. @section fps
  9196. Convert the video to specified constant frame rate by duplicating or dropping
  9197. frames as necessary.
  9198. It accepts the following parameters:
  9199. @table @option
  9200. @item fps
  9201. The desired output frame rate. The default is @code{25}.
  9202. @item start_time
  9203. Assume the first PTS should be the given value, in seconds. This allows for
  9204. padding/trimming at the start of stream. By default, no assumption is made
  9205. about the first frame's expected PTS, so no padding or trimming is done.
  9206. For example, this could be set to 0 to pad the beginning with duplicates of
  9207. the first frame if a video stream starts after the audio stream or to trim any
  9208. frames with a negative PTS.
  9209. @item round
  9210. Timestamp (PTS) rounding method.
  9211. Possible values are:
  9212. @table @option
  9213. @item zero
  9214. round towards 0
  9215. @item inf
  9216. round away from 0
  9217. @item down
  9218. round towards -infinity
  9219. @item up
  9220. round towards +infinity
  9221. @item near
  9222. round to nearest
  9223. @end table
  9224. The default is @code{near}.
  9225. @item eof_action
  9226. Action performed when reading the last frame.
  9227. Possible values are:
  9228. @table @option
  9229. @item round
  9230. Use same timestamp rounding method as used for other frames.
  9231. @item pass
  9232. Pass through last frame if input duration has not been reached yet.
  9233. @end table
  9234. The default is @code{round}.
  9235. @end table
  9236. Alternatively, the options can be specified as a flat string:
  9237. @var{fps}[:@var{start_time}[:@var{round}]].
  9238. See also the @ref{setpts} filter.
  9239. @subsection Examples
  9240. @itemize
  9241. @item
  9242. A typical usage in order to set the fps to 25:
  9243. @example
  9244. fps=fps=25
  9245. @end example
  9246. @item
  9247. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9248. @example
  9249. fps=fps=film:round=near
  9250. @end example
  9251. @end itemize
  9252. @section framepack
  9253. Pack two different video streams into a stereoscopic video, setting proper
  9254. metadata on supported codecs. The two views should have the same size and
  9255. framerate and processing will stop when the shorter video ends. Please note
  9256. that you may conveniently adjust view properties with the @ref{scale} and
  9257. @ref{fps} filters.
  9258. It accepts the following parameters:
  9259. @table @option
  9260. @item format
  9261. The desired packing format. Supported values are:
  9262. @table @option
  9263. @item sbs
  9264. The views are next to each other (default).
  9265. @item tab
  9266. The views are on top of each other.
  9267. @item lines
  9268. The views are packed by line.
  9269. @item columns
  9270. The views are packed by column.
  9271. @item frameseq
  9272. The views are temporally interleaved.
  9273. @end table
  9274. @end table
  9275. Some examples:
  9276. @example
  9277. # Convert left and right views into a frame-sequential video
  9278. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9279. # Convert views into a side-by-side video with the same output resolution as the input
  9280. 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
  9281. @end example
  9282. @section framerate
  9283. Change the frame rate by interpolating new video output frames from the source
  9284. frames.
  9285. This filter is not designed to function correctly with interlaced media. If
  9286. you wish to change the frame rate of interlaced media then you are required
  9287. to deinterlace before this filter and re-interlace after this filter.
  9288. A description of the accepted options follows.
  9289. @table @option
  9290. @item fps
  9291. Specify the output frames per second. This option can also be specified
  9292. as a value alone. The default is @code{50}.
  9293. @item interp_start
  9294. Specify the start of a range where the output frame will be created as a
  9295. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9296. the default is @code{15}.
  9297. @item interp_end
  9298. Specify the end of a range where the output frame will be created as a
  9299. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9300. the default is @code{240}.
  9301. @item scene
  9302. Specify the level at which a scene change is detected as a value between
  9303. 0 and 100 to indicate a new scene; a low value reflects a low
  9304. probability for the current frame to introduce a new scene, while a higher
  9305. value means the current frame is more likely to be one.
  9306. The default is @code{8.2}.
  9307. @item flags
  9308. Specify flags influencing the filter process.
  9309. Available value for @var{flags} is:
  9310. @table @option
  9311. @item scene_change_detect, scd
  9312. Enable scene change detection using the value of the option @var{scene}.
  9313. This flag is enabled by default.
  9314. @end table
  9315. @end table
  9316. @section framestep
  9317. Select one frame every N-th frame.
  9318. This filter accepts the following option:
  9319. @table @option
  9320. @item step
  9321. Select frame after every @code{step} frames.
  9322. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9323. @end table
  9324. @section freezedetect
  9325. Detect frozen video.
  9326. This filter logs a message and sets frame metadata when it detects that the
  9327. input video has no significant change in content during a specified duration.
  9328. Video freeze detection calculates the mean average absolute difference of all
  9329. the components of video frames and compares it to a noise floor.
  9330. The printed times and duration are expressed in seconds. The
  9331. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9332. whose timestamp equals or exceeds the detection duration and it contains the
  9333. timestamp of the first frame of the freeze. The
  9334. @code{lavfi.freezedetect.freeze_duration} and
  9335. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9336. after the freeze.
  9337. The filter accepts the following options:
  9338. @table @option
  9339. @item noise, n
  9340. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9341. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9342. 0.001.
  9343. @item duration, d
  9344. Set freeze duration until notification (default is 2 seconds).
  9345. @end table
  9346. @section freezeframes
  9347. Freeze video frames.
  9348. This filter freezes video frames using frame from 2nd input.
  9349. The filter accepts the following options:
  9350. @table @option
  9351. @item first
  9352. Set number of first frame from which to start freeze.
  9353. @item last
  9354. Set number of last frame from which to end freeze.
  9355. @item replace
  9356. Set number of frame from 2nd input which will be used instead of replaced frames.
  9357. @end table
  9358. @anchor{frei0r}
  9359. @section frei0r
  9360. Apply a frei0r effect to the input video.
  9361. To enable the compilation of this filter, you need to install the frei0r
  9362. header and configure FFmpeg with @code{--enable-frei0r}.
  9363. It accepts the following parameters:
  9364. @table @option
  9365. @item filter_name
  9366. The name of the frei0r effect to load. If the environment variable
  9367. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9368. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9369. Otherwise, the standard frei0r paths are searched, in this order:
  9370. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9371. @file{/usr/lib/frei0r-1/}.
  9372. @item filter_params
  9373. A '|'-separated list of parameters to pass to the frei0r effect.
  9374. @end table
  9375. A frei0r effect parameter can be a boolean (its value is either
  9376. "y" or "n"), a double, a color (specified as
  9377. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9378. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9379. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9380. a position (specified as @var{X}/@var{Y}, where
  9381. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9382. The number and types of parameters depend on the loaded effect. If an
  9383. effect parameter is not specified, the default value is set.
  9384. @subsection Examples
  9385. @itemize
  9386. @item
  9387. Apply the distort0r effect, setting the first two double parameters:
  9388. @example
  9389. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9390. @end example
  9391. @item
  9392. Apply the colordistance effect, taking a color as the first parameter:
  9393. @example
  9394. frei0r=colordistance:0.2/0.3/0.4
  9395. frei0r=colordistance:violet
  9396. frei0r=colordistance:0x112233
  9397. @end example
  9398. @item
  9399. Apply the perspective effect, specifying the top left and top right image
  9400. positions:
  9401. @example
  9402. frei0r=perspective:0.2/0.2|0.8/0.2
  9403. @end example
  9404. @end itemize
  9405. For more information, see
  9406. @url{http://frei0r.dyne.org}
  9407. @subsection Commands
  9408. This filter supports the @option{filter_params} option as @ref{commands}.
  9409. @section fspp
  9410. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9411. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9412. processing filter, one of them is performed once per block, not per pixel.
  9413. This allows for much higher speed.
  9414. The filter accepts the following options:
  9415. @table @option
  9416. @item quality
  9417. Set quality. This option defines the number of levels for averaging. It accepts
  9418. an integer in the range 4-5. Default value is @code{4}.
  9419. @item qp
  9420. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9421. If not set, the filter will use the QP from the video stream (if available).
  9422. @item strength
  9423. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9424. more details but also more artifacts, while higher values make the image smoother
  9425. but also blurrier. Default value is @code{0} − PSNR optimal.
  9426. @item use_bframe_qp
  9427. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9428. option may cause flicker since the B-Frames have often larger QP. Default is
  9429. @code{0} (not enabled).
  9430. @end table
  9431. @section gblur
  9432. Apply Gaussian blur filter.
  9433. The filter accepts the following options:
  9434. @table @option
  9435. @item sigma
  9436. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9437. @item steps
  9438. Set number of steps for Gaussian approximation. Default is @code{1}.
  9439. @item planes
  9440. Set which planes to filter. By default all planes are filtered.
  9441. @item sigmaV
  9442. Set vertical sigma, if negative it will be same as @code{sigma}.
  9443. Default is @code{-1}.
  9444. @end table
  9445. @subsection Commands
  9446. This filter supports same commands as options.
  9447. The command accepts the same syntax of the corresponding option.
  9448. If the specified expression is not valid, it is kept at its current
  9449. value.
  9450. @section geq
  9451. Apply generic equation to each pixel.
  9452. The filter accepts the following options:
  9453. @table @option
  9454. @item lum_expr, lum
  9455. Set the luminance expression.
  9456. @item cb_expr, cb
  9457. Set the chrominance blue expression.
  9458. @item cr_expr, cr
  9459. Set the chrominance red expression.
  9460. @item alpha_expr, a
  9461. Set the alpha expression.
  9462. @item red_expr, r
  9463. Set the red expression.
  9464. @item green_expr, g
  9465. Set the green expression.
  9466. @item blue_expr, b
  9467. Set the blue expression.
  9468. @end table
  9469. The colorspace is selected according to the specified options. If one
  9470. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9471. options is specified, the filter will automatically select a YCbCr
  9472. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9473. @option{blue_expr} options is specified, it will select an RGB
  9474. colorspace.
  9475. If one of the chrominance expression is not defined, it falls back on the other
  9476. one. If no alpha expression is specified it will evaluate to opaque value.
  9477. If none of chrominance expressions are specified, they will evaluate
  9478. to the luminance expression.
  9479. The expressions can use the following variables and functions:
  9480. @table @option
  9481. @item N
  9482. The sequential number of the filtered frame, starting from @code{0}.
  9483. @item X
  9484. @item Y
  9485. The coordinates of the current sample.
  9486. @item W
  9487. @item H
  9488. The width and height of the image.
  9489. @item SW
  9490. @item SH
  9491. Width and height scale depending on the currently filtered plane. It is the
  9492. ratio between the corresponding luma plane number of pixels and the current
  9493. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9494. @code{0.5,0.5} for chroma planes.
  9495. @item T
  9496. Time of the current frame, expressed in seconds.
  9497. @item p(x, y)
  9498. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9499. plane.
  9500. @item lum(x, y)
  9501. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9502. plane.
  9503. @item cb(x, y)
  9504. Return the value of the pixel at location (@var{x},@var{y}) of the
  9505. blue-difference chroma plane. Return 0 if there is no such plane.
  9506. @item cr(x, y)
  9507. Return the value of the pixel at location (@var{x},@var{y}) of the
  9508. red-difference chroma plane. Return 0 if there is no such plane.
  9509. @item r(x, y)
  9510. @item g(x, y)
  9511. @item b(x, y)
  9512. Return the value of the pixel at location (@var{x},@var{y}) of the
  9513. red/green/blue component. Return 0 if there is no such component.
  9514. @item alpha(x, y)
  9515. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9516. plane. Return 0 if there is no such plane.
  9517. @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)
  9518. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9519. sums of samples within a rectangle. See the functions without the sum postfix.
  9520. @item interpolation
  9521. Set one of interpolation methods:
  9522. @table @option
  9523. @item nearest, n
  9524. @item bilinear, b
  9525. @end table
  9526. Default is bilinear.
  9527. @end table
  9528. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9529. automatically clipped to the closer edge.
  9530. Please note that this filter can use multiple threads in which case each slice
  9531. will have its own expression state. If you want to use only a single expression
  9532. state because your expressions depend on previous state then you should limit
  9533. the number of filter threads to 1.
  9534. @subsection Examples
  9535. @itemize
  9536. @item
  9537. Flip the image horizontally:
  9538. @example
  9539. geq=p(W-X\,Y)
  9540. @end example
  9541. @item
  9542. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9543. wavelength of 100 pixels:
  9544. @example
  9545. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9546. @end example
  9547. @item
  9548. Generate a fancy enigmatic moving light:
  9549. @example
  9550. 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
  9551. @end example
  9552. @item
  9553. Generate a quick emboss effect:
  9554. @example
  9555. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9556. @end example
  9557. @item
  9558. Modify RGB components depending on pixel position:
  9559. @example
  9560. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9561. @end example
  9562. @item
  9563. Create a radial gradient that is the same size as the input (also see
  9564. the @ref{vignette} filter):
  9565. @example
  9566. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9567. @end example
  9568. @end itemize
  9569. @section gradfun
  9570. Fix the banding artifacts that are sometimes introduced into nearly flat
  9571. regions by truncation to 8-bit color depth.
  9572. Interpolate the gradients that should go where the bands are, and
  9573. dither them.
  9574. It is designed for playback only. Do not use it prior to
  9575. lossy compression, because compression tends to lose the dither and
  9576. bring back the bands.
  9577. It accepts the following parameters:
  9578. @table @option
  9579. @item strength
  9580. The maximum amount by which the filter will change any one pixel. This is also
  9581. the threshold for detecting nearly flat regions. Acceptable values range from
  9582. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9583. valid range.
  9584. @item radius
  9585. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9586. gradients, but also prevents the filter from modifying the pixels near detailed
  9587. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9588. values will be clipped to the valid range.
  9589. @end table
  9590. Alternatively, the options can be specified as a flat string:
  9591. @var{strength}[:@var{radius}]
  9592. @subsection Examples
  9593. @itemize
  9594. @item
  9595. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9596. @example
  9597. gradfun=3.5:8
  9598. @end example
  9599. @item
  9600. Specify radius, omitting the strength (which will fall-back to the default
  9601. value):
  9602. @example
  9603. gradfun=radius=8
  9604. @end example
  9605. @end itemize
  9606. @anchor{graphmonitor}
  9607. @section graphmonitor
  9608. Show various filtergraph stats.
  9609. With this filter one can debug complete filtergraph.
  9610. Especially issues with links filling with queued frames.
  9611. The filter accepts the following options:
  9612. @table @option
  9613. @item size, s
  9614. Set video output size. Default is @var{hd720}.
  9615. @item opacity, o
  9616. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9617. @item mode, m
  9618. Set output mode, can be @var{fulll} or @var{compact}.
  9619. In @var{compact} mode only filters with some queued frames have displayed stats.
  9620. @item flags, f
  9621. Set flags which enable which stats are shown in video.
  9622. Available values for flags are:
  9623. @table @samp
  9624. @item queue
  9625. Display number of queued frames in each link.
  9626. @item frame_count_in
  9627. Display number of frames taken from filter.
  9628. @item frame_count_out
  9629. Display number of frames given out from filter.
  9630. @item pts
  9631. Display current filtered frame pts.
  9632. @item time
  9633. Display current filtered frame time.
  9634. @item timebase
  9635. Display time base for filter link.
  9636. @item format
  9637. Display used format for filter link.
  9638. @item size
  9639. Display video size or number of audio channels in case of audio used by filter link.
  9640. @item rate
  9641. Display video frame rate or sample rate in case of audio used by filter link.
  9642. @item eof
  9643. Display link output status.
  9644. @end table
  9645. @item rate, r
  9646. Set upper limit for video rate of output stream, Default value is @var{25}.
  9647. This guarantee that output video frame rate will not be higher than this value.
  9648. @end table
  9649. @section greyedge
  9650. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9651. and corrects the scene colors accordingly.
  9652. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9653. The filter accepts the following options:
  9654. @table @option
  9655. @item difford
  9656. The order of differentiation to be applied on the scene. Must be chosen in the range
  9657. [0,2] and default value is 1.
  9658. @item minknorm
  9659. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9660. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9661. max value instead of calculating Minkowski distance.
  9662. @item sigma
  9663. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9664. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9665. can't be equal to 0 if @var{difford} is greater than 0.
  9666. @end table
  9667. @subsection Examples
  9668. @itemize
  9669. @item
  9670. Grey Edge:
  9671. @example
  9672. greyedge=difford=1:minknorm=5:sigma=2
  9673. @end example
  9674. @item
  9675. Max Edge:
  9676. @example
  9677. greyedge=difford=1:minknorm=0:sigma=2
  9678. @end example
  9679. @end itemize
  9680. @anchor{haldclut}
  9681. @section haldclut
  9682. Apply a Hald CLUT to a video stream.
  9683. First input is the video stream to process, and second one is the Hald CLUT.
  9684. The Hald CLUT input can be a simple picture or a complete video stream.
  9685. The filter accepts the following options:
  9686. @table @option
  9687. @item shortest
  9688. Force termination when the shortest input terminates. Default is @code{0}.
  9689. @item repeatlast
  9690. Continue applying the last CLUT after the end of the stream. A value of
  9691. @code{0} disable the filter after the last frame of the CLUT is reached.
  9692. Default is @code{1}.
  9693. @end table
  9694. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9695. filters share the same internals).
  9696. This filter also supports the @ref{framesync} options.
  9697. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9698. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9699. @subsection Workflow examples
  9700. @subsubsection Hald CLUT video stream
  9701. Generate an identity Hald CLUT stream altered with various effects:
  9702. @example
  9703. 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
  9704. @end example
  9705. Note: make sure you use a lossless codec.
  9706. Then use it with @code{haldclut} to apply it on some random stream:
  9707. @example
  9708. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9709. @end example
  9710. The Hald CLUT will be applied to the 10 first seconds (duration of
  9711. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9712. to the remaining frames of the @code{mandelbrot} stream.
  9713. @subsubsection Hald CLUT with preview
  9714. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9715. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9716. biggest possible square starting at the top left of the picture. The remaining
  9717. padding pixels (bottom or right) will be ignored. This area can be used to add
  9718. a preview of the Hald CLUT.
  9719. Typically, the following generated Hald CLUT will be supported by the
  9720. @code{haldclut} filter:
  9721. @example
  9722. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9723. pad=iw+320 [padded_clut];
  9724. smptebars=s=320x256, split [a][b];
  9725. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9726. [main][b] overlay=W-320" -frames:v 1 clut.png
  9727. @end example
  9728. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9729. bars are displayed on the right-top, and below the same color bars processed by
  9730. the color changes.
  9731. Then, the effect of this Hald CLUT can be visualized with:
  9732. @example
  9733. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9734. @end example
  9735. @section hflip
  9736. Flip the input video horizontally.
  9737. For example, to horizontally flip the input video with @command{ffmpeg}:
  9738. @example
  9739. ffmpeg -i in.avi -vf "hflip" out.avi
  9740. @end example
  9741. @section histeq
  9742. This filter applies a global color histogram equalization on a
  9743. per-frame basis.
  9744. It can be used to correct video that has a compressed range of pixel
  9745. intensities. The filter redistributes the pixel intensities to
  9746. equalize their distribution across the intensity range. It may be
  9747. viewed as an "automatically adjusting contrast filter". This filter is
  9748. useful only for correcting degraded or poorly captured source
  9749. video.
  9750. The filter accepts the following options:
  9751. @table @option
  9752. @item strength
  9753. Determine the amount of equalization to be applied. As the strength
  9754. is reduced, the distribution of pixel intensities more-and-more
  9755. approaches that of the input frame. The value must be a float number
  9756. in the range [0,1] and defaults to 0.200.
  9757. @item intensity
  9758. Set the maximum intensity that can generated and scale the output
  9759. values appropriately. The strength should be set as desired and then
  9760. the intensity can be limited if needed to avoid washing-out. The value
  9761. must be a float number in the range [0,1] and defaults to 0.210.
  9762. @item antibanding
  9763. Set the antibanding level. If enabled the filter will randomly vary
  9764. the luminance of output pixels by a small amount to avoid banding of
  9765. the histogram. Possible values are @code{none}, @code{weak} or
  9766. @code{strong}. It defaults to @code{none}.
  9767. @end table
  9768. @anchor{histogram}
  9769. @section histogram
  9770. Compute and draw a color distribution histogram for the input video.
  9771. The computed histogram is a representation of the color component
  9772. distribution in an image.
  9773. Standard histogram displays the color components distribution in an image.
  9774. Displays color graph for each color component. Shows distribution of
  9775. the Y, U, V, A or R, G, B components, depending on input format, in the
  9776. current frame. Below each graph a color component scale meter is shown.
  9777. The filter accepts the following options:
  9778. @table @option
  9779. @item level_height
  9780. Set height of level. Default value is @code{200}.
  9781. Allowed range is [50, 2048].
  9782. @item scale_height
  9783. Set height of color scale. Default value is @code{12}.
  9784. Allowed range is [0, 40].
  9785. @item display_mode
  9786. Set display mode.
  9787. It accepts the following values:
  9788. @table @samp
  9789. @item stack
  9790. Per color component graphs are placed below each other.
  9791. @item parade
  9792. Per color component graphs are placed side by side.
  9793. @item overlay
  9794. Presents information identical to that in the @code{parade}, except
  9795. that the graphs representing color components are superimposed directly
  9796. over one another.
  9797. @end table
  9798. Default is @code{stack}.
  9799. @item levels_mode
  9800. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9801. Default is @code{linear}.
  9802. @item components
  9803. Set what color components to display.
  9804. Default is @code{7}.
  9805. @item fgopacity
  9806. Set foreground opacity. Default is @code{0.7}.
  9807. @item bgopacity
  9808. Set background opacity. Default is @code{0.5}.
  9809. @end table
  9810. @subsection Examples
  9811. @itemize
  9812. @item
  9813. Calculate and draw histogram:
  9814. @example
  9815. ffplay -i input -vf histogram
  9816. @end example
  9817. @end itemize
  9818. @anchor{hqdn3d}
  9819. @section hqdn3d
  9820. This is a high precision/quality 3d denoise filter. It aims to reduce
  9821. image noise, producing smooth images and making still images really
  9822. still. It should enhance compressibility.
  9823. It accepts the following optional parameters:
  9824. @table @option
  9825. @item luma_spatial
  9826. A non-negative floating point number which specifies spatial luma strength.
  9827. It defaults to 4.0.
  9828. @item chroma_spatial
  9829. A non-negative floating point number which specifies spatial chroma strength.
  9830. It defaults to 3.0*@var{luma_spatial}/4.0.
  9831. @item luma_tmp
  9832. A floating point number which specifies luma temporal strength. It defaults to
  9833. 6.0*@var{luma_spatial}/4.0.
  9834. @item chroma_tmp
  9835. A floating point number which specifies chroma temporal strength. It defaults to
  9836. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9837. @end table
  9838. @subsection Commands
  9839. This filter supports same @ref{commands} as options.
  9840. The command accepts the same syntax of the corresponding option.
  9841. If the specified expression is not valid, it is kept at its current
  9842. value.
  9843. @anchor{hwdownload}
  9844. @section hwdownload
  9845. Download hardware frames to system memory.
  9846. The input must be in hardware frames, and the output a non-hardware format.
  9847. Not all formats will be supported on the output - it may be necessary to insert
  9848. an additional @option{format} filter immediately following in the graph to get
  9849. the output in a supported format.
  9850. @section hwmap
  9851. Map hardware frames to system memory or to another device.
  9852. This filter has several different modes of operation; which one is used depends
  9853. on the input and output formats:
  9854. @itemize
  9855. @item
  9856. Hardware frame input, normal frame output
  9857. Map the input frames to system memory and pass them to the output. If the
  9858. original hardware frame is later required (for example, after overlaying
  9859. something else on part of it), the @option{hwmap} filter can be used again
  9860. in the next mode to retrieve it.
  9861. @item
  9862. Normal frame input, hardware frame output
  9863. If the input is actually a software-mapped hardware frame, then unmap it -
  9864. that is, return the original hardware frame.
  9865. Otherwise, a device must be provided. Create new hardware surfaces on that
  9866. device for the output, then map them back to the software format at the input
  9867. and give those frames to the preceding filter. This will then act like the
  9868. @option{hwupload} filter, but may be able to avoid an additional copy when
  9869. the input is already in a compatible format.
  9870. @item
  9871. Hardware frame input and output
  9872. A device must be supplied for the output, either directly or with the
  9873. @option{derive_device} option. The input and output devices must be of
  9874. different types and compatible - the exact meaning of this is
  9875. system-dependent, but typically it means that they must refer to the same
  9876. underlying hardware context (for example, refer to the same graphics card).
  9877. If the input frames were originally created on the output device, then unmap
  9878. to retrieve the original frames.
  9879. Otherwise, map the frames to the output device - create new hardware frames
  9880. on the output corresponding to the frames on the input.
  9881. @end itemize
  9882. The following additional parameters are accepted:
  9883. @table @option
  9884. @item mode
  9885. Set the frame mapping mode. Some combination of:
  9886. @table @var
  9887. @item read
  9888. The mapped frame should be readable.
  9889. @item write
  9890. The mapped frame should be writeable.
  9891. @item overwrite
  9892. The mapping will always overwrite the entire frame.
  9893. This may improve performance in some cases, as the original contents of the
  9894. frame need not be loaded.
  9895. @item direct
  9896. The mapping must not involve any copying.
  9897. Indirect mappings to copies of frames are created in some cases where either
  9898. direct mapping is not possible or it would have unexpected properties.
  9899. Setting this flag ensures that the mapping is direct and will fail if that is
  9900. not possible.
  9901. @end table
  9902. Defaults to @var{read+write} if not specified.
  9903. @item derive_device @var{type}
  9904. Rather than using the device supplied at initialisation, instead derive a new
  9905. device of type @var{type} from the device the input frames exist on.
  9906. @item reverse
  9907. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9908. and map them back to the source. This may be necessary in some cases where
  9909. a mapping in one direction is required but only the opposite direction is
  9910. supported by the devices being used.
  9911. This option is dangerous - it may break the preceding filter in undefined
  9912. ways if there are any additional constraints on that filter's output.
  9913. Do not use it without fully understanding the implications of its use.
  9914. @end table
  9915. @anchor{hwupload}
  9916. @section hwupload
  9917. Upload system memory frames to hardware surfaces.
  9918. The device to upload to must be supplied when the filter is initialised. If
  9919. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9920. option or with the @option{derive_device} option. The input and output devices
  9921. must be of different types and compatible - the exact meaning of this is
  9922. system-dependent, but typically it means that they must refer to the same
  9923. underlying hardware context (for example, refer to the same graphics card).
  9924. The following additional parameters are accepted:
  9925. @table @option
  9926. @item derive_device @var{type}
  9927. Rather than using the device supplied at initialisation, instead derive a new
  9928. device of type @var{type} from the device the input frames exist on.
  9929. @end table
  9930. @anchor{hwupload_cuda}
  9931. @section hwupload_cuda
  9932. Upload system memory frames to a CUDA device.
  9933. It accepts the following optional parameters:
  9934. @table @option
  9935. @item device
  9936. The number of the CUDA device to use
  9937. @end table
  9938. @section hqx
  9939. Apply a high-quality magnification filter designed for pixel art. This filter
  9940. was originally created by Maxim Stepin.
  9941. It accepts the following option:
  9942. @table @option
  9943. @item n
  9944. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9945. @code{hq3x} and @code{4} for @code{hq4x}.
  9946. Default is @code{3}.
  9947. @end table
  9948. @section hstack
  9949. Stack input videos horizontally.
  9950. All streams must be of same pixel format and of same height.
  9951. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9952. to create same output.
  9953. The filter accepts the following option:
  9954. @table @option
  9955. @item inputs
  9956. Set number of input streams. Default is 2.
  9957. @item shortest
  9958. If set to 1, force the output to terminate when the shortest input
  9959. terminates. Default value is 0.
  9960. @end table
  9961. @section hue
  9962. Modify the hue and/or the saturation of the input.
  9963. It accepts the following parameters:
  9964. @table @option
  9965. @item h
  9966. Specify the hue angle as a number of degrees. It accepts an expression,
  9967. and defaults to "0".
  9968. @item s
  9969. Specify the saturation in the [-10,10] range. It accepts an expression and
  9970. defaults to "1".
  9971. @item H
  9972. Specify the hue angle as a number of radians. It accepts an
  9973. expression, and defaults to "0".
  9974. @item b
  9975. Specify the brightness in the [-10,10] range. It accepts an expression and
  9976. defaults to "0".
  9977. @end table
  9978. @option{h} and @option{H} are mutually exclusive, and can't be
  9979. specified at the same time.
  9980. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9981. expressions containing the following constants:
  9982. @table @option
  9983. @item n
  9984. frame count of the input frame starting from 0
  9985. @item pts
  9986. presentation timestamp of the input frame expressed in time base units
  9987. @item r
  9988. frame rate of the input video, NAN if the input frame rate is unknown
  9989. @item t
  9990. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9991. @item tb
  9992. time base of the input video
  9993. @end table
  9994. @subsection Examples
  9995. @itemize
  9996. @item
  9997. Set the hue to 90 degrees and the saturation to 1.0:
  9998. @example
  9999. hue=h=90:s=1
  10000. @end example
  10001. @item
  10002. Same command but expressing the hue in radians:
  10003. @example
  10004. hue=H=PI/2:s=1
  10005. @end example
  10006. @item
  10007. Rotate hue and make the saturation swing between 0
  10008. and 2 over a period of 1 second:
  10009. @example
  10010. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10011. @end example
  10012. @item
  10013. Apply a 3 seconds saturation fade-in effect starting at 0:
  10014. @example
  10015. hue="s=min(t/3\,1)"
  10016. @end example
  10017. The general fade-in expression can be written as:
  10018. @example
  10019. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10020. @end example
  10021. @item
  10022. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10023. @example
  10024. hue="s=max(0\, min(1\, (8-t)/3))"
  10025. @end example
  10026. The general fade-out expression can be written as:
  10027. @example
  10028. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10029. @end example
  10030. @end itemize
  10031. @subsection Commands
  10032. This filter supports the following commands:
  10033. @table @option
  10034. @item b
  10035. @item s
  10036. @item h
  10037. @item H
  10038. Modify the hue and/or the saturation and/or brightness of the input video.
  10039. The command accepts the same syntax of the corresponding option.
  10040. If the specified expression is not valid, it is kept at its current
  10041. value.
  10042. @end table
  10043. @section hysteresis
  10044. Grow first stream into second stream by connecting components.
  10045. This makes it possible to build more robust edge masks.
  10046. This filter accepts the following options:
  10047. @table @option
  10048. @item planes
  10049. Set which planes will be processed as bitmap, unprocessed planes will be
  10050. copied from first stream.
  10051. By default value 0xf, all planes will be processed.
  10052. @item threshold
  10053. Set threshold which is used in filtering. If pixel component value is higher than
  10054. this value filter algorithm for connecting components is activated.
  10055. By default value is 0.
  10056. @end table
  10057. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10058. @section idet
  10059. Detect video interlacing type.
  10060. This filter tries to detect if the input frames are interlaced, progressive,
  10061. top or bottom field first. It will also try to detect fields that are
  10062. repeated between adjacent frames (a sign of telecine).
  10063. Single frame detection considers only immediately adjacent frames when classifying each frame.
  10064. Multiple frame detection incorporates the classification history of previous frames.
  10065. The filter will log these metadata values:
  10066. @table @option
  10067. @item single.current_frame
  10068. Detected type of current frame using single-frame detection. One of:
  10069. ``tff'' (top field first), ``bff'' (bottom field first),
  10070. ``progressive'', or ``undetermined''
  10071. @item single.tff
  10072. Cumulative number of frames detected as top field first using single-frame detection.
  10073. @item multiple.tff
  10074. Cumulative number of frames detected as top field first using multiple-frame detection.
  10075. @item single.bff
  10076. Cumulative number of frames detected as bottom field first using single-frame detection.
  10077. @item multiple.current_frame
  10078. Detected type of current frame using multiple-frame detection. One of:
  10079. ``tff'' (top field first), ``bff'' (bottom field first),
  10080. ``progressive'', or ``undetermined''
  10081. @item multiple.bff
  10082. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  10083. @item single.progressive
  10084. Cumulative number of frames detected as progressive using single-frame detection.
  10085. @item multiple.progressive
  10086. Cumulative number of frames detected as progressive using multiple-frame detection.
  10087. @item single.undetermined
  10088. Cumulative number of frames that could not be classified using single-frame detection.
  10089. @item multiple.undetermined
  10090. Cumulative number of frames that could not be classified using multiple-frame detection.
  10091. @item repeated.current_frame
  10092. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10093. @item repeated.neither
  10094. Cumulative number of frames with no repeated field.
  10095. @item repeated.top
  10096. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10097. @item repeated.bottom
  10098. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10099. @end table
  10100. The filter accepts the following options:
  10101. @table @option
  10102. @item intl_thres
  10103. Set interlacing threshold.
  10104. @item prog_thres
  10105. Set progressive threshold.
  10106. @item rep_thres
  10107. Threshold for repeated field detection.
  10108. @item half_life
  10109. Number of frames after which a given frame's contribution to the
  10110. statistics is halved (i.e., it contributes only 0.5 to its
  10111. classification). The default of 0 means that all frames seen are given
  10112. full weight of 1.0 forever.
  10113. @item analyze_interlaced_flag
  10114. When this is not 0 then idet will use the specified number of frames to determine
  10115. if the interlaced flag is accurate, it will not count undetermined frames.
  10116. If the flag is found to be accurate it will be used without any further
  10117. computations, if it is found to be inaccurate it will be cleared without any
  10118. further computations. This allows inserting the idet filter as a low computational
  10119. method to clean up the interlaced flag
  10120. @end table
  10121. @section il
  10122. Deinterleave or interleave fields.
  10123. This filter allows one to process interlaced images fields without
  10124. deinterlacing them. Deinterleaving splits the input frame into 2
  10125. fields (so called half pictures). Odd lines are moved to the top
  10126. half of the output image, even lines to the bottom half.
  10127. You can process (filter) them independently and then re-interleave them.
  10128. The filter accepts the following options:
  10129. @table @option
  10130. @item luma_mode, l
  10131. @item chroma_mode, c
  10132. @item alpha_mode, a
  10133. Available values for @var{luma_mode}, @var{chroma_mode} and
  10134. @var{alpha_mode} are:
  10135. @table @samp
  10136. @item none
  10137. Do nothing.
  10138. @item deinterleave, d
  10139. Deinterleave fields, placing one above the other.
  10140. @item interleave, i
  10141. Interleave fields. Reverse the effect of deinterleaving.
  10142. @end table
  10143. Default value is @code{none}.
  10144. @item luma_swap, ls
  10145. @item chroma_swap, cs
  10146. @item alpha_swap, as
  10147. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10148. @end table
  10149. @subsection Commands
  10150. This filter supports the all above options as @ref{commands}.
  10151. @section inflate
  10152. Apply inflate effect to the video.
  10153. This filter replaces the pixel by the local(3x3) average by taking into account
  10154. only values higher than the pixel.
  10155. It accepts the following options:
  10156. @table @option
  10157. @item threshold0
  10158. @item threshold1
  10159. @item threshold2
  10160. @item threshold3
  10161. Limit the maximum change for each plane, default is 65535.
  10162. If 0, plane will remain unchanged.
  10163. @end table
  10164. @subsection Commands
  10165. This filter supports the all above options as @ref{commands}.
  10166. @section interlace
  10167. Simple interlacing filter from progressive contents. This interleaves upper (or
  10168. lower) lines from odd frames with lower (or upper) lines from even frames,
  10169. halving the frame rate and preserving image height.
  10170. @example
  10171. Original Original New Frame
  10172. Frame 'j' Frame 'j+1' (tff)
  10173. ========== =========== ==================
  10174. Line 0 --------------------> Frame 'j' Line 0
  10175. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10176. Line 2 ---------------------> Frame 'j' Line 2
  10177. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10178. ... ... ...
  10179. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10180. @end example
  10181. It accepts the following optional parameters:
  10182. @table @option
  10183. @item scan
  10184. This determines whether the interlaced frame is taken from the even
  10185. (tff - default) or odd (bff) lines of the progressive frame.
  10186. @item lowpass
  10187. Vertical lowpass filter to avoid twitter interlacing and
  10188. reduce moire patterns.
  10189. @table @samp
  10190. @item 0, off
  10191. Disable vertical lowpass filter
  10192. @item 1, linear
  10193. Enable linear filter (default)
  10194. @item 2, complex
  10195. Enable complex filter. This will slightly less reduce twitter and moire
  10196. but better retain detail and subjective sharpness impression.
  10197. @end table
  10198. @end table
  10199. @section kerndeint
  10200. Deinterlace input video by applying Donald Graft's adaptive kernel
  10201. deinterling. Work on interlaced parts of a video to produce
  10202. progressive frames.
  10203. The description of the accepted parameters follows.
  10204. @table @option
  10205. @item thresh
  10206. Set the threshold which affects the filter's tolerance when
  10207. determining if a pixel line must be processed. It must be an integer
  10208. in the range [0,255] and defaults to 10. A value of 0 will result in
  10209. applying the process on every pixels.
  10210. @item map
  10211. Paint pixels exceeding the threshold value to white if set to 1.
  10212. Default is 0.
  10213. @item order
  10214. Set the fields order. Swap fields if set to 1, leave fields alone if
  10215. 0. Default is 0.
  10216. @item sharp
  10217. Enable additional sharpening if set to 1. Default is 0.
  10218. @item twoway
  10219. Enable twoway sharpening if set to 1. Default is 0.
  10220. @end table
  10221. @subsection Examples
  10222. @itemize
  10223. @item
  10224. Apply default values:
  10225. @example
  10226. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10227. @end example
  10228. @item
  10229. Enable additional sharpening:
  10230. @example
  10231. kerndeint=sharp=1
  10232. @end example
  10233. @item
  10234. Paint processed pixels in white:
  10235. @example
  10236. kerndeint=map=1
  10237. @end example
  10238. @end itemize
  10239. @section lagfun
  10240. Slowly update darker pixels.
  10241. This filter makes short flashes of light appear longer.
  10242. This filter accepts the following options:
  10243. @table @option
  10244. @item decay
  10245. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10246. @item planes
  10247. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10248. @end table
  10249. @section lenscorrection
  10250. Correct radial lens distortion
  10251. This filter can be used to correct for radial distortion as can result from the use
  10252. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10253. one can use tools available for example as part of opencv or simply trial-and-error.
  10254. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10255. and extract the k1 and k2 coefficients from the resulting matrix.
  10256. Note that effectively the same filter is available in the open-source tools Krita and
  10257. Digikam from the KDE project.
  10258. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10259. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10260. brightness distribution, so you may want to use both filters together in certain
  10261. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10262. be applied before or after lens correction.
  10263. @subsection Options
  10264. The filter accepts the following options:
  10265. @table @option
  10266. @item cx
  10267. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10268. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10269. width. Default is 0.5.
  10270. @item cy
  10271. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10272. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10273. height. Default is 0.5.
  10274. @item k1
  10275. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10276. no correction. Default is 0.
  10277. @item k2
  10278. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10279. 0 means no correction. Default is 0.
  10280. @item i
  10281. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  10282. Default is @code{nearest}.
  10283. @item fc
  10284. Specify the color of the unmapped pixels. For the syntax of this option,
  10285. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10286. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  10287. @end table
  10288. The formula that generates the correction is:
  10289. @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)
  10290. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10291. distances from the focal point in the source and target images, respectively.
  10292. @subsection Commands
  10293. This filter supports the all above options as @ref{commands}.
  10294. @section lensfun
  10295. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10296. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10297. to apply the lens correction. The filter will load the lensfun database and
  10298. query it to find the corresponding camera and lens entries in the database. As
  10299. long as these entries can be found with the given options, the filter can
  10300. perform corrections on frames. Note that incomplete strings will result in the
  10301. filter choosing the best match with the given options, and the filter will
  10302. output the chosen camera and lens models (logged with level "info"). You must
  10303. provide the make, camera model, and lens model as they are required.
  10304. The filter accepts the following options:
  10305. @table @option
  10306. @item make
  10307. The make of the camera (for example, "Canon"). This option is required.
  10308. @item model
  10309. The model of the camera (for example, "Canon EOS 100D"). This option is
  10310. required.
  10311. @item lens_model
  10312. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10313. option is required.
  10314. @item mode
  10315. The type of correction to apply. The following values are valid options:
  10316. @table @samp
  10317. @item vignetting
  10318. Enables fixing lens vignetting.
  10319. @item geometry
  10320. Enables fixing lens geometry. This is the default.
  10321. @item subpixel
  10322. Enables fixing chromatic aberrations.
  10323. @item vig_geo
  10324. Enables fixing lens vignetting and lens geometry.
  10325. @item vig_subpixel
  10326. Enables fixing lens vignetting and chromatic aberrations.
  10327. @item distortion
  10328. Enables fixing both lens geometry and chromatic aberrations.
  10329. @item all
  10330. Enables all possible corrections.
  10331. @end table
  10332. @item focal_length
  10333. The focal length of the image/video (zoom; expected constant for video). For
  10334. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10335. range should be chosen when using that lens. Default 18.
  10336. @item aperture
  10337. The aperture of the image/video (expected constant for video). Note that
  10338. aperture is only used for vignetting correction. Default 3.5.
  10339. @item focus_distance
  10340. The focus distance of the image/video (expected constant for video). Note that
  10341. focus distance is only used for vignetting and only slightly affects the
  10342. vignetting correction process. If unknown, leave it at the default value (which
  10343. is 1000).
  10344. @item scale
  10345. The scale factor which is applied after transformation. After correction the
  10346. video is no longer necessarily rectangular. This parameter controls how much of
  10347. the resulting image is visible. The value 0 means that a value will be chosen
  10348. automatically such that there is little or no unmapped area in the output
  10349. image. 1.0 means that no additional scaling is done. Lower values may result
  10350. in more of the corrected image being visible, while higher values may avoid
  10351. unmapped areas in the output.
  10352. @item target_geometry
  10353. The target geometry of the output image/video. The following values are valid
  10354. options:
  10355. @table @samp
  10356. @item rectilinear (default)
  10357. @item fisheye
  10358. @item panoramic
  10359. @item equirectangular
  10360. @item fisheye_orthographic
  10361. @item fisheye_stereographic
  10362. @item fisheye_equisolid
  10363. @item fisheye_thoby
  10364. @end table
  10365. @item reverse
  10366. Apply the reverse of image correction (instead of correcting distortion, apply
  10367. it).
  10368. @item interpolation
  10369. The type of interpolation used when correcting distortion. The following values
  10370. are valid options:
  10371. @table @samp
  10372. @item nearest
  10373. @item linear (default)
  10374. @item lanczos
  10375. @end table
  10376. @end table
  10377. @subsection Examples
  10378. @itemize
  10379. @item
  10380. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10381. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10382. aperture of "8.0".
  10383. @example
  10384. 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
  10385. @end example
  10386. @item
  10387. Apply the same as before, but only for the first 5 seconds of video.
  10388. @example
  10389. 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
  10390. @end example
  10391. @end itemize
  10392. @section libvmaf
  10393. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10394. score between two input videos.
  10395. The obtained VMAF score is printed through the logging system.
  10396. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10397. After installing the library it can be enabled using:
  10398. @code{./configure --enable-libvmaf}.
  10399. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10400. The filter has following options:
  10401. @table @option
  10402. @item model_path
  10403. Set the model path which is to be used for SVM.
  10404. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10405. @item log_path
  10406. Set the file path to be used to store logs.
  10407. @item log_fmt
  10408. Set the format of the log file (csv, json or xml).
  10409. @item enable_transform
  10410. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10411. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10412. Default value: @code{false}
  10413. @item phone_model
  10414. Invokes the phone model which will generate VMAF scores higher than in the
  10415. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10416. Default value: @code{false}
  10417. @item psnr
  10418. Enables computing psnr along with vmaf.
  10419. Default value: @code{false}
  10420. @item ssim
  10421. Enables computing ssim along with vmaf.
  10422. Default value: @code{false}
  10423. @item ms_ssim
  10424. Enables computing ms_ssim along with vmaf.
  10425. Default value: @code{false}
  10426. @item pool
  10427. Set the pool method to be used for computing vmaf.
  10428. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10429. @item n_threads
  10430. Set number of threads to be used when computing vmaf.
  10431. Default value: @code{0}, which makes use of all available logical processors.
  10432. @item n_subsample
  10433. Set interval for frame subsampling used when computing vmaf.
  10434. Default value: @code{1}
  10435. @item enable_conf_interval
  10436. Enables confidence interval.
  10437. Default value: @code{false}
  10438. @end table
  10439. This filter also supports the @ref{framesync} options.
  10440. @subsection Examples
  10441. @itemize
  10442. @item
  10443. On the below examples the input file @file{main.mpg} being processed is
  10444. compared with the reference file @file{ref.mpg}.
  10445. @example
  10446. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10447. @end example
  10448. @item
  10449. Example with options:
  10450. @example
  10451. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10452. @end example
  10453. @item
  10454. Example with options and different containers:
  10455. @example
  10456. 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 -
  10457. @end example
  10458. @end itemize
  10459. @section limiter
  10460. Limits the pixel components values to the specified range [min, max].
  10461. The filter accepts the following options:
  10462. @table @option
  10463. @item min
  10464. Lower bound. Defaults to the lowest allowed value for the input.
  10465. @item max
  10466. Upper bound. Defaults to the highest allowed value for the input.
  10467. @item planes
  10468. Specify which planes will be processed. Defaults to all available.
  10469. @end table
  10470. @subsection Commands
  10471. This filter supports the all above options as @ref{commands}.
  10472. @section loop
  10473. Loop video frames.
  10474. The filter accepts the following options:
  10475. @table @option
  10476. @item loop
  10477. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10478. Default is 0.
  10479. @item size
  10480. Set maximal size in number of frames. Default is 0.
  10481. @item start
  10482. Set first frame of loop. Default is 0.
  10483. @end table
  10484. @subsection Examples
  10485. @itemize
  10486. @item
  10487. Loop single first frame infinitely:
  10488. @example
  10489. loop=loop=-1:size=1:start=0
  10490. @end example
  10491. @item
  10492. Loop single first frame 10 times:
  10493. @example
  10494. loop=loop=10:size=1:start=0
  10495. @end example
  10496. @item
  10497. Loop 10 first frames 5 times:
  10498. @example
  10499. loop=loop=5:size=10:start=0
  10500. @end example
  10501. @end itemize
  10502. @section lut1d
  10503. Apply a 1D LUT to an input video.
  10504. The filter accepts the following options:
  10505. @table @option
  10506. @item file
  10507. Set the 1D LUT file name.
  10508. Currently supported formats:
  10509. @table @samp
  10510. @item cube
  10511. Iridas
  10512. @item csp
  10513. cineSpace
  10514. @end table
  10515. @item interp
  10516. Select interpolation mode.
  10517. Available values are:
  10518. @table @samp
  10519. @item nearest
  10520. Use values from the nearest defined point.
  10521. @item linear
  10522. Interpolate values using the linear interpolation.
  10523. @item cosine
  10524. Interpolate values using the cosine interpolation.
  10525. @item cubic
  10526. Interpolate values using the cubic interpolation.
  10527. @item spline
  10528. Interpolate values using the spline interpolation.
  10529. @end table
  10530. @end table
  10531. @anchor{lut3d}
  10532. @section lut3d
  10533. Apply a 3D LUT to an input video.
  10534. The filter accepts the following options:
  10535. @table @option
  10536. @item file
  10537. Set the 3D LUT file name.
  10538. Currently supported formats:
  10539. @table @samp
  10540. @item 3dl
  10541. AfterEffects
  10542. @item cube
  10543. Iridas
  10544. @item dat
  10545. DaVinci
  10546. @item m3d
  10547. Pandora
  10548. @item csp
  10549. cineSpace
  10550. @end table
  10551. @item interp
  10552. Select interpolation mode.
  10553. Available values are:
  10554. @table @samp
  10555. @item nearest
  10556. Use values from the nearest defined point.
  10557. @item trilinear
  10558. Interpolate values using the 8 points defining a cube.
  10559. @item tetrahedral
  10560. Interpolate values using a tetrahedron.
  10561. @end table
  10562. @end table
  10563. @section lumakey
  10564. Turn certain luma values into transparency.
  10565. The filter accepts the following options:
  10566. @table @option
  10567. @item threshold
  10568. Set the luma which will be used as base for transparency.
  10569. Default value is @code{0}.
  10570. @item tolerance
  10571. Set the range of luma values to be keyed out.
  10572. Default value is @code{0.01}.
  10573. @item softness
  10574. Set the range of softness. Default value is @code{0}.
  10575. Use this to control gradual transition from zero to full transparency.
  10576. @end table
  10577. @subsection Commands
  10578. This filter supports same @ref{commands} as options.
  10579. The command accepts the same syntax of the corresponding option.
  10580. If the specified expression is not valid, it is kept at its current
  10581. value.
  10582. @section lut, lutrgb, lutyuv
  10583. Compute a look-up table for binding each pixel component input value
  10584. to an output value, and apply it to the input video.
  10585. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10586. to an RGB input video.
  10587. These filters accept the following parameters:
  10588. @table @option
  10589. @item c0
  10590. set first pixel component expression
  10591. @item c1
  10592. set second pixel component expression
  10593. @item c2
  10594. set third pixel component expression
  10595. @item c3
  10596. set fourth pixel component expression, corresponds to the alpha component
  10597. @item r
  10598. set red component expression
  10599. @item g
  10600. set green component expression
  10601. @item b
  10602. set blue component expression
  10603. @item a
  10604. alpha component expression
  10605. @item y
  10606. set Y/luminance component expression
  10607. @item u
  10608. set U/Cb component expression
  10609. @item v
  10610. set V/Cr component expression
  10611. @end table
  10612. Each of them specifies the expression to use for computing the lookup table for
  10613. the corresponding pixel component values.
  10614. The exact component associated to each of the @var{c*} options depends on the
  10615. format in input.
  10616. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10617. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10618. The expressions can contain the following constants and functions:
  10619. @table @option
  10620. @item w
  10621. @item h
  10622. The input width and height.
  10623. @item val
  10624. The input value for the pixel component.
  10625. @item clipval
  10626. The input value, clipped to the @var{minval}-@var{maxval} range.
  10627. @item maxval
  10628. The maximum value for the pixel component.
  10629. @item minval
  10630. The minimum value for the pixel component.
  10631. @item negval
  10632. The negated value for the pixel component value, clipped to the
  10633. @var{minval}-@var{maxval} range; it corresponds to the expression
  10634. "maxval-clipval+minval".
  10635. @item clip(val)
  10636. The computed value in @var{val}, clipped to the
  10637. @var{minval}-@var{maxval} range.
  10638. @item gammaval(gamma)
  10639. The computed gamma correction value of the pixel component value,
  10640. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10641. expression
  10642. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10643. @end table
  10644. All expressions default to "val".
  10645. @subsection Examples
  10646. @itemize
  10647. @item
  10648. Negate input video:
  10649. @example
  10650. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10651. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10652. @end example
  10653. The above is the same as:
  10654. @example
  10655. lutrgb="r=negval:g=negval:b=negval"
  10656. lutyuv="y=negval:u=negval:v=negval"
  10657. @end example
  10658. @item
  10659. Negate luminance:
  10660. @example
  10661. lutyuv=y=negval
  10662. @end example
  10663. @item
  10664. Remove chroma components, turning the video into a graytone image:
  10665. @example
  10666. lutyuv="u=128:v=128"
  10667. @end example
  10668. @item
  10669. Apply a luma burning effect:
  10670. @example
  10671. lutyuv="y=2*val"
  10672. @end example
  10673. @item
  10674. Remove green and blue components:
  10675. @example
  10676. lutrgb="g=0:b=0"
  10677. @end example
  10678. @item
  10679. Set a constant alpha channel value on input:
  10680. @example
  10681. format=rgba,lutrgb=a="maxval-minval/2"
  10682. @end example
  10683. @item
  10684. Correct luminance gamma by a factor of 0.5:
  10685. @example
  10686. lutyuv=y=gammaval(0.5)
  10687. @end example
  10688. @item
  10689. Discard least significant bits of luma:
  10690. @example
  10691. lutyuv=y='bitand(val, 128+64+32)'
  10692. @end example
  10693. @item
  10694. Technicolor like effect:
  10695. @example
  10696. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10697. @end example
  10698. @end itemize
  10699. @section lut2, tlut2
  10700. The @code{lut2} filter takes two input streams and outputs one
  10701. stream.
  10702. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10703. from one single stream.
  10704. This filter accepts the following parameters:
  10705. @table @option
  10706. @item c0
  10707. set first pixel component expression
  10708. @item c1
  10709. set second pixel component expression
  10710. @item c2
  10711. set third pixel component expression
  10712. @item c3
  10713. set fourth pixel component expression, corresponds to the alpha component
  10714. @item d
  10715. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10716. which means bit depth is automatically picked from first input format.
  10717. @end table
  10718. The @code{lut2} filter also supports the @ref{framesync} options.
  10719. Each of them specifies the expression to use for computing the lookup table for
  10720. the corresponding pixel component values.
  10721. The exact component associated to each of the @var{c*} options depends on the
  10722. format in inputs.
  10723. The expressions can contain the following constants:
  10724. @table @option
  10725. @item w
  10726. @item h
  10727. The input width and height.
  10728. @item x
  10729. The first input value for the pixel component.
  10730. @item y
  10731. The second input value for the pixel component.
  10732. @item bdx
  10733. The first input video bit depth.
  10734. @item bdy
  10735. The second input video bit depth.
  10736. @end table
  10737. All expressions default to "x".
  10738. @subsection Examples
  10739. @itemize
  10740. @item
  10741. Highlight differences between two RGB video streams:
  10742. @example
  10743. 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)'
  10744. @end example
  10745. @item
  10746. Highlight differences between two YUV video streams:
  10747. @example
  10748. 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)'
  10749. @end example
  10750. @item
  10751. Show max difference between two video streams:
  10752. @example
  10753. 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)))'
  10754. @end example
  10755. @end itemize
  10756. @section maskedclamp
  10757. Clamp the first input stream with the second input and third input stream.
  10758. Returns the value of first stream to be between second input
  10759. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10760. This filter accepts the following options:
  10761. @table @option
  10762. @item undershoot
  10763. Default value is @code{0}.
  10764. @item overshoot
  10765. Default value is @code{0}.
  10766. @item planes
  10767. Set which planes will be processed as bitmap, unprocessed planes will be
  10768. copied from first stream.
  10769. By default value 0xf, all planes will be processed.
  10770. @end table
  10771. @subsection Commands
  10772. This filter supports the all above options as @ref{commands}.
  10773. @section maskedmax
  10774. Merge the second and third input stream into output stream using absolute differences
  10775. between second input stream and first input stream and absolute difference between
  10776. third input stream and first input stream. The picked value will be from second input
  10777. stream if second absolute difference is greater than first one or from third input stream
  10778. otherwise.
  10779. This filter accepts the following options:
  10780. @table @option
  10781. @item planes
  10782. Set which planes will be processed as bitmap, unprocessed planes will be
  10783. copied from first stream.
  10784. By default value 0xf, all planes will be processed.
  10785. @end table
  10786. @subsection Commands
  10787. This filter supports the all above options as @ref{commands}.
  10788. @section maskedmerge
  10789. Merge the first input stream with the second input stream using per pixel
  10790. weights in the third input stream.
  10791. A value of 0 in the third stream pixel component means that pixel component
  10792. from first stream is returned unchanged, while maximum value (eg. 255 for
  10793. 8-bit videos) means that pixel component from second stream is returned
  10794. unchanged. Intermediate values define the amount of merging between both
  10795. input stream's pixel components.
  10796. This filter accepts the following options:
  10797. @table @option
  10798. @item planes
  10799. Set which planes will be processed as bitmap, unprocessed planes will be
  10800. copied from first stream.
  10801. By default value 0xf, all planes will be processed.
  10802. @end table
  10803. @subsection Commands
  10804. This filter supports the all above options as @ref{commands}.
  10805. @section maskedmin
  10806. Merge the second and third input stream into output stream using absolute differences
  10807. between second input stream and first input stream and absolute difference between
  10808. third input stream and first input stream. The picked value will be from second input
  10809. stream if second absolute difference is less than first one or from third input stream
  10810. otherwise.
  10811. This filter accepts the following options:
  10812. @table @option
  10813. @item planes
  10814. Set which planes will be processed as bitmap, unprocessed planes will be
  10815. copied from first stream.
  10816. By default value 0xf, all planes will be processed.
  10817. @end table
  10818. @subsection Commands
  10819. This filter supports the all above options as @ref{commands}.
  10820. @section maskedthreshold
  10821. Pick pixels comparing absolute difference of two video streams with fixed
  10822. threshold.
  10823. If absolute difference between pixel component of first and second video
  10824. stream is equal or lower than user supplied threshold than pixel component
  10825. from first video stream is picked, otherwise pixel component from second
  10826. video stream is picked.
  10827. This filter accepts the following options:
  10828. @table @option
  10829. @item threshold
  10830. Set threshold used when picking pixels from absolute difference from two input
  10831. video streams.
  10832. @item planes
  10833. Set which planes will be processed as bitmap, unprocessed planes will be
  10834. copied from second stream.
  10835. By default value 0xf, all planes will be processed.
  10836. @end table
  10837. @subsection Commands
  10838. This filter supports the all above options as @ref{commands}.
  10839. @section maskfun
  10840. Create mask from input video.
  10841. For example it is useful to create motion masks after @code{tblend} filter.
  10842. This filter accepts the following options:
  10843. @table @option
  10844. @item low
  10845. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10846. @item high
  10847. Set high threshold. Any pixel component higher than this value will be set to max value
  10848. allowed for current pixel format.
  10849. @item planes
  10850. Set planes to filter, by default all available planes are filtered.
  10851. @item fill
  10852. Fill all frame pixels with this value.
  10853. @item sum
  10854. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10855. average, output frame will be completely filled with value set by @var{fill} option.
  10856. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10857. @end table
  10858. @section mcdeint
  10859. Apply motion-compensation deinterlacing.
  10860. It needs one field per frame as input and must thus be used together
  10861. with yadif=1/3 or equivalent.
  10862. This filter accepts the following options:
  10863. @table @option
  10864. @item mode
  10865. Set the deinterlacing mode.
  10866. It accepts one of the following values:
  10867. @table @samp
  10868. @item fast
  10869. @item medium
  10870. @item slow
  10871. use iterative motion estimation
  10872. @item extra_slow
  10873. like @samp{slow}, but use multiple reference frames.
  10874. @end table
  10875. Default value is @samp{fast}.
  10876. @item parity
  10877. Set the picture field parity assumed for the input video. It must be
  10878. one of the following values:
  10879. @table @samp
  10880. @item 0, tff
  10881. assume top field first
  10882. @item 1, bff
  10883. assume bottom field first
  10884. @end table
  10885. Default value is @samp{bff}.
  10886. @item qp
  10887. Set per-block quantization parameter (QP) used by the internal
  10888. encoder.
  10889. Higher values should result in a smoother motion vector field but less
  10890. optimal individual vectors. Default value is 1.
  10891. @end table
  10892. @section median
  10893. Pick median pixel from certain rectangle defined by radius.
  10894. This filter accepts the following options:
  10895. @table @option
  10896. @item radius
  10897. Set horizontal radius size. Default value is @code{1}.
  10898. Allowed range is integer from 1 to 127.
  10899. @item planes
  10900. Set which planes to process. Default is @code{15}, which is all available planes.
  10901. @item radiusV
  10902. Set vertical radius size. Default value is @code{0}.
  10903. Allowed range is integer from 0 to 127.
  10904. If it is 0, value will be picked from horizontal @code{radius} option.
  10905. @item percentile
  10906. Set median percentile. Default value is @code{0.5}.
  10907. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10908. minimum values, and @code{1} maximum values.
  10909. @end table
  10910. @subsection Commands
  10911. This filter supports same @ref{commands} as options.
  10912. The command accepts the same syntax of the corresponding option.
  10913. If the specified expression is not valid, it is kept at its current
  10914. value.
  10915. @section mergeplanes
  10916. Merge color channel components from several video streams.
  10917. The filter accepts up to 4 input streams, and merge selected input
  10918. planes to the output video.
  10919. This filter accepts the following options:
  10920. @table @option
  10921. @item mapping
  10922. Set input to output plane mapping. Default is @code{0}.
  10923. The mappings is specified as a bitmap. It should be specified as a
  10924. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10925. mapping for the first plane of the output stream. 'A' sets the number of
  10926. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10927. corresponding input to use (from 0 to 3). The rest of the mappings is
  10928. similar, 'Bb' describes the mapping for the output stream second
  10929. plane, 'Cc' describes the mapping for the output stream third plane and
  10930. 'Dd' describes the mapping for the output stream fourth plane.
  10931. @item format
  10932. Set output pixel format. Default is @code{yuva444p}.
  10933. @end table
  10934. @subsection Examples
  10935. @itemize
  10936. @item
  10937. Merge three gray video streams of same width and height into single video stream:
  10938. @example
  10939. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10940. @end example
  10941. @item
  10942. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10943. @example
  10944. [a0][a1]mergeplanes=0x00010210:yuva444p
  10945. @end example
  10946. @item
  10947. Swap Y and A plane in yuva444p stream:
  10948. @example
  10949. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10950. @end example
  10951. @item
  10952. Swap U and V plane in yuv420p stream:
  10953. @example
  10954. format=yuv420p,mergeplanes=0x000201:yuv420p
  10955. @end example
  10956. @item
  10957. Cast a rgb24 clip to yuv444p:
  10958. @example
  10959. format=rgb24,mergeplanes=0x000102:yuv444p
  10960. @end example
  10961. @end itemize
  10962. @section mestimate
  10963. Estimate and export motion vectors using block matching algorithms.
  10964. Motion vectors are stored in frame side data to be used by other filters.
  10965. This filter accepts the following options:
  10966. @table @option
  10967. @item method
  10968. Specify the motion estimation method. Accepts one of the following values:
  10969. @table @samp
  10970. @item esa
  10971. Exhaustive search algorithm.
  10972. @item tss
  10973. Three step search algorithm.
  10974. @item tdls
  10975. Two dimensional logarithmic search algorithm.
  10976. @item ntss
  10977. New three step search algorithm.
  10978. @item fss
  10979. Four step search algorithm.
  10980. @item ds
  10981. Diamond search algorithm.
  10982. @item hexbs
  10983. Hexagon-based search algorithm.
  10984. @item epzs
  10985. Enhanced predictive zonal search algorithm.
  10986. @item umh
  10987. Uneven multi-hexagon search algorithm.
  10988. @end table
  10989. Default value is @samp{esa}.
  10990. @item mb_size
  10991. Macroblock size. Default @code{16}.
  10992. @item search_param
  10993. Search parameter. Default @code{7}.
  10994. @end table
  10995. @section midequalizer
  10996. Apply Midway Image Equalization effect using two video streams.
  10997. Midway Image Equalization adjusts a pair of images to have the same
  10998. histogram, while maintaining their dynamics as much as possible. It's
  10999. useful for e.g. matching exposures from a pair of stereo cameras.
  11000. This filter has two inputs and one output, which must be of same pixel format, but
  11001. may be of different sizes. The output of filter is first input adjusted with
  11002. midway histogram of both inputs.
  11003. This filter accepts the following option:
  11004. @table @option
  11005. @item planes
  11006. Set which planes to process. Default is @code{15}, which is all available planes.
  11007. @end table
  11008. @section minterpolate
  11009. Convert the video to specified frame rate using motion interpolation.
  11010. This filter accepts the following options:
  11011. @table @option
  11012. @item fps
  11013. 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}.
  11014. @item mi_mode
  11015. Motion interpolation mode. Following values are accepted:
  11016. @table @samp
  11017. @item dup
  11018. Duplicate previous or next frame for interpolating new ones.
  11019. @item blend
  11020. Blend source frames. Interpolated frame is mean of previous and next frames.
  11021. @item mci
  11022. Motion compensated interpolation. Following options are effective when this mode is selected:
  11023. @table @samp
  11024. @item mc_mode
  11025. Motion compensation mode. Following values are accepted:
  11026. @table @samp
  11027. @item obmc
  11028. Overlapped block motion compensation.
  11029. @item aobmc
  11030. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  11031. @end table
  11032. Default mode is @samp{obmc}.
  11033. @item me_mode
  11034. Motion estimation mode. Following values are accepted:
  11035. @table @samp
  11036. @item bidir
  11037. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  11038. @item bilat
  11039. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  11040. @end table
  11041. Default mode is @samp{bilat}.
  11042. @item me
  11043. The algorithm to be used for motion estimation. Following values are accepted:
  11044. @table @samp
  11045. @item esa
  11046. Exhaustive search algorithm.
  11047. @item tss
  11048. Three step search algorithm.
  11049. @item tdls
  11050. Two dimensional logarithmic search algorithm.
  11051. @item ntss
  11052. New three step search algorithm.
  11053. @item fss
  11054. Four step search algorithm.
  11055. @item ds
  11056. Diamond search algorithm.
  11057. @item hexbs
  11058. Hexagon-based search algorithm.
  11059. @item epzs
  11060. Enhanced predictive zonal search algorithm.
  11061. @item umh
  11062. Uneven multi-hexagon search algorithm.
  11063. @end table
  11064. Default algorithm is @samp{epzs}.
  11065. @item mb_size
  11066. Macroblock size. Default @code{16}.
  11067. @item search_param
  11068. Motion estimation search parameter. Default @code{32}.
  11069. @item vsbmc
  11070. 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).
  11071. @end table
  11072. @end table
  11073. @item scd
  11074. 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:
  11075. @table @samp
  11076. @item none
  11077. Disable scene change detection.
  11078. @item fdiff
  11079. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  11080. @end table
  11081. Default method is @samp{fdiff}.
  11082. @item scd_threshold
  11083. Scene change detection threshold. Default is @code{10.}.
  11084. @end table
  11085. @section mix
  11086. Mix several video input streams into one video stream.
  11087. A description of the accepted options follows.
  11088. @table @option
  11089. @item nb_inputs
  11090. The number of inputs. If unspecified, it defaults to 2.
  11091. @item weights
  11092. Specify weight of each input video stream as sequence.
  11093. Each weight is separated by space. If number of weights
  11094. is smaller than number of @var{frames} last specified
  11095. weight will be used for all remaining unset weights.
  11096. @item scale
  11097. Specify scale, if it is set it will be multiplied with sum
  11098. of each weight multiplied with pixel values to give final destination
  11099. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11100. @item duration
  11101. Specify how end of stream is determined.
  11102. @table @samp
  11103. @item longest
  11104. The duration of the longest input. (default)
  11105. @item shortest
  11106. The duration of the shortest input.
  11107. @item first
  11108. The duration of the first input.
  11109. @end table
  11110. @end table
  11111. @section mpdecimate
  11112. Drop frames that do not differ greatly from the previous frame in
  11113. order to reduce frame rate.
  11114. The main use of this filter is for very-low-bitrate encoding
  11115. (e.g. streaming over dialup modem), but it could in theory be used for
  11116. fixing movies that were inverse-telecined incorrectly.
  11117. A description of the accepted options follows.
  11118. @table @option
  11119. @item max
  11120. Set the maximum number of consecutive frames which can be dropped (if
  11121. positive), or the minimum interval between dropped frames (if
  11122. negative). If the value is 0, the frame is dropped disregarding the
  11123. number of previous sequentially dropped frames.
  11124. Default value is 0.
  11125. @item hi
  11126. @item lo
  11127. @item frac
  11128. Set the dropping threshold values.
  11129. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  11130. represent actual pixel value differences, so a threshold of 64
  11131. corresponds to 1 unit of difference for each pixel, or the same spread
  11132. out differently over the block.
  11133. A frame is a candidate for dropping if no 8x8 blocks differ by more
  11134. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  11135. meaning the whole image) differ by more than a threshold of @option{lo}.
  11136. Default value for @option{hi} is 64*12, default value for @option{lo} is
  11137. 64*5, and default value for @option{frac} is 0.33.
  11138. @end table
  11139. @section negate
  11140. Negate (invert) the input video.
  11141. It accepts the following option:
  11142. @table @option
  11143. @item negate_alpha
  11144. With value 1, it negates the alpha component, if present. Default value is 0.
  11145. @end table
  11146. @anchor{nlmeans}
  11147. @section nlmeans
  11148. Denoise frames using Non-Local Means algorithm.
  11149. Each pixel is adjusted by looking for other pixels with similar contexts. This
  11150. context similarity is defined by comparing their surrounding patches of size
  11151. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  11152. around the pixel.
  11153. Note that the research area defines centers for patches, which means some
  11154. patches will be made of pixels outside that research area.
  11155. The filter accepts the following options.
  11156. @table @option
  11157. @item s
  11158. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  11159. @item p
  11160. Set patch size. Default is 7. Must be odd number in range [0, 99].
  11161. @item pc
  11162. Same as @option{p} but for chroma planes.
  11163. The default value is @var{0} and means automatic.
  11164. @item r
  11165. Set research size. Default is 15. Must be odd number in range [0, 99].
  11166. @item rc
  11167. Same as @option{r} but for chroma planes.
  11168. The default value is @var{0} and means automatic.
  11169. @end table
  11170. @section nnedi
  11171. Deinterlace video using neural network edge directed interpolation.
  11172. This filter accepts the following options:
  11173. @table @option
  11174. @item weights
  11175. Mandatory option, without binary file filter can not work.
  11176. Currently file can be found here:
  11177. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  11178. @item deint
  11179. Set which frames to deinterlace, by default it is @code{all}.
  11180. Can be @code{all} or @code{interlaced}.
  11181. @item field
  11182. Set mode of operation.
  11183. Can be one of the following:
  11184. @table @samp
  11185. @item af
  11186. Use frame flags, both fields.
  11187. @item a
  11188. Use frame flags, single field.
  11189. @item t
  11190. Use top field only.
  11191. @item b
  11192. Use bottom field only.
  11193. @item tf
  11194. Use both fields, top first.
  11195. @item bf
  11196. Use both fields, bottom first.
  11197. @end table
  11198. @item planes
  11199. Set which planes to process, by default filter process all frames.
  11200. @item nsize
  11201. Set size of local neighborhood around each pixel, used by the predictor neural
  11202. network.
  11203. Can be one of the following:
  11204. @table @samp
  11205. @item s8x6
  11206. @item s16x6
  11207. @item s32x6
  11208. @item s48x6
  11209. @item s8x4
  11210. @item s16x4
  11211. @item s32x4
  11212. @end table
  11213. @item nns
  11214. Set the number of neurons in predictor neural network.
  11215. Can be one of the following:
  11216. @table @samp
  11217. @item n16
  11218. @item n32
  11219. @item n64
  11220. @item n128
  11221. @item n256
  11222. @end table
  11223. @item qual
  11224. Controls the number of different neural network predictions that are blended
  11225. together to compute the final output value. Can be @code{fast}, default or
  11226. @code{slow}.
  11227. @item etype
  11228. Set which set of weights to use in the predictor.
  11229. Can be one of the following:
  11230. @table @samp
  11231. @item a, abs
  11232. weights trained to minimize absolute error
  11233. @item s, mse
  11234. weights trained to minimize squared error
  11235. @end table
  11236. @item pscrn
  11237. Controls whether or not the prescreener neural network is used to decide
  11238. which pixels should be processed by the predictor neural network and which
  11239. can be handled by simple cubic interpolation.
  11240. The prescreener is trained to know whether cubic interpolation will be
  11241. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11242. The computational complexity of the prescreener nn is much less than that of
  11243. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11244. using the prescreener generally results in much faster processing.
  11245. The prescreener is pretty accurate, so the difference between using it and not
  11246. using it is almost always unnoticeable.
  11247. Can be one of the following:
  11248. @table @samp
  11249. @item none
  11250. @item original
  11251. @item new
  11252. @item new2
  11253. @item new3
  11254. @end table
  11255. Default is @code{new}.
  11256. @end table
  11257. @subsection Commands
  11258. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  11259. @section noformat
  11260. Force libavfilter not to use any of the specified pixel formats for the
  11261. input to the next filter.
  11262. It accepts the following parameters:
  11263. @table @option
  11264. @item pix_fmts
  11265. A '|'-separated list of pixel format names, such as
  11266. pix_fmts=yuv420p|monow|rgb24".
  11267. @end table
  11268. @subsection Examples
  11269. @itemize
  11270. @item
  11271. Force libavfilter to use a format different from @var{yuv420p} for the
  11272. input to the vflip filter:
  11273. @example
  11274. noformat=pix_fmts=yuv420p,vflip
  11275. @end example
  11276. @item
  11277. Convert the input video to any of the formats not contained in the list:
  11278. @example
  11279. noformat=yuv420p|yuv444p|yuv410p
  11280. @end example
  11281. @end itemize
  11282. @section noise
  11283. Add noise on video input frame.
  11284. The filter accepts the following options:
  11285. @table @option
  11286. @item all_seed
  11287. @item c0_seed
  11288. @item c1_seed
  11289. @item c2_seed
  11290. @item c3_seed
  11291. Set noise seed for specific pixel component or all pixel components in case
  11292. of @var{all_seed}. Default value is @code{123457}.
  11293. @item all_strength, alls
  11294. @item c0_strength, c0s
  11295. @item c1_strength, c1s
  11296. @item c2_strength, c2s
  11297. @item c3_strength, c3s
  11298. Set noise strength for specific pixel component or all pixel components in case
  11299. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11300. @item all_flags, allf
  11301. @item c0_flags, c0f
  11302. @item c1_flags, c1f
  11303. @item c2_flags, c2f
  11304. @item c3_flags, c3f
  11305. Set pixel component flags or set flags for all components if @var{all_flags}.
  11306. Available values for component flags are:
  11307. @table @samp
  11308. @item a
  11309. averaged temporal noise (smoother)
  11310. @item p
  11311. mix random noise with a (semi)regular pattern
  11312. @item t
  11313. temporal noise (noise pattern changes between frames)
  11314. @item u
  11315. uniform noise (gaussian otherwise)
  11316. @end table
  11317. @end table
  11318. @subsection Examples
  11319. Add temporal and uniform noise to input video:
  11320. @example
  11321. noise=alls=20:allf=t+u
  11322. @end example
  11323. @section normalize
  11324. Normalize RGB video (aka histogram stretching, contrast stretching).
  11325. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11326. For each channel of each frame, the filter computes the input range and maps
  11327. it linearly to the user-specified output range. The output range defaults
  11328. to the full dynamic range from pure black to pure white.
  11329. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11330. changes in brightness) caused when small dark or bright objects enter or leave
  11331. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11332. video camera, and, like a video camera, it may cause a period of over- or
  11333. under-exposure of the video.
  11334. The R,G,B channels can be normalized independently, which may cause some
  11335. color shifting, or linked together as a single channel, which prevents
  11336. color shifting. Linked normalization preserves hue. Independent normalization
  11337. does not, so it can be used to remove some color casts. Independent and linked
  11338. normalization can be combined in any ratio.
  11339. The normalize filter accepts the following options:
  11340. @table @option
  11341. @item blackpt
  11342. @item whitept
  11343. Colors which define the output range. The minimum input value is mapped to
  11344. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11345. The defaults are black and white respectively. Specifying white for
  11346. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11347. normalized video. Shades of grey can be used to reduce the dynamic range
  11348. (contrast). Specifying saturated colors here can create some interesting
  11349. effects.
  11350. @item smoothing
  11351. The number of previous frames to use for temporal smoothing. The input range
  11352. of each channel is smoothed using a rolling average over the current frame
  11353. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11354. smoothing).
  11355. @item independence
  11356. Controls the ratio of independent (color shifting) channel normalization to
  11357. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11358. independent. Defaults to 1.0 (fully independent).
  11359. @item strength
  11360. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11361. expensive no-op. Defaults to 1.0 (full strength).
  11362. @end table
  11363. @subsection Commands
  11364. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11365. The command accepts the same syntax of the corresponding option.
  11366. If the specified expression is not valid, it is kept at its current
  11367. value.
  11368. @subsection Examples
  11369. Stretch video contrast to use the full dynamic range, with no temporal
  11370. smoothing; may flicker depending on the source content:
  11371. @example
  11372. normalize=blackpt=black:whitept=white:smoothing=0
  11373. @end example
  11374. As above, but with 50 frames of temporal smoothing; flicker should be
  11375. reduced, depending on the source content:
  11376. @example
  11377. normalize=blackpt=black:whitept=white:smoothing=50
  11378. @end example
  11379. As above, but with hue-preserving linked channel normalization:
  11380. @example
  11381. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11382. @end example
  11383. As above, but with half strength:
  11384. @example
  11385. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11386. @end example
  11387. Map the darkest input color to red, the brightest input color to cyan:
  11388. @example
  11389. normalize=blackpt=red:whitept=cyan
  11390. @end example
  11391. @section null
  11392. Pass the video source unchanged to the output.
  11393. @section ocr
  11394. Optical Character Recognition
  11395. This filter uses Tesseract for optical character recognition. To enable
  11396. compilation of this filter, you need to configure FFmpeg with
  11397. @code{--enable-libtesseract}.
  11398. It accepts the following options:
  11399. @table @option
  11400. @item datapath
  11401. Set datapath to tesseract data. Default is to use whatever was
  11402. set at installation.
  11403. @item language
  11404. Set language, default is "eng".
  11405. @item whitelist
  11406. Set character whitelist.
  11407. @item blacklist
  11408. Set character blacklist.
  11409. @end table
  11410. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11411. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11412. @section ocv
  11413. Apply a video transform using libopencv.
  11414. To enable this filter, install the libopencv library and headers and
  11415. configure FFmpeg with @code{--enable-libopencv}.
  11416. It accepts the following parameters:
  11417. @table @option
  11418. @item filter_name
  11419. The name of the libopencv filter to apply.
  11420. @item filter_params
  11421. The parameters to pass to the libopencv filter. If not specified, the default
  11422. values are assumed.
  11423. @end table
  11424. Refer to the official libopencv documentation for more precise
  11425. information:
  11426. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11427. Several libopencv filters are supported; see the following subsections.
  11428. @anchor{dilate}
  11429. @subsection dilate
  11430. Dilate an image by using a specific structuring element.
  11431. It corresponds to the libopencv function @code{cvDilate}.
  11432. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11433. @var{struct_el} represents a structuring element, and has the syntax:
  11434. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11435. @var{cols} and @var{rows} represent the number of columns and rows of
  11436. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11437. point, and @var{shape} the shape for the structuring element. @var{shape}
  11438. must be "rect", "cross", "ellipse", or "custom".
  11439. If the value for @var{shape} is "custom", it must be followed by a
  11440. string of the form "=@var{filename}". The file with name
  11441. @var{filename} is assumed to represent a binary image, with each
  11442. printable character corresponding to a bright pixel. When a custom
  11443. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11444. or columns and rows of the read file are assumed instead.
  11445. The default value for @var{struct_el} is "3x3+0x0/rect".
  11446. @var{nb_iterations} specifies the number of times the transform is
  11447. applied to the image, and defaults to 1.
  11448. Some examples:
  11449. @example
  11450. # Use the default values
  11451. ocv=dilate
  11452. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11453. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11454. # Read the shape from the file diamond.shape, iterating two times.
  11455. # The file diamond.shape may contain a pattern of characters like this
  11456. # *
  11457. # ***
  11458. # *****
  11459. # ***
  11460. # *
  11461. # The specified columns and rows are ignored
  11462. # but the anchor point coordinates are not
  11463. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11464. @end example
  11465. @subsection erode
  11466. Erode an image by using a specific structuring element.
  11467. It corresponds to the libopencv function @code{cvErode}.
  11468. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11469. with the same syntax and semantics as the @ref{dilate} filter.
  11470. @subsection smooth
  11471. Smooth the input video.
  11472. The filter takes the following parameters:
  11473. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11474. @var{type} is the type of smooth filter to apply, and must be one of
  11475. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11476. or "bilateral". The default value is "gaussian".
  11477. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11478. depends on the smooth type. @var{param1} and
  11479. @var{param2} accept integer positive values or 0. @var{param3} and
  11480. @var{param4} accept floating point values.
  11481. The default value for @var{param1} is 3. The default value for the
  11482. other parameters is 0.
  11483. These parameters correspond to the parameters assigned to the
  11484. libopencv function @code{cvSmooth}.
  11485. @section oscilloscope
  11486. 2D Video Oscilloscope.
  11487. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11488. It accepts the following parameters:
  11489. @table @option
  11490. @item x
  11491. Set scope center x position.
  11492. @item y
  11493. Set scope center y position.
  11494. @item s
  11495. Set scope size, relative to frame diagonal.
  11496. @item t
  11497. Set scope tilt/rotation.
  11498. @item o
  11499. Set trace opacity.
  11500. @item tx
  11501. Set trace center x position.
  11502. @item ty
  11503. Set trace center y position.
  11504. @item tw
  11505. Set trace width, relative to width of frame.
  11506. @item th
  11507. Set trace height, relative to height of frame.
  11508. @item c
  11509. Set which components to trace. By default it traces first three components.
  11510. @item g
  11511. Draw trace grid. By default is enabled.
  11512. @item st
  11513. Draw some statistics. By default is enabled.
  11514. @item sc
  11515. Draw scope. By default is enabled.
  11516. @end table
  11517. @subsection Commands
  11518. This filter supports same @ref{commands} as options.
  11519. The command accepts the same syntax of the corresponding option.
  11520. If the specified expression is not valid, it is kept at its current
  11521. value.
  11522. @subsection Examples
  11523. @itemize
  11524. @item
  11525. Inspect full first row of video frame.
  11526. @example
  11527. oscilloscope=x=0.5:y=0:s=1
  11528. @end example
  11529. @item
  11530. Inspect full last row of video frame.
  11531. @example
  11532. oscilloscope=x=0.5:y=1:s=1
  11533. @end example
  11534. @item
  11535. Inspect full 5th line of video frame of height 1080.
  11536. @example
  11537. oscilloscope=x=0.5:y=5/1080:s=1
  11538. @end example
  11539. @item
  11540. Inspect full last column of video frame.
  11541. @example
  11542. oscilloscope=x=1:y=0.5:s=1:t=1
  11543. @end example
  11544. @end itemize
  11545. @anchor{overlay}
  11546. @section overlay
  11547. Overlay one video on top of another.
  11548. It takes two inputs and has one output. The first input is the "main"
  11549. video on which the second input is overlaid.
  11550. It accepts the following parameters:
  11551. A description of the accepted options follows.
  11552. @table @option
  11553. @item x
  11554. @item y
  11555. Set the expression for the x and y coordinates of the overlaid video
  11556. on the main video. Default value is "0" for both expressions. In case
  11557. the expression is invalid, it is set to a huge value (meaning that the
  11558. overlay will not be displayed within the output visible area).
  11559. @item eof_action
  11560. See @ref{framesync}.
  11561. @item eval
  11562. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11563. It accepts the following values:
  11564. @table @samp
  11565. @item init
  11566. only evaluate expressions once during the filter initialization or
  11567. when a command is processed
  11568. @item frame
  11569. evaluate expressions for each incoming frame
  11570. @end table
  11571. Default value is @samp{frame}.
  11572. @item shortest
  11573. See @ref{framesync}.
  11574. @item format
  11575. Set the format for the output video.
  11576. It accepts the following values:
  11577. @table @samp
  11578. @item yuv420
  11579. force YUV420 output
  11580. @item yuv420p10
  11581. force YUV420p10 output
  11582. @item yuv422
  11583. force YUV422 output
  11584. @item yuv422p10
  11585. force YUV422p10 output
  11586. @item yuv444
  11587. force YUV444 output
  11588. @item rgb
  11589. force packed RGB output
  11590. @item gbrp
  11591. force planar RGB output
  11592. @item auto
  11593. automatically pick format
  11594. @end table
  11595. Default value is @samp{yuv420}.
  11596. @item repeatlast
  11597. See @ref{framesync}.
  11598. @item alpha
  11599. Set format of alpha of the overlaid video, it can be @var{straight} or
  11600. @var{premultiplied}. Default is @var{straight}.
  11601. @end table
  11602. The @option{x}, and @option{y} expressions can contain the following
  11603. parameters.
  11604. @table @option
  11605. @item main_w, W
  11606. @item main_h, H
  11607. The main input width and height.
  11608. @item overlay_w, w
  11609. @item overlay_h, h
  11610. The overlay input width and height.
  11611. @item x
  11612. @item y
  11613. The computed values for @var{x} and @var{y}. They are evaluated for
  11614. each new frame.
  11615. @item hsub
  11616. @item vsub
  11617. horizontal and vertical chroma subsample values of the output
  11618. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11619. @var{vsub} is 1.
  11620. @item n
  11621. the number of input frame, starting from 0
  11622. @item pos
  11623. the position in the file of the input frame, NAN if unknown
  11624. @item t
  11625. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11626. @end table
  11627. This filter also supports the @ref{framesync} options.
  11628. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11629. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11630. when @option{eval} is set to @samp{init}.
  11631. Be aware that frames are taken from each input video in timestamp
  11632. order, hence, if their initial timestamps differ, it is a good idea
  11633. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11634. have them begin in the same zero timestamp, as the example for
  11635. the @var{movie} filter does.
  11636. You can chain together more overlays but you should test the
  11637. efficiency of such approach.
  11638. @subsection Commands
  11639. This filter supports the following commands:
  11640. @table @option
  11641. @item x
  11642. @item y
  11643. Modify the x and y of the overlay input.
  11644. The command accepts the same syntax of the corresponding option.
  11645. If the specified expression is not valid, it is kept at its current
  11646. value.
  11647. @end table
  11648. @subsection Examples
  11649. @itemize
  11650. @item
  11651. Draw the overlay at 10 pixels from the bottom right corner of the main
  11652. video:
  11653. @example
  11654. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11655. @end example
  11656. Using named options the example above becomes:
  11657. @example
  11658. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11659. @end example
  11660. @item
  11661. Insert a transparent PNG logo in the bottom left corner of the input,
  11662. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11663. @example
  11664. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11665. @end example
  11666. @item
  11667. Insert 2 different transparent PNG logos (second logo on bottom
  11668. right corner) using the @command{ffmpeg} tool:
  11669. @example
  11670. 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
  11671. @end example
  11672. @item
  11673. Add a transparent color layer on top of the main video; @code{WxH}
  11674. must specify the size of the main input to the overlay filter:
  11675. @example
  11676. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11677. @end example
  11678. @item
  11679. Play an original video and a filtered version (here with the deshake
  11680. filter) side by side using the @command{ffplay} tool:
  11681. @example
  11682. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11683. @end example
  11684. The above command is the same as:
  11685. @example
  11686. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11687. @end example
  11688. @item
  11689. Make a sliding overlay appearing from the left to the right top part of the
  11690. screen starting since time 2:
  11691. @example
  11692. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11693. @end example
  11694. @item
  11695. Compose output by putting two input videos side to side:
  11696. @example
  11697. ffmpeg -i left.avi -i right.avi -filter_complex "
  11698. nullsrc=size=200x100 [background];
  11699. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11700. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11701. [background][left] overlay=shortest=1 [background+left];
  11702. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11703. "
  11704. @end example
  11705. @item
  11706. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11707. @example
  11708. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11709. -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]'
  11710. masked.avi
  11711. @end example
  11712. @item
  11713. Chain several overlays in cascade:
  11714. @example
  11715. nullsrc=s=200x200 [bg];
  11716. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11717. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11718. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11719. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11720. [in3] null, [mid2] overlay=100:100 [out0]
  11721. @end example
  11722. @end itemize
  11723. @anchor{overlay_cuda}
  11724. @section overlay_cuda
  11725. Overlay one video on top of another.
  11726. This is the CUDA variant of the @ref{overlay} filter.
  11727. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11728. It takes two inputs and has one output. The first input is the "main"
  11729. video on which the second input is overlaid.
  11730. It accepts the following parameters:
  11731. @table @option
  11732. @item x
  11733. @item y
  11734. Set the x and y coordinates of the overlaid video on the main video.
  11735. Default value is "0" for both expressions.
  11736. @item eof_action
  11737. See @ref{framesync}.
  11738. @item shortest
  11739. See @ref{framesync}.
  11740. @item repeatlast
  11741. See @ref{framesync}.
  11742. @end table
  11743. This filter also supports the @ref{framesync} options.
  11744. @section owdenoise
  11745. Apply Overcomplete Wavelet denoiser.
  11746. The filter accepts the following options:
  11747. @table @option
  11748. @item depth
  11749. Set depth.
  11750. Larger depth values will denoise lower frequency components more, but
  11751. slow down filtering.
  11752. Must be an int in the range 8-16, default is @code{8}.
  11753. @item luma_strength, ls
  11754. Set luma strength.
  11755. Must be a double value in the range 0-1000, default is @code{1.0}.
  11756. @item chroma_strength, cs
  11757. Set chroma strength.
  11758. Must be a double value in the range 0-1000, default is @code{1.0}.
  11759. @end table
  11760. @anchor{pad}
  11761. @section pad
  11762. Add paddings to the input image, and place the original input at the
  11763. provided @var{x}, @var{y} coordinates.
  11764. It accepts the following parameters:
  11765. @table @option
  11766. @item width, w
  11767. @item height, h
  11768. Specify an expression for the size of the output image with the
  11769. paddings added. If the value for @var{width} or @var{height} is 0, the
  11770. corresponding input size is used for the output.
  11771. The @var{width} expression can reference the value set by the
  11772. @var{height} expression, and vice versa.
  11773. The default value of @var{width} and @var{height} is 0.
  11774. @item x
  11775. @item y
  11776. Specify the offsets to place the input image at within the padded area,
  11777. with respect to the top/left border of the output image.
  11778. The @var{x} expression can reference the value set by the @var{y}
  11779. expression, and vice versa.
  11780. The default value of @var{x} and @var{y} is 0.
  11781. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11782. so the input image is centered on the padded area.
  11783. @item color
  11784. Specify the color of the padded area. For the syntax of this option,
  11785. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11786. manual,ffmpeg-utils}.
  11787. The default value of @var{color} is "black".
  11788. @item eval
  11789. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11790. It accepts the following values:
  11791. @table @samp
  11792. @item init
  11793. Only evaluate expressions once during the filter initialization or when
  11794. a command is processed.
  11795. @item frame
  11796. Evaluate expressions for each incoming frame.
  11797. @end table
  11798. Default value is @samp{init}.
  11799. @item aspect
  11800. Pad to aspect instead to a resolution.
  11801. @end table
  11802. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11803. options are expressions containing the following constants:
  11804. @table @option
  11805. @item in_w
  11806. @item in_h
  11807. The input video width and height.
  11808. @item iw
  11809. @item ih
  11810. These are the same as @var{in_w} and @var{in_h}.
  11811. @item out_w
  11812. @item out_h
  11813. The output width and height (the size of the padded area), as
  11814. specified by the @var{width} and @var{height} expressions.
  11815. @item ow
  11816. @item oh
  11817. These are the same as @var{out_w} and @var{out_h}.
  11818. @item x
  11819. @item y
  11820. The x and y offsets as specified by the @var{x} and @var{y}
  11821. expressions, or NAN if not yet specified.
  11822. @item a
  11823. same as @var{iw} / @var{ih}
  11824. @item sar
  11825. input sample aspect ratio
  11826. @item dar
  11827. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11828. @item hsub
  11829. @item vsub
  11830. The horizontal and vertical chroma subsample values. For example for the
  11831. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11832. @end table
  11833. @subsection Examples
  11834. @itemize
  11835. @item
  11836. Add paddings with the color "violet" to the input video. The output video
  11837. size is 640x480, and the top-left corner of the input video is placed at
  11838. column 0, row 40
  11839. @example
  11840. pad=640:480:0:40:violet
  11841. @end example
  11842. The example above is equivalent to the following command:
  11843. @example
  11844. pad=width=640:height=480:x=0:y=40:color=violet
  11845. @end example
  11846. @item
  11847. Pad the input to get an output with dimensions increased by 3/2,
  11848. and put the input video at the center of the padded area:
  11849. @example
  11850. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11851. @end example
  11852. @item
  11853. Pad the input to get a squared output with size equal to the maximum
  11854. value between the input width and height, and put the input video at
  11855. the center of the padded area:
  11856. @example
  11857. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11858. @end example
  11859. @item
  11860. Pad the input to get a final w/h ratio of 16:9:
  11861. @example
  11862. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11863. @end example
  11864. @item
  11865. In case of anamorphic video, in order to set the output display aspect
  11866. correctly, it is necessary to use @var{sar} in the expression,
  11867. according to the relation:
  11868. @example
  11869. (ih * X / ih) * sar = output_dar
  11870. X = output_dar / sar
  11871. @end example
  11872. Thus the previous example needs to be modified to:
  11873. @example
  11874. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11875. @end example
  11876. @item
  11877. Double the output size and put the input video in the bottom-right
  11878. corner of the output padded area:
  11879. @example
  11880. pad="2*iw:2*ih:ow-iw:oh-ih"
  11881. @end example
  11882. @end itemize
  11883. @anchor{palettegen}
  11884. @section palettegen
  11885. Generate one palette for a whole video stream.
  11886. It accepts the following options:
  11887. @table @option
  11888. @item max_colors
  11889. Set the maximum number of colors to quantize in the palette.
  11890. Note: the palette will still contain 256 colors; the unused palette entries
  11891. will be black.
  11892. @item reserve_transparent
  11893. Create a palette of 255 colors maximum and reserve the last one for
  11894. transparency. Reserving the transparency color is useful for GIF optimization.
  11895. If not set, the maximum of colors in the palette will be 256. You probably want
  11896. to disable this option for a standalone image.
  11897. Set by default.
  11898. @item transparency_color
  11899. Set the color that will be used as background for transparency.
  11900. @item stats_mode
  11901. Set statistics mode.
  11902. It accepts the following values:
  11903. @table @samp
  11904. @item full
  11905. Compute full frame histograms.
  11906. @item diff
  11907. Compute histograms only for the part that differs from previous frame. This
  11908. might be relevant to give more importance to the moving part of your input if
  11909. the background is static.
  11910. @item single
  11911. Compute new histogram for each frame.
  11912. @end table
  11913. Default value is @var{full}.
  11914. @end table
  11915. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11916. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11917. color quantization of the palette. This information is also visible at
  11918. @var{info} logging level.
  11919. @subsection Examples
  11920. @itemize
  11921. @item
  11922. Generate a representative palette of a given video using @command{ffmpeg}:
  11923. @example
  11924. ffmpeg -i input.mkv -vf palettegen palette.png
  11925. @end example
  11926. @end itemize
  11927. @section paletteuse
  11928. Use a palette to downsample an input video stream.
  11929. The filter takes two inputs: one video stream and a palette. The palette must
  11930. be a 256 pixels image.
  11931. It accepts the following options:
  11932. @table @option
  11933. @item dither
  11934. Select dithering mode. Available algorithms are:
  11935. @table @samp
  11936. @item bayer
  11937. Ordered 8x8 bayer dithering (deterministic)
  11938. @item heckbert
  11939. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11940. Note: this dithering is sometimes considered "wrong" and is included as a
  11941. reference.
  11942. @item floyd_steinberg
  11943. Floyd and Steingberg dithering (error diffusion)
  11944. @item sierra2
  11945. Frankie Sierra dithering v2 (error diffusion)
  11946. @item sierra2_4a
  11947. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11948. @end table
  11949. Default is @var{sierra2_4a}.
  11950. @item bayer_scale
  11951. When @var{bayer} dithering is selected, this option defines the scale of the
  11952. pattern (how much the crosshatch pattern is visible). A low value means more
  11953. visible pattern for less banding, and higher value means less visible pattern
  11954. at the cost of more banding.
  11955. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11956. @item diff_mode
  11957. If set, define the zone to process
  11958. @table @samp
  11959. @item rectangle
  11960. Only the changing rectangle will be reprocessed. This is similar to GIF
  11961. cropping/offsetting compression mechanism. This option can be useful for speed
  11962. if only a part of the image is changing, and has use cases such as limiting the
  11963. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11964. moving scene (it leads to more deterministic output if the scene doesn't change
  11965. much, and as a result less moving noise and better GIF compression).
  11966. @end table
  11967. Default is @var{none}.
  11968. @item new
  11969. Take new palette for each output frame.
  11970. @item alpha_threshold
  11971. Sets the alpha threshold for transparency. Alpha values above this threshold
  11972. will be treated as completely opaque, and values below this threshold will be
  11973. treated as completely transparent.
  11974. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11975. @end table
  11976. @subsection Examples
  11977. @itemize
  11978. @item
  11979. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11980. using @command{ffmpeg}:
  11981. @example
  11982. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11983. @end example
  11984. @end itemize
  11985. @section perspective
  11986. Correct perspective of video not recorded perpendicular to the screen.
  11987. A description of the accepted parameters follows.
  11988. @table @option
  11989. @item x0
  11990. @item y0
  11991. @item x1
  11992. @item y1
  11993. @item x2
  11994. @item y2
  11995. @item x3
  11996. @item y3
  11997. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11998. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11999. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  12000. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  12001. then the corners of the source will be sent to the specified coordinates.
  12002. The expressions can use the following variables:
  12003. @table @option
  12004. @item W
  12005. @item H
  12006. the width and height of video frame.
  12007. @item in
  12008. Input frame count.
  12009. @item on
  12010. Output frame count.
  12011. @end table
  12012. @item interpolation
  12013. Set interpolation for perspective correction.
  12014. It accepts the following values:
  12015. @table @samp
  12016. @item linear
  12017. @item cubic
  12018. @end table
  12019. Default value is @samp{linear}.
  12020. @item sense
  12021. Set interpretation of coordinate options.
  12022. It accepts the following values:
  12023. @table @samp
  12024. @item 0, source
  12025. Send point in the source specified by the given coordinates to
  12026. the corners of the destination.
  12027. @item 1, destination
  12028. Send the corners of the source to the point in the destination specified
  12029. by the given coordinates.
  12030. Default value is @samp{source}.
  12031. @end table
  12032. @item eval
  12033. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  12034. It accepts the following values:
  12035. @table @samp
  12036. @item init
  12037. only evaluate expressions once during the filter initialization or
  12038. when a command is processed
  12039. @item frame
  12040. evaluate expressions for each incoming frame
  12041. @end table
  12042. Default value is @samp{init}.
  12043. @end table
  12044. @section phase
  12045. Delay interlaced video by one field time so that the field order changes.
  12046. The intended use is to fix PAL movies that have been captured with the
  12047. opposite field order to the film-to-video transfer.
  12048. A description of the accepted parameters follows.
  12049. @table @option
  12050. @item mode
  12051. Set phase mode.
  12052. It accepts the following values:
  12053. @table @samp
  12054. @item t
  12055. Capture field order top-first, transfer bottom-first.
  12056. Filter will delay the bottom field.
  12057. @item b
  12058. Capture field order bottom-first, transfer top-first.
  12059. Filter will delay the top field.
  12060. @item p
  12061. Capture and transfer with the same field order. This mode only exists
  12062. for the documentation of the other options to refer to, but if you
  12063. actually select it, the filter will faithfully do nothing.
  12064. @item a
  12065. Capture field order determined automatically by field flags, transfer
  12066. opposite.
  12067. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  12068. basis using field flags. If no field information is available,
  12069. then this works just like @samp{u}.
  12070. @item u
  12071. Capture unknown or varying, transfer opposite.
  12072. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  12073. analyzing the images and selecting the alternative that produces best
  12074. match between the fields.
  12075. @item T
  12076. Capture top-first, transfer unknown or varying.
  12077. Filter selects among @samp{t} and @samp{p} using image analysis.
  12078. @item B
  12079. Capture bottom-first, transfer unknown or varying.
  12080. Filter selects among @samp{b} and @samp{p} using image analysis.
  12081. @item A
  12082. Capture determined by field flags, transfer unknown or varying.
  12083. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  12084. image analysis. If no field information is available, then this works just
  12085. like @samp{U}. This is the default mode.
  12086. @item U
  12087. Both capture and transfer unknown or varying.
  12088. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  12089. @end table
  12090. @end table
  12091. @subsection Commands
  12092. This filter supports the all above options as @ref{commands}.
  12093. @section photosensitivity
  12094. Reduce various flashes in video, so to help users with epilepsy.
  12095. It accepts the following options:
  12096. @table @option
  12097. @item frames, f
  12098. Set how many frames to use when filtering. Default is 30.
  12099. @item threshold, t
  12100. Set detection threshold factor. Default is 1.
  12101. Lower is stricter.
  12102. @item skip
  12103. Set how many pixels to skip when sampling frames. Default is 1.
  12104. Allowed range is from 1 to 1024.
  12105. @item bypass
  12106. Leave frames unchanged. Default is disabled.
  12107. @end table
  12108. @section pixdesctest
  12109. Pixel format descriptor test filter, mainly useful for internal
  12110. testing. The output video should be equal to the input video.
  12111. For example:
  12112. @example
  12113. format=monow, pixdesctest
  12114. @end example
  12115. can be used to test the monowhite pixel format descriptor definition.
  12116. @section pixscope
  12117. Display sample values of color channels. Mainly useful for checking color
  12118. and levels. Minimum supported resolution is 640x480.
  12119. The filters accept the following options:
  12120. @table @option
  12121. @item x
  12122. Set scope X position, relative offset on X axis.
  12123. @item y
  12124. Set scope Y position, relative offset on Y axis.
  12125. @item w
  12126. Set scope width.
  12127. @item h
  12128. Set scope height.
  12129. @item o
  12130. Set window opacity. This window also holds statistics about pixel area.
  12131. @item wx
  12132. Set window X position, relative offset on X axis.
  12133. @item wy
  12134. Set window Y position, relative offset on Y axis.
  12135. @end table
  12136. @section pp
  12137. Enable the specified chain of postprocessing subfilters using libpostproc. This
  12138. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  12139. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  12140. Each subfilter and some options have a short and a long name that can be used
  12141. interchangeably, i.e. dr/dering are the same.
  12142. The filters accept the following options:
  12143. @table @option
  12144. @item subfilters
  12145. Set postprocessing subfilters string.
  12146. @end table
  12147. All subfilters share common options to determine their scope:
  12148. @table @option
  12149. @item a/autoq
  12150. Honor the quality commands for this subfilter.
  12151. @item c/chrom
  12152. Do chrominance filtering, too (default).
  12153. @item y/nochrom
  12154. Do luminance filtering only (no chrominance).
  12155. @item n/noluma
  12156. Do chrominance filtering only (no luminance).
  12157. @end table
  12158. These options can be appended after the subfilter name, separated by a '|'.
  12159. Available subfilters are:
  12160. @table @option
  12161. @item hb/hdeblock[|difference[|flatness]]
  12162. Horizontal deblocking filter
  12163. @table @option
  12164. @item difference
  12165. Difference factor where higher values mean more deblocking (default: @code{32}).
  12166. @item flatness
  12167. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12168. @end table
  12169. @item vb/vdeblock[|difference[|flatness]]
  12170. Vertical deblocking filter
  12171. @table @option
  12172. @item difference
  12173. Difference factor where higher values mean more deblocking (default: @code{32}).
  12174. @item flatness
  12175. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12176. @end table
  12177. @item ha/hadeblock[|difference[|flatness]]
  12178. Accurate horizontal deblocking filter
  12179. @table @option
  12180. @item difference
  12181. Difference factor where higher values mean more deblocking (default: @code{32}).
  12182. @item flatness
  12183. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12184. @end table
  12185. @item va/vadeblock[|difference[|flatness]]
  12186. Accurate vertical deblocking filter
  12187. @table @option
  12188. @item difference
  12189. Difference factor where higher values mean more deblocking (default: @code{32}).
  12190. @item flatness
  12191. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12192. @end table
  12193. @end table
  12194. The horizontal and vertical deblocking filters share the difference and
  12195. flatness values so you cannot set different horizontal and vertical
  12196. thresholds.
  12197. @table @option
  12198. @item h1/x1hdeblock
  12199. Experimental horizontal deblocking filter
  12200. @item v1/x1vdeblock
  12201. Experimental vertical deblocking filter
  12202. @item dr/dering
  12203. Deringing filter
  12204. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12205. @table @option
  12206. @item threshold1
  12207. larger -> stronger filtering
  12208. @item threshold2
  12209. larger -> stronger filtering
  12210. @item threshold3
  12211. larger -> stronger filtering
  12212. @end table
  12213. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12214. @table @option
  12215. @item f/fullyrange
  12216. Stretch luminance to @code{0-255}.
  12217. @end table
  12218. @item lb/linblenddeint
  12219. Linear blend deinterlacing filter that deinterlaces the given block by
  12220. filtering all lines with a @code{(1 2 1)} filter.
  12221. @item li/linipoldeint
  12222. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12223. linearly interpolating every second line.
  12224. @item ci/cubicipoldeint
  12225. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12226. cubically interpolating every second line.
  12227. @item md/mediandeint
  12228. Median deinterlacing filter that deinterlaces the given block by applying a
  12229. median filter to every second line.
  12230. @item fd/ffmpegdeint
  12231. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12232. second line with a @code{(-1 4 2 4 -1)} filter.
  12233. @item l5/lowpass5
  12234. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12235. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12236. @item fq/forceQuant[|quantizer]
  12237. Overrides the quantizer table from the input with the constant quantizer you
  12238. specify.
  12239. @table @option
  12240. @item quantizer
  12241. Quantizer to use
  12242. @end table
  12243. @item de/default
  12244. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12245. @item fa/fast
  12246. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12247. @item ac
  12248. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12249. @end table
  12250. @subsection Examples
  12251. @itemize
  12252. @item
  12253. Apply horizontal and vertical deblocking, deringing and automatic
  12254. brightness/contrast:
  12255. @example
  12256. pp=hb/vb/dr/al
  12257. @end example
  12258. @item
  12259. Apply default filters without brightness/contrast correction:
  12260. @example
  12261. pp=de/-al
  12262. @end example
  12263. @item
  12264. Apply default filters and temporal denoiser:
  12265. @example
  12266. pp=default/tmpnoise|1|2|3
  12267. @end example
  12268. @item
  12269. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12270. automatically depending on available CPU time:
  12271. @example
  12272. pp=hb|y/vb|a
  12273. @end example
  12274. @end itemize
  12275. @section pp7
  12276. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12277. similar to spp = 6 with 7 point DCT, where only the center sample is
  12278. used after IDCT.
  12279. The filter accepts the following options:
  12280. @table @option
  12281. @item qp
  12282. Force a constant quantization parameter. It accepts an integer in range
  12283. 0 to 63. If not set, the filter will use the QP from the video stream
  12284. (if available).
  12285. @item mode
  12286. Set thresholding mode. Available modes are:
  12287. @table @samp
  12288. @item hard
  12289. Set hard thresholding.
  12290. @item soft
  12291. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12292. @item medium
  12293. Set medium thresholding (good results, default).
  12294. @end table
  12295. @end table
  12296. @section premultiply
  12297. Apply alpha premultiply effect to input video stream using first plane
  12298. of second stream as alpha.
  12299. Both streams must have same dimensions and same pixel format.
  12300. The filter accepts the following option:
  12301. @table @option
  12302. @item planes
  12303. Set which planes will be processed, unprocessed planes will be copied.
  12304. By default value 0xf, all planes will be processed.
  12305. @item inplace
  12306. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12307. @end table
  12308. @section prewitt
  12309. Apply prewitt operator to input video stream.
  12310. The filter accepts the following option:
  12311. @table @option
  12312. @item planes
  12313. Set which planes will be processed, unprocessed planes will be copied.
  12314. By default value 0xf, all planes will be processed.
  12315. @item scale
  12316. Set value which will be multiplied with filtered result.
  12317. @item delta
  12318. Set value which will be added to filtered result.
  12319. @end table
  12320. @subsection Commands
  12321. This filter supports the all above options as @ref{commands}.
  12322. @section pseudocolor
  12323. Alter frame colors in video with pseudocolors.
  12324. This filter accepts the following options:
  12325. @table @option
  12326. @item c0
  12327. set pixel first component expression
  12328. @item c1
  12329. set pixel second component expression
  12330. @item c2
  12331. set pixel third component expression
  12332. @item c3
  12333. set pixel fourth component expression, corresponds to the alpha component
  12334. @item i
  12335. set component to use as base for altering colors
  12336. @end table
  12337. Each of them specifies the expression to use for computing the lookup table for
  12338. the corresponding pixel component values.
  12339. The expressions can contain the following constants and functions:
  12340. @table @option
  12341. @item w
  12342. @item h
  12343. The input width and height.
  12344. @item val
  12345. The input value for the pixel component.
  12346. @item ymin, umin, vmin, amin
  12347. The minimum allowed component value.
  12348. @item ymax, umax, vmax, amax
  12349. The maximum allowed component value.
  12350. @end table
  12351. All expressions default to "val".
  12352. @subsection Examples
  12353. @itemize
  12354. @item
  12355. Change too high luma values to gradient:
  12356. @example
  12357. 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'"
  12358. @end example
  12359. @end itemize
  12360. @section psnr
  12361. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12362. Ratio) between two input videos.
  12363. This filter takes in input two input videos, the first input is
  12364. considered the "main" source and is passed unchanged to the
  12365. output. The second input is used as a "reference" video for computing
  12366. the PSNR.
  12367. Both video inputs must have the same resolution and pixel format for
  12368. this filter to work correctly. Also it assumes that both inputs
  12369. have the same number of frames, which are compared one by one.
  12370. The obtained average PSNR is printed through the logging system.
  12371. The filter stores the accumulated MSE (mean squared error) of each
  12372. frame, and at the end of the processing it is averaged across all frames
  12373. equally, and the following formula is applied to obtain the PSNR:
  12374. @example
  12375. PSNR = 10*log10(MAX^2/MSE)
  12376. @end example
  12377. Where MAX is the average of the maximum values of each component of the
  12378. image.
  12379. The description of the accepted parameters follows.
  12380. @table @option
  12381. @item stats_file, f
  12382. If specified the filter will use the named file to save the PSNR of
  12383. each individual frame. When filename equals "-" the data is sent to
  12384. standard output.
  12385. @item stats_version
  12386. Specifies which version of the stats file format to use. Details of
  12387. each format are written below.
  12388. Default value is 1.
  12389. @item stats_add_max
  12390. Determines whether the max value is output to the stats log.
  12391. Default value is 0.
  12392. Requires stats_version >= 2. If this is set and stats_version < 2,
  12393. the filter will return an error.
  12394. @end table
  12395. This filter also supports the @ref{framesync} options.
  12396. The file printed if @var{stats_file} is selected, contains a sequence of
  12397. key/value pairs of the form @var{key}:@var{value} for each compared
  12398. couple of frames.
  12399. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12400. the list of per-frame-pair stats, with key value pairs following the frame
  12401. format with the following parameters:
  12402. @table @option
  12403. @item psnr_log_version
  12404. The version of the log file format. Will match @var{stats_version}.
  12405. @item fields
  12406. A comma separated list of the per-frame-pair parameters included in
  12407. the log.
  12408. @end table
  12409. A description of each shown per-frame-pair parameter follows:
  12410. @table @option
  12411. @item n
  12412. sequential number of the input frame, starting from 1
  12413. @item mse_avg
  12414. Mean Square Error pixel-by-pixel average difference of the compared
  12415. frames, averaged over all the image components.
  12416. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12417. Mean Square Error pixel-by-pixel average difference of the compared
  12418. frames for the component specified by the suffix.
  12419. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12420. Peak Signal to Noise ratio of the compared frames for the component
  12421. specified by the suffix.
  12422. @item max_avg, max_y, max_u, max_v
  12423. Maximum allowed value for each channel, and average over all
  12424. channels.
  12425. @end table
  12426. @subsection Examples
  12427. @itemize
  12428. @item
  12429. For example:
  12430. @example
  12431. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12432. [main][ref] psnr="stats_file=stats.log" [out]
  12433. @end example
  12434. On this example the input file being processed is compared with the
  12435. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12436. is stored in @file{stats.log}.
  12437. @item
  12438. Another example with different containers:
  12439. @example
  12440. 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 -
  12441. @end example
  12442. @end itemize
  12443. @anchor{pullup}
  12444. @section pullup
  12445. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12446. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12447. content.
  12448. The pullup filter is designed to take advantage of future context in making
  12449. its decisions. This filter is stateless in the sense that it does not lock
  12450. onto a pattern to follow, but it instead looks forward to the following
  12451. fields in order to identify matches and rebuild progressive frames.
  12452. To produce content with an even framerate, insert the fps filter after
  12453. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12454. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12455. The filter accepts the following options:
  12456. @table @option
  12457. @item jl
  12458. @item jr
  12459. @item jt
  12460. @item jb
  12461. These options set the amount of "junk" to ignore at the left, right, top, and
  12462. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12463. while top and bottom are in units of 2 lines.
  12464. The default is 8 pixels on each side.
  12465. @item sb
  12466. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12467. filter generating an occasional mismatched frame, but it may also cause an
  12468. excessive number of frames to be dropped during high motion sequences.
  12469. Conversely, setting it to -1 will make filter match fields more easily.
  12470. This may help processing of video where there is slight blurring between
  12471. the fields, but may also cause there to be interlaced frames in the output.
  12472. Default value is @code{0}.
  12473. @item mp
  12474. Set the metric plane to use. It accepts the following values:
  12475. @table @samp
  12476. @item l
  12477. Use luma plane.
  12478. @item u
  12479. Use chroma blue plane.
  12480. @item v
  12481. Use chroma red plane.
  12482. @end table
  12483. This option may be set to use chroma plane instead of the default luma plane
  12484. for doing filter's computations. This may improve accuracy on very clean
  12485. source material, but more likely will decrease accuracy, especially if there
  12486. is chroma noise (rainbow effect) or any grayscale video.
  12487. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12488. load and make pullup usable in realtime on slow machines.
  12489. @end table
  12490. For best results (without duplicated frames in the output file) it is
  12491. necessary to change the output frame rate. For example, to inverse
  12492. telecine NTSC input:
  12493. @example
  12494. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12495. @end example
  12496. @section qp
  12497. Change video quantization parameters (QP).
  12498. The filter accepts the following option:
  12499. @table @option
  12500. @item qp
  12501. Set expression for quantization parameter.
  12502. @end table
  12503. The expression is evaluated through the eval API and can contain, among others,
  12504. the following constants:
  12505. @table @var
  12506. @item known
  12507. 1 if index is not 129, 0 otherwise.
  12508. @item qp
  12509. Sequential index starting from -129 to 128.
  12510. @end table
  12511. @subsection Examples
  12512. @itemize
  12513. @item
  12514. Some equation like:
  12515. @example
  12516. qp=2+2*sin(PI*qp)
  12517. @end example
  12518. @end itemize
  12519. @section random
  12520. Flush video frames from internal cache of frames into a random order.
  12521. No frame is discarded.
  12522. Inspired by @ref{frei0r} nervous filter.
  12523. @table @option
  12524. @item frames
  12525. Set size in number of frames of internal cache, in range from @code{2} to
  12526. @code{512}. Default is @code{30}.
  12527. @item seed
  12528. Set seed for random number generator, must be an integer included between
  12529. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12530. less than @code{0}, the filter will try to use a good random seed on a
  12531. best effort basis.
  12532. @end table
  12533. @section readeia608
  12534. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12535. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12536. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12537. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12538. @table @option
  12539. @item lavfi.readeia608.X.cc
  12540. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12541. @item lavfi.readeia608.X.line
  12542. The number of the line on which the EIA-608 data was identified and read.
  12543. @end table
  12544. This filter accepts the following options:
  12545. @table @option
  12546. @item scan_min
  12547. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12548. @item scan_max
  12549. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12550. @item spw
  12551. Set the ratio of width reserved for sync code detection.
  12552. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12553. @item chp
  12554. Enable checking the parity bit. In the event of a parity error, the filter will output
  12555. @code{0x00} for that character. Default is false.
  12556. @item lp
  12557. Lowpass lines prior to further processing. Default is enabled.
  12558. @end table
  12559. @subsection Commands
  12560. This filter supports the all above options as @ref{commands}.
  12561. @subsection Examples
  12562. @itemize
  12563. @item
  12564. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12565. @example
  12566. 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
  12567. @end example
  12568. @end itemize
  12569. @section readvitc
  12570. Read vertical interval timecode (VITC) information from the top lines of a
  12571. video frame.
  12572. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12573. timecode value, if a valid timecode has been detected. Further metadata key
  12574. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12575. timecode data has been found or not.
  12576. This filter accepts the following options:
  12577. @table @option
  12578. @item scan_max
  12579. Set the maximum number of lines to scan for VITC data. If the value is set to
  12580. @code{-1} the full video frame is scanned. Default is @code{45}.
  12581. @item thr_b
  12582. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12583. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12584. @item thr_w
  12585. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12586. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12587. @end table
  12588. @subsection Examples
  12589. @itemize
  12590. @item
  12591. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12592. draw @code{--:--:--:--} as a placeholder:
  12593. @example
  12594. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12595. @end example
  12596. @end itemize
  12597. @section remap
  12598. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12599. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12600. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12601. value for pixel will be used for destination pixel.
  12602. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12603. will have Xmap/Ymap video stream dimensions.
  12604. Xmap and Ymap input video streams are 16bit depth, single channel.
  12605. @table @option
  12606. @item format
  12607. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12608. Default is @code{color}.
  12609. @item fill
  12610. Specify the color of the unmapped pixels. For the syntax of this option,
  12611. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12612. manual,ffmpeg-utils}. Default color is @code{black}.
  12613. @end table
  12614. @section removegrain
  12615. The removegrain filter is a spatial denoiser for progressive video.
  12616. @table @option
  12617. @item m0
  12618. Set mode for the first plane.
  12619. @item m1
  12620. Set mode for the second plane.
  12621. @item m2
  12622. Set mode for the third plane.
  12623. @item m3
  12624. Set mode for the fourth plane.
  12625. @end table
  12626. Range of mode is from 0 to 24. Description of each mode follows:
  12627. @table @var
  12628. @item 0
  12629. Leave input plane unchanged. Default.
  12630. @item 1
  12631. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12632. @item 2
  12633. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12634. @item 3
  12635. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12636. @item 4
  12637. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12638. This is equivalent to a median filter.
  12639. @item 5
  12640. Line-sensitive clipping giving the minimal change.
  12641. @item 6
  12642. Line-sensitive clipping, intermediate.
  12643. @item 7
  12644. Line-sensitive clipping, intermediate.
  12645. @item 8
  12646. Line-sensitive clipping, intermediate.
  12647. @item 9
  12648. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12649. @item 10
  12650. Replaces the target pixel with the closest neighbour.
  12651. @item 11
  12652. [1 2 1] horizontal and vertical kernel blur.
  12653. @item 12
  12654. Same as mode 11.
  12655. @item 13
  12656. Bob mode, interpolates top field from the line where the neighbours
  12657. pixels are the closest.
  12658. @item 14
  12659. Bob mode, interpolates bottom field from the line where the neighbours
  12660. pixels are the closest.
  12661. @item 15
  12662. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12663. interpolation formula.
  12664. @item 16
  12665. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12666. interpolation formula.
  12667. @item 17
  12668. Clips the pixel with the minimum and maximum of respectively the maximum and
  12669. minimum of each pair of opposite neighbour pixels.
  12670. @item 18
  12671. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12672. the current pixel is minimal.
  12673. @item 19
  12674. Replaces the pixel with the average of its 8 neighbours.
  12675. @item 20
  12676. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12677. @item 21
  12678. Clips pixels using the averages of opposite neighbour.
  12679. @item 22
  12680. Same as mode 21 but simpler and faster.
  12681. @item 23
  12682. Small edge and halo removal, but reputed useless.
  12683. @item 24
  12684. Similar as 23.
  12685. @end table
  12686. @section removelogo
  12687. Suppress a TV station logo, using an image file to determine which
  12688. pixels comprise the logo. It works by filling in the pixels that
  12689. comprise the logo with neighboring pixels.
  12690. The filter accepts the following options:
  12691. @table @option
  12692. @item filename, f
  12693. Set the filter bitmap file, which can be any image format supported by
  12694. libavformat. The width and height of the image file must match those of the
  12695. video stream being processed.
  12696. @end table
  12697. Pixels in the provided bitmap image with a value of zero are not
  12698. considered part of the logo, non-zero pixels are considered part of
  12699. the logo. If you use white (255) for the logo and black (0) for the
  12700. rest, you will be safe. For making the filter bitmap, it is
  12701. recommended to take a screen capture of a black frame with the logo
  12702. visible, and then using a threshold filter followed by the erode
  12703. filter once or twice.
  12704. If needed, little splotches can be fixed manually. Remember that if
  12705. logo pixels are not covered, the filter quality will be much
  12706. reduced. Marking too many pixels as part of the logo does not hurt as
  12707. much, but it will increase the amount of blurring needed to cover over
  12708. the image and will destroy more information than necessary, and extra
  12709. pixels will slow things down on a large logo.
  12710. @section repeatfields
  12711. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12712. fields based on its value.
  12713. @section reverse
  12714. Reverse a video clip.
  12715. Warning: This filter requires memory to buffer the entire clip, so trimming
  12716. is suggested.
  12717. @subsection Examples
  12718. @itemize
  12719. @item
  12720. Take the first 5 seconds of a clip, and reverse it.
  12721. @example
  12722. trim=end=5,reverse
  12723. @end example
  12724. @end itemize
  12725. @section rgbashift
  12726. Shift R/G/B/A pixels horizontally and/or vertically.
  12727. The filter accepts the following options:
  12728. @table @option
  12729. @item rh
  12730. Set amount to shift red horizontally.
  12731. @item rv
  12732. Set amount to shift red vertically.
  12733. @item gh
  12734. Set amount to shift green horizontally.
  12735. @item gv
  12736. Set amount to shift green vertically.
  12737. @item bh
  12738. Set amount to shift blue horizontally.
  12739. @item bv
  12740. Set amount to shift blue vertically.
  12741. @item ah
  12742. Set amount to shift alpha horizontally.
  12743. @item av
  12744. Set amount to shift alpha vertically.
  12745. @item edge
  12746. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12747. @end table
  12748. @subsection Commands
  12749. This filter supports the all above options as @ref{commands}.
  12750. @section roberts
  12751. Apply roberts cross operator to input video stream.
  12752. The filter accepts the following option:
  12753. @table @option
  12754. @item planes
  12755. Set which planes will be processed, unprocessed planes will be copied.
  12756. By default value 0xf, all planes will be processed.
  12757. @item scale
  12758. Set value which will be multiplied with filtered result.
  12759. @item delta
  12760. Set value which will be added to filtered result.
  12761. @end table
  12762. @subsection Commands
  12763. This filter supports the all above options as @ref{commands}.
  12764. @section rotate
  12765. Rotate video by an arbitrary angle expressed in radians.
  12766. The filter accepts the following options:
  12767. A description of the optional parameters follows.
  12768. @table @option
  12769. @item angle, a
  12770. Set an expression for the angle by which to rotate the input video
  12771. clockwise, expressed as a number of radians. A negative value will
  12772. result in a counter-clockwise rotation. By default it is set to "0".
  12773. This expression is evaluated for each frame.
  12774. @item out_w, ow
  12775. Set the output width expression, default value is "iw".
  12776. This expression is evaluated just once during configuration.
  12777. @item out_h, oh
  12778. Set the output height expression, default value is "ih".
  12779. This expression is evaluated just once during configuration.
  12780. @item bilinear
  12781. Enable bilinear interpolation if set to 1, a value of 0 disables
  12782. it. Default value is 1.
  12783. @item fillcolor, c
  12784. Set the color used to fill the output area not covered by the rotated
  12785. image. For the general syntax of this option, check the
  12786. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12787. If the special value "none" is selected then no
  12788. background is printed (useful for example if the background is never shown).
  12789. Default value is "black".
  12790. @end table
  12791. The expressions for the angle and the output size can contain the
  12792. following constants and functions:
  12793. @table @option
  12794. @item n
  12795. sequential number of the input frame, starting from 0. It is always NAN
  12796. before the first frame is filtered.
  12797. @item t
  12798. time in seconds of the input frame, it is set to 0 when the filter is
  12799. configured. It is always NAN before the first frame is filtered.
  12800. @item hsub
  12801. @item vsub
  12802. horizontal and vertical chroma subsample values. For example for the
  12803. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12804. @item in_w, iw
  12805. @item in_h, ih
  12806. the input video width and height
  12807. @item out_w, ow
  12808. @item out_h, oh
  12809. the output width and height, that is the size of the padded area as
  12810. specified by the @var{width} and @var{height} expressions
  12811. @item rotw(a)
  12812. @item roth(a)
  12813. the minimal width/height required for completely containing the input
  12814. video rotated by @var{a} radians.
  12815. These are only available when computing the @option{out_w} and
  12816. @option{out_h} expressions.
  12817. @end table
  12818. @subsection Examples
  12819. @itemize
  12820. @item
  12821. Rotate the input by PI/6 radians clockwise:
  12822. @example
  12823. rotate=PI/6
  12824. @end example
  12825. @item
  12826. Rotate the input by PI/6 radians counter-clockwise:
  12827. @example
  12828. rotate=-PI/6
  12829. @end example
  12830. @item
  12831. Rotate the input by 45 degrees clockwise:
  12832. @example
  12833. rotate=45*PI/180
  12834. @end example
  12835. @item
  12836. Apply a constant rotation with period T, starting from an angle of PI/3:
  12837. @example
  12838. rotate=PI/3+2*PI*t/T
  12839. @end example
  12840. @item
  12841. Make the input video rotation oscillating with a period of T
  12842. seconds and an amplitude of A radians:
  12843. @example
  12844. rotate=A*sin(2*PI/T*t)
  12845. @end example
  12846. @item
  12847. Rotate the video, output size is chosen so that the whole rotating
  12848. input video is always completely contained in the output:
  12849. @example
  12850. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12851. @end example
  12852. @item
  12853. Rotate the video, reduce the output size so that no background is ever
  12854. shown:
  12855. @example
  12856. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12857. @end example
  12858. @end itemize
  12859. @subsection Commands
  12860. The filter supports the following commands:
  12861. @table @option
  12862. @item a, angle
  12863. Set the angle expression.
  12864. The command accepts the same syntax of the corresponding option.
  12865. If the specified expression is not valid, it is kept at its current
  12866. value.
  12867. @end table
  12868. @section sab
  12869. Apply Shape Adaptive Blur.
  12870. The filter accepts the following options:
  12871. @table @option
  12872. @item luma_radius, lr
  12873. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12874. value is 1.0. A greater value will result in a more blurred image, and
  12875. in slower processing.
  12876. @item luma_pre_filter_radius, lpfr
  12877. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12878. value is 1.0.
  12879. @item luma_strength, ls
  12880. Set luma maximum difference between pixels to still be considered, must
  12881. be a value in the 0.1-100.0 range, default value is 1.0.
  12882. @item chroma_radius, cr
  12883. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12884. greater value will result in a more blurred image, and in slower
  12885. processing.
  12886. @item chroma_pre_filter_radius, cpfr
  12887. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12888. @item chroma_strength, cs
  12889. Set chroma maximum difference between pixels to still be considered,
  12890. must be a value in the -0.9-100.0 range.
  12891. @end table
  12892. Each chroma option value, if not explicitly specified, is set to the
  12893. corresponding luma option value.
  12894. @anchor{scale}
  12895. @section scale
  12896. Scale (resize) the input video, using the libswscale library.
  12897. The scale filter forces the output display aspect ratio to be the same
  12898. of the input, by changing the output sample aspect ratio.
  12899. If the input image format is different from the format requested by
  12900. the next filter, the scale filter will convert the input to the
  12901. requested format.
  12902. @subsection Options
  12903. The filter accepts the following options, or any of the options
  12904. supported by the libswscale scaler.
  12905. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12906. the complete list of scaler options.
  12907. @table @option
  12908. @item width, w
  12909. @item height, h
  12910. Set the output video dimension expression. Default value is the input
  12911. dimension.
  12912. If the @var{width} or @var{w} value is 0, the input width is used for
  12913. the output. If the @var{height} or @var{h} value is 0, the input height
  12914. is used for the output.
  12915. If one and only one of the values is -n with n >= 1, the scale filter
  12916. will use a value that maintains the aspect ratio of the input image,
  12917. calculated from the other specified dimension. After that it will,
  12918. however, make sure that the calculated dimension is divisible by n and
  12919. adjust the value if necessary.
  12920. If both values are -n with n >= 1, the behavior will be identical to
  12921. both values being set to 0 as previously detailed.
  12922. See below for the list of accepted constants for use in the dimension
  12923. expression.
  12924. @item eval
  12925. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12926. @table @samp
  12927. @item init
  12928. Only evaluate expressions once during the filter initialization or when a command is processed.
  12929. @item frame
  12930. Evaluate expressions for each incoming frame.
  12931. @end table
  12932. Default value is @samp{init}.
  12933. @item interl
  12934. Set the interlacing mode. It accepts the following values:
  12935. @table @samp
  12936. @item 1
  12937. Force interlaced aware scaling.
  12938. @item 0
  12939. Do not apply interlaced scaling.
  12940. @item -1
  12941. Select interlaced aware scaling depending on whether the source frames
  12942. are flagged as interlaced or not.
  12943. @end table
  12944. Default value is @samp{0}.
  12945. @item flags
  12946. Set libswscale scaling flags. See
  12947. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12948. complete list of values. If not explicitly specified the filter applies
  12949. the default flags.
  12950. @item param0, param1
  12951. Set libswscale input parameters for scaling algorithms that need them. See
  12952. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12953. complete documentation. If not explicitly specified the filter applies
  12954. empty parameters.
  12955. @item size, s
  12956. Set the video size. For the syntax of this option, check the
  12957. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12958. @item in_color_matrix
  12959. @item out_color_matrix
  12960. Set in/output YCbCr color space type.
  12961. This allows the autodetected value to be overridden as well as allows forcing
  12962. a specific value used for the output and encoder.
  12963. If not specified, the color space type depends on the pixel format.
  12964. Possible values:
  12965. @table @samp
  12966. @item auto
  12967. Choose automatically.
  12968. @item bt709
  12969. Format conforming to International Telecommunication Union (ITU)
  12970. Recommendation BT.709.
  12971. @item fcc
  12972. Set color space conforming to the United States Federal Communications
  12973. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12974. @item bt601
  12975. @item bt470
  12976. @item smpte170m
  12977. Set color space conforming to:
  12978. @itemize
  12979. @item
  12980. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12981. @item
  12982. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12983. @item
  12984. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12985. @end itemize
  12986. @item smpte240m
  12987. Set color space conforming to SMPTE ST 240:1999.
  12988. @item bt2020
  12989. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12990. @end table
  12991. @item in_range
  12992. @item out_range
  12993. Set in/output YCbCr sample range.
  12994. This allows the autodetected value to be overridden as well as allows forcing
  12995. a specific value used for the output and encoder. If not specified, the
  12996. range depends on the pixel format. Possible values:
  12997. @table @samp
  12998. @item auto/unknown
  12999. Choose automatically.
  13000. @item jpeg/full/pc
  13001. Set full range (0-255 in case of 8-bit luma).
  13002. @item mpeg/limited/tv
  13003. Set "MPEG" range (16-235 in case of 8-bit luma).
  13004. @end table
  13005. @item force_original_aspect_ratio
  13006. Enable decreasing or increasing output video width or height if necessary to
  13007. keep the original aspect ratio. Possible values:
  13008. @table @samp
  13009. @item disable
  13010. Scale the video as specified and disable this feature.
  13011. @item decrease
  13012. The output video dimensions will automatically be decreased if needed.
  13013. @item increase
  13014. The output video dimensions will automatically be increased if needed.
  13015. @end table
  13016. One useful instance of this option is that when you know a specific device's
  13017. maximum allowed resolution, you can use this to limit the output video to
  13018. that, while retaining the aspect ratio. For example, device A allows
  13019. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13020. decrease) and specifying 1280x720 to the command line makes the output
  13021. 1280x533.
  13022. Please note that this is a different thing than specifying -1 for @option{w}
  13023. or @option{h}, you still need to specify the output resolution for this option
  13024. to work.
  13025. @item force_divisible_by
  13026. Ensures that both the output dimensions, width and height, are divisible by the
  13027. given integer when used together with @option{force_original_aspect_ratio}. This
  13028. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13029. This option respects the value set for @option{force_original_aspect_ratio},
  13030. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13031. may be slightly modified.
  13032. This option can be handy if you need to have a video fit within or exceed
  13033. a defined resolution using @option{force_original_aspect_ratio} but also have
  13034. encoder restrictions on width or height divisibility.
  13035. @end table
  13036. The values of the @option{w} and @option{h} options are expressions
  13037. containing the following constants:
  13038. @table @var
  13039. @item in_w
  13040. @item in_h
  13041. The input width and height
  13042. @item iw
  13043. @item ih
  13044. These are the same as @var{in_w} and @var{in_h}.
  13045. @item out_w
  13046. @item out_h
  13047. The output (scaled) width and height
  13048. @item ow
  13049. @item oh
  13050. These are the same as @var{out_w} and @var{out_h}
  13051. @item a
  13052. The same as @var{iw} / @var{ih}
  13053. @item sar
  13054. input sample aspect ratio
  13055. @item dar
  13056. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13057. @item hsub
  13058. @item vsub
  13059. horizontal and vertical input chroma subsample values. For example for the
  13060. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13061. @item ohsub
  13062. @item ovsub
  13063. horizontal and vertical output chroma subsample values. For example for the
  13064. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13065. @item n
  13066. The (sequential) number of the input frame, starting from 0.
  13067. Only available with @code{eval=frame}.
  13068. @item t
  13069. The presentation timestamp of the input frame, expressed as a number of
  13070. seconds. Only available with @code{eval=frame}.
  13071. @item pos
  13072. The position (byte offset) of the frame in the input stream, or NaN if
  13073. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13074. Only available with @code{eval=frame}.
  13075. @end table
  13076. @subsection Examples
  13077. @itemize
  13078. @item
  13079. Scale the input video to a size of 200x100
  13080. @example
  13081. scale=w=200:h=100
  13082. @end example
  13083. This is equivalent to:
  13084. @example
  13085. scale=200:100
  13086. @end example
  13087. or:
  13088. @example
  13089. scale=200x100
  13090. @end example
  13091. @item
  13092. Specify a size abbreviation for the output size:
  13093. @example
  13094. scale=qcif
  13095. @end example
  13096. which can also be written as:
  13097. @example
  13098. scale=size=qcif
  13099. @end example
  13100. @item
  13101. Scale the input to 2x:
  13102. @example
  13103. scale=w=2*iw:h=2*ih
  13104. @end example
  13105. @item
  13106. The above is the same as:
  13107. @example
  13108. scale=2*in_w:2*in_h
  13109. @end example
  13110. @item
  13111. Scale the input to 2x with forced interlaced scaling:
  13112. @example
  13113. scale=2*iw:2*ih:interl=1
  13114. @end example
  13115. @item
  13116. Scale the input to half size:
  13117. @example
  13118. scale=w=iw/2:h=ih/2
  13119. @end example
  13120. @item
  13121. Increase the width, and set the height to the same size:
  13122. @example
  13123. scale=3/2*iw:ow
  13124. @end example
  13125. @item
  13126. Seek Greek harmony:
  13127. @example
  13128. scale=iw:1/PHI*iw
  13129. scale=ih*PHI:ih
  13130. @end example
  13131. @item
  13132. Increase the height, and set the width to 3/2 of the height:
  13133. @example
  13134. scale=w=3/2*oh:h=3/5*ih
  13135. @end example
  13136. @item
  13137. Increase the size, making the size a multiple of the chroma
  13138. subsample values:
  13139. @example
  13140. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  13141. @end example
  13142. @item
  13143. Increase the width to a maximum of 500 pixels,
  13144. keeping the same aspect ratio as the input:
  13145. @example
  13146. scale=w='min(500\, iw*3/2):h=-1'
  13147. @end example
  13148. @item
  13149. Make pixels square by combining scale and setsar:
  13150. @example
  13151. scale='trunc(ih*dar):ih',setsar=1/1
  13152. @end example
  13153. @item
  13154. Make pixels square by combining scale and setsar,
  13155. making sure the resulting resolution is even (required by some codecs):
  13156. @example
  13157. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  13158. @end example
  13159. @end itemize
  13160. @subsection Commands
  13161. This filter supports the following commands:
  13162. @table @option
  13163. @item width, w
  13164. @item height, h
  13165. Set the output video dimension expression.
  13166. The command accepts the same syntax of the corresponding option.
  13167. If the specified expression is not valid, it is kept at its current
  13168. value.
  13169. @end table
  13170. @section scale_npp
  13171. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  13172. format conversion on CUDA video frames. Setting the output width and height
  13173. works in the same way as for the @var{scale} filter.
  13174. The following additional options are accepted:
  13175. @table @option
  13176. @item format
  13177. The pixel format of the output CUDA frames. If set to the string "same" (the
  13178. default), the input format will be kept. Note that automatic format negotiation
  13179. and conversion is not yet supported for hardware frames
  13180. @item interp_algo
  13181. The interpolation algorithm used for resizing. One of the following:
  13182. @table @option
  13183. @item nn
  13184. Nearest neighbour.
  13185. @item linear
  13186. @item cubic
  13187. @item cubic2p_bspline
  13188. 2-parameter cubic (B=1, C=0)
  13189. @item cubic2p_catmullrom
  13190. 2-parameter cubic (B=0, C=1/2)
  13191. @item cubic2p_b05c03
  13192. 2-parameter cubic (B=1/2, C=3/10)
  13193. @item super
  13194. Supersampling
  13195. @item lanczos
  13196. @end table
  13197. @item force_original_aspect_ratio
  13198. Enable decreasing or increasing output video width or height if necessary to
  13199. keep the original aspect ratio. Possible values:
  13200. @table @samp
  13201. @item disable
  13202. Scale the video as specified and disable this feature.
  13203. @item decrease
  13204. The output video dimensions will automatically be decreased if needed.
  13205. @item increase
  13206. The output video dimensions will automatically be increased if needed.
  13207. @end table
  13208. One useful instance of this option is that when you know a specific device's
  13209. maximum allowed resolution, you can use this to limit the output video to
  13210. that, while retaining the aspect ratio. For example, device A allows
  13211. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13212. decrease) and specifying 1280x720 to the command line makes the output
  13213. 1280x533.
  13214. Please note that this is a different thing than specifying -1 for @option{w}
  13215. or @option{h}, you still need to specify the output resolution for this option
  13216. to work.
  13217. @item force_divisible_by
  13218. Ensures that both the output dimensions, width and height, are divisible by the
  13219. given integer when used together with @option{force_original_aspect_ratio}. This
  13220. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13221. This option respects the value set for @option{force_original_aspect_ratio},
  13222. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13223. may be slightly modified.
  13224. This option can be handy if you need to have a video fit within or exceed
  13225. a defined resolution using @option{force_original_aspect_ratio} but also have
  13226. encoder restrictions on width or height divisibility.
  13227. @end table
  13228. @section scale2ref
  13229. Scale (resize) the input video, based on a reference video.
  13230. See the scale filter for available options, scale2ref supports the same but
  13231. uses the reference video instead of the main input as basis. scale2ref also
  13232. supports the following additional constants for the @option{w} and
  13233. @option{h} options:
  13234. @table @var
  13235. @item main_w
  13236. @item main_h
  13237. The main input video's width and height
  13238. @item main_a
  13239. The same as @var{main_w} / @var{main_h}
  13240. @item main_sar
  13241. The main input video's sample aspect ratio
  13242. @item main_dar, mdar
  13243. The main input video's display aspect ratio. Calculated from
  13244. @code{(main_w / main_h) * main_sar}.
  13245. @item main_hsub
  13246. @item main_vsub
  13247. The main input video's horizontal and vertical chroma subsample values.
  13248. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13249. is 1.
  13250. @item main_n
  13251. The (sequential) number of the main input frame, starting from 0.
  13252. Only available with @code{eval=frame}.
  13253. @item main_t
  13254. The presentation timestamp of the main input frame, expressed as a number of
  13255. seconds. Only available with @code{eval=frame}.
  13256. @item main_pos
  13257. The position (byte offset) of the frame in the main input stream, or NaN if
  13258. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13259. Only available with @code{eval=frame}.
  13260. @end table
  13261. @subsection Examples
  13262. @itemize
  13263. @item
  13264. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13265. @example
  13266. 'scale2ref[b][a];[a][b]overlay'
  13267. @end example
  13268. @item
  13269. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13270. @example
  13271. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13272. @end example
  13273. @end itemize
  13274. @subsection Commands
  13275. This filter supports the following commands:
  13276. @table @option
  13277. @item width, w
  13278. @item height, h
  13279. Set the output video dimension expression.
  13280. The command accepts the same syntax of the corresponding option.
  13281. If the specified expression is not valid, it is kept at its current
  13282. value.
  13283. @end table
  13284. @section scroll
  13285. Scroll input video horizontally and/or vertically by constant speed.
  13286. The filter accepts the following options:
  13287. @table @option
  13288. @item horizontal, h
  13289. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13290. Negative values changes scrolling direction.
  13291. @item vertical, v
  13292. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13293. Negative values changes scrolling direction.
  13294. @item hpos
  13295. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13296. @item vpos
  13297. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13298. @end table
  13299. @subsection Commands
  13300. This filter supports the following @ref{commands}:
  13301. @table @option
  13302. @item horizontal, h
  13303. Set the horizontal scrolling speed.
  13304. @item vertical, v
  13305. Set the vertical scrolling speed.
  13306. @end table
  13307. @anchor{scdet}
  13308. @section scdet
  13309. Detect video scene change.
  13310. This filter sets frame metadata with mafd between frame, the scene score, and
  13311. forward the frame to the next filter, so they can use these metadata to detect
  13312. scene change or others.
  13313. In addition, this filter logs a message and sets frame metadata when it detects
  13314. a scene change by @option{threshold}.
  13315. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13316. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13317. to detect scene change.
  13318. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13319. detect scene change with @option{threshold}.
  13320. The filter accepts the following options:
  13321. @table @option
  13322. @item threshold, t
  13323. Set the scene change detection threshold as a percentage of maximum change. Good
  13324. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13325. @code{[0., 100.]}.
  13326. Default value is @code{10.}.
  13327. @item sc_pass, s
  13328. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13329. You can enable it if you want to get snapshot of scene change frames only.
  13330. @end table
  13331. @anchor{selectivecolor}
  13332. @section selectivecolor
  13333. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13334. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13335. by the "purity" of the color (that is, how saturated it already is).
  13336. This filter is similar to the Adobe Photoshop Selective Color tool.
  13337. The filter accepts the following options:
  13338. @table @option
  13339. @item correction_method
  13340. Select color correction method.
  13341. Available values are:
  13342. @table @samp
  13343. @item absolute
  13344. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13345. component value).
  13346. @item relative
  13347. Specified adjustments are relative to the original component value.
  13348. @end table
  13349. Default is @code{absolute}.
  13350. @item reds
  13351. Adjustments for red pixels (pixels where the red component is the maximum)
  13352. @item yellows
  13353. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13354. @item greens
  13355. Adjustments for green pixels (pixels where the green component is the maximum)
  13356. @item cyans
  13357. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13358. @item blues
  13359. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13360. @item magentas
  13361. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13362. @item whites
  13363. Adjustments for white pixels (pixels where all components are greater than 128)
  13364. @item neutrals
  13365. Adjustments for all pixels except pure black and pure white
  13366. @item blacks
  13367. Adjustments for black pixels (pixels where all components are lesser than 128)
  13368. @item psfile
  13369. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13370. @end table
  13371. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13372. 4 space separated floating point adjustment values in the [-1,1] range,
  13373. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13374. pixels of its range.
  13375. @subsection Examples
  13376. @itemize
  13377. @item
  13378. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13379. increase magenta by 27% in blue areas:
  13380. @example
  13381. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13382. @end example
  13383. @item
  13384. Use a Photoshop selective color preset:
  13385. @example
  13386. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13387. @end example
  13388. @end itemize
  13389. @anchor{separatefields}
  13390. @section separatefields
  13391. The @code{separatefields} takes a frame-based video input and splits
  13392. each frame into its components fields, producing a new half height clip
  13393. with twice the frame rate and twice the frame count.
  13394. This filter use field-dominance information in frame to decide which
  13395. of each pair of fields to place first in the output.
  13396. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13397. @section setdar, setsar
  13398. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13399. output video.
  13400. This is done by changing the specified Sample (aka Pixel) Aspect
  13401. Ratio, according to the following equation:
  13402. @example
  13403. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13404. @end example
  13405. Keep in mind that the @code{setdar} filter does not modify the pixel
  13406. dimensions of the video frame. Also, the display aspect ratio set by
  13407. this filter may be changed by later filters in the filterchain,
  13408. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13409. applied.
  13410. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13411. the filter output video.
  13412. Note that as a consequence of the application of this filter, the
  13413. output display aspect ratio will change according to the equation
  13414. above.
  13415. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13416. filter may be changed by later filters in the filterchain, e.g. if
  13417. another "setsar" or a "setdar" filter is applied.
  13418. It accepts the following parameters:
  13419. @table @option
  13420. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13421. Set the aspect ratio used by the filter.
  13422. The parameter can be a floating point number string, an expression, or
  13423. a string of the form @var{num}:@var{den}, where @var{num} and
  13424. @var{den} are the numerator and denominator of the aspect ratio. If
  13425. the parameter is not specified, it is assumed the value "0".
  13426. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13427. should be escaped.
  13428. @item max
  13429. Set the maximum integer value to use for expressing numerator and
  13430. denominator when reducing the expressed aspect ratio to a rational.
  13431. Default value is @code{100}.
  13432. @end table
  13433. The parameter @var{sar} is an expression containing
  13434. the following constants:
  13435. @table @option
  13436. @item E, PI, PHI
  13437. These are approximated values for the mathematical constants e
  13438. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13439. @item w, h
  13440. The input width and height.
  13441. @item a
  13442. These are the same as @var{w} / @var{h}.
  13443. @item sar
  13444. The input sample aspect ratio.
  13445. @item dar
  13446. The input display aspect ratio. It is the same as
  13447. (@var{w} / @var{h}) * @var{sar}.
  13448. @item hsub, vsub
  13449. Horizontal and vertical chroma subsample values. For example, for the
  13450. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13451. @end table
  13452. @subsection Examples
  13453. @itemize
  13454. @item
  13455. To change the display aspect ratio to 16:9, specify one of the following:
  13456. @example
  13457. setdar=dar=1.77777
  13458. setdar=dar=16/9
  13459. @end example
  13460. @item
  13461. To change the sample aspect ratio to 10:11, specify:
  13462. @example
  13463. setsar=sar=10/11
  13464. @end example
  13465. @item
  13466. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13467. 1000 in the aspect ratio reduction, use the command:
  13468. @example
  13469. setdar=ratio=16/9:max=1000
  13470. @end example
  13471. @end itemize
  13472. @anchor{setfield}
  13473. @section setfield
  13474. Force field for the output video frame.
  13475. The @code{setfield} filter marks the interlace type field for the
  13476. output frames. It does not change the input frame, but only sets the
  13477. corresponding property, which affects how the frame is treated by
  13478. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13479. The filter accepts the following options:
  13480. @table @option
  13481. @item mode
  13482. Available values are:
  13483. @table @samp
  13484. @item auto
  13485. Keep the same field property.
  13486. @item bff
  13487. Mark the frame as bottom-field-first.
  13488. @item tff
  13489. Mark the frame as top-field-first.
  13490. @item prog
  13491. Mark the frame as progressive.
  13492. @end table
  13493. @end table
  13494. @anchor{setparams}
  13495. @section setparams
  13496. Force frame parameter for the output video frame.
  13497. The @code{setparams} filter marks interlace and color range for the
  13498. output frames. It does not change the input frame, but only sets the
  13499. corresponding property, which affects how the frame is treated by
  13500. filters/encoders.
  13501. @table @option
  13502. @item field_mode
  13503. Available values are:
  13504. @table @samp
  13505. @item auto
  13506. Keep the same field property (default).
  13507. @item bff
  13508. Mark the frame as bottom-field-first.
  13509. @item tff
  13510. Mark the frame as top-field-first.
  13511. @item prog
  13512. Mark the frame as progressive.
  13513. @end table
  13514. @item range
  13515. Available values are:
  13516. @table @samp
  13517. @item auto
  13518. Keep the same color range property (default).
  13519. @item unspecified, unknown
  13520. Mark the frame as unspecified color range.
  13521. @item limited, tv, mpeg
  13522. Mark the frame as limited range.
  13523. @item full, pc, jpeg
  13524. Mark the frame as full range.
  13525. @end table
  13526. @item color_primaries
  13527. Set the color primaries.
  13528. Available values are:
  13529. @table @samp
  13530. @item auto
  13531. Keep the same color primaries property (default).
  13532. @item bt709
  13533. @item unknown
  13534. @item bt470m
  13535. @item bt470bg
  13536. @item smpte170m
  13537. @item smpte240m
  13538. @item film
  13539. @item bt2020
  13540. @item smpte428
  13541. @item smpte431
  13542. @item smpte432
  13543. @item jedec-p22
  13544. @end table
  13545. @item color_trc
  13546. Set the color transfer.
  13547. Available values are:
  13548. @table @samp
  13549. @item auto
  13550. Keep the same color trc property (default).
  13551. @item bt709
  13552. @item unknown
  13553. @item bt470m
  13554. @item bt470bg
  13555. @item smpte170m
  13556. @item smpte240m
  13557. @item linear
  13558. @item log100
  13559. @item log316
  13560. @item iec61966-2-4
  13561. @item bt1361e
  13562. @item iec61966-2-1
  13563. @item bt2020-10
  13564. @item bt2020-12
  13565. @item smpte2084
  13566. @item smpte428
  13567. @item arib-std-b67
  13568. @end table
  13569. @item colorspace
  13570. Set the colorspace.
  13571. Available values are:
  13572. @table @samp
  13573. @item auto
  13574. Keep the same colorspace property (default).
  13575. @item gbr
  13576. @item bt709
  13577. @item unknown
  13578. @item fcc
  13579. @item bt470bg
  13580. @item smpte170m
  13581. @item smpte240m
  13582. @item ycgco
  13583. @item bt2020nc
  13584. @item bt2020c
  13585. @item smpte2085
  13586. @item chroma-derived-nc
  13587. @item chroma-derived-c
  13588. @item ictcp
  13589. @end table
  13590. @end table
  13591. @section shear
  13592. Apply shear transform to input video.
  13593. This filter supports the following options:
  13594. @table @option
  13595. @item shx
  13596. Shear factor in X-direction. Default value is 0.
  13597. Allowed range is from -2 to 2.
  13598. @item shy
  13599. Shear factor in Y-direction. Default value is 0.
  13600. Allowed range is from -2 to 2.
  13601. @item fillcolor, c
  13602. Set the color used to fill the output area not covered by the transformed
  13603. video. For the general syntax of this option, check the
  13604. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13605. If the special value "none" is selected then no
  13606. background is printed (useful for example if the background is never shown).
  13607. Default value is "black".
  13608. @item interp
  13609. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  13610. @end table
  13611. @section showinfo
  13612. Show a line containing various information for each input video frame.
  13613. The input video is not modified.
  13614. This filter supports the following options:
  13615. @table @option
  13616. @item checksum
  13617. Calculate checksums of each plane. By default enabled.
  13618. @end table
  13619. The shown line contains a sequence of key/value pairs of the form
  13620. @var{key}:@var{value}.
  13621. The following values are shown in the output:
  13622. @table @option
  13623. @item n
  13624. The (sequential) number of the input frame, starting from 0.
  13625. @item pts
  13626. The Presentation TimeStamp of the input frame, expressed as a number of
  13627. time base units. The time base unit depends on the filter input pad.
  13628. @item pts_time
  13629. The Presentation TimeStamp of the input frame, expressed as a number of
  13630. seconds.
  13631. @item pos
  13632. The position of the frame in the input stream, or -1 if this information is
  13633. unavailable and/or meaningless (for example in case of synthetic video).
  13634. @item fmt
  13635. The pixel format name.
  13636. @item sar
  13637. The sample aspect ratio of the input frame, expressed in the form
  13638. @var{num}/@var{den}.
  13639. @item s
  13640. The size of the input frame. For the syntax of this option, check the
  13641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13642. @item i
  13643. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13644. for bottom field first).
  13645. @item iskey
  13646. This is 1 if the frame is a key frame, 0 otherwise.
  13647. @item type
  13648. The picture type of the input frame ("I" for an I-frame, "P" for a
  13649. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13650. Also refer to the documentation of the @code{AVPictureType} enum and of
  13651. the @code{av_get_picture_type_char} function defined in
  13652. @file{libavutil/avutil.h}.
  13653. @item checksum
  13654. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13655. @item plane_checksum
  13656. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13657. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13658. @item mean
  13659. The mean value of pixels in each plane of the input frame, expressed in the form
  13660. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13661. @item stdev
  13662. The standard deviation of pixel values in each plane of the input frame, expressed
  13663. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13664. @end table
  13665. @section showpalette
  13666. Displays the 256 colors palette of each frame. This filter is only relevant for
  13667. @var{pal8} pixel format frames.
  13668. It accepts the following option:
  13669. @table @option
  13670. @item s
  13671. Set the size of the box used to represent one palette color entry. Default is
  13672. @code{30} (for a @code{30x30} pixel box).
  13673. @end table
  13674. @section shuffleframes
  13675. Reorder and/or duplicate and/or drop video frames.
  13676. It accepts the following parameters:
  13677. @table @option
  13678. @item mapping
  13679. Set the destination indexes of input frames.
  13680. This is space or '|' separated list of indexes that maps input frames to output
  13681. frames. Number of indexes also sets maximal value that each index may have.
  13682. '-1' index have special meaning and that is to drop frame.
  13683. @end table
  13684. The first frame has the index 0. The default is to keep the input unchanged.
  13685. @subsection Examples
  13686. @itemize
  13687. @item
  13688. Swap second and third frame of every three frames of the input:
  13689. @example
  13690. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13691. @end example
  13692. @item
  13693. Swap 10th and 1st frame of every ten frames of the input:
  13694. @example
  13695. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13696. @end example
  13697. @end itemize
  13698. @section shufflepixels
  13699. Reorder pixels in video frames.
  13700. This filter accepts the following options:
  13701. @table @option
  13702. @item direction, d
  13703. Set shuffle direction. Can be forward or inverse direction.
  13704. Default direction is forward.
  13705. @item mode, m
  13706. Set shuffle mode. Can be horizontal, vertical or block mode.
  13707. @item width, w
  13708. @item height, h
  13709. Set shuffle block_size. In case of horizontal shuffle mode only width
  13710. part of size is used, and in case of vertical shuffle mode only height
  13711. part of size is used.
  13712. @item seed, s
  13713. Set random seed used with shuffling pixels. Mainly useful to set to be able
  13714. to reverse filtering process to get original input.
  13715. For example, to reverse forward shuffle you need to use same parameters
  13716. and exact same seed and to set direction to inverse.
  13717. @end table
  13718. @section shuffleplanes
  13719. Reorder and/or duplicate video planes.
  13720. It accepts the following parameters:
  13721. @table @option
  13722. @item map0
  13723. The index of the input plane to be used as the first output plane.
  13724. @item map1
  13725. The index of the input plane to be used as the second output plane.
  13726. @item map2
  13727. The index of the input plane to be used as the third output plane.
  13728. @item map3
  13729. The index of the input plane to be used as the fourth output plane.
  13730. @end table
  13731. The first plane has the index 0. The default is to keep the input unchanged.
  13732. @subsection Examples
  13733. @itemize
  13734. @item
  13735. Swap the second and third planes of the input:
  13736. @example
  13737. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13738. @end example
  13739. @end itemize
  13740. @anchor{signalstats}
  13741. @section signalstats
  13742. Evaluate various visual metrics that assist in determining issues associated
  13743. with the digitization of analog video media.
  13744. By default the filter will log these metadata values:
  13745. @table @option
  13746. @item YMIN
  13747. Display the minimal Y value contained within the input frame. Expressed in
  13748. range of [0-255].
  13749. @item YLOW
  13750. Display the Y value at the 10% percentile within the input frame. Expressed in
  13751. range of [0-255].
  13752. @item YAVG
  13753. Display the average Y value within the input frame. Expressed in range of
  13754. [0-255].
  13755. @item YHIGH
  13756. Display the Y value at the 90% percentile within the input frame. Expressed in
  13757. range of [0-255].
  13758. @item YMAX
  13759. Display the maximum Y value contained within the input frame. Expressed in
  13760. range of [0-255].
  13761. @item UMIN
  13762. Display the minimal U value contained within the input frame. Expressed in
  13763. range of [0-255].
  13764. @item ULOW
  13765. Display the U value at the 10% percentile within the input frame. Expressed in
  13766. range of [0-255].
  13767. @item UAVG
  13768. Display the average U value within the input frame. Expressed in range of
  13769. [0-255].
  13770. @item UHIGH
  13771. Display the U value at the 90% percentile within the input frame. Expressed in
  13772. range of [0-255].
  13773. @item UMAX
  13774. Display the maximum U value contained within the input frame. Expressed in
  13775. range of [0-255].
  13776. @item VMIN
  13777. Display the minimal V value contained within the input frame. Expressed in
  13778. range of [0-255].
  13779. @item VLOW
  13780. Display the V value at the 10% percentile within the input frame. Expressed in
  13781. range of [0-255].
  13782. @item VAVG
  13783. Display the average V value within the input frame. Expressed in range of
  13784. [0-255].
  13785. @item VHIGH
  13786. Display the V value at the 90% percentile within the input frame. Expressed in
  13787. range of [0-255].
  13788. @item VMAX
  13789. Display the maximum V value contained within the input frame. Expressed in
  13790. range of [0-255].
  13791. @item SATMIN
  13792. Display the minimal saturation value contained within the input frame.
  13793. Expressed in range of [0-~181.02].
  13794. @item SATLOW
  13795. Display the saturation value at the 10% percentile within the input frame.
  13796. Expressed in range of [0-~181.02].
  13797. @item SATAVG
  13798. Display the average saturation value within the input frame. Expressed in range
  13799. of [0-~181.02].
  13800. @item SATHIGH
  13801. Display the saturation value at the 90% percentile within the input frame.
  13802. Expressed in range of [0-~181.02].
  13803. @item SATMAX
  13804. Display the maximum saturation value contained within the input frame.
  13805. Expressed in range of [0-~181.02].
  13806. @item HUEMED
  13807. Display the median value for hue within the input frame. Expressed in range of
  13808. [0-360].
  13809. @item HUEAVG
  13810. Display the average value for hue within the input frame. Expressed in range of
  13811. [0-360].
  13812. @item YDIF
  13813. Display the average of sample value difference between all values of the Y
  13814. plane in the current frame and corresponding values of the previous input frame.
  13815. Expressed in range of [0-255].
  13816. @item UDIF
  13817. Display the average of sample value difference between all values of the U
  13818. plane in the current frame and corresponding values of the previous input frame.
  13819. Expressed in range of [0-255].
  13820. @item VDIF
  13821. Display the average of sample value difference between all values of the V
  13822. plane in the current frame and corresponding values of the previous input frame.
  13823. Expressed in range of [0-255].
  13824. @item YBITDEPTH
  13825. Display bit depth of Y plane in current frame.
  13826. Expressed in range of [0-16].
  13827. @item UBITDEPTH
  13828. Display bit depth of U plane in current frame.
  13829. Expressed in range of [0-16].
  13830. @item VBITDEPTH
  13831. Display bit depth of V plane in current frame.
  13832. Expressed in range of [0-16].
  13833. @end table
  13834. The filter accepts the following options:
  13835. @table @option
  13836. @item stat
  13837. @item out
  13838. @option{stat} specify an additional form of image analysis.
  13839. @option{out} output video with the specified type of pixel highlighted.
  13840. Both options accept the following values:
  13841. @table @samp
  13842. @item tout
  13843. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13844. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13845. include the results of video dropouts, head clogs, or tape tracking issues.
  13846. @item vrep
  13847. Identify @var{vertical line repetition}. Vertical line repetition includes
  13848. similar rows of pixels within a frame. In born-digital video vertical line
  13849. repetition is common, but this pattern is uncommon in video digitized from an
  13850. analog source. When it occurs in video that results from the digitization of an
  13851. analog source it can indicate concealment from a dropout compensator.
  13852. @item brng
  13853. Identify pixels that fall outside of legal broadcast range.
  13854. @end table
  13855. @item color, c
  13856. Set the highlight color for the @option{out} option. The default color is
  13857. yellow.
  13858. @end table
  13859. @subsection Examples
  13860. @itemize
  13861. @item
  13862. Output data of various video metrics:
  13863. @example
  13864. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13865. @end example
  13866. @item
  13867. Output specific data about the minimum and maximum values of the Y plane per frame:
  13868. @example
  13869. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13870. @end example
  13871. @item
  13872. Playback video while highlighting pixels that are outside of broadcast range in red.
  13873. @example
  13874. ffplay example.mov -vf signalstats="out=brng:color=red"
  13875. @end example
  13876. @item
  13877. Playback video with signalstats metadata drawn over the frame.
  13878. @example
  13879. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13880. @end example
  13881. The contents of signalstat_drawtext.txt used in the command are:
  13882. @example
  13883. time %@{pts:hms@}
  13884. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13885. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13886. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13887. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13888. @end example
  13889. @end itemize
  13890. @anchor{signature}
  13891. @section signature
  13892. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13893. input. In this case the matching between the inputs can be calculated additionally.
  13894. The filter always passes through the first input. The signature of each stream can
  13895. be written into a file.
  13896. It accepts the following options:
  13897. @table @option
  13898. @item detectmode
  13899. Enable or disable the matching process.
  13900. Available values are:
  13901. @table @samp
  13902. @item off
  13903. Disable the calculation of a matching (default).
  13904. @item full
  13905. Calculate the matching for the whole video and output whether the whole video
  13906. matches or only parts.
  13907. @item fast
  13908. Calculate only until a matching is found or the video ends. Should be faster in
  13909. some cases.
  13910. @end table
  13911. @item nb_inputs
  13912. Set the number of inputs. The option value must be a non negative integer.
  13913. Default value is 1.
  13914. @item filename
  13915. Set the path to which the output is written. If there is more than one input,
  13916. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13917. integer), that will be replaced with the input number. If no filename is
  13918. specified, no output will be written. This is the default.
  13919. @item format
  13920. Choose the output format.
  13921. Available values are:
  13922. @table @samp
  13923. @item binary
  13924. Use the specified binary representation (default).
  13925. @item xml
  13926. Use the specified xml representation.
  13927. @end table
  13928. @item th_d
  13929. Set threshold to detect one word as similar. The option value must be an integer
  13930. greater than zero. The default value is 9000.
  13931. @item th_dc
  13932. Set threshold to detect all words as similar. The option value must be an integer
  13933. greater than zero. The default value is 60000.
  13934. @item th_xh
  13935. Set threshold to detect frames as similar. The option value must be an integer
  13936. greater than zero. The default value is 116.
  13937. @item th_di
  13938. Set the minimum length of a sequence in frames to recognize it as matching
  13939. sequence. The option value must be a non negative integer value.
  13940. The default value is 0.
  13941. @item th_it
  13942. Set the minimum relation, that matching frames to all frames must have.
  13943. The option value must be a double value between 0 and 1. The default value is 0.5.
  13944. @end table
  13945. @subsection Examples
  13946. @itemize
  13947. @item
  13948. To calculate the signature of an input video and store it in signature.bin:
  13949. @example
  13950. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13951. @end example
  13952. @item
  13953. To detect whether two videos match and store the signatures in XML format in
  13954. signature0.xml and signature1.xml:
  13955. @example
  13956. 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 -
  13957. @end example
  13958. @end itemize
  13959. @anchor{smartblur}
  13960. @section smartblur
  13961. Blur the input video without impacting the outlines.
  13962. It accepts the following options:
  13963. @table @option
  13964. @item luma_radius, lr
  13965. Set the luma radius. The option value must be a float number in
  13966. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13967. used to blur the image (slower if larger). Default value is 1.0.
  13968. @item luma_strength, ls
  13969. Set the luma strength. The option value must be a float number
  13970. in the range [-1.0,1.0] that configures the blurring. A value included
  13971. in [0.0,1.0] will blur the image whereas a value included in
  13972. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13973. @item luma_threshold, lt
  13974. Set the luma threshold used as a coefficient to determine
  13975. whether a pixel should be blurred or not. The option value must be an
  13976. integer in the range [-30,30]. A value of 0 will filter all the image,
  13977. a value included in [0,30] will filter flat areas and a value included
  13978. in [-30,0] will filter edges. Default value is 0.
  13979. @item chroma_radius, cr
  13980. Set the chroma radius. The option value must be a float number in
  13981. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13982. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13983. @item chroma_strength, cs
  13984. Set the chroma strength. The option value must be a float number
  13985. in the range [-1.0,1.0] that configures the blurring. A value included
  13986. in [0.0,1.0] will blur the image whereas a value included in
  13987. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13988. @item chroma_threshold, ct
  13989. Set the chroma threshold used as a coefficient to determine
  13990. whether a pixel should be blurred or not. The option value must be an
  13991. integer in the range [-30,30]. A value of 0 will filter all the image,
  13992. a value included in [0,30] will filter flat areas and a value included
  13993. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13994. @end table
  13995. If a chroma option is not explicitly set, the corresponding luma value
  13996. is set.
  13997. @section sobel
  13998. Apply sobel operator to input video stream.
  13999. The filter accepts the following option:
  14000. @table @option
  14001. @item planes
  14002. Set which planes will be processed, unprocessed planes will be copied.
  14003. By default value 0xf, all planes will be processed.
  14004. @item scale
  14005. Set value which will be multiplied with filtered result.
  14006. @item delta
  14007. Set value which will be added to filtered result.
  14008. @end table
  14009. @subsection Commands
  14010. This filter supports the all above options as @ref{commands}.
  14011. @anchor{spp}
  14012. @section spp
  14013. Apply a simple postprocessing filter that compresses and decompresses the image
  14014. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  14015. and average the results.
  14016. The filter accepts the following options:
  14017. @table @option
  14018. @item quality
  14019. Set quality. This option defines the number of levels for averaging. It accepts
  14020. an integer in the range 0-6. If set to @code{0}, the filter will have no
  14021. effect. A value of @code{6} means the higher quality. For each increment of
  14022. that value the speed drops by a factor of approximately 2. Default value is
  14023. @code{3}.
  14024. @item qp
  14025. Force a constant quantization parameter. If not set, the filter will use the QP
  14026. from the video stream (if available).
  14027. @item mode
  14028. Set thresholding mode. Available modes are:
  14029. @table @samp
  14030. @item hard
  14031. Set hard thresholding (default).
  14032. @item soft
  14033. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14034. @end table
  14035. @item use_bframe_qp
  14036. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  14037. option may cause flicker since the B-Frames have often larger QP. Default is
  14038. @code{0} (not enabled).
  14039. @end table
  14040. @subsection Commands
  14041. This filter supports the following commands:
  14042. @table @option
  14043. @item quality, level
  14044. Set quality level. The value @code{max} can be used to set the maximum level,
  14045. currently @code{6}.
  14046. @end table
  14047. @anchor{sr}
  14048. @section sr
  14049. Scale the input by applying one of the super-resolution methods based on
  14050. convolutional neural networks. Supported models:
  14051. @itemize
  14052. @item
  14053. Super-Resolution Convolutional Neural Network model (SRCNN).
  14054. See @url{https://arxiv.org/abs/1501.00092}.
  14055. @item
  14056. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  14057. See @url{https://arxiv.org/abs/1609.05158}.
  14058. @end itemize
  14059. Training scripts as well as scripts for model file (.pb) saving can be found at
  14060. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  14061. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  14062. Native model files (.model) can be generated from TensorFlow model
  14063. files (.pb) by using tools/python/convert.py
  14064. The filter accepts the following options:
  14065. @table @option
  14066. @item dnn_backend
  14067. Specify which DNN backend to use for model loading and execution. This option accepts
  14068. the following values:
  14069. @table @samp
  14070. @item native
  14071. Native implementation of DNN loading and execution.
  14072. @item tensorflow
  14073. TensorFlow backend. To enable this backend you
  14074. need to install the TensorFlow for C library (see
  14075. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  14076. @code{--enable-libtensorflow}
  14077. @end table
  14078. Default value is @samp{native}.
  14079. @item model
  14080. Set path to model file specifying network architecture and its parameters.
  14081. Note that different backends use different file formats. TensorFlow backend
  14082. can load files for both formats, while native backend can load files for only
  14083. its format.
  14084. @item scale_factor
  14085. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  14086. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  14087. input upscaled using bicubic upscaling with proper scale factor.
  14088. @end table
  14089. This feature can also be finished with @ref{dnn_processing} filter.
  14090. @section ssim
  14091. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  14092. This filter takes in input two input videos, the first input is
  14093. considered the "main" source and is passed unchanged to the
  14094. output. The second input is used as a "reference" video for computing
  14095. the SSIM.
  14096. Both video inputs must have the same resolution and pixel format for
  14097. this filter to work correctly. Also it assumes that both inputs
  14098. have the same number of frames, which are compared one by one.
  14099. The filter stores the calculated SSIM of each frame.
  14100. The description of the accepted parameters follows.
  14101. @table @option
  14102. @item stats_file, f
  14103. If specified the filter will use the named file to save the SSIM of
  14104. each individual frame. When filename equals "-" the data is sent to
  14105. standard output.
  14106. @end table
  14107. The file printed if @var{stats_file} is selected, contains a sequence of
  14108. key/value pairs of the form @var{key}:@var{value} for each compared
  14109. couple of frames.
  14110. A description of each shown parameter follows:
  14111. @table @option
  14112. @item n
  14113. sequential number of the input frame, starting from 1
  14114. @item Y, U, V, R, G, B
  14115. SSIM of the compared frames for the component specified by the suffix.
  14116. @item All
  14117. SSIM of the compared frames for the whole frame.
  14118. @item dB
  14119. Same as above but in dB representation.
  14120. @end table
  14121. This filter also supports the @ref{framesync} options.
  14122. @subsection Examples
  14123. @itemize
  14124. @item
  14125. For example:
  14126. @example
  14127. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14128. [main][ref] ssim="stats_file=stats.log" [out]
  14129. @end example
  14130. On this example the input file being processed is compared with the
  14131. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  14132. is stored in @file{stats.log}.
  14133. @item
  14134. Another example with both psnr and ssim at same time:
  14135. @example
  14136. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  14137. @end example
  14138. @item
  14139. Another example with different containers:
  14140. @example
  14141. 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 -
  14142. @end example
  14143. @end itemize
  14144. @section stereo3d
  14145. Convert between different stereoscopic image formats.
  14146. The filters accept the following options:
  14147. @table @option
  14148. @item in
  14149. Set stereoscopic image format of input.
  14150. Available values for input image formats are:
  14151. @table @samp
  14152. @item sbsl
  14153. side by side parallel (left eye left, right eye right)
  14154. @item sbsr
  14155. side by side crosseye (right eye left, left eye right)
  14156. @item sbs2l
  14157. side by side parallel with half width resolution
  14158. (left eye left, right eye right)
  14159. @item sbs2r
  14160. side by side crosseye with half width resolution
  14161. (right eye left, left eye right)
  14162. @item abl
  14163. @item tbl
  14164. above-below (left eye above, right eye below)
  14165. @item abr
  14166. @item tbr
  14167. above-below (right eye above, left eye below)
  14168. @item ab2l
  14169. @item tb2l
  14170. above-below with half height resolution
  14171. (left eye above, right eye below)
  14172. @item ab2r
  14173. @item tb2r
  14174. above-below with half height resolution
  14175. (right eye above, left eye below)
  14176. @item al
  14177. alternating frames (left eye first, right eye second)
  14178. @item ar
  14179. alternating frames (right eye first, left eye second)
  14180. @item irl
  14181. interleaved rows (left eye has top row, right eye starts on next row)
  14182. @item irr
  14183. interleaved rows (right eye has top row, left eye starts on next row)
  14184. @item icl
  14185. interleaved columns, left eye first
  14186. @item icr
  14187. interleaved columns, right eye first
  14188. Default value is @samp{sbsl}.
  14189. @end table
  14190. @item out
  14191. Set stereoscopic image format of output.
  14192. @table @samp
  14193. @item sbsl
  14194. side by side parallel (left eye left, right eye right)
  14195. @item sbsr
  14196. side by side crosseye (right eye left, left eye right)
  14197. @item sbs2l
  14198. side by side parallel with half width resolution
  14199. (left eye left, right eye right)
  14200. @item sbs2r
  14201. side by side crosseye with half width resolution
  14202. (right eye left, left eye right)
  14203. @item abl
  14204. @item tbl
  14205. above-below (left eye above, right eye below)
  14206. @item abr
  14207. @item tbr
  14208. above-below (right eye above, left eye below)
  14209. @item ab2l
  14210. @item tb2l
  14211. above-below with half height resolution
  14212. (left eye above, right eye below)
  14213. @item ab2r
  14214. @item tb2r
  14215. above-below with half height resolution
  14216. (right eye above, left eye below)
  14217. @item al
  14218. alternating frames (left eye first, right eye second)
  14219. @item ar
  14220. alternating frames (right eye first, left eye second)
  14221. @item irl
  14222. interleaved rows (left eye has top row, right eye starts on next row)
  14223. @item irr
  14224. interleaved rows (right eye has top row, left eye starts on next row)
  14225. @item arbg
  14226. anaglyph red/blue gray
  14227. (red filter on left eye, blue filter on right eye)
  14228. @item argg
  14229. anaglyph red/green gray
  14230. (red filter on left eye, green filter on right eye)
  14231. @item arcg
  14232. anaglyph red/cyan gray
  14233. (red filter on left eye, cyan filter on right eye)
  14234. @item arch
  14235. anaglyph red/cyan half colored
  14236. (red filter on left eye, cyan filter on right eye)
  14237. @item arcc
  14238. anaglyph red/cyan color
  14239. (red filter on left eye, cyan filter on right eye)
  14240. @item arcd
  14241. anaglyph red/cyan color optimized with the least squares projection of dubois
  14242. (red filter on left eye, cyan filter on right eye)
  14243. @item agmg
  14244. anaglyph green/magenta gray
  14245. (green filter on left eye, magenta filter on right eye)
  14246. @item agmh
  14247. anaglyph green/magenta half colored
  14248. (green filter on left eye, magenta filter on right eye)
  14249. @item agmc
  14250. anaglyph green/magenta colored
  14251. (green filter on left eye, magenta filter on right eye)
  14252. @item agmd
  14253. anaglyph green/magenta color optimized with the least squares projection of dubois
  14254. (green filter on left eye, magenta filter on right eye)
  14255. @item aybg
  14256. anaglyph yellow/blue gray
  14257. (yellow filter on left eye, blue filter on right eye)
  14258. @item aybh
  14259. anaglyph yellow/blue half colored
  14260. (yellow filter on left eye, blue filter on right eye)
  14261. @item aybc
  14262. anaglyph yellow/blue colored
  14263. (yellow filter on left eye, blue filter on right eye)
  14264. @item aybd
  14265. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14266. (yellow filter on left eye, blue filter on right eye)
  14267. @item ml
  14268. mono output (left eye only)
  14269. @item mr
  14270. mono output (right eye only)
  14271. @item chl
  14272. checkerboard, left eye first
  14273. @item chr
  14274. checkerboard, right eye first
  14275. @item icl
  14276. interleaved columns, left eye first
  14277. @item icr
  14278. interleaved columns, right eye first
  14279. @item hdmi
  14280. HDMI frame pack
  14281. @end table
  14282. Default value is @samp{arcd}.
  14283. @end table
  14284. @subsection Examples
  14285. @itemize
  14286. @item
  14287. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14288. @example
  14289. stereo3d=sbsl:aybd
  14290. @end example
  14291. @item
  14292. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14293. @example
  14294. stereo3d=abl:sbsr
  14295. @end example
  14296. @end itemize
  14297. @section streamselect, astreamselect
  14298. Select video or audio streams.
  14299. The filter accepts the following options:
  14300. @table @option
  14301. @item inputs
  14302. Set number of inputs. Default is 2.
  14303. @item map
  14304. Set input indexes to remap to outputs.
  14305. @end table
  14306. @subsection Commands
  14307. The @code{streamselect} and @code{astreamselect} filter supports the following
  14308. commands:
  14309. @table @option
  14310. @item map
  14311. Set input indexes to remap to outputs.
  14312. @end table
  14313. @subsection Examples
  14314. @itemize
  14315. @item
  14316. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14317. @example
  14318. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14319. @end example
  14320. @item
  14321. Same as above, but for audio:
  14322. @example
  14323. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14324. @end example
  14325. @end itemize
  14326. @anchor{subtitles}
  14327. @section subtitles
  14328. Draw subtitles on top of input video using the libass library.
  14329. To enable compilation of this filter you need to configure FFmpeg with
  14330. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14331. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14332. Alpha) subtitles format.
  14333. The filter accepts the following options:
  14334. @table @option
  14335. @item filename, f
  14336. Set the filename of the subtitle file to read. It must be specified.
  14337. @item original_size
  14338. Specify the size of the original video, the video for which the ASS file
  14339. was composed. For the syntax of this option, check the
  14340. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14341. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14342. correctly scale the fonts if the aspect ratio has been changed.
  14343. @item fontsdir
  14344. Set a directory path containing fonts that can be used by the filter.
  14345. These fonts will be used in addition to whatever the font provider uses.
  14346. @item alpha
  14347. Process alpha channel, by default alpha channel is untouched.
  14348. @item charenc
  14349. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14350. useful if not UTF-8.
  14351. @item stream_index, si
  14352. Set subtitles stream index. @code{subtitles} filter only.
  14353. @item force_style
  14354. Override default style or script info parameters of the subtitles. It accepts a
  14355. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14356. @end table
  14357. If the first key is not specified, it is assumed that the first value
  14358. specifies the @option{filename}.
  14359. For example, to render the file @file{sub.srt} on top of the input
  14360. video, use the command:
  14361. @example
  14362. subtitles=sub.srt
  14363. @end example
  14364. which is equivalent to:
  14365. @example
  14366. subtitles=filename=sub.srt
  14367. @end example
  14368. To render the default subtitles stream from file @file{video.mkv}, use:
  14369. @example
  14370. subtitles=video.mkv
  14371. @end example
  14372. To render the second subtitles stream from that file, use:
  14373. @example
  14374. subtitles=video.mkv:si=1
  14375. @end example
  14376. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14377. @code{DejaVu Serif}, use:
  14378. @example
  14379. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14380. @end example
  14381. @section super2xsai
  14382. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14383. Interpolate) pixel art scaling algorithm.
  14384. Useful for enlarging pixel art images without reducing sharpness.
  14385. @section swaprect
  14386. Swap two rectangular objects in video.
  14387. This filter accepts the following options:
  14388. @table @option
  14389. @item w
  14390. Set object width.
  14391. @item h
  14392. Set object height.
  14393. @item x1
  14394. Set 1st rect x coordinate.
  14395. @item y1
  14396. Set 1st rect y coordinate.
  14397. @item x2
  14398. Set 2nd rect x coordinate.
  14399. @item y2
  14400. Set 2nd rect y coordinate.
  14401. All expressions are evaluated once for each frame.
  14402. @end table
  14403. The all options are expressions containing the following constants:
  14404. @table @option
  14405. @item w
  14406. @item h
  14407. The input width and height.
  14408. @item a
  14409. same as @var{w} / @var{h}
  14410. @item sar
  14411. input sample aspect ratio
  14412. @item dar
  14413. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14414. @item n
  14415. The number of the input frame, starting from 0.
  14416. @item t
  14417. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14418. @item pos
  14419. the position in the file of the input frame, NAN if unknown
  14420. @end table
  14421. @section swapuv
  14422. Swap U & V plane.
  14423. @section tblend
  14424. Blend successive video frames.
  14425. See @ref{blend}
  14426. @section telecine
  14427. Apply telecine process to the video.
  14428. This filter accepts the following options:
  14429. @table @option
  14430. @item first_field
  14431. @table @samp
  14432. @item top, t
  14433. top field first
  14434. @item bottom, b
  14435. bottom field first
  14436. The default value is @code{top}.
  14437. @end table
  14438. @item pattern
  14439. A string of numbers representing the pulldown pattern you wish to apply.
  14440. The default value is @code{23}.
  14441. @end table
  14442. @example
  14443. Some typical patterns:
  14444. NTSC output (30i):
  14445. 27.5p: 32222
  14446. 24p: 23 (classic)
  14447. 24p: 2332 (preferred)
  14448. 20p: 33
  14449. 18p: 334
  14450. 16p: 3444
  14451. PAL output (25i):
  14452. 27.5p: 12222
  14453. 24p: 222222222223 ("Euro pulldown")
  14454. 16.67p: 33
  14455. 16p: 33333334
  14456. @end example
  14457. @section thistogram
  14458. Compute and draw a color distribution histogram for the input video across time.
  14459. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14460. at certain time, this filter shows also past histograms of number of frames defined
  14461. by @code{width} option.
  14462. The computed histogram is a representation of the color component
  14463. distribution in an image.
  14464. The filter accepts the following options:
  14465. @table @option
  14466. @item width, w
  14467. Set width of single color component output. Default value is @code{0}.
  14468. Value of @code{0} means width will be picked from input video.
  14469. This also set number of passed histograms to keep.
  14470. Allowed range is [0, 8192].
  14471. @item display_mode, d
  14472. Set display mode.
  14473. It accepts the following values:
  14474. @table @samp
  14475. @item stack
  14476. Per color component graphs are placed below each other.
  14477. @item parade
  14478. Per color component graphs are placed side by side.
  14479. @item overlay
  14480. Presents information identical to that in the @code{parade}, except
  14481. that the graphs representing color components are superimposed directly
  14482. over one another.
  14483. @end table
  14484. Default is @code{stack}.
  14485. @item levels_mode, m
  14486. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14487. Default is @code{linear}.
  14488. @item components, c
  14489. Set what color components to display.
  14490. Default is @code{7}.
  14491. @item bgopacity, b
  14492. Set background opacity. Default is @code{0.9}.
  14493. @item envelope, e
  14494. Show envelope. Default is disabled.
  14495. @item ecolor, ec
  14496. Set envelope color. Default is @code{gold}.
  14497. @item slide
  14498. Set slide mode.
  14499. Available values for slide is:
  14500. @table @samp
  14501. @item frame
  14502. Draw new frame when right border is reached.
  14503. @item replace
  14504. Replace old columns with new ones.
  14505. @item scroll
  14506. Scroll from right to left.
  14507. @item rscroll
  14508. Scroll from left to right.
  14509. @item picture
  14510. Draw single picture.
  14511. @end table
  14512. Default is @code{replace}.
  14513. @end table
  14514. @section threshold
  14515. Apply threshold effect to video stream.
  14516. This filter needs four video streams to perform thresholding.
  14517. First stream is stream we are filtering.
  14518. Second stream is holding threshold values, third stream is holding min values,
  14519. and last, fourth stream is holding max values.
  14520. The filter accepts the following option:
  14521. @table @option
  14522. @item planes
  14523. Set which planes will be processed, unprocessed planes will be copied.
  14524. By default value 0xf, all planes will be processed.
  14525. @end table
  14526. For example if first stream pixel's component value is less then threshold value
  14527. of pixel component from 2nd threshold stream, third stream value will picked,
  14528. otherwise fourth stream pixel component value will be picked.
  14529. Using color source filter one can perform various types of thresholding:
  14530. @subsection Examples
  14531. @itemize
  14532. @item
  14533. Binary threshold, using gray color as threshold:
  14534. @example
  14535. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14536. @end example
  14537. @item
  14538. Inverted binary threshold, using gray color as threshold:
  14539. @example
  14540. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14541. @end example
  14542. @item
  14543. Truncate binary threshold, using gray color as threshold:
  14544. @example
  14545. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14546. @end example
  14547. @item
  14548. Threshold to zero, using gray color as threshold:
  14549. @example
  14550. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14551. @end example
  14552. @item
  14553. Inverted threshold to zero, using gray color as threshold:
  14554. @example
  14555. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14556. @end example
  14557. @end itemize
  14558. @section thumbnail
  14559. Select the most representative frame in a given sequence of consecutive frames.
  14560. The filter accepts the following options:
  14561. @table @option
  14562. @item n
  14563. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14564. will pick one of them, and then handle the next batch of @var{n} frames until
  14565. the end. Default is @code{100}.
  14566. @end table
  14567. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14568. value will result in a higher memory usage, so a high value is not recommended.
  14569. @subsection Examples
  14570. @itemize
  14571. @item
  14572. Extract one picture each 50 frames:
  14573. @example
  14574. thumbnail=50
  14575. @end example
  14576. @item
  14577. Complete example of a thumbnail creation with @command{ffmpeg}:
  14578. @example
  14579. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14580. @end example
  14581. @end itemize
  14582. @anchor{tile}
  14583. @section tile
  14584. Tile several successive frames together.
  14585. The @ref{untile} filter can do the reverse.
  14586. The filter accepts the following options:
  14587. @table @option
  14588. @item layout
  14589. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14590. this option, check the
  14591. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14592. @item nb_frames
  14593. Set the maximum number of frames to render in the given area. It must be less
  14594. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14595. the area will be used.
  14596. @item margin
  14597. Set the outer border margin in pixels.
  14598. @item padding
  14599. Set the inner border thickness (i.e. the number of pixels between frames). For
  14600. more advanced padding options (such as having different values for the edges),
  14601. refer to the pad video filter.
  14602. @item color
  14603. Specify the color of the unused area. For the syntax of this option, check the
  14604. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14605. The default value of @var{color} is "black".
  14606. @item overlap
  14607. Set the number of frames to overlap when tiling several successive frames together.
  14608. The value must be between @code{0} and @var{nb_frames - 1}.
  14609. @item init_padding
  14610. Set the number of frames to initially be empty before displaying first output frame.
  14611. This controls how soon will one get first output frame.
  14612. The value must be between @code{0} and @var{nb_frames - 1}.
  14613. @end table
  14614. @subsection Examples
  14615. @itemize
  14616. @item
  14617. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14618. @example
  14619. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14620. @end example
  14621. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14622. duplicating each output frame to accommodate the originally detected frame
  14623. rate.
  14624. @item
  14625. Display @code{5} pictures in an area of @code{3x2} frames,
  14626. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14627. mixed flat and named options:
  14628. @example
  14629. tile=3x2:nb_frames=5:padding=7:margin=2
  14630. @end example
  14631. @end itemize
  14632. @section tinterlace
  14633. Perform various types of temporal field interlacing.
  14634. Frames are counted starting from 1, so the first input frame is
  14635. considered odd.
  14636. The filter accepts the following options:
  14637. @table @option
  14638. @item mode
  14639. Specify the mode of the interlacing. This option can also be specified
  14640. as a value alone. See below for a list of values for this option.
  14641. Available values are:
  14642. @table @samp
  14643. @item merge, 0
  14644. Move odd frames into the upper field, even into the lower field,
  14645. generating a double height frame at half frame rate.
  14646. @example
  14647. ------> time
  14648. Input:
  14649. Frame 1 Frame 2 Frame 3 Frame 4
  14650. 11111 22222 33333 44444
  14651. 11111 22222 33333 44444
  14652. 11111 22222 33333 44444
  14653. 11111 22222 33333 44444
  14654. Output:
  14655. 11111 33333
  14656. 22222 44444
  14657. 11111 33333
  14658. 22222 44444
  14659. 11111 33333
  14660. 22222 44444
  14661. 11111 33333
  14662. 22222 44444
  14663. @end example
  14664. @item drop_even, 1
  14665. Only output odd frames, even frames are dropped, generating a frame with
  14666. unchanged height at half frame rate.
  14667. @example
  14668. ------> time
  14669. Input:
  14670. Frame 1 Frame 2 Frame 3 Frame 4
  14671. 11111 22222 33333 44444
  14672. 11111 22222 33333 44444
  14673. 11111 22222 33333 44444
  14674. 11111 22222 33333 44444
  14675. Output:
  14676. 11111 33333
  14677. 11111 33333
  14678. 11111 33333
  14679. 11111 33333
  14680. @end example
  14681. @item drop_odd, 2
  14682. Only output even frames, odd frames are dropped, generating a frame with
  14683. unchanged height at half frame rate.
  14684. @example
  14685. ------> time
  14686. Input:
  14687. Frame 1 Frame 2 Frame 3 Frame 4
  14688. 11111 22222 33333 44444
  14689. 11111 22222 33333 44444
  14690. 11111 22222 33333 44444
  14691. 11111 22222 33333 44444
  14692. Output:
  14693. 22222 44444
  14694. 22222 44444
  14695. 22222 44444
  14696. 22222 44444
  14697. @end example
  14698. @item pad, 3
  14699. Expand each frame to full height, but pad alternate lines with black,
  14700. generating a frame with double height at the same input frame rate.
  14701. @example
  14702. ------> time
  14703. Input:
  14704. Frame 1 Frame 2 Frame 3 Frame 4
  14705. 11111 22222 33333 44444
  14706. 11111 22222 33333 44444
  14707. 11111 22222 33333 44444
  14708. 11111 22222 33333 44444
  14709. Output:
  14710. 11111 ..... 33333 .....
  14711. ..... 22222 ..... 44444
  14712. 11111 ..... 33333 .....
  14713. ..... 22222 ..... 44444
  14714. 11111 ..... 33333 .....
  14715. ..... 22222 ..... 44444
  14716. 11111 ..... 33333 .....
  14717. ..... 22222 ..... 44444
  14718. @end example
  14719. @item interleave_top, 4
  14720. Interleave the upper field from odd frames with the lower field from
  14721. even frames, generating a frame with unchanged height at half frame rate.
  14722. @example
  14723. ------> time
  14724. Input:
  14725. Frame 1 Frame 2 Frame 3 Frame 4
  14726. 11111<- 22222 33333<- 44444
  14727. 11111 22222<- 33333 44444<-
  14728. 11111<- 22222 33333<- 44444
  14729. 11111 22222<- 33333 44444<-
  14730. Output:
  14731. 11111 33333
  14732. 22222 44444
  14733. 11111 33333
  14734. 22222 44444
  14735. @end example
  14736. @item interleave_bottom, 5
  14737. Interleave the lower field from odd frames with the upper field from
  14738. even frames, generating a frame with unchanged height at half frame rate.
  14739. @example
  14740. ------> time
  14741. Input:
  14742. Frame 1 Frame 2 Frame 3 Frame 4
  14743. 11111 22222<- 33333 44444<-
  14744. 11111<- 22222 33333<- 44444
  14745. 11111 22222<- 33333 44444<-
  14746. 11111<- 22222 33333<- 44444
  14747. Output:
  14748. 22222 44444
  14749. 11111 33333
  14750. 22222 44444
  14751. 11111 33333
  14752. @end example
  14753. @item interlacex2, 6
  14754. Double frame rate with unchanged height. Frames are inserted each
  14755. containing the second temporal field from the previous input frame and
  14756. the first temporal field from the next input frame. This mode relies on
  14757. the top_field_first flag. Useful for interlaced video displays with no
  14758. field synchronisation.
  14759. @example
  14760. ------> time
  14761. Input:
  14762. Frame 1 Frame 2 Frame 3 Frame 4
  14763. 11111 22222 33333 44444
  14764. 11111 22222 33333 44444
  14765. 11111 22222 33333 44444
  14766. 11111 22222 33333 44444
  14767. Output:
  14768. 11111 22222 22222 33333 33333 44444 44444
  14769. 11111 11111 22222 22222 33333 33333 44444
  14770. 11111 22222 22222 33333 33333 44444 44444
  14771. 11111 11111 22222 22222 33333 33333 44444
  14772. @end example
  14773. @item mergex2, 7
  14774. Move odd frames into the upper field, even into the lower field,
  14775. generating a double height frame at same frame rate.
  14776. @example
  14777. ------> time
  14778. Input:
  14779. Frame 1 Frame 2 Frame 3 Frame 4
  14780. 11111 22222 33333 44444
  14781. 11111 22222 33333 44444
  14782. 11111 22222 33333 44444
  14783. 11111 22222 33333 44444
  14784. Output:
  14785. 11111 33333 33333 55555
  14786. 22222 22222 44444 44444
  14787. 11111 33333 33333 55555
  14788. 22222 22222 44444 44444
  14789. 11111 33333 33333 55555
  14790. 22222 22222 44444 44444
  14791. 11111 33333 33333 55555
  14792. 22222 22222 44444 44444
  14793. @end example
  14794. @end table
  14795. Numeric values are deprecated but are accepted for backward
  14796. compatibility reasons.
  14797. Default mode is @code{merge}.
  14798. @item flags
  14799. Specify flags influencing the filter process.
  14800. Available value for @var{flags} is:
  14801. @table @option
  14802. @item low_pass_filter, vlpf
  14803. Enable linear vertical low-pass filtering in the filter.
  14804. Vertical low-pass filtering is required when creating an interlaced
  14805. destination from a progressive source which contains high-frequency
  14806. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14807. patterning.
  14808. @item complex_filter, cvlpf
  14809. Enable complex vertical low-pass filtering.
  14810. This will slightly less reduce interlace 'twitter' and Moire
  14811. patterning but better retain detail and subjective sharpness impression.
  14812. @item bypass_il
  14813. Bypass already interlaced frames, only adjust the frame rate.
  14814. @end table
  14815. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14816. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14817. @end table
  14818. @section tmedian
  14819. Pick median pixels from several successive input video frames.
  14820. The filter accepts the following options:
  14821. @table @option
  14822. @item radius
  14823. Set radius of median filter.
  14824. Default is 1. Allowed range is from 1 to 127.
  14825. @item planes
  14826. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14827. @item percentile
  14828. Set median percentile. Default value is @code{0.5}.
  14829. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14830. minimum values, and @code{1} maximum values.
  14831. @end table
  14832. @subsection Commands
  14833. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  14834. @section tmidequalizer
  14835. Apply Temporal Midway Video Equalization effect.
  14836. Midway Video Equalization adjusts a sequence of video frames to have the same
  14837. histograms, while maintaining their dynamics as much as possible. It's
  14838. useful for e.g. matching exposures from a video frames sequence.
  14839. This filter accepts the following option:
  14840. @table @option
  14841. @item radius
  14842. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  14843. @item sigma
  14844. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  14845. Setting this option to 0 effectively does nothing.
  14846. @item planes
  14847. Set which planes to process. Default is @code{15}, which is all available planes.
  14848. @end table
  14849. @section tmix
  14850. Mix successive video frames.
  14851. A description of the accepted options follows.
  14852. @table @option
  14853. @item frames
  14854. The number of successive frames to mix. If unspecified, it defaults to 3.
  14855. @item weights
  14856. Specify weight of each input video frame.
  14857. Each weight is separated by space. If number of weights is smaller than
  14858. number of @var{frames} last specified weight will be used for all remaining
  14859. unset weights.
  14860. @item scale
  14861. Specify scale, if it is set it will be multiplied with sum
  14862. of each weight multiplied with pixel values to give final destination
  14863. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14864. @end table
  14865. @subsection Examples
  14866. @itemize
  14867. @item
  14868. Average 7 successive frames:
  14869. @example
  14870. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14871. @end example
  14872. @item
  14873. Apply simple temporal convolution:
  14874. @example
  14875. tmix=frames=3:weights="-1 3 -1"
  14876. @end example
  14877. @item
  14878. Similar as above but only showing temporal differences:
  14879. @example
  14880. tmix=frames=3:weights="-1 2 -1":scale=1
  14881. @end example
  14882. @end itemize
  14883. @anchor{tonemap}
  14884. @section tonemap
  14885. Tone map colors from different dynamic ranges.
  14886. This filter expects data in single precision floating point, as it needs to
  14887. operate on (and can output) out-of-range values. Another filter, such as
  14888. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14889. The tonemapping algorithms implemented only work on linear light, so input
  14890. data should be linearized beforehand (and possibly correctly tagged).
  14891. @example
  14892. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14893. @end example
  14894. @subsection Options
  14895. The filter accepts the following options.
  14896. @table @option
  14897. @item tonemap
  14898. Set the tone map algorithm to use.
  14899. Possible values are:
  14900. @table @var
  14901. @item none
  14902. Do not apply any tone map, only desaturate overbright pixels.
  14903. @item clip
  14904. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14905. in-range values, while distorting out-of-range values.
  14906. @item linear
  14907. Stretch the entire reference gamut to a linear multiple of the display.
  14908. @item gamma
  14909. Fit a logarithmic transfer between the tone curves.
  14910. @item reinhard
  14911. Preserve overall image brightness with a simple curve, using nonlinear
  14912. contrast, which results in flattening details and degrading color accuracy.
  14913. @item hable
  14914. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14915. of slightly darkening everything. Use it when detail preservation is more
  14916. important than color and brightness accuracy.
  14917. @item mobius
  14918. Smoothly map out-of-range values, while retaining contrast and colors for
  14919. in-range material as much as possible. Use it when color accuracy is more
  14920. important than detail preservation.
  14921. @end table
  14922. Default is none.
  14923. @item param
  14924. Tune the tone mapping algorithm.
  14925. This affects the following algorithms:
  14926. @table @var
  14927. @item none
  14928. Ignored.
  14929. @item linear
  14930. Specifies the scale factor to use while stretching.
  14931. Default to 1.0.
  14932. @item gamma
  14933. Specifies the exponent of the function.
  14934. Default to 1.8.
  14935. @item clip
  14936. Specify an extra linear coefficient to multiply into the signal before clipping.
  14937. Default to 1.0.
  14938. @item reinhard
  14939. Specify the local contrast coefficient at the display peak.
  14940. Default to 0.5, which means that in-gamut values will be about half as bright
  14941. as when clipping.
  14942. @item hable
  14943. Ignored.
  14944. @item mobius
  14945. Specify the transition point from linear to mobius transform. Every value
  14946. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14947. more accurate the result will be, at the cost of losing bright details.
  14948. Default to 0.3, which due to the steep initial slope still preserves in-range
  14949. colors fairly accurately.
  14950. @end table
  14951. @item desat
  14952. Apply desaturation for highlights that exceed this level of brightness. The
  14953. higher the parameter, the more color information will be preserved. This
  14954. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14955. (smoothly) turning into white instead. This makes images feel more natural,
  14956. at the cost of reducing information about out-of-range colors.
  14957. The default of 2.0 is somewhat conservative and will mostly just apply to
  14958. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14959. This option works only if the input frame has a supported color tag.
  14960. @item peak
  14961. Override signal/nominal/reference peak with this value. Useful when the
  14962. embedded peak information in display metadata is not reliable or when tone
  14963. mapping from a lower range to a higher range.
  14964. @end table
  14965. @section tpad
  14966. Temporarily pad video frames.
  14967. The filter accepts the following options:
  14968. @table @option
  14969. @item start
  14970. Specify number of delay frames before input video stream. Default is 0.
  14971. @item stop
  14972. Specify number of padding frames after input video stream.
  14973. Set to -1 to pad indefinitely. Default is 0.
  14974. @item start_mode
  14975. Set kind of frames added to beginning of stream.
  14976. Can be either @var{add} or @var{clone}.
  14977. With @var{add} frames of solid-color are added.
  14978. With @var{clone} frames are clones of first frame.
  14979. Default is @var{add}.
  14980. @item stop_mode
  14981. Set kind of frames added to end of stream.
  14982. Can be either @var{add} or @var{clone}.
  14983. With @var{add} frames of solid-color are added.
  14984. With @var{clone} frames are clones of last frame.
  14985. Default is @var{add}.
  14986. @item start_duration, stop_duration
  14987. Specify the duration of the start/stop delay. See
  14988. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14989. for the accepted syntax.
  14990. These options override @var{start} and @var{stop}. Default is 0.
  14991. @item color
  14992. Specify the color of the padded area. For the syntax of this option,
  14993. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14994. manual,ffmpeg-utils}.
  14995. The default value of @var{color} is "black".
  14996. @end table
  14997. @anchor{transpose}
  14998. @section transpose
  14999. Transpose rows with columns in the input video and optionally flip it.
  15000. It accepts the following parameters:
  15001. @table @option
  15002. @item dir
  15003. Specify the transposition direction.
  15004. Can assume the following values:
  15005. @table @samp
  15006. @item 0, 4, cclock_flip
  15007. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  15008. @example
  15009. L.R L.l
  15010. . . -> . .
  15011. l.r R.r
  15012. @end example
  15013. @item 1, 5, clock
  15014. Rotate by 90 degrees clockwise, that is:
  15015. @example
  15016. L.R l.L
  15017. . . -> . .
  15018. l.r r.R
  15019. @end example
  15020. @item 2, 6, cclock
  15021. Rotate by 90 degrees counterclockwise, that is:
  15022. @example
  15023. L.R R.r
  15024. . . -> . .
  15025. l.r L.l
  15026. @end example
  15027. @item 3, 7, clock_flip
  15028. Rotate by 90 degrees clockwise and vertically flip, that is:
  15029. @example
  15030. L.R r.R
  15031. . . -> . .
  15032. l.r l.L
  15033. @end example
  15034. @end table
  15035. For values between 4-7, the transposition is only done if the input
  15036. video geometry is portrait and not landscape. These values are
  15037. deprecated, the @code{passthrough} option should be used instead.
  15038. Numerical values are deprecated, and should be dropped in favor of
  15039. symbolic constants.
  15040. @item passthrough
  15041. Do not apply the transposition if the input geometry matches the one
  15042. specified by the specified value. It accepts the following values:
  15043. @table @samp
  15044. @item none
  15045. Always apply transposition.
  15046. @item portrait
  15047. Preserve portrait geometry (when @var{height} >= @var{width}).
  15048. @item landscape
  15049. Preserve landscape geometry (when @var{width} >= @var{height}).
  15050. @end table
  15051. Default value is @code{none}.
  15052. @end table
  15053. For example to rotate by 90 degrees clockwise and preserve portrait
  15054. layout:
  15055. @example
  15056. transpose=dir=1:passthrough=portrait
  15057. @end example
  15058. The command above can also be specified as:
  15059. @example
  15060. transpose=1:portrait
  15061. @end example
  15062. @section transpose_npp
  15063. Transpose rows with columns in the input video and optionally flip it.
  15064. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  15065. It accepts the following parameters:
  15066. @table @option
  15067. @item dir
  15068. Specify the transposition direction.
  15069. Can assume the following values:
  15070. @table @samp
  15071. @item cclock_flip
  15072. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  15073. @item clock
  15074. Rotate by 90 degrees clockwise.
  15075. @item cclock
  15076. Rotate by 90 degrees counterclockwise.
  15077. @item clock_flip
  15078. Rotate by 90 degrees clockwise and vertically flip.
  15079. @end table
  15080. @item passthrough
  15081. Do not apply the transposition if the input geometry matches the one
  15082. specified by the specified value. It accepts the following values:
  15083. @table @samp
  15084. @item none
  15085. Always apply transposition. (default)
  15086. @item portrait
  15087. Preserve portrait geometry (when @var{height} >= @var{width}).
  15088. @item landscape
  15089. Preserve landscape geometry (when @var{width} >= @var{height}).
  15090. @end table
  15091. @end table
  15092. @section trim
  15093. Trim the input so that the output contains one continuous subpart of the input.
  15094. It accepts the following parameters:
  15095. @table @option
  15096. @item start
  15097. Specify the time of the start of the kept section, i.e. the frame with the
  15098. timestamp @var{start} will be the first frame in the output.
  15099. @item end
  15100. Specify the time of the first frame that will be dropped, i.e. the frame
  15101. immediately preceding the one with the timestamp @var{end} will be the last
  15102. frame in the output.
  15103. @item start_pts
  15104. This is the same as @var{start}, except this option sets the start timestamp
  15105. in timebase units instead of seconds.
  15106. @item end_pts
  15107. This is the same as @var{end}, except this option sets the end timestamp
  15108. in timebase units instead of seconds.
  15109. @item duration
  15110. The maximum duration of the output in seconds.
  15111. @item start_frame
  15112. The number of the first frame that should be passed to the output.
  15113. @item end_frame
  15114. The number of the first frame that should be dropped.
  15115. @end table
  15116. @option{start}, @option{end}, and @option{duration} are expressed as time
  15117. duration specifications; see
  15118. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15119. for the accepted syntax.
  15120. Note that the first two sets of the start/end options and the @option{duration}
  15121. option look at the frame timestamp, while the _frame variants simply count the
  15122. frames that pass through the filter. Also note that this filter does not modify
  15123. the timestamps. If you wish for the output timestamps to start at zero, insert a
  15124. setpts filter after the trim filter.
  15125. If multiple start or end options are set, this filter tries to be greedy and
  15126. keep all the frames that match at least one of the specified constraints. To keep
  15127. only the part that matches all the constraints at once, chain multiple trim
  15128. filters.
  15129. The defaults are such that all the input is kept. So it is possible to set e.g.
  15130. just the end values to keep everything before the specified time.
  15131. Examples:
  15132. @itemize
  15133. @item
  15134. Drop everything except the second minute of input:
  15135. @example
  15136. ffmpeg -i INPUT -vf trim=60:120
  15137. @end example
  15138. @item
  15139. Keep only the first second:
  15140. @example
  15141. ffmpeg -i INPUT -vf trim=duration=1
  15142. @end example
  15143. @end itemize
  15144. @section unpremultiply
  15145. Apply alpha unpremultiply effect to input video stream using first plane
  15146. of second stream as alpha.
  15147. Both streams must have same dimensions and same pixel format.
  15148. The filter accepts the following option:
  15149. @table @option
  15150. @item planes
  15151. Set which planes will be processed, unprocessed planes will be copied.
  15152. By default value 0xf, all planes will be processed.
  15153. If the format has 1 or 2 components, then luma is bit 0.
  15154. If the format has 3 or 4 components:
  15155. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  15156. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  15157. If present, the alpha channel is always the last bit.
  15158. @item inplace
  15159. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15160. @end table
  15161. @anchor{unsharp}
  15162. @section unsharp
  15163. Sharpen or blur the input video.
  15164. It accepts the following parameters:
  15165. @table @option
  15166. @item luma_msize_x, lx
  15167. Set the luma matrix horizontal size. It must be an odd integer between
  15168. 3 and 23. The default value is 5.
  15169. @item luma_msize_y, ly
  15170. Set the luma matrix vertical size. It must be an odd integer between 3
  15171. and 23. The default value is 5.
  15172. @item luma_amount, la
  15173. Set the luma effect strength. It must be a floating point number, reasonable
  15174. values lay between -1.5 and 1.5.
  15175. Negative values will blur the input video, while positive values will
  15176. sharpen it, a value of zero will disable the effect.
  15177. Default value is 1.0.
  15178. @item chroma_msize_x, cx
  15179. Set the chroma matrix horizontal size. It must be an odd integer
  15180. between 3 and 23. The default value is 5.
  15181. @item chroma_msize_y, cy
  15182. Set the chroma matrix vertical size. It must be an odd integer
  15183. between 3 and 23. The default value is 5.
  15184. @item chroma_amount, ca
  15185. Set the chroma effect strength. It must be a floating point number, reasonable
  15186. values lay between -1.5 and 1.5.
  15187. Negative values will blur the input video, while positive values will
  15188. sharpen it, a value of zero will disable the effect.
  15189. Default value is 0.0.
  15190. @end table
  15191. All parameters are optional and default to the equivalent of the
  15192. string '5:5:1.0:5:5:0.0'.
  15193. @subsection Examples
  15194. @itemize
  15195. @item
  15196. Apply strong luma sharpen effect:
  15197. @example
  15198. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  15199. @end example
  15200. @item
  15201. Apply a strong blur of both luma and chroma parameters:
  15202. @example
  15203. unsharp=7:7:-2:7:7:-2
  15204. @end example
  15205. @end itemize
  15206. @anchor{untile}
  15207. @section untile
  15208. Decompose a video made of tiled images into the individual images.
  15209. The frame rate of the output video is the frame rate of the input video
  15210. multiplied by the number of tiles.
  15211. This filter does the reverse of @ref{tile}.
  15212. The filter accepts the following options:
  15213. @table @option
  15214. @item layout
  15215. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15216. this option, check the
  15217. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15218. @end table
  15219. @subsection Examples
  15220. @itemize
  15221. @item
  15222. Produce a 1-second video from a still image file made of 25 frames stacked
  15223. vertically, like an analogic film reel:
  15224. @example
  15225. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  15226. @end example
  15227. @end itemize
  15228. @section uspp
  15229. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  15230. the image at several (or - in the case of @option{quality} level @code{8} - all)
  15231. shifts and average the results.
  15232. The way this differs from the behavior of spp is that uspp actually encodes &
  15233. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  15234. DCT similar to MJPEG.
  15235. The filter accepts the following options:
  15236. @table @option
  15237. @item quality
  15238. Set quality. This option defines the number of levels for averaging. It accepts
  15239. an integer in the range 0-8. If set to @code{0}, the filter will have no
  15240. effect. A value of @code{8} means the higher quality. For each increment of
  15241. that value the speed drops by a factor of approximately 2. Default value is
  15242. @code{3}.
  15243. @item qp
  15244. Force a constant quantization parameter. If not set, the filter will use the QP
  15245. from the video stream (if available).
  15246. @end table
  15247. @section v360
  15248. Convert 360 videos between various formats.
  15249. The filter accepts the following options:
  15250. @table @option
  15251. @item input
  15252. @item output
  15253. Set format of the input/output video.
  15254. Available formats:
  15255. @table @samp
  15256. @item e
  15257. @item equirect
  15258. Equirectangular projection.
  15259. @item c3x2
  15260. @item c6x1
  15261. @item c1x6
  15262. Cubemap with 3x2/6x1/1x6 layout.
  15263. Format specific options:
  15264. @table @option
  15265. @item in_pad
  15266. @item out_pad
  15267. Set padding proportion for the input/output cubemap. Values in decimals.
  15268. Example values:
  15269. @table @samp
  15270. @item 0
  15271. No padding.
  15272. @item 0.01
  15273. 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)
  15274. @end table
  15275. Default value is @b{@samp{0}}.
  15276. Maximum value is @b{@samp{0.1}}.
  15277. @item fin_pad
  15278. @item fout_pad
  15279. Set fixed padding for the input/output cubemap. Values in pixels.
  15280. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15281. @item in_forder
  15282. @item out_forder
  15283. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15284. Designation of directions:
  15285. @table @samp
  15286. @item r
  15287. right
  15288. @item l
  15289. left
  15290. @item u
  15291. up
  15292. @item d
  15293. down
  15294. @item f
  15295. forward
  15296. @item b
  15297. back
  15298. @end table
  15299. Default value is @b{@samp{rludfb}}.
  15300. @item in_frot
  15301. @item out_frot
  15302. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15303. Designation of angles:
  15304. @table @samp
  15305. @item 0
  15306. 0 degrees clockwise
  15307. @item 1
  15308. 90 degrees clockwise
  15309. @item 2
  15310. 180 degrees clockwise
  15311. @item 3
  15312. 270 degrees clockwise
  15313. @end table
  15314. Default value is @b{@samp{000000}}.
  15315. @end table
  15316. @item eac
  15317. Equi-Angular Cubemap.
  15318. @item flat
  15319. @item gnomonic
  15320. @item rectilinear
  15321. Regular video.
  15322. Format specific options:
  15323. @table @option
  15324. @item h_fov
  15325. @item v_fov
  15326. @item d_fov
  15327. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15328. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15329. @item ih_fov
  15330. @item iv_fov
  15331. @item id_fov
  15332. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15333. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15334. @end table
  15335. @item dfisheye
  15336. Dual fisheye.
  15337. Format specific options:
  15338. @table @option
  15339. @item h_fov
  15340. @item v_fov
  15341. @item d_fov
  15342. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15343. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15344. @item ih_fov
  15345. @item iv_fov
  15346. @item id_fov
  15347. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15348. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15349. @end table
  15350. @item barrel
  15351. @item fb
  15352. @item barrelsplit
  15353. Facebook's 360 formats.
  15354. @item sg
  15355. Stereographic format.
  15356. Format specific options:
  15357. @table @option
  15358. @item h_fov
  15359. @item v_fov
  15360. @item d_fov
  15361. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15362. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15363. @item ih_fov
  15364. @item iv_fov
  15365. @item id_fov
  15366. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15367. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15368. @end table
  15369. @item mercator
  15370. Mercator format.
  15371. @item ball
  15372. Ball format, gives significant distortion toward the back.
  15373. @item hammer
  15374. Hammer-Aitoff map projection format.
  15375. @item sinusoidal
  15376. Sinusoidal map projection format.
  15377. @item fisheye
  15378. Fisheye projection.
  15379. Format specific options:
  15380. @table @option
  15381. @item h_fov
  15382. @item v_fov
  15383. @item d_fov
  15384. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15385. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15386. @item ih_fov
  15387. @item iv_fov
  15388. @item id_fov
  15389. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15390. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15391. @end table
  15392. @item pannini
  15393. Pannini projection.
  15394. Format specific options:
  15395. @table @option
  15396. @item h_fov
  15397. Set output pannini parameter.
  15398. @item ih_fov
  15399. Set input pannini parameter.
  15400. @end table
  15401. @item cylindrical
  15402. Cylindrical projection.
  15403. Format specific options:
  15404. @table @option
  15405. @item h_fov
  15406. @item v_fov
  15407. @item d_fov
  15408. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15409. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15410. @item ih_fov
  15411. @item iv_fov
  15412. @item id_fov
  15413. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15414. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15415. @end table
  15416. @item perspective
  15417. Perspective projection. @i{(output only)}
  15418. Format specific options:
  15419. @table @option
  15420. @item v_fov
  15421. Set perspective parameter.
  15422. @end table
  15423. @item tetrahedron
  15424. Tetrahedron projection.
  15425. @item tsp
  15426. Truncated square pyramid projection.
  15427. @item he
  15428. @item hequirect
  15429. Half equirectangular projection.
  15430. @item equisolid
  15431. Equisolid format.
  15432. Format specific options:
  15433. @table @option
  15434. @item h_fov
  15435. @item v_fov
  15436. @item d_fov
  15437. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15438. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15439. @item ih_fov
  15440. @item iv_fov
  15441. @item id_fov
  15442. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15443. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15444. @end table
  15445. @item og
  15446. Orthographic format.
  15447. Format specific options:
  15448. @table @option
  15449. @item h_fov
  15450. @item v_fov
  15451. @item d_fov
  15452. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15453. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15454. @item ih_fov
  15455. @item iv_fov
  15456. @item id_fov
  15457. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15458. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15459. @end table
  15460. @item octahedron
  15461. Octahedron projection.
  15462. @end table
  15463. @item interp
  15464. Set interpolation method.@*
  15465. @i{Note: more complex interpolation methods require much more memory to run.}
  15466. Available methods:
  15467. @table @samp
  15468. @item near
  15469. @item nearest
  15470. Nearest neighbour.
  15471. @item line
  15472. @item linear
  15473. Bilinear interpolation.
  15474. @item lagrange9
  15475. Lagrange9 interpolation.
  15476. @item cube
  15477. @item cubic
  15478. Bicubic interpolation.
  15479. @item lanc
  15480. @item lanczos
  15481. Lanczos interpolation.
  15482. @item sp16
  15483. @item spline16
  15484. Spline16 interpolation.
  15485. @item gauss
  15486. @item gaussian
  15487. Gaussian interpolation.
  15488. @item mitchell
  15489. Mitchell interpolation.
  15490. @end table
  15491. Default value is @b{@samp{line}}.
  15492. @item w
  15493. @item h
  15494. Set the output video resolution.
  15495. Default resolution depends on formats.
  15496. @item in_stereo
  15497. @item out_stereo
  15498. Set the input/output stereo format.
  15499. @table @samp
  15500. @item 2d
  15501. 2D mono
  15502. @item sbs
  15503. Side by side
  15504. @item tb
  15505. Top bottom
  15506. @end table
  15507. Default value is @b{@samp{2d}} for input and output format.
  15508. @item yaw
  15509. @item pitch
  15510. @item roll
  15511. Set rotation for the output video. Values in degrees.
  15512. @item rorder
  15513. Set rotation order for the output video. Choose one item for each position.
  15514. @table @samp
  15515. @item y, Y
  15516. yaw
  15517. @item p, P
  15518. pitch
  15519. @item r, R
  15520. roll
  15521. @end table
  15522. Default value is @b{@samp{ypr}}.
  15523. @item h_flip
  15524. @item v_flip
  15525. @item d_flip
  15526. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15527. @item ih_flip
  15528. @item iv_flip
  15529. Set if input video is flipped horizontally/vertically. Boolean values.
  15530. @item in_trans
  15531. Set if input video is transposed. Boolean value, by default disabled.
  15532. @item out_trans
  15533. Set if output video needs to be transposed. Boolean value, by default disabled.
  15534. @item alpha_mask
  15535. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15536. @end table
  15537. @subsection Examples
  15538. @itemize
  15539. @item
  15540. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15541. @example
  15542. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15543. @end example
  15544. @item
  15545. Extract back view of Equi-Angular Cubemap:
  15546. @example
  15547. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15548. @end example
  15549. @item
  15550. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15551. @example
  15552. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15553. @end example
  15554. @end itemize
  15555. @subsection Commands
  15556. This filter supports subset of above options as @ref{commands}.
  15557. @section vaguedenoiser
  15558. Apply a wavelet based denoiser.
  15559. It transforms each frame from the video input into the wavelet domain,
  15560. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15561. the obtained coefficients. It does an inverse wavelet transform after.
  15562. Due to wavelet properties, it should give a nice smoothed result, and
  15563. reduced noise, without blurring picture features.
  15564. This filter accepts the following options:
  15565. @table @option
  15566. @item threshold
  15567. The filtering strength. The higher, the more filtered the video will be.
  15568. Hard thresholding can use a higher threshold than soft thresholding
  15569. before the video looks overfiltered. Default value is 2.
  15570. @item method
  15571. The filtering method the filter will use.
  15572. It accepts the following values:
  15573. @table @samp
  15574. @item hard
  15575. All values under the threshold will be zeroed.
  15576. @item soft
  15577. All values under the threshold will be zeroed. All values above will be
  15578. reduced by the threshold.
  15579. @item garrote
  15580. Scales or nullifies coefficients - intermediary between (more) soft and
  15581. (less) hard thresholding.
  15582. @end table
  15583. Default is garrote.
  15584. @item nsteps
  15585. Number of times, the wavelet will decompose the picture. Picture can't
  15586. be decomposed beyond a particular point (typically, 8 for a 640x480
  15587. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15588. @item percent
  15589. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15590. @item planes
  15591. A list of the planes to process. By default all planes are processed.
  15592. @item type
  15593. The threshold type the filter will use.
  15594. It accepts the following values:
  15595. @table @samp
  15596. @item universal
  15597. Threshold used is same for all decompositions.
  15598. @item bayes
  15599. Threshold used depends also on each decomposition coefficients.
  15600. @end table
  15601. Default is universal.
  15602. @end table
  15603. @section vectorscope
  15604. Display 2 color component values in the two dimensional graph (which is called
  15605. a vectorscope).
  15606. This filter accepts the following options:
  15607. @table @option
  15608. @item mode, m
  15609. Set vectorscope mode.
  15610. It accepts the following values:
  15611. @table @samp
  15612. @item gray
  15613. @item tint
  15614. Gray values are displayed on graph, higher brightness means more pixels have
  15615. same component color value on location in graph. This is the default mode.
  15616. @item color
  15617. Gray values are displayed on graph. Surrounding pixels values which are not
  15618. present in video frame are drawn in gradient of 2 color components which are
  15619. set by option @code{x} and @code{y}. The 3rd color component is static.
  15620. @item color2
  15621. Actual color components values present in video frame are displayed on graph.
  15622. @item color3
  15623. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15624. on graph increases value of another color component, which is luminance by
  15625. default values of @code{x} and @code{y}.
  15626. @item color4
  15627. Actual colors present in video frame are displayed on graph. If two different
  15628. colors map to same position on graph then color with higher value of component
  15629. not present in graph is picked.
  15630. @item color5
  15631. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15632. component picked from radial gradient.
  15633. @end table
  15634. @item x
  15635. Set which color component will be represented on X-axis. Default is @code{1}.
  15636. @item y
  15637. Set which color component will be represented on Y-axis. Default is @code{2}.
  15638. @item intensity, i
  15639. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15640. of color component which represents frequency of (X, Y) location in graph.
  15641. @item envelope, e
  15642. @table @samp
  15643. @item none
  15644. No envelope, this is default.
  15645. @item instant
  15646. Instant envelope, even darkest single pixel will be clearly highlighted.
  15647. @item peak
  15648. Hold maximum and minimum values presented in graph over time. This way you
  15649. can still spot out of range values without constantly looking at vectorscope.
  15650. @item peak+instant
  15651. Peak and instant envelope combined together.
  15652. @end table
  15653. @item graticule, g
  15654. Set what kind of graticule to draw.
  15655. @table @samp
  15656. @item none
  15657. @item green
  15658. @item color
  15659. @item invert
  15660. @end table
  15661. @item opacity, o
  15662. Set graticule opacity.
  15663. @item flags, f
  15664. Set graticule flags.
  15665. @table @samp
  15666. @item white
  15667. Draw graticule for white point.
  15668. @item black
  15669. Draw graticule for black point.
  15670. @item name
  15671. Draw color points short names.
  15672. @end table
  15673. @item bgopacity, b
  15674. Set background opacity.
  15675. @item lthreshold, l
  15676. Set low threshold for color component not represented on X or Y axis.
  15677. Values lower than this value will be ignored. Default is 0.
  15678. Note this value is multiplied with actual max possible value one pixel component
  15679. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15680. is 0.1 * 255 = 25.
  15681. @item hthreshold, h
  15682. Set high threshold for color component not represented on X or Y axis.
  15683. Values higher than this value will be ignored. Default is 1.
  15684. Note this value is multiplied with actual max possible value one pixel component
  15685. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15686. is 0.9 * 255 = 230.
  15687. @item colorspace, c
  15688. Set what kind of colorspace to use when drawing graticule.
  15689. @table @samp
  15690. @item auto
  15691. @item 601
  15692. @item 709
  15693. @end table
  15694. Default is auto.
  15695. @item tint0, t0
  15696. @item tint1, t1
  15697. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15698. This means no tint, and output will remain gray.
  15699. @end table
  15700. @anchor{vidstabdetect}
  15701. @section vidstabdetect
  15702. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15703. @ref{vidstabtransform} for pass 2.
  15704. This filter generates a file with relative translation and rotation
  15705. transform information about subsequent frames, which is then used by
  15706. the @ref{vidstabtransform} filter.
  15707. To enable compilation of this filter you need to configure FFmpeg with
  15708. @code{--enable-libvidstab}.
  15709. This filter accepts the following options:
  15710. @table @option
  15711. @item result
  15712. Set the path to the file used to write the transforms information.
  15713. Default value is @file{transforms.trf}.
  15714. @item shakiness
  15715. Set how shaky the video is and how quick the camera is. It accepts an
  15716. integer in the range 1-10, a value of 1 means little shakiness, a
  15717. value of 10 means strong shakiness. Default value is 5.
  15718. @item accuracy
  15719. Set the accuracy of the detection process. It must be a value in the
  15720. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15721. accuracy. Default value is 15.
  15722. @item stepsize
  15723. Set stepsize of the search process. The region around minimum is
  15724. scanned with 1 pixel resolution. Default value is 6.
  15725. @item mincontrast
  15726. Set minimum contrast. Below this value a local measurement field is
  15727. discarded. Must be a floating point value in the range 0-1. Default
  15728. value is 0.3.
  15729. @item tripod
  15730. Set reference frame number for tripod mode.
  15731. If enabled, the motion of the frames is compared to a reference frame
  15732. in the filtered stream, identified by the specified number. The idea
  15733. is to compensate all movements in a more-or-less static scene and keep
  15734. the camera view absolutely still.
  15735. If set to 0, it is disabled. The frames are counted starting from 1.
  15736. @item show
  15737. Show fields and transforms in the resulting frames. It accepts an
  15738. integer in the range 0-2. Default value is 0, which disables any
  15739. visualization.
  15740. @end table
  15741. @subsection Examples
  15742. @itemize
  15743. @item
  15744. Use default values:
  15745. @example
  15746. vidstabdetect
  15747. @end example
  15748. @item
  15749. Analyze strongly shaky movie and put the results in file
  15750. @file{mytransforms.trf}:
  15751. @example
  15752. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15753. @end example
  15754. @item
  15755. Visualize the result of internal transformations in the resulting
  15756. video:
  15757. @example
  15758. vidstabdetect=show=1
  15759. @end example
  15760. @item
  15761. Analyze a video with medium shakiness using @command{ffmpeg}:
  15762. @example
  15763. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15764. @end example
  15765. @end itemize
  15766. @anchor{vidstabtransform}
  15767. @section vidstabtransform
  15768. Video stabilization/deshaking: pass 2 of 2,
  15769. see @ref{vidstabdetect} for pass 1.
  15770. Read a file with transform information for each frame and
  15771. apply/compensate them. Together with the @ref{vidstabdetect}
  15772. filter this can be used to deshake videos. See also
  15773. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15774. the @ref{unsharp} filter, see below.
  15775. To enable compilation of this filter you need to configure FFmpeg with
  15776. @code{--enable-libvidstab}.
  15777. @subsection Options
  15778. @table @option
  15779. @item input
  15780. Set path to the file used to read the transforms. Default value is
  15781. @file{transforms.trf}.
  15782. @item smoothing
  15783. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15784. camera movements. Default value is 10.
  15785. For example a number of 10 means that 21 frames are used (10 in the
  15786. past and 10 in the future) to smoothen the motion in the video. A
  15787. larger value leads to a smoother video, but limits the acceleration of
  15788. the camera (pan/tilt movements). 0 is a special case where a static
  15789. camera is simulated.
  15790. @item optalgo
  15791. Set the camera path optimization algorithm.
  15792. Accepted values are:
  15793. @table @samp
  15794. @item gauss
  15795. gaussian kernel low-pass filter on camera motion (default)
  15796. @item avg
  15797. averaging on transformations
  15798. @end table
  15799. @item maxshift
  15800. Set maximal number of pixels to translate frames. Default value is -1,
  15801. meaning no limit.
  15802. @item maxangle
  15803. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15804. value is -1, meaning no limit.
  15805. @item crop
  15806. Specify how to deal with borders that may be visible due to movement
  15807. compensation.
  15808. Available values are:
  15809. @table @samp
  15810. @item keep
  15811. keep image information from previous frame (default)
  15812. @item black
  15813. fill the border black
  15814. @end table
  15815. @item invert
  15816. Invert transforms if set to 1. Default value is 0.
  15817. @item relative
  15818. Consider transforms as relative to previous frame if set to 1,
  15819. absolute if set to 0. Default value is 0.
  15820. @item zoom
  15821. Set percentage to zoom. A positive value will result in a zoom-in
  15822. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15823. zoom).
  15824. @item optzoom
  15825. Set optimal zooming to avoid borders.
  15826. Accepted values are:
  15827. @table @samp
  15828. @item 0
  15829. disabled
  15830. @item 1
  15831. optimal static zoom value is determined (only very strong movements
  15832. will lead to visible borders) (default)
  15833. @item 2
  15834. optimal adaptive zoom value is determined (no borders will be
  15835. visible), see @option{zoomspeed}
  15836. @end table
  15837. Note that the value given at zoom is added to the one calculated here.
  15838. @item zoomspeed
  15839. Set percent to zoom maximally each frame (enabled when
  15840. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15841. 0.25.
  15842. @item interpol
  15843. Specify type of interpolation.
  15844. Available values are:
  15845. @table @samp
  15846. @item no
  15847. no interpolation
  15848. @item linear
  15849. linear only horizontal
  15850. @item bilinear
  15851. linear in both directions (default)
  15852. @item bicubic
  15853. cubic in both directions (slow)
  15854. @end table
  15855. @item tripod
  15856. Enable virtual tripod mode if set to 1, which is equivalent to
  15857. @code{relative=0:smoothing=0}. Default value is 0.
  15858. Use also @code{tripod} option of @ref{vidstabdetect}.
  15859. @item debug
  15860. Increase log verbosity if set to 1. Also the detected global motions
  15861. are written to the temporary file @file{global_motions.trf}. Default
  15862. value is 0.
  15863. @end table
  15864. @subsection Examples
  15865. @itemize
  15866. @item
  15867. Use @command{ffmpeg} for a typical stabilization with default values:
  15868. @example
  15869. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15870. @end example
  15871. Note the use of the @ref{unsharp} filter which is always recommended.
  15872. @item
  15873. Zoom in a bit more and load transform data from a given file:
  15874. @example
  15875. vidstabtransform=zoom=5:input="mytransforms.trf"
  15876. @end example
  15877. @item
  15878. Smoothen the video even more:
  15879. @example
  15880. vidstabtransform=smoothing=30
  15881. @end example
  15882. @end itemize
  15883. @section vflip
  15884. Flip the input video vertically.
  15885. For example, to vertically flip a video with @command{ffmpeg}:
  15886. @example
  15887. ffmpeg -i in.avi -vf "vflip" out.avi
  15888. @end example
  15889. @section vfrdet
  15890. Detect variable frame rate video.
  15891. This filter tries to detect if the input is variable or constant frame rate.
  15892. At end it will output number of frames detected as having variable delta pts,
  15893. and ones with constant delta pts.
  15894. If there was frames with variable delta, than it will also show min, max and
  15895. average delta encountered.
  15896. @section vibrance
  15897. Boost or alter saturation.
  15898. The filter accepts the following options:
  15899. @table @option
  15900. @item intensity
  15901. Set strength of boost if positive value or strength of alter if negative value.
  15902. Default is 0. Allowed range is from -2 to 2.
  15903. @item rbal
  15904. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15905. @item gbal
  15906. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15907. @item bbal
  15908. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15909. @item rlum
  15910. Set the red luma coefficient.
  15911. @item glum
  15912. Set the green luma coefficient.
  15913. @item blum
  15914. Set the blue luma coefficient.
  15915. @item alternate
  15916. If @code{intensity} is negative and this is set to 1, colors will change,
  15917. otherwise colors will be less saturated, more towards gray.
  15918. @end table
  15919. @subsection Commands
  15920. This filter supports the all above options as @ref{commands}.
  15921. @anchor{vignette}
  15922. @section vignette
  15923. Make or reverse a natural vignetting effect.
  15924. The filter accepts the following options:
  15925. @table @option
  15926. @item angle, a
  15927. Set lens angle expression as a number of radians.
  15928. The value is clipped in the @code{[0,PI/2]} range.
  15929. Default value: @code{"PI/5"}
  15930. @item x0
  15931. @item y0
  15932. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15933. by default.
  15934. @item mode
  15935. Set forward/backward mode.
  15936. Available modes are:
  15937. @table @samp
  15938. @item forward
  15939. The larger the distance from the central point, the darker the image becomes.
  15940. @item backward
  15941. The larger the distance from the central point, the brighter the image becomes.
  15942. This can be used to reverse a vignette effect, though there is no automatic
  15943. detection to extract the lens @option{angle} and other settings (yet). It can
  15944. also be used to create a burning effect.
  15945. @end table
  15946. Default value is @samp{forward}.
  15947. @item eval
  15948. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15949. It accepts the following values:
  15950. @table @samp
  15951. @item init
  15952. Evaluate expressions only once during the filter initialization.
  15953. @item frame
  15954. Evaluate expressions for each incoming frame. This is way slower than the
  15955. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15956. allows advanced dynamic expressions.
  15957. @end table
  15958. Default value is @samp{init}.
  15959. @item dither
  15960. Set dithering to reduce the circular banding effects. Default is @code{1}
  15961. (enabled).
  15962. @item aspect
  15963. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15964. Setting this value to the SAR of the input will make a rectangular vignetting
  15965. following the dimensions of the video.
  15966. Default is @code{1/1}.
  15967. @end table
  15968. @subsection Expressions
  15969. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15970. following parameters.
  15971. @table @option
  15972. @item w
  15973. @item h
  15974. input width and height
  15975. @item n
  15976. the number of input frame, starting from 0
  15977. @item pts
  15978. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15979. @var{TB} units, NAN if undefined
  15980. @item r
  15981. frame rate of the input video, NAN if the input frame rate is unknown
  15982. @item t
  15983. the PTS (Presentation TimeStamp) of the filtered video frame,
  15984. expressed in seconds, NAN if undefined
  15985. @item tb
  15986. time base of the input video
  15987. @end table
  15988. @subsection Examples
  15989. @itemize
  15990. @item
  15991. Apply simple strong vignetting effect:
  15992. @example
  15993. vignette=PI/4
  15994. @end example
  15995. @item
  15996. Make a flickering vignetting:
  15997. @example
  15998. vignette='PI/4+random(1)*PI/50':eval=frame
  15999. @end example
  16000. @end itemize
  16001. @section vmafmotion
  16002. Obtain the average VMAF motion score of a video.
  16003. It is one of the component metrics of VMAF.
  16004. The obtained average motion score is printed through the logging system.
  16005. The filter accepts the following options:
  16006. @table @option
  16007. @item stats_file
  16008. If specified, the filter will use the named file to save the motion score of
  16009. each frame with respect to the previous frame.
  16010. When filename equals "-" the data is sent to standard output.
  16011. @end table
  16012. Example:
  16013. @example
  16014. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  16015. @end example
  16016. @section vstack
  16017. Stack input videos vertically.
  16018. All streams must be of same pixel format and of same width.
  16019. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  16020. to create same output.
  16021. The filter accepts the following options:
  16022. @table @option
  16023. @item inputs
  16024. Set number of input streams. Default is 2.
  16025. @item shortest
  16026. If set to 1, force the output to terminate when the shortest input
  16027. terminates. Default value is 0.
  16028. @end table
  16029. @section w3fdif
  16030. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  16031. Deinterlacing Filter").
  16032. Based on the process described by Martin Weston for BBC R&D, and
  16033. implemented based on the de-interlace algorithm written by Jim
  16034. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  16035. uses filter coefficients calculated by BBC R&D.
  16036. This filter uses field-dominance information in frame to decide which
  16037. of each pair of fields to place first in the output.
  16038. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  16039. There are two sets of filter coefficients, so called "simple"
  16040. and "complex". Which set of filter coefficients is used can
  16041. be set by passing an optional parameter:
  16042. @table @option
  16043. @item filter
  16044. Set the interlacing filter coefficients. Accepts one of the following values:
  16045. @table @samp
  16046. @item simple
  16047. Simple filter coefficient set.
  16048. @item complex
  16049. More-complex filter coefficient set.
  16050. @end table
  16051. Default value is @samp{complex}.
  16052. @item mode
  16053. The interlacing mode to adopt. It accepts one of the following values:
  16054. @table @option
  16055. @item frame
  16056. Output one frame for each frame.
  16057. @item field
  16058. Output one frame for each field.
  16059. @end table
  16060. The default value is @code{field}.
  16061. @item parity
  16062. The picture field parity assumed for the input interlaced video. It accepts one
  16063. of the following values:
  16064. @table @option
  16065. @item tff
  16066. Assume the top field is first.
  16067. @item bff
  16068. Assume the bottom field is first.
  16069. @item auto
  16070. Enable automatic detection of field parity.
  16071. @end table
  16072. The default value is @code{auto}.
  16073. If the interlacing is unknown or the decoder does not export this information,
  16074. top field first will be assumed.
  16075. @item deint
  16076. Specify which frames to deinterlace. Accepts one of the following values:
  16077. @table @samp
  16078. @item all
  16079. Deinterlace all frames,
  16080. @item interlaced
  16081. Only deinterlace frames marked as interlaced.
  16082. @end table
  16083. Default value is @samp{all}.
  16084. @end table
  16085. @subsection Commands
  16086. This filter supports same @ref{commands} as options.
  16087. @section waveform
  16088. Video waveform monitor.
  16089. The waveform monitor plots color component intensity. By default luminance
  16090. only. Each column of the waveform corresponds to a column of pixels in the
  16091. source video.
  16092. It accepts the following options:
  16093. @table @option
  16094. @item mode, m
  16095. Can be either @code{row}, or @code{column}. Default is @code{column}.
  16096. In row mode, the graph on the left side represents color component value 0 and
  16097. the right side represents value = 255. In column mode, the top side represents
  16098. color component value = 0 and bottom side represents value = 255.
  16099. @item intensity, i
  16100. Set intensity. Smaller values are useful to find out how many values of the same
  16101. luminance are distributed across input rows/columns.
  16102. Default value is @code{0.04}. Allowed range is [0, 1].
  16103. @item mirror, r
  16104. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  16105. In mirrored mode, higher values will be represented on the left
  16106. side for @code{row} mode and at the top for @code{column} mode. Default is
  16107. @code{1} (mirrored).
  16108. @item display, d
  16109. Set display mode.
  16110. It accepts the following values:
  16111. @table @samp
  16112. @item overlay
  16113. Presents information identical to that in the @code{parade}, except
  16114. that the graphs representing color components are superimposed directly
  16115. over one another.
  16116. This display mode makes it easier to spot relative differences or similarities
  16117. in overlapping areas of the color components that are supposed to be identical,
  16118. such as neutral whites, grays, or blacks.
  16119. @item stack
  16120. Display separate graph for the color components side by side in
  16121. @code{row} mode or one below the other in @code{column} mode.
  16122. @item parade
  16123. Display separate graph for the color components side by side in
  16124. @code{column} mode or one below the other in @code{row} mode.
  16125. Using this display mode makes it easy to spot color casts in the highlights
  16126. and shadows of an image, by comparing the contours of the top and the bottom
  16127. graphs of each waveform. Since whites, grays, and blacks are characterized
  16128. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  16129. should display three waveforms of roughly equal width/height. If not, the
  16130. correction is easy to perform by making level adjustments the three waveforms.
  16131. @end table
  16132. Default is @code{stack}.
  16133. @item components, c
  16134. Set which color components to display. Default is 1, which means only luminance
  16135. or red color component if input is in RGB colorspace. If is set for example to
  16136. 7 it will display all 3 (if) available color components.
  16137. @item envelope, e
  16138. @table @samp
  16139. @item none
  16140. No envelope, this is default.
  16141. @item instant
  16142. Instant envelope, minimum and maximum values presented in graph will be easily
  16143. visible even with small @code{step} value.
  16144. @item peak
  16145. Hold minimum and maximum values presented in graph across time. This way you
  16146. can still spot out of range values without constantly looking at waveforms.
  16147. @item peak+instant
  16148. Peak and instant envelope combined together.
  16149. @end table
  16150. @item filter, f
  16151. @table @samp
  16152. @item lowpass
  16153. No filtering, this is default.
  16154. @item flat
  16155. Luma and chroma combined together.
  16156. @item aflat
  16157. Similar as above, but shows difference between blue and red chroma.
  16158. @item xflat
  16159. Similar as above, but use different colors.
  16160. @item yflat
  16161. Similar as above, but again with different colors.
  16162. @item chroma
  16163. Displays only chroma.
  16164. @item color
  16165. Displays actual color value on waveform.
  16166. @item acolor
  16167. Similar as above, but with luma showing frequency of chroma values.
  16168. @end table
  16169. @item graticule, g
  16170. Set which graticule to display.
  16171. @table @samp
  16172. @item none
  16173. Do not display graticule.
  16174. @item green
  16175. Display green graticule showing legal broadcast ranges.
  16176. @item orange
  16177. Display orange graticule showing legal broadcast ranges.
  16178. @item invert
  16179. Display invert graticule showing legal broadcast ranges.
  16180. @end table
  16181. @item opacity, o
  16182. Set graticule opacity.
  16183. @item flags, fl
  16184. Set graticule flags.
  16185. @table @samp
  16186. @item numbers
  16187. Draw numbers above lines. By default enabled.
  16188. @item dots
  16189. Draw dots instead of lines.
  16190. @end table
  16191. @item scale, s
  16192. Set scale used for displaying graticule.
  16193. @table @samp
  16194. @item digital
  16195. @item millivolts
  16196. @item ire
  16197. @end table
  16198. Default is digital.
  16199. @item bgopacity, b
  16200. Set background opacity.
  16201. @item tint0, t0
  16202. @item tint1, t1
  16203. Set tint for output.
  16204. Only used with lowpass filter and when display is not overlay and input
  16205. pixel formats are not RGB.
  16206. @end table
  16207. @section weave, doubleweave
  16208. The @code{weave} takes a field-based video input and join
  16209. each two sequential fields into single frame, producing a new double
  16210. height clip with half the frame rate and half the frame count.
  16211. The @code{doubleweave} works same as @code{weave} but without
  16212. halving frame rate and frame count.
  16213. It accepts the following option:
  16214. @table @option
  16215. @item first_field
  16216. Set first field. Available values are:
  16217. @table @samp
  16218. @item top, t
  16219. Set the frame as top-field-first.
  16220. @item bottom, b
  16221. Set the frame as bottom-field-first.
  16222. @end table
  16223. @end table
  16224. @subsection Examples
  16225. @itemize
  16226. @item
  16227. Interlace video using @ref{select} and @ref{separatefields} filter:
  16228. @example
  16229. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  16230. @end example
  16231. @end itemize
  16232. @section xbr
  16233. Apply the xBR high-quality magnification filter which is designed for pixel
  16234. art. It follows a set of edge-detection rules, see
  16235. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  16236. It accepts the following option:
  16237. @table @option
  16238. @item n
  16239. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  16240. @code{3xBR} and @code{4} for @code{4xBR}.
  16241. Default is @code{3}.
  16242. @end table
  16243. @section xfade
  16244. Apply cross fade from one input video stream to another input video stream.
  16245. The cross fade is applied for specified duration.
  16246. The filter accepts the following options:
  16247. @table @option
  16248. @item transition
  16249. Set one of available transition effects:
  16250. @table @samp
  16251. @item custom
  16252. @item fade
  16253. @item wipeleft
  16254. @item wiperight
  16255. @item wipeup
  16256. @item wipedown
  16257. @item slideleft
  16258. @item slideright
  16259. @item slideup
  16260. @item slidedown
  16261. @item circlecrop
  16262. @item rectcrop
  16263. @item distance
  16264. @item fadeblack
  16265. @item fadewhite
  16266. @item radial
  16267. @item smoothleft
  16268. @item smoothright
  16269. @item smoothup
  16270. @item smoothdown
  16271. @item circleopen
  16272. @item circleclose
  16273. @item vertopen
  16274. @item vertclose
  16275. @item horzopen
  16276. @item horzclose
  16277. @item dissolve
  16278. @item pixelize
  16279. @item diagtl
  16280. @item diagtr
  16281. @item diagbl
  16282. @item diagbr
  16283. @item hlslice
  16284. @item hrslice
  16285. @item vuslice
  16286. @item vdslice
  16287. @item hblur
  16288. @item fadegrays
  16289. @item wipetl
  16290. @item wipetr
  16291. @item wipebl
  16292. @item wipebr
  16293. @item squeezeh
  16294. @item squeezev
  16295. @end table
  16296. Default transition effect is fade.
  16297. @item duration
  16298. Set cross fade duration in seconds.
  16299. Default duration is 1 second.
  16300. @item offset
  16301. Set cross fade start relative to first input stream in seconds.
  16302. Default offset is 0.
  16303. @item expr
  16304. Set expression for custom transition effect.
  16305. The expressions can use the following variables and functions:
  16306. @table @option
  16307. @item X
  16308. @item Y
  16309. The coordinates of the current sample.
  16310. @item W
  16311. @item H
  16312. The width and height of the image.
  16313. @item P
  16314. Progress of transition effect.
  16315. @item PLANE
  16316. Currently processed plane.
  16317. @item A
  16318. Return value of first input at current location and plane.
  16319. @item B
  16320. Return value of second input at current location and plane.
  16321. @item a0(x, y)
  16322. @item a1(x, y)
  16323. @item a2(x, y)
  16324. @item a3(x, y)
  16325. Return the value of the pixel at location (@var{x},@var{y}) of the
  16326. first/second/third/fourth component of first input.
  16327. @item b0(x, y)
  16328. @item b1(x, y)
  16329. @item b2(x, y)
  16330. @item b3(x, y)
  16331. Return the value of the pixel at location (@var{x},@var{y}) of the
  16332. first/second/third/fourth component of second input.
  16333. @end table
  16334. @end table
  16335. @subsection Examples
  16336. @itemize
  16337. @item
  16338. Cross fade from one input video to another input video, with fade transition and duration of transition
  16339. of 2 seconds starting at offset of 5 seconds:
  16340. @example
  16341. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16342. @end example
  16343. @end itemize
  16344. @section xmedian
  16345. Pick median pixels from several input videos.
  16346. The filter accepts the following options:
  16347. @table @option
  16348. @item inputs
  16349. Set number of inputs.
  16350. Default is 3. Allowed range is from 3 to 255.
  16351. If number of inputs is even number, than result will be mean value between two median values.
  16352. @item planes
  16353. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16354. @item percentile
  16355. Set median percentile. Default value is @code{0.5}.
  16356. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16357. minimum values, and @code{1} maximum values.
  16358. @end table
  16359. @subsection Commands
  16360. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  16361. @section xstack
  16362. Stack video inputs into custom layout.
  16363. All streams must be of same pixel format.
  16364. The filter accepts the following options:
  16365. @table @option
  16366. @item inputs
  16367. Set number of input streams. Default is 2.
  16368. @item layout
  16369. Specify layout of inputs.
  16370. This option requires the desired layout configuration to be explicitly set by the user.
  16371. This sets position of each video input in output. Each input
  16372. is separated by '|'.
  16373. The first number represents the column, and the second number represents the row.
  16374. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16375. where X is video input from which to take width or height.
  16376. Multiple values can be used when separated by '+'. In such
  16377. case values are summed together.
  16378. Note that if inputs are of different sizes gaps may appear, as not all of
  16379. the output video frame will be filled. Similarly, videos can overlap each
  16380. other if their position doesn't leave enough space for the full frame of
  16381. adjoining videos.
  16382. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16383. a layout must be set by the user.
  16384. @item shortest
  16385. If set to 1, force the output to terminate when the shortest input
  16386. terminates. Default value is 0.
  16387. @item fill
  16388. If set to valid color, all unused pixels will be filled with that color.
  16389. By default fill is set to none, so it is disabled.
  16390. @end table
  16391. @subsection Examples
  16392. @itemize
  16393. @item
  16394. Display 4 inputs into 2x2 grid.
  16395. Layout:
  16396. @example
  16397. input1(0, 0) | input3(w0, 0)
  16398. input2(0, h0) | input4(w0, h0)
  16399. @end example
  16400. @example
  16401. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16402. @end example
  16403. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16404. @item
  16405. Display 4 inputs into 1x4 grid.
  16406. Layout:
  16407. @example
  16408. input1(0, 0)
  16409. input2(0, h0)
  16410. input3(0, h0+h1)
  16411. input4(0, h0+h1+h2)
  16412. @end example
  16413. @example
  16414. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16415. @end example
  16416. Note that if inputs are of different widths, unused space will appear.
  16417. @item
  16418. Display 9 inputs into 3x3 grid.
  16419. Layout:
  16420. @example
  16421. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16422. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16423. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16424. @end example
  16425. @example
  16426. 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
  16427. @end example
  16428. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16429. @item
  16430. Display 16 inputs into 4x4 grid.
  16431. Layout:
  16432. @example
  16433. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16434. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16435. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16436. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16437. @end example
  16438. @example
  16439. 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|
  16440. 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
  16441. @end example
  16442. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16443. @end itemize
  16444. @anchor{yadif}
  16445. @section yadif
  16446. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16447. filter").
  16448. It accepts the following parameters:
  16449. @table @option
  16450. @item mode
  16451. The interlacing mode to adopt. It accepts one of the following values:
  16452. @table @option
  16453. @item 0, send_frame
  16454. Output one frame for each frame.
  16455. @item 1, send_field
  16456. Output one frame for each field.
  16457. @item 2, send_frame_nospatial
  16458. Like @code{send_frame}, but it skips the spatial interlacing check.
  16459. @item 3, send_field_nospatial
  16460. Like @code{send_field}, but it skips the spatial interlacing check.
  16461. @end table
  16462. The default value is @code{send_frame}.
  16463. @item parity
  16464. The picture field parity assumed for the input interlaced video. It accepts one
  16465. of the following values:
  16466. @table @option
  16467. @item 0, tff
  16468. Assume the top field is first.
  16469. @item 1, bff
  16470. Assume the bottom field is first.
  16471. @item -1, auto
  16472. Enable automatic detection of field parity.
  16473. @end table
  16474. The default value is @code{auto}.
  16475. If the interlacing is unknown or the decoder does not export this information,
  16476. top field first will be assumed.
  16477. @item deint
  16478. Specify which frames to deinterlace. Accepts one of the following
  16479. values:
  16480. @table @option
  16481. @item 0, all
  16482. Deinterlace all frames.
  16483. @item 1, interlaced
  16484. Only deinterlace frames marked as interlaced.
  16485. @end table
  16486. The default value is @code{all}.
  16487. @end table
  16488. @section yadif_cuda
  16489. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16490. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16491. and/or nvenc.
  16492. It accepts the following parameters:
  16493. @table @option
  16494. @item mode
  16495. The interlacing mode to adopt. It accepts one of the following values:
  16496. @table @option
  16497. @item 0, send_frame
  16498. Output one frame for each frame.
  16499. @item 1, send_field
  16500. Output one frame for each field.
  16501. @item 2, send_frame_nospatial
  16502. Like @code{send_frame}, but it skips the spatial interlacing check.
  16503. @item 3, send_field_nospatial
  16504. Like @code{send_field}, but it skips the spatial interlacing check.
  16505. @end table
  16506. The default value is @code{send_frame}.
  16507. @item parity
  16508. The picture field parity assumed for the input interlaced video. It accepts one
  16509. of the following values:
  16510. @table @option
  16511. @item 0, tff
  16512. Assume the top field is first.
  16513. @item 1, bff
  16514. Assume the bottom field is first.
  16515. @item -1, auto
  16516. Enable automatic detection of field parity.
  16517. @end table
  16518. The default value is @code{auto}.
  16519. If the interlacing is unknown or the decoder does not export this information,
  16520. top field first will be assumed.
  16521. @item deint
  16522. Specify which frames to deinterlace. Accepts one of the following
  16523. values:
  16524. @table @option
  16525. @item 0, all
  16526. Deinterlace all frames.
  16527. @item 1, interlaced
  16528. Only deinterlace frames marked as interlaced.
  16529. @end table
  16530. The default value is @code{all}.
  16531. @end table
  16532. @section yaepblur
  16533. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16534. The algorithm is described in
  16535. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16536. It accepts the following parameters:
  16537. @table @option
  16538. @item radius, r
  16539. Set the window radius. Default value is 3.
  16540. @item planes, p
  16541. Set which planes to filter. Default is only the first plane.
  16542. @item sigma, s
  16543. Set blur strength. Default value is 128.
  16544. @end table
  16545. @subsection Commands
  16546. This filter supports same @ref{commands} as options.
  16547. @section zoompan
  16548. Apply Zoom & Pan effect.
  16549. This filter accepts the following options:
  16550. @table @option
  16551. @item zoom, z
  16552. Set the zoom expression. Range is 1-10. Default is 1.
  16553. @item x
  16554. @item y
  16555. Set the x and y expression. Default is 0.
  16556. @item d
  16557. Set the duration expression in number of frames.
  16558. This sets for how many number of frames effect will last for
  16559. single input image.
  16560. @item s
  16561. Set the output image size, default is 'hd720'.
  16562. @item fps
  16563. Set the output frame rate, default is '25'.
  16564. @end table
  16565. Each expression can contain the following constants:
  16566. @table @option
  16567. @item in_w, iw
  16568. Input width.
  16569. @item in_h, ih
  16570. Input height.
  16571. @item out_w, ow
  16572. Output width.
  16573. @item out_h, oh
  16574. Output height.
  16575. @item in
  16576. Input frame count.
  16577. @item on
  16578. Output frame count.
  16579. @item in_time, it
  16580. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16581. @item out_time, time, ot
  16582. The output timestamp expressed in seconds.
  16583. @item x
  16584. @item y
  16585. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16586. for current input frame.
  16587. @item px
  16588. @item py
  16589. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16590. not yet such frame (first input frame).
  16591. @item zoom
  16592. Last calculated zoom from 'z' expression for current input frame.
  16593. @item pzoom
  16594. Last calculated zoom of last output frame of previous input frame.
  16595. @item duration
  16596. Number of output frames for current input frame. Calculated from 'd' expression
  16597. for each input frame.
  16598. @item pduration
  16599. number of output frames created for previous input frame
  16600. @item a
  16601. Rational number: input width / input height
  16602. @item sar
  16603. sample aspect ratio
  16604. @item dar
  16605. display aspect ratio
  16606. @end table
  16607. @subsection Examples
  16608. @itemize
  16609. @item
  16610. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16611. @example
  16612. 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
  16613. @end example
  16614. @item
  16615. Zoom in up to 1.5x and pan always at center of picture:
  16616. @example
  16617. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16618. @end example
  16619. @item
  16620. Same as above but without pausing:
  16621. @example
  16622. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16623. @end example
  16624. @item
  16625. Zoom in 2x into center of picture only for the first second of the input video:
  16626. @example
  16627. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16628. @end example
  16629. @end itemize
  16630. @anchor{zscale}
  16631. @section zscale
  16632. Scale (resize) the input video, using the z.lib library:
  16633. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16634. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16635. The zscale filter forces the output display aspect ratio to be the same
  16636. as the input, by changing the output sample aspect ratio.
  16637. If the input image format is different from the format requested by
  16638. the next filter, the zscale filter will convert the input to the
  16639. requested format.
  16640. @subsection Options
  16641. The filter accepts the following options.
  16642. @table @option
  16643. @item width, w
  16644. @item height, h
  16645. Set the output video dimension expression. Default value is the input
  16646. dimension.
  16647. If the @var{width} or @var{w} value is 0, the input width is used for
  16648. the output. If the @var{height} or @var{h} value is 0, the input height
  16649. is used for the output.
  16650. If one and only one of the values is -n with n >= 1, the zscale filter
  16651. will use a value that maintains the aspect ratio of the input image,
  16652. calculated from the other specified dimension. After that it will,
  16653. however, make sure that the calculated dimension is divisible by n and
  16654. adjust the value if necessary.
  16655. If both values are -n with n >= 1, the behavior will be identical to
  16656. both values being set to 0 as previously detailed.
  16657. See below for the list of accepted constants for use in the dimension
  16658. expression.
  16659. @item size, s
  16660. Set the video size. For the syntax of this option, check the
  16661. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16662. @item dither, d
  16663. Set the dither type.
  16664. Possible values are:
  16665. @table @var
  16666. @item none
  16667. @item ordered
  16668. @item random
  16669. @item error_diffusion
  16670. @end table
  16671. Default is none.
  16672. @item filter, f
  16673. Set the resize filter type.
  16674. Possible values are:
  16675. @table @var
  16676. @item point
  16677. @item bilinear
  16678. @item bicubic
  16679. @item spline16
  16680. @item spline36
  16681. @item lanczos
  16682. @end table
  16683. Default is bilinear.
  16684. @item range, r
  16685. Set the color range.
  16686. Possible values are:
  16687. @table @var
  16688. @item input
  16689. @item limited
  16690. @item full
  16691. @end table
  16692. Default is same as input.
  16693. @item primaries, p
  16694. Set the color primaries.
  16695. Possible values are:
  16696. @table @var
  16697. @item input
  16698. @item 709
  16699. @item unspecified
  16700. @item 170m
  16701. @item 240m
  16702. @item 2020
  16703. @end table
  16704. Default is same as input.
  16705. @item transfer, t
  16706. Set the transfer characteristics.
  16707. Possible values are:
  16708. @table @var
  16709. @item input
  16710. @item 709
  16711. @item unspecified
  16712. @item 601
  16713. @item linear
  16714. @item 2020_10
  16715. @item 2020_12
  16716. @item smpte2084
  16717. @item iec61966-2-1
  16718. @item arib-std-b67
  16719. @end table
  16720. Default is same as input.
  16721. @item matrix, m
  16722. Set the colorspace matrix.
  16723. Possible value are:
  16724. @table @var
  16725. @item input
  16726. @item 709
  16727. @item unspecified
  16728. @item 470bg
  16729. @item 170m
  16730. @item 2020_ncl
  16731. @item 2020_cl
  16732. @end table
  16733. Default is same as input.
  16734. @item rangein, rin
  16735. Set the input color range.
  16736. Possible values are:
  16737. @table @var
  16738. @item input
  16739. @item limited
  16740. @item full
  16741. @end table
  16742. Default is same as input.
  16743. @item primariesin, pin
  16744. Set the input color primaries.
  16745. Possible values are:
  16746. @table @var
  16747. @item input
  16748. @item 709
  16749. @item unspecified
  16750. @item 170m
  16751. @item 240m
  16752. @item 2020
  16753. @end table
  16754. Default is same as input.
  16755. @item transferin, tin
  16756. Set the input transfer characteristics.
  16757. Possible values are:
  16758. @table @var
  16759. @item input
  16760. @item 709
  16761. @item unspecified
  16762. @item 601
  16763. @item linear
  16764. @item 2020_10
  16765. @item 2020_12
  16766. @end table
  16767. Default is same as input.
  16768. @item matrixin, min
  16769. Set the input colorspace matrix.
  16770. Possible value are:
  16771. @table @var
  16772. @item input
  16773. @item 709
  16774. @item unspecified
  16775. @item 470bg
  16776. @item 170m
  16777. @item 2020_ncl
  16778. @item 2020_cl
  16779. @end table
  16780. @item chromal, c
  16781. Set the output chroma location.
  16782. Possible values are:
  16783. @table @var
  16784. @item input
  16785. @item left
  16786. @item center
  16787. @item topleft
  16788. @item top
  16789. @item bottomleft
  16790. @item bottom
  16791. @end table
  16792. @item chromalin, cin
  16793. Set the input chroma location.
  16794. Possible values are:
  16795. @table @var
  16796. @item input
  16797. @item left
  16798. @item center
  16799. @item topleft
  16800. @item top
  16801. @item bottomleft
  16802. @item bottom
  16803. @end table
  16804. @item npl
  16805. Set the nominal peak luminance.
  16806. @end table
  16807. The values of the @option{w} and @option{h} options are expressions
  16808. containing the following constants:
  16809. @table @var
  16810. @item in_w
  16811. @item in_h
  16812. The input width and height
  16813. @item iw
  16814. @item ih
  16815. These are the same as @var{in_w} and @var{in_h}.
  16816. @item out_w
  16817. @item out_h
  16818. The output (scaled) width and height
  16819. @item ow
  16820. @item oh
  16821. These are the same as @var{out_w} and @var{out_h}
  16822. @item a
  16823. The same as @var{iw} / @var{ih}
  16824. @item sar
  16825. input sample aspect ratio
  16826. @item dar
  16827. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16828. @item hsub
  16829. @item vsub
  16830. horizontal and vertical input chroma subsample values. For example for the
  16831. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16832. @item ohsub
  16833. @item ovsub
  16834. horizontal and vertical output chroma subsample values. For example for the
  16835. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16836. @end table
  16837. @subsection Commands
  16838. This filter supports the following commands:
  16839. @table @option
  16840. @item width, w
  16841. @item height, h
  16842. Set the output video dimension expression.
  16843. The command accepts the same syntax of the corresponding option.
  16844. If the specified expression is not valid, it is kept at its current
  16845. value.
  16846. @end table
  16847. @c man end VIDEO FILTERS
  16848. @chapter OpenCL Video Filters
  16849. @c man begin OPENCL VIDEO FILTERS
  16850. Below is a description of the currently available OpenCL video filters.
  16851. To enable compilation of these filters you need to configure FFmpeg with
  16852. @code{--enable-opencl}.
  16853. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16854. @table @option
  16855. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16856. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16857. given device parameters.
  16858. @item -filter_hw_device @var{name}
  16859. Pass the hardware device called @var{name} to all filters in any filter graph.
  16860. @end table
  16861. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16862. @itemize
  16863. @item
  16864. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16865. @example
  16866. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16867. @end example
  16868. @end itemize
  16869. 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.
  16870. @section avgblur_opencl
  16871. Apply average blur filter.
  16872. The filter accepts the following options:
  16873. @table @option
  16874. @item sizeX
  16875. Set horizontal radius size.
  16876. Range is @code{[1, 1024]} and default value is @code{1}.
  16877. @item planes
  16878. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16879. @item sizeY
  16880. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16881. @end table
  16882. @subsection Example
  16883. @itemize
  16884. @item
  16885. 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.
  16886. @example
  16887. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16888. @end example
  16889. @end itemize
  16890. @section boxblur_opencl
  16891. Apply a boxblur algorithm to the input video.
  16892. It accepts the following parameters:
  16893. @table @option
  16894. @item luma_radius, lr
  16895. @item luma_power, lp
  16896. @item chroma_radius, cr
  16897. @item chroma_power, cp
  16898. @item alpha_radius, ar
  16899. @item alpha_power, ap
  16900. @end table
  16901. A description of the accepted options follows.
  16902. @table @option
  16903. @item luma_radius, lr
  16904. @item chroma_radius, cr
  16905. @item alpha_radius, ar
  16906. Set an expression for the box radius in pixels used for blurring the
  16907. corresponding input plane.
  16908. The radius value must be a non-negative number, and must not be
  16909. greater than the value of the expression @code{min(w,h)/2} for the
  16910. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16911. planes.
  16912. Default value for @option{luma_radius} is "2". If not specified,
  16913. @option{chroma_radius} and @option{alpha_radius} default to the
  16914. corresponding value set for @option{luma_radius}.
  16915. The expressions can contain the following constants:
  16916. @table @option
  16917. @item w
  16918. @item h
  16919. The input width and height in pixels.
  16920. @item cw
  16921. @item ch
  16922. The input chroma image width and height in pixels.
  16923. @item hsub
  16924. @item vsub
  16925. The horizontal and vertical chroma subsample values. For example, for the
  16926. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16927. @end table
  16928. @item luma_power, lp
  16929. @item chroma_power, cp
  16930. @item alpha_power, ap
  16931. Specify how many times the boxblur filter is applied to the
  16932. corresponding plane.
  16933. Default value for @option{luma_power} is 2. If not specified,
  16934. @option{chroma_power} and @option{alpha_power} default to the
  16935. corresponding value set for @option{luma_power}.
  16936. A value of 0 will disable the effect.
  16937. @end table
  16938. @subsection Examples
  16939. 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.
  16940. @itemize
  16941. @item
  16942. Apply a boxblur filter with the luma, chroma, and alpha radius
  16943. 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.
  16944. @example
  16945. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16946. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16947. @end example
  16948. @item
  16949. 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.
  16950. For the luma plane, a 2x2 box radius will be run once.
  16951. For the chroma plane, a 4x4 box radius will be run 5 times.
  16952. For the alpha plane, a 3x3 box radius will be run 7 times.
  16953. @example
  16954. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16955. @end example
  16956. @end itemize
  16957. @section colorkey_opencl
  16958. RGB colorspace color keying.
  16959. The filter accepts the following options:
  16960. @table @option
  16961. @item color
  16962. The color which will be replaced with transparency.
  16963. @item similarity
  16964. Similarity percentage with the key color.
  16965. 0.01 matches only the exact key color, while 1.0 matches everything.
  16966. @item blend
  16967. Blend percentage.
  16968. 0.0 makes pixels either fully transparent, or not transparent at all.
  16969. Higher values result in semi-transparent pixels, with a higher transparency
  16970. the more similar the pixels color is to the key color.
  16971. @end table
  16972. @subsection Examples
  16973. @itemize
  16974. @item
  16975. Make every semi-green pixel in the input transparent with some slight blending:
  16976. @example
  16977. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16978. @end example
  16979. @end itemize
  16980. @section convolution_opencl
  16981. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16982. The filter accepts the following options:
  16983. @table @option
  16984. @item 0m
  16985. @item 1m
  16986. @item 2m
  16987. @item 3m
  16988. Set matrix for each plane.
  16989. Matrix is sequence of 9, 25 or 49 signed numbers.
  16990. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16991. @item 0rdiv
  16992. @item 1rdiv
  16993. @item 2rdiv
  16994. @item 3rdiv
  16995. Set multiplier for calculated value for each plane.
  16996. If unset or 0, it will be sum of all matrix elements.
  16997. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16998. @item 0bias
  16999. @item 1bias
  17000. @item 2bias
  17001. @item 3bias
  17002. Set bias for each plane. This value is added to the result of the multiplication.
  17003. Useful for making the overall image brighter or darker.
  17004. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  17005. @end table
  17006. @subsection Examples
  17007. @itemize
  17008. @item
  17009. Apply sharpen:
  17010. @example
  17011. -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
  17012. @end example
  17013. @item
  17014. Apply blur:
  17015. @example
  17016. -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
  17017. @end example
  17018. @item
  17019. Apply edge enhance:
  17020. @example
  17021. -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
  17022. @end example
  17023. @item
  17024. Apply edge detect:
  17025. @example
  17026. -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
  17027. @end example
  17028. @item
  17029. Apply laplacian edge detector which includes diagonals:
  17030. @example
  17031. -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
  17032. @end example
  17033. @item
  17034. Apply emboss:
  17035. @example
  17036. -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
  17037. @end example
  17038. @end itemize
  17039. @section erosion_opencl
  17040. Apply erosion effect to the video.
  17041. This filter replaces the pixel by the local(3x3) minimum.
  17042. It accepts the following options:
  17043. @table @option
  17044. @item threshold0
  17045. @item threshold1
  17046. @item threshold2
  17047. @item threshold3
  17048. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17049. If @code{0}, plane will remain unchanged.
  17050. @item coordinates
  17051. Flag which specifies the pixel to refer to.
  17052. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17053. Flags to local 3x3 coordinates region centered on @code{x}:
  17054. 1 2 3
  17055. 4 x 5
  17056. 6 7 8
  17057. @end table
  17058. @subsection Example
  17059. @itemize
  17060. @item
  17061. 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.
  17062. @example
  17063. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17064. @end example
  17065. @end itemize
  17066. @section deshake_opencl
  17067. Feature-point based video stabilization filter.
  17068. The filter accepts the following options:
  17069. @table @option
  17070. @item tripod
  17071. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  17072. @item debug
  17073. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  17074. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  17075. Viewing point matches in the output video is only supported for RGB input.
  17076. Defaults to @code{0}.
  17077. @item adaptive_crop
  17078. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  17079. Defaults to @code{1}.
  17080. @item refine_features
  17081. Whether or not feature points should be refined at a sub-pixel level.
  17082. This can be turned off for a slight performance gain at the cost of precision.
  17083. Defaults to @code{1}.
  17084. @item smooth_strength
  17085. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  17086. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  17087. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  17088. Defaults to @code{0.0}.
  17089. @item smooth_window_multiplier
  17090. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  17091. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  17092. Acceptable values range from @code{0.1} to @code{10.0}.
  17093. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  17094. potentially improving smoothness, but also increase latency and memory usage.
  17095. Defaults to @code{2.0}.
  17096. @end table
  17097. @subsection Examples
  17098. @itemize
  17099. @item
  17100. Stabilize a video with a fixed, medium smoothing strength:
  17101. @example
  17102. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  17103. @end example
  17104. @item
  17105. Stabilize a video with debugging (both in console and in rendered video):
  17106. @example
  17107. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  17108. @end example
  17109. @end itemize
  17110. @section dilation_opencl
  17111. Apply dilation effect to the video.
  17112. This filter replaces the pixel by the local(3x3) maximum.
  17113. It accepts the following options:
  17114. @table @option
  17115. @item threshold0
  17116. @item threshold1
  17117. @item threshold2
  17118. @item threshold3
  17119. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17120. If @code{0}, plane will remain unchanged.
  17121. @item coordinates
  17122. Flag which specifies the pixel to refer to.
  17123. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17124. Flags to local 3x3 coordinates region centered on @code{x}:
  17125. 1 2 3
  17126. 4 x 5
  17127. 6 7 8
  17128. @end table
  17129. @subsection Example
  17130. @itemize
  17131. @item
  17132. 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.
  17133. @example
  17134. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17135. @end example
  17136. @end itemize
  17137. @section nlmeans_opencl
  17138. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  17139. @section overlay_opencl
  17140. Overlay one video on top of another.
  17141. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  17142. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  17143. The filter accepts the following options:
  17144. @table @option
  17145. @item x
  17146. Set the x coordinate of the overlaid video on the main video.
  17147. Default value is @code{0}.
  17148. @item y
  17149. Set the y coordinate of the overlaid video on the main video.
  17150. Default value is @code{0}.
  17151. @end table
  17152. @subsection Examples
  17153. @itemize
  17154. @item
  17155. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  17156. @example
  17157. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17158. @end example
  17159. @item
  17160. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  17161. @example
  17162. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17163. @end example
  17164. @end itemize
  17165. @section pad_opencl
  17166. Add paddings to the input image, and place the original input at the
  17167. provided @var{x}, @var{y} coordinates.
  17168. It accepts the following options:
  17169. @table @option
  17170. @item width, w
  17171. @item height, h
  17172. Specify an expression for the size of the output image with the
  17173. paddings added. If the value for @var{width} or @var{height} is 0, the
  17174. corresponding input size is used for the output.
  17175. The @var{width} expression can reference the value set by the
  17176. @var{height} expression, and vice versa.
  17177. The default value of @var{width} and @var{height} is 0.
  17178. @item x
  17179. @item y
  17180. Specify the offsets to place the input image at within the padded area,
  17181. with respect to the top/left border of the output image.
  17182. The @var{x} expression can reference the value set by the @var{y}
  17183. expression, and vice versa.
  17184. The default value of @var{x} and @var{y} is 0.
  17185. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  17186. so the input image is centered on the padded area.
  17187. @item color
  17188. Specify the color of the padded area. For the syntax of this option,
  17189. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17190. manual,ffmpeg-utils}.
  17191. @item aspect
  17192. Pad to an aspect instead to a resolution.
  17193. @end table
  17194. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  17195. options are expressions containing the following constants:
  17196. @table @option
  17197. @item in_w
  17198. @item in_h
  17199. The input video width and height.
  17200. @item iw
  17201. @item ih
  17202. These are the same as @var{in_w} and @var{in_h}.
  17203. @item out_w
  17204. @item out_h
  17205. The output width and height (the size of the padded area), as
  17206. specified by the @var{width} and @var{height} expressions.
  17207. @item ow
  17208. @item oh
  17209. These are the same as @var{out_w} and @var{out_h}.
  17210. @item x
  17211. @item y
  17212. The x and y offsets as specified by the @var{x} and @var{y}
  17213. expressions, or NAN if not yet specified.
  17214. @item a
  17215. same as @var{iw} / @var{ih}
  17216. @item sar
  17217. input sample aspect ratio
  17218. @item dar
  17219. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  17220. @end table
  17221. @section prewitt_opencl
  17222. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  17223. The filter accepts the following option:
  17224. @table @option
  17225. @item planes
  17226. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17227. @item scale
  17228. Set value which will be multiplied with filtered result.
  17229. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17230. @item delta
  17231. Set value which will be added to filtered result.
  17232. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17233. @end table
  17234. @subsection Example
  17235. @itemize
  17236. @item
  17237. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  17238. @example
  17239. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17240. @end example
  17241. @end itemize
  17242. @anchor{program_opencl}
  17243. @section program_opencl
  17244. Filter video using an OpenCL program.
  17245. @table @option
  17246. @item source
  17247. OpenCL program source file.
  17248. @item kernel
  17249. Kernel name in program.
  17250. @item inputs
  17251. Number of inputs to the filter. Defaults to 1.
  17252. @item size, s
  17253. Size of output frames. Defaults to the same as the first input.
  17254. @end table
  17255. The @code{program_opencl} filter also supports the @ref{framesync} options.
  17256. The program source file must contain a kernel function with the given name,
  17257. which will be run once for each plane of the output. Each run on a plane
  17258. gets enqueued as a separate 2D global NDRange with one work-item for each
  17259. pixel to be generated. The global ID offset for each work-item is therefore
  17260. the coordinates of a pixel in the destination image.
  17261. The kernel function needs to take the following arguments:
  17262. @itemize
  17263. @item
  17264. Destination image, @var{__write_only image2d_t}.
  17265. This image will become the output; the kernel should write all of it.
  17266. @item
  17267. Frame index, @var{unsigned int}.
  17268. This is a counter starting from zero and increasing by one for each frame.
  17269. @item
  17270. Source images, @var{__read_only image2d_t}.
  17271. These are the most recent images on each input. The kernel may read from
  17272. them to generate the output, but they can't be written to.
  17273. @end itemize
  17274. Example programs:
  17275. @itemize
  17276. @item
  17277. Copy the input to the output (output must be the same size as the input).
  17278. @verbatim
  17279. __kernel void copy(__write_only image2d_t destination,
  17280. unsigned int index,
  17281. __read_only image2d_t source)
  17282. {
  17283. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17284. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17285. float4 value = read_imagef(source, sampler, location);
  17286. write_imagef(destination, location, value);
  17287. }
  17288. @end verbatim
  17289. @item
  17290. Apply a simple transformation, rotating the input by an amount increasing
  17291. with the index counter. Pixel values are linearly interpolated by the
  17292. sampler, and the output need not have the same dimensions as the input.
  17293. @verbatim
  17294. __kernel void rotate_image(__write_only image2d_t dst,
  17295. unsigned int index,
  17296. __read_only image2d_t src)
  17297. {
  17298. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17299. CLK_FILTER_LINEAR);
  17300. float angle = (float)index / 100.0f;
  17301. float2 dst_dim = convert_float2(get_image_dim(dst));
  17302. float2 src_dim = convert_float2(get_image_dim(src));
  17303. float2 dst_cen = dst_dim / 2.0f;
  17304. float2 src_cen = src_dim / 2.0f;
  17305. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17306. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17307. float2 src_pos = {
  17308. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17309. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17310. };
  17311. src_pos = src_pos * src_dim / dst_dim;
  17312. float2 src_loc = src_pos + src_cen;
  17313. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17314. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17315. write_imagef(dst, dst_loc, 0.5f);
  17316. else
  17317. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17318. }
  17319. @end verbatim
  17320. @item
  17321. Blend two inputs together, with the amount of each input used varying
  17322. with the index counter.
  17323. @verbatim
  17324. __kernel void blend_images(__write_only image2d_t dst,
  17325. unsigned int index,
  17326. __read_only image2d_t src1,
  17327. __read_only image2d_t src2)
  17328. {
  17329. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17330. CLK_FILTER_LINEAR);
  17331. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17332. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17333. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17334. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17335. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17336. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17337. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17338. }
  17339. @end verbatim
  17340. @end itemize
  17341. @section roberts_opencl
  17342. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17343. The filter accepts the following option:
  17344. @table @option
  17345. @item planes
  17346. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17347. @item scale
  17348. Set value which will be multiplied with filtered result.
  17349. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17350. @item delta
  17351. Set value which will be added to filtered result.
  17352. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17353. @end table
  17354. @subsection Example
  17355. @itemize
  17356. @item
  17357. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17358. @example
  17359. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17360. @end example
  17361. @end itemize
  17362. @section sobel_opencl
  17363. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17364. The filter accepts the following option:
  17365. @table @option
  17366. @item planes
  17367. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17368. @item scale
  17369. Set value which will be multiplied with filtered result.
  17370. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17371. @item delta
  17372. Set value which will be added to filtered result.
  17373. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17374. @end table
  17375. @subsection Example
  17376. @itemize
  17377. @item
  17378. Apply sobel operator with scale set to 2 and delta set to 10
  17379. @example
  17380. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17381. @end example
  17382. @end itemize
  17383. @section tonemap_opencl
  17384. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17385. It accepts the following parameters:
  17386. @table @option
  17387. @item tonemap
  17388. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17389. @item param
  17390. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17391. @item desat
  17392. Apply desaturation for highlights that exceed this level of brightness. The
  17393. higher the parameter, the more color information will be preserved. This
  17394. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17395. (smoothly) turning into white instead. This makes images feel more natural,
  17396. at the cost of reducing information about out-of-range colors.
  17397. The default value is 0.5, and the algorithm here is a little different from
  17398. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17399. @item threshold
  17400. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17401. is used to detect whether the scene has changed or not. If the distance between
  17402. the current frame average brightness and the current running average exceeds
  17403. a threshold value, we would re-calculate scene average and peak brightness.
  17404. The default value is 0.2.
  17405. @item format
  17406. Specify the output pixel format.
  17407. Currently supported formats are:
  17408. @table @var
  17409. @item p010
  17410. @item nv12
  17411. @end table
  17412. @item range, r
  17413. Set the output color range.
  17414. Possible values are:
  17415. @table @var
  17416. @item tv/mpeg
  17417. @item pc/jpeg
  17418. @end table
  17419. Default is same as input.
  17420. @item primaries, p
  17421. Set the output color primaries.
  17422. Possible values are:
  17423. @table @var
  17424. @item bt709
  17425. @item bt2020
  17426. @end table
  17427. Default is same as input.
  17428. @item transfer, t
  17429. Set the output transfer characteristics.
  17430. Possible values are:
  17431. @table @var
  17432. @item bt709
  17433. @item bt2020
  17434. @end table
  17435. Default is bt709.
  17436. @item matrix, m
  17437. Set the output colorspace matrix.
  17438. Possible value are:
  17439. @table @var
  17440. @item bt709
  17441. @item bt2020
  17442. @end table
  17443. Default is same as input.
  17444. @end table
  17445. @subsection Example
  17446. @itemize
  17447. @item
  17448. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17449. @example
  17450. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17451. @end example
  17452. @end itemize
  17453. @section unsharp_opencl
  17454. Sharpen or blur the input video.
  17455. It accepts the following parameters:
  17456. @table @option
  17457. @item luma_msize_x, lx
  17458. Set the luma matrix horizontal size.
  17459. Range is @code{[1, 23]} and default value is @code{5}.
  17460. @item luma_msize_y, ly
  17461. Set the luma matrix vertical size.
  17462. Range is @code{[1, 23]} and default value is @code{5}.
  17463. @item luma_amount, la
  17464. Set the luma effect strength.
  17465. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17466. Negative values will blur the input video, while positive values will
  17467. sharpen it, a value of zero will disable the effect.
  17468. @item chroma_msize_x, cx
  17469. Set the chroma matrix horizontal size.
  17470. Range is @code{[1, 23]} and default value is @code{5}.
  17471. @item chroma_msize_y, cy
  17472. Set the chroma matrix vertical size.
  17473. Range is @code{[1, 23]} and default value is @code{5}.
  17474. @item chroma_amount, ca
  17475. Set the chroma effect strength.
  17476. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17477. Negative values will blur the input video, while positive values will
  17478. sharpen it, a value of zero will disable the effect.
  17479. @end table
  17480. All parameters are optional and default to the equivalent of the
  17481. string '5:5:1.0:5:5:0.0'.
  17482. @subsection Examples
  17483. @itemize
  17484. @item
  17485. Apply strong luma sharpen effect:
  17486. @example
  17487. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17488. @end example
  17489. @item
  17490. Apply a strong blur of both luma and chroma parameters:
  17491. @example
  17492. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17493. @end example
  17494. @end itemize
  17495. @section xfade_opencl
  17496. Cross fade two videos with custom transition effect by using OpenCL.
  17497. It accepts the following options:
  17498. @table @option
  17499. @item transition
  17500. Set one of possible transition effects.
  17501. @table @option
  17502. @item custom
  17503. Select custom transition effect, the actual transition description
  17504. will be picked from source and kernel options.
  17505. @item fade
  17506. @item wipeleft
  17507. @item wiperight
  17508. @item wipeup
  17509. @item wipedown
  17510. @item slideleft
  17511. @item slideright
  17512. @item slideup
  17513. @item slidedown
  17514. Default transition is fade.
  17515. @end table
  17516. @item source
  17517. OpenCL program source file for custom transition.
  17518. @item kernel
  17519. Set name of kernel to use for custom transition from program source file.
  17520. @item duration
  17521. Set duration of video transition.
  17522. @item offset
  17523. Set time of start of transition relative to first video.
  17524. @end table
  17525. The program source file must contain a kernel function with the given name,
  17526. which will be run once for each plane of the output. Each run on a plane
  17527. gets enqueued as a separate 2D global NDRange with one work-item for each
  17528. pixel to be generated. The global ID offset for each work-item is therefore
  17529. the coordinates of a pixel in the destination image.
  17530. The kernel function needs to take the following arguments:
  17531. @itemize
  17532. @item
  17533. Destination image, @var{__write_only image2d_t}.
  17534. This image will become the output; the kernel should write all of it.
  17535. @item
  17536. First Source image, @var{__read_only image2d_t}.
  17537. Second Source image, @var{__read_only image2d_t}.
  17538. These are the most recent images on each input. The kernel may read from
  17539. them to generate the output, but they can't be written to.
  17540. @item
  17541. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17542. @end itemize
  17543. Example programs:
  17544. @itemize
  17545. @item
  17546. Apply dots curtain transition effect:
  17547. @verbatim
  17548. __kernel void blend_images(__write_only image2d_t dst,
  17549. __read_only image2d_t src1,
  17550. __read_only image2d_t src2,
  17551. float progress)
  17552. {
  17553. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17554. CLK_FILTER_LINEAR);
  17555. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17556. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17557. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17558. rp = rp / dim;
  17559. float2 dots = (float2)(20.0, 20.0);
  17560. float2 center = (float2)(0,0);
  17561. float2 unused;
  17562. float4 val1 = read_imagef(src1, sampler, p);
  17563. float4 val2 = read_imagef(src2, sampler, p);
  17564. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17565. write_imagef(dst, p, next ? val1 : val2);
  17566. }
  17567. @end verbatim
  17568. @end itemize
  17569. @c man end OPENCL VIDEO FILTERS
  17570. @chapter VAAPI Video Filters
  17571. @c man begin VAAPI VIDEO FILTERS
  17572. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17573. To enable compilation of these filters you need to configure FFmpeg with
  17574. @code{--enable-vaapi}.
  17575. 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}
  17576. @section tonemap_vaapi
  17577. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17578. It maps the dynamic range of HDR10 content to the SDR content.
  17579. It currently only accepts HDR10 as input.
  17580. It accepts the following parameters:
  17581. @table @option
  17582. @item format
  17583. Specify the output pixel format.
  17584. Currently supported formats are:
  17585. @table @var
  17586. @item p010
  17587. @item nv12
  17588. @end table
  17589. Default is nv12.
  17590. @item primaries, p
  17591. Set the output color primaries.
  17592. Default is same as input.
  17593. @item transfer, t
  17594. Set the output transfer characteristics.
  17595. Default is bt709.
  17596. @item matrix, m
  17597. Set the output colorspace matrix.
  17598. Default is same as input.
  17599. @end table
  17600. @subsection Example
  17601. @itemize
  17602. @item
  17603. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17604. @example
  17605. tonemap_vaapi=format=p010:t=bt2020-10
  17606. @end example
  17607. @end itemize
  17608. @c man end VAAPI VIDEO FILTERS
  17609. @chapter Video Sources
  17610. @c man begin VIDEO SOURCES
  17611. Below is a description of the currently available video sources.
  17612. @section buffer
  17613. Buffer video frames, and make them available to the filter chain.
  17614. This source is mainly intended for a programmatic use, in particular
  17615. through the interface defined in @file{libavfilter/buffersrc.h}.
  17616. It accepts the following parameters:
  17617. @table @option
  17618. @item video_size
  17619. Specify the size (width and height) of the buffered video frames. For the
  17620. syntax of this option, check the
  17621. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17622. @item width
  17623. The input video width.
  17624. @item height
  17625. The input video height.
  17626. @item pix_fmt
  17627. A string representing the pixel format of the buffered video frames.
  17628. It may be a number corresponding to a pixel format, or a pixel format
  17629. name.
  17630. @item time_base
  17631. Specify the timebase assumed by the timestamps of the buffered frames.
  17632. @item frame_rate
  17633. Specify the frame rate expected for the video stream.
  17634. @item pixel_aspect, sar
  17635. The sample (pixel) aspect ratio of the input video.
  17636. @item sws_param
  17637. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17638. to the filtergraph description to specify swscale flags for automatically
  17639. inserted scalers. See @ref{Filtergraph syntax}.
  17640. @item hw_frames_ctx
  17641. When using a hardware pixel format, this should be a reference to an
  17642. AVHWFramesContext describing input frames.
  17643. @end table
  17644. For example:
  17645. @example
  17646. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17647. @end example
  17648. will instruct the source to accept video frames with size 320x240 and
  17649. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17650. square pixels (1:1 sample aspect ratio).
  17651. Since the pixel format with name "yuv410p" corresponds to the number 6
  17652. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17653. this example corresponds to:
  17654. @example
  17655. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17656. @end example
  17657. Alternatively, the options can be specified as a flat string, but this
  17658. syntax is deprecated:
  17659. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17660. @section cellauto
  17661. Create a pattern generated by an elementary cellular automaton.
  17662. The initial state of the cellular automaton can be defined through the
  17663. @option{filename} and @option{pattern} options. If such options are
  17664. not specified an initial state is created randomly.
  17665. At each new frame a new row in the video is filled with the result of
  17666. the cellular automaton next generation. The behavior when the whole
  17667. frame is filled is defined by the @option{scroll} option.
  17668. This source accepts the following options:
  17669. @table @option
  17670. @item filename, f
  17671. Read the initial cellular automaton state, i.e. the starting row, from
  17672. the specified file.
  17673. In the file, each non-whitespace character is considered an alive
  17674. cell, a newline will terminate the row, and further characters in the
  17675. file will be ignored.
  17676. @item pattern, p
  17677. Read the initial cellular automaton state, i.e. the starting row, from
  17678. the specified string.
  17679. Each non-whitespace character in the string is considered an alive
  17680. cell, a newline will terminate the row, and further characters in the
  17681. string will be ignored.
  17682. @item rate, r
  17683. Set the video rate, that is the number of frames generated per second.
  17684. Default is 25.
  17685. @item random_fill_ratio, ratio
  17686. Set the random fill ratio for the initial cellular automaton row. It
  17687. is a floating point number value ranging from 0 to 1, defaults to
  17688. 1/PHI.
  17689. This option is ignored when a file or a pattern is specified.
  17690. @item random_seed, seed
  17691. Set the seed for filling randomly the initial row, must be an integer
  17692. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17693. set to -1, the filter will try to use a good random seed on a best
  17694. effort basis.
  17695. @item rule
  17696. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17697. Default value is 110.
  17698. @item size, s
  17699. Set the size of the output video. For the syntax of this option, check the
  17700. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17701. If @option{filename} or @option{pattern} is specified, the size is set
  17702. by default to the width of the specified initial state row, and the
  17703. height is set to @var{width} * PHI.
  17704. If @option{size} is set, it must contain the width of the specified
  17705. pattern string, and the specified pattern will be centered in the
  17706. larger row.
  17707. If a filename or a pattern string is not specified, the size value
  17708. defaults to "320x518" (used for a randomly generated initial state).
  17709. @item scroll
  17710. If set to 1, scroll the output upward when all the rows in the output
  17711. have been already filled. If set to 0, the new generated row will be
  17712. written over the top row just after the bottom row is filled.
  17713. Defaults to 1.
  17714. @item start_full, full
  17715. If set to 1, completely fill the output with generated rows before
  17716. outputting the first frame.
  17717. This is the default behavior, for disabling set the value to 0.
  17718. @item stitch
  17719. If set to 1, stitch the left and right row edges together.
  17720. This is the default behavior, for disabling set the value to 0.
  17721. @end table
  17722. @subsection Examples
  17723. @itemize
  17724. @item
  17725. Read the initial state from @file{pattern}, and specify an output of
  17726. size 200x400.
  17727. @example
  17728. cellauto=f=pattern:s=200x400
  17729. @end example
  17730. @item
  17731. Generate a random initial row with a width of 200 cells, with a fill
  17732. ratio of 2/3:
  17733. @example
  17734. cellauto=ratio=2/3:s=200x200
  17735. @end example
  17736. @item
  17737. Create a pattern generated by rule 18 starting by a single alive cell
  17738. centered on an initial row with width 100:
  17739. @example
  17740. cellauto=p=@@:s=100x400:full=0:rule=18
  17741. @end example
  17742. @item
  17743. Specify a more elaborated initial pattern:
  17744. @example
  17745. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17746. @end example
  17747. @end itemize
  17748. @anchor{coreimagesrc}
  17749. @section coreimagesrc
  17750. Video source generated on GPU using Apple's CoreImage API on OSX.
  17751. This video source is a specialized version of the @ref{coreimage} video filter.
  17752. Use a core image generator at the beginning of the applied filterchain to
  17753. generate the content.
  17754. The coreimagesrc video source accepts the following options:
  17755. @table @option
  17756. @item list_generators
  17757. List all available generators along with all their respective options as well as
  17758. possible minimum and maximum values along with the default values.
  17759. @example
  17760. list_generators=true
  17761. @end example
  17762. @item size, s
  17763. Specify the size of the sourced video. For the syntax of this option, check the
  17764. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17765. The default value is @code{320x240}.
  17766. @item rate, r
  17767. Specify the frame rate of the sourced video, as the number of frames
  17768. generated per second. It has to be a string in the format
  17769. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17770. number or a valid video frame rate abbreviation. The default value is
  17771. "25".
  17772. @item sar
  17773. Set the sample aspect ratio of the sourced video.
  17774. @item duration, d
  17775. Set the duration of the sourced video. See
  17776. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17777. for the accepted syntax.
  17778. If not specified, or the expressed duration is negative, the video is
  17779. supposed to be generated forever.
  17780. @end table
  17781. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17782. A complete filterchain can be used for further processing of the
  17783. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17784. and examples for details.
  17785. @subsection Examples
  17786. @itemize
  17787. @item
  17788. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17789. given as complete and escaped command-line for Apple's standard bash shell:
  17790. @example
  17791. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17792. @end example
  17793. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17794. need for a nullsrc video source.
  17795. @end itemize
  17796. @section gradients
  17797. Generate several gradients.
  17798. @table @option
  17799. @item size, s
  17800. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17801. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17802. @item rate, r
  17803. Set frame rate, expressed as number of frames per second. Default
  17804. value is "25".
  17805. @item c0, c1, c2, c3, c4, c5, c6, c7
  17806. Set 8 colors. Default values for colors is to pick random one.
  17807. @item x0, y0, y0, y1
  17808. Set gradient line source and destination points. If negative or out of range, random ones
  17809. are picked.
  17810. @item nb_colors, n
  17811. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17812. @item seed
  17813. Set seed for picking gradient line points.
  17814. @item duration, d
  17815. Set the duration of the sourced video. See
  17816. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17817. for the accepted syntax.
  17818. If not specified, or the expressed duration is negative, the video is
  17819. supposed to be generated forever.
  17820. @item speed
  17821. Set speed of gradients rotation.
  17822. @end table
  17823. @section mandelbrot
  17824. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17825. point specified with @var{start_x} and @var{start_y}.
  17826. This source accepts the following options:
  17827. @table @option
  17828. @item end_pts
  17829. Set the terminal pts value. Default value is 400.
  17830. @item end_scale
  17831. Set the terminal scale value.
  17832. Must be a floating point value. Default value is 0.3.
  17833. @item inner
  17834. Set the inner coloring mode, that is the algorithm used to draw the
  17835. Mandelbrot fractal internal region.
  17836. It shall assume one of the following values:
  17837. @table @option
  17838. @item black
  17839. Set black mode.
  17840. @item convergence
  17841. Show time until convergence.
  17842. @item mincol
  17843. Set color based on point closest to the origin of the iterations.
  17844. @item period
  17845. Set period mode.
  17846. @end table
  17847. Default value is @var{mincol}.
  17848. @item bailout
  17849. Set the bailout value. Default value is 10.0.
  17850. @item maxiter
  17851. Set the maximum of iterations performed by the rendering
  17852. algorithm. Default value is 7189.
  17853. @item outer
  17854. Set outer coloring mode.
  17855. It shall assume one of following values:
  17856. @table @option
  17857. @item iteration_count
  17858. Set iteration count mode.
  17859. @item normalized_iteration_count
  17860. set normalized iteration count mode.
  17861. @end table
  17862. Default value is @var{normalized_iteration_count}.
  17863. @item rate, r
  17864. Set frame rate, expressed as number of frames per second. Default
  17865. value is "25".
  17866. @item size, s
  17867. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17868. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17869. @item start_scale
  17870. Set the initial scale value. Default value is 3.0.
  17871. @item start_x
  17872. Set the initial x position. Must be a floating point value between
  17873. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17874. @item start_y
  17875. Set the initial y position. Must be a floating point value between
  17876. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17877. @end table
  17878. @section mptestsrc
  17879. Generate various test patterns, as generated by the MPlayer test filter.
  17880. The size of the generated video is fixed, and is 256x256.
  17881. This source is useful in particular for testing encoding features.
  17882. This source accepts the following options:
  17883. @table @option
  17884. @item rate, r
  17885. Specify the frame rate of the sourced video, as the number of frames
  17886. generated per second. It has to be a string in the format
  17887. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17888. number or a valid video frame rate abbreviation. The default value is
  17889. "25".
  17890. @item duration, d
  17891. Set the duration of the sourced video. See
  17892. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17893. for the accepted syntax.
  17894. If not specified, or the expressed duration is negative, the video is
  17895. supposed to be generated forever.
  17896. @item test, t
  17897. Set the number or the name of the test to perform. Supported tests are:
  17898. @table @option
  17899. @item dc_luma
  17900. @item dc_chroma
  17901. @item freq_luma
  17902. @item freq_chroma
  17903. @item amp_luma
  17904. @item amp_chroma
  17905. @item cbp
  17906. @item mv
  17907. @item ring1
  17908. @item ring2
  17909. @item all
  17910. @item max_frames, m
  17911. Set the maximum number of frames generated for each test, default value is 30.
  17912. @end table
  17913. Default value is "all", which will cycle through the list of all tests.
  17914. @end table
  17915. Some examples:
  17916. @example
  17917. mptestsrc=t=dc_luma
  17918. @end example
  17919. will generate a "dc_luma" test pattern.
  17920. @section frei0r_src
  17921. Provide a frei0r source.
  17922. To enable compilation of this filter you need to install the frei0r
  17923. header and configure FFmpeg with @code{--enable-frei0r}.
  17924. This source accepts the following parameters:
  17925. @table @option
  17926. @item size
  17927. The size of the video to generate. For the syntax of this option, check the
  17928. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17929. @item framerate
  17930. The framerate of the generated video. It may be a string of the form
  17931. @var{num}/@var{den} or a frame rate abbreviation.
  17932. @item filter_name
  17933. The name to the frei0r source to load. For more information regarding frei0r and
  17934. how to set the parameters, read the @ref{frei0r} section in the video filters
  17935. documentation.
  17936. @item filter_params
  17937. A '|'-separated list of parameters to pass to the frei0r source.
  17938. @end table
  17939. For example, to generate a frei0r partik0l source with size 200x200
  17940. and frame rate 10 which is overlaid on the overlay filter main input:
  17941. @example
  17942. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17943. @end example
  17944. @section life
  17945. Generate a life pattern.
  17946. This source is based on a generalization of John Conway's life game.
  17947. The sourced input represents a life grid, each pixel represents a cell
  17948. which can be in one of two possible states, alive or dead. Every cell
  17949. interacts with its eight neighbours, which are the cells that are
  17950. horizontally, vertically, or diagonally adjacent.
  17951. At each interaction the grid evolves according to the adopted rule,
  17952. which specifies the number of neighbor alive cells which will make a
  17953. cell stay alive or born. The @option{rule} option allows one to specify
  17954. the rule to adopt.
  17955. This source accepts the following options:
  17956. @table @option
  17957. @item filename, f
  17958. Set the file from which to read the initial grid state. In the file,
  17959. each non-whitespace character is considered an alive cell, and newline
  17960. is used to delimit the end of each row.
  17961. If this option is not specified, the initial grid is generated
  17962. randomly.
  17963. @item rate, r
  17964. Set the video rate, that is the number of frames generated per second.
  17965. Default is 25.
  17966. @item random_fill_ratio, ratio
  17967. Set the random fill ratio for the initial random grid. It is a
  17968. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17969. It is ignored when a file is specified.
  17970. @item random_seed, seed
  17971. Set the seed for filling the initial random grid, must be an integer
  17972. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17973. set to -1, the filter will try to use a good random seed on a best
  17974. effort basis.
  17975. @item rule
  17976. Set the life rule.
  17977. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17978. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17979. @var{NS} specifies the number of alive neighbor cells which make a
  17980. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17981. which make a dead cell to become alive (i.e. to "born").
  17982. "s" and "b" can be used in place of "S" and "B", respectively.
  17983. Alternatively a rule can be specified by an 18-bits integer. The 9
  17984. high order bits are used to encode the next cell state if it is alive
  17985. for each number of neighbor alive cells, the low order bits specify
  17986. the rule for "borning" new cells. Higher order bits encode for an
  17987. higher number of neighbor cells.
  17988. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17989. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17990. Default value is "S23/B3", which is the original Conway's game of life
  17991. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17992. cells, and will born a new cell if there are three alive cells around
  17993. a dead cell.
  17994. @item size, s
  17995. Set the size of the output video. For the syntax of this option, check the
  17996. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17997. If @option{filename} is specified, the size is set by default to the
  17998. same size of the input file. If @option{size} is set, it must contain
  17999. the size specified in the input file, and the initial grid defined in
  18000. that file is centered in the larger resulting area.
  18001. If a filename is not specified, the size value defaults to "320x240"
  18002. (used for a randomly generated initial grid).
  18003. @item stitch
  18004. If set to 1, stitch the left and right grid edges together, and the
  18005. top and bottom edges also. Defaults to 1.
  18006. @item mold
  18007. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  18008. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  18009. value from 0 to 255.
  18010. @item life_color
  18011. Set the color of living (or new born) cells.
  18012. @item death_color
  18013. Set the color of dead cells. If @option{mold} is set, this is the first color
  18014. used to represent a dead cell.
  18015. @item mold_color
  18016. Set mold color, for definitely dead and moldy cells.
  18017. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  18018. ffmpeg-utils manual,ffmpeg-utils}.
  18019. @end table
  18020. @subsection Examples
  18021. @itemize
  18022. @item
  18023. Read a grid from @file{pattern}, and center it on a grid of size
  18024. 300x300 pixels:
  18025. @example
  18026. life=f=pattern:s=300x300
  18027. @end example
  18028. @item
  18029. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  18030. @example
  18031. life=ratio=2/3:s=200x200
  18032. @end example
  18033. @item
  18034. Specify a custom rule for evolving a randomly generated grid:
  18035. @example
  18036. life=rule=S14/B34
  18037. @end example
  18038. @item
  18039. Full example with slow death effect (mold) using @command{ffplay}:
  18040. @example
  18041. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  18042. @end example
  18043. @end itemize
  18044. @anchor{allrgb}
  18045. @anchor{allyuv}
  18046. @anchor{color}
  18047. @anchor{haldclutsrc}
  18048. @anchor{nullsrc}
  18049. @anchor{pal75bars}
  18050. @anchor{pal100bars}
  18051. @anchor{rgbtestsrc}
  18052. @anchor{smptebars}
  18053. @anchor{smptehdbars}
  18054. @anchor{testsrc}
  18055. @anchor{testsrc2}
  18056. @anchor{yuvtestsrc}
  18057. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  18058. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  18059. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  18060. The @code{color} source provides an uniformly colored input.
  18061. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  18062. @ref{haldclut} filter.
  18063. The @code{nullsrc} source returns unprocessed video frames. It is
  18064. mainly useful to be employed in analysis / debugging tools, or as the
  18065. source for filters which ignore the input data.
  18066. The @code{pal75bars} source generates a color bars pattern, based on
  18067. EBU PAL recommendations with 75% color levels.
  18068. The @code{pal100bars} source generates a color bars pattern, based on
  18069. EBU PAL recommendations with 100% color levels.
  18070. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  18071. detecting RGB vs BGR issues. You should see a red, green and blue
  18072. stripe from top to bottom.
  18073. The @code{smptebars} source generates a color bars pattern, based on
  18074. the SMPTE Engineering Guideline EG 1-1990.
  18075. The @code{smptehdbars} source generates a color bars pattern, based on
  18076. the SMPTE RP 219-2002.
  18077. The @code{testsrc} source generates a test video pattern, showing a
  18078. color pattern, a scrolling gradient and a timestamp. This is mainly
  18079. intended for testing purposes.
  18080. The @code{testsrc2} source is similar to testsrc, but supports more
  18081. pixel formats instead of just @code{rgb24}. This allows using it as an
  18082. input for other tests without requiring a format conversion.
  18083. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  18084. see a y, cb and cr stripe from top to bottom.
  18085. The sources accept the following parameters:
  18086. @table @option
  18087. @item level
  18088. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  18089. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  18090. pixels to be used as identity matrix for 3D lookup tables. Each component is
  18091. coded on a @code{1/(N*N)} scale.
  18092. @item color, c
  18093. Specify the color of the source, only available in the @code{color}
  18094. source. For the syntax of this option, check the
  18095. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18096. @item size, s
  18097. Specify the size of the sourced video. For the syntax of this option, check the
  18098. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18099. The default value is @code{320x240}.
  18100. This option is not available with the @code{allrgb}, @code{allyuv}, and
  18101. @code{haldclutsrc} filters.
  18102. @item rate, r
  18103. Specify the frame rate of the sourced video, as the number of frames
  18104. generated per second. It has to be a string in the format
  18105. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18106. number or a valid video frame rate abbreviation. The default value is
  18107. "25".
  18108. @item duration, d
  18109. Set the duration of the sourced video. See
  18110. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18111. for the accepted syntax.
  18112. If not specified, or the expressed duration is negative, the video is
  18113. supposed to be generated forever.
  18114. Since the frame rate is used as time base, all frames including the last one
  18115. will have their full duration. If the specified duration is not a multiple
  18116. of the frame duration, it will be rounded up.
  18117. @item sar
  18118. Set the sample aspect ratio of the sourced video.
  18119. @item alpha
  18120. Specify the alpha (opacity) of the background, only available in the
  18121. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  18122. 255 (fully opaque, the default).
  18123. @item decimals, n
  18124. Set the number of decimals to show in the timestamp, only available in the
  18125. @code{testsrc} source.
  18126. The displayed timestamp value will correspond to the original
  18127. timestamp value multiplied by the power of 10 of the specified
  18128. value. Default value is 0.
  18129. @end table
  18130. @subsection Examples
  18131. @itemize
  18132. @item
  18133. Generate a video with a duration of 5.3 seconds, with size
  18134. 176x144 and a frame rate of 10 frames per second:
  18135. @example
  18136. testsrc=duration=5.3:size=qcif:rate=10
  18137. @end example
  18138. @item
  18139. The following graph description will generate a red source
  18140. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  18141. frames per second:
  18142. @example
  18143. color=c=red@@0.2:s=qcif:r=10
  18144. @end example
  18145. @item
  18146. If the input content is to be ignored, @code{nullsrc} can be used. The
  18147. following command generates noise in the luminance plane by employing
  18148. the @code{geq} filter:
  18149. @example
  18150. nullsrc=s=256x256, geq=random(1)*255:128:128
  18151. @end example
  18152. @end itemize
  18153. @subsection Commands
  18154. The @code{color} source supports the following commands:
  18155. @table @option
  18156. @item c, color
  18157. Set the color of the created image. Accepts the same syntax of the
  18158. corresponding @option{color} option.
  18159. @end table
  18160. @section openclsrc
  18161. Generate video using an OpenCL program.
  18162. @table @option
  18163. @item source
  18164. OpenCL program source file.
  18165. @item kernel
  18166. Kernel name in program.
  18167. @item size, s
  18168. Size of frames to generate. This must be set.
  18169. @item format
  18170. Pixel format to use for the generated frames. This must be set.
  18171. @item rate, r
  18172. Number of frames generated every second. Default value is '25'.
  18173. @end table
  18174. For details of how the program loading works, see the @ref{program_opencl}
  18175. filter.
  18176. Example programs:
  18177. @itemize
  18178. @item
  18179. Generate a colour ramp by setting pixel values from the position of the pixel
  18180. in the output image. (Note that this will work with all pixel formats, but
  18181. the generated output will not be the same.)
  18182. @verbatim
  18183. __kernel void ramp(__write_only image2d_t dst,
  18184. unsigned int index)
  18185. {
  18186. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18187. float4 val;
  18188. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  18189. write_imagef(dst, loc, val);
  18190. }
  18191. @end verbatim
  18192. @item
  18193. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  18194. @verbatim
  18195. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  18196. unsigned int index)
  18197. {
  18198. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18199. float4 value = 0.0f;
  18200. int x = loc.x + index;
  18201. int y = loc.y + index;
  18202. while (x > 0 || y > 0) {
  18203. if (x % 3 == 1 && y % 3 == 1) {
  18204. value = 1.0f;
  18205. break;
  18206. }
  18207. x /= 3;
  18208. y /= 3;
  18209. }
  18210. write_imagef(dst, loc, value);
  18211. }
  18212. @end verbatim
  18213. @end itemize
  18214. @section sierpinski
  18215. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  18216. This source accepts the following options:
  18217. @table @option
  18218. @item size, s
  18219. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18220. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18221. @item rate, r
  18222. Set frame rate, expressed as number of frames per second. Default
  18223. value is "25".
  18224. @item seed
  18225. Set seed which is used for random panning.
  18226. @item jump
  18227. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  18228. @item type
  18229. Set fractal type, can be default @code{carpet} or @code{triangle}.
  18230. @end table
  18231. @c man end VIDEO SOURCES
  18232. @chapter Video Sinks
  18233. @c man begin VIDEO SINKS
  18234. Below is a description of the currently available video sinks.
  18235. @section buffersink
  18236. Buffer video frames, and make them available to the end of the filter
  18237. graph.
  18238. This sink is mainly intended for programmatic use, in particular
  18239. through the interface defined in @file{libavfilter/buffersink.h}
  18240. or the options system.
  18241. It accepts a pointer to an AVBufferSinkContext structure, which
  18242. defines the incoming buffers' formats, to be passed as the opaque
  18243. parameter to @code{avfilter_init_filter} for initialization.
  18244. @section nullsink
  18245. Null video sink: do absolutely nothing with the input video. It is
  18246. mainly useful as a template and for use in analysis / debugging
  18247. tools.
  18248. @c man end VIDEO SINKS
  18249. @chapter Multimedia Filters
  18250. @c man begin MULTIMEDIA FILTERS
  18251. Below is a description of the currently available multimedia filters.
  18252. @section abitscope
  18253. Convert input audio to a video output, displaying the audio bit scope.
  18254. The filter accepts the following options:
  18255. @table @option
  18256. @item rate, r
  18257. Set frame rate, expressed as number of frames per second. Default
  18258. value is "25".
  18259. @item size, s
  18260. Specify the video size for the output. For the syntax of this option, check the
  18261. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18262. Default value is @code{1024x256}.
  18263. @item colors
  18264. Specify list of colors separated by space or by '|' which will be used to
  18265. draw channels. Unrecognized or missing colors will be replaced
  18266. by white color.
  18267. @end table
  18268. @section adrawgraph
  18269. Draw a graph using input audio metadata.
  18270. See @ref{drawgraph}
  18271. @section agraphmonitor
  18272. See @ref{graphmonitor}.
  18273. @section ahistogram
  18274. Convert input audio to a video output, displaying the volume histogram.
  18275. The filter accepts the following options:
  18276. @table @option
  18277. @item dmode
  18278. Specify how histogram is calculated.
  18279. It accepts the following values:
  18280. @table @samp
  18281. @item single
  18282. Use single histogram for all channels.
  18283. @item separate
  18284. Use separate histogram for each channel.
  18285. @end table
  18286. Default is @code{single}.
  18287. @item rate, r
  18288. Set frame rate, expressed as number of frames per second. Default
  18289. value is "25".
  18290. @item size, s
  18291. Specify the video size for the output. For the syntax of this option, check the
  18292. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18293. Default value is @code{hd720}.
  18294. @item scale
  18295. Set display scale.
  18296. It accepts the following values:
  18297. @table @samp
  18298. @item log
  18299. logarithmic
  18300. @item sqrt
  18301. square root
  18302. @item cbrt
  18303. cubic root
  18304. @item lin
  18305. linear
  18306. @item rlog
  18307. reverse logarithmic
  18308. @end table
  18309. Default is @code{log}.
  18310. @item ascale
  18311. Set amplitude scale.
  18312. It accepts the following values:
  18313. @table @samp
  18314. @item log
  18315. logarithmic
  18316. @item lin
  18317. linear
  18318. @end table
  18319. Default is @code{log}.
  18320. @item acount
  18321. Set how much frames to accumulate in histogram.
  18322. Default is 1. Setting this to -1 accumulates all frames.
  18323. @item rheight
  18324. Set histogram ratio of window height.
  18325. @item slide
  18326. Set sonogram sliding.
  18327. It accepts the following values:
  18328. @table @samp
  18329. @item replace
  18330. replace old rows with new ones.
  18331. @item scroll
  18332. scroll from top to bottom.
  18333. @end table
  18334. Default is @code{replace}.
  18335. @end table
  18336. @section aphasemeter
  18337. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18338. representing mean phase of current audio frame. A video output can also be produced and is
  18339. enabled by default. The audio is passed through as first output.
  18340. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18341. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18342. and @code{1} means channels are in phase.
  18343. The filter accepts the following options, all related to its video output:
  18344. @table @option
  18345. @item rate, r
  18346. Set the output frame rate. Default value is @code{25}.
  18347. @item size, s
  18348. Set the video size for the output. For the syntax of this option, check the
  18349. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18350. Default value is @code{800x400}.
  18351. @item rc
  18352. @item gc
  18353. @item bc
  18354. Specify the red, green, blue contrast. Default values are @code{2},
  18355. @code{7} and @code{1}.
  18356. Allowed range is @code{[0, 255]}.
  18357. @item mpc
  18358. Set color which will be used for drawing median phase. If color is
  18359. @code{none} which is default, no median phase value will be drawn.
  18360. @item video
  18361. Enable video output. Default is enabled.
  18362. @end table
  18363. @subsection phasing detection
  18364. The filter also detects out of phase and mono sequences in stereo streams.
  18365. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18366. The filter accepts the following options for this detection:
  18367. @table @option
  18368. @item phasing
  18369. Enable mono and out of phase detection. Default is disabled.
  18370. @item tolerance, t
  18371. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18372. Allowed range is @code{[0, 1]}.
  18373. @item angle, a
  18374. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18375. Allowed range is @code{[90, 180]}.
  18376. @item duration, d
  18377. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18378. @end table
  18379. @subsection Examples
  18380. @itemize
  18381. @item
  18382. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18383. @example
  18384. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18385. @end example
  18386. @end itemize
  18387. @section avectorscope
  18388. Convert input audio to a video output, representing the audio vector
  18389. scope.
  18390. The filter is used to measure the difference between channels of stereo
  18391. audio stream. A monaural signal, consisting of identical left and right
  18392. signal, results in straight vertical line. Any stereo separation is visible
  18393. as a deviation from this line, creating a Lissajous figure.
  18394. If the straight (or deviation from it) but horizontal line appears this
  18395. indicates that the left and right channels are out of phase.
  18396. The filter accepts the following options:
  18397. @table @option
  18398. @item mode, m
  18399. Set the vectorscope mode.
  18400. Available values are:
  18401. @table @samp
  18402. @item lissajous
  18403. Lissajous rotated by 45 degrees.
  18404. @item lissajous_xy
  18405. Same as above but not rotated.
  18406. @item polar
  18407. Shape resembling half of circle.
  18408. @end table
  18409. Default value is @samp{lissajous}.
  18410. @item size, s
  18411. Set the video size for the output. For the syntax of this option, check the
  18412. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18413. Default value is @code{400x400}.
  18414. @item rate, r
  18415. Set the output frame rate. Default value is @code{25}.
  18416. @item rc
  18417. @item gc
  18418. @item bc
  18419. @item ac
  18420. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18421. @code{160}, @code{80} and @code{255}.
  18422. Allowed range is @code{[0, 255]}.
  18423. @item rf
  18424. @item gf
  18425. @item bf
  18426. @item af
  18427. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18428. @code{10}, @code{5} and @code{5}.
  18429. Allowed range is @code{[0, 255]}.
  18430. @item zoom
  18431. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18432. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18433. @item draw
  18434. Set the vectorscope drawing mode.
  18435. Available values are:
  18436. @table @samp
  18437. @item dot
  18438. Draw dot for each sample.
  18439. @item line
  18440. Draw line between previous and current sample.
  18441. @end table
  18442. Default value is @samp{dot}.
  18443. @item scale
  18444. Specify amplitude scale of audio samples.
  18445. Available values are:
  18446. @table @samp
  18447. @item lin
  18448. Linear.
  18449. @item sqrt
  18450. Square root.
  18451. @item cbrt
  18452. Cubic root.
  18453. @item log
  18454. Logarithmic.
  18455. @end table
  18456. @item swap
  18457. Swap left channel axis with right channel axis.
  18458. @item mirror
  18459. Mirror axis.
  18460. @table @samp
  18461. @item none
  18462. No mirror.
  18463. @item x
  18464. Mirror only x axis.
  18465. @item y
  18466. Mirror only y axis.
  18467. @item xy
  18468. Mirror both axis.
  18469. @end table
  18470. @end table
  18471. @subsection Examples
  18472. @itemize
  18473. @item
  18474. Complete example using @command{ffplay}:
  18475. @example
  18476. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18477. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18478. @end example
  18479. @end itemize
  18480. @section bench, abench
  18481. Benchmark part of a filtergraph.
  18482. The filter accepts the following options:
  18483. @table @option
  18484. @item action
  18485. Start or stop a timer.
  18486. Available values are:
  18487. @table @samp
  18488. @item start
  18489. Get the current time, set it as frame metadata (using the key
  18490. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18491. @item stop
  18492. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18493. the input frame metadata to get the time difference. Time difference, average,
  18494. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18495. @code{min}) are then printed. The timestamps are expressed in seconds.
  18496. @end table
  18497. @end table
  18498. @subsection Examples
  18499. @itemize
  18500. @item
  18501. Benchmark @ref{selectivecolor} filter:
  18502. @example
  18503. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18504. @end example
  18505. @end itemize
  18506. @section concat
  18507. Concatenate audio and video streams, joining them together one after the
  18508. other.
  18509. The filter works on segments of synchronized video and audio streams. All
  18510. segments must have the same number of streams of each type, and that will
  18511. also be the number of streams at output.
  18512. The filter accepts the following options:
  18513. @table @option
  18514. @item n
  18515. Set the number of segments. Default is 2.
  18516. @item v
  18517. Set the number of output video streams, that is also the number of video
  18518. streams in each segment. Default is 1.
  18519. @item a
  18520. Set the number of output audio streams, that is also the number of audio
  18521. streams in each segment. Default is 0.
  18522. @item unsafe
  18523. Activate unsafe mode: do not fail if segments have a different format.
  18524. @end table
  18525. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18526. @var{a} audio outputs.
  18527. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18528. segment, in the same order as the outputs, then the inputs for the second
  18529. segment, etc.
  18530. Related streams do not always have exactly the same duration, for various
  18531. reasons including codec frame size or sloppy authoring. For that reason,
  18532. related synchronized streams (e.g. a video and its audio track) should be
  18533. concatenated at once. The concat filter will use the duration of the longest
  18534. stream in each segment (except the last one), and if necessary pad shorter
  18535. audio streams with silence.
  18536. For this filter to work correctly, all segments must start at timestamp 0.
  18537. All corresponding streams must have the same parameters in all segments; the
  18538. filtering system will automatically select a common pixel format for video
  18539. streams, and a common sample format, sample rate and channel layout for
  18540. audio streams, but other settings, such as resolution, must be converted
  18541. explicitly by the user.
  18542. Different frame rates are acceptable but will result in variable frame rate
  18543. at output; be sure to configure the output file to handle it.
  18544. @subsection Examples
  18545. @itemize
  18546. @item
  18547. Concatenate an opening, an episode and an ending, all in bilingual version
  18548. (video in stream 0, audio in streams 1 and 2):
  18549. @example
  18550. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18551. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18552. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18553. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18554. @end example
  18555. @item
  18556. Concatenate two parts, handling audio and video separately, using the
  18557. (a)movie sources, and adjusting the resolution:
  18558. @example
  18559. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18560. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18561. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18562. @end example
  18563. Note that a desync will happen at the stitch if the audio and video streams
  18564. do not have exactly the same duration in the first file.
  18565. @end itemize
  18566. @subsection Commands
  18567. This filter supports the following commands:
  18568. @table @option
  18569. @item next
  18570. Close the current segment and step to the next one
  18571. @end table
  18572. @anchor{ebur128}
  18573. @section ebur128
  18574. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18575. level. By default, it logs a message at a frequency of 10Hz with the
  18576. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18577. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18578. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18579. sample format is double-precision floating point. The input stream will be converted to
  18580. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18581. after this filter to obtain the original parameters.
  18582. The filter also has a video output (see the @var{video} option) with a real
  18583. time graph to observe the loudness evolution. The graphic contains the logged
  18584. message mentioned above, so it is not printed anymore when this option is set,
  18585. unless the verbose logging is set. The main graphing area contains the
  18586. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18587. the momentary loudness (400 milliseconds), but can optionally be configured
  18588. to instead display short-term loudness (see @var{gauge}).
  18589. The green area marks a +/- 1LU target range around the target loudness
  18590. (-23LUFS by default, unless modified through @var{target}).
  18591. More information about the Loudness Recommendation EBU R128 on
  18592. @url{http://tech.ebu.ch/loudness}.
  18593. The filter accepts the following options:
  18594. @table @option
  18595. @item video
  18596. Activate the video output. The audio stream is passed unchanged whether this
  18597. option is set or no. The video stream will be the first output stream if
  18598. activated. Default is @code{0}.
  18599. @item size
  18600. Set the video size. This option is for video only. For the syntax of this
  18601. option, check the
  18602. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18603. Default and minimum resolution is @code{640x480}.
  18604. @item meter
  18605. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18606. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18607. other integer value between this range is allowed.
  18608. @item metadata
  18609. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18610. into 100ms output frames, each of them containing various loudness information
  18611. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18612. Default is @code{0}.
  18613. @item framelog
  18614. Force the frame logging level.
  18615. Available values are:
  18616. @table @samp
  18617. @item info
  18618. information logging level
  18619. @item verbose
  18620. verbose logging level
  18621. @end table
  18622. By default, the logging level is set to @var{info}. If the @option{video} or
  18623. the @option{metadata} options are set, it switches to @var{verbose}.
  18624. @item peak
  18625. Set peak mode(s).
  18626. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18627. values are:
  18628. @table @samp
  18629. @item none
  18630. Disable any peak mode (default).
  18631. @item sample
  18632. Enable sample-peak mode.
  18633. Simple peak mode looking for the higher sample value. It logs a message
  18634. for sample-peak (identified by @code{SPK}).
  18635. @item true
  18636. Enable true-peak mode.
  18637. If enabled, the peak lookup is done on an over-sampled version of the input
  18638. stream for better peak accuracy. It logs a message for true-peak.
  18639. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18640. This mode requires a build with @code{libswresample}.
  18641. @end table
  18642. @item dualmono
  18643. Treat mono input files as "dual mono". If a mono file is intended for playback
  18644. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18645. If set to @code{true}, this option will compensate for this effect.
  18646. Multi-channel input files are not affected by this option.
  18647. @item panlaw
  18648. Set a specific pan law to be used for the measurement of dual mono files.
  18649. This parameter is optional, and has a default value of -3.01dB.
  18650. @item target
  18651. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18652. This parameter is optional and has a default value of -23LUFS as specified
  18653. by EBU R128. However, material published online may prefer a level of -16LUFS
  18654. (e.g. for use with podcasts or video platforms).
  18655. @item gauge
  18656. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18657. @code{shortterm}. By default the momentary value will be used, but in certain
  18658. scenarios it may be more useful to observe the short term value instead (e.g.
  18659. live mixing).
  18660. @item scale
  18661. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18662. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18663. video output, not the summary or continuous log output.
  18664. @end table
  18665. @subsection Examples
  18666. @itemize
  18667. @item
  18668. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18669. @example
  18670. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18671. @end example
  18672. @item
  18673. Run an analysis with @command{ffmpeg}:
  18674. @example
  18675. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18676. @end example
  18677. @end itemize
  18678. @section interleave, ainterleave
  18679. Temporally interleave frames from several inputs.
  18680. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18681. These filters read frames from several inputs and send the oldest
  18682. queued frame to the output.
  18683. Input streams must have well defined, monotonically increasing frame
  18684. timestamp values.
  18685. In order to submit one frame to output, these filters need to enqueue
  18686. at least one frame for each input, so they cannot work in case one
  18687. input is not yet terminated and will not receive incoming frames.
  18688. For example consider the case when one input is a @code{select} filter
  18689. which always drops input frames. The @code{interleave} filter will keep
  18690. reading from that input, but it will never be able to send new frames
  18691. to output until the input sends an end-of-stream signal.
  18692. Also, depending on inputs synchronization, the filters will drop
  18693. frames in case one input receives more frames than the other ones, and
  18694. the queue is already filled.
  18695. These filters accept the following options:
  18696. @table @option
  18697. @item nb_inputs, n
  18698. Set the number of different inputs, it is 2 by default.
  18699. @item duration
  18700. How to determine the end-of-stream.
  18701. @table @option
  18702. @item longest
  18703. The duration of the longest input. (default)
  18704. @item shortest
  18705. The duration of the shortest input.
  18706. @item first
  18707. The duration of the first input.
  18708. @end table
  18709. @end table
  18710. @subsection Examples
  18711. @itemize
  18712. @item
  18713. Interleave frames belonging to different streams using @command{ffmpeg}:
  18714. @example
  18715. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18716. @end example
  18717. @item
  18718. Add flickering blur effect:
  18719. @example
  18720. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18721. @end example
  18722. @end itemize
  18723. @section metadata, ametadata
  18724. Manipulate frame metadata.
  18725. This filter accepts the following options:
  18726. @table @option
  18727. @item mode
  18728. Set mode of operation of the filter.
  18729. Can be one of the following:
  18730. @table @samp
  18731. @item select
  18732. If both @code{value} and @code{key} is set, select frames
  18733. which have such metadata. If only @code{key} is set, select
  18734. every frame that has such key in metadata.
  18735. @item add
  18736. Add new metadata @code{key} and @code{value}. If key is already available
  18737. do nothing.
  18738. @item modify
  18739. Modify value of already present key.
  18740. @item delete
  18741. If @code{value} is set, delete only keys that have such value.
  18742. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18743. the frame.
  18744. @item print
  18745. Print key and its value if metadata was found. If @code{key} is not set print all
  18746. metadata values available in frame.
  18747. @end table
  18748. @item key
  18749. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18750. @item value
  18751. Set metadata value which will be used. This option is mandatory for
  18752. @code{modify} and @code{add} mode.
  18753. @item function
  18754. Which function to use when comparing metadata value and @code{value}.
  18755. Can be one of following:
  18756. @table @samp
  18757. @item same_str
  18758. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18759. @item starts_with
  18760. Values are interpreted as strings, returns true if metadata value starts with
  18761. the @code{value} option string.
  18762. @item less
  18763. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18764. @item equal
  18765. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18766. @item greater
  18767. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18768. @item expr
  18769. Values are interpreted as floats, returns true if expression from option @code{expr}
  18770. evaluates to true.
  18771. @item ends_with
  18772. Values are interpreted as strings, returns true if metadata value ends with
  18773. the @code{value} option string.
  18774. @end table
  18775. @item expr
  18776. Set expression which is used when @code{function} is set to @code{expr}.
  18777. The expression is evaluated through the eval API and can contain the following
  18778. constants:
  18779. @table @option
  18780. @item VALUE1
  18781. Float representation of @code{value} from metadata key.
  18782. @item VALUE2
  18783. Float representation of @code{value} as supplied by user in @code{value} option.
  18784. @end table
  18785. @item file
  18786. If specified in @code{print} mode, output is written to the named file. Instead of
  18787. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18788. for standard output. If @code{file} option is not set, output is written to the log
  18789. with AV_LOG_INFO loglevel.
  18790. @item direct
  18791. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18792. @end table
  18793. @subsection Examples
  18794. @itemize
  18795. @item
  18796. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18797. between 0 and 1.
  18798. @example
  18799. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18800. @end example
  18801. @item
  18802. Print silencedetect output to file @file{metadata.txt}.
  18803. @example
  18804. silencedetect,ametadata=mode=print:file=metadata.txt
  18805. @end example
  18806. @item
  18807. Direct all metadata to a pipe with file descriptor 4.
  18808. @example
  18809. metadata=mode=print:file='pipe\:4'
  18810. @end example
  18811. @end itemize
  18812. @section perms, aperms
  18813. Set read/write permissions for the output frames.
  18814. These filters are mainly aimed at developers to test direct path in the
  18815. following filter in the filtergraph.
  18816. The filters accept the following options:
  18817. @table @option
  18818. @item mode
  18819. Select the permissions mode.
  18820. It accepts the following values:
  18821. @table @samp
  18822. @item none
  18823. Do nothing. This is the default.
  18824. @item ro
  18825. Set all the output frames read-only.
  18826. @item rw
  18827. Set all the output frames directly writable.
  18828. @item toggle
  18829. Make the frame read-only if writable, and writable if read-only.
  18830. @item random
  18831. Set each output frame read-only or writable randomly.
  18832. @end table
  18833. @item seed
  18834. Set the seed for the @var{random} mode, must be an integer included between
  18835. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18836. @code{-1}, the filter will try to use a good random seed on a best effort
  18837. basis.
  18838. @end table
  18839. Note: in case of auto-inserted filter between the permission filter and the
  18840. following one, the permission might not be received as expected in that
  18841. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18842. perms/aperms filter can avoid this problem.
  18843. @section realtime, arealtime
  18844. Slow down filtering to match real time approximately.
  18845. These filters will pause the filtering for a variable amount of time to
  18846. match the output rate with the input timestamps.
  18847. They are similar to the @option{re} option to @code{ffmpeg}.
  18848. They accept the following options:
  18849. @table @option
  18850. @item limit
  18851. Time limit for the pauses. Any pause longer than that will be considered
  18852. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18853. @item speed
  18854. Speed factor for processing. The value must be a float larger than zero.
  18855. Values larger than 1.0 will result in faster than realtime processing,
  18856. smaller will slow processing down. The @var{limit} is automatically adapted
  18857. accordingly. Default is 1.0.
  18858. A processing speed faster than what is possible without these filters cannot
  18859. be achieved.
  18860. @end table
  18861. @anchor{select}
  18862. @section select, aselect
  18863. Select frames to pass in output.
  18864. This filter accepts the following options:
  18865. @table @option
  18866. @item expr, e
  18867. Set expression, which is evaluated for each input frame.
  18868. If the expression is evaluated to zero, the frame is discarded.
  18869. If the evaluation result is negative or NaN, the frame is sent to the
  18870. first output; otherwise it is sent to the output with index
  18871. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18872. For example a value of @code{1.2} corresponds to the output with index
  18873. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18874. @item outputs, n
  18875. Set the number of outputs. The output to which to send the selected
  18876. frame is based on the result of the evaluation. Default value is 1.
  18877. @end table
  18878. The expression can contain the following constants:
  18879. @table @option
  18880. @item n
  18881. The (sequential) number of the filtered frame, starting from 0.
  18882. @item selected_n
  18883. The (sequential) number of the selected frame, starting from 0.
  18884. @item prev_selected_n
  18885. The sequential number of the last selected frame. It's NAN if undefined.
  18886. @item TB
  18887. The timebase of the input timestamps.
  18888. @item pts
  18889. The PTS (Presentation TimeStamp) of the filtered video frame,
  18890. expressed in @var{TB} units. It's NAN if undefined.
  18891. @item t
  18892. The PTS of the filtered video frame,
  18893. expressed in seconds. It's NAN if undefined.
  18894. @item prev_pts
  18895. The PTS of the previously filtered video frame. It's NAN if undefined.
  18896. @item prev_selected_pts
  18897. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18898. @item prev_selected_t
  18899. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18900. @item start_pts
  18901. The PTS of the first video frame in the video. It's NAN if undefined.
  18902. @item start_t
  18903. The time of the first video frame in the video. It's NAN if undefined.
  18904. @item pict_type @emph{(video only)}
  18905. The type of the filtered frame. It can assume one of the following
  18906. values:
  18907. @table @option
  18908. @item I
  18909. @item P
  18910. @item B
  18911. @item S
  18912. @item SI
  18913. @item SP
  18914. @item BI
  18915. @end table
  18916. @item interlace_type @emph{(video only)}
  18917. The frame interlace type. It can assume one of the following values:
  18918. @table @option
  18919. @item PROGRESSIVE
  18920. The frame is progressive (not interlaced).
  18921. @item TOPFIRST
  18922. The frame is top-field-first.
  18923. @item BOTTOMFIRST
  18924. The frame is bottom-field-first.
  18925. @end table
  18926. @item consumed_sample_n @emph{(audio only)}
  18927. the number of selected samples before the current frame
  18928. @item samples_n @emph{(audio only)}
  18929. the number of samples in the current frame
  18930. @item sample_rate @emph{(audio only)}
  18931. the input sample rate
  18932. @item key
  18933. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18934. @item pos
  18935. the position in the file of the filtered frame, -1 if the information
  18936. is not available (e.g. for synthetic video)
  18937. @item scene @emph{(video only)}
  18938. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18939. probability for the current frame to introduce a new scene, while a higher
  18940. value means the current frame is more likely to be one (see the example below)
  18941. @item concatdec_select
  18942. The concat demuxer can select only part of a concat input file by setting an
  18943. inpoint and an outpoint, but the output packets may not be entirely contained
  18944. in the selected interval. By using this variable, it is possible to skip frames
  18945. generated by the concat demuxer which are not exactly contained in the selected
  18946. interval.
  18947. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18948. and the @var{lavf.concat.duration} packet metadata values which are also
  18949. present in the decoded frames.
  18950. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18951. start_time and either the duration metadata is missing or the frame pts is less
  18952. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18953. missing.
  18954. That basically means that an input frame is selected if its pts is within the
  18955. interval set by the concat demuxer.
  18956. @end table
  18957. The default value of the select expression is "1".
  18958. @subsection Examples
  18959. @itemize
  18960. @item
  18961. Select all frames in input:
  18962. @example
  18963. select
  18964. @end example
  18965. The example above is the same as:
  18966. @example
  18967. select=1
  18968. @end example
  18969. @item
  18970. Skip all frames:
  18971. @example
  18972. select=0
  18973. @end example
  18974. @item
  18975. Select only I-frames:
  18976. @example
  18977. select='eq(pict_type\,I)'
  18978. @end example
  18979. @item
  18980. Select one frame every 100:
  18981. @example
  18982. select='not(mod(n\,100))'
  18983. @end example
  18984. @item
  18985. Select only frames contained in the 10-20 time interval:
  18986. @example
  18987. select=between(t\,10\,20)
  18988. @end example
  18989. @item
  18990. Select only I-frames contained in the 10-20 time interval:
  18991. @example
  18992. select=between(t\,10\,20)*eq(pict_type\,I)
  18993. @end example
  18994. @item
  18995. Select frames with a minimum distance of 10 seconds:
  18996. @example
  18997. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18998. @end example
  18999. @item
  19000. Use aselect to select only audio frames with samples number > 100:
  19001. @example
  19002. aselect='gt(samples_n\,100)'
  19003. @end example
  19004. @item
  19005. Create a mosaic of the first scenes:
  19006. @example
  19007. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  19008. @end example
  19009. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  19010. choice.
  19011. @item
  19012. Send even and odd frames to separate outputs, and compose them:
  19013. @example
  19014. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  19015. @end example
  19016. @item
  19017. Select useful frames from an ffconcat file which is using inpoints and
  19018. outpoints but where the source files are not intra frame only.
  19019. @example
  19020. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  19021. @end example
  19022. @end itemize
  19023. @section sendcmd, asendcmd
  19024. Send commands to filters in the filtergraph.
  19025. These filters read commands to be sent to other filters in the
  19026. filtergraph.
  19027. @code{sendcmd} must be inserted between two video filters,
  19028. @code{asendcmd} must be inserted between two audio filters, but apart
  19029. from that they act the same way.
  19030. The specification of commands can be provided in the filter arguments
  19031. with the @var{commands} option, or in a file specified by the
  19032. @var{filename} option.
  19033. These filters accept the following options:
  19034. @table @option
  19035. @item commands, c
  19036. Set the commands to be read and sent to the other filters.
  19037. @item filename, f
  19038. Set the filename of the commands to be read and sent to the other
  19039. filters.
  19040. @end table
  19041. @subsection Commands syntax
  19042. A commands description consists of a sequence of interval
  19043. specifications, comprising a list of commands to be executed when a
  19044. particular event related to that interval occurs. The occurring event
  19045. is typically the current frame time entering or leaving a given time
  19046. interval.
  19047. An interval is specified by the following syntax:
  19048. @example
  19049. @var{START}[-@var{END}] @var{COMMANDS};
  19050. @end example
  19051. The time interval is specified by the @var{START} and @var{END} times.
  19052. @var{END} is optional and defaults to the maximum time.
  19053. The current frame time is considered within the specified interval if
  19054. it is included in the interval [@var{START}, @var{END}), that is when
  19055. the time is greater or equal to @var{START} and is lesser than
  19056. @var{END}.
  19057. @var{COMMANDS} consists of a sequence of one or more command
  19058. specifications, separated by ",", relating to that interval. The
  19059. syntax of a command specification is given by:
  19060. @example
  19061. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  19062. @end example
  19063. @var{FLAGS} is optional and specifies the type of events relating to
  19064. the time interval which enable sending the specified command, and must
  19065. be a non-null sequence of identifier flags separated by "+" or "|" and
  19066. enclosed between "[" and "]".
  19067. The following flags are recognized:
  19068. @table @option
  19069. @item enter
  19070. The command is sent when the current frame timestamp enters the
  19071. specified interval. In other words, the command is sent when the
  19072. previous frame timestamp was not in the given interval, and the
  19073. current is.
  19074. @item leave
  19075. The command is sent when the current frame timestamp leaves the
  19076. specified interval. In other words, the command is sent when the
  19077. previous frame timestamp was in the given interval, and the
  19078. current is not.
  19079. @item expr
  19080. The command @var{ARG} is interpreted as expression and result of
  19081. expression is passed as @var{ARG}.
  19082. The expression is evaluated through the eval API and can contain the following
  19083. constants:
  19084. @table @option
  19085. @item POS
  19086. Original position in the file of the frame, or undefined if undefined
  19087. for the current frame.
  19088. @item PTS
  19089. The presentation timestamp in input.
  19090. @item N
  19091. The count of the input frame for video or audio, starting from 0.
  19092. @item T
  19093. The time in seconds of the current frame.
  19094. @item TS
  19095. The start time in seconds of the current command interval.
  19096. @item TE
  19097. The end time in seconds of the current command interval.
  19098. @item TI
  19099. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  19100. @end table
  19101. @end table
  19102. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  19103. assumed.
  19104. @var{TARGET} specifies the target of the command, usually the name of
  19105. the filter class or a specific filter instance name.
  19106. @var{COMMAND} specifies the name of the command for the target filter.
  19107. @var{ARG} is optional and specifies the optional list of argument for
  19108. the given @var{COMMAND}.
  19109. Between one interval specification and another, whitespaces, or
  19110. sequences of characters starting with @code{#} until the end of line,
  19111. are ignored and can be used to annotate comments.
  19112. A simplified BNF description of the commands specification syntax
  19113. follows:
  19114. @example
  19115. @var{COMMAND_FLAG} ::= "enter" | "leave"
  19116. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  19117. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  19118. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  19119. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  19120. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  19121. @end example
  19122. @subsection Examples
  19123. @itemize
  19124. @item
  19125. Specify audio tempo change at second 4:
  19126. @example
  19127. asendcmd=c='4.0 atempo tempo 1.5',atempo
  19128. @end example
  19129. @item
  19130. Target a specific filter instance:
  19131. @example
  19132. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  19133. @end example
  19134. @item
  19135. Specify a list of drawtext and hue commands in a file.
  19136. @example
  19137. # show text in the interval 5-10
  19138. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  19139. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  19140. # desaturate the image in the interval 15-20
  19141. 15.0-20.0 [enter] hue s 0,
  19142. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  19143. [leave] hue s 1,
  19144. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  19145. # apply an exponential saturation fade-out effect, starting from time 25
  19146. 25 [enter] hue s exp(25-t)
  19147. @end example
  19148. A filtergraph allowing to read and process the above command list
  19149. stored in a file @file{test.cmd}, can be specified with:
  19150. @example
  19151. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  19152. @end example
  19153. @end itemize
  19154. @anchor{setpts}
  19155. @section setpts, asetpts
  19156. Change the PTS (presentation timestamp) of the input frames.
  19157. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  19158. This filter accepts the following options:
  19159. @table @option
  19160. @item expr
  19161. The expression which is evaluated for each frame to construct its timestamp.
  19162. @end table
  19163. The expression is evaluated through the eval API and can contain the following
  19164. constants:
  19165. @table @option
  19166. @item FRAME_RATE, FR
  19167. frame rate, only defined for constant frame-rate video
  19168. @item PTS
  19169. The presentation timestamp in input
  19170. @item N
  19171. The count of the input frame for video or the number of consumed samples,
  19172. not including the current frame for audio, starting from 0.
  19173. @item NB_CONSUMED_SAMPLES
  19174. The number of consumed samples, not including the current frame (only
  19175. audio)
  19176. @item NB_SAMPLES, S
  19177. The number of samples in the current frame (only audio)
  19178. @item SAMPLE_RATE, SR
  19179. The audio sample rate.
  19180. @item STARTPTS
  19181. The PTS of the first frame.
  19182. @item STARTT
  19183. the time in seconds of the first frame
  19184. @item INTERLACED
  19185. State whether the current frame is interlaced.
  19186. @item T
  19187. the time in seconds of the current frame
  19188. @item POS
  19189. original position in the file of the frame, or undefined if undefined
  19190. for the current frame
  19191. @item PREV_INPTS
  19192. The previous input PTS.
  19193. @item PREV_INT
  19194. previous input time in seconds
  19195. @item PREV_OUTPTS
  19196. The previous output PTS.
  19197. @item PREV_OUTT
  19198. previous output time in seconds
  19199. @item RTCTIME
  19200. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  19201. instead.
  19202. @item RTCSTART
  19203. The wallclock (RTC) time at the start of the movie in microseconds.
  19204. @item TB
  19205. The timebase of the input timestamps.
  19206. @end table
  19207. @subsection Examples
  19208. @itemize
  19209. @item
  19210. Start counting PTS from zero
  19211. @example
  19212. setpts=PTS-STARTPTS
  19213. @end example
  19214. @item
  19215. Apply fast motion effect:
  19216. @example
  19217. setpts=0.5*PTS
  19218. @end example
  19219. @item
  19220. Apply slow motion effect:
  19221. @example
  19222. setpts=2.0*PTS
  19223. @end example
  19224. @item
  19225. Set fixed rate of 25 frames per second:
  19226. @example
  19227. setpts=N/(25*TB)
  19228. @end example
  19229. @item
  19230. Set fixed rate 25 fps with some jitter:
  19231. @example
  19232. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  19233. @end example
  19234. @item
  19235. Apply an offset of 10 seconds to the input PTS:
  19236. @example
  19237. setpts=PTS+10/TB
  19238. @end example
  19239. @item
  19240. Generate timestamps from a "live source" and rebase onto the current timebase:
  19241. @example
  19242. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  19243. @end example
  19244. @item
  19245. Generate timestamps by counting samples:
  19246. @example
  19247. asetpts=N/SR/TB
  19248. @end example
  19249. @end itemize
  19250. @section setrange
  19251. Force color range for the output video frame.
  19252. The @code{setrange} filter marks the color range property for the
  19253. output frames. It does not change the input frame, but only sets the
  19254. corresponding property, which affects how the frame is treated by
  19255. following filters.
  19256. The filter accepts the following options:
  19257. @table @option
  19258. @item range
  19259. Available values are:
  19260. @table @samp
  19261. @item auto
  19262. Keep the same color range property.
  19263. @item unspecified, unknown
  19264. Set the color range as unspecified.
  19265. @item limited, tv, mpeg
  19266. Set the color range as limited.
  19267. @item full, pc, jpeg
  19268. Set the color range as full.
  19269. @end table
  19270. @end table
  19271. @section settb, asettb
  19272. Set the timebase to use for the output frames timestamps.
  19273. It is mainly useful for testing timebase configuration.
  19274. It accepts the following parameters:
  19275. @table @option
  19276. @item expr, tb
  19277. The expression which is evaluated into the output timebase.
  19278. @end table
  19279. The value for @option{tb} is an arithmetic expression representing a
  19280. rational. The expression can contain the constants "AVTB" (the default
  19281. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19282. audio only). Default value is "intb".
  19283. @subsection Examples
  19284. @itemize
  19285. @item
  19286. Set the timebase to 1/25:
  19287. @example
  19288. settb=expr=1/25
  19289. @end example
  19290. @item
  19291. Set the timebase to 1/10:
  19292. @example
  19293. settb=expr=0.1
  19294. @end example
  19295. @item
  19296. Set the timebase to 1001/1000:
  19297. @example
  19298. settb=1+0.001
  19299. @end example
  19300. @item
  19301. Set the timebase to 2*intb:
  19302. @example
  19303. settb=2*intb
  19304. @end example
  19305. @item
  19306. Set the default timebase value:
  19307. @example
  19308. settb=AVTB
  19309. @end example
  19310. @end itemize
  19311. @section showcqt
  19312. Convert input audio to a video output representing frequency spectrum
  19313. logarithmically using Brown-Puckette constant Q transform algorithm with
  19314. direct frequency domain coefficient calculation (but the transform itself
  19315. is not really constant Q, instead the Q factor is actually variable/clamped),
  19316. with musical tone scale, from E0 to D#10.
  19317. The filter accepts the following options:
  19318. @table @option
  19319. @item size, s
  19320. Specify the video size for the output. It must be even. For the syntax of this option,
  19321. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19322. Default value is @code{1920x1080}.
  19323. @item fps, rate, r
  19324. Set the output frame rate. Default value is @code{25}.
  19325. @item bar_h
  19326. Set the bargraph height. It must be even. Default value is @code{-1} which
  19327. computes the bargraph height automatically.
  19328. @item axis_h
  19329. Set the axis height. It must be even. Default value is @code{-1} which computes
  19330. the axis height automatically.
  19331. @item sono_h
  19332. Set the sonogram height. It must be even. Default value is @code{-1} which
  19333. computes the sonogram height automatically.
  19334. @item fullhd
  19335. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19336. instead. Default value is @code{1}.
  19337. @item sono_v, volume
  19338. Specify the sonogram volume expression. It can contain variables:
  19339. @table @option
  19340. @item bar_v
  19341. the @var{bar_v} evaluated expression
  19342. @item frequency, freq, f
  19343. the frequency where it is evaluated
  19344. @item timeclamp, tc
  19345. the value of @var{timeclamp} option
  19346. @end table
  19347. and functions:
  19348. @table @option
  19349. @item a_weighting(f)
  19350. A-weighting of equal loudness
  19351. @item b_weighting(f)
  19352. B-weighting of equal loudness
  19353. @item c_weighting(f)
  19354. C-weighting of equal loudness.
  19355. @end table
  19356. Default value is @code{16}.
  19357. @item bar_v, volume2
  19358. Specify the bargraph volume expression. It can contain variables:
  19359. @table @option
  19360. @item sono_v
  19361. the @var{sono_v} evaluated expression
  19362. @item frequency, freq, f
  19363. the frequency where it is evaluated
  19364. @item timeclamp, tc
  19365. the value of @var{timeclamp} option
  19366. @end table
  19367. and functions:
  19368. @table @option
  19369. @item a_weighting(f)
  19370. A-weighting of equal loudness
  19371. @item b_weighting(f)
  19372. B-weighting of equal loudness
  19373. @item c_weighting(f)
  19374. C-weighting of equal loudness.
  19375. @end table
  19376. Default value is @code{sono_v}.
  19377. @item sono_g, gamma
  19378. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19379. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19380. Acceptable range is @code{[1, 7]}.
  19381. @item bar_g, gamma2
  19382. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19383. @code{[1, 7]}.
  19384. @item bar_t
  19385. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19386. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19387. @item timeclamp, tc
  19388. Specify the transform timeclamp. At low frequency, there is trade-off between
  19389. accuracy in time domain and frequency domain. If timeclamp is lower,
  19390. event in time domain is represented more accurately (such as fast bass drum),
  19391. otherwise event in frequency domain is represented more accurately
  19392. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19393. @item attack
  19394. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19395. limits future samples by applying asymmetric windowing in time domain, useful
  19396. when low latency is required. Accepted range is @code{[0, 1]}.
  19397. @item basefreq
  19398. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19399. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19400. @item endfreq
  19401. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19402. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19403. @item coeffclamp
  19404. This option is deprecated and ignored.
  19405. @item tlength
  19406. Specify the transform length in time domain. Use this option to control accuracy
  19407. trade-off between time domain and frequency domain at every frequency sample.
  19408. It can contain variables:
  19409. @table @option
  19410. @item frequency, freq, f
  19411. the frequency where it is evaluated
  19412. @item timeclamp, tc
  19413. the value of @var{timeclamp} option.
  19414. @end table
  19415. Default value is @code{384*tc/(384+tc*f)}.
  19416. @item count
  19417. Specify the transform count for every video frame. Default value is @code{6}.
  19418. Acceptable range is @code{[1, 30]}.
  19419. @item fcount
  19420. Specify the transform count for every single pixel. Default value is @code{0},
  19421. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19422. @item fontfile
  19423. Specify font file for use with freetype to draw the axis. If not specified,
  19424. use embedded font. Note that drawing with font file or embedded font is not
  19425. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19426. option instead.
  19427. @item font
  19428. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19429. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19430. escaping.
  19431. @item fontcolor
  19432. Specify font color expression. This is arithmetic expression that should return
  19433. integer value 0xRRGGBB. It can contain variables:
  19434. @table @option
  19435. @item frequency, freq, f
  19436. the frequency where it is evaluated
  19437. @item timeclamp, tc
  19438. the value of @var{timeclamp} option
  19439. @end table
  19440. and functions:
  19441. @table @option
  19442. @item midi(f)
  19443. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19444. @item r(x), g(x), b(x)
  19445. red, green, and blue value of intensity x.
  19446. @end table
  19447. Default value is @code{st(0, (midi(f)-59.5)/12);
  19448. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19449. r(1-ld(1)) + b(ld(1))}.
  19450. @item axisfile
  19451. Specify image file to draw the axis. This option override @var{fontfile} and
  19452. @var{fontcolor} option.
  19453. @item axis, text
  19454. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19455. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19456. Default value is @code{1}.
  19457. @item csp
  19458. Set colorspace. The accepted values are:
  19459. @table @samp
  19460. @item unspecified
  19461. Unspecified (default)
  19462. @item bt709
  19463. BT.709
  19464. @item fcc
  19465. FCC
  19466. @item bt470bg
  19467. BT.470BG or BT.601-6 625
  19468. @item smpte170m
  19469. SMPTE-170M or BT.601-6 525
  19470. @item smpte240m
  19471. SMPTE-240M
  19472. @item bt2020ncl
  19473. BT.2020 with non-constant luminance
  19474. @end table
  19475. @item cscheme
  19476. Set spectrogram color scheme. This is list of floating point values with format
  19477. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19478. The default is @code{1|0.5|0|0|0.5|1}.
  19479. @end table
  19480. @subsection Examples
  19481. @itemize
  19482. @item
  19483. Playing audio while showing the spectrum:
  19484. @example
  19485. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19486. @end example
  19487. @item
  19488. Same as above, but with frame rate 30 fps:
  19489. @example
  19490. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19491. @end example
  19492. @item
  19493. Playing at 1280x720:
  19494. @example
  19495. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19496. @end example
  19497. @item
  19498. Disable sonogram display:
  19499. @example
  19500. sono_h=0
  19501. @end example
  19502. @item
  19503. A1 and its harmonics: A1, A2, (near)E3, A3:
  19504. @example
  19505. 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),
  19506. asplit[a][out1]; [a] showcqt [out0]'
  19507. @end example
  19508. @item
  19509. Same as above, but with more accuracy in frequency domain:
  19510. @example
  19511. 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),
  19512. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19513. @end example
  19514. @item
  19515. Custom volume:
  19516. @example
  19517. bar_v=10:sono_v=bar_v*a_weighting(f)
  19518. @end example
  19519. @item
  19520. Custom gamma, now spectrum is linear to the amplitude.
  19521. @example
  19522. bar_g=2:sono_g=2
  19523. @end example
  19524. @item
  19525. Custom tlength equation:
  19526. @example
  19527. 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)))'
  19528. @end example
  19529. @item
  19530. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19531. @example
  19532. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19533. @end example
  19534. @item
  19535. Custom font using fontconfig:
  19536. @example
  19537. font='Courier New,Monospace,mono|bold'
  19538. @end example
  19539. @item
  19540. Custom frequency range with custom axis using image file:
  19541. @example
  19542. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19543. @end example
  19544. @end itemize
  19545. @section showfreqs
  19546. Convert input audio to video output representing the audio power spectrum.
  19547. Audio amplitude is on Y-axis while frequency is on X-axis.
  19548. The filter accepts the following options:
  19549. @table @option
  19550. @item size, s
  19551. Specify size of video. For the syntax of this option, check the
  19552. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19553. Default is @code{1024x512}.
  19554. @item mode
  19555. Set display mode.
  19556. This set how each frequency bin will be represented.
  19557. It accepts the following values:
  19558. @table @samp
  19559. @item line
  19560. @item bar
  19561. @item dot
  19562. @end table
  19563. Default is @code{bar}.
  19564. @item ascale
  19565. Set amplitude scale.
  19566. It accepts the following values:
  19567. @table @samp
  19568. @item lin
  19569. Linear scale.
  19570. @item sqrt
  19571. Square root scale.
  19572. @item cbrt
  19573. Cubic root scale.
  19574. @item log
  19575. Logarithmic scale.
  19576. @end table
  19577. Default is @code{log}.
  19578. @item fscale
  19579. Set frequency scale.
  19580. It accepts the following values:
  19581. @table @samp
  19582. @item lin
  19583. Linear scale.
  19584. @item log
  19585. Logarithmic scale.
  19586. @item rlog
  19587. Reverse logarithmic scale.
  19588. @end table
  19589. Default is @code{lin}.
  19590. @item win_size
  19591. Set window size. Allowed range is from 16 to 65536.
  19592. Default is @code{2048}
  19593. @item win_func
  19594. Set windowing function.
  19595. It accepts the following values:
  19596. @table @samp
  19597. @item rect
  19598. @item bartlett
  19599. @item hanning
  19600. @item hamming
  19601. @item blackman
  19602. @item welch
  19603. @item flattop
  19604. @item bharris
  19605. @item bnuttall
  19606. @item bhann
  19607. @item sine
  19608. @item nuttall
  19609. @item lanczos
  19610. @item gauss
  19611. @item tukey
  19612. @item dolph
  19613. @item cauchy
  19614. @item parzen
  19615. @item poisson
  19616. @item bohman
  19617. @end table
  19618. Default is @code{hanning}.
  19619. @item overlap
  19620. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19621. which means optimal overlap for selected window function will be picked.
  19622. @item averaging
  19623. Set time averaging. Setting this to 0 will display current maximal peaks.
  19624. Default is @code{1}, which means time averaging is disabled.
  19625. @item colors
  19626. Specify list of colors separated by space or by '|' which will be used to
  19627. draw channel frequencies. Unrecognized or missing colors will be replaced
  19628. by white color.
  19629. @item cmode
  19630. Set channel display mode.
  19631. It accepts the following values:
  19632. @table @samp
  19633. @item combined
  19634. @item separate
  19635. @end table
  19636. Default is @code{combined}.
  19637. @item minamp
  19638. Set minimum amplitude used in @code{log} amplitude scaler.
  19639. @item data
  19640. Set data display mode.
  19641. It accepts the following values:
  19642. @table @samp
  19643. @item magnitude
  19644. @item phase
  19645. @item delay
  19646. @end table
  19647. Default is @code{magnitude}.
  19648. @end table
  19649. @section showspatial
  19650. Convert stereo input audio to a video output, representing the spatial relationship
  19651. between two channels.
  19652. The filter accepts the following options:
  19653. @table @option
  19654. @item size, s
  19655. Specify the video size for the output. For the syntax of this option, check the
  19656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19657. Default value is @code{512x512}.
  19658. @item win_size
  19659. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19660. @item win_func
  19661. Set window function.
  19662. It accepts the following values:
  19663. @table @samp
  19664. @item rect
  19665. @item bartlett
  19666. @item hann
  19667. @item hanning
  19668. @item hamming
  19669. @item blackman
  19670. @item welch
  19671. @item flattop
  19672. @item bharris
  19673. @item bnuttall
  19674. @item bhann
  19675. @item sine
  19676. @item nuttall
  19677. @item lanczos
  19678. @item gauss
  19679. @item tukey
  19680. @item dolph
  19681. @item cauchy
  19682. @item parzen
  19683. @item poisson
  19684. @item bohman
  19685. @end table
  19686. Default value is @code{hann}.
  19687. @item overlap
  19688. Set ratio of overlap window. Default value is @code{0.5}.
  19689. When value is @code{1} overlap is set to recommended size for specific
  19690. window function currently used.
  19691. @end table
  19692. @anchor{showspectrum}
  19693. @section showspectrum
  19694. Convert input audio to a video output, representing the audio frequency
  19695. spectrum.
  19696. The filter accepts the following options:
  19697. @table @option
  19698. @item size, s
  19699. Specify the video size for the output. For the syntax of this option, check the
  19700. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19701. Default value is @code{640x512}.
  19702. @item slide
  19703. Specify how the spectrum should slide along the window.
  19704. It accepts the following values:
  19705. @table @samp
  19706. @item replace
  19707. the samples start again on the left when they reach the right
  19708. @item scroll
  19709. the samples scroll from right to left
  19710. @item fullframe
  19711. frames are only produced when the samples reach the right
  19712. @item rscroll
  19713. the samples scroll from left to right
  19714. @end table
  19715. Default value is @code{replace}.
  19716. @item mode
  19717. Specify display mode.
  19718. It accepts the following values:
  19719. @table @samp
  19720. @item combined
  19721. all channels are displayed in the same row
  19722. @item separate
  19723. all channels are displayed in separate rows
  19724. @end table
  19725. Default value is @samp{combined}.
  19726. @item color
  19727. Specify display color mode.
  19728. It accepts the following values:
  19729. @table @samp
  19730. @item channel
  19731. each channel is displayed in a separate color
  19732. @item intensity
  19733. each channel is displayed using the same color scheme
  19734. @item rainbow
  19735. each channel is displayed using the rainbow color scheme
  19736. @item moreland
  19737. each channel is displayed using the moreland color scheme
  19738. @item nebulae
  19739. each channel is displayed using the nebulae color scheme
  19740. @item fire
  19741. each channel is displayed using the fire color scheme
  19742. @item fiery
  19743. each channel is displayed using the fiery color scheme
  19744. @item fruit
  19745. each channel is displayed using the fruit color scheme
  19746. @item cool
  19747. each channel is displayed using the cool color scheme
  19748. @item magma
  19749. each channel is displayed using the magma color scheme
  19750. @item green
  19751. each channel is displayed using the green color scheme
  19752. @item viridis
  19753. each channel is displayed using the viridis color scheme
  19754. @item plasma
  19755. each channel is displayed using the plasma color scheme
  19756. @item cividis
  19757. each channel is displayed using the cividis color scheme
  19758. @item terrain
  19759. each channel is displayed using the terrain color scheme
  19760. @end table
  19761. Default value is @samp{channel}.
  19762. @item scale
  19763. Specify scale used for calculating intensity color values.
  19764. It accepts the following values:
  19765. @table @samp
  19766. @item lin
  19767. linear
  19768. @item sqrt
  19769. square root, default
  19770. @item cbrt
  19771. cubic root
  19772. @item log
  19773. logarithmic
  19774. @item 4thrt
  19775. 4th root
  19776. @item 5thrt
  19777. 5th root
  19778. @end table
  19779. Default value is @samp{sqrt}.
  19780. @item fscale
  19781. Specify frequency scale.
  19782. It accepts the following values:
  19783. @table @samp
  19784. @item lin
  19785. linear
  19786. @item log
  19787. logarithmic
  19788. @end table
  19789. Default value is @samp{lin}.
  19790. @item saturation
  19791. Set saturation modifier for displayed colors. Negative values provide
  19792. alternative color scheme. @code{0} is no saturation at all.
  19793. Saturation must be in [-10.0, 10.0] range.
  19794. Default value is @code{1}.
  19795. @item win_func
  19796. Set window function.
  19797. It accepts the following values:
  19798. @table @samp
  19799. @item rect
  19800. @item bartlett
  19801. @item hann
  19802. @item hanning
  19803. @item hamming
  19804. @item blackman
  19805. @item welch
  19806. @item flattop
  19807. @item bharris
  19808. @item bnuttall
  19809. @item bhann
  19810. @item sine
  19811. @item nuttall
  19812. @item lanczos
  19813. @item gauss
  19814. @item tukey
  19815. @item dolph
  19816. @item cauchy
  19817. @item parzen
  19818. @item poisson
  19819. @item bohman
  19820. @end table
  19821. Default value is @code{hann}.
  19822. @item orientation
  19823. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19824. @code{horizontal}. Default is @code{vertical}.
  19825. @item overlap
  19826. Set ratio of overlap window. Default value is @code{0}.
  19827. When value is @code{1} overlap is set to recommended size for specific
  19828. window function currently used.
  19829. @item gain
  19830. Set scale gain for calculating intensity color values.
  19831. Default value is @code{1}.
  19832. @item data
  19833. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19834. @item rotation
  19835. Set color rotation, must be in [-1.0, 1.0] range.
  19836. Default value is @code{0}.
  19837. @item start
  19838. Set start frequency from which to display spectrogram. Default is @code{0}.
  19839. @item stop
  19840. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19841. @item fps
  19842. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19843. @item legend
  19844. Draw time and frequency axes and legends. Default is disabled.
  19845. @end table
  19846. The usage is very similar to the showwaves filter; see the examples in that
  19847. section.
  19848. @subsection Examples
  19849. @itemize
  19850. @item
  19851. Large window with logarithmic color scaling:
  19852. @example
  19853. showspectrum=s=1280x480:scale=log
  19854. @end example
  19855. @item
  19856. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19857. @example
  19858. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19859. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19860. @end example
  19861. @end itemize
  19862. @section showspectrumpic
  19863. Convert input audio to a single video frame, representing the audio frequency
  19864. spectrum.
  19865. The filter accepts the following options:
  19866. @table @option
  19867. @item size, s
  19868. Specify the video size for the output. For the syntax of this option, check the
  19869. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19870. Default value is @code{4096x2048}.
  19871. @item mode
  19872. Specify display mode.
  19873. It accepts the following values:
  19874. @table @samp
  19875. @item combined
  19876. all channels are displayed in the same row
  19877. @item separate
  19878. all channels are displayed in separate rows
  19879. @end table
  19880. Default value is @samp{combined}.
  19881. @item color
  19882. Specify display color mode.
  19883. It accepts the following values:
  19884. @table @samp
  19885. @item channel
  19886. each channel is displayed in a separate color
  19887. @item intensity
  19888. each channel is displayed using the same color scheme
  19889. @item rainbow
  19890. each channel is displayed using the rainbow color scheme
  19891. @item moreland
  19892. each channel is displayed using the moreland color scheme
  19893. @item nebulae
  19894. each channel is displayed using the nebulae color scheme
  19895. @item fire
  19896. each channel is displayed using the fire color scheme
  19897. @item fiery
  19898. each channel is displayed using the fiery color scheme
  19899. @item fruit
  19900. each channel is displayed using the fruit color scheme
  19901. @item cool
  19902. each channel is displayed using the cool color scheme
  19903. @item magma
  19904. each channel is displayed using the magma color scheme
  19905. @item green
  19906. each channel is displayed using the green color scheme
  19907. @item viridis
  19908. each channel is displayed using the viridis color scheme
  19909. @item plasma
  19910. each channel is displayed using the plasma color scheme
  19911. @item cividis
  19912. each channel is displayed using the cividis color scheme
  19913. @item terrain
  19914. each channel is displayed using the terrain color scheme
  19915. @end table
  19916. Default value is @samp{intensity}.
  19917. @item scale
  19918. Specify scale used for calculating intensity color values.
  19919. It accepts the following values:
  19920. @table @samp
  19921. @item lin
  19922. linear
  19923. @item sqrt
  19924. square root, default
  19925. @item cbrt
  19926. cubic root
  19927. @item log
  19928. logarithmic
  19929. @item 4thrt
  19930. 4th root
  19931. @item 5thrt
  19932. 5th root
  19933. @end table
  19934. Default value is @samp{log}.
  19935. @item fscale
  19936. Specify frequency scale.
  19937. It accepts the following values:
  19938. @table @samp
  19939. @item lin
  19940. linear
  19941. @item log
  19942. logarithmic
  19943. @end table
  19944. Default value is @samp{lin}.
  19945. @item saturation
  19946. Set saturation modifier for displayed colors. Negative values provide
  19947. alternative color scheme. @code{0} is no saturation at all.
  19948. Saturation must be in [-10.0, 10.0] range.
  19949. Default value is @code{1}.
  19950. @item win_func
  19951. Set window function.
  19952. It accepts the following values:
  19953. @table @samp
  19954. @item rect
  19955. @item bartlett
  19956. @item hann
  19957. @item hanning
  19958. @item hamming
  19959. @item blackman
  19960. @item welch
  19961. @item flattop
  19962. @item bharris
  19963. @item bnuttall
  19964. @item bhann
  19965. @item sine
  19966. @item nuttall
  19967. @item lanczos
  19968. @item gauss
  19969. @item tukey
  19970. @item dolph
  19971. @item cauchy
  19972. @item parzen
  19973. @item poisson
  19974. @item bohman
  19975. @end table
  19976. Default value is @code{hann}.
  19977. @item orientation
  19978. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19979. @code{horizontal}. Default is @code{vertical}.
  19980. @item gain
  19981. Set scale gain for calculating intensity color values.
  19982. Default value is @code{1}.
  19983. @item legend
  19984. Draw time and frequency axes and legends. Default is enabled.
  19985. @item rotation
  19986. Set color rotation, must be in [-1.0, 1.0] range.
  19987. Default value is @code{0}.
  19988. @item start
  19989. Set start frequency from which to display spectrogram. Default is @code{0}.
  19990. @item stop
  19991. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19992. @end table
  19993. @subsection Examples
  19994. @itemize
  19995. @item
  19996. Extract an audio spectrogram of a whole audio track
  19997. in a 1024x1024 picture using @command{ffmpeg}:
  19998. @example
  19999. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  20000. @end example
  20001. @end itemize
  20002. @section showvolume
  20003. Convert input audio volume to a video output.
  20004. The filter accepts the following options:
  20005. @table @option
  20006. @item rate, r
  20007. Set video rate.
  20008. @item b
  20009. Set border width, allowed range is [0, 5]. Default is 1.
  20010. @item w
  20011. Set channel width, allowed range is [80, 8192]. Default is 400.
  20012. @item h
  20013. Set channel height, allowed range is [1, 900]. Default is 20.
  20014. @item f
  20015. Set fade, allowed range is [0, 1]. Default is 0.95.
  20016. @item c
  20017. Set volume color expression.
  20018. The expression can use the following variables:
  20019. @table @option
  20020. @item VOLUME
  20021. Current max volume of channel in dB.
  20022. @item PEAK
  20023. Current peak.
  20024. @item CHANNEL
  20025. Current channel number, starting from 0.
  20026. @end table
  20027. @item t
  20028. If set, displays channel names. Default is enabled.
  20029. @item v
  20030. If set, displays volume values. Default is enabled.
  20031. @item o
  20032. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  20033. default is @code{h}.
  20034. @item s
  20035. Set step size, allowed range is [0, 5]. Default is 0, which means
  20036. step is disabled.
  20037. @item p
  20038. Set background opacity, allowed range is [0, 1]. Default is 0.
  20039. @item m
  20040. Set metering mode, can be peak: @code{p} or rms: @code{r},
  20041. default is @code{p}.
  20042. @item ds
  20043. Set display scale, can be linear: @code{lin} or log: @code{log},
  20044. default is @code{lin}.
  20045. @item dm
  20046. In second.
  20047. If set to > 0., display a line for the max level
  20048. in the previous seconds.
  20049. default is disabled: @code{0.}
  20050. @item dmc
  20051. The color of the max line. Use when @code{dm} option is set to > 0.
  20052. default is: @code{orange}
  20053. @end table
  20054. @section showwaves
  20055. Convert input audio to a video output, representing the samples waves.
  20056. The filter accepts the following options:
  20057. @table @option
  20058. @item size, s
  20059. Specify the video size for the output. For the syntax of this option, check the
  20060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20061. Default value is @code{600x240}.
  20062. @item mode
  20063. Set display mode.
  20064. Available values are:
  20065. @table @samp
  20066. @item point
  20067. Draw a point for each sample.
  20068. @item line
  20069. Draw a vertical line for each sample.
  20070. @item p2p
  20071. Draw a point for each sample and a line between them.
  20072. @item cline
  20073. Draw a centered vertical line for each sample.
  20074. @end table
  20075. Default value is @code{point}.
  20076. @item n
  20077. Set the number of samples which are printed on the same column. A
  20078. larger value will decrease the frame rate. Must be a positive
  20079. integer. This option can be set only if the value for @var{rate}
  20080. is not explicitly specified.
  20081. @item rate, r
  20082. Set the (approximate) output frame rate. This is done by setting the
  20083. option @var{n}. Default value is "25".
  20084. @item split_channels
  20085. Set if channels should be drawn separately or overlap. Default value is 0.
  20086. @item colors
  20087. Set colors separated by '|' which are going to be used for drawing of each channel.
  20088. @item scale
  20089. Set amplitude scale.
  20090. Available values are:
  20091. @table @samp
  20092. @item lin
  20093. Linear.
  20094. @item log
  20095. Logarithmic.
  20096. @item sqrt
  20097. Square root.
  20098. @item cbrt
  20099. Cubic root.
  20100. @end table
  20101. Default is linear.
  20102. @item draw
  20103. Set the draw mode. This is mostly useful to set for high @var{n}.
  20104. Available values are:
  20105. @table @samp
  20106. @item scale
  20107. Scale pixel values for each drawn sample.
  20108. @item full
  20109. Draw every sample directly.
  20110. @end table
  20111. Default value is @code{scale}.
  20112. @end table
  20113. @subsection Examples
  20114. @itemize
  20115. @item
  20116. Output the input file audio and the corresponding video representation
  20117. at the same time:
  20118. @example
  20119. amovie=a.mp3,asplit[out0],showwaves[out1]
  20120. @end example
  20121. @item
  20122. Create a synthetic signal and show it with showwaves, forcing a
  20123. frame rate of 30 frames per second:
  20124. @example
  20125. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  20126. @end example
  20127. @end itemize
  20128. @section showwavespic
  20129. Convert input audio to a single video frame, representing the samples waves.
  20130. The filter accepts the following options:
  20131. @table @option
  20132. @item size, s
  20133. Specify the video size for the output. For the syntax of this option, check the
  20134. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20135. Default value is @code{600x240}.
  20136. @item split_channels
  20137. Set if channels should be drawn separately or overlap. Default value is 0.
  20138. @item colors
  20139. Set colors separated by '|' which are going to be used for drawing of each channel.
  20140. @item scale
  20141. Set amplitude scale.
  20142. Available values are:
  20143. @table @samp
  20144. @item lin
  20145. Linear.
  20146. @item log
  20147. Logarithmic.
  20148. @item sqrt
  20149. Square root.
  20150. @item cbrt
  20151. Cubic root.
  20152. @end table
  20153. Default is linear.
  20154. @item draw
  20155. Set the draw mode.
  20156. Available values are:
  20157. @table @samp
  20158. @item scale
  20159. Scale pixel values for each drawn sample.
  20160. @item full
  20161. Draw every sample directly.
  20162. @end table
  20163. Default value is @code{scale}.
  20164. @item filter
  20165. Set the filter mode.
  20166. Available values are:
  20167. @table @samp
  20168. @item average
  20169. Use average samples values for each drawn sample.
  20170. @item peak
  20171. Use peak samples values for each drawn sample.
  20172. @end table
  20173. Default value is @code{average}.
  20174. @end table
  20175. @subsection Examples
  20176. @itemize
  20177. @item
  20178. Extract a channel split representation of the wave form of a whole audio track
  20179. in a 1024x800 picture using @command{ffmpeg}:
  20180. @example
  20181. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  20182. @end example
  20183. @end itemize
  20184. @section sidedata, asidedata
  20185. Delete frame side data, or select frames based on it.
  20186. This filter accepts the following options:
  20187. @table @option
  20188. @item mode
  20189. Set mode of operation of the filter.
  20190. Can be one of the following:
  20191. @table @samp
  20192. @item select
  20193. Select every frame with side data of @code{type}.
  20194. @item delete
  20195. Delete side data of @code{type}. If @code{type} is not set, delete all side
  20196. data in the frame.
  20197. @end table
  20198. @item type
  20199. Set side data type used with all modes. Must be set for @code{select} mode. For
  20200. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  20201. in @file{libavutil/frame.h}. For example, to choose
  20202. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  20203. @end table
  20204. @section spectrumsynth
  20205. Synthesize audio from 2 input video spectrums, first input stream represents
  20206. magnitude across time and second represents phase across time.
  20207. The filter will transform from frequency domain as displayed in videos back
  20208. to time domain as presented in audio output.
  20209. This filter is primarily created for reversing processed @ref{showspectrum}
  20210. filter outputs, but can synthesize sound from other spectrograms too.
  20211. But in such case results are going to be poor if the phase data is not
  20212. available, because in such cases phase data need to be recreated, usually
  20213. it's just recreated from random noise.
  20214. For best results use gray only output (@code{channel} color mode in
  20215. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  20216. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  20217. @code{data} option. Inputs videos should generally use @code{fullframe}
  20218. slide mode as that saves resources needed for decoding video.
  20219. The filter accepts the following options:
  20220. @table @option
  20221. @item sample_rate
  20222. Specify sample rate of output audio, the sample rate of audio from which
  20223. spectrum was generated may differ.
  20224. @item channels
  20225. Set number of channels represented in input video spectrums.
  20226. @item scale
  20227. Set scale which was used when generating magnitude input spectrum.
  20228. Can be @code{lin} or @code{log}. Default is @code{log}.
  20229. @item slide
  20230. Set slide which was used when generating inputs spectrums.
  20231. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  20232. Default is @code{fullframe}.
  20233. @item win_func
  20234. Set window function used for resynthesis.
  20235. @item overlap
  20236. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20237. which means optimal overlap for selected window function will be picked.
  20238. @item orientation
  20239. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  20240. Default is @code{vertical}.
  20241. @end table
  20242. @subsection Examples
  20243. @itemize
  20244. @item
  20245. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  20246. then resynthesize videos back to audio with spectrumsynth:
  20247. @example
  20248. 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
  20249. 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
  20250. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  20251. @end example
  20252. @end itemize
  20253. @section split, asplit
  20254. Split input into several identical outputs.
  20255. @code{asplit} works with audio input, @code{split} with video.
  20256. The filter accepts a single parameter which specifies the number of outputs. If
  20257. unspecified, it defaults to 2.
  20258. @subsection Examples
  20259. @itemize
  20260. @item
  20261. Create two separate outputs from the same input:
  20262. @example
  20263. [in] split [out0][out1]
  20264. @end example
  20265. @item
  20266. To create 3 or more outputs, you need to specify the number of
  20267. outputs, like in:
  20268. @example
  20269. [in] asplit=3 [out0][out1][out2]
  20270. @end example
  20271. @item
  20272. Create two separate outputs from the same input, one cropped and
  20273. one padded:
  20274. @example
  20275. [in] split [splitout1][splitout2];
  20276. [splitout1] crop=100:100:0:0 [cropout];
  20277. [splitout2] pad=200:200:100:100 [padout];
  20278. @end example
  20279. @item
  20280. Create 5 copies of the input audio with @command{ffmpeg}:
  20281. @example
  20282. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20283. @end example
  20284. @end itemize
  20285. @section zmq, azmq
  20286. Receive commands sent through a libzmq client, and forward them to
  20287. filters in the filtergraph.
  20288. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20289. must be inserted between two video filters, @code{azmq} between two
  20290. audio filters. Both are capable to send messages to any filter type.
  20291. To enable these filters you need to install the libzmq library and
  20292. headers and configure FFmpeg with @code{--enable-libzmq}.
  20293. For more information about libzmq see:
  20294. @url{http://www.zeromq.org/}
  20295. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20296. receives messages sent through a network interface defined by the
  20297. @option{bind_address} (or the abbreviation "@option{b}") option.
  20298. Default value of this option is @file{tcp://localhost:5555}. You may
  20299. want to alter this value to your needs, but do not forget to escape any
  20300. ':' signs (see @ref{filtergraph escaping}).
  20301. The received message must be in the form:
  20302. @example
  20303. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20304. @end example
  20305. @var{TARGET} specifies the target of the command, usually the name of
  20306. the filter class or a specific filter instance name. The default
  20307. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20308. but you can override this by using the @samp{filter_name@@id} syntax
  20309. (see @ref{Filtergraph syntax}).
  20310. @var{COMMAND} specifies the name of the command for the target filter.
  20311. @var{ARG} is optional and specifies the optional argument list for the
  20312. given @var{COMMAND}.
  20313. Upon reception, the message is processed and the corresponding command
  20314. is injected into the filtergraph. Depending on the result, the filter
  20315. will send a reply to the client, adopting the format:
  20316. @example
  20317. @var{ERROR_CODE} @var{ERROR_REASON}
  20318. @var{MESSAGE}
  20319. @end example
  20320. @var{MESSAGE} is optional.
  20321. @subsection Examples
  20322. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20323. be used to send commands processed by these filters.
  20324. Consider the following filtergraph generated by @command{ffplay}.
  20325. In this example the last overlay filter has an instance name. All other
  20326. filters will have default instance names.
  20327. @example
  20328. ffplay -dumpgraph 1 -f lavfi "
  20329. color=s=100x100:c=red [l];
  20330. color=s=100x100:c=blue [r];
  20331. nullsrc=s=200x100, zmq [bg];
  20332. [bg][l] overlay [bg+l];
  20333. [bg+l][r] overlay@@my=x=100 "
  20334. @end example
  20335. To change the color of the left side of the video, the following
  20336. command can be used:
  20337. @example
  20338. echo Parsed_color_0 c yellow | tools/zmqsend
  20339. @end example
  20340. To change the right side:
  20341. @example
  20342. echo Parsed_color_1 c pink | tools/zmqsend
  20343. @end example
  20344. To change the position of the right side:
  20345. @example
  20346. echo overlay@@my x 150 | tools/zmqsend
  20347. @end example
  20348. @c man end MULTIMEDIA FILTERS
  20349. @chapter Multimedia Sources
  20350. @c man begin MULTIMEDIA SOURCES
  20351. Below is a description of the currently available multimedia sources.
  20352. @section amovie
  20353. This is the same as @ref{movie} source, except it selects an audio
  20354. stream by default.
  20355. @anchor{movie}
  20356. @section movie
  20357. Read audio and/or video stream(s) from a movie container.
  20358. It accepts the following parameters:
  20359. @table @option
  20360. @item filename
  20361. The name of the resource to read (not necessarily a file; it can also be a
  20362. device or a stream accessed through some protocol).
  20363. @item format_name, f
  20364. Specifies the format assumed for the movie to read, and can be either
  20365. the name of a container or an input device. If not specified, the
  20366. format is guessed from @var{movie_name} or by probing.
  20367. @item seek_point, sp
  20368. Specifies the seek point in seconds. The frames will be output
  20369. starting from this seek point. The parameter is evaluated with
  20370. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20371. postfix. The default value is "0".
  20372. @item streams, s
  20373. Specifies the streams to read. Several streams can be specified,
  20374. separated by "+". The source will then have as many outputs, in the
  20375. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20376. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20377. respectively the default (best suited) video and audio stream. Default
  20378. is "dv", or "da" if the filter is called as "amovie".
  20379. @item stream_index, si
  20380. Specifies the index of the video stream to read. If the value is -1,
  20381. the most suitable video stream will be automatically selected. The default
  20382. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20383. audio instead of video.
  20384. @item loop
  20385. Specifies how many times to read the stream in sequence.
  20386. If the value is 0, the stream will be looped infinitely.
  20387. Default value is "1".
  20388. Note that when the movie is looped the source timestamps are not
  20389. changed, so it will generate non monotonically increasing timestamps.
  20390. @item discontinuity
  20391. Specifies the time difference between frames above which the point is
  20392. considered a timestamp discontinuity which is removed by adjusting the later
  20393. timestamps.
  20394. @end table
  20395. It allows overlaying a second video on top of the main input of
  20396. a filtergraph, as shown in this graph:
  20397. @example
  20398. input -----------> deltapts0 --> overlay --> output
  20399. ^
  20400. |
  20401. movie --> scale--> deltapts1 -------+
  20402. @end example
  20403. @subsection Examples
  20404. @itemize
  20405. @item
  20406. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20407. on top of the input labelled "in":
  20408. @example
  20409. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20410. [in] setpts=PTS-STARTPTS [main];
  20411. [main][over] overlay=16:16 [out]
  20412. @end example
  20413. @item
  20414. Read from a video4linux2 device, and overlay it on top of the input
  20415. labelled "in":
  20416. @example
  20417. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20418. [in] setpts=PTS-STARTPTS [main];
  20419. [main][over] overlay=16:16 [out]
  20420. @end example
  20421. @item
  20422. Read the first video stream and the audio stream with id 0x81 from
  20423. dvd.vob; the video is connected to the pad named "video" and the audio is
  20424. connected to the pad named "audio":
  20425. @example
  20426. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20427. @end example
  20428. @end itemize
  20429. @subsection Commands
  20430. Both movie and amovie support the following commands:
  20431. @table @option
  20432. @item seek
  20433. Perform seek using "av_seek_frame".
  20434. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20435. @itemize
  20436. @item
  20437. @var{stream_index}: If stream_index is -1, a default
  20438. stream is selected, and @var{timestamp} is automatically converted
  20439. from AV_TIME_BASE units to the stream specific time_base.
  20440. @item
  20441. @var{timestamp}: Timestamp in AVStream.time_base units
  20442. or, if no stream is specified, in AV_TIME_BASE units.
  20443. @item
  20444. @var{flags}: Flags which select direction and seeking mode.
  20445. @end itemize
  20446. @item get_duration
  20447. Get movie duration in AV_TIME_BASE units.
  20448. @end table
  20449. @c man end MULTIMEDIA SOURCES