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.

26788 lines
710KB

  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. @end table
  5489. @subsection Commands
  5490. This filter supports same @ref{commands} as options except option @code{s}.
  5491. The command accepts the same syntax of the corresponding option.
  5492. @section avgblur
  5493. Apply average blur filter.
  5494. The filter accepts the following options:
  5495. @table @option
  5496. @item sizeX
  5497. Set horizontal radius size.
  5498. @item planes
  5499. Set which planes to filter. By default all planes are filtered.
  5500. @item sizeY
  5501. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5502. Default is @code{0}.
  5503. @end table
  5504. @subsection Commands
  5505. This filter supports same commands as options.
  5506. The command accepts the same syntax of the corresponding option.
  5507. If the specified expression is not valid, it is kept at its current
  5508. value.
  5509. @section bbox
  5510. Compute the bounding box for the non-black pixels in the input frame
  5511. luminance plane.
  5512. This filter computes the bounding box containing all the pixels with a
  5513. luminance value greater than the minimum allowed value.
  5514. The parameters describing the bounding box are printed on the filter
  5515. log.
  5516. The filter accepts the following option:
  5517. @table @option
  5518. @item min_val
  5519. Set the minimal luminance value. Default is @code{16}.
  5520. @end table
  5521. @subsection Commands
  5522. This filter supports the all above options as @ref{commands}.
  5523. @section bilateral
  5524. Apply bilateral filter, spatial smoothing while preserving edges.
  5525. The filter accepts the following options:
  5526. @table @option
  5527. @item sigmaS
  5528. Set sigma of gaussian function to calculate spatial weight.
  5529. Allowed range is 0 to 512. Default is 0.1.
  5530. @item sigmaR
  5531. Set sigma of gaussian function to calculate range weight.
  5532. Allowed range is 0 to 1. Default is 0.1.
  5533. @item planes
  5534. Set planes to filter. Default is first only.
  5535. @end table
  5536. @subsection Commands
  5537. This filter supports the all above options as @ref{commands}.
  5538. @section bitplanenoise
  5539. Show and measure bit plane noise.
  5540. The filter accepts the following options:
  5541. @table @option
  5542. @item bitplane
  5543. Set which plane to analyze. Default is @code{1}.
  5544. @item filter
  5545. Filter out noisy pixels from @code{bitplane} set above.
  5546. Default is disabled.
  5547. @end table
  5548. @section blackdetect
  5549. Detect video intervals that are (almost) completely black. Can be
  5550. useful to detect chapter transitions, commercials, or invalid
  5551. recordings.
  5552. The filter outputs its detection analysis to both the log as well as
  5553. frame metadata. If a black segment of at least the specified minimum
  5554. duration is found, a line with the start and end timestamps as well
  5555. as duration is printed to the log with level @code{info}. In addition,
  5556. a log line with level @code{debug} is printed per frame showing the
  5557. black amount detected for that frame.
  5558. The filter also attaches metadata to the first frame of a black
  5559. segment with key @code{lavfi.black_start} and to the first frame
  5560. after the black segment ends with key @code{lavfi.black_end}. The
  5561. value is the frame's timestamp. This metadata is added regardless
  5562. of the minimum duration specified.
  5563. The filter accepts the following options:
  5564. @table @option
  5565. @item black_min_duration, d
  5566. Set the minimum detected black duration expressed in seconds. It must
  5567. be a non-negative floating point number.
  5568. Default value is 2.0.
  5569. @item picture_black_ratio_th, pic_th
  5570. Set the threshold for considering a picture "black".
  5571. Express the minimum value for the ratio:
  5572. @example
  5573. @var{nb_black_pixels} / @var{nb_pixels}
  5574. @end example
  5575. for which a picture is considered black.
  5576. Default value is 0.98.
  5577. @item pixel_black_th, pix_th
  5578. Set the threshold for considering a pixel "black".
  5579. The threshold expresses the maximum pixel luminance value for which a
  5580. pixel is considered "black". The provided value is scaled according to
  5581. the following equation:
  5582. @example
  5583. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5584. @end example
  5585. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5586. the input video format, the range is [0-255] for YUV full-range
  5587. formats and [16-235] for YUV non full-range formats.
  5588. Default value is 0.10.
  5589. @end table
  5590. The following example sets the maximum pixel threshold to the minimum
  5591. value, and detects only black intervals of 2 or more seconds:
  5592. @example
  5593. blackdetect=d=2:pix_th=0.00
  5594. @end example
  5595. @section blackframe
  5596. Detect frames that are (almost) completely black. Can be useful to
  5597. detect chapter transitions or commercials. Output lines consist of
  5598. the frame number of the detected frame, the percentage of blackness,
  5599. the position in the file if known or -1 and the timestamp in seconds.
  5600. In order to display the output lines, you need to set the loglevel at
  5601. least to the AV_LOG_INFO value.
  5602. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5603. The value represents the percentage of pixels in the picture that
  5604. are below the threshold value.
  5605. It accepts the following parameters:
  5606. @table @option
  5607. @item amount
  5608. The percentage of the pixels that have to be below the threshold; it defaults to
  5609. @code{98}.
  5610. @item threshold, thresh
  5611. The threshold below which a pixel value is considered black; it defaults to
  5612. @code{32}.
  5613. @end table
  5614. @anchor{blend}
  5615. @section blend
  5616. Blend two video frames into each other.
  5617. The @code{blend} filter takes two input streams and outputs one
  5618. stream, the first input is the "top" layer and second input is
  5619. "bottom" layer. By default, the output terminates when the longest input terminates.
  5620. The @code{tblend} (time blend) filter takes two consecutive frames
  5621. from one single stream, and outputs the result obtained by blending
  5622. the new frame on top of the old frame.
  5623. A description of the accepted options follows.
  5624. @table @option
  5625. @item c0_mode
  5626. @item c1_mode
  5627. @item c2_mode
  5628. @item c3_mode
  5629. @item all_mode
  5630. Set blend mode for specific pixel component or all pixel components in case
  5631. of @var{all_mode}. Default value is @code{normal}.
  5632. Available values for component modes are:
  5633. @table @samp
  5634. @item addition
  5635. @item grainmerge
  5636. @item and
  5637. @item average
  5638. @item burn
  5639. @item darken
  5640. @item difference
  5641. @item grainextract
  5642. @item divide
  5643. @item dodge
  5644. @item freeze
  5645. @item exclusion
  5646. @item extremity
  5647. @item glow
  5648. @item hardlight
  5649. @item hardmix
  5650. @item heat
  5651. @item lighten
  5652. @item linearlight
  5653. @item multiply
  5654. @item multiply128
  5655. @item negation
  5656. @item normal
  5657. @item or
  5658. @item overlay
  5659. @item phoenix
  5660. @item pinlight
  5661. @item reflect
  5662. @item screen
  5663. @item softlight
  5664. @item subtract
  5665. @item vividlight
  5666. @item xor
  5667. @end table
  5668. @item c0_opacity
  5669. @item c1_opacity
  5670. @item c2_opacity
  5671. @item c3_opacity
  5672. @item all_opacity
  5673. Set blend opacity for specific pixel component or all pixel components in case
  5674. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5675. @item c0_expr
  5676. @item c1_expr
  5677. @item c2_expr
  5678. @item c3_expr
  5679. @item all_expr
  5680. Set blend expression for specific pixel component or all pixel components in case
  5681. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5682. The expressions can use the following variables:
  5683. @table @option
  5684. @item N
  5685. The sequential number of the filtered frame, starting from @code{0}.
  5686. @item X
  5687. @item Y
  5688. the coordinates of the current sample
  5689. @item W
  5690. @item H
  5691. the width and height of currently filtered plane
  5692. @item SW
  5693. @item SH
  5694. Width and height scale for the plane being filtered. It is the
  5695. ratio between the dimensions of the current plane to the luma plane,
  5696. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5697. the luma plane and @code{0.5,0.5} for the chroma planes.
  5698. @item T
  5699. Time of the current frame, expressed in seconds.
  5700. @item TOP, A
  5701. Value of pixel component at current location for first video frame (top layer).
  5702. @item BOTTOM, B
  5703. Value of pixel component at current location for second video frame (bottom layer).
  5704. @end table
  5705. @end table
  5706. The @code{blend} filter also supports the @ref{framesync} options.
  5707. @subsection Examples
  5708. @itemize
  5709. @item
  5710. Apply transition from bottom layer to top layer in first 10 seconds:
  5711. @example
  5712. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5713. @end example
  5714. @item
  5715. Apply linear horizontal transition from top layer to bottom layer:
  5716. @example
  5717. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5718. @end example
  5719. @item
  5720. Apply 1x1 checkerboard effect:
  5721. @example
  5722. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5723. @end example
  5724. @item
  5725. Apply uncover left effect:
  5726. @example
  5727. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5728. @end example
  5729. @item
  5730. Apply uncover down effect:
  5731. @example
  5732. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5733. @end example
  5734. @item
  5735. Apply uncover up-left effect:
  5736. @example
  5737. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5738. @end example
  5739. @item
  5740. Split diagonally video and shows top and bottom layer on each side:
  5741. @example
  5742. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5743. @end example
  5744. @item
  5745. Display differences between the current and the previous frame:
  5746. @example
  5747. tblend=all_mode=grainextract
  5748. @end example
  5749. @end itemize
  5750. @section bm3d
  5751. Denoise frames using Block-Matching 3D algorithm.
  5752. The filter accepts the following options.
  5753. @table @option
  5754. @item sigma
  5755. Set denoising strength. Default value is 1.
  5756. Allowed range is from 0 to 999.9.
  5757. The denoising algorithm is very sensitive to sigma, so adjust it
  5758. according to the source.
  5759. @item block
  5760. Set local patch size. This sets dimensions in 2D.
  5761. @item bstep
  5762. Set sliding step for processing blocks. Default value is 4.
  5763. Allowed range is from 1 to 64.
  5764. Smaller values allows processing more reference blocks and is slower.
  5765. @item group
  5766. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5767. When set to 1, no block matching is done. Larger values allows more blocks
  5768. in single group.
  5769. Allowed range is from 1 to 256.
  5770. @item range
  5771. Set radius for search block matching. Default is 9.
  5772. Allowed range is from 1 to INT32_MAX.
  5773. @item mstep
  5774. Set step between two search locations for block matching. Default is 1.
  5775. Allowed range is from 1 to 64. Smaller is slower.
  5776. @item thmse
  5777. Set threshold of mean square error for block matching. Valid range is 0 to
  5778. INT32_MAX.
  5779. @item hdthr
  5780. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5781. Larger values results in stronger hard-thresholding filtering in frequency
  5782. domain.
  5783. @item estim
  5784. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5785. Default is @code{basic}.
  5786. @item ref
  5787. If enabled, filter will use 2nd stream for block matching.
  5788. Default is disabled for @code{basic} value of @var{estim} option,
  5789. and always enabled if value of @var{estim} is @code{final}.
  5790. @item planes
  5791. Set planes to filter. Default is all available except alpha.
  5792. @end table
  5793. @subsection Examples
  5794. @itemize
  5795. @item
  5796. Basic filtering with bm3d:
  5797. @example
  5798. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5799. @end example
  5800. @item
  5801. Same as above, but filtering only luma:
  5802. @example
  5803. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5804. @end example
  5805. @item
  5806. Same as above, but with both estimation modes:
  5807. @example
  5808. 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
  5809. @end example
  5810. @item
  5811. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5812. @example
  5813. 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
  5814. @end example
  5815. @end itemize
  5816. @section boxblur
  5817. Apply a boxblur algorithm to the input video.
  5818. It accepts the following parameters:
  5819. @table @option
  5820. @item luma_radius, lr
  5821. @item luma_power, lp
  5822. @item chroma_radius, cr
  5823. @item chroma_power, cp
  5824. @item alpha_radius, ar
  5825. @item alpha_power, ap
  5826. @end table
  5827. A description of the accepted options follows.
  5828. @table @option
  5829. @item luma_radius, lr
  5830. @item chroma_radius, cr
  5831. @item alpha_radius, ar
  5832. Set an expression for the box radius in pixels used for blurring the
  5833. corresponding input plane.
  5834. The radius value must be a non-negative number, and must not be
  5835. greater than the value of the expression @code{min(w,h)/2} for the
  5836. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5837. planes.
  5838. Default value for @option{luma_radius} is "2". If not specified,
  5839. @option{chroma_radius} and @option{alpha_radius} default to the
  5840. corresponding value set for @option{luma_radius}.
  5841. The expressions can contain the following constants:
  5842. @table @option
  5843. @item w
  5844. @item h
  5845. The input width and height in pixels.
  5846. @item cw
  5847. @item ch
  5848. The input chroma image width and height in pixels.
  5849. @item hsub
  5850. @item vsub
  5851. The horizontal and vertical chroma subsample values. For example, for the
  5852. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5853. @end table
  5854. @item luma_power, lp
  5855. @item chroma_power, cp
  5856. @item alpha_power, ap
  5857. Specify how many times the boxblur filter is applied to the
  5858. corresponding plane.
  5859. Default value for @option{luma_power} is 2. If not specified,
  5860. @option{chroma_power} and @option{alpha_power} default to the
  5861. corresponding value set for @option{luma_power}.
  5862. A value of 0 will disable the effect.
  5863. @end table
  5864. @subsection Examples
  5865. @itemize
  5866. @item
  5867. Apply a boxblur filter with the luma, chroma, and alpha radii
  5868. set to 2:
  5869. @example
  5870. boxblur=luma_radius=2:luma_power=1
  5871. boxblur=2:1
  5872. @end example
  5873. @item
  5874. Set the luma radius to 2, and alpha and chroma radius to 0:
  5875. @example
  5876. boxblur=2:1:cr=0:ar=0
  5877. @end example
  5878. @item
  5879. Set the luma and chroma radii to a fraction of the video dimension:
  5880. @example
  5881. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5882. @end example
  5883. @end itemize
  5884. @section bwdif
  5885. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5886. Deinterlacing Filter").
  5887. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5888. interpolation algorithms.
  5889. It accepts the following parameters:
  5890. @table @option
  5891. @item mode
  5892. The interlacing mode to adopt. It accepts one of the following values:
  5893. @table @option
  5894. @item 0, send_frame
  5895. Output one frame for each frame.
  5896. @item 1, send_field
  5897. Output one frame for each field.
  5898. @end table
  5899. The default value is @code{send_field}.
  5900. @item parity
  5901. The picture field parity assumed for the input interlaced video. It accepts one
  5902. of the following values:
  5903. @table @option
  5904. @item 0, tff
  5905. Assume the top field is first.
  5906. @item 1, bff
  5907. Assume the bottom field is first.
  5908. @item -1, auto
  5909. Enable automatic detection of field parity.
  5910. @end table
  5911. The default value is @code{auto}.
  5912. If the interlacing is unknown or the decoder does not export this information,
  5913. top field first will be assumed.
  5914. @item deint
  5915. Specify which frames to deinterlace. Accepts one of the following
  5916. values:
  5917. @table @option
  5918. @item 0, all
  5919. Deinterlace all frames.
  5920. @item 1, interlaced
  5921. Only deinterlace frames marked as interlaced.
  5922. @end table
  5923. The default value is @code{all}.
  5924. @end table
  5925. @section cas
  5926. Apply Contrast Adaptive Sharpen filter to video stream.
  5927. The filter accepts the following options:
  5928. @table @option
  5929. @item strength
  5930. Set the sharpening strength. Default value is 0.
  5931. @item planes
  5932. Set planes to filter. Default value is to filter all
  5933. planes except alpha plane.
  5934. @end table
  5935. @subsection Commands
  5936. This filter supports same @ref{commands} as options.
  5937. @section chromahold
  5938. Remove all color information for all colors except for certain one.
  5939. The filter accepts the following options:
  5940. @table @option
  5941. @item color
  5942. The color which will not be replaced with neutral chroma.
  5943. @item similarity
  5944. Similarity percentage with the above color.
  5945. 0.01 matches only the exact key color, while 1.0 matches everything.
  5946. @item blend
  5947. Blend percentage.
  5948. 0.0 makes pixels either fully gray, or not gray at all.
  5949. Higher values result in more preserved color.
  5950. @item yuv
  5951. Signals that the color passed is already in YUV instead of RGB.
  5952. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5953. This can be used to pass exact YUV values as hexadecimal numbers.
  5954. @end table
  5955. @subsection Commands
  5956. This filter supports same @ref{commands} as options.
  5957. The command accepts the same syntax of the corresponding option.
  5958. If the specified expression is not valid, it is kept at its current
  5959. value.
  5960. @section chromakey
  5961. YUV colorspace color/chroma keying.
  5962. The filter accepts the following options:
  5963. @table @option
  5964. @item color
  5965. The color which will be replaced with transparency.
  5966. @item similarity
  5967. Similarity percentage with the key color.
  5968. 0.01 matches only the exact key color, while 1.0 matches everything.
  5969. @item blend
  5970. Blend percentage.
  5971. 0.0 makes pixels either fully transparent, or not transparent at all.
  5972. Higher values result in semi-transparent pixels, with a higher transparency
  5973. the more similar the pixels color is to the key color.
  5974. @item yuv
  5975. Signals that the color passed is already in YUV instead of RGB.
  5976. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5977. This can be used to pass exact YUV values as hexadecimal numbers.
  5978. @end table
  5979. @subsection Commands
  5980. This filter supports same @ref{commands} as options.
  5981. The command accepts the same syntax of the corresponding option.
  5982. If the specified expression is not valid, it is kept at its current
  5983. value.
  5984. @subsection Examples
  5985. @itemize
  5986. @item
  5987. Make every green pixel in the input image transparent:
  5988. @example
  5989. ffmpeg -i input.png -vf chromakey=green out.png
  5990. @end example
  5991. @item
  5992. Overlay a greenscreen-video on top of a static black background.
  5993. @example
  5994. 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
  5995. @end example
  5996. @end itemize
  5997. @section chromanr
  5998. Reduce chrominance noise.
  5999. The filter accepts the following options:
  6000. @table @option
  6001. @item thres
  6002. Set threshold for averaging chrominance values.
  6003. Sum of absolute difference of Y, U and V pixel components of current
  6004. pixel and neighbour pixels lower than this threshold will be used in
  6005. averaging. Luma component is left unchanged and is copied to output.
  6006. Default value is 30. Allowed range is from 1 to 200.
  6007. @item sizew
  6008. Set horizontal radius of rectangle used for averaging.
  6009. Allowed range is from 1 to 100. Default value is 5.
  6010. @item sizeh
  6011. Set vertical radius of rectangle used for averaging.
  6012. Allowed range is from 1 to 100. Default value is 5.
  6013. @item stepw
  6014. Set horizontal step when averaging. Default value is 1.
  6015. Allowed range is from 1 to 50.
  6016. Mostly useful to speed-up filtering.
  6017. @item steph
  6018. Set vertical step when averaging. Default value is 1.
  6019. Allowed range is from 1 to 50.
  6020. Mostly useful to speed-up filtering.
  6021. @item threy
  6022. Set Y threshold for averaging chrominance values.
  6023. Set finer control for max allowed difference between Y components
  6024. of current pixel and neigbour pixels.
  6025. Default value is 200. Allowed range is from 1 to 200.
  6026. @item threu
  6027. Set U threshold for averaging chrominance values.
  6028. Set finer control for max allowed difference between U components
  6029. of current pixel and neigbour pixels.
  6030. Default value is 200. Allowed range is from 1 to 200.
  6031. @item threv
  6032. Set V threshold for averaging chrominance values.
  6033. Set finer control for max allowed difference between V components
  6034. of current pixel and neigbour pixels.
  6035. Default value is 200. Allowed range is from 1 to 200.
  6036. @end table
  6037. @subsection Commands
  6038. This filter supports same @ref{commands} as options.
  6039. The command accepts the same syntax of the corresponding option.
  6040. @section chromashift
  6041. Shift chroma pixels horizontally and/or vertically.
  6042. The filter accepts the following options:
  6043. @table @option
  6044. @item cbh
  6045. Set amount to shift chroma-blue horizontally.
  6046. @item cbv
  6047. Set amount to shift chroma-blue vertically.
  6048. @item crh
  6049. Set amount to shift chroma-red horizontally.
  6050. @item crv
  6051. Set amount to shift chroma-red vertically.
  6052. @item edge
  6053. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6054. @end table
  6055. @subsection Commands
  6056. This filter supports the all above options as @ref{commands}.
  6057. @section ciescope
  6058. Display CIE color diagram with pixels overlaid onto it.
  6059. The filter accepts the following options:
  6060. @table @option
  6061. @item system
  6062. Set color system.
  6063. @table @samp
  6064. @item ntsc, 470m
  6065. @item ebu, 470bg
  6066. @item smpte
  6067. @item 240m
  6068. @item apple
  6069. @item widergb
  6070. @item cie1931
  6071. @item rec709, hdtv
  6072. @item uhdtv, rec2020
  6073. @item dcip3
  6074. @end table
  6075. @item cie
  6076. Set CIE system.
  6077. @table @samp
  6078. @item xyy
  6079. @item ucs
  6080. @item luv
  6081. @end table
  6082. @item gamuts
  6083. Set what gamuts to draw.
  6084. See @code{system} option for available values.
  6085. @item size, s
  6086. Set ciescope size, by default set to 512.
  6087. @item intensity, i
  6088. Set intensity used to map input pixel values to CIE diagram.
  6089. @item contrast
  6090. Set contrast used to draw tongue colors that are out of active color system gamut.
  6091. @item corrgamma
  6092. Correct gamma displayed on scope, by default enabled.
  6093. @item showwhite
  6094. Show white point on CIE diagram, by default disabled.
  6095. @item gamma
  6096. Set input gamma. Used only with XYZ input color space.
  6097. @end table
  6098. @section codecview
  6099. Visualize information exported by some codecs.
  6100. Some codecs can export information through frames using side-data or other
  6101. means. For example, some MPEG based codecs export motion vectors through the
  6102. @var{export_mvs} flag in the codec @option{flags2} option.
  6103. The filter accepts the following option:
  6104. @table @option
  6105. @item mv
  6106. Set motion vectors to visualize.
  6107. Available flags for @var{mv} are:
  6108. @table @samp
  6109. @item pf
  6110. forward predicted MVs of P-frames
  6111. @item bf
  6112. forward predicted MVs of B-frames
  6113. @item bb
  6114. backward predicted MVs of B-frames
  6115. @end table
  6116. @item qp
  6117. Display quantization parameters using the chroma planes.
  6118. @item mv_type, mvt
  6119. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6120. Available flags for @var{mv_type} are:
  6121. @table @samp
  6122. @item fp
  6123. forward predicted MVs
  6124. @item bp
  6125. backward predicted MVs
  6126. @end table
  6127. @item frame_type, ft
  6128. Set frame type to visualize motion vectors of.
  6129. Available flags for @var{frame_type} are:
  6130. @table @samp
  6131. @item if
  6132. intra-coded frames (I-frames)
  6133. @item pf
  6134. predicted frames (P-frames)
  6135. @item bf
  6136. bi-directionally predicted frames (B-frames)
  6137. @end table
  6138. @end table
  6139. @subsection Examples
  6140. @itemize
  6141. @item
  6142. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6143. @example
  6144. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6145. @end example
  6146. @item
  6147. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6148. @example
  6149. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6150. @end example
  6151. @end itemize
  6152. @section colorbalance
  6153. Modify intensity of primary colors (red, green and blue) of input frames.
  6154. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6155. regions for the red-cyan, green-magenta or blue-yellow balance.
  6156. A positive adjustment value shifts the balance towards the primary color, a negative
  6157. value towards the complementary color.
  6158. The filter accepts the following options:
  6159. @table @option
  6160. @item rs
  6161. @item gs
  6162. @item bs
  6163. Adjust red, green and blue shadows (darkest pixels).
  6164. @item rm
  6165. @item gm
  6166. @item bm
  6167. Adjust red, green and blue midtones (medium pixels).
  6168. @item rh
  6169. @item gh
  6170. @item bh
  6171. Adjust red, green and blue highlights (brightest pixels).
  6172. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6173. @item pl
  6174. Preserve lightness when changing color balance. Default is disabled.
  6175. @end table
  6176. @subsection Examples
  6177. @itemize
  6178. @item
  6179. Add red color cast to shadows:
  6180. @example
  6181. colorbalance=rs=.3
  6182. @end example
  6183. @end itemize
  6184. @subsection Commands
  6185. This filter supports the all above options as @ref{commands}.
  6186. @section colorchannelmixer
  6187. Adjust video input frames by re-mixing color channels.
  6188. This filter modifies a color channel by adding the values associated to
  6189. the other channels of the same pixels. For example if the value to
  6190. modify is red, the output value will be:
  6191. @example
  6192. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6193. @end example
  6194. The filter accepts the following options:
  6195. @table @option
  6196. @item rr
  6197. @item rg
  6198. @item rb
  6199. @item ra
  6200. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6201. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6202. @item gr
  6203. @item gg
  6204. @item gb
  6205. @item ga
  6206. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6207. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6208. @item br
  6209. @item bg
  6210. @item bb
  6211. @item ba
  6212. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6213. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6214. @item ar
  6215. @item ag
  6216. @item ab
  6217. @item aa
  6218. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6219. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6220. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6221. @end table
  6222. @subsection Examples
  6223. @itemize
  6224. @item
  6225. Convert source to grayscale:
  6226. @example
  6227. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6228. @end example
  6229. @item
  6230. Simulate sepia tones:
  6231. @example
  6232. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6233. @end example
  6234. @end itemize
  6235. @subsection Commands
  6236. This filter supports the all above options as @ref{commands}.
  6237. @section colorkey
  6238. RGB colorspace color keying.
  6239. The filter accepts the following options:
  6240. @table @option
  6241. @item color
  6242. The color which will be replaced with transparency.
  6243. @item similarity
  6244. Similarity percentage with the key color.
  6245. 0.01 matches only the exact key color, while 1.0 matches everything.
  6246. @item blend
  6247. Blend percentage.
  6248. 0.0 makes pixels either fully transparent, or not transparent at all.
  6249. Higher values result in semi-transparent pixels, with a higher transparency
  6250. the more similar the pixels color is to the key color.
  6251. @end table
  6252. @subsection Examples
  6253. @itemize
  6254. @item
  6255. Make every green pixel in the input image transparent:
  6256. @example
  6257. ffmpeg -i input.png -vf colorkey=green out.png
  6258. @end example
  6259. @item
  6260. Overlay a greenscreen-video on top of a static background image.
  6261. @example
  6262. 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
  6263. @end example
  6264. @end itemize
  6265. @subsection Commands
  6266. This filter supports same @ref{commands} as options.
  6267. The command accepts the same syntax of the corresponding option.
  6268. If the specified expression is not valid, it is kept at its current
  6269. value.
  6270. @section colorhold
  6271. Remove all color information for all RGB colors except for certain one.
  6272. The filter accepts the following options:
  6273. @table @option
  6274. @item color
  6275. The color which will not be replaced with neutral gray.
  6276. @item similarity
  6277. Similarity percentage with the above color.
  6278. 0.01 matches only the exact key color, while 1.0 matches everything.
  6279. @item blend
  6280. Blend percentage. 0.0 makes pixels fully gray.
  6281. Higher values result in more preserved color.
  6282. @end table
  6283. @subsection Commands
  6284. This filter supports same @ref{commands} as options.
  6285. The command accepts the same syntax of the corresponding option.
  6286. If the specified expression is not valid, it is kept at its current
  6287. value.
  6288. @section colorlevels
  6289. Adjust video input frames using levels.
  6290. The filter accepts the following options:
  6291. @table @option
  6292. @item rimin
  6293. @item gimin
  6294. @item bimin
  6295. @item aimin
  6296. Adjust red, green, blue and alpha input black point.
  6297. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6298. @item rimax
  6299. @item gimax
  6300. @item bimax
  6301. @item aimax
  6302. Adjust red, green, blue and alpha input white point.
  6303. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6304. Input levels are used to lighten highlights (bright tones), darken shadows
  6305. (dark tones), change the balance of bright and dark tones.
  6306. @item romin
  6307. @item gomin
  6308. @item bomin
  6309. @item aomin
  6310. Adjust red, green, blue and alpha output black point.
  6311. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6312. @item romax
  6313. @item gomax
  6314. @item bomax
  6315. @item aomax
  6316. Adjust red, green, blue and alpha output white point.
  6317. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6318. Output levels allows manual selection of a constrained output level range.
  6319. @end table
  6320. @subsection Examples
  6321. @itemize
  6322. @item
  6323. Make video output darker:
  6324. @example
  6325. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6326. @end example
  6327. @item
  6328. Increase contrast:
  6329. @example
  6330. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6331. @end example
  6332. @item
  6333. Make video output lighter:
  6334. @example
  6335. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6336. @end example
  6337. @item
  6338. Increase brightness:
  6339. @example
  6340. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6341. @end example
  6342. @end itemize
  6343. @subsection Commands
  6344. This filter supports the all above options as @ref{commands}.
  6345. @section colormatrix
  6346. Convert color matrix.
  6347. The filter accepts the following options:
  6348. @table @option
  6349. @item src
  6350. @item dst
  6351. Specify the source and destination color matrix. Both values must be
  6352. specified.
  6353. The accepted values are:
  6354. @table @samp
  6355. @item bt709
  6356. BT.709
  6357. @item fcc
  6358. FCC
  6359. @item bt601
  6360. BT.601
  6361. @item bt470
  6362. BT.470
  6363. @item bt470bg
  6364. BT.470BG
  6365. @item smpte170m
  6366. SMPTE-170M
  6367. @item smpte240m
  6368. SMPTE-240M
  6369. @item bt2020
  6370. BT.2020
  6371. @end table
  6372. @end table
  6373. For example to convert from BT.601 to SMPTE-240M, use the command:
  6374. @example
  6375. colormatrix=bt601:smpte240m
  6376. @end example
  6377. @section colorspace
  6378. Convert colorspace, transfer characteristics or color primaries.
  6379. Input video needs to have an even size.
  6380. The filter accepts the following options:
  6381. @table @option
  6382. @anchor{all}
  6383. @item all
  6384. Specify all color properties at once.
  6385. The accepted values are:
  6386. @table @samp
  6387. @item bt470m
  6388. BT.470M
  6389. @item bt470bg
  6390. BT.470BG
  6391. @item bt601-6-525
  6392. BT.601-6 525
  6393. @item bt601-6-625
  6394. BT.601-6 625
  6395. @item bt709
  6396. BT.709
  6397. @item smpte170m
  6398. SMPTE-170M
  6399. @item smpte240m
  6400. SMPTE-240M
  6401. @item bt2020
  6402. BT.2020
  6403. @end table
  6404. @anchor{space}
  6405. @item space
  6406. Specify output colorspace.
  6407. The accepted values are:
  6408. @table @samp
  6409. @item bt709
  6410. BT.709
  6411. @item fcc
  6412. FCC
  6413. @item bt470bg
  6414. BT.470BG or BT.601-6 625
  6415. @item smpte170m
  6416. SMPTE-170M or BT.601-6 525
  6417. @item smpte240m
  6418. SMPTE-240M
  6419. @item ycgco
  6420. YCgCo
  6421. @item bt2020ncl
  6422. BT.2020 with non-constant luminance
  6423. @end table
  6424. @anchor{trc}
  6425. @item trc
  6426. Specify output transfer characteristics.
  6427. The accepted values are:
  6428. @table @samp
  6429. @item bt709
  6430. BT.709
  6431. @item bt470m
  6432. BT.470M
  6433. @item bt470bg
  6434. BT.470BG
  6435. @item gamma22
  6436. Constant gamma of 2.2
  6437. @item gamma28
  6438. Constant gamma of 2.8
  6439. @item smpte170m
  6440. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6441. @item smpte240m
  6442. SMPTE-240M
  6443. @item srgb
  6444. SRGB
  6445. @item iec61966-2-1
  6446. iec61966-2-1
  6447. @item iec61966-2-4
  6448. iec61966-2-4
  6449. @item xvycc
  6450. xvycc
  6451. @item bt2020-10
  6452. BT.2020 for 10-bits content
  6453. @item bt2020-12
  6454. BT.2020 for 12-bits content
  6455. @end table
  6456. @anchor{primaries}
  6457. @item primaries
  6458. Specify output color primaries.
  6459. The accepted values are:
  6460. @table @samp
  6461. @item bt709
  6462. BT.709
  6463. @item bt470m
  6464. BT.470M
  6465. @item bt470bg
  6466. BT.470BG or BT.601-6 625
  6467. @item smpte170m
  6468. SMPTE-170M or BT.601-6 525
  6469. @item smpte240m
  6470. SMPTE-240M
  6471. @item film
  6472. film
  6473. @item smpte431
  6474. SMPTE-431
  6475. @item smpte432
  6476. SMPTE-432
  6477. @item bt2020
  6478. BT.2020
  6479. @item jedec-p22
  6480. JEDEC P22 phosphors
  6481. @end table
  6482. @anchor{range}
  6483. @item range
  6484. Specify output color range.
  6485. The accepted values are:
  6486. @table @samp
  6487. @item tv
  6488. TV (restricted) range
  6489. @item mpeg
  6490. MPEG (restricted) range
  6491. @item pc
  6492. PC (full) range
  6493. @item jpeg
  6494. JPEG (full) range
  6495. @end table
  6496. @item format
  6497. Specify output color format.
  6498. The accepted values are:
  6499. @table @samp
  6500. @item yuv420p
  6501. YUV 4:2:0 planar 8-bits
  6502. @item yuv420p10
  6503. YUV 4:2:0 planar 10-bits
  6504. @item yuv420p12
  6505. YUV 4:2:0 planar 12-bits
  6506. @item yuv422p
  6507. YUV 4:2:2 planar 8-bits
  6508. @item yuv422p10
  6509. YUV 4:2:2 planar 10-bits
  6510. @item yuv422p12
  6511. YUV 4:2:2 planar 12-bits
  6512. @item yuv444p
  6513. YUV 4:4:4 planar 8-bits
  6514. @item yuv444p10
  6515. YUV 4:4:4 planar 10-bits
  6516. @item yuv444p12
  6517. YUV 4:4:4 planar 12-bits
  6518. @end table
  6519. @item fast
  6520. Do a fast conversion, which skips gamma/primary correction. This will take
  6521. significantly less CPU, but will be mathematically incorrect. To get output
  6522. compatible with that produced by the colormatrix filter, use fast=1.
  6523. @item dither
  6524. Specify dithering mode.
  6525. The accepted values are:
  6526. @table @samp
  6527. @item none
  6528. No dithering
  6529. @item fsb
  6530. Floyd-Steinberg dithering
  6531. @end table
  6532. @item wpadapt
  6533. Whitepoint adaptation mode.
  6534. The accepted values are:
  6535. @table @samp
  6536. @item bradford
  6537. Bradford whitepoint adaptation
  6538. @item vonkries
  6539. von Kries whitepoint adaptation
  6540. @item identity
  6541. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6542. @end table
  6543. @item iall
  6544. Override all input properties at once. Same accepted values as @ref{all}.
  6545. @item ispace
  6546. Override input colorspace. Same accepted values as @ref{space}.
  6547. @item iprimaries
  6548. Override input color primaries. Same accepted values as @ref{primaries}.
  6549. @item itrc
  6550. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6551. @item irange
  6552. Override input color range. Same accepted values as @ref{range}.
  6553. @end table
  6554. The filter converts the transfer characteristics, color space and color
  6555. primaries to the specified user values. The output value, if not specified,
  6556. is set to a default value based on the "all" property. If that property is
  6557. also not specified, the filter will log an error. The output color range and
  6558. format default to the same value as the input color range and format. The
  6559. input transfer characteristics, color space, color primaries and color range
  6560. should be set on the input data. If any of these are missing, the filter will
  6561. log an error and no conversion will take place.
  6562. For example to convert the input to SMPTE-240M, use the command:
  6563. @example
  6564. colorspace=smpte240m
  6565. @end example
  6566. @section convolution
  6567. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6568. The filter accepts the following options:
  6569. @table @option
  6570. @item 0m
  6571. @item 1m
  6572. @item 2m
  6573. @item 3m
  6574. Set matrix for each plane.
  6575. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6576. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6577. @item 0rdiv
  6578. @item 1rdiv
  6579. @item 2rdiv
  6580. @item 3rdiv
  6581. Set multiplier for calculated value for each plane.
  6582. If unset or 0, it will be sum of all matrix elements.
  6583. @item 0bias
  6584. @item 1bias
  6585. @item 2bias
  6586. @item 3bias
  6587. Set bias for each plane. This value is added to the result of the multiplication.
  6588. Useful for making the overall image brighter or darker. Default is 0.0.
  6589. @item 0mode
  6590. @item 1mode
  6591. @item 2mode
  6592. @item 3mode
  6593. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6594. Default is @var{square}.
  6595. @end table
  6596. @subsection Commands
  6597. This filter supports the all above options as @ref{commands}.
  6598. @subsection Examples
  6599. @itemize
  6600. @item
  6601. Apply sharpen:
  6602. @example
  6603. 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"
  6604. @end example
  6605. @item
  6606. Apply blur:
  6607. @example
  6608. 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"
  6609. @end example
  6610. @item
  6611. Apply edge enhance:
  6612. @example
  6613. 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"
  6614. @end example
  6615. @item
  6616. Apply edge detect:
  6617. @example
  6618. 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"
  6619. @end example
  6620. @item
  6621. Apply laplacian edge detector which includes diagonals:
  6622. @example
  6623. 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"
  6624. @end example
  6625. @item
  6626. Apply emboss:
  6627. @example
  6628. 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"
  6629. @end example
  6630. @end itemize
  6631. @section convolve
  6632. Apply 2D convolution of video stream in frequency domain using second stream
  6633. as impulse.
  6634. The filter accepts the following options:
  6635. @table @option
  6636. @item planes
  6637. Set which planes to process.
  6638. @item impulse
  6639. Set which impulse video frames will be processed, can be @var{first}
  6640. or @var{all}. Default is @var{all}.
  6641. @end table
  6642. The @code{convolve} filter also supports the @ref{framesync} options.
  6643. @section copy
  6644. Copy the input video source unchanged to the output. This is mainly useful for
  6645. testing purposes.
  6646. @anchor{coreimage}
  6647. @section coreimage
  6648. Video filtering on GPU using Apple's CoreImage API on OSX.
  6649. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6650. processed by video hardware. However, software-based OpenGL implementations
  6651. exist which means there is no guarantee for hardware processing. It depends on
  6652. the respective OSX.
  6653. There are many filters and image generators provided by Apple that come with a
  6654. large variety of options. The filter has to be referenced by its name along
  6655. with its options.
  6656. The coreimage filter accepts the following options:
  6657. @table @option
  6658. @item list_filters
  6659. List all available filters and generators along with all their respective
  6660. options as well as possible minimum and maximum values along with the default
  6661. values.
  6662. @example
  6663. list_filters=true
  6664. @end example
  6665. @item filter
  6666. Specify all filters by their respective name and options.
  6667. Use @var{list_filters} to determine all valid filter names and options.
  6668. Numerical options are specified by a float value and are automatically clamped
  6669. to their respective value range. Vector and color options have to be specified
  6670. by a list of space separated float values. Character escaping has to be done.
  6671. A special option name @code{default} is available to use default options for a
  6672. filter.
  6673. It is required to specify either @code{default} or at least one of the filter options.
  6674. All omitted options are used with their default values.
  6675. The syntax of the filter string is as follows:
  6676. @example
  6677. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6678. @end example
  6679. @item output_rect
  6680. Specify a rectangle where the output of the filter chain is copied into the
  6681. input image. It is given by a list of space separated float values:
  6682. @example
  6683. output_rect=x\ y\ width\ height
  6684. @end example
  6685. If not given, the output rectangle equals the dimensions of the input image.
  6686. The output rectangle is automatically cropped at the borders of the input
  6687. image. Negative values are valid for each component.
  6688. @example
  6689. output_rect=25\ 25\ 100\ 100
  6690. @end example
  6691. @end table
  6692. Several filters can be chained for successive processing without GPU-HOST
  6693. transfers allowing for fast processing of complex filter chains.
  6694. Currently, only filters with zero (generators) or exactly one (filters) input
  6695. image and one output image are supported. Also, transition filters are not yet
  6696. usable as intended.
  6697. Some filters generate output images with additional padding depending on the
  6698. respective filter kernel. The padding is automatically removed to ensure the
  6699. filter output has the same size as the input image.
  6700. For image generators, the size of the output image is determined by the
  6701. previous output image of the filter chain or the input image of the whole
  6702. filterchain, respectively. The generators do not use the pixel information of
  6703. this image to generate their output. However, the generated output is
  6704. blended onto this image, resulting in partial or complete coverage of the
  6705. output image.
  6706. The @ref{coreimagesrc} video source can be used for generating input images
  6707. which are directly fed into the filter chain. By using it, providing input
  6708. images by another video source or an input video is not required.
  6709. @subsection Examples
  6710. @itemize
  6711. @item
  6712. List all filters available:
  6713. @example
  6714. coreimage=list_filters=true
  6715. @end example
  6716. @item
  6717. Use the CIBoxBlur filter with default options to blur an image:
  6718. @example
  6719. coreimage=filter=CIBoxBlur@@default
  6720. @end example
  6721. @item
  6722. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6723. its center at 100x100 and a radius of 50 pixels:
  6724. @example
  6725. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6726. @end example
  6727. @item
  6728. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6729. given as complete and escaped command-line for Apple's standard bash shell:
  6730. @example
  6731. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6732. @end example
  6733. @end itemize
  6734. @section cover_rect
  6735. Cover a rectangular object
  6736. It accepts the following options:
  6737. @table @option
  6738. @item cover
  6739. Filepath of the optional cover image, needs to be in yuv420.
  6740. @item mode
  6741. Set covering mode.
  6742. It accepts the following values:
  6743. @table @samp
  6744. @item cover
  6745. cover it by the supplied image
  6746. @item blur
  6747. cover it by interpolating the surrounding pixels
  6748. @end table
  6749. Default value is @var{blur}.
  6750. @end table
  6751. @subsection Examples
  6752. @itemize
  6753. @item
  6754. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6755. @example
  6756. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6757. @end example
  6758. @end itemize
  6759. @section crop
  6760. Crop the input video to given dimensions.
  6761. It accepts the following parameters:
  6762. @table @option
  6763. @item w, out_w
  6764. The width of the output video. It defaults to @code{iw}.
  6765. This expression is evaluated only once during the filter
  6766. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6767. @item h, out_h
  6768. The height of the output video. It defaults to @code{ih}.
  6769. This expression is evaluated only once during the filter
  6770. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6771. @item x
  6772. The horizontal position, in the input video, of the left edge of the output
  6773. video. It defaults to @code{(in_w-out_w)/2}.
  6774. This expression is evaluated per-frame.
  6775. @item y
  6776. The vertical position, in the input video, of the top edge of the output video.
  6777. It defaults to @code{(in_h-out_h)/2}.
  6778. This expression is evaluated per-frame.
  6779. @item keep_aspect
  6780. If set to 1 will force the output display aspect ratio
  6781. to be the same of the input, by changing the output sample aspect
  6782. ratio. It defaults to 0.
  6783. @item exact
  6784. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6785. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6786. It defaults to 0.
  6787. @end table
  6788. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6789. expressions containing the following constants:
  6790. @table @option
  6791. @item x
  6792. @item y
  6793. The computed values for @var{x} and @var{y}. They are evaluated for
  6794. each new frame.
  6795. @item in_w
  6796. @item in_h
  6797. The input width and height.
  6798. @item iw
  6799. @item ih
  6800. These are the same as @var{in_w} and @var{in_h}.
  6801. @item out_w
  6802. @item out_h
  6803. The output (cropped) width and height.
  6804. @item ow
  6805. @item oh
  6806. These are the same as @var{out_w} and @var{out_h}.
  6807. @item a
  6808. same as @var{iw} / @var{ih}
  6809. @item sar
  6810. input sample aspect ratio
  6811. @item dar
  6812. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6813. @item hsub
  6814. @item vsub
  6815. horizontal and vertical chroma subsample values. For example for the
  6816. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6817. @item n
  6818. The number of the input frame, starting from 0.
  6819. @item pos
  6820. the position in the file of the input frame, NAN if unknown
  6821. @item t
  6822. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6823. @end table
  6824. The expression for @var{out_w} may depend on the value of @var{out_h},
  6825. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6826. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6827. evaluated after @var{out_w} and @var{out_h}.
  6828. The @var{x} and @var{y} parameters specify the expressions for the
  6829. position of the top-left corner of the output (non-cropped) area. They
  6830. are evaluated for each frame. If the evaluated value is not valid, it
  6831. is approximated to the nearest valid value.
  6832. The expression for @var{x} may depend on @var{y}, and the expression
  6833. for @var{y} may depend on @var{x}.
  6834. @subsection Examples
  6835. @itemize
  6836. @item
  6837. Crop area with size 100x100 at position (12,34).
  6838. @example
  6839. crop=100:100:12:34
  6840. @end example
  6841. Using named options, the example above becomes:
  6842. @example
  6843. crop=w=100:h=100:x=12:y=34
  6844. @end example
  6845. @item
  6846. Crop the central input area with size 100x100:
  6847. @example
  6848. crop=100:100
  6849. @end example
  6850. @item
  6851. Crop the central input area with size 2/3 of the input video:
  6852. @example
  6853. crop=2/3*in_w:2/3*in_h
  6854. @end example
  6855. @item
  6856. Crop the input video central square:
  6857. @example
  6858. crop=out_w=in_h
  6859. crop=in_h
  6860. @end example
  6861. @item
  6862. Delimit the rectangle with the top-left corner placed at position
  6863. 100:100 and the right-bottom corner corresponding to the right-bottom
  6864. corner of the input image.
  6865. @example
  6866. crop=in_w-100:in_h-100:100:100
  6867. @end example
  6868. @item
  6869. Crop 10 pixels from the left and right borders, and 20 pixels from
  6870. the top and bottom borders
  6871. @example
  6872. crop=in_w-2*10:in_h-2*20
  6873. @end example
  6874. @item
  6875. Keep only the bottom right quarter of the input image:
  6876. @example
  6877. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6878. @end example
  6879. @item
  6880. Crop height for getting Greek harmony:
  6881. @example
  6882. crop=in_w:1/PHI*in_w
  6883. @end example
  6884. @item
  6885. Apply trembling effect:
  6886. @example
  6887. 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)
  6888. @end example
  6889. @item
  6890. Apply erratic camera effect depending on timestamp:
  6891. @example
  6892. 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)"
  6893. @end example
  6894. @item
  6895. Set x depending on the value of y:
  6896. @example
  6897. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6898. @end example
  6899. @end itemize
  6900. @subsection Commands
  6901. This filter supports the following commands:
  6902. @table @option
  6903. @item w, out_w
  6904. @item h, out_h
  6905. @item x
  6906. @item y
  6907. Set width/height of the output video and the horizontal/vertical position
  6908. in the input video.
  6909. The command accepts the same syntax of the corresponding option.
  6910. If the specified expression is not valid, it is kept at its current
  6911. value.
  6912. @end table
  6913. @section cropdetect
  6914. Auto-detect the crop size.
  6915. It calculates the necessary cropping parameters and prints the
  6916. recommended parameters via the logging system. The detected dimensions
  6917. correspond to the non-black area of the input video.
  6918. It accepts the following parameters:
  6919. @table @option
  6920. @item limit
  6921. Set higher black value threshold, which can be optionally specified
  6922. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6923. value greater to the set value is considered non-black. It defaults to 24.
  6924. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6925. on the bitdepth of the pixel format.
  6926. @item round
  6927. The value which the width/height should be divisible by. It defaults to
  6928. 16. The offset is automatically adjusted to center the video. Use 2 to
  6929. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6930. encoding to most video codecs.
  6931. @item skip
  6932. Set the number of initial frames for which evaluation is skipped.
  6933. Default is 2. Range is 0 to INT_MAX.
  6934. @item reset_count, reset
  6935. Set the counter that determines after how many frames cropdetect will
  6936. reset the previously detected largest video area and start over to
  6937. detect the current optimal crop area. Default value is 0.
  6938. This can be useful when channel logos distort the video area. 0
  6939. indicates 'never reset', and returns the largest area encountered during
  6940. playback.
  6941. @end table
  6942. @anchor{cue}
  6943. @section cue
  6944. Delay video filtering until a given wallclock timestamp. The filter first
  6945. passes on @option{preroll} amount of frames, then it buffers at most
  6946. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6947. it forwards the buffered frames and also any subsequent frames coming in its
  6948. input.
  6949. The filter can be used synchronize the output of multiple ffmpeg processes for
  6950. realtime output devices like decklink. By putting the delay in the filtering
  6951. chain and pre-buffering frames the process can pass on data to output almost
  6952. immediately after the target wallclock timestamp is reached.
  6953. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6954. some use cases.
  6955. @table @option
  6956. @item cue
  6957. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6958. @item preroll
  6959. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6960. @item buffer
  6961. The maximum duration of content to buffer before waiting for the cue expressed
  6962. in seconds. Default is 0.
  6963. @end table
  6964. @anchor{curves}
  6965. @section curves
  6966. Apply color adjustments using curves.
  6967. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6968. component (red, green and blue) has its values defined by @var{N} key points
  6969. tied from each other using a smooth curve. The x-axis represents the pixel
  6970. values from the input frame, and the y-axis the new pixel values to be set for
  6971. the output frame.
  6972. By default, a component curve is defined by the two points @var{(0;0)} and
  6973. @var{(1;1)}. This creates a straight line where each original pixel value is
  6974. "adjusted" to its own value, which means no change to the image.
  6975. The filter allows you to redefine these two points and add some more. A new
  6976. curve (using a natural cubic spline interpolation) will be define to pass
  6977. smoothly through all these new coordinates. The new defined points needs to be
  6978. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6979. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6980. the vector spaces, the values will be clipped accordingly.
  6981. The filter accepts the following options:
  6982. @table @option
  6983. @item preset
  6984. Select one of the available color presets. This option can be used in addition
  6985. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6986. options takes priority on the preset values.
  6987. Available presets are:
  6988. @table @samp
  6989. @item none
  6990. @item color_negative
  6991. @item cross_process
  6992. @item darker
  6993. @item increase_contrast
  6994. @item lighter
  6995. @item linear_contrast
  6996. @item medium_contrast
  6997. @item negative
  6998. @item strong_contrast
  6999. @item vintage
  7000. @end table
  7001. Default is @code{none}.
  7002. @item master, m
  7003. Set the master key points. These points will define a second pass mapping. It
  7004. is sometimes called a "luminance" or "value" mapping. It can be used with
  7005. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7006. post-processing LUT.
  7007. @item red, r
  7008. Set the key points for the red component.
  7009. @item green, g
  7010. Set the key points for the green component.
  7011. @item blue, b
  7012. Set the key points for the blue component.
  7013. @item all
  7014. Set the key points for all components (not including master).
  7015. Can be used in addition to the other key points component
  7016. options. In this case, the unset component(s) will fallback on this
  7017. @option{all} setting.
  7018. @item psfile
  7019. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7020. @item plot
  7021. Save Gnuplot script of the curves in specified file.
  7022. @end table
  7023. To avoid some filtergraph syntax conflicts, each key points list need to be
  7024. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7025. @subsection Examples
  7026. @itemize
  7027. @item
  7028. Increase slightly the middle level of blue:
  7029. @example
  7030. curves=blue='0/0 0.5/0.58 1/1'
  7031. @end example
  7032. @item
  7033. Vintage effect:
  7034. @example
  7035. 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'
  7036. @end example
  7037. Here we obtain the following coordinates for each components:
  7038. @table @var
  7039. @item red
  7040. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7041. @item green
  7042. @code{(0;0) (0.50;0.48) (1;1)}
  7043. @item blue
  7044. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7045. @end table
  7046. @item
  7047. The previous example can also be achieved with the associated built-in preset:
  7048. @example
  7049. curves=preset=vintage
  7050. @end example
  7051. @item
  7052. Or simply:
  7053. @example
  7054. curves=vintage
  7055. @end example
  7056. @item
  7057. Use a Photoshop preset and redefine the points of the green component:
  7058. @example
  7059. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7060. @end example
  7061. @item
  7062. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7063. and @command{gnuplot}:
  7064. @example
  7065. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7066. gnuplot -p /tmp/curves.plt
  7067. @end example
  7068. @end itemize
  7069. @section datascope
  7070. Video data analysis filter.
  7071. This filter shows hexadecimal pixel values of part of video.
  7072. The filter accepts the following options:
  7073. @table @option
  7074. @item size, s
  7075. Set output video size.
  7076. @item x
  7077. Set x offset from where to pick pixels.
  7078. @item y
  7079. Set y offset from where to pick pixels.
  7080. @item mode
  7081. Set scope mode, can be one of the following:
  7082. @table @samp
  7083. @item mono
  7084. Draw hexadecimal pixel values with white color on black background.
  7085. @item color
  7086. Draw hexadecimal pixel values with input video pixel color on black
  7087. background.
  7088. @item color2
  7089. Draw hexadecimal pixel values on color background picked from input video,
  7090. the text color is picked in such way so its always visible.
  7091. @end table
  7092. @item axis
  7093. Draw rows and columns numbers on left and top of video.
  7094. @item opacity
  7095. Set background opacity.
  7096. @item format
  7097. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7098. @item components
  7099. Set pixel components to display. By default all pixel components are displayed.
  7100. @end table
  7101. @section dblur
  7102. Apply Directional blur filter.
  7103. The filter accepts the following options:
  7104. @table @option
  7105. @item angle
  7106. Set angle of directional blur. Default is @code{45}.
  7107. @item radius
  7108. Set radius of directional blur. Default is @code{5}.
  7109. @item planes
  7110. Set which planes to filter. By default all planes are filtered.
  7111. @end table
  7112. @subsection Commands
  7113. This filter supports same @ref{commands} as options.
  7114. The command accepts the same syntax of the corresponding option.
  7115. If the specified expression is not valid, it is kept at its current
  7116. value.
  7117. @section dctdnoiz
  7118. Denoise frames using 2D DCT (frequency domain filtering).
  7119. This filter is not designed for real time.
  7120. The filter accepts the following options:
  7121. @table @option
  7122. @item sigma, s
  7123. Set the noise sigma constant.
  7124. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7125. coefficient (absolute value) below this threshold with be dropped.
  7126. If you need a more advanced filtering, see @option{expr}.
  7127. Default is @code{0}.
  7128. @item overlap
  7129. Set number overlapping pixels for each block. Since the filter can be slow, you
  7130. may want to reduce this value, at the cost of a less effective filter and the
  7131. risk of various artefacts.
  7132. If the overlapping value doesn't permit processing the whole input width or
  7133. height, a warning will be displayed and according borders won't be denoised.
  7134. Default value is @var{blocksize}-1, which is the best possible setting.
  7135. @item expr, e
  7136. Set the coefficient factor expression.
  7137. For each coefficient of a DCT block, this expression will be evaluated as a
  7138. multiplier value for the coefficient.
  7139. If this is option is set, the @option{sigma} option will be ignored.
  7140. The absolute value of the coefficient can be accessed through the @var{c}
  7141. variable.
  7142. @item n
  7143. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7144. @var{blocksize}, which is the width and height of the processed blocks.
  7145. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7146. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7147. on the speed processing. Also, a larger block size does not necessarily means a
  7148. better de-noising.
  7149. @end table
  7150. @subsection Examples
  7151. Apply a denoise with a @option{sigma} of @code{4.5}:
  7152. @example
  7153. dctdnoiz=4.5
  7154. @end example
  7155. The same operation can be achieved using the expression system:
  7156. @example
  7157. dctdnoiz=e='gte(c, 4.5*3)'
  7158. @end example
  7159. Violent denoise using a block size of @code{16x16}:
  7160. @example
  7161. dctdnoiz=15:n=4
  7162. @end example
  7163. @section deband
  7164. Remove banding artifacts from input video.
  7165. It works by replacing banded pixels with average value of referenced pixels.
  7166. The filter accepts the following options:
  7167. @table @option
  7168. @item 1thr
  7169. @item 2thr
  7170. @item 3thr
  7171. @item 4thr
  7172. Set banding detection threshold for each plane. Default is 0.02.
  7173. Valid range is 0.00003 to 0.5.
  7174. If difference between current pixel and reference pixel is less than threshold,
  7175. it will be considered as banded.
  7176. @item range, r
  7177. Banding detection range in pixels. Default is 16. If positive, random number
  7178. in range 0 to set value will be used. If negative, exact absolute value
  7179. will be used.
  7180. The range defines square of four pixels around current pixel.
  7181. @item direction, d
  7182. Set direction in radians from which four pixel will be compared. If positive,
  7183. random direction from 0 to set direction will be picked. If negative, exact of
  7184. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7185. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7186. column.
  7187. @item blur, b
  7188. If enabled, current pixel is compared with average value of all four
  7189. surrounding pixels. The default is enabled. If disabled current pixel is
  7190. compared with all four surrounding pixels. The pixel is considered banded
  7191. if only all four differences with surrounding pixels are less than threshold.
  7192. @item coupling, c
  7193. If enabled, current pixel is changed if and only if all pixel components are banded,
  7194. e.g. banding detection threshold is triggered for all color components.
  7195. The default is disabled.
  7196. @end table
  7197. @section deblock
  7198. Remove blocking artifacts from input video.
  7199. The filter accepts the following options:
  7200. @table @option
  7201. @item filter
  7202. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7203. This controls what kind of deblocking is applied.
  7204. @item block
  7205. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7206. @item alpha
  7207. @item beta
  7208. @item gamma
  7209. @item delta
  7210. Set blocking detection thresholds. Allowed range is 0 to 1.
  7211. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7212. Using higher threshold gives more deblocking strength.
  7213. Setting @var{alpha} controls threshold detection at exact edge of block.
  7214. Remaining options controls threshold detection near the edge. Each one for
  7215. below/above or left/right. Setting any of those to @var{0} disables
  7216. deblocking.
  7217. @item planes
  7218. Set planes to filter. Default is to filter all available planes.
  7219. @end table
  7220. @subsection Examples
  7221. @itemize
  7222. @item
  7223. Deblock using weak filter and block size of 4 pixels.
  7224. @example
  7225. deblock=filter=weak:block=4
  7226. @end example
  7227. @item
  7228. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7229. deblocking more edges.
  7230. @example
  7231. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7232. @end example
  7233. @item
  7234. Similar as above, but filter only first plane.
  7235. @example
  7236. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7237. @end example
  7238. @item
  7239. Similar as above, but filter only second and third plane.
  7240. @example
  7241. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7242. @end example
  7243. @end itemize
  7244. @anchor{decimate}
  7245. @section decimate
  7246. Drop duplicated frames at regular intervals.
  7247. The filter accepts the following options:
  7248. @table @option
  7249. @item cycle
  7250. Set the number of frames from which one will be dropped. Setting this to
  7251. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7252. Default is @code{5}.
  7253. @item dupthresh
  7254. Set the threshold for duplicate detection. If the difference metric for a frame
  7255. is less than or equal to this value, then it is declared as duplicate. Default
  7256. is @code{1.1}
  7257. @item scthresh
  7258. Set scene change threshold. Default is @code{15}.
  7259. @item blockx
  7260. @item blocky
  7261. Set the size of the x and y-axis blocks used during metric calculations.
  7262. Larger blocks give better noise suppression, but also give worse detection of
  7263. small movements. Must be a power of two. Default is @code{32}.
  7264. @item ppsrc
  7265. Mark main input as a pre-processed input and activate clean source input
  7266. stream. This allows the input to be pre-processed with various filters to help
  7267. the metrics calculation while keeping the frame selection lossless. When set to
  7268. @code{1}, the first stream is for the pre-processed input, and the second
  7269. stream is the clean source from where the kept frames are chosen. Default is
  7270. @code{0}.
  7271. @item chroma
  7272. Set whether or not chroma is considered in the metric calculations. Default is
  7273. @code{1}.
  7274. @end table
  7275. @section deconvolve
  7276. Apply 2D deconvolution of video stream in frequency domain using second stream
  7277. as impulse.
  7278. The filter accepts the following options:
  7279. @table @option
  7280. @item planes
  7281. Set which planes to process.
  7282. @item impulse
  7283. Set which impulse video frames will be processed, can be @var{first}
  7284. or @var{all}. Default is @var{all}.
  7285. @item noise
  7286. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7287. and height are not same and not power of 2 or if stream prior to convolving
  7288. had noise.
  7289. @end table
  7290. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7291. @section dedot
  7292. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7293. It accepts the following options:
  7294. @table @option
  7295. @item m
  7296. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7297. @var{rainbows} for cross-color reduction.
  7298. @item lt
  7299. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7300. @item tl
  7301. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7302. @item tc
  7303. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7304. @item ct
  7305. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7306. @end table
  7307. @section deflate
  7308. Apply deflate effect to the video.
  7309. This filter replaces the pixel by the local(3x3) average by taking into account
  7310. only values lower than the pixel.
  7311. It accepts the following options:
  7312. @table @option
  7313. @item threshold0
  7314. @item threshold1
  7315. @item threshold2
  7316. @item threshold3
  7317. Limit the maximum change for each plane, default is 65535.
  7318. If 0, plane will remain unchanged.
  7319. @end table
  7320. @subsection Commands
  7321. This filter supports the all above options as @ref{commands}.
  7322. @section deflicker
  7323. Remove temporal frame luminance variations.
  7324. It accepts the following options:
  7325. @table @option
  7326. @item size, s
  7327. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7328. @item mode, m
  7329. Set averaging mode to smooth temporal luminance variations.
  7330. Available values are:
  7331. @table @samp
  7332. @item am
  7333. Arithmetic mean
  7334. @item gm
  7335. Geometric mean
  7336. @item hm
  7337. Harmonic mean
  7338. @item qm
  7339. Quadratic mean
  7340. @item cm
  7341. Cubic mean
  7342. @item pm
  7343. Power mean
  7344. @item median
  7345. Median
  7346. @end table
  7347. @item bypass
  7348. Do not actually modify frame. Useful when one only wants metadata.
  7349. @end table
  7350. @section dejudder
  7351. Remove judder produced by partially interlaced telecined content.
  7352. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7353. source was partially telecined content then the output of @code{pullup,dejudder}
  7354. will have a variable frame rate. May change the recorded frame rate of the
  7355. container. Aside from that change, this filter will not affect constant frame
  7356. rate video.
  7357. The option available in this filter is:
  7358. @table @option
  7359. @item cycle
  7360. Specify the length of the window over which the judder repeats.
  7361. Accepts any integer greater than 1. Useful values are:
  7362. @table @samp
  7363. @item 4
  7364. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7365. @item 5
  7366. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7367. @item 20
  7368. If a mixture of the two.
  7369. @end table
  7370. The default is @samp{4}.
  7371. @end table
  7372. @section delogo
  7373. Suppress a TV station logo by a simple interpolation of the surrounding
  7374. pixels. Just set a rectangle covering the logo and watch it disappear
  7375. (and sometimes something even uglier appear - your mileage may vary).
  7376. It accepts the following parameters:
  7377. @table @option
  7378. @item x
  7379. @item y
  7380. Specify the top left corner coordinates of the logo. They must be
  7381. specified.
  7382. @item w
  7383. @item h
  7384. Specify the width and height of the logo to clear. They must be
  7385. specified.
  7386. @item band, t
  7387. Specify the thickness of the fuzzy edge of the rectangle (added to
  7388. @var{w} and @var{h}). The default value is 1. This option is
  7389. deprecated, setting higher values should no longer be necessary and
  7390. is not recommended.
  7391. @item show
  7392. When set to 1, a green rectangle is drawn on the screen to simplify
  7393. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7394. The default value is 0.
  7395. The rectangle is drawn on the outermost pixels which will be (partly)
  7396. replaced with interpolated values. The values of the next pixels
  7397. immediately outside this rectangle in each direction will be used to
  7398. compute the interpolated pixel values inside the rectangle.
  7399. @end table
  7400. @subsection Examples
  7401. @itemize
  7402. @item
  7403. Set a rectangle covering the area with top left corner coordinates 0,0
  7404. and size 100x77, and a band of size 10:
  7405. @example
  7406. delogo=x=0:y=0:w=100:h=77:band=10
  7407. @end example
  7408. @end itemize
  7409. @anchor{derain}
  7410. @section derain
  7411. Remove the rain in the input image/video by applying the derain methods based on
  7412. convolutional neural networks. Supported models:
  7413. @itemize
  7414. @item
  7415. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7416. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7417. @end itemize
  7418. Training as well as model generation scripts are provided in
  7419. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7420. Native model files (.model) can be generated from TensorFlow model
  7421. files (.pb) by using tools/python/convert.py
  7422. The filter accepts the following options:
  7423. @table @option
  7424. @item filter_type
  7425. Specify which filter to use. This option accepts the following values:
  7426. @table @samp
  7427. @item derain
  7428. Derain filter. To conduct derain filter, you need to use a derain model.
  7429. @item dehaze
  7430. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7431. @end table
  7432. Default value is @samp{derain}.
  7433. @item dnn_backend
  7434. Specify which DNN backend to use for model loading and execution. This option accepts
  7435. the following values:
  7436. @table @samp
  7437. @item native
  7438. Native implementation of DNN loading and execution.
  7439. @item tensorflow
  7440. TensorFlow backend. To enable this backend you
  7441. need to install the TensorFlow for C library (see
  7442. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7443. @code{--enable-libtensorflow}
  7444. @end table
  7445. Default value is @samp{native}.
  7446. @item model
  7447. Set path to model file specifying network architecture and its parameters.
  7448. Note that different backends use different file formats. TensorFlow and native
  7449. backend can load files for only its format.
  7450. @end table
  7451. It can also be finished with @ref{dnn_processing} filter.
  7452. @section deshake
  7453. Attempt to fix small changes in horizontal and/or vertical shift. This
  7454. filter helps remove camera shake from hand-holding a camera, bumping a
  7455. tripod, moving on a vehicle, etc.
  7456. The filter accepts the following options:
  7457. @table @option
  7458. @item x
  7459. @item y
  7460. @item w
  7461. @item h
  7462. Specify a rectangular area where to limit the search for motion
  7463. vectors.
  7464. If desired the search for motion vectors can be limited to a
  7465. rectangular area of the frame defined by its top left corner, width
  7466. and height. These parameters have the same meaning as the drawbox
  7467. filter which can be used to visualise the position of the bounding
  7468. box.
  7469. This is useful when simultaneous movement of subjects within the frame
  7470. might be confused for camera motion by the motion vector search.
  7471. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7472. then the full frame is used. This allows later options to be set
  7473. without specifying the bounding box for the motion vector search.
  7474. Default - search the whole frame.
  7475. @item rx
  7476. @item ry
  7477. Specify the maximum extent of movement in x and y directions in the
  7478. range 0-64 pixels. Default 16.
  7479. @item edge
  7480. Specify how to generate pixels to fill blanks at the edge of the
  7481. frame. Available values are:
  7482. @table @samp
  7483. @item blank, 0
  7484. Fill zeroes at blank locations
  7485. @item original, 1
  7486. Original image at blank locations
  7487. @item clamp, 2
  7488. Extruded edge value at blank locations
  7489. @item mirror, 3
  7490. Mirrored edge at blank locations
  7491. @end table
  7492. Default value is @samp{mirror}.
  7493. @item blocksize
  7494. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7495. default 8.
  7496. @item contrast
  7497. Specify the contrast threshold for blocks. Only blocks with more than
  7498. the specified contrast (difference between darkest and lightest
  7499. pixels) will be considered. Range 1-255, default 125.
  7500. @item search
  7501. Specify the search strategy. Available values are:
  7502. @table @samp
  7503. @item exhaustive, 0
  7504. Set exhaustive search
  7505. @item less, 1
  7506. Set less exhaustive search.
  7507. @end table
  7508. Default value is @samp{exhaustive}.
  7509. @item filename
  7510. If set then a detailed log of the motion search is written to the
  7511. specified file.
  7512. @end table
  7513. @section despill
  7514. Remove unwanted contamination of foreground colors, caused by reflected color of
  7515. greenscreen or bluescreen.
  7516. This filter accepts the following options:
  7517. @table @option
  7518. @item type
  7519. Set what type of despill to use.
  7520. @item mix
  7521. Set how spillmap will be generated.
  7522. @item expand
  7523. Set how much to get rid of still remaining spill.
  7524. @item red
  7525. Controls amount of red in spill area.
  7526. @item green
  7527. Controls amount of green in spill area.
  7528. Should be -1 for greenscreen.
  7529. @item blue
  7530. Controls amount of blue in spill area.
  7531. Should be -1 for bluescreen.
  7532. @item brightness
  7533. Controls brightness of spill area, preserving colors.
  7534. @item alpha
  7535. Modify alpha from generated spillmap.
  7536. @end table
  7537. @subsection Commands
  7538. This filter supports the all above options as @ref{commands}.
  7539. @section detelecine
  7540. Apply an exact inverse of the telecine operation. It requires a predefined
  7541. pattern specified using the pattern option which must be the same as that passed
  7542. to the telecine filter.
  7543. This filter accepts the following options:
  7544. @table @option
  7545. @item first_field
  7546. @table @samp
  7547. @item top, t
  7548. top field first
  7549. @item bottom, b
  7550. bottom field first
  7551. The default value is @code{top}.
  7552. @end table
  7553. @item pattern
  7554. A string of numbers representing the pulldown pattern you wish to apply.
  7555. The default value is @code{23}.
  7556. @item start_frame
  7557. A number representing position of the first frame with respect to the telecine
  7558. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7559. @end table
  7560. @section dilation
  7561. Apply dilation effect to the video.
  7562. This filter replaces the pixel by the local(3x3) maximum.
  7563. It accepts the following options:
  7564. @table @option
  7565. @item threshold0
  7566. @item threshold1
  7567. @item threshold2
  7568. @item threshold3
  7569. Limit the maximum change for each plane, default is 65535.
  7570. If 0, plane will remain unchanged.
  7571. @item coordinates
  7572. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7573. pixels are used.
  7574. Flags to local 3x3 coordinates maps like this:
  7575. 1 2 3
  7576. 4 5
  7577. 6 7 8
  7578. @end table
  7579. @subsection Commands
  7580. This filter supports the all above options as @ref{commands}.
  7581. @section displace
  7582. Displace pixels as indicated by second and third input stream.
  7583. It takes three input streams and outputs one stream, the first input is the
  7584. source, and second and third input are displacement maps.
  7585. The second input specifies how much to displace pixels along the
  7586. x-axis, while the third input specifies how much to displace pixels
  7587. along the y-axis.
  7588. If one of displacement map streams terminates, last frame from that
  7589. displacement map will be used.
  7590. Note that once generated, displacements maps can be reused over and over again.
  7591. A description of the accepted options follows.
  7592. @table @option
  7593. @item edge
  7594. Set displace behavior for pixels that are out of range.
  7595. Available values are:
  7596. @table @samp
  7597. @item blank
  7598. Missing pixels are replaced by black pixels.
  7599. @item smear
  7600. Adjacent pixels will spread out to replace missing pixels.
  7601. @item wrap
  7602. Out of range pixels are wrapped so they point to pixels of other side.
  7603. @item mirror
  7604. Out of range pixels will be replaced with mirrored pixels.
  7605. @end table
  7606. Default is @samp{smear}.
  7607. @end table
  7608. @subsection Examples
  7609. @itemize
  7610. @item
  7611. Add ripple effect to rgb input of video size hd720:
  7612. @example
  7613. 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
  7614. @end example
  7615. @item
  7616. Add wave effect to rgb input of video size hd720:
  7617. @example
  7618. 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
  7619. @end example
  7620. @end itemize
  7621. @anchor{dnn_processing}
  7622. @section dnn_processing
  7623. Do image processing with deep neural networks. It works together with another filter
  7624. which converts the pixel format of the Frame to what the dnn network requires.
  7625. The filter accepts the following options:
  7626. @table @option
  7627. @item dnn_backend
  7628. Specify which DNN backend to use for model loading and execution. This option accepts
  7629. the following values:
  7630. @table @samp
  7631. @item native
  7632. Native implementation of DNN loading and execution.
  7633. @item tensorflow
  7634. TensorFlow backend. To enable this backend you
  7635. need to install the TensorFlow for C library (see
  7636. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7637. @code{--enable-libtensorflow}
  7638. @item openvino
  7639. OpenVINO backend. To enable this backend you
  7640. need to build and install the OpenVINO for C library (see
  7641. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7642. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7643. be needed if the header files and libraries are not installed into system path)
  7644. @end table
  7645. Default value is @samp{native}.
  7646. @item model
  7647. Set path to model file specifying network architecture and its parameters.
  7648. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7649. backend can load files for only its format.
  7650. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7651. @item input
  7652. Set the input name of the dnn network.
  7653. @item output
  7654. Set the output name of the dnn network.
  7655. @item async
  7656. use DNN async execution if set (default: set),
  7657. roll back to sync execution if the backend does not support async.
  7658. @end table
  7659. @subsection Examples
  7660. @itemize
  7661. @item
  7662. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7663. @example
  7664. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7665. @end example
  7666. @item
  7667. Halve the pixel value of the frame with format gray32f:
  7668. @example
  7669. 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
  7670. @end example
  7671. @item
  7672. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7673. @example
  7674. ./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
  7675. @end example
  7676. @item
  7677. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7678. @example
  7679. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7680. @end example
  7681. @end itemize
  7682. @section drawbox
  7683. Draw a colored box on the input image.
  7684. It accepts the following parameters:
  7685. @table @option
  7686. @item x
  7687. @item y
  7688. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7689. @item width, w
  7690. @item height, h
  7691. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7692. the input width and height. It defaults to 0.
  7693. @item color, c
  7694. Specify the color of the box to write. For the general syntax of this option,
  7695. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7696. value @code{invert} is used, the box edge color is the same as the
  7697. video with inverted luma.
  7698. @item thickness, t
  7699. The expression which sets the thickness of the box edge.
  7700. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7701. See below for the list of accepted constants.
  7702. @item replace
  7703. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7704. will overwrite the video's color and alpha pixels.
  7705. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7706. @end table
  7707. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7708. following constants:
  7709. @table @option
  7710. @item dar
  7711. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7712. @item hsub
  7713. @item vsub
  7714. horizontal and vertical chroma subsample values. For example for the
  7715. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7716. @item in_h, ih
  7717. @item in_w, iw
  7718. The input width and height.
  7719. @item sar
  7720. The input sample aspect ratio.
  7721. @item x
  7722. @item y
  7723. The x and y offset coordinates where the box is drawn.
  7724. @item w
  7725. @item h
  7726. The width and height of the drawn box.
  7727. @item t
  7728. The thickness of the drawn box.
  7729. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7730. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7731. @end table
  7732. @subsection Examples
  7733. @itemize
  7734. @item
  7735. Draw a black box around the edge of the input image:
  7736. @example
  7737. drawbox
  7738. @end example
  7739. @item
  7740. Draw a box with color red and an opacity of 50%:
  7741. @example
  7742. drawbox=10:20:200:60:red@@0.5
  7743. @end example
  7744. The previous example can be specified as:
  7745. @example
  7746. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7747. @end example
  7748. @item
  7749. Fill the box with pink color:
  7750. @example
  7751. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7752. @end example
  7753. @item
  7754. Draw a 2-pixel red 2.40:1 mask:
  7755. @example
  7756. 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
  7757. @end example
  7758. @end itemize
  7759. @subsection Commands
  7760. This filter supports same commands as options.
  7761. The command accepts the same syntax of the corresponding option.
  7762. If the specified expression is not valid, it is kept at its current
  7763. value.
  7764. @anchor{drawgraph}
  7765. @section drawgraph
  7766. Draw a graph using input video metadata.
  7767. It accepts the following parameters:
  7768. @table @option
  7769. @item m1
  7770. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7771. @item fg1
  7772. Set 1st foreground color expression.
  7773. @item m2
  7774. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7775. @item fg2
  7776. Set 2nd foreground color expression.
  7777. @item m3
  7778. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7779. @item fg3
  7780. Set 3rd foreground color expression.
  7781. @item m4
  7782. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7783. @item fg4
  7784. Set 4th foreground color expression.
  7785. @item min
  7786. Set minimal value of metadata value.
  7787. @item max
  7788. Set maximal value of metadata value.
  7789. @item bg
  7790. Set graph background color. Default is white.
  7791. @item mode
  7792. Set graph mode.
  7793. Available values for mode is:
  7794. @table @samp
  7795. @item bar
  7796. @item dot
  7797. @item line
  7798. @end table
  7799. Default is @code{line}.
  7800. @item slide
  7801. Set slide mode.
  7802. Available values for slide is:
  7803. @table @samp
  7804. @item frame
  7805. Draw new frame when right border is reached.
  7806. @item replace
  7807. Replace old columns with new ones.
  7808. @item scroll
  7809. Scroll from right to left.
  7810. @item rscroll
  7811. Scroll from left to right.
  7812. @item picture
  7813. Draw single picture.
  7814. @end table
  7815. Default is @code{frame}.
  7816. @item size
  7817. Set size of graph video. For the syntax of this option, check the
  7818. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7819. The default value is @code{900x256}.
  7820. @item rate, r
  7821. Set the output frame rate. Default value is @code{25}.
  7822. The foreground color expressions can use the following variables:
  7823. @table @option
  7824. @item MIN
  7825. Minimal value of metadata value.
  7826. @item MAX
  7827. Maximal value of metadata value.
  7828. @item VAL
  7829. Current metadata key value.
  7830. @end table
  7831. The color is defined as 0xAABBGGRR.
  7832. @end table
  7833. Example using metadata from @ref{signalstats} filter:
  7834. @example
  7835. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7836. @end example
  7837. Example using metadata from @ref{ebur128} filter:
  7838. @example
  7839. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7840. @end example
  7841. @section drawgrid
  7842. Draw a grid on the input image.
  7843. It accepts the following parameters:
  7844. @table @option
  7845. @item x
  7846. @item y
  7847. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7848. @item width, w
  7849. @item height, h
  7850. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7851. input width and height, respectively, minus @code{thickness}, so image gets
  7852. framed. Default to 0.
  7853. @item color, c
  7854. Specify the color of the grid. For the general syntax of this option,
  7855. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7856. value @code{invert} is used, the grid color is the same as the
  7857. video with inverted luma.
  7858. @item thickness, t
  7859. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7860. See below for the list of accepted constants.
  7861. @item replace
  7862. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7863. will overwrite the video's color and alpha pixels.
  7864. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7865. @end table
  7866. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7867. following constants:
  7868. @table @option
  7869. @item dar
  7870. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7871. @item hsub
  7872. @item vsub
  7873. horizontal and vertical chroma subsample values. For example for the
  7874. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7875. @item in_h, ih
  7876. @item in_w, iw
  7877. The input grid cell width and height.
  7878. @item sar
  7879. The input sample aspect ratio.
  7880. @item x
  7881. @item y
  7882. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7883. @item w
  7884. @item h
  7885. The width and height of the drawn cell.
  7886. @item t
  7887. The thickness of the drawn cell.
  7888. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7889. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7890. @end table
  7891. @subsection Examples
  7892. @itemize
  7893. @item
  7894. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7895. @example
  7896. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7897. @end example
  7898. @item
  7899. Draw a white 3x3 grid with an opacity of 50%:
  7900. @example
  7901. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7902. @end example
  7903. @end itemize
  7904. @subsection Commands
  7905. This filter supports same commands as options.
  7906. The command accepts the same syntax of the corresponding option.
  7907. If the specified expression is not valid, it is kept at its current
  7908. value.
  7909. @anchor{drawtext}
  7910. @section drawtext
  7911. Draw a text string or text from a specified file on top of a video, using the
  7912. libfreetype library.
  7913. To enable compilation of this filter, you need to configure FFmpeg with
  7914. @code{--enable-libfreetype}.
  7915. To enable default font fallback and the @var{font} option you need to
  7916. configure FFmpeg with @code{--enable-libfontconfig}.
  7917. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7918. @code{--enable-libfribidi}.
  7919. @subsection Syntax
  7920. It accepts the following parameters:
  7921. @table @option
  7922. @item box
  7923. Used to draw a box around text using the background color.
  7924. The value must be either 1 (enable) or 0 (disable).
  7925. The default value of @var{box} is 0.
  7926. @item boxborderw
  7927. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7928. The default value of @var{boxborderw} is 0.
  7929. @item boxcolor
  7930. The color to be used for drawing box around text. For the syntax of this
  7931. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7932. The default value of @var{boxcolor} is "white".
  7933. @item line_spacing
  7934. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7935. The default value of @var{line_spacing} is 0.
  7936. @item borderw
  7937. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7938. The default value of @var{borderw} is 0.
  7939. @item bordercolor
  7940. Set the color to be used for drawing border around text. For the syntax of this
  7941. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7942. The default value of @var{bordercolor} is "black".
  7943. @item expansion
  7944. Select how the @var{text} is expanded. Can be either @code{none},
  7945. @code{strftime} (deprecated) or
  7946. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7947. below for details.
  7948. @item basetime
  7949. Set a start time for the count. Value is in microseconds. Only applied
  7950. in the deprecated strftime expansion mode. To emulate in normal expansion
  7951. mode use the @code{pts} function, supplying the start time (in seconds)
  7952. as the second argument.
  7953. @item fix_bounds
  7954. If true, check and fix text coords to avoid clipping.
  7955. @item fontcolor
  7956. The color to be used for drawing fonts. For the syntax of this option, check
  7957. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7958. The default value of @var{fontcolor} is "black".
  7959. @item fontcolor_expr
  7960. String which is expanded the same way as @var{text} to obtain dynamic
  7961. @var{fontcolor} value. By default this option has empty value and is not
  7962. processed. When this option is set, it overrides @var{fontcolor} option.
  7963. @item font
  7964. The font family to be used for drawing text. By default Sans.
  7965. @item fontfile
  7966. The font file to be used for drawing text. The path must be included.
  7967. This parameter is mandatory if the fontconfig support is disabled.
  7968. @item alpha
  7969. Draw the text applying alpha blending. The value can
  7970. be a number between 0.0 and 1.0.
  7971. The expression accepts the same variables @var{x, y} as well.
  7972. The default value is 1.
  7973. Please see @var{fontcolor_expr}.
  7974. @item fontsize
  7975. The font size to be used for drawing text.
  7976. The default value of @var{fontsize} is 16.
  7977. @item text_shaping
  7978. If set to 1, attempt to shape the text (for example, reverse the order of
  7979. right-to-left text and join Arabic characters) before drawing it.
  7980. Otherwise, just draw the text exactly as given.
  7981. By default 1 (if supported).
  7982. @item ft_load_flags
  7983. The flags to be used for loading the fonts.
  7984. The flags map the corresponding flags supported by libfreetype, and are
  7985. a combination of the following values:
  7986. @table @var
  7987. @item default
  7988. @item no_scale
  7989. @item no_hinting
  7990. @item render
  7991. @item no_bitmap
  7992. @item vertical_layout
  7993. @item force_autohint
  7994. @item crop_bitmap
  7995. @item pedantic
  7996. @item ignore_global_advance_width
  7997. @item no_recurse
  7998. @item ignore_transform
  7999. @item monochrome
  8000. @item linear_design
  8001. @item no_autohint
  8002. @end table
  8003. Default value is "default".
  8004. For more information consult the documentation for the FT_LOAD_*
  8005. libfreetype flags.
  8006. @item shadowcolor
  8007. The color to be used for drawing a shadow behind the drawn text. For the
  8008. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8009. ffmpeg-utils manual,ffmpeg-utils}.
  8010. The default value of @var{shadowcolor} is "black".
  8011. @item shadowx
  8012. @item shadowy
  8013. The x and y offsets for the text shadow position with respect to the
  8014. position of the text. They can be either positive or negative
  8015. values. The default value for both is "0".
  8016. @item start_number
  8017. The starting frame number for the n/frame_num variable. The default value
  8018. is "0".
  8019. @item tabsize
  8020. The size in number of spaces to use for rendering the tab.
  8021. Default value is 4.
  8022. @item timecode
  8023. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8024. format. It can be used with or without text parameter. @var{timecode_rate}
  8025. option must be specified.
  8026. @item timecode_rate, rate, r
  8027. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8028. integer. Minimum value is "1".
  8029. Drop-frame timecode is supported for frame rates 30 & 60.
  8030. @item tc24hmax
  8031. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8032. Default is 0 (disabled).
  8033. @item text
  8034. The text string to be drawn. The text must be a sequence of UTF-8
  8035. encoded characters.
  8036. This parameter is mandatory if no file is specified with the parameter
  8037. @var{textfile}.
  8038. @item textfile
  8039. A text file containing text to be drawn. The text must be a sequence
  8040. of UTF-8 encoded characters.
  8041. This parameter is mandatory if no text string is specified with the
  8042. parameter @var{text}.
  8043. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8044. @item reload
  8045. If set to 1, the @var{textfile} will be reloaded before each frame.
  8046. Be sure to update it atomically, or it may be read partially, or even fail.
  8047. @item x
  8048. @item y
  8049. The expressions which specify the offsets where text will be drawn
  8050. within the video frame. They are relative to the top/left border of the
  8051. output image.
  8052. The default value of @var{x} and @var{y} is "0".
  8053. See below for the list of accepted constants and functions.
  8054. @end table
  8055. The parameters for @var{x} and @var{y} are expressions containing the
  8056. following constants and functions:
  8057. @table @option
  8058. @item dar
  8059. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8060. @item hsub
  8061. @item vsub
  8062. horizontal and vertical chroma subsample values. For example for the
  8063. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8064. @item line_h, lh
  8065. the height of each text line
  8066. @item main_h, h, H
  8067. the input height
  8068. @item main_w, w, W
  8069. the input width
  8070. @item max_glyph_a, ascent
  8071. the maximum distance from the baseline to the highest/upper grid
  8072. coordinate used to place a glyph outline point, for all the rendered
  8073. glyphs.
  8074. It is a positive value, due to the grid's orientation with the Y axis
  8075. upwards.
  8076. @item max_glyph_d, descent
  8077. the maximum distance from the baseline to the lowest grid coordinate
  8078. used to place a glyph outline point, for all the rendered glyphs.
  8079. This is a negative value, due to the grid's orientation, with the Y axis
  8080. upwards.
  8081. @item max_glyph_h
  8082. maximum glyph height, that is the maximum height for all the glyphs
  8083. contained in the rendered text, it is equivalent to @var{ascent} -
  8084. @var{descent}.
  8085. @item max_glyph_w
  8086. maximum glyph width, that is the maximum width for all the glyphs
  8087. contained in the rendered text
  8088. @item n
  8089. the number of input frame, starting from 0
  8090. @item rand(min, max)
  8091. return a random number included between @var{min} and @var{max}
  8092. @item sar
  8093. The input sample aspect ratio.
  8094. @item t
  8095. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8096. @item text_h, th
  8097. the height of the rendered text
  8098. @item text_w, tw
  8099. the width of the rendered text
  8100. @item x
  8101. @item y
  8102. the x and y offset coordinates where the text is drawn.
  8103. These parameters allow the @var{x} and @var{y} expressions to refer
  8104. to each other, so you can for example specify @code{y=x/dar}.
  8105. @item pict_type
  8106. A one character description of the current frame's picture type.
  8107. @item pkt_pos
  8108. The current packet's position in the input file or stream
  8109. (in bytes, from the start of the input). A value of -1 indicates
  8110. this info is not available.
  8111. @item pkt_duration
  8112. The current packet's duration, in seconds.
  8113. @item pkt_size
  8114. The current packet's size (in bytes).
  8115. @end table
  8116. @anchor{drawtext_expansion}
  8117. @subsection Text expansion
  8118. If @option{expansion} is set to @code{strftime},
  8119. the filter recognizes strftime() sequences in the provided text and
  8120. expands them accordingly. Check the documentation of strftime(). This
  8121. feature is deprecated.
  8122. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8123. If @option{expansion} is set to @code{normal} (which is the default),
  8124. the following expansion mechanism is used.
  8125. The backslash character @samp{\}, followed by any character, always expands to
  8126. the second character.
  8127. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8128. braces is a function name, possibly followed by arguments separated by ':'.
  8129. If the arguments contain special characters or delimiters (':' or '@}'),
  8130. they should be escaped.
  8131. Note that they probably must also be escaped as the value for the
  8132. @option{text} option in the filter argument string and as the filter
  8133. argument in the filtergraph description, and possibly also for the shell,
  8134. that makes up to four levels of escaping; using a text file avoids these
  8135. problems.
  8136. The following functions are available:
  8137. @table @command
  8138. @item expr, e
  8139. The expression evaluation result.
  8140. It must take one argument specifying the expression to be evaluated,
  8141. which accepts the same constants and functions as the @var{x} and
  8142. @var{y} values. Note that not all constants should be used, for
  8143. example the text size is not known when evaluating the expression, so
  8144. the constants @var{text_w} and @var{text_h} will have an undefined
  8145. value.
  8146. @item expr_int_format, eif
  8147. Evaluate the expression's value and output as formatted integer.
  8148. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8149. The second argument specifies the output format. Allowed values are @samp{x},
  8150. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8151. @code{printf} function.
  8152. The third parameter is optional and sets the number of positions taken by the output.
  8153. It can be used to add padding with zeros from the left.
  8154. @item gmtime
  8155. The time at which the filter is running, expressed in UTC.
  8156. It can accept an argument: a strftime() format string.
  8157. @item localtime
  8158. The time at which the filter is running, expressed in the local time zone.
  8159. It can accept an argument: a strftime() format string.
  8160. @item metadata
  8161. Frame metadata. Takes one or two arguments.
  8162. The first argument is mandatory and specifies the metadata key.
  8163. The second argument is optional and specifies a default value, used when the
  8164. metadata key is not found or empty.
  8165. Available metadata can be identified by inspecting entries
  8166. starting with TAG included within each frame section
  8167. printed by running @code{ffprobe -show_frames}.
  8168. String metadata generated in filters leading to
  8169. the drawtext filter are also available.
  8170. @item n, frame_num
  8171. The frame number, starting from 0.
  8172. @item pict_type
  8173. A one character description of the current picture type.
  8174. @item pts
  8175. The timestamp of the current frame.
  8176. It can take up to three arguments.
  8177. The first argument is the format of the timestamp; it defaults to @code{flt}
  8178. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8179. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8180. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8181. @code{localtime} stands for the timestamp of the frame formatted as
  8182. local time zone time.
  8183. The second argument is an offset added to the timestamp.
  8184. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8185. supplied to present the hour part of the formatted timestamp in 24h format
  8186. (00-23).
  8187. If the format is set to @code{localtime} or @code{gmtime},
  8188. a third argument may be supplied: a strftime() format string.
  8189. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8190. @end table
  8191. @subsection Commands
  8192. This filter supports altering parameters via commands:
  8193. @table @option
  8194. @item reinit
  8195. Alter existing filter parameters.
  8196. Syntax for the argument is the same as for filter invocation, e.g.
  8197. @example
  8198. fontsize=56:fontcolor=green:text='Hello World'
  8199. @end example
  8200. Full filter invocation with sendcmd would look like this:
  8201. @example
  8202. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8203. @end example
  8204. @end table
  8205. If the entire argument can't be parsed or applied as valid values then the filter will
  8206. continue with its existing parameters.
  8207. @subsection Examples
  8208. @itemize
  8209. @item
  8210. Draw "Test Text" with font FreeSerif, using the default values for the
  8211. optional parameters.
  8212. @example
  8213. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8214. @end example
  8215. @item
  8216. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8217. and y=50 (counting from the top-left corner of the screen), text is
  8218. yellow with a red box around it. Both the text and the box have an
  8219. opacity of 20%.
  8220. @example
  8221. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8222. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8223. @end example
  8224. Note that the double quotes are not necessary if spaces are not used
  8225. within the parameter list.
  8226. @item
  8227. Show the text at the center of the video frame:
  8228. @example
  8229. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8230. @end example
  8231. @item
  8232. Show the text at a random position, switching to a new position every 30 seconds:
  8233. @example
  8234. 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)"
  8235. @end example
  8236. @item
  8237. Show a text line sliding from right to left in the last row of the video
  8238. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8239. with no newlines.
  8240. @example
  8241. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8242. @end example
  8243. @item
  8244. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8245. @example
  8246. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8247. @end example
  8248. @item
  8249. Draw a single green letter "g", at the center of the input video.
  8250. The glyph baseline is placed at half screen height.
  8251. @example
  8252. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8253. @end example
  8254. @item
  8255. Show text for 1 second every 3 seconds:
  8256. @example
  8257. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8258. @end example
  8259. @item
  8260. Use fontconfig to set the font. Note that the colons need to be escaped.
  8261. @example
  8262. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8263. @end example
  8264. @item
  8265. Draw "Test Text" with font size dependent on height of the video.
  8266. @example
  8267. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8268. @end example
  8269. @item
  8270. Print the date of a real-time encoding (see strftime(3)):
  8271. @example
  8272. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8273. @end example
  8274. @item
  8275. Show text fading in and out (appearing/disappearing):
  8276. @example
  8277. #!/bin/sh
  8278. DS=1.0 # display start
  8279. DE=10.0 # display end
  8280. FID=1.5 # fade in duration
  8281. FOD=5 # fade out duration
  8282. 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 @}"
  8283. @end example
  8284. @item
  8285. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8286. and the @option{fontsize} value are included in the @option{y} offset.
  8287. @example
  8288. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8289. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8290. @end example
  8291. @item
  8292. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8293. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8294. must have option @option{-export_path_metadata 1} for the special metadata fields
  8295. to be available for filters.
  8296. @example
  8297. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8298. @end example
  8299. @end itemize
  8300. For more information about libfreetype, check:
  8301. @url{http://www.freetype.org/}.
  8302. For more information about fontconfig, check:
  8303. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8304. For more information about libfribidi, check:
  8305. @url{http://fribidi.org/}.
  8306. @section edgedetect
  8307. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8308. The filter accepts the following options:
  8309. @table @option
  8310. @item low
  8311. @item high
  8312. Set low and high threshold values used by the Canny thresholding
  8313. algorithm.
  8314. The high threshold selects the "strong" edge pixels, which are then
  8315. connected through 8-connectivity with the "weak" edge pixels selected
  8316. by the low threshold.
  8317. @var{low} and @var{high} threshold values must be chosen in the range
  8318. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8319. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8320. is @code{50/255}.
  8321. @item mode
  8322. Define the drawing mode.
  8323. @table @samp
  8324. @item wires
  8325. Draw white/gray wires on black background.
  8326. @item colormix
  8327. Mix the colors to create a paint/cartoon effect.
  8328. @item canny
  8329. Apply Canny edge detector on all selected planes.
  8330. @end table
  8331. Default value is @var{wires}.
  8332. @item planes
  8333. Select planes for filtering. By default all available planes are filtered.
  8334. @end table
  8335. @subsection Examples
  8336. @itemize
  8337. @item
  8338. Standard edge detection with custom values for the hysteresis thresholding:
  8339. @example
  8340. edgedetect=low=0.1:high=0.4
  8341. @end example
  8342. @item
  8343. Painting effect without thresholding:
  8344. @example
  8345. edgedetect=mode=colormix:high=0
  8346. @end example
  8347. @end itemize
  8348. @section elbg
  8349. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8350. For each input image, the filter will compute the optimal mapping from
  8351. the input to the output given the codebook length, that is the number
  8352. of distinct output colors.
  8353. This filter accepts the following options.
  8354. @table @option
  8355. @item codebook_length, l
  8356. Set codebook length. The value must be a positive integer, and
  8357. represents the number of distinct output colors. Default value is 256.
  8358. @item nb_steps, n
  8359. Set the maximum number of iterations to apply for computing the optimal
  8360. mapping. The higher the value the better the result and the higher the
  8361. computation time. Default value is 1.
  8362. @item seed, s
  8363. Set a random seed, must be an integer included between 0 and
  8364. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8365. will try to use a good random seed on a best effort basis.
  8366. @item pal8
  8367. Set pal8 output pixel format. This option does not work with codebook
  8368. length greater than 256.
  8369. @end table
  8370. @section entropy
  8371. Measure graylevel entropy in histogram of color channels of video frames.
  8372. It accepts the following parameters:
  8373. @table @option
  8374. @item mode
  8375. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8376. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8377. between neighbour histogram values.
  8378. @end table
  8379. @section eq
  8380. Set brightness, contrast, saturation and approximate gamma adjustment.
  8381. The filter accepts the following options:
  8382. @table @option
  8383. @item contrast
  8384. Set the contrast expression. The value must be a float value in range
  8385. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8386. @item brightness
  8387. Set the brightness expression. The value must be a float value in
  8388. range @code{-1.0} to @code{1.0}. The default value is "0".
  8389. @item saturation
  8390. Set the saturation expression. The value must be a float in
  8391. range @code{0.0} to @code{3.0}. The default value is "1".
  8392. @item gamma
  8393. Set the gamma expression. The value must be a float in range
  8394. @code{0.1} to @code{10.0}. The default value is "1".
  8395. @item gamma_r
  8396. Set the gamma expression for red. The value must be a float in
  8397. range @code{0.1} to @code{10.0}. The default value is "1".
  8398. @item gamma_g
  8399. Set the gamma expression for green. The value must be a float in range
  8400. @code{0.1} to @code{10.0}. The default value is "1".
  8401. @item gamma_b
  8402. Set the gamma expression for blue. The value must be a float in range
  8403. @code{0.1} to @code{10.0}. The default value is "1".
  8404. @item gamma_weight
  8405. Set the gamma weight expression. It can be used to reduce the effect
  8406. of a high gamma value on bright image areas, e.g. keep them from
  8407. getting overamplified and just plain white. The value must be a float
  8408. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8409. gamma correction all the way down while @code{1.0} leaves it at its
  8410. full strength. Default is "1".
  8411. @item eval
  8412. Set when the expressions for brightness, contrast, saturation and
  8413. gamma expressions are evaluated.
  8414. It accepts the following values:
  8415. @table @samp
  8416. @item init
  8417. only evaluate expressions once during the filter initialization or
  8418. when a command is processed
  8419. @item frame
  8420. evaluate expressions for each incoming frame
  8421. @end table
  8422. Default value is @samp{init}.
  8423. @end table
  8424. The expressions accept the following parameters:
  8425. @table @option
  8426. @item n
  8427. frame count of the input frame starting from 0
  8428. @item pos
  8429. byte position of the corresponding packet in the input file, NAN if
  8430. unspecified
  8431. @item r
  8432. frame rate of the input video, NAN if the input frame rate is unknown
  8433. @item t
  8434. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8435. @end table
  8436. @subsection Commands
  8437. The filter supports the following commands:
  8438. @table @option
  8439. @item contrast
  8440. Set the contrast expression.
  8441. @item brightness
  8442. Set the brightness expression.
  8443. @item saturation
  8444. Set the saturation expression.
  8445. @item gamma
  8446. Set the gamma expression.
  8447. @item gamma_r
  8448. Set the gamma_r expression.
  8449. @item gamma_g
  8450. Set gamma_g expression.
  8451. @item gamma_b
  8452. Set gamma_b expression.
  8453. @item gamma_weight
  8454. Set gamma_weight expression.
  8455. The command accepts the same syntax of the corresponding option.
  8456. If the specified expression is not valid, it is kept at its current
  8457. value.
  8458. @end table
  8459. @section erosion
  8460. Apply erosion effect to the video.
  8461. This filter replaces the pixel by the local(3x3) minimum.
  8462. It accepts the following options:
  8463. @table @option
  8464. @item threshold0
  8465. @item threshold1
  8466. @item threshold2
  8467. @item threshold3
  8468. Limit the maximum change for each plane, default is 65535.
  8469. If 0, plane will remain unchanged.
  8470. @item coordinates
  8471. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8472. pixels are used.
  8473. Flags to local 3x3 coordinates maps like this:
  8474. 1 2 3
  8475. 4 5
  8476. 6 7 8
  8477. @end table
  8478. @subsection Commands
  8479. This filter supports the all above options as @ref{commands}.
  8480. @section estdif
  8481. Deinterlace the input video ("estdif" stands for "Edge Slope
  8482. Tracing Deinterlacing Filter").
  8483. Spatial only filter that uses edge slope tracing algorithm
  8484. to interpolate missing lines.
  8485. It accepts the following parameters:
  8486. @table @option
  8487. @item mode
  8488. The interlacing mode to adopt. It accepts one of the following values:
  8489. @table @option
  8490. @item frame
  8491. Output one frame for each frame.
  8492. @item field
  8493. Output one frame for each field.
  8494. @end table
  8495. The default value is @code{field}.
  8496. @item parity
  8497. The picture field parity assumed for the input interlaced video. It accepts one
  8498. of the following values:
  8499. @table @option
  8500. @item tff
  8501. Assume the top field is first.
  8502. @item bff
  8503. Assume the bottom field is first.
  8504. @item auto
  8505. Enable automatic detection of field parity.
  8506. @end table
  8507. The default value is @code{auto}.
  8508. If the interlacing is unknown or the decoder does not export this information,
  8509. top field first will be assumed.
  8510. @item deint
  8511. Specify which frames to deinterlace. Accepts one of the following
  8512. values:
  8513. @table @option
  8514. @item all
  8515. Deinterlace all frames.
  8516. @item interlaced
  8517. Only deinterlace frames marked as interlaced.
  8518. @end table
  8519. The default value is @code{all}.
  8520. @item rslope
  8521. Specify the search radius for edge slope tracing. Default value is 1.
  8522. Allowed range is from 1 to 15.
  8523. @item redge
  8524. Specify the search radius for best edge matching. Default value is 2.
  8525. Allowed range is from 0 to 15.
  8526. @end table
  8527. @subsection Commands
  8528. This filter supports same @ref{commands} as options.
  8529. @section extractplanes
  8530. Extract color channel components from input video stream into
  8531. separate grayscale video streams.
  8532. The filter accepts the following option:
  8533. @table @option
  8534. @item planes
  8535. Set plane(s) to extract.
  8536. Available values for planes are:
  8537. @table @samp
  8538. @item y
  8539. @item u
  8540. @item v
  8541. @item a
  8542. @item r
  8543. @item g
  8544. @item b
  8545. @end table
  8546. Choosing planes not available in the input will result in an error.
  8547. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8548. with @code{y}, @code{u}, @code{v} planes at same time.
  8549. @end table
  8550. @subsection Examples
  8551. @itemize
  8552. @item
  8553. Extract luma, u and v color channel component from input video frame
  8554. into 3 grayscale outputs:
  8555. @example
  8556. 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
  8557. @end example
  8558. @end itemize
  8559. @section fade
  8560. Apply a fade-in/out effect to the input video.
  8561. It accepts the following parameters:
  8562. @table @option
  8563. @item type, t
  8564. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8565. effect.
  8566. Default is @code{in}.
  8567. @item start_frame, s
  8568. Specify the number of the frame to start applying the fade
  8569. effect at. Default is 0.
  8570. @item nb_frames, n
  8571. The number of frames that the fade effect lasts. At the end of the
  8572. fade-in effect, the output video will have the same intensity as the input video.
  8573. At the end of the fade-out transition, the output video will be filled with the
  8574. selected @option{color}.
  8575. Default is 25.
  8576. @item alpha
  8577. If set to 1, fade only alpha channel, if one exists on the input.
  8578. Default value is 0.
  8579. @item start_time, st
  8580. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8581. effect. If both start_frame and start_time are specified, the fade will start at
  8582. whichever comes last. Default is 0.
  8583. @item duration, d
  8584. The number of seconds for which the fade effect has to last. At the end of the
  8585. fade-in effect the output video will have the same intensity as the input video,
  8586. at the end of the fade-out transition the output video will be filled with the
  8587. selected @option{color}.
  8588. If both duration and nb_frames are specified, duration is used. Default is 0
  8589. (nb_frames is used by default).
  8590. @item color, c
  8591. Specify the color of the fade. Default is "black".
  8592. @end table
  8593. @subsection Examples
  8594. @itemize
  8595. @item
  8596. Fade in the first 30 frames of video:
  8597. @example
  8598. fade=in:0:30
  8599. @end example
  8600. The command above is equivalent to:
  8601. @example
  8602. fade=t=in:s=0:n=30
  8603. @end example
  8604. @item
  8605. Fade out the last 45 frames of a 200-frame video:
  8606. @example
  8607. fade=out:155:45
  8608. fade=type=out:start_frame=155:nb_frames=45
  8609. @end example
  8610. @item
  8611. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8612. @example
  8613. fade=in:0:25, fade=out:975:25
  8614. @end example
  8615. @item
  8616. Make the first 5 frames yellow, then fade in from frame 5-24:
  8617. @example
  8618. fade=in:5:20:color=yellow
  8619. @end example
  8620. @item
  8621. Fade in alpha over first 25 frames of video:
  8622. @example
  8623. fade=in:0:25:alpha=1
  8624. @end example
  8625. @item
  8626. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8627. @example
  8628. fade=t=in:st=5.5:d=0.5
  8629. @end example
  8630. @end itemize
  8631. @section fftdnoiz
  8632. Denoise frames using 3D FFT (frequency domain filtering).
  8633. The filter accepts the following options:
  8634. @table @option
  8635. @item sigma
  8636. Set the noise sigma constant. This sets denoising strength.
  8637. Default value is 1. Allowed range is from 0 to 30.
  8638. Using very high sigma with low overlap may give blocking artifacts.
  8639. @item amount
  8640. Set amount of denoising. By default all detected noise is reduced.
  8641. Default value is 1. Allowed range is from 0 to 1.
  8642. @item block
  8643. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8644. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8645. block size in pixels is 2^4 which is 16.
  8646. @item overlap
  8647. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8648. @item prev
  8649. Set number of previous frames to use for denoising. By default is set to 0.
  8650. @item next
  8651. Set number of next frames to to use for denoising. By default is set to 0.
  8652. @item planes
  8653. Set planes which will be filtered, by default are all available filtered
  8654. except alpha.
  8655. @end table
  8656. @section fftfilt
  8657. Apply arbitrary expressions to samples in frequency domain
  8658. @table @option
  8659. @item dc_Y
  8660. Adjust the dc value (gain) of the luma plane of the image. The filter
  8661. accepts an integer value in range @code{0} to @code{1000}. The default
  8662. value is set to @code{0}.
  8663. @item dc_U
  8664. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8665. filter accepts an integer value in range @code{0} to @code{1000}. The
  8666. default value is set to @code{0}.
  8667. @item dc_V
  8668. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8669. filter accepts an integer value in range @code{0} to @code{1000}. The
  8670. default value is set to @code{0}.
  8671. @item weight_Y
  8672. Set the frequency domain weight expression for the luma plane.
  8673. @item weight_U
  8674. Set the frequency domain weight expression for the 1st chroma plane.
  8675. @item weight_V
  8676. Set the frequency domain weight expression for the 2nd chroma plane.
  8677. @item eval
  8678. Set when the expressions are evaluated.
  8679. It accepts the following values:
  8680. @table @samp
  8681. @item init
  8682. Only evaluate expressions once during the filter initialization.
  8683. @item frame
  8684. Evaluate expressions for each incoming frame.
  8685. @end table
  8686. Default value is @samp{init}.
  8687. The filter accepts the following variables:
  8688. @item X
  8689. @item Y
  8690. The coordinates of the current sample.
  8691. @item W
  8692. @item H
  8693. The width and height of the image.
  8694. @item N
  8695. The number of input frame, starting from 0.
  8696. @end table
  8697. @subsection Examples
  8698. @itemize
  8699. @item
  8700. High-pass:
  8701. @example
  8702. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8703. @end example
  8704. @item
  8705. Low-pass:
  8706. @example
  8707. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8708. @end example
  8709. @item
  8710. Sharpen:
  8711. @example
  8712. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8713. @end example
  8714. @item
  8715. Blur:
  8716. @example
  8717. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8718. @end example
  8719. @end itemize
  8720. @section field
  8721. Extract a single field from an interlaced image using stride
  8722. arithmetic to avoid wasting CPU time. The output frames are marked as
  8723. non-interlaced.
  8724. The filter accepts the following options:
  8725. @table @option
  8726. @item type
  8727. Specify whether to extract the top (if the value is @code{0} or
  8728. @code{top}) or the bottom field (if the value is @code{1} or
  8729. @code{bottom}).
  8730. @end table
  8731. @section fieldhint
  8732. Create new frames by copying the top and bottom fields from surrounding frames
  8733. supplied as numbers by the hint file.
  8734. @table @option
  8735. @item hint
  8736. Set file containing hints: absolute/relative frame numbers.
  8737. There must be one line for each frame in a clip. Each line must contain two
  8738. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8739. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8740. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8741. for @code{relative} mode. First number tells from which frame to pick up top
  8742. field and second number tells from which frame to pick up bottom field.
  8743. If optionally followed by @code{+} output frame will be marked as interlaced,
  8744. else if followed by @code{-} output frame will be marked as progressive, else
  8745. it will be marked same as input frame.
  8746. If optionally followed by @code{t} output frame will use only top field, or in
  8747. case of @code{b} it will use only bottom field.
  8748. If line starts with @code{#} or @code{;} that line is skipped.
  8749. @item mode
  8750. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8751. @end table
  8752. Example of first several lines of @code{hint} file for @code{relative} mode:
  8753. @example
  8754. 0,0 - # first frame
  8755. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8756. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8757. 1,0 -
  8758. 0,0 -
  8759. 0,0 -
  8760. 1,0 -
  8761. 1,0 -
  8762. 1,0 -
  8763. 0,0 -
  8764. 0,0 -
  8765. 1,0 -
  8766. 1,0 -
  8767. 1,0 -
  8768. 0,0 -
  8769. @end example
  8770. @section fieldmatch
  8771. Field matching filter for inverse telecine. It is meant to reconstruct the
  8772. progressive frames from a telecined stream. The filter does not drop duplicated
  8773. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8774. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8775. The separation of the field matching and the decimation is notably motivated by
  8776. the possibility of inserting a de-interlacing filter fallback between the two.
  8777. If the source has mixed telecined and real interlaced content,
  8778. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8779. But these remaining combed frames will be marked as interlaced, and thus can be
  8780. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8781. In addition to the various configuration options, @code{fieldmatch} can take an
  8782. optional second stream, activated through the @option{ppsrc} option. If
  8783. enabled, the frames reconstruction will be based on the fields and frames from
  8784. this second stream. This allows the first input to be pre-processed in order to
  8785. help the various algorithms of the filter, while keeping the output lossless
  8786. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8787. or brightness/contrast adjustments can help.
  8788. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8789. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8790. which @code{fieldmatch} is based on. While the semantic and usage are very
  8791. close, some behaviour and options names can differ.
  8792. The @ref{decimate} filter currently only works for constant frame rate input.
  8793. If your input has mixed telecined (30fps) and progressive content with a lower
  8794. framerate like 24fps use the following filterchain to produce the necessary cfr
  8795. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8796. The filter accepts the following options:
  8797. @table @option
  8798. @item order
  8799. Specify the assumed field order of the input stream. Available values are:
  8800. @table @samp
  8801. @item auto
  8802. Auto detect parity (use FFmpeg's internal parity value).
  8803. @item bff
  8804. Assume bottom field first.
  8805. @item tff
  8806. Assume top field first.
  8807. @end table
  8808. Note that it is sometimes recommended not to trust the parity announced by the
  8809. stream.
  8810. Default value is @var{auto}.
  8811. @item mode
  8812. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8813. sense that it won't risk creating jerkiness due to duplicate frames when
  8814. possible, but if there are bad edits or blended fields it will end up
  8815. outputting combed frames when a good match might actually exist. On the other
  8816. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8817. but will almost always find a good frame if there is one. The other values are
  8818. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8819. jerkiness and creating duplicate frames versus finding good matches in sections
  8820. with bad edits, orphaned fields, blended fields, etc.
  8821. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8822. Available values are:
  8823. @table @samp
  8824. @item pc
  8825. 2-way matching (p/c)
  8826. @item pc_n
  8827. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8828. @item pc_u
  8829. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8830. @item pc_n_ub
  8831. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8832. still combed (p/c + n + u/b)
  8833. @item pcn
  8834. 3-way matching (p/c/n)
  8835. @item pcn_ub
  8836. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8837. detected as combed (p/c/n + u/b)
  8838. @end table
  8839. The parenthesis at the end indicate the matches that would be used for that
  8840. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8841. @var{top}).
  8842. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8843. the slowest.
  8844. Default value is @var{pc_n}.
  8845. @item ppsrc
  8846. Mark the main input stream as a pre-processed input, and enable the secondary
  8847. input stream as the clean source to pick the fields from. See the filter
  8848. introduction for more details. It is similar to the @option{clip2} feature from
  8849. VFM/TFM.
  8850. Default value is @code{0} (disabled).
  8851. @item field
  8852. Set the field to match from. It is recommended to set this to the same value as
  8853. @option{order} unless you experience matching failures with that setting. In
  8854. certain circumstances changing the field that is used to match from can have a
  8855. large impact on matching performance. Available values are:
  8856. @table @samp
  8857. @item auto
  8858. Automatic (same value as @option{order}).
  8859. @item bottom
  8860. Match from the bottom field.
  8861. @item top
  8862. Match from the top field.
  8863. @end table
  8864. Default value is @var{auto}.
  8865. @item mchroma
  8866. Set whether or not chroma is included during the match comparisons. In most
  8867. cases it is recommended to leave this enabled. You should set this to @code{0}
  8868. only if your clip has bad chroma problems such as heavy rainbowing or other
  8869. artifacts. Setting this to @code{0} could also be used to speed things up at
  8870. the cost of some accuracy.
  8871. Default value is @code{1}.
  8872. @item y0
  8873. @item y1
  8874. These define an exclusion band which excludes the lines between @option{y0} and
  8875. @option{y1} from being included in the field matching decision. An exclusion
  8876. band can be used to ignore subtitles, a logo, or other things that may
  8877. interfere with the matching. @option{y0} sets the starting scan line and
  8878. @option{y1} sets the ending line; all lines in between @option{y0} and
  8879. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8880. @option{y0} and @option{y1} to the same value will disable the feature.
  8881. @option{y0} and @option{y1} defaults to @code{0}.
  8882. @item scthresh
  8883. Set the scene change detection threshold as a percentage of maximum change on
  8884. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8885. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8886. @option{scthresh} is @code{[0.0, 100.0]}.
  8887. Default value is @code{12.0}.
  8888. @item combmatch
  8889. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8890. account the combed scores of matches when deciding what match to use as the
  8891. final match. Available values are:
  8892. @table @samp
  8893. @item none
  8894. No final matching based on combed scores.
  8895. @item sc
  8896. Combed scores are only used when a scene change is detected.
  8897. @item full
  8898. Use combed scores all the time.
  8899. @end table
  8900. Default is @var{sc}.
  8901. @item combdbg
  8902. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8903. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8904. Available values are:
  8905. @table @samp
  8906. @item none
  8907. No forced calculation.
  8908. @item pcn
  8909. Force p/c/n calculations.
  8910. @item pcnub
  8911. Force p/c/n/u/b calculations.
  8912. @end table
  8913. Default value is @var{none}.
  8914. @item cthresh
  8915. This is the area combing threshold used for combed frame detection. This
  8916. essentially controls how "strong" or "visible" combing must be to be detected.
  8917. Larger values mean combing must be more visible and smaller values mean combing
  8918. can be less visible or strong and still be detected. Valid settings are from
  8919. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8920. be detected as combed). This is basically a pixel difference value. A good
  8921. range is @code{[8, 12]}.
  8922. Default value is @code{9}.
  8923. @item chroma
  8924. Sets whether or not chroma is considered in the combed frame decision. Only
  8925. disable this if your source has chroma problems (rainbowing, etc.) that are
  8926. causing problems for the combed frame detection with chroma enabled. Actually,
  8927. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8928. where there is chroma only combing in the source.
  8929. Default value is @code{0}.
  8930. @item blockx
  8931. @item blocky
  8932. Respectively set the x-axis and y-axis size of the window used during combed
  8933. frame detection. This has to do with the size of the area in which
  8934. @option{combpel} pixels are required to be detected as combed for a frame to be
  8935. declared combed. See the @option{combpel} parameter description for more info.
  8936. Possible values are any number that is a power of 2 starting at 4 and going up
  8937. to 512.
  8938. Default value is @code{16}.
  8939. @item combpel
  8940. The number of combed pixels inside any of the @option{blocky} by
  8941. @option{blockx} size blocks on the frame for the frame to be detected as
  8942. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8943. setting controls "how much" combing there must be in any localized area (a
  8944. window defined by the @option{blockx} and @option{blocky} settings) on the
  8945. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8946. which point no frames will ever be detected as combed). This setting is known
  8947. as @option{MI} in TFM/VFM vocabulary.
  8948. Default value is @code{80}.
  8949. @end table
  8950. @anchor{p/c/n/u/b meaning}
  8951. @subsection p/c/n/u/b meaning
  8952. @subsubsection p/c/n
  8953. We assume the following telecined stream:
  8954. @example
  8955. Top fields: 1 2 2 3 4
  8956. Bottom fields: 1 2 3 4 4
  8957. @end example
  8958. The numbers correspond to the progressive frame the fields relate to. Here, the
  8959. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8960. When @code{fieldmatch} is configured to run a matching from bottom
  8961. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8962. @example
  8963. Input stream:
  8964. T 1 2 2 3 4
  8965. B 1 2 3 4 4 <-- matching reference
  8966. Matches: c c n n c
  8967. Output stream:
  8968. T 1 2 3 4 4
  8969. B 1 2 3 4 4
  8970. @end example
  8971. As a result of the field matching, we can see that some frames get duplicated.
  8972. To perform a complete inverse telecine, you need to rely on a decimation filter
  8973. after this operation. See for instance the @ref{decimate} filter.
  8974. The same operation now matching from top fields (@option{field}=@var{top})
  8975. looks like this:
  8976. @example
  8977. Input stream:
  8978. T 1 2 2 3 4 <-- matching reference
  8979. B 1 2 3 4 4
  8980. Matches: c c p p c
  8981. Output stream:
  8982. T 1 2 2 3 4
  8983. B 1 2 2 3 4
  8984. @end example
  8985. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8986. basically, they refer to the frame and field of the opposite parity:
  8987. @itemize
  8988. @item @var{p} matches the field of the opposite parity in the previous frame
  8989. @item @var{c} matches the field of the opposite parity in the current frame
  8990. @item @var{n} matches the field of the opposite parity in the next frame
  8991. @end itemize
  8992. @subsubsection u/b
  8993. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8994. from the opposite parity flag. In the following examples, we assume that we are
  8995. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8996. 'x' is placed above and below each matched fields.
  8997. With bottom matching (@option{field}=@var{bottom}):
  8998. @example
  8999. Match: c p n b u
  9000. x x x x x
  9001. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9002. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9003. x x x x x
  9004. Output frames:
  9005. 2 1 2 2 2
  9006. 2 2 2 1 3
  9007. @end example
  9008. With top matching (@option{field}=@var{top}):
  9009. @example
  9010. Match: c p n b u
  9011. x x x x x
  9012. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9013. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9014. x x x x x
  9015. Output frames:
  9016. 2 2 2 1 2
  9017. 2 1 3 2 2
  9018. @end example
  9019. @subsection Examples
  9020. Simple IVTC of a top field first telecined stream:
  9021. @example
  9022. fieldmatch=order=tff:combmatch=none, decimate
  9023. @end example
  9024. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9025. @example
  9026. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9027. @end example
  9028. @section fieldorder
  9029. Transform the field order of the input video.
  9030. It accepts the following parameters:
  9031. @table @option
  9032. @item order
  9033. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9034. for bottom field first.
  9035. @end table
  9036. The default value is @samp{tff}.
  9037. The transformation is done by shifting the picture content up or down
  9038. by one line, and filling the remaining line with appropriate picture content.
  9039. This method is consistent with most broadcast field order converters.
  9040. If the input video is not flagged as being interlaced, or it is already
  9041. flagged as being of the required output field order, then this filter does
  9042. not alter the incoming video.
  9043. It is very useful when converting to or from PAL DV material,
  9044. which is bottom field first.
  9045. For example:
  9046. @example
  9047. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9048. @end example
  9049. @section fifo, afifo
  9050. Buffer input images and send them when they are requested.
  9051. It is mainly useful when auto-inserted by the libavfilter
  9052. framework.
  9053. It does not take parameters.
  9054. @section fillborders
  9055. Fill borders of the input video, without changing video stream dimensions.
  9056. Sometimes video can have garbage at the four edges and you may not want to
  9057. crop video input to keep size multiple of some number.
  9058. This filter accepts the following options:
  9059. @table @option
  9060. @item left
  9061. Number of pixels to fill from left border.
  9062. @item right
  9063. Number of pixels to fill from right border.
  9064. @item top
  9065. Number of pixels to fill from top border.
  9066. @item bottom
  9067. Number of pixels to fill from bottom border.
  9068. @item mode
  9069. Set fill mode.
  9070. It accepts the following values:
  9071. @table @samp
  9072. @item smear
  9073. fill pixels using outermost pixels
  9074. @item mirror
  9075. fill pixels using mirroring (half sample symmetric)
  9076. @item fixed
  9077. fill pixels with constant value
  9078. @item reflect
  9079. fill pixels using reflecting (whole sample symmetric)
  9080. @item wrap
  9081. fill pixels using wrapping
  9082. @item fade
  9083. fade pixels to constant value
  9084. @end table
  9085. Default is @var{smear}.
  9086. @item color
  9087. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9088. @end table
  9089. @subsection Commands
  9090. This filter supports same @ref{commands} as options.
  9091. The command accepts the same syntax of the corresponding option.
  9092. If the specified expression is not valid, it is kept at its current
  9093. value.
  9094. @section find_rect
  9095. Find a rectangular object
  9096. It accepts the following options:
  9097. @table @option
  9098. @item object
  9099. Filepath of the object image, needs to be in gray8.
  9100. @item threshold
  9101. Detection threshold, default is 0.5.
  9102. @item mipmaps
  9103. Number of mipmaps, default is 3.
  9104. @item xmin, ymin, xmax, ymax
  9105. Specifies the rectangle in which to search.
  9106. @end table
  9107. @subsection Examples
  9108. @itemize
  9109. @item
  9110. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9111. @example
  9112. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9113. @end example
  9114. @end itemize
  9115. @section floodfill
  9116. Flood area with values of same pixel components with another values.
  9117. It accepts the following options:
  9118. @table @option
  9119. @item x
  9120. Set pixel x coordinate.
  9121. @item y
  9122. Set pixel y coordinate.
  9123. @item s0
  9124. Set source #0 component value.
  9125. @item s1
  9126. Set source #1 component value.
  9127. @item s2
  9128. Set source #2 component value.
  9129. @item s3
  9130. Set source #3 component value.
  9131. @item d0
  9132. Set destination #0 component value.
  9133. @item d1
  9134. Set destination #1 component value.
  9135. @item d2
  9136. Set destination #2 component value.
  9137. @item d3
  9138. Set destination #3 component value.
  9139. @end table
  9140. @anchor{format}
  9141. @section format
  9142. Convert the input video to one of the specified pixel formats.
  9143. Libavfilter will try to pick one that is suitable as input to
  9144. the next filter.
  9145. It accepts the following parameters:
  9146. @table @option
  9147. @item pix_fmts
  9148. A '|'-separated list of pixel format names, such as
  9149. "pix_fmts=yuv420p|monow|rgb24".
  9150. @end table
  9151. @subsection Examples
  9152. @itemize
  9153. @item
  9154. Convert the input video to the @var{yuv420p} format
  9155. @example
  9156. format=pix_fmts=yuv420p
  9157. @end example
  9158. Convert the input video to any of the formats in the list
  9159. @example
  9160. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9161. @end example
  9162. @end itemize
  9163. @anchor{fps}
  9164. @section fps
  9165. Convert the video to specified constant frame rate by duplicating or dropping
  9166. frames as necessary.
  9167. It accepts the following parameters:
  9168. @table @option
  9169. @item fps
  9170. The desired output frame rate. The default is @code{25}.
  9171. @item start_time
  9172. Assume the first PTS should be the given value, in seconds. This allows for
  9173. padding/trimming at the start of stream. By default, no assumption is made
  9174. about the first frame's expected PTS, so no padding or trimming is done.
  9175. For example, this could be set to 0 to pad the beginning with duplicates of
  9176. the first frame if a video stream starts after the audio stream or to trim any
  9177. frames with a negative PTS.
  9178. @item round
  9179. Timestamp (PTS) rounding method.
  9180. Possible values are:
  9181. @table @option
  9182. @item zero
  9183. round towards 0
  9184. @item inf
  9185. round away from 0
  9186. @item down
  9187. round towards -infinity
  9188. @item up
  9189. round towards +infinity
  9190. @item near
  9191. round to nearest
  9192. @end table
  9193. The default is @code{near}.
  9194. @item eof_action
  9195. Action performed when reading the last frame.
  9196. Possible values are:
  9197. @table @option
  9198. @item round
  9199. Use same timestamp rounding method as used for other frames.
  9200. @item pass
  9201. Pass through last frame if input duration has not been reached yet.
  9202. @end table
  9203. The default is @code{round}.
  9204. @end table
  9205. Alternatively, the options can be specified as a flat string:
  9206. @var{fps}[:@var{start_time}[:@var{round}]].
  9207. See also the @ref{setpts} filter.
  9208. @subsection Examples
  9209. @itemize
  9210. @item
  9211. A typical usage in order to set the fps to 25:
  9212. @example
  9213. fps=fps=25
  9214. @end example
  9215. @item
  9216. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9217. @example
  9218. fps=fps=film:round=near
  9219. @end example
  9220. @end itemize
  9221. @section framepack
  9222. Pack two different video streams into a stereoscopic video, setting proper
  9223. metadata on supported codecs. The two views should have the same size and
  9224. framerate and processing will stop when the shorter video ends. Please note
  9225. that you may conveniently adjust view properties with the @ref{scale} and
  9226. @ref{fps} filters.
  9227. It accepts the following parameters:
  9228. @table @option
  9229. @item format
  9230. The desired packing format. Supported values are:
  9231. @table @option
  9232. @item sbs
  9233. The views are next to each other (default).
  9234. @item tab
  9235. The views are on top of each other.
  9236. @item lines
  9237. The views are packed by line.
  9238. @item columns
  9239. The views are packed by column.
  9240. @item frameseq
  9241. The views are temporally interleaved.
  9242. @end table
  9243. @end table
  9244. Some examples:
  9245. @example
  9246. # Convert left and right views into a frame-sequential video
  9247. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9248. # Convert views into a side-by-side video with the same output resolution as the input
  9249. 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
  9250. @end example
  9251. @section framerate
  9252. Change the frame rate by interpolating new video output frames from the source
  9253. frames.
  9254. This filter is not designed to function correctly with interlaced media. If
  9255. you wish to change the frame rate of interlaced media then you are required
  9256. to deinterlace before this filter and re-interlace after this filter.
  9257. A description of the accepted options follows.
  9258. @table @option
  9259. @item fps
  9260. Specify the output frames per second. This option can also be specified
  9261. as a value alone. The default is @code{50}.
  9262. @item interp_start
  9263. Specify the start of a range where the output frame will be created as a
  9264. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9265. the default is @code{15}.
  9266. @item interp_end
  9267. Specify the end of a range where the output frame will be created as a
  9268. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9269. the default is @code{240}.
  9270. @item scene
  9271. Specify the level at which a scene change is detected as a value between
  9272. 0 and 100 to indicate a new scene; a low value reflects a low
  9273. probability for the current frame to introduce a new scene, while a higher
  9274. value means the current frame is more likely to be one.
  9275. The default is @code{8.2}.
  9276. @item flags
  9277. Specify flags influencing the filter process.
  9278. Available value for @var{flags} is:
  9279. @table @option
  9280. @item scene_change_detect, scd
  9281. Enable scene change detection using the value of the option @var{scene}.
  9282. This flag is enabled by default.
  9283. @end table
  9284. @end table
  9285. @section framestep
  9286. Select one frame every N-th frame.
  9287. This filter accepts the following option:
  9288. @table @option
  9289. @item step
  9290. Select frame after every @code{step} frames.
  9291. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9292. @end table
  9293. @section freezedetect
  9294. Detect frozen video.
  9295. This filter logs a message and sets frame metadata when it detects that the
  9296. input video has no significant change in content during a specified duration.
  9297. Video freeze detection calculates the mean average absolute difference of all
  9298. the components of video frames and compares it to a noise floor.
  9299. The printed times and duration are expressed in seconds. The
  9300. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9301. whose timestamp equals or exceeds the detection duration and it contains the
  9302. timestamp of the first frame of the freeze. The
  9303. @code{lavfi.freezedetect.freeze_duration} and
  9304. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9305. after the freeze.
  9306. The filter accepts the following options:
  9307. @table @option
  9308. @item noise, n
  9309. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9310. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9311. 0.001.
  9312. @item duration, d
  9313. Set freeze duration until notification (default is 2 seconds).
  9314. @end table
  9315. @section freezeframes
  9316. Freeze video frames.
  9317. This filter freezes video frames using frame from 2nd input.
  9318. The filter accepts the following options:
  9319. @table @option
  9320. @item first
  9321. Set number of first frame from which to start freeze.
  9322. @item last
  9323. Set number of last frame from which to end freeze.
  9324. @item replace
  9325. Set number of frame from 2nd input which will be used instead of replaced frames.
  9326. @end table
  9327. @anchor{frei0r}
  9328. @section frei0r
  9329. Apply a frei0r effect to the input video.
  9330. To enable the compilation of this filter, you need to install the frei0r
  9331. header and configure FFmpeg with @code{--enable-frei0r}.
  9332. It accepts the following parameters:
  9333. @table @option
  9334. @item filter_name
  9335. The name of the frei0r effect to load. If the environment variable
  9336. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9337. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9338. Otherwise, the standard frei0r paths are searched, in this order:
  9339. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9340. @file{/usr/lib/frei0r-1/}.
  9341. @item filter_params
  9342. A '|'-separated list of parameters to pass to the frei0r effect.
  9343. @end table
  9344. A frei0r effect parameter can be a boolean (its value is either
  9345. "y" or "n"), a double, a color (specified as
  9346. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9347. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9348. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9349. a position (specified as @var{X}/@var{Y}, where
  9350. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9351. The number and types of parameters depend on the loaded effect. If an
  9352. effect parameter is not specified, the default value is set.
  9353. @subsection Examples
  9354. @itemize
  9355. @item
  9356. Apply the distort0r effect, setting the first two double parameters:
  9357. @example
  9358. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9359. @end example
  9360. @item
  9361. Apply the colordistance effect, taking a color as the first parameter:
  9362. @example
  9363. frei0r=colordistance:0.2/0.3/0.4
  9364. frei0r=colordistance:violet
  9365. frei0r=colordistance:0x112233
  9366. @end example
  9367. @item
  9368. Apply the perspective effect, specifying the top left and top right image
  9369. positions:
  9370. @example
  9371. frei0r=perspective:0.2/0.2|0.8/0.2
  9372. @end example
  9373. @end itemize
  9374. For more information, see
  9375. @url{http://frei0r.dyne.org}
  9376. @subsection Commands
  9377. This filter supports the @option{filter_params} option as @ref{commands}.
  9378. @section fspp
  9379. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9380. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9381. processing filter, one of them is performed once per block, not per pixel.
  9382. This allows for much higher speed.
  9383. The filter accepts the following options:
  9384. @table @option
  9385. @item quality
  9386. Set quality. This option defines the number of levels for averaging. It accepts
  9387. an integer in the range 4-5. Default value is @code{4}.
  9388. @item qp
  9389. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9390. If not set, the filter will use the QP from the video stream (if available).
  9391. @item strength
  9392. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9393. more details but also more artifacts, while higher values make the image smoother
  9394. but also blurrier. Default value is @code{0} − PSNR optimal.
  9395. @item use_bframe_qp
  9396. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9397. option may cause flicker since the B-Frames have often larger QP. Default is
  9398. @code{0} (not enabled).
  9399. @end table
  9400. @section gblur
  9401. Apply Gaussian blur filter.
  9402. The filter accepts the following options:
  9403. @table @option
  9404. @item sigma
  9405. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9406. @item steps
  9407. Set number of steps for Gaussian approximation. Default is @code{1}.
  9408. @item planes
  9409. Set which planes to filter. By default all planes are filtered.
  9410. @item sigmaV
  9411. Set vertical sigma, if negative it will be same as @code{sigma}.
  9412. Default is @code{-1}.
  9413. @end table
  9414. @subsection Commands
  9415. This filter supports same commands as options.
  9416. The command accepts the same syntax of the corresponding option.
  9417. If the specified expression is not valid, it is kept at its current
  9418. value.
  9419. @section geq
  9420. Apply generic equation to each pixel.
  9421. The filter accepts the following options:
  9422. @table @option
  9423. @item lum_expr, lum
  9424. Set the luminance expression.
  9425. @item cb_expr, cb
  9426. Set the chrominance blue expression.
  9427. @item cr_expr, cr
  9428. Set the chrominance red expression.
  9429. @item alpha_expr, a
  9430. Set the alpha expression.
  9431. @item red_expr, r
  9432. Set the red expression.
  9433. @item green_expr, g
  9434. Set the green expression.
  9435. @item blue_expr, b
  9436. Set the blue expression.
  9437. @end table
  9438. The colorspace is selected according to the specified options. If one
  9439. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9440. options is specified, the filter will automatically select a YCbCr
  9441. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9442. @option{blue_expr} options is specified, it will select an RGB
  9443. colorspace.
  9444. If one of the chrominance expression is not defined, it falls back on the other
  9445. one. If no alpha expression is specified it will evaluate to opaque value.
  9446. If none of chrominance expressions are specified, they will evaluate
  9447. to the luminance expression.
  9448. The expressions can use the following variables and functions:
  9449. @table @option
  9450. @item N
  9451. The sequential number of the filtered frame, starting from @code{0}.
  9452. @item X
  9453. @item Y
  9454. The coordinates of the current sample.
  9455. @item W
  9456. @item H
  9457. The width and height of the image.
  9458. @item SW
  9459. @item SH
  9460. Width and height scale depending on the currently filtered plane. It is the
  9461. ratio between the corresponding luma plane number of pixels and the current
  9462. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9463. @code{0.5,0.5} for chroma planes.
  9464. @item T
  9465. Time of the current frame, expressed in seconds.
  9466. @item p(x, y)
  9467. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9468. plane.
  9469. @item lum(x, y)
  9470. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9471. plane.
  9472. @item cb(x, y)
  9473. Return the value of the pixel at location (@var{x},@var{y}) of the
  9474. blue-difference chroma plane. Return 0 if there is no such plane.
  9475. @item cr(x, y)
  9476. Return the value of the pixel at location (@var{x},@var{y}) of the
  9477. red-difference chroma plane. Return 0 if there is no such plane.
  9478. @item r(x, y)
  9479. @item g(x, y)
  9480. @item b(x, y)
  9481. Return the value of the pixel at location (@var{x},@var{y}) of the
  9482. red/green/blue component. Return 0 if there is no such component.
  9483. @item alpha(x, y)
  9484. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9485. plane. Return 0 if there is no such plane.
  9486. @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)
  9487. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9488. sums of samples within a rectangle. See the functions without the sum postfix.
  9489. @item interpolation
  9490. Set one of interpolation methods:
  9491. @table @option
  9492. @item nearest, n
  9493. @item bilinear, b
  9494. @end table
  9495. Default is bilinear.
  9496. @end table
  9497. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9498. automatically clipped to the closer edge.
  9499. Please note that this filter can use multiple threads in which case each slice
  9500. will have its own expression state. If you want to use only a single expression
  9501. state because your expressions depend on previous state then you should limit
  9502. the number of filter threads to 1.
  9503. @subsection Examples
  9504. @itemize
  9505. @item
  9506. Flip the image horizontally:
  9507. @example
  9508. geq=p(W-X\,Y)
  9509. @end example
  9510. @item
  9511. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9512. wavelength of 100 pixels:
  9513. @example
  9514. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9515. @end example
  9516. @item
  9517. Generate a fancy enigmatic moving light:
  9518. @example
  9519. 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
  9520. @end example
  9521. @item
  9522. Generate a quick emboss effect:
  9523. @example
  9524. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9525. @end example
  9526. @item
  9527. Modify RGB components depending on pixel position:
  9528. @example
  9529. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9530. @end example
  9531. @item
  9532. Create a radial gradient that is the same size as the input (also see
  9533. the @ref{vignette} filter):
  9534. @example
  9535. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9536. @end example
  9537. @end itemize
  9538. @section gradfun
  9539. Fix the banding artifacts that are sometimes introduced into nearly flat
  9540. regions by truncation to 8-bit color depth.
  9541. Interpolate the gradients that should go where the bands are, and
  9542. dither them.
  9543. It is designed for playback only. Do not use it prior to
  9544. lossy compression, because compression tends to lose the dither and
  9545. bring back the bands.
  9546. It accepts the following parameters:
  9547. @table @option
  9548. @item strength
  9549. The maximum amount by which the filter will change any one pixel. This is also
  9550. the threshold for detecting nearly flat regions. Acceptable values range from
  9551. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9552. valid range.
  9553. @item radius
  9554. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9555. gradients, but also prevents the filter from modifying the pixels near detailed
  9556. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9557. values will be clipped to the valid range.
  9558. @end table
  9559. Alternatively, the options can be specified as a flat string:
  9560. @var{strength}[:@var{radius}]
  9561. @subsection Examples
  9562. @itemize
  9563. @item
  9564. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9565. @example
  9566. gradfun=3.5:8
  9567. @end example
  9568. @item
  9569. Specify radius, omitting the strength (which will fall-back to the default
  9570. value):
  9571. @example
  9572. gradfun=radius=8
  9573. @end example
  9574. @end itemize
  9575. @anchor{graphmonitor}
  9576. @section graphmonitor
  9577. Show various filtergraph stats.
  9578. With this filter one can debug complete filtergraph.
  9579. Especially issues with links filling with queued frames.
  9580. The filter accepts the following options:
  9581. @table @option
  9582. @item size, s
  9583. Set video output size. Default is @var{hd720}.
  9584. @item opacity, o
  9585. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9586. @item mode, m
  9587. Set output mode, can be @var{fulll} or @var{compact}.
  9588. In @var{compact} mode only filters with some queued frames have displayed stats.
  9589. @item flags, f
  9590. Set flags which enable which stats are shown in video.
  9591. Available values for flags are:
  9592. @table @samp
  9593. @item queue
  9594. Display number of queued frames in each link.
  9595. @item frame_count_in
  9596. Display number of frames taken from filter.
  9597. @item frame_count_out
  9598. Display number of frames given out from filter.
  9599. @item pts
  9600. Display current filtered frame pts.
  9601. @item time
  9602. Display current filtered frame time.
  9603. @item timebase
  9604. Display time base for filter link.
  9605. @item format
  9606. Display used format for filter link.
  9607. @item size
  9608. Display video size or number of audio channels in case of audio used by filter link.
  9609. @item rate
  9610. Display video frame rate or sample rate in case of audio used by filter link.
  9611. @item eof
  9612. Display link output status.
  9613. @end table
  9614. @item rate, r
  9615. Set upper limit for video rate of output stream, Default value is @var{25}.
  9616. This guarantee that output video frame rate will not be higher than this value.
  9617. @end table
  9618. @section greyedge
  9619. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9620. and corrects the scene colors accordingly.
  9621. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9622. The filter accepts the following options:
  9623. @table @option
  9624. @item difford
  9625. The order of differentiation to be applied on the scene. Must be chosen in the range
  9626. [0,2] and default value is 1.
  9627. @item minknorm
  9628. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9629. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9630. max value instead of calculating Minkowski distance.
  9631. @item sigma
  9632. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9633. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9634. can't be equal to 0 if @var{difford} is greater than 0.
  9635. @end table
  9636. @subsection Examples
  9637. @itemize
  9638. @item
  9639. Grey Edge:
  9640. @example
  9641. greyedge=difford=1:minknorm=5:sigma=2
  9642. @end example
  9643. @item
  9644. Max Edge:
  9645. @example
  9646. greyedge=difford=1:minknorm=0:sigma=2
  9647. @end example
  9648. @end itemize
  9649. @anchor{haldclut}
  9650. @section haldclut
  9651. Apply a Hald CLUT to a video stream.
  9652. First input is the video stream to process, and second one is the Hald CLUT.
  9653. The Hald CLUT input can be a simple picture or a complete video stream.
  9654. The filter accepts the following options:
  9655. @table @option
  9656. @item shortest
  9657. Force termination when the shortest input terminates. Default is @code{0}.
  9658. @item repeatlast
  9659. Continue applying the last CLUT after the end of the stream. A value of
  9660. @code{0} disable the filter after the last frame of the CLUT is reached.
  9661. Default is @code{1}.
  9662. @end table
  9663. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9664. filters share the same internals).
  9665. This filter also supports the @ref{framesync} options.
  9666. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9667. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9668. @subsection Workflow examples
  9669. @subsubsection Hald CLUT video stream
  9670. Generate an identity Hald CLUT stream altered with various effects:
  9671. @example
  9672. 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
  9673. @end example
  9674. Note: make sure you use a lossless codec.
  9675. Then use it with @code{haldclut} to apply it on some random stream:
  9676. @example
  9677. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9678. @end example
  9679. The Hald CLUT will be applied to the 10 first seconds (duration of
  9680. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9681. to the remaining frames of the @code{mandelbrot} stream.
  9682. @subsubsection Hald CLUT with preview
  9683. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9684. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9685. biggest possible square starting at the top left of the picture. The remaining
  9686. padding pixels (bottom or right) will be ignored. This area can be used to add
  9687. a preview of the Hald CLUT.
  9688. Typically, the following generated Hald CLUT will be supported by the
  9689. @code{haldclut} filter:
  9690. @example
  9691. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9692. pad=iw+320 [padded_clut];
  9693. smptebars=s=320x256, split [a][b];
  9694. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9695. [main][b] overlay=W-320" -frames:v 1 clut.png
  9696. @end example
  9697. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9698. bars are displayed on the right-top, and below the same color bars processed by
  9699. the color changes.
  9700. Then, the effect of this Hald CLUT can be visualized with:
  9701. @example
  9702. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9703. @end example
  9704. @section hflip
  9705. Flip the input video horizontally.
  9706. For example, to horizontally flip the input video with @command{ffmpeg}:
  9707. @example
  9708. ffmpeg -i in.avi -vf "hflip" out.avi
  9709. @end example
  9710. @section histeq
  9711. This filter applies a global color histogram equalization on a
  9712. per-frame basis.
  9713. It can be used to correct video that has a compressed range of pixel
  9714. intensities. The filter redistributes the pixel intensities to
  9715. equalize their distribution across the intensity range. It may be
  9716. viewed as an "automatically adjusting contrast filter". This filter is
  9717. useful only for correcting degraded or poorly captured source
  9718. video.
  9719. The filter accepts the following options:
  9720. @table @option
  9721. @item strength
  9722. Determine the amount of equalization to be applied. As the strength
  9723. is reduced, the distribution of pixel intensities more-and-more
  9724. approaches that of the input frame. The value must be a float number
  9725. in the range [0,1] and defaults to 0.200.
  9726. @item intensity
  9727. Set the maximum intensity that can generated and scale the output
  9728. values appropriately. The strength should be set as desired and then
  9729. the intensity can be limited if needed to avoid washing-out. The value
  9730. must be a float number in the range [0,1] and defaults to 0.210.
  9731. @item antibanding
  9732. Set the antibanding level. If enabled the filter will randomly vary
  9733. the luminance of output pixels by a small amount to avoid banding of
  9734. the histogram. Possible values are @code{none}, @code{weak} or
  9735. @code{strong}. It defaults to @code{none}.
  9736. @end table
  9737. @anchor{histogram}
  9738. @section histogram
  9739. Compute and draw a color distribution histogram for the input video.
  9740. The computed histogram is a representation of the color component
  9741. distribution in an image.
  9742. Standard histogram displays the color components distribution in an image.
  9743. Displays color graph for each color component. Shows distribution of
  9744. the Y, U, V, A or R, G, B components, depending on input format, in the
  9745. current frame. Below each graph a color component scale meter is shown.
  9746. The filter accepts the following options:
  9747. @table @option
  9748. @item level_height
  9749. Set height of level. Default value is @code{200}.
  9750. Allowed range is [50, 2048].
  9751. @item scale_height
  9752. Set height of color scale. Default value is @code{12}.
  9753. Allowed range is [0, 40].
  9754. @item display_mode
  9755. Set display mode.
  9756. It accepts the following values:
  9757. @table @samp
  9758. @item stack
  9759. Per color component graphs are placed below each other.
  9760. @item parade
  9761. Per color component graphs are placed side by side.
  9762. @item overlay
  9763. Presents information identical to that in the @code{parade}, except
  9764. that the graphs representing color components are superimposed directly
  9765. over one another.
  9766. @end table
  9767. Default is @code{stack}.
  9768. @item levels_mode
  9769. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9770. Default is @code{linear}.
  9771. @item components
  9772. Set what color components to display.
  9773. Default is @code{7}.
  9774. @item fgopacity
  9775. Set foreground opacity. Default is @code{0.7}.
  9776. @item bgopacity
  9777. Set background opacity. Default is @code{0.5}.
  9778. @end table
  9779. @subsection Examples
  9780. @itemize
  9781. @item
  9782. Calculate and draw histogram:
  9783. @example
  9784. ffplay -i input -vf histogram
  9785. @end example
  9786. @end itemize
  9787. @anchor{hqdn3d}
  9788. @section hqdn3d
  9789. This is a high precision/quality 3d denoise filter. It aims to reduce
  9790. image noise, producing smooth images and making still images really
  9791. still. It should enhance compressibility.
  9792. It accepts the following optional parameters:
  9793. @table @option
  9794. @item luma_spatial
  9795. A non-negative floating point number which specifies spatial luma strength.
  9796. It defaults to 4.0.
  9797. @item chroma_spatial
  9798. A non-negative floating point number which specifies spatial chroma strength.
  9799. It defaults to 3.0*@var{luma_spatial}/4.0.
  9800. @item luma_tmp
  9801. A floating point number which specifies luma temporal strength. It defaults to
  9802. 6.0*@var{luma_spatial}/4.0.
  9803. @item chroma_tmp
  9804. A floating point number which specifies chroma temporal strength. It defaults to
  9805. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9806. @end table
  9807. @subsection Commands
  9808. This filter supports same @ref{commands} as options.
  9809. The command accepts the same syntax of the corresponding option.
  9810. If the specified expression is not valid, it is kept at its current
  9811. value.
  9812. @anchor{hwdownload}
  9813. @section hwdownload
  9814. Download hardware frames to system memory.
  9815. The input must be in hardware frames, and the output a non-hardware format.
  9816. Not all formats will be supported on the output - it may be necessary to insert
  9817. an additional @option{format} filter immediately following in the graph to get
  9818. the output in a supported format.
  9819. @section hwmap
  9820. Map hardware frames to system memory or to another device.
  9821. This filter has several different modes of operation; which one is used depends
  9822. on the input and output formats:
  9823. @itemize
  9824. @item
  9825. Hardware frame input, normal frame output
  9826. Map the input frames to system memory and pass them to the output. If the
  9827. original hardware frame is later required (for example, after overlaying
  9828. something else on part of it), the @option{hwmap} filter can be used again
  9829. in the next mode to retrieve it.
  9830. @item
  9831. Normal frame input, hardware frame output
  9832. If the input is actually a software-mapped hardware frame, then unmap it -
  9833. that is, return the original hardware frame.
  9834. Otherwise, a device must be provided. Create new hardware surfaces on that
  9835. device for the output, then map them back to the software format at the input
  9836. and give those frames to the preceding filter. This will then act like the
  9837. @option{hwupload} filter, but may be able to avoid an additional copy when
  9838. the input is already in a compatible format.
  9839. @item
  9840. Hardware frame input and output
  9841. A device must be supplied for the output, either directly or with the
  9842. @option{derive_device} option. The input and output devices must be of
  9843. different types and compatible - the exact meaning of this is
  9844. system-dependent, but typically it means that they must refer to the same
  9845. underlying hardware context (for example, refer to the same graphics card).
  9846. If the input frames were originally created on the output device, then unmap
  9847. to retrieve the original frames.
  9848. Otherwise, map the frames to the output device - create new hardware frames
  9849. on the output corresponding to the frames on the input.
  9850. @end itemize
  9851. The following additional parameters are accepted:
  9852. @table @option
  9853. @item mode
  9854. Set the frame mapping mode. Some combination of:
  9855. @table @var
  9856. @item read
  9857. The mapped frame should be readable.
  9858. @item write
  9859. The mapped frame should be writeable.
  9860. @item overwrite
  9861. The mapping will always overwrite the entire frame.
  9862. This may improve performance in some cases, as the original contents of the
  9863. frame need not be loaded.
  9864. @item direct
  9865. The mapping must not involve any copying.
  9866. Indirect mappings to copies of frames are created in some cases where either
  9867. direct mapping is not possible or it would have unexpected properties.
  9868. Setting this flag ensures that the mapping is direct and will fail if that is
  9869. not possible.
  9870. @end table
  9871. Defaults to @var{read+write} if not specified.
  9872. @item derive_device @var{type}
  9873. Rather than using the device supplied at initialisation, instead derive a new
  9874. device of type @var{type} from the device the input frames exist on.
  9875. @item reverse
  9876. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9877. and map them back to the source. This may be necessary in some cases where
  9878. a mapping in one direction is required but only the opposite direction is
  9879. supported by the devices being used.
  9880. This option is dangerous - it may break the preceding filter in undefined
  9881. ways if there are any additional constraints on that filter's output.
  9882. Do not use it without fully understanding the implications of its use.
  9883. @end table
  9884. @anchor{hwupload}
  9885. @section hwupload
  9886. Upload system memory frames to hardware surfaces.
  9887. The device to upload to must be supplied when the filter is initialised. If
  9888. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9889. option or with the @option{derive_device} option. The input and output devices
  9890. must be of different types and compatible - the exact meaning of this is
  9891. system-dependent, but typically it means that they must refer to the same
  9892. underlying hardware context (for example, refer to the same graphics card).
  9893. The following additional parameters are accepted:
  9894. @table @option
  9895. @item derive_device @var{type}
  9896. Rather than using the device supplied at initialisation, instead derive a new
  9897. device of type @var{type} from the device the input frames exist on.
  9898. @end table
  9899. @anchor{hwupload_cuda}
  9900. @section hwupload_cuda
  9901. Upload system memory frames to a CUDA device.
  9902. It accepts the following optional parameters:
  9903. @table @option
  9904. @item device
  9905. The number of the CUDA device to use
  9906. @end table
  9907. @section hqx
  9908. Apply a high-quality magnification filter designed for pixel art. This filter
  9909. was originally created by Maxim Stepin.
  9910. It accepts the following option:
  9911. @table @option
  9912. @item n
  9913. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9914. @code{hq3x} and @code{4} for @code{hq4x}.
  9915. Default is @code{3}.
  9916. @end table
  9917. @section hstack
  9918. Stack input videos horizontally.
  9919. All streams must be of same pixel format and of same height.
  9920. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9921. to create same output.
  9922. The filter accepts the following option:
  9923. @table @option
  9924. @item inputs
  9925. Set number of input streams. Default is 2.
  9926. @item shortest
  9927. If set to 1, force the output to terminate when the shortest input
  9928. terminates. Default value is 0.
  9929. @end table
  9930. @section hue
  9931. Modify the hue and/or the saturation of the input.
  9932. It accepts the following parameters:
  9933. @table @option
  9934. @item h
  9935. Specify the hue angle as a number of degrees. It accepts an expression,
  9936. and defaults to "0".
  9937. @item s
  9938. Specify the saturation in the [-10,10] range. It accepts an expression and
  9939. defaults to "1".
  9940. @item H
  9941. Specify the hue angle as a number of radians. It accepts an
  9942. expression, and defaults to "0".
  9943. @item b
  9944. Specify the brightness in the [-10,10] range. It accepts an expression and
  9945. defaults to "0".
  9946. @end table
  9947. @option{h} and @option{H} are mutually exclusive, and can't be
  9948. specified at the same time.
  9949. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9950. expressions containing the following constants:
  9951. @table @option
  9952. @item n
  9953. frame count of the input frame starting from 0
  9954. @item pts
  9955. presentation timestamp of the input frame expressed in time base units
  9956. @item r
  9957. frame rate of the input video, NAN if the input frame rate is unknown
  9958. @item t
  9959. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9960. @item tb
  9961. time base of the input video
  9962. @end table
  9963. @subsection Examples
  9964. @itemize
  9965. @item
  9966. Set the hue to 90 degrees and the saturation to 1.0:
  9967. @example
  9968. hue=h=90:s=1
  9969. @end example
  9970. @item
  9971. Same command but expressing the hue in radians:
  9972. @example
  9973. hue=H=PI/2:s=1
  9974. @end example
  9975. @item
  9976. Rotate hue and make the saturation swing between 0
  9977. and 2 over a period of 1 second:
  9978. @example
  9979. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9980. @end example
  9981. @item
  9982. Apply a 3 seconds saturation fade-in effect starting at 0:
  9983. @example
  9984. hue="s=min(t/3\,1)"
  9985. @end example
  9986. The general fade-in expression can be written as:
  9987. @example
  9988. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9989. @end example
  9990. @item
  9991. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9992. @example
  9993. hue="s=max(0\, min(1\, (8-t)/3))"
  9994. @end example
  9995. The general fade-out expression can be written as:
  9996. @example
  9997. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9998. @end example
  9999. @end itemize
  10000. @subsection Commands
  10001. This filter supports the following commands:
  10002. @table @option
  10003. @item b
  10004. @item s
  10005. @item h
  10006. @item H
  10007. Modify the hue and/or the saturation and/or brightness of the input video.
  10008. The command accepts the same syntax of the corresponding option.
  10009. If the specified expression is not valid, it is kept at its current
  10010. value.
  10011. @end table
  10012. @section hysteresis
  10013. Grow first stream into second stream by connecting components.
  10014. This makes it possible to build more robust edge masks.
  10015. This filter accepts the following options:
  10016. @table @option
  10017. @item planes
  10018. Set which planes will be processed as bitmap, unprocessed planes will be
  10019. copied from first stream.
  10020. By default value 0xf, all planes will be processed.
  10021. @item threshold
  10022. Set threshold which is used in filtering. If pixel component value is higher than
  10023. this value filter algorithm for connecting components is activated.
  10024. By default value is 0.
  10025. @end table
  10026. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10027. @section idet
  10028. Detect video interlacing type.
  10029. This filter tries to detect if the input frames are interlaced, progressive,
  10030. top or bottom field first. It will also try to detect fields that are
  10031. repeated between adjacent frames (a sign of telecine).
  10032. Single frame detection considers only immediately adjacent frames when classifying each frame.
  10033. Multiple frame detection incorporates the classification history of previous frames.
  10034. The filter will log these metadata values:
  10035. @table @option
  10036. @item single.current_frame
  10037. Detected type of current frame using single-frame detection. One of:
  10038. ``tff'' (top field first), ``bff'' (bottom field first),
  10039. ``progressive'', or ``undetermined''
  10040. @item single.tff
  10041. Cumulative number of frames detected as top field first using single-frame detection.
  10042. @item multiple.tff
  10043. Cumulative number of frames detected as top field first using multiple-frame detection.
  10044. @item single.bff
  10045. Cumulative number of frames detected as bottom field first using single-frame detection.
  10046. @item multiple.current_frame
  10047. Detected type of current frame using multiple-frame detection. One of:
  10048. ``tff'' (top field first), ``bff'' (bottom field first),
  10049. ``progressive'', or ``undetermined''
  10050. @item multiple.bff
  10051. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  10052. @item single.progressive
  10053. Cumulative number of frames detected as progressive using single-frame detection.
  10054. @item multiple.progressive
  10055. Cumulative number of frames detected as progressive using multiple-frame detection.
  10056. @item single.undetermined
  10057. Cumulative number of frames that could not be classified using single-frame detection.
  10058. @item multiple.undetermined
  10059. Cumulative number of frames that could not be classified using multiple-frame detection.
  10060. @item repeated.current_frame
  10061. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10062. @item repeated.neither
  10063. Cumulative number of frames with no repeated field.
  10064. @item repeated.top
  10065. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10066. @item repeated.bottom
  10067. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10068. @end table
  10069. The filter accepts the following options:
  10070. @table @option
  10071. @item intl_thres
  10072. Set interlacing threshold.
  10073. @item prog_thres
  10074. Set progressive threshold.
  10075. @item rep_thres
  10076. Threshold for repeated field detection.
  10077. @item half_life
  10078. Number of frames after which a given frame's contribution to the
  10079. statistics is halved (i.e., it contributes only 0.5 to its
  10080. classification). The default of 0 means that all frames seen are given
  10081. full weight of 1.0 forever.
  10082. @item analyze_interlaced_flag
  10083. When this is not 0 then idet will use the specified number of frames to determine
  10084. if the interlaced flag is accurate, it will not count undetermined frames.
  10085. If the flag is found to be accurate it will be used without any further
  10086. computations, if it is found to be inaccurate it will be cleared without any
  10087. further computations. This allows inserting the idet filter as a low computational
  10088. method to clean up the interlaced flag
  10089. @end table
  10090. @section il
  10091. Deinterleave or interleave fields.
  10092. This filter allows one to process interlaced images fields without
  10093. deinterlacing them. Deinterleaving splits the input frame into 2
  10094. fields (so called half pictures). Odd lines are moved to the top
  10095. half of the output image, even lines to the bottom half.
  10096. You can process (filter) them independently and then re-interleave them.
  10097. The filter accepts the following options:
  10098. @table @option
  10099. @item luma_mode, l
  10100. @item chroma_mode, c
  10101. @item alpha_mode, a
  10102. Available values for @var{luma_mode}, @var{chroma_mode} and
  10103. @var{alpha_mode} are:
  10104. @table @samp
  10105. @item none
  10106. Do nothing.
  10107. @item deinterleave, d
  10108. Deinterleave fields, placing one above the other.
  10109. @item interleave, i
  10110. Interleave fields. Reverse the effect of deinterleaving.
  10111. @end table
  10112. Default value is @code{none}.
  10113. @item luma_swap, ls
  10114. @item chroma_swap, cs
  10115. @item alpha_swap, as
  10116. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10117. @end table
  10118. @subsection Commands
  10119. This filter supports the all above options as @ref{commands}.
  10120. @section inflate
  10121. Apply inflate effect to the video.
  10122. This filter replaces the pixel by the local(3x3) average by taking into account
  10123. only values higher than the pixel.
  10124. It accepts the following options:
  10125. @table @option
  10126. @item threshold0
  10127. @item threshold1
  10128. @item threshold2
  10129. @item threshold3
  10130. Limit the maximum change for each plane, default is 65535.
  10131. If 0, plane will remain unchanged.
  10132. @end table
  10133. @subsection Commands
  10134. This filter supports the all above options as @ref{commands}.
  10135. @section interlace
  10136. Simple interlacing filter from progressive contents. This interleaves upper (or
  10137. lower) lines from odd frames with lower (or upper) lines from even frames,
  10138. halving the frame rate and preserving image height.
  10139. @example
  10140. Original Original New Frame
  10141. Frame 'j' Frame 'j+1' (tff)
  10142. ========== =========== ==================
  10143. Line 0 --------------------> Frame 'j' Line 0
  10144. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10145. Line 2 ---------------------> Frame 'j' Line 2
  10146. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10147. ... ... ...
  10148. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10149. @end example
  10150. It accepts the following optional parameters:
  10151. @table @option
  10152. @item scan
  10153. This determines whether the interlaced frame is taken from the even
  10154. (tff - default) or odd (bff) lines of the progressive frame.
  10155. @item lowpass
  10156. Vertical lowpass filter to avoid twitter interlacing and
  10157. reduce moire patterns.
  10158. @table @samp
  10159. @item 0, off
  10160. Disable vertical lowpass filter
  10161. @item 1, linear
  10162. Enable linear filter (default)
  10163. @item 2, complex
  10164. Enable complex filter. This will slightly less reduce twitter and moire
  10165. but better retain detail and subjective sharpness impression.
  10166. @end table
  10167. @end table
  10168. @section kerndeint
  10169. Deinterlace input video by applying Donald Graft's adaptive kernel
  10170. deinterling. Work on interlaced parts of a video to produce
  10171. progressive frames.
  10172. The description of the accepted parameters follows.
  10173. @table @option
  10174. @item thresh
  10175. Set the threshold which affects the filter's tolerance when
  10176. determining if a pixel line must be processed. It must be an integer
  10177. in the range [0,255] and defaults to 10. A value of 0 will result in
  10178. applying the process on every pixels.
  10179. @item map
  10180. Paint pixels exceeding the threshold value to white if set to 1.
  10181. Default is 0.
  10182. @item order
  10183. Set the fields order. Swap fields if set to 1, leave fields alone if
  10184. 0. Default is 0.
  10185. @item sharp
  10186. Enable additional sharpening if set to 1. Default is 0.
  10187. @item twoway
  10188. Enable twoway sharpening if set to 1. Default is 0.
  10189. @end table
  10190. @subsection Examples
  10191. @itemize
  10192. @item
  10193. Apply default values:
  10194. @example
  10195. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10196. @end example
  10197. @item
  10198. Enable additional sharpening:
  10199. @example
  10200. kerndeint=sharp=1
  10201. @end example
  10202. @item
  10203. Paint processed pixels in white:
  10204. @example
  10205. kerndeint=map=1
  10206. @end example
  10207. @end itemize
  10208. @section lagfun
  10209. Slowly update darker pixels.
  10210. This filter makes short flashes of light appear longer.
  10211. This filter accepts the following options:
  10212. @table @option
  10213. @item decay
  10214. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10215. @item planes
  10216. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10217. @end table
  10218. @section lenscorrection
  10219. Correct radial lens distortion
  10220. This filter can be used to correct for radial distortion as can result from the use
  10221. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10222. one can use tools available for example as part of opencv or simply trial-and-error.
  10223. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10224. and extract the k1 and k2 coefficients from the resulting matrix.
  10225. Note that effectively the same filter is available in the open-source tools Krita and
  10226. Digikam from the KDE project.
  10227. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10228. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10229. brightness distribution, so you may want to use both filters together in certain
  10230. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10231. be applied before or after lens correction.
  10232. @subsection Options
  10233. The filter accepts the following options:
  10234. @table @option
  10235. @item cx
  10236. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10237. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10238. width. Default is 0.5.
  10239. @item cy
  10240. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10241. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10242. height. Default is 0.5.
  10243. @item k1
  10244. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10245. no correction. Default is 0.
  10246. @item k2
  10247. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10248. 0 means no correction. Default is 0.
  10249. @end table
  10250. The formula that generates the correction is:
  10251. @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)
  10252. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10253. distances from the focal point in the source and target images, respectively.
  10254. @section lensfun
  10255. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10256. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10257. to apply the lens correction. The filter will load the lensfun database and
  10258. query it to find the corresponding camera and lens entries in the database. As
  10259. long as these entries can be found with the given options, the filter can
  10260. perform corrections on frames. Note that incomplete strings will result in the
  10261. filter choosing the best match with the given options, and the filter will
  10262. output the chosen camera and lens models (logged with level "info"). You must
  10263. provide the make, camera model, and lens model as they are required.
  10264. The filter accepts the following options:
  10265. @table @option
  10266. @item make
  10267. The make of the camera (for example, "Canon"). This option is required.
  10268. @item model
  10269. The model of the camera (for example, "Canon EOS 100D"). This option is
  10270. required.
  10271. @item lens_model
  10272. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10273. option is required.
  10274. @item mode
  10275. The type of correction to apply. The following values are valid options:
  10276. @table @samp
  10277. @item vignetting
  10278. Enables fixing lens vignetting.
  10279. @item geometry
  10280. Enables fixing lens geometry. This is the default.
  10281. @item subpixel
  10282. Enables fixing chromatic aberrations.
  10283. @item vig_geo
  10284. Enables fixing lens vignetting and lens geometry.
  10285. @item vig_subpixel
  10286. Enables fixing lens vignetting and chromatic aberrations.
  10287. @item distortion
  10288. Enables fixing both lens geometry and chromatic aberrations.
  10289. @item all
  10290. Enables all possible corrections.
  10291. @end table
  10292. @item focal_length
  10293. The focal length of the image/video (zoom; expected constant for video). For
  10294. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10295. range should be chosen when using that lens. Default 18.
  10296. @item aperture
  10297. The aperture of the image/video (expected constant for video). Note that
  10298. aperture is only used for vignetting correction. Default 3.5.
  10299. @item focus_distance
  10300. The focus distance of the image/video (expected constant for video). Note that
  10301. focus distance is only used for vignetting and only slightly affects the
  10302. vignetting correction process. If unknown, leave it at the default value (which
  10303. is 1000).
  10304. @item scale
  10305. The scale factor which is applied after transformation. After correction the
  10306. video is no longer necessarily rectangular. This parameter controls how much of
  10307. the resulting image is visible. The value 0 means that a value will be chosen
  10308. automatically such that there is little or no unmapped area in the output
  10309. image. 1.0 means that no additional scaling is done. Lower values may result
  10310. in more of the corrected image being visible, while higher values may avoid
  10311. unmapped areas in the output.
  10312. @item target_geometry
  10313. The target geometry of the output image/video. The following values are valid
  10314. options:
  10315. @table @samp
  10316. @item rectilinear (default)
  10317. @item fisheye
  10318. @item panoramic
  10319. @item equirectangular
  10320. @item fisheye_orthographic
  10321. @item fisheye_stereographic
  10322. @item fisheye_equisolid
  10323. @item fisheye_thoby
  10324. @end table
  10325. @item reverse
  10326. Apply the reverse of image correction (instead of correcting distortion, apply
  10327. it).
  10328. @item interpolation
  10329. The type of interpolation used when correcting distortion. The following values
  10330. are valid options:
  10331. @table @samp
  10332. @item nearest
  10333. @item linear (default)
  10334. @item lanczos
  10335. @end table
  10336. @end table
  10337. @subsection Examples
  10338. @itemize
  10339. @item
  10340. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10341. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10342. aperture of "8.0".
  10343. @example
  10344. 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
  10345. @end example
  10346. @item
  10347. Apply the same as before, but only for the first 5 seconds of video.
  10348. @example
  10349. 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
  10350. @end example
  10351. @end itemize
  10352. @section libvmaf
  10353. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10354. score between two input videos.
  10355. The obtained VMAF score is printed through the logging system.
  10356. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10357. After installing the library it can be enabled using:
  10358. @code{./configure --enable-libvmaf}.
  10359. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10360. The filter has following options:
  10361. @table @option
  10362. @item model_path
  10363. Set the model path which is to be used for SVM.
  10364. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10365. @item log_path
  10366. Set the file path to be used to store logs.
  10367. @item log_fmt
  10368. Set the format of the log file (csv, json or xml).
  10369. @item enable_transform
  10370. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10371. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10372. Default value: @code{false}
  10373. @item phone_model
  10374. Invokes the phone model which will generate VMAF scores higher than in the
  10375. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10376. Default value: @code{false}
  10377. @item psnr
  10378. Enables computing psnr along with vmaf.
  10379. Default value: @code{false}
  10380. @item ssim
  10381. Enables computing ssim along with vmaf.
  10382. Default value: @code{false}
  10383. @item ms_ssim
  10384. Enables computing ms_ssim along with vmaf.
  10385. Default value: @code{false}
  10386. @item pool
  10387. Set the pool method to be used for computing vmaf.
  10388. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10389. @item n_threads
  10390. Set number of threads to be used when computing vmaf.
  10391. Default value: @code{0}, which makes use of all available logical processors.
  10392. @item n_subsample
  10393. Set interval for frame subsampling used when computing vmaf.
  10394. Default value: @code{1}
  10395. @item enable_conf_interval
  10396. Enables confidence interval.
  10397. Default value: @code{false}
  10398. @end table
  10399. This filter also supports the @ref{framesync} options.
  10400. @subsection Examples
  10401. @itemize
  10402. @item
  10403. On the below examples the input file @file{main.mpg} being processed is
  10404. compared with the reference file @file{ref.mpg}.
  10405. @example
  10406. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10407. @end example
  10408. @item
  10409. Example with options:
  10410. @example
  10411. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10412. @end example
  10413. @item
  10414. Example with options and different containers:
  10415. @example
  10416. 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 -
  10417. @end example
  10418. @end itemize
  10419. @section limiter
  10420. Limits the pixel components values to the specified range [min, max].
  10421. The filter accepts the following options:
  10422. @table @option
  10423. @item min
  10424. Lower bound. Defaults to the lowest allowed value for the input.
  10425. @item max
  10426. Upper bound. Defaults to the highest allowed value for the input.
  10427. @item planes
  10428. Specify which planes will be processed. Defaults to all available.
  10429. @end table
  10430. @subsection Commands
  10431. This filter supports the all above options as @ref{commands}.
  10432. @section loop
  10433. Loop video frames.
  10434. The filter accepts the following options:
  10435. @table @option
  10436. @item loop
  10437. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10438. Default is 0.
  10439. @item size
  10440. Set maximal size in number of frames. Default is 0.
  10441. @item start
  10442. Set first frame of loop. Default is 0.
  10443. @end table
  10444. @subsection Examples
  10445. @itemize
  10446. @item
  10447. Loop single first frame infinitely:
  10448. @example
  10449. loop=loop=-1:size=1:start=0
  10450. @end example
  10451. @item
  10452. Loop single first frame 10 times:
  10453. @example
  10454. loop=loop=10:size=1:start=0
  10455. @end example
  10456. @item
  10457. Loop 10 first frames 5 times:
  10458. @example
  10459. loop=loop=5:size=10:start=0
  10460. @end example
  10461. @end itemize
  10462. @section lut1d
  10463. Apply a 1D LUT to an input video.
  10464. The filter accepts the following options:
  10465. @table @option
  10466. @item file
  10467. Set the 1D LUT file name.
  10468. Currently supported formats:
  10469. @table @samp
  10470. @item cube
  10471. Iridas
  10472. @item csp
  10473. cineSpace
  10474. @end table
  10475. @item interp
  10476. Select interpolation mode.
  10477. Available values are:
  10478. @table @samp
  10479. @item nearest
  10480. Use values from the nearest defined point.
  10481. @item linear
  10482. Interpolate values using the linear interpolation.
  10483. @item cosine
  10484. Interpolate values using the cosine interpolation.
  10485. @item cubic
  10486. Interpolate values using the cubic interpolation.
  10487. @item spline
  10488. Interpolate values using the spline interpolation.
  10489. @end table
  10490. @end table
  10491. @anchor{lut3d}
  10492. @section lut3d
  10493. Apply a 3D LUT to an input video.
  10494. The filter accepts the following options:
  10495. @table @option
  10496. @item file
  10497. Set the 3D LUT file name.
  10498. Currently supported formats:
  10499. @table @samp
  10500. @item 3dl
  10501. AfterEffects
  10502. @item cube
  10503. Iridas
  10504. @item dat
  10505. DaVinci
  10506. @item m3d
  10507. Pandora
  10508. @item csp
  10509. cineSpace
  10510. @end table
  10511. @item interp
  10512. Select interpolation mode.
  10513. Available values are:
  10514. @table @samp
  10515. @item nearest
  10516. Use values from the nearest defined point.
  10517. @item trilinear
  10518. Interpolate values using the 8 points defining a cube.
  10519. @item tetrahedral
  10520. Interpolate values using a tetrahedron.
  10521. @end table
  10522. @end table
  10523. @section lumakey
  10524. Turn certain luma values into transparency.
  10525. The filter accepts the following options:
  10526. @table @option
  10527. @item threshold
  10528. Set the luma which will be used as base for transparency.
  10529. Default value is @code{0}.
  10530. @item tolerance
  10531. Set the range of luma values to be keyed out.
  10532. Default value is @code{0.01}.
  10533. @item softness
  10534. Set the range of softness. Default value is @code{0}.
  10535. Use this to control gradual transition from zero to full transparency.
  10536. @end table
  10537. @subsection Commands
  10538. This filter supports same @ref{commands} as options.
  10539. The command accepts the same syntax of the corresponding option.
  10540. If the specified expression is not valid, it is kept at its current
  10541. value.
  10542. @section lut, lutrgb, lutyuv
  10543. Compute a look-up table for binding each pixel component input value
  10544. to an output value, and apply it to the input video.
  10545. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10546. to an RGB input video.
  10547. These filters accept the following parameters:
  10548. @table @option
  10549. @item c0
  10550. set first pixel component expression
  10551. @item c1
  10552. set second pixel component expression
  10553. @item c2
  10554. set third pixel component expression
  10555. @item c3
  10556. set fourth pixel component expression, corresponds to the alpha component
  10557. @item r
  10558. set red component expression
  10559. @item g
  10560. set green component expression
  10561. @item b
  10562. set blue component expression
  10563. @item a
  10564. alpha component expression
  10565. @item y
  10566. set Y/luminance component expression
  10567. @item u
  10568. set U/Cb component expression
  10569. @item v
  10570. set V/Cr component expression
  10571. @end table
  10572. Each of them specifies the expression to use for computing the lookup table for
  10573. the corresponding pixel component values.
  10574. The exact component associated to each of the @var{c*} options depends on the
  10575. format in input.
  10576. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10577. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10578. The expressions can contain the following constants and functions:
  10579. @table @option
  10580. @item w
  10581. @item h
  10582. The input width and height.
  10583. @item val
  10584. The input value for the pixel component.
  10585. @item clipval
  10586. The input value, clipped to the @var{minval}-@var{maxval} range.
  10587. @item maxval
  10588. The maximum value for the pixel component.
  10589. @item minval
  10590. The minimum value for the pixel component.
  10591. @item negval
  10592. The negated value for the pixel component value, clipped to the
  10593. @var{minval}-@var{maxval} range; it corresponds to the expression
  10594. "maxval-clipval+minval".
  10595. @item clip(val)
  10596. The computed value in @var{val}, clipped to the
  10597. @var{minval}-@var{maxval} range.
  10598. @item gammaval(gamma)
  10599. The computed gamma correction value of the pixel component value,
  10600. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10601. expression
  10602. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10603. @end table
  10604. All expressions default to "val".
  10605. @subsection Examples
  10606. @itemize
  10607. @item
  10608. Negate input video:
  10609. @example
  10610. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10611. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10612. @end example
  10613. The above is the same as:
  10614. @example
  10615. lutrgb="r=negval:g=negval:b=negval"
  10616. lutyuv="y=negval:u=negval:v=negval"
  10617. @end example
  10618. @item
  10619. Negate luminance:
  10620. @example
  10621. lutyuv=y=negval
  10622. @end example
  10623. @item
  10624. Remove chroma components, turning the video into a graytone image:
  10625. @example
  10626. lutyuv="u=128:v=128"
  10627. @end example
  10628. @item
  10629. Apply a luma burning effect:
  10630. @example
  10631. lutyuv="y=2*val"
  10632. @end example
  10633. @item
  10634. Remove green and blue components:
  10635. @example
  10636. lutrgb="g=0:b=0"
  10637. @end example
  10638. @item
  10639. Set a constant alpha channel value on input:
  10640. @example
  10641. format=rgba,lutrgb=a="maxval-minval/2"
  10642. @end example
  10643. @item
  10644. Correct luminance gamma by a factor of 0.5:
  10645. @example
  10646. lutyuv=y=gammaval(0.5)
  10647. @end example
  10648. @item
  10649. Discard least significant bits of luma:
  10650. @example
  10651. lutyuv=y='bitand(val, 128+64+32)'
  10652. @end example
  10653. @item
  10654. Technicolor like effect:
  10655. @example
  10656. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10657. @end example
  10658. @end itemize
  10659. @section lut2, tlut2
  10660. The @code{lut2} filter takes two input streams and outputs one
  10661. stream.
  10662. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10663. from one single stream.
  10664. This filter accepts the following parameters:
  10665. @table @option
  10666. @item c0
  10667. set first pixel component expression
  10668. @item c1
  10669. set second pixel component expression
  10670. @item c2
  10671. set third pixel component expression
  10672. @item c3
  10673. set fourth pixel component expression, corresponds to the alpha component
  10674. @item d
  10675. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10676. which means bit depth is automatically picked from first input format.
  10677. @end table
  10678. The @code{lut2} filter also supports the @ref{framesync} options.
  10679. Each of them specifies the expression to use for computing the lookup table for
  10680. the corresponding pixel component values.
  10681. The exact component associated to each of the @var{c*} options depends on the
  10682. format in inputs.
  10683. The expressions can contain the following constants:
  10684. @table @option
  10685. @item w
  10686. @item h
  10687. The input width and height.
  10688. @item x
  10689. The first input value for the pixel component.
  10690. @item y
  10691. The second input value for the pixel component.
  10692. @item bdx
  10693. The first input video bit depth.
  10694. @item bdy
  10695. The second input video bit depth.
  10696. @end table
  10697. All expressions default to "x".
  10698. @subsection Examples
  10699. @itemize
  10700. @item
  10701. Highlight differences between two RGB video streams:
  10702. @example
  10703. 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)'
  10704. @end example
  10705. @item
  10706. Highlight differences between two YUV video streams:
  10707. @example
  10708. 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)'
  10709. @end example
  10710. @item
  10711. Show max difference between two video streams:
  10712. @example
  10713. 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)))'
  10714. @end example
  10715. @end itemize
  10716. @section maskedclamp
  10717. Clamp the first input stream with the second input and third input stream.
  10718. Returns the value of first stream to be between second input
  10719. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10720. This filter accepts the following options:
  10721. @table @option
  10722. @item undershoot
  10723. Default value is @code{0}.
  10724. @item overshoot
  10725. Default value is @code{0}.
  10726. @item planes
  10727. Set which planes will be processed as bitmap, unprocessed planes will be
  10728. copied from first stream.
  10729. By default value 0xf, all planes will be processed.
  10730. @end table
  10731. @subsection Commands
  10732. This filter supports the all above options as @ref{commands}.
  10733. @section maskedmax
  10734. Merge the second and third input stream into output stream using absolute differences
  10735. between second input stream and first input stream and absolute difference between
  10736. third input stream and first input stream. The picked value will be from second input
  10737. stream if second absolute difference is greater than first one or from third input stream
  10738. otherwise.
  10739. This filter accepts the following options:
  10740. @table @option
  10741. @item planes
  10742. Set which planes will be processed as bitmap, unprocessed planes will be
  10743. copied from first stream.
  10744. By default value 0xf, all planes will be processed.
  10745. @end table
  10746. @subsection Commands
  10747. This filter supports the all above options as @ref{commands}.
  10748. @section maskedmerge
  10749. Merge the first input stream with the second input stream using per pixel
  10750. weights in the third input stream.
  10751. A value of 0 in the third stream pixel component means that pixel component
  10752. from first stream is returned unchanged, while maximum value (eg. 255 for
  10753. 8-bit videos) means that pixel component from second stream is returned
  10754. unchanged. Intermediate values define the amount of merging between both
  10755. input stream's pixel components.
  10756. This filter accepts the following options:
  10757. @table @option
  10758. @item planes
  10759. Set which planes will be processed as bitmap, unprocessed planes will be
  10760. copied from first stream.
  10761. By default value 0xf, all planes will be processed.
  10762. @end table
  10763. @subsection Commands
  10764. This filter supports the all above options as @ref{commands}.
  10765. @section maskedmin
  10766. Merge the second and third input stream into output stream using absolute differences
  10767. between second input stream and first input stream and absolute difference between
  10768. third input stream and first input stream. The picked value will be from second input
  10769. stream if second absolute difference is less than first one or from third input stream
  10770. otherwise.
  10771. This filter accepts the following options:
  10772. @table @option
  10773. @item planes
  10774. Set which planes will be processed as bitmap, unprocessed planes will be
  10775. copied from first stream.
  10776. By default value 0xf, all planes will be processed.
  10777. @end table
  10778. @subsection Commands
  10779. This filter supports the all above options as @ref{commands}.
  10780. @section maskedthreshold
  10781. Pick pixels comparing absolute difference of two video streams with fixed
  10782. threshold.
  10783. If absolute difference between pixel component of first and second video
  10784. stream is equal or lower than user supplied threshold than pixel component
  10785. from first video stream is picked, otherwise pixel component from second
  10786. video stream is picked.
  10787. This filter accepts the following options:
  10788. @table @option
  10789. @item threshold
  10790. Set threshold used when picking pixels from absolute difference from two input
  10791. video streams.
  10792. @item planes
  10793. Set which planes will be processed as bitmap, unprocessed planes will be
  10794. copied from second stream.
  10795. By default value 0xf, all planes will be processed.
  10796. @end table
  10797. @subsection Commands
  10798. This filter supports the all above options as @ref{commands}.
  10799. @section maskfun
  10800. Create mask from input video.
  10801. For example it is useful to create motion masks after @code{tblend} filter.
  10802. This filter accepts the following options:
  10803. @table @option
  10804. @item low
  10805. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10806. @item high
  10807. Set high threshold. Any pixel component higher than this value will be set to max value
  10808. allowed for current pixel format.
  10809. @item planes
  10810. Set planes to filter, by default all available planes are filtered.
  10811. @item fill
  10812. Fill all frame pixels with this value.
  10813. @item sum
  10814. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10815. average, output frame will be completely filled with value set by @var{fill} option.
  10816. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10817. @end table
  10818. @section mcdeint
  10819. Apply motion-compensation deinterlacing.
  10820. It needs one field per frame as input and must thus be used together
  10821. with yadif=1/3 or equivalent.
  10822. This filter accepts the following options:
  10823. @table @option
  10824. @item mode
  10825. Set the deinterlacing mode.
  10826. It accepts one of the following values:
  10827. @table @samp
  10828. @item fast
  10829. @item medium
  10830. @item slow
  10831. use iterative motion estimation
  10832. @item extra_slow
  10833. like @samp{slow}, but use multiple reference frames.
  10834. @end table
  10835. Default value is @samp{fast}.
  10836. @item parity
  10837. Set the picture field parity assumed for the input video. It must be
  10838. one of the following values:
  10839. @table @samp
  10840. @item 0, tff
  10841. assume top field first
  10842. @item 1, bff
  10843. assume bottom field first
  10844. @end table
  10845. Default value is @samp{bff}.
  10846. @item qp
  10847. Set per-block quantization parameter (QP) used by the internal
  10848. encoder.
  10849. Higher values should result in a smoother motion vector field but less
  10850. optimal individual vectors. Default value is 1.
  10851. @end table
  10852. @section median
  10853. Pick median pixel from certain rectangle defined by radius.
  10854. This filter accepts the following options:
  10855. @table @option
  10856. @item radius
  10857. Set horizontal radius size. Default value is @code{1}.
  10858. Allowed range is integer from 1 to 127.
  10859. @item planes
  10860. Set which planes to process. Default is @code{15}, which is all available planes.
  10861. @item radiusV
  10862. Set vertical radius size. Default value is @code{0}.
  10863. Allowed range is integer from 0 to 127.
  10864. If it is 0, value will be picked from horizontal @code{radius} option.
  10865. @item percentile
  10866. Set median percentile. Default value is @code{0.5}.
  10867. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10868. minimum values, and @code{1} maximum values.
  10869. @end table
  10870. @subsection Commands
  10871. This filter supports same @ref{commands} as options.
  10872. The command accepts the same syntax of the corresponding option.
  10873. If the specified expression is not valid, it is kept at its current
  10874. value.
  10875. @section mergeplanes
  10876. Merge color channel components from several video streams.
  10877. The filter accepts up to 4 input streams, and merge selected input
  10878. planes to the output video.
  10879. This filter accepts the following options:
  10880. @table @option
  10881. @item mapping
  10882. Set input to output plane mapping. Default is @code{0}.
  10883. The mappings is specified as a bitmap. It should be specified as a
  10884. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10885. mapping for the first plane of the output stream. 'A' sets the number of
  10886. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10887. corresponding input to use (from 0 to 3). The rest of the mappings is
  10888. similar, 'Bb' describes the mapping for the output stream second
  10889. plane, 'Cc' describes the mapping for the output stream third plane and
  10890. 'Dd' describes the mapping for the output stream fourth plane.
  10891. @item format
  10892. Set output pixel format. Default is @code{yuva444p}.
  10893. @end table
  10894. @subsection Examples
  10895. @itemize
  10896. @item
  10897. Merge three gray video streams of same width and height into single video stream:
  10898. @example
  10899. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10900. @end example
  10901. @item
  10902. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10903. @example
  10904. [a0][a1]mergeplanes=0x00010210:yuva444p
  10905. @end example
  10906. @item
  10907. Swap Y and A plane in yuva444p stream:
  10908. @example
  10909. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10910. @end example
  10911. @item
  10912. Swap U and V plane in yuv420p stream:
  10913. @example
  10914. format=yuv420p,mergeplanes=0x000201:yuv420p
  10915. @end example
  10916. @item
  10917. Cast a rgb24 clip to yuv444p:
  10918. @example
  10919. format=rgb24,mergeplanes=0x000102:yuv444p
  10920. @end example
  10921. @end itemize
  10922. @section mestimate
  10923. Estimate and export motion vectors using block matching algorithms.
  10924. Motion vectors are stored in frame side data to be used by other filters.
  10925. This filter accepts the following options:
  10926. @table @option
  10927. @item method
  10928. Specify the motion estimation method. Accepts one of the following values:
  10929. @table @samp
  10930. @item esa
  10931. Exhaustive search algorithm.
  10932. @item tss
  10933. Three step search algorithm.
  10934. @item tdls
  10935. Two dimensional logarithmic search algorithm.
  10936. @item ntss
  10937. New three step search algorithm.
  10938. @item fss
  10939. Four step search algorithm.
  10940. @item ds
  10941. Diamond search algorithm.
  10942. @item hexbs
  10943. Hexagon-based search algorithm.
  10944. @item epzs
  10945. Enhanced predictive zonal search algorithm.
  10946. @item umh
  10947. Uneven multi-hexagon search algorithm.
  10948. @end table
  10949. Default value is @samp{esa}.
  10950. @item mb_size
  10951. Macroblock size. Default @code{16}.
  10952. @item search_param
  10953. Search parameter. Default @code{7}.
  10954. @end table
  10955. @section midequalizer
  10956. Apply Midway Image Equalization effect using two video streams.
  10957. Midway Image Equalization adjusts a pair of images to have the same
  10958. histogram, while maintaining their dynamics as much as possible. It's
  10959. useful for e.g. matching exposures from a pair of stereo cameras.
  10960. This filter has two inputs and one output, which must be of same pixel format, but
  10961. may be of different sizes. The output of filter is first input adjusted with
  10962. midway histogram of both inputs.
  10963. This filter accepts the following option:
  10964. @table @option
  10965. @item planes
  10966. Set which planes to process. Default is @code{15}, which is all available planes.
  10967. @end table
  10968. @section minterpolate
  10969. Convert the video to specified frame rate using motion interpolation.
  10970. This filter accepts the following options:
  10971. @table @option
  10972. @item fps
  10973. 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}.
  10974. @item mi_mode
  10975. Motion interpolation mode. Following values are accepted:
  10976. @table @samp
  10977. @item dup
  10978. Duplicate previous or next frame for interpolating new ones.
  10979. @item blend
  10980. Blend source frames. Interpolated frame is mean of previous and next frames.
  10981. @item mci
  10982. Motion compensated interpolation. Following options are effective when this mode is selected:
  10983. @table @samp
  10984. @item mc_mode
  10985. Motion compensation mode. Following values are accepted:
  10986. @table @samp
  10987. @item obmc
  10988. Overlapped block motion compensation.
  10989. @item aobmc
  10990. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10991. @end table
  10992. Default mode is @samp{obmc}.
  10993. @item me_mode
  10994. Motion estimation mode. Following values are accepted:
  10995. @table @samp
  10996. @item bidir
  10997. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10998. @item bilat
  10999. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  11000. @end table
  11001. Default mode is @samp{bilat}.
  11002. @item me
  11003. The algorithm to be used for motion estimation. Following values are accepted:
  11004. @table @samp
  11005. @item esa
  11006. Exhaustive search algorithm.
  11007. @item tss
  11008. Three step search algorithm.
  11009. @item tdls
  11010. Two dimensional logarithmic search algorithm.
  11011. @item ntss
  11012. New three step search algorithm.
  11013. @item fss
  11014. Four step search algorithm.
  11015. @item ds
  11016. Diamond search algorithm.
  11017. @item hexbs
  11018. Hexagon-based search algorithm.
  11019. @item epzs
  11020. Enhanced predictive zonal search algorithm.
  11021. @item umh
  11022. Uneven multi-hexagon search algorithm.
  11023. @end table
  11024. Default algorithm is @samp{epzs}.
  11025. @item mb_size
  11026. Macroblock size. Default @code{16}.
  11027. @item search_param
  11028. Motion estimation search parameter. Default @code{32}.
  11029. @item vsbmc
  11030. 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).
  11031. @end table
  11032. @end table
  11033. @item scd
  11034. 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:
  11035. @table @samp
  11036. @item none
  11037. Disable scene change detection.
  11038. @item fdiff
  11039. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  11040. @end table
  11041. Default method is @samp{fdiff}.
  11042. @item scd_threshold
  11043. Scene change detection threshold. Default is @code{10.}.
  11044. @end table
  11045. @section mix
  11046. Mix several video input streams into one video stream.
  11047. A description of the accepted options follows.
  11048. @table @option
  11049. @item nb_inputs
  11050. The number of inputs. If unspecified, it defaults to 2.
  11051. @item weights
  11052. Specify weight of each input video stream as sequence.
  11053. Each weight is separated by space. If number of weights
  11054. is smaller than number of @var{frames} last specified
  11055. weight will be used for all remaining unset weights.
  11056. @item scale
  11057. Specify scale, if it is set it will be multiplied with sum
  11058. of each weight multiplied with pixel values to give final destination
  11059. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11060. @item duration
  11061. Specify how end of stream is determined.
  11062. @table @samp
  11063. @item longest
  11064. The duration of the longest input. (default)
  11065. @item shortest
  11066. The duration of the shortest input.
  11067. @item first
  11068. The duration of the first input.
  11069. @end table
  11070. @end table
  11071. @section mpdecimate
  11072. Drop frames that do not differ greatly from the previous frame in
  11073. order to reduce frame rate.
  11074. The main use of this filter is for very-low-bitrate encoding
  11075. (e.g. streaming over dialup modem), but it could in theory be used for
  11076. fixing movies that were inverse-telecined incorrectly.
  11077. A description of the accepted options follows.
  11078. @table @option
  11079. @item max
  11080. Set the maximum number of consecutive frames which can be dropped (if
  11081. positive), or the minimum interval between dropped frames (if
  11082. negative). If the value is 0, the frame is dropped disregarding the
  11083. number of previous sequentially dropped frames.
  11084. Default value is 0.
  11085. @item hi
  11086. @item lo
  11087. @item frac
  11088. Set the dropping threshold values.
  11089. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  11090. represent actual pixel value differences, so a threshold of 64
  11091. corresponds to 1 unit of difference for each pixel, or the same spread
  11092. out differently over the block.
  11093. A frame is a candidate for dropping if no 8x8 blocks differ by more
  11094. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  11095. meaning the whole image) differ by more than a threshold of @option{lo}.
  11096. Default value for @option{hi} is 64*12, default value for @option{lo} is
  11097. 64*5, and default value for @option{frac} is 0.33.
  11098. @end table
  11099. @section negate
  11100. Negate (invert) the input video.
  11101. It accepts the following option:
  11102. @table @option
  11103. @item negate_alpha
  11104. With value 1, it negates the alpha component, if present. Default value is 0.
  11105. @end table
  11106. @anchor{nlmeans}
  11107. @section nlmeans
  11108. Denoise frames using Non-Local Means algorithm.
  11109. Each pixel is adjusted by looking for other pixels with similar contexts. This
  11110. context similarity is defined by comparing their surrounding patches of size
  11111. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  11112. around the pixel.
  11113. Note that the research area defines centers for patches, which means some
  11114. patches will be made of pixels outside that research area.
  11115. The filter accepts the following options.
  11116. @table @option
  11117. @item s
  11118. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  11119. @item p
  11120. Set patch size. Default is 7. Must be odd number in range [0, 99].
  11121. @item pc
  11122. Same as @option{p} but for chroma planes.
  11123. The default value is @var{0} and means automatic.
  11124. @item r
  11125. Set research size. Default is 15. Must be odd number in range [0, 99].
  11126. @item rc
  11127. Same as @option{r} but for chroma planes.
  11128. The default value is @var{0} and means automatic.
  11129. @end table
  11130. @section nnedi
  11131. Deinterlace video using neural network edge directed interpolation.
  11132. This filter accepts the following options:
  11133. @table @option
  11134. @item weights
  11135. Mandatory option, without binary file filter can not work.
  11136. Currently file can be found here:
  11137. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  11138. @item deint
  11139. Set which frames to deinterlace, by default it is @code{all}.
  11140. Can be @code{all} or @code{interlaced}.
  11141. @item field
  11142. Set mode of operation.
  11143. Can be one of the following:
  11144. @table @samp
  11145. @item af
  11146. Use frame flags, both fields.
  11147. @item a
  11148. Use frame flags, single field.
  11149. @item t
  11150. Use top field only.
  11151. @item b
  11152. Use bottom field only.
  11153. @item tf
  11154. Use both fields, top first.
  11155. @item bf
  11156. Use both fields, bottom first.
  11157. @end table
  11158. @item planes
  11159. Set which planes to process, by default filter process all frames.
  11160. @item nsize
  11161. Set size of local neighborhood around each pixel, used by the predictor neural
  11162. network.
  11163. Can be one of the following:
  11164. @table @samp
  11165. @item s8x6
  11166. @item s16x6
  11167. @item s32x6
  11168. @item s48x6
  11169. @item s8x4
  11170. @item s16x4
  11171. @item s32x4
  11172. @end table
  11173. @item nns
  11174. Set the number of neurons in predictor neural network.
  11175. Can be one of the following:
  11176. @table @samp
  11177. @item n16
  11178. @item n32
  11179. @item n64
  11180. @item n128
  11181. @item n256
  11182. @end table
  11183. @item qual
  11184. Controls the number of different neural network predictions that are blended
  11185. together to compute the final output value. Can be @code{fast}, default or
  11186. @code{slow}.
  11187. @item etype
  11188. Set which set of weights to use in the predictor.
  11189. Can be one of the following:
  11190. @table @samp
  11191. @item a, abs
  11192. weights trained to minimize absolute error
  11193. @item s, mse
  11194. weights trained to minimize squared error
  11195. @end table
  11196. @item pscrn
  11197. Controls whether or not the prescreener neural network is used to decide
  11198. which pixels should be processed by the predictor neural network and which
  11199. can be handled by simple cubic interpolation.
  11200. The prescreener is trained to know whether cubic interpolation will be
  11201. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11202. The computational complexity of the prescreener nn is much less than that of
  11203. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11204. using the prescreener generally results in much faster processing.
  11205. The prescreener is pretty accurate, so the difference between using it and not
  11206. using it is almost always unnoticeable.
  11207. Can be one of the following:
  11208. @table @samp
  11209. @item none
  11210. @item original
  11211. @item new
  11212. @item new2
  11213. @item new3
  11214. @end table
  11215. Default is @code{new}.
  11216. @end table
  11217. @subsection Commands
  11218. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  11219. @section noformat
  11220. Force libavfilter not to use any of the specified pixel formats for the
  11221. input to the next filter.
  11222. It accepts the following parameters:
  11223. @table @option
  11224. @item pix_fmts
  11225. A '|'-separated list of pixel format names, such as
  11226. pix_fmts=yuv420p|monow|rgb24".
  11227. @end table
  11228. @subsection Examples
  11229. @itemize
  11230. @item
  11231. Force libavfilter to use a format different from @var{yuv420p} for the
  11232. input to the vflip filter:
  11233. @example
  11234. noformat=pix_fmts=yuv420p,vflip
  11235. @end example
  11236. @item
  11237. Convert the input video to any of the formats not contained in the list:
  11238. @example
  11239. noformat=yuv420p|yuv444p|yuv410p
  11240. @end example
  11241. @end itemize
  11242. @section noise
  11243. Add noise on video input frame.
  11244. The filter accepts the following options:
  11245. @table @option
  11246. @item all_seed
  11247. @item c0_seed
  11248. @item c1_seed
  11249. @item c2_seed
  11250. @item c3_seed
  11251. Set noise seed for specific pixel component or all pixel components in case
  11252. of @var{all_seed}. Default value is @code{123457}.
  11253. @item all_strength, alls
  11254. @item c0_strength, c0s
  11255. @item c1_strength, c1s
  11256. @item c2_strength, c2s
  11257. @item c3_strength, c3s
  11258. Set noise strength for specific pixel component or all pixel components in case
  11259. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11260. @item all_flags, allf
  11261. @item c0_flags, c0f
  11262. @item c1_flags, c1f
  11263. @item c2_flags, c2f
  11264. @item c3_flags, c3f
  11265. Set pixel component flags or set flags for all components if @var{all_flags}.
  11266. Available values for component flags are:
  11267. @table @samp
  11268. @item a
  11269. averaged temporal noise (smoother)
  11270. @item p
  11271. mix random noise with a (semi)regular pattern
  11272. @item t
  11273. temporal noise (noise pattern changes between frames)
  11274. @item u
  11275. uniform noise (gaussian otherwise)
  11276. @end table
  11277. @end table
  11278. @subsection Examples
  11279. Add temporal and uniform noise to input video:
  11280. @example
  11281. noise=alls=20:allf=t+u
  11282. @end example
  11283. @section normalize
  11284. Normalize RGB video (aka histogram stretching, contrast stretching).
  11285. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11286. For each channel of each frame, the filter computes the input range and maps
  11287. it linearly to the user-specified output range. The output range defaults
  11288. to the full dynamic range from pure black to pure white.
  11289. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11290. changes in brightness) caused when small dark or bright objects enter or leave
  11291. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11292. video camera, and, like a video camera, it may cause a period of over- or
  11293. under-exposure of the video.
  11294. The R,G,B channels can be normalized independently, which may cause some
  11295. color shifting, or linked together as a single channel, which prevents
  11296. color shifting. Linked normalization preserves hue. Independent normalization
  11297. does not, so it can be used to remove some color casts. Independent and linked
  11298. normalization can be combined in any ratio.
  11299. The normalize filter accepts the following options:
  11300. @table @option
  11301. @item blackpt
  11302. @item whitept
  11303. Colors which define the output range. The minimum input value is mapped to
  11304. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11305. The defaults are black and white respectively. Specifying white for
  11306. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11307. normalized video. Shades of grey can be used to reduce the dynamic range
  11308. (contrast). Specifying saturated colors here can create some interesting
  11309. effects.
  11310. @item smoothing
  11311. The number of previous frames to use for temporal smoothing. The input range
  11312. of each channel is smoothed using a rolling average over the current frame
  11313. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11314. smoothing).
  11315. @item independence
  11316. Controls the ratio of independent (color shifting) channel normalization to
  11317. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11318. independent. Defaults to 1.0 (fully independent).
  11319. @item strength
  11320. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11321. expensive no-op. Defaults to 1.0 (full strength).
  11322. @end table
  11323. @subsection Commands
  11324. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11325. The command accepts the same syntax of the corresponding option.
  11326. If the specified expression is not valid, it is kept at its current
  11327. value.
  11328. @subsection Examples
  11329. Stretch video contrast to use the full dynamic range, with no temporal
  11330. smoothing; may flicker depending on the source content:
  11331. @example
  11332. normalize=blackpt=black:whitept=white:smoothing=0
  11333. @end example
  11334. As above, but with 50 frames of temporal smoothing; flicker should be
  11335. reduced, depending on the source content:
  11336. @example
  11337. normalize=blackpt=black:whitept=white:smoothing=50
  11338. @end example
  11339. As above, but with hue-preserving linked channel normalization:
  11340. @example
  11341. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11342. @end example
  11343. As above, but with half strength:
  11344. @example
  11345. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11346. @end example
  11347. Map the darkest input color to red, the brightest input color to cyan:
  11348. @example
  11349. normalize=blackpt=red:whitept=cyan
  11350. @end example
  11351. @section null
  11352. Pass the video source unchanged to the output.
  11353. @section ocr
  11354. Optical Character Recognition
  11355. This filter uses Tesseract for optical character recognition. To enable
  11356. compilation of this filter, you need to configure FFmpeg with
  11357. @code{--enable-libtesseract}.
  11358. It accepts the following options:
  11359. @table @option
  11360. @item datapath
  11361. Set datapath to tesseract data. Default is to use whatever was
  11362. set at installation.
  11363. @item language
  11364. Set language, default is "eng".
  11365. @item whitelist
  11366. Set character whitelist.
  11367. @item blacklist
  11368. Set character blacklist.
  11369. @end table
  11370. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11371. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11372. @section ocv
  11373. Apply a video transform using libopencv.
  11374. To enable this filter, install the libopencv library and headers and
  11375. configure FFmpeg with @code{--enable-libopencv}.
  11376. It accepts the following parameters:
  11377. @table @option
  11378. @item filter_name
  11379. The name of the libopencv filter to apply.
  11380. @item filter_params
  11381. The parameters to pass to the libopencv filter. If not specified, the default
  11382. values are assumed.
  11383. @end table
  11384. Refer to the official libopencv documentation for more precise
  11385. information:
  11386. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11387. Several libopencv filters are supported; see the following subsections.
  11388. @anchor{dilate}
  11389. @subsection dilate
  11390. Dilate an image by using a specific structuring element.
  11391. It corresponds to the libopencv function @code{cvDilate}.
  11392. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11393. @var{struct_el} represents a structuring element, and has the syntax:
  11394. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11395. @var{cols} and @var{rows} represent the number of columns and rows of
  11396. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11397. point, and @var{shape} the shape for the structuring element. @var{shape}
  11398. must be "rect", "cross", "ellipse", or "custom".
  11399. If the value for @var{shape} is "custom", it must be followed by a
  11400. string of the form "=@var{filename}". The file with name
  11401. @var{filename} is assumed to represent a binary image, with each
  11402. printable character corresponding to a bright pixel. When a custom
  11403. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11404. or columns and rows of the read file are assumed instead.
  11405. The default value for @var{struct_el} is "3x3+0x0/rect".
  11406. @var{nb_iterations} specifies the number of times the transform is
  11407. applied to the image, and defaults to 1.
  11408. Some examples:
  11409. @example
  11410. # Use the default values
  11411. ocv=dilate
  11412. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11413. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11414. # Read the shape from the file diamond.shape, iterating two times.
  11415. # The file diamond.shape may contain a pattern of characters like this
  11416. # *
  11417. # ***
  11418. # *****
  11419. # ***
  11420. # *
  11421. # The specified columns and rows are ignored
  11422. # but the anchor point coordinates are not
  11423. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11424. @end example
  11425. @subsection erode
  11426. Erode an image by using a specific structuring element.
  11427. It corresponds to the libopencv function @code{cvErode}.
  11428. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11429. with the same syntax and semantics as the @ref{dilate} filter.
  11430. @subsection smooth
  11431. Smooth the input video.
  11432. The filter takes the following parameters:
  11433. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11434. @var{type} is the type of smooth filter to apply, and must be one of
  11435. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11436. or "bilateral". The default value is "gaussian".
  11437. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11438. depends on the smooth type. @var{param1} and
  11439. @var{param2} accept integer positive values or 0. @var{param3} and
  11440. @var{param4} accept floating point values.
  11441. The default value for @var{param1} is 3. The default value for the
  11442. other parameters is 0.
  11443. These parameters correspond to the parameters assigned to the
  11444. libopencv function @code{cvSmooth}.
  11445. @section oscilloscope
  11446. 2D Video Oscilloscope.
  11447. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11448. It accepts the following parameters:
  11449. @table @option
  11450. @item x
  11451. Set scope center x position.
  11452. @item y
  11453. Set scope center y position.
  11454. @item s
  11455. Set scope size, relative to frame diagonal.
  11456. @item t
  11457. Set scope tilt/rotation.
  11458. @item o
  11459. Set trace opacity.
  11460. @item tx
  11461. Set trace center x position.
  11462. @item ty
  11463. Set trace center y position.
  11464. @item tw
  11465. Set trace width, relative to width of frame.
  11466. @item th
  11467. Set trace height, relative to height of frame.
  11468. @item c
  11469. Set which components to trace. By default it traces first three components.
  11470. @item g
  11471. Draw trace grid. By default is enabled.
  11472. @item st
  11473. Draw some statistics. By default is enabled.
  11474. @item sc
  11475. Draw scope. By default is enabled.
  11476. @end table
  11477. @subsection Commands
  11478. This filter supports same @ref{commands} as options.
  11479. The command accepts the same syntax of the corresponding option.
  11480. If the specified expression is not valid, it is kept at its current
  11481. value.
  11482. @subsection Examples
  11483. @itemize
  11484. @item
  11485. Inspect full first row of video frame.
  11486. @example
  11487. oscilloscope=x=0.5:y=0:s=1
  11488. @end example
  11489. @item
  11490. Inspect full last row of video frame.
  11491. @example
  11492. oscilloscope=x=0.5:y=1:s=1
  11493. @end example
  11494. @item
  11495. Inspect full 5th line of video frame of height 1080.
  11496. @example
  11497. oscilloscope=x=0.5:y=5/1080:s=1
  11498. @end example
  11499. @item
  11500. Inspect full last column of video frame.
  11501. @example
  11502. oscilloscope=x=1:y=0.5:s=1:t=1
  11503. @end example
  11504. @end itemize
  11505. @anchor{overlay}
  11506. @section overlay
  11507. Overlay one video on top of another.
  11508. It takes two inputs and has one output. The first input is the "main"
  11509. video on which the second input is overlaid.
  11510. It accepts the following parameters:
  11511. A description of the accepted options follows.
  11512. @table @option
  11513. @item x
  11514. @item y
  11515. Set the expression for the x and y coordinates of the overlaid video
  11516. on the main video. Default value is "0" for both expressions. In case
  11517. the expression is invalid, it is set to a huge value (meaning that the
  11518. overlay will not be displayed within the output visible area).
  11519. @item eof_action
  11520. See @ref{framesync}.
  11521. @item eval
  11522. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11523. It accepts the following values:
  11524. @table @samp
  11525. @item init
  11526. only evaluate expressions once during the filter initialization or
  11527. when a command is processed
  11528. @item frame
  11529. evaluate expressions for each incoming frame
  11530. @end table
  11531. Default value is @samp{frame}.
  11532. @item shortest
  11533. See @ref{framesync}.
  11534. @item format
  11535. Set the format for the output video.
  11536. It accepts the following values:
  11537. @table @samp
  11538. @item yuv420
  11539. force YUV420 output
  11540. @item yuv420p10
  11541. force YUV420p10 output
  11542. @item yuv422
  11543. force YUV422 output
  11544. @item yuv422p10
  11545. force YUV422p10 output
  11546. @item yuv444
  11547. force YUV444 output
  11548. @item rgb
  11549. force packed RGB output
  11550. @item gbrp
  11551. force planar RGB output
  11552. @item auto
  11553. automatically pick format
  11554. @end table
  11555. Default value is @samp{yuv420}.
  11556. @item repeatlast
  11557. See @ref{framesync}.
  11558. @item alpha
  11559. Set format of alpha of the overlaid video, it can be @var{straight} or
  11560. @var{premultiplied}. Default is @var{straight}.
  11561. @end table
  11562. The @option{x}, and @option{y} expressions can contain the following
  11563. parameters.
  11564. @table @option
  11565. @item main_w, W
  11566. @item main_h, H
  11567. The main input width and height.
  11568. @item overlay_w, w
  11569. @item overlay_h, h
  11570. The overlay input width and height.
  11571. @item x
  11572. @item y
  11573. The computed values for @var{x} and @var{y}. They are evaluated for
  11574. each new frame.
  11575. @item hsub
  11576. @item vsub
  11577. horizontal and vertical chroma subsample values of the output
  11578. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11579. @var{vsub} is 1.
  11580. @item n
  11581. the number of input frame, starting from 0
  11582. @item pos
  11583. the position in the file of the input frame, NAN if unknown
  11584. @item t
  11585. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11586. @end table
  11587. This filter also supports the @ref{framesync} options.
  11588. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11589. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11590. when @option{eval} is set to @samp{init}.
  11591. Be aware that frames are taken from each input video in timestamp
  11592. order, hence, if their initial timestamps differ, it is a good idea
  11593. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11594. have them begin in the same zero timestamp, as the example for
  11595. the @var{movie} filter does.
  11596. You can chain together more overlays but you should test the
  11597. efficiency of such approach.
  11598. @subsection Commands
  11599. This filter supports the following commands:
  11600. @table @option
  11601. @item x
  11602. @item y
  11603. Modify the x and y of the overlay input.
  11604. The command accepts the same syntax of the corresponding option.
  11605. If the specified expression is not valid, it is kept at its current
  11606. value.
  11607. @end table
  11608. @subsection Examples
  11609. @itemize
  11610. @item
  11611. Draw the overlay at 10 pixels from the bottom right corner of the main
  11612. video:
  11613. @example
  11614. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11615. @end example
  11616. Using named options the example above becomes:
  11617. @example
  11618. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11619. @end example
  11620. @item
  11621. Insert a transparent PNG logo in the bottom left corner of the input,
  11622. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11623. @example
  11624. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11625. @end example
  11626. @item
  11627. Insert 2 different transparent PNG logos (second logo on bottom
  11628. right corner) using the @command{ffmpeg} tool:
  11629. @example
  11630. 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
  11631. @end example
  11632. @item
  11633. Add a transparent color layer on top of the main video; @code{WxH}
  11634. must specify the size of the main input to the overlay filter:
  11635. @example
  11636. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11637. @end example
  11638. @item
  11639. Play an original video and a filtered version (here with the deshake
  11640. filter) side by side using the @command{ffplay} tool:
  11641. @example
  11642. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11643. @end example
  11644. The above command is the same as:
  11645. @example
  11646. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11647. @end example
  11648. @item
  11649. Make a sliding overlay appearing from the left to the right top part of the
  11650. screen starting since time 2:
  11651. @example
  11652. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11653. @end example
  11654. @item
  11655. Compose output by putting two input videos side to side:
  11656. @example
  11657. ffmpeg -i left.avi -i right.avi -filter_complex "
  11658. nullsrc=size=200x100 [background];
  11659. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11660. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11661. [background][left] overlay=shortest=1 [background+left];
  11662. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11663. "
  11664. @end example
  11665. @item
  11666. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11667. @example
  11668. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11669. -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]'
  11670. masked.avi
  11671. @end example
  11672. @item
  11673. Chain several overlays in cascade:
  11674. @example
  11675. nullsrc=s=200x200 [bg];
  11676. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11677. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11678. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11679. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11680. [in3] null, [mid2] overlay=100:100 [out0]
  11681. @end example
  11682. @end itemize
  11683. @anchor{overlay_cuda}
  11684. @section overlay_cuda
  11685. Overlay one video on top of another.
  11686. This is the CUDA variant of the @ref{overlay} filter.
  11687. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11688. It takes two inputs and has one output. The first input is the "main"
  11689. video on which the second input is overlaid.
  11690. It accepts the following parameters:
  11691. @table @option
  11692. @item x
  11693. @item y
  11694. Set the x and y coordinates of the overlaid video on the main video.
  11695. Default value is "0" for both expressions.
  11696. @item eof_action
  11697. See @ref{framesync}.
  11698. @item shortest
  11699. See @ref{framesync}.
  11700. @item repeatlast
  11701. See @ref{framesync}.
  11702. @end table
  11703. This filter also supports the @ref{framesync} options.
  11704. @section owdenoise
  11705. Apply Overcomplete Wavelet denoiser.
  11706. The filter accepts the following options:
  11707. @table @option
  11708. @item depth
  11709. Set depth.
  11710. Larger depth values will denoise lower frequency components more, but
  11711. slow down filtering.
  11712. Must be an int in the range 8-16, default is @code{8}.
  11713. @item luma_strength, ls
  11714. Set luma strength.
  11715. Must be a double value in the range 0-1000, default is @code{1.0}.
  11716. @item chroma_strength, cs
  11717. Set chroma strength.
  11718. Must be a double value in the range 0-1000, default is @code{1.0}.
  11719. @end table
  11720. @anchor{pad}
  11721. @section pad
  11722. Add paddings to the input image, and place the original input at the
  11723. provided @var{x}, @var{y} coordinates.
  11724. It accepts the following parameters:
  11725. @table @option
  11726. @item width, w
  11727. @item height, h
  11728. Specify an expression for the size of the output image with the
  11729. paddings added. If the value for @var{width} or @var{height} is 0, the
  11730. corresponding input size is used for the output.
  11731. The @var{width} expression can reference the value set by the
  11732. @var{height} expression, and vice versa.
  11733. The default value of @var{width} and @var{height} is 0.
  11734. @item x
  11735. @item y
  11736. Specify the offsets to place the input image at within the padded area,
  11737. with respect to the top/left border of the output image.
  11738. The @var{x} expression can reference the value set by the @var{y}
  11739. expression, and vice versa.
  11740. The default value of @var{x} and @var{y} is 0.
  11741. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11742. so the input image is centered on the padded area.
  11743. @item color
  11744. Specify the color of the padded area. For the syntax of this option,
  11745. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11746. manual,ffmpeg-utils}.
  11747. The default value of @var{color} is "black".
  11748. @item eval
  11749. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11750. It accepts the following values:
  11751. @table @samp
  11752. @item init
  11753. Only evaluate expressions once during the filter initialization or when
  11754. a command is processed.
  11755. @item frame
  11756. Evaluate expressions for each incoming frame.
  11757. @end table
  11758. Default value is @samp{init}.
  11759. @item aspect
  11760. Pad to aspect instead to a resolution.
  11761. @end table
  11762. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11763. options are expressions containing the following constants:
  11764. @table @option
  11765. @item in_w
  11766. @item in_h
  11767. The input video width and height.
  11768. @item iw
  11769. @item ih
  11770. These are the same as @var{in_w} and @var{in_h}.
  11771. @item out_w
  11772. @item out_h
  11773. The output width and height (the size of the padded area), as
  11774. specified by the @var{width} and @var{height} expressions.
  11775. @item ow
  11776. @item oh
  11777. These are the same as @var{out_w} and @var{out_h}.
  11778. @item x
  11779. @item y
  11780. The x and y offsets as specified by the @var{x} and @var{y}
  11781. expressions, or NAN if not yet specified.
  11782. @item a
  11783. same as @var{iw} / @var{ih}
  11784. @item sar
  11785. input sample aspect ratio
  11786. @item dar
  11787. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11788. @item hsub
  11789. @item vsub
  11790. The horizontal and vertical chroma subsample values. For example for the
  11791. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11792. @end table
  11793. @subsection Examples
  11794. @itemize
  11795. @item
  11796. Add paddings with the color "violet" to the input video. The output video
  11797. size is 640x480, and the top-left corner of the input video is placed at
  11798. column 0, row 40
  11799. @example
  11800. pad=640:480:0:40:violet
  11801. @end example
  11802. The example above is equivalent to the following command:
  11803. @example
  11804. pad=width=640:height=480:x=0:y=40:color=violet
  11805. @end example
  11806. @item
  11807. Pad the input to get an output with dimensions increased by 3/2,
  11808. and put the input video at the center of the padded area:
  11809. @example
  11810. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11811. @end example
  11812. @item
  11813. Pad the input to get a squared output with size equal to the maximum
  11814. value between the input width and height, and put the input video at
  11815. the center of the padded area:
  11816. @example
  11817. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11818. @end example
  11819. @item
  11820. Pad the input to get a final w/h ratio of 16:9:
  11821. @example
  11822. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11823. @end example
  11824. @item
  11825. In case of anamorphic video, in order to set the output display aspect
  11826. correctly, it is necessary to use @var{sar} in the expression,
  11827. according to the relation:
  11828. @example
  11829. (ih * X / ih) * sar = output_dar
  11830. X = output_dar / sar
  11831. @end example
  11832. Thus the previous example needs to be modified to:
  11833. @example
  11834. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11835. @end example
  11836. @item
  11837. Double the output size and put the input video in the bottom-right
  11838. corner of the output padded area:
  11839. @example
  11840. pad="2*iw:2*ih:ow-iw:oh-ih"
  11841. @end example
  11842. @end itemize
  11843. @anchor{palettegen}
  11844. @section palettegen
  11845. Generate one palette for a whole video stream.
  11846. It accepts the following options:
  11847. @table @option
  11848. @item max_colors
  11849. Set the maximum number of colors to quantize in the palette.
  11850. Note: the palette will still contain 256 colors; the unused palette entries
  11851. will be black.
  11852. @item reserve_transparent
  11853. Create a palette of 255 colors maximum and reserve the last one for
  11854. transparency. Reserving the transparency color is useful for GIF optimization.
  11855. If not set, the maximum of colors in the palette will be 256. You probably want
  11856. to disable this option for a standalone image.
  11857. Set by default.
  11858. @item transparency_color
  11859. Set the color that will be used as background for transparency.
  11860. @item stats_mode
  11861. Set statistics mode.
  11862. It accepts the following values:
  11863. @table @samp
  11864. @item full
  11865. Compute full frame histograms.
  11866. @item diff
  11867. Compute histograms only for the part that differs from previous frame. This
  11868. might be relevant to give more importance to the moving part of your input if
  11869. the background is static.
  11870. @item single
  11871. Compute new histogram for each frame.
  11872. @end table
  11873. Default value is @var{full}.
  11874. @end table
  11875. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11876. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11877. color quantization of the palette. This information is also visible at
  11878. @var{info} logging level.
  11879. @subsection Examples
  11880. @itemize
  11881. @item
  11882. Generate a representative palette of a given video using @command{ffmpeg}:
  11883. @example
  11884. ffmpeg -i input.mkv -vf palettegen palette.png
  11885. @end example
  11886. @end itemize
  11887. @section paletteuse
  11888. Use a palette to downsample an input video stream.
  11889. The filter takes two inputs: one video stream and a palette. The palette must
  11890. be a 256 pixels image.
  11891. It accepts the following options:
  11892. @table @option
  11893. @item dither
  11894. Select dithering mode. Available algorithms are:
  11895. @table @samp
  11896. @item bayer
  11897. Ordered 8x8 bayer dithering (deterministic)
  11898. @item heckbert
  11899. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11900. Note: this dithering is sometimes considered "wrong" and is included as a
  11901. reference.
  11902. @item floyd_steinberg
  11903. Floyd and Steingberg dithering (error diffusion)
  11904. @item sierra2
  11905. Frankie Sierra dithering v2 (error diffusion)
  11906. @item sierra2_4a
  11907. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11908. @end table
  11909. Default is @var{sierra2_4a}.
  11910. @item bayer_scale
  11911. When @var{bayer} dithering is selected, this option defines the scale of the
  11912. pattern (how much the crosshatch pattern is visible). A low value means more
  11913. visible pattern for less banding, and higher value means less visible pattern
  11914. at the cost of more banding.
  11915. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11916. @item diff_mode
  11917. If set, define the zone to process
  11918. @table @samp
  11919. @item rectangle
  11920. Only the changing rectangle will be reprocessed. This is similar to GIF
  11921. cropping/offsetting compression mechanism. This option can be useful for speed
  11922. if only a part of the image is changing, and has use cases such as limiting the
  11923. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11924. moving scene (it leads to more deterministic output if the scene doesn't change
  11925. much, and as a result less moving noise and better GIF compression).
  11926. @end table
  11927. Default is @var{none}.
  11928. @item new
  11929. Take new palette for each output frame.
  11930. @item alpha_threshold
  11931. Sets the alpha threshold for transparency. Alpha values above this threshold
  11932. will be treated as completely opaque, and values below this threshold will be
  11933. treated as completely transparent.
  11934. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11935. @end table
  11936. @subsection Examples
  11937. @itemize
  11938. @item
  11939. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11940. using @command{ffmpeg}:
  11941. @example
  11942. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11943. @end example
  11944. @end itemize
  11945. @section perspective
  11946. Correct perspective of video not recorded perpendicular to the screen.
  11947. A description of the accepted parameters follows.
  11948. @table @option
  11949. @item x0
  11950. @item y0
  11951. @item x1
  11952. @item y1
  11953. @item x2
  11954. @item y2
  11955. @item x3
  11956. @item y3
  11957. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11958. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11959. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11960. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11961. then the corners of the source will be sent to the specified coordinates.
  11962. The expressions can use the following variables:
  11963. @table @option
  11964. @item W
  11965. @item H
  11966. the width and height of video frame.
  11967. @item in
  11968. Input frame count.
  11969. @item on
  11970. Output frame count.
  11971. @end table
  11972. @item interpolation
  11973. Set interpolation for perspective correction.
  11974. It accepts the following values:
  11975. @table @samp
  11976. @item linear
  11977. @item cubic
  11978. @end table
  11979. Default value is @samp{linear}.
  11980. @item sense
  11981. Set interpretation of coordinate options.
  11982. It accepts the following values:
  11983. @table @samp
  11984. @item 0, source
  11985. Send point in the source specified by the given coordinates to
  11986. the corners of the destination.
  11987. @item 1, destination
  11988. Send the corners of the source to the point in the destination specified
  11989. by the given coordinates.
  11990. Default value is @samp{source}.
  11991. @end table
  11992. @item eval
  11993. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11994. It accepts the following values:
  11995. @table @samp
  11996. @item init
  11997. only evaluate expressions once during the filter initialization or
  11998. when a command is processed
  11999. @item frame
  12000. evaluate expressions for each incoming frame
  12001. @end table
  12002. Default value is @samp{init}.
  12003. @end table
  12004. @section phase
  12005. Delay interlaced video by one field time so that the field order changes.
  12006. The intended use is to fix PAL movies that have been captured with the
  12007. opposite field order to the film-to-video transfer.
  12008. A description of the accepted parameters follows.
  12009. @table @option
  12010. @item mode
  12011. Set phase mode.
  12012. It accepts the following values:
  12013. @table @samp
  12014. @item t
  12015. Capture field order top-first, transfer bottom-first.
  12016. Filter will delay the bottom field.
  12017. @item b
  12018. Capture field order bottom-first, transfer top-first.
  12019. Filter will delay the top field.
  12020. @item p
  12021. Capture and transfer with the same field order. This mode only exists
  12022. for the documentation of the other options to refer to, but if you
  12023. actually select it, the filter will faithfully do nothing.
  12024. @item a
  12025. Capture field order determined automatically by field flags, transfer
  12026. opposite.
  12027. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  12028. basis using field flags. If no field information is available,
  12029. then this works just like @samp{u}.
  12030. @item u
  12031. Capture unknown or varying, transfer opposite.
  12032. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  12033. analyzing the images and selecting the alternative that produces best
  12034. match between the fields.
  12035. @item T
  12036. Capture top-first, transfer unknown or varying.
  12037. Filter selects among @samp{t} and @samp{p} using image analysis.
  12038. @item B
  12039. Capture bottom-first, transfer unknown or varying.
  12040. Filter selects among @samp{b} and @samp{p} using image analysis.
  12041. @item A
  12042. Capture determined by field flags, transfer unknown or varying.
  12043. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  12044. image analysis. If no field information is available, then this works just
  12045. like @samp{U}. This is the default mode.
  12046. @item U
  12047. Both capture and transfer unknown or varying.
  12048. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  12049. @end table
  12050. @end table
  12051. @subsection Commands
  12052. This filter supports the all above options as @ref{commands}.
  12053. @section photosensitivity
  12054. Reduce various flashes in video, so to help users with epilepsy.
  12055. It accepts the following options:
  12056. @table @option
  12057. @item frames, f
  12058. Set how many frames to use when filtering. Default is 30.
  12059. @item threshold, t
  12060. Set detection threshold factor. Default is 1.
  12061. Lower is stricter.
  12062. @item skip
  12063. Set how many pixels to skip when sampling frames. Default is 1.
  12064. Allowed range is from 1 to 1024.
  12065. @item bypass
  12066. Leave frames unchanged. Default is disabled.
  12067. @end table
  12068. @section pixdesctest
  12069. Pixel format descriptor test filter, mainly useful for internal
  12070. testing. The output video should be equal to the input video.
  12071. For example:
  12072. @example
  12073. format=monow, pixdesctest
  12074. @end example
  12075. can be used to test the monowhite pixel format descriptor definition.
  12076. @section pixscope
  12077. Display sample values of color channels. Mainly useful for checking color
  12078. and levels. Minimum supported resolution is 640x480.
  12079. The filters accept the following options:
  12080. @table @option
  12081. @item x
  12082. Set scope X position, relative offset on X axis.
  12083. @item y
  12084. Set scope Y position, relative offset on Y axis.
  12085. @item w
  12086. Set scope width.
  12087. @item h
  12088. Set scope height.
  12089. @item o
  12090. Set window opacity. This window also holds statistics about pixel area.
  12091. @item wx
  12092. Set window X position, relative offset on X axis.
  12093. @item wy
  12094. Set window Y position, relative offset on Y axis.
  12095. @end table
  12096. @section pp
  12097. Enable the specified chain of postprocessing subfilters using libpostproc. This
  12098. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  12099. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  12100. Each subfilter and some options have a short and a long name that can be used
  12101. interchangeably, i.e. dr/dering are the same.
  12102. The filters accept the following options:
  12103. @table @option
  12104. @item subfilters
  12105. Set postprocessing subfilters string.
  12106. @end table
  12107. All subfilters share common options to determine their scope:
  12108. @table @option
  12109. @item a/autoq
  12110. Honor the quality commands for this subfilter.
  12111. @item c/chrom
  12112. Do chrominance filtering, too (default).
  12113. @item y/nochrom
  12114. Do luminance filtering only (no chrominance).
  12115. @item n/noluma
  12116. Do chrominance filtering only (no luminance).
  12117. @end table
  12118. These options can be appended after the subfilter name, separated by a '|'.
  12119. Available subfilters are:
  12120. @table @option
  12121. @item hb/hdeblock[|difference[|flatness]]
  12122. Horizontal deblocking filter
  12123. @table @option
  12124. @item difference
  12125. Difference factor where higher values mean more deblocking (default: @code{32}).
  12126. @item flatness
  12127. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12128. @end table
  12129. @item vb/vdeblock[|difference[|flatness]]
  12130. Vertical deblocking filter
  12131. @table @option
  12132. @item difference
  12133. Difference factor where higher values mean more deblocking (default: @code{32}).
  12134. @item flatness
  12135. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12136. @end table
  12137. @item ha/hadeblock[|difference[|flatness]]
  12138. Accurate horizontal deblocking filter
  12139. @table @option
  12140. @item difference
  12141. Difference factor where higher values mean more deblocking (default: @code{32}).
  12142. @item flatness
  12143. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12144. @end table
  12145. @item va/vadeblock[|difference[|flatness]]
  12146. Accurate vertical deblocking filter
  12147. @table @option
  12148. @item difference
  12149. Difference factor where higher values mean more deblocking (default: @code{32}).
  12150. @item flatness
  12151. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12152. @end table
  12153. @end table
  12154. The horizontal and vertical deblocking filters share the difference and
  12155. flatness values so you cannot set different horizontal and vertical
  12156. thresholds.
  12157. @table @option
  12158. @item h1/x1hdeblock
  12159. Experimental horizontal deblocking filter
  12160. @item v1/x1vdeblock
  12161. Experimental vertical deblocking filter
  12162. @item dr/dering
  12163. Deringing filter
  12164. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12165. @table @option
  12166. @item threshold1
  12167. larger -> stronger filtering
  12168. @item threshold2
  12169. larger -> stronger filtering
  12170. @item threshold3
  12171. larger -> stronger filtering
  12172. @end table
  12173. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12174. @table @option
  12175. @item f/fullyrange
  12176. Stretch luminance to @code{0-255}.
  12177. @end table
  12178. @item lb/linblenddeint
  12179. Linear blend deinterlacing filter that deinterlaces the given block by
  12180. filtering all lines with a @code{(1 2 1)} filter.
  12181. @item li/linipoldeint
  12182. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12183. linearly interpolating every second line.
  12184. @item ci/cubicipoldeint
  12185. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12186. cubically interpolating every second line.
  12187. @item md/mediandeint
  12188. Median deinterlacing filter that deinterlaces the given block by applying a
  12189. median filter to every second line.
  12190. @item fd/ffmpegdeint
  12191. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12192. second line with a @code{(-1 4 2 4 -1)} filter.
  12193. @item l5/lowpass5
  12194. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12195. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12196. @item fq/forceQuant[|quantizer]
  12197. Overrides the quantizer table from the input with the constant quantizer you
  12198. specify.
  12199. @table @option
  12200. @item quantizer
  12201. Quantizer to use
  12202. @end table
  12203. @item de/default
  12204. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12205. @item fa/fast
  12206. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12207. @item ac
  12208. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12209. @end table
  12210. @subsection Examples
  12211. @itemize
  12212. @item
  12213. Apply horizontal and vertical deblocking, deringing and automatic
  12214. brightness/contrast:
  12215. @example
  12216. pp=hb/vb/dr/al
  12217. @end example
  12218. @item
  12219. Apply default filters without brightness/contrast correction:
  12220. @example
  12221. pp=de/-al
  12222. @end example
  12223. @item
  12224. Apply default filters and temporal denoiser:
  12225. @example
  12226. pp=default/tmpnoise|1|2|3
  12227. @end example
  12228. @item
  12229. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12230. automatically depending on available CPU time:
  12231. @example
  12232. pp=hb|y/vb|a
  12233. @end example
  12234. @end itemize
  12235. @section pp7
  12236. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12237. similar to spp = 6 with 7 point DCT, where only the center sample is
  12238. used after IDCT.
  12239. The filter accepts the following options:
  12240. @table @option
  12241. @item qp
  12242. Force a constant quantization parameter. It accepts an integer in range
  12243. 0 to 63. If not set, the filter will use the QP from the video stream
  12244. (if available).
  12245. @item mode
  12246. Set thresholding mode. Available modes are:
  12247. @table @samp
  12248. @item hard
  12249. Set hard thresholding.
  12250. @item soft
  12251. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12252. @item medium
  12253. Set medium thresholding (good results, default).
  12254. @end table
  12255. @end table
  12256. @section premultiply
  12257. Apply alpha premultiply effect to input video stream using first plane
  12258. of second stream as alpha.
  12259. Both streams must have same dimensions and same pixel format.
  12260. The filter accepts the following option:
  12261. @table @option
  12262. @item planes
  12263. Set which planes will be processed, unprocessed planes will be copied.
  12264. By default value 0xf, all planes will be processed.
  12265. @item inplace
  12266. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12267. @end table
  12268. @section prewitt
  12269. Apply prewitt operator to input video stream.
  12270. The filter accepts the following option:
  12271. @table @option
  12272. @item planes
  12273. Set which planes will be processed, unprocessed planes will be copied.
  12274. By default value 0xf, all planes will be processed.
  12275. @item scale
  12276. Set value which will be multiplied with filtered result.
  12277. @item delta
  12278. Set value which will be added to filtered result.
  12279. @end table
  12280. @subsection Commands
  12281. This filter supports the all above options as @ref{commands}.
  12282. @section pseudocolor
  12283. Alter frame colors in video with pseudocolors.
  12284. This filter accepts the following options:
  12285. @table @option
  12286. @item c0
  12287. set pixel first component expression
  12288. @item c1
  12289. set pixel second component expression
  12290. @item c2
  12291. set pixel third component expression
  12292. @item c3
  12293. set pixel fourth component expression, corresponds to the alpha component
  12294. @item i
  12295. set component to use as base for altering colors
  12296. @end table
  12297. Each of them specifies the expression to use for computing the lookup table for
  12298. the corresponding pixel component values.
  12299. The expressions can contain the following constants and functions:
  12300. @table @option
  12301. @item w
  12302. @item h
  12303. The input width and height.
  12304. @item val
  12305. The input value for the pixel component.
  12306. @item ymin, umin, vmin, amin
  12307. The minimum allowed component value.
  12308. @item ymax, umax, vmax, amax
  12309. The maximum allowed component value.
  12310. @end table
  12311. All expressions default to "val".
  12312. @subsection Examples
  12313. @itemize
  12314. @item
  12315. Change too high luma values to gradient:
  12316. @example
  12317. 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'"
  12318. @end example
  12319. @end itemize
  12320. @section psnr
  12321. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12322. Ratio) between two input videos.
  12323. This filter takes in input two input videos, the first input is
  12324. considered the "main" source and is passed unchanged to the
  12325. output. The second input is used as a "reference" video for computing
  12326. the PSNR.
  12327. Both video inputs must have the same resolution and pixel format for
  12328. this filter to work correctly. Also it assumes that both inputs
  12329. have the same number of frames, which are compared one by one.
  12330. The obtained average PSNR is printed through the logging system.
  12331. The filter stores the accumulated MSE (mean squared error) of each
  12332. frame, and at the end of the processing it is averaged across all frames
  12333. equally, and the following formula is applied to obtain the PSNR:
  12334. @example
  12335. PSNR = 10*log10(MAX^2/MSE)
  12336. @end example
  12337. Where MAX is the average of the maximum values of each component of the
  12338. image.
  12339. The description of the accepted parameters follows.
  12340. @table @option
  12341. @item stats_file, f
  12342. If specified the filter will use the named file to save the PSNR of
  12343. each individual frame. When filename equals "-" the data is sent to
  12344. standard output.
  12345. @item stats_version
  12346. Specifies which version of the stats file format to use. Details of
  12347. each format are written below.
  12348. Default value is 1.
  12349. @item stats_add_max
  12350. Determines whether the max value is output to the stats log.
  12351. Default value is 0.
  12352. Requires stats_version >= 2. If this is set and stats_version < 2,
  12353. the filter will return an error.
  12354. @end table
  12355. This filter also supports the @ref{framesync} options.
  12356. The file printed if @var{stats_file} is selected, contains a sequence of
  12357. key/value pairs of the form @var{key}:@var{value} for each compared
  12358. couple of frames.
  12359. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12360. the list of per-frame-pair stats, with key value pairs following the frame
  12361. format with the following parameters:
  12362. @table @option
  12363. @item psnr_log_version
  12364. The version of the log file format. Will match @var{stats_version}.
  12365. @item fields
  12366. A comma separated list of the per-frame-pair parameters included in
  12367. the log.
  12368. @end table
  12369. A description of each shown per-frame-pair parameter follows:
  12370. @table @option
  12371. @item n
  12372. sequential number of the input frame, starting from 1
  12373. @item mse_avg
  12374. Mean Square Error pixel-by-pixel average difference of the compared
  12375. frames, averaged over all the image components.
  12376. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12377. Mean Square Error pixel-by-pixel average difference of the compared
  12378. frames for the component specified by the suffix.
  12379. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12380. Peak Signal to Noise ratio of the compared frames for the component
  12381. specified by the suffix.
  12382. @item max_avg, max_y, max_u, max_v
  12383. Maximum allowed value for each channel, and average over all
  12384. channels.
  12385. @end table
  12386. @subsection Examples
  12387. @itemize
  12388. @item
  12389. For example:
  12390. @example
  12391. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12392. [main][ref] psnr="stats_file=stats.log" [out]
  12393. @end example
  12394. On this example the input file being processed is compared with the
  12395. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12396. is stored in @file{stats.log}.
  12397. @item
  12398. Another example with different containers:
  12399. @example
  12400. 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 -
  12401. @end example
  12402. @end itemize
  12403. @anchor{pullup}
  12404. @section pullup
  12405. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12406. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12407. content.
  12408. The pullup filter is designed to take advantage of future context in making
  12409. its decisions. This filter is stateless in the sense that it does not lock
  12410. onto a pattern to follow, but it instead looks forward to the following
  12411. fields in order to identify matches and rebuild progressive frames.
  12412. To produce content with an even framerate, insert the fps filter after
  12413. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12414. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12415. The filter accepts the following options:
  12416. @table @option
  12417. @item jl
  12418. @item jr
  12419. @item jt
  12420. @item jb
  12421. These options set the amount of "junk" to ignore at the left, right, top, and
  12422. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12423. while top and bottom are in units of 2 lines.
  12424. The default is 8 pixels on each side.
  12425. @item sb
  12426. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12427. filter generating an occasional mismatched frame, but it may also cause an
  12428. excessive number of frames to be dropped during high motion sequences.
  12429. Conversely, setting it to -1 will make filter match fields more easily.
  12430. This may help processing of video where there is slight blurring between
  12431. the fields, but may also cause there to be interlaced frames in the output.
  12432. Default value is @code{0}.
  12433. @item mp
  12434. Set the metric plane to use. It accepts the following values:
  12435. @table @samp
  12436. @item l
  12437. Use luma plane.
  12438. @item u
  12439. Use chroma blue plane.
  12440. @item v
  12441. Use chroma red plane.
  12442. @end table
  12443. This option may be set to use chroma plane instead of the default luma plane
  12444. for doing filter's computations. This may improve accuracy on very clean
  12445. source material, but more likely will decrease accuracy, especially if there
  12446. is chroma noise (rainbow effect) or any grayscale video.
  12447. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12448. load and make pullup usable in realtime on slow machines.
  12449. @end table
  12450. For best results (without duplicated frames in the output file) it is
  12451. necessary to change the output frame rate. For example, to inverse
  12452. telecine NTSC input:
  12453. @example
  12454. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12455. @end example
  12456. @section qp
  12457. Change video quantization parameters (QP).
  12458. The filter accepts the following option:
  12459. @table @option
  12460. @item qp
  12461. Set expression for quantization parameter.
  12462. @end table
  12463. The expression is evaluated through the eval API and can contain, among others,
  12464. the following constants:
  12465. @table @var
  12466. @item known
  12467. 1 if index is not 129, 0 otherwise.
  12468. @item qp
  12469. Sequential index starting from -129 to 128.
  12470. @end table
  12471. @subsection Examples
  12472. @itemize
  12473. @item
  12474. Some equation like:
  12475. @example
  12476. qp=2+2*sin(PI*qp)
  12477. @end example
  12478. @end itemize
  12479. @section random
  12480. Flush video frames from internal cache of frames into a random order.
  12481. No frame is discarded.
  12482. Inspired by @ref{frei0r} nervous filter.
  12483. @table @option
  12484. @item frames
  12485. Set size in number of frames of internal cache, in range from @code{2} to
  12486. @code{512}. Default is @code{30}.
  12487. @item seed
  12488. Set seed for random number generator, must be an integer included between
  12489. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12490. less than @code{0}, the filter will try to use a good random seed on a
  12491. best effort basis.
  12492. @end table
  12493. @section readeia608
  12494. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12495. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12496. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12497. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12498. @table @option
  12499. @item lavfi.readeia608.X.cc
  12500. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12501. @item lavfi.readeia608.X.line
  12502. The number of the line on which the EIA-608 data was identified and read.
  12503. @end table
  12504. This filter accepts the following options:
  12505. @table @option
  12506. @item scan_min
  12507. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12508. @item scan_max
  12509. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12510. @item spw
  12511. Set the ratio of width reserved for sync code detection.
  12512. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12513. @item chp
  12514. Enable checking the parity bit. In the event of a parity error, the filter will output
  12515. @code{0x00} for that character. Default is false.
  12516. @item lp
  12517. Lowpass lines prior to further processing. Default is enabled.
  12518. @end table
  12519. @subsection Commands
  12520. This filter supports the all above options as @ref{commands}.
  12521. @subsection Examples
  12522. @itemize
  12523. @item
  12524. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12525. @example
  12526. 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
  12527. @end example
  12528. @end itemize
  12529. @section readvitc
  12530. Read vertical interval timecode (VITC) information from the top lines of a
  12531. video frame.
  12532. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12533. timecode value, if a valid timecode has been detected. Further metadata key
  12534. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12535. timecode data has been found or not.
  12536. This filter accepts the following options:
  12537. @table @option
  12538. @item scan_max
  12539. Set the maximum number of lines to scan for VITC data. If the value is set to
  12540. @code{-1} the full video frame is scanned. Default is @code{45}.
  12541. @item thr_b
  12542. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12543. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12544. @item thr_w
  12545. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12546. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12547. @end table
  12548. @subsection Examples
  12549. @itemize
  12550. @item
  12551. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12552. draw @code{--:--:--:--} as a placeholder:
  12553. @example
  12554. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12555. @end example
  12556. @end itemize
  12557. @section remap
  12558. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12559. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12560. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12561. value for pixel will be used for destination pixel.
  12562. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12563. will have Xmap/Ymap video stream dimensions.
  12564. Xmap and Ymap input video streams are 16bit depth, single channel.
  12565. @table @option
  12566. @item format
  12567. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12568. Default is @code{color}.
  12569. @item fill
  12570. Specify the color of the unmapped pixels. For the syntax of this option,
  12571. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12572. manual,ffmpeg-utils}. Default color is @code{black}.
  12573. @end table
  12574. @section removegrain
  12575. The removegrain filter is a spatial denoiser for progressive video.
  12576. @table @option
  12577. @item m0
  12578. Set mode for the first plane.
  12579. @item m1
  12580. Set mode for the second plane.
  12581. @item m2
  12582. Set mode for the third plane.
  12583. @item m3
  12584. Set mode for the fourth plane.
  12585. @end table
  12586. Range of mode is from 0 to 24. Description of each mode follows:
  12587. @table @var
  12588. @item 0
  12589. Leave input plane unchanged. Default.
  12590. @item 1
  12591. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12592. @item 2
  12593. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12594. @item 3
  12595. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12596. @item 4
  12597. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12598. This is equivalent to a median filter.
  12599. @item 5
  12600. Line-sensitive clipping giving the minimal change.
  12601. @item 6
  12602. Line-sensitive clipping, intermediate.
  12603. @item 7
  12604. Line-sensitive clipping, intermediate.
  12605. @item 8
  12606. Line-sensitive clipping, intermediate.
  12607. @item 9
  12608. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12609. @item 10
  12610. Replaces the target pixel with the closest neighbour.
  12611. @item 11
  12612. [1 2 1] horizontal and vertical kernel blur.
  12613. @item 12
  12614. Same as mode 11.
  12615. @item 13
  12616. Bob mode, interpolates top field from the line where the neighbours
  12617. pixels are the closest.
  12618. @item 14
  12619. Bob mode, interpolates bottom field from the line where the neighbours
  12620. pixels are the closest.
  12621. @item 15
  12622. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12623. interpolation formula.
  12624. @item 16
  12625. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12626. interpolation formula.
  12627. @item 17
  12628. Clips the pixel with the minimum and maximum of respectively the maximum and
  12629. minimum of each pair of opposite neighbour pixels.
  12630. @item 18
  12631. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12632. the current pixel is minimal.
  12633. @item 19
  12634. Replaces the pixel with the average of its 8 neighbours.
  12635. @item 20
  12636. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12637. @item 21
  12638. Clips pixels using the averages of opposite neighbour.
  12639. @item 22
  12640. Same as mode 21 but simpler and faster.
  12641. @item 23
  12642. Small edge and halo removal, but reputed useless.
  12643. @item 24
  12644. Similar as 23.
  12645. @end table
  12646. @section removelogo
  12647. Suppress a TV station logo, using an image file to determine which
  12648. pixels comprise the logo. It works by filling in the pixels that
  12649. comprise the logo with neighboring pixels.
  12650. The filter accepts the following options:
  12651. @table @option
  12652. @item filename, f
  12653. Set the filter bitmap file, which can be any image format supported by
  12654. libavformat. The width and height of the image file must match those of the
  12655. video stream being processed.
  12656. @end table
  12657. Pixels in the provided bitmap image with a value of zero are not
  12658. considered part of the logo, non-zero pixels are considered part of
  12659. the logo. If you use white (255) for the logo and black (0) for the
  12660. rest, you will be safe. For making the filter bitmap, it is
  12661. recommended to take a screen capture of a black frame with the logo
  12662. visible, and then using a threshold filter followed by the erode
  12663. filter once or twice.
  12664. If needed, little splotches can be fixed manually. Remember that if
  12665. logo pixels are not covered, the filter quality will be much
  12666. reduced. Marking too many pixels as part of the logo does not hurt as
  12667. much, but it will increase the amount of blurring needed to cover over
  12668. the image and will destroy more information than necessary, and extra
  12669. pixels will slow things down on a large logo.
  12670. @section repeatfields
  12671. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12672. fields based on its value.
  12673. @section reverse
  12674. Reverse a video clip.
  12675. Warning: This filter requires memory to buffer the entire clip, so trimming
  12676. is suggested.
  12677. @subsection Examples
  12678. @itemize
  12679. @item
  12680. Take the first 5 seconds of a clip, and reverse it.
  12681. @example
  12682. trim=end=5,reverse
  12683. @end example
  12684. @end itemize
  12685. @section rgbashift
  12686. Shift R/G/B/A pixels horizontally and/or vertically.
  12687. The filter accepts the following options:
  12688. @table @option
  12689. @item rh
  12690. Set amount to shift red horizontally.
  12691. @item rv
  12692. Set amount to shift red vertically.
  12693. @item gh
  12694. Set amount to shift green horizontally.
  12695. @item gv
  12696. Set amount to shift green vertically.
  12697. @item bh
  12698. Set amount to shift blue horizontally.
  12699. @item bv
  12700. Set amount to shift blue vertically.
  12701. @item ah
  12702. Set amount to shift alpha horizontally.
  12703. @item av
  12704. Set amount to shift alpha vertically.
  12705. @item edge
  12706. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12707. @end table
  12708. @subsection Commands
  12709. This filter supports the all above options as @ref{commands}.
  12710. @section roberts
  12711. Apply roberts cross operator to input video stream.
  12712. The filter accepts the following option:
  12713. @table @option
  12714. @item planes
  12715. Set which planes will be processed, unprocessed planes will be copied.
  12716. By default value 0xf, all planes will be processed.
  12717. @item scale
  12718. Set value which will be multiplied with filtered result.
  12719. @item delta
  12720. Set value which will be added to filtered result.
  12721. @end table
  12722. @subsection Commands
  12723. This filter supports the all above options as @ref{commands}.
  12724. @section rotate
  12725. Rotate video by an arbitrary angle expressed in radians.
  12726. The filter accepts the following options:
  12727. A description of the optional parameters follows.
  12728. @table @option
  12729. @item angle, a
  12730. Set an expression for the angle by which to rotate the input video
  12731. clockwise, expressed as a number of radians. A negative value will
  12732. result in a counter-clockwise rotation. By default it is set to "0".
  12733. This expression is evaluated for each frame.
  12734. @item out_w, ow
  12735. Set the output width expression, default value is "iw".
  12736. This expression is evaluated just once during configuration.
  12737. @item out_h, oh
  12738. Set the output height expression, default value is "ih".
  12739. This expression is evaluated just once during configuration.
  12740. @item bilinear
  12741. Enable bilinear interpolation if set to 1, a value of 0 disables
  12742. it. Default value is 1.
  12743. @item fillcolor, c
  12744. Set the color used to fill the output area not covered by the rotated
  12745. image. For the general syntax of this option, check the
  12746. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12747. If the special value "none" is selected then no
  12748. background is printed (useful for example if the background is never shown).
  12749. Default value is "black".
  12750. @end table
  12751. The expressions for the angle and the output size can contain the
  12752. following constants and functions:
  12753. @table @option
  12754. @item n
  12755. sequential number of the input frame, starting from 0. It is always NAN
  12756. before the first frame is filtered.
  12757. @item t
  12758. time in seconds of the input frame, it is set to 0 when the filter is
  12759. configured. It is always NAN before the first frame is filtered.
  12760. @item hsub
  12761. @item vsub
  12762. horizontal and vertical chroma subsample values. For example for the
  12763. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12764. @item in_w, iw
  12765. @item in_h, ih
  12766. the input video width and height
  12767. @item out_w, ow
  12768. @item out_h, oh
  12769. the output width and height, that is the size of the padded area as
  12770. specified by the @var{width} and @var{height} expressions
  12771. @item rotw(a)
  12772. @item roth(a)
  12773. the minimal width/height required for completely containing the input
  12774. video rotated by @var{a} radians.
  12775. These are only available when computing the @option{out_w} and
  12776. @option{out_h} expressions.
  12777. @end table
  12778. @subsection Examples
  12779. @itemize
  12780. @item
  12781. Rotate the input by PI/6 radians clockwise:
  12782. @example
  12783. rotate=PI/6
  12784. @end example
  12785. @item
  12786. Rotate the input by PI/6 radians counter-clockwise:
  12787. @example
  12788. rotate=-PI/6
  12789. @end example
  12790. @item
  12791. Rotate the input by 45 degrees clockwise:
  12792. @example
  12793. rotate=45*PI/180
  12794. @end example
  12795. @item
  12796. Apply a constant rotation with period T, starting from an angle of PI/3:
  12797. @example
  12798. rotate=PI/3+2*PI*t/T
  12799. @end example
  12800. @item
  12801. Make the input video rotation oscillating with a period of T
  12802. seconds and an amplitude of A radians:
  12803. @example
  12804. rotate=A*sin(2*PI/T*t)
  12805. @end example
  12806. @item
  12807. Rotate the video, output size is chosen so that the whole rotating
  12808. input video is always completely contained in the output:
  12809. @example
  12810. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12811. @end example
  12812. @item
  12813. Rotate the video, reduce the output size so that no background is ever
  12814. shown:
  12815. @example
  12816. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12817. @end example
  12818. @end itemize
  12819. @subsection Commands
  12820. The filter supports the following commands:
  12821. @table @option
  12822. @item a, angle
  12823. Set the angle expression.
  12824. The command accepts the same syntax of the corresponding option.
  12825. If the specified expression is not valid, it is kept at its current
  12826. value.
  12827. @end table
  12828. @section sab
  12829. Apply Shape Adaptive Blur.
  12830. The filter accepts the following options:
  12831. @table @option
  12832. @item luma_radius, lr
  12833. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12834. value is 1.0. A greater value will result in a more blurred image, and
  12835. in slower processing.
  12836. @item luma_pre_filter_radius, lpfr
  12837. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12838. value is 1.0.
  12839. @item luma_strength, ls
  12840. Set luma maximum difference between pixels to still be considered, must
  12841. be a value in the 0.1-100.0 range, default value is 1.0.
  12842. @item chroma_radius, cr
  12843. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12844. greater value will result in a more blurred image, and in slower
  12845. processing.
  12846. @item chroma_pre_filter_radius, cpfr
  12847. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12848. @item chroma_strength, cs
  12849. Set chroma maximum difference between pixels to still be considered,
  12850. must be a value in the -0.9-100.0 range.
  12851. @end table
  12852. Each chroma option value, if not explicitly specified, is set to the
  12853. corresponding luma option value.
  12854. @anchor{scale}
  12855. @section scale
  12856. Scale (resize) the input video, using the libswscale library.
  12857. The scale filter forces the output display aspect ratio to be the same
  12858. of the input, by changing the output sample aspect ratio.
  12859. If the input image format is different from the format requested by
  12860. the next filter, the scale filter will convert the input to the
  12861. requested format.
  12862. @subsection Options
  12863. The filter accepts the following options, or any of the options
  12864. supported by the libswscale scaler.
  12865. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12866. the complete list of scaler options.
  12867. @table @option
  12868. @item width, w
  12869. @item height, h
  12870. Set the output video dimension expression. Default value is the input
  12871. dimension.
  12872. If the @var{width} or @var{w} value is 0, the input width is used for
  12873. the output. If the @var{height} or @var{h} value is 0, the input height
  12874. is used for the output.
  12875. If one and only one of the values is -n with n >= 1, the scale filter
  12876. will use a value that maintains the aspect ratio of the input image,
  12877. calculated from the other specified dimension. After that it will,
  12878. however, make sure that the calculated dimension is divisible by n and
  12879. adjust the value if necessary.
  12880. If both values are -n with n >= 1, the behavior will be identical to
  12881. both values being set to 0 as previously detailed.
  12882. See below for the list of accepted constants for use in the dimension
  12883. expression.
  12884. @item eval
  12885. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12886. @table @samp
  12887. @item init
  12888. Only evaluate expressions once during the filter initialization or when a command is processed.
  12889. @item frame
  12890. Evaluate expressions for each incoming frame.
  12891. @end table
  12892. Default value is @samp{init}.
  12893. @item interl
  12894. Set the interlacing mode. It accepts the following values:
  12895. @table @samp
  12896. @item 1
  12897. Force interlaced aware scaling.
  12898. @item 0
  12899. Do not apply interlaced scaling.
  12900. @item -1
  12901. Select interlaced aware scaling depending on whether the source frames
  12902. are flagged as interlaced or not.
  12903. @end table
  12904. Default value is @samp{0}.
  12905. @item flags
  12906. Set libswscale scaling flags. See
  12907. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12908. complete list of values. If not explicitly specified the filter applies
  12909. the default flags.
  12910. @item param0, param1
  12911. Set libswscale input parameters for scaling algorithms that need them. See
  12912. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12913. complete documentation. If not explicitly specified the filter applies
  12914. empty parameters.
  12915. @item size, s
  12916. Set the video size. For the syntax of this option, check the
  12917. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12918. @item in_color_matrix
  12919. @item out_color_matrix
  12920. Set in/output YCbCr color space type.
  12921. This allows the autodetected value to be overridden as well as allows forcing
  12922. a specific value used for the output and encoder.
  12923. If not specified, the color space type depends on the pixel format.
  12924. Possible values:
  12925. @table @samp
  12926. @item auto
  12927. Choose automatically.
  12928. @item bt709
  12929. Format conforming to International Telecommunication Union (ITU)
  12930. Recommendation BT.709.
  12931. @item fcc
  12932. Set color space conforming to the United States Federal Communications
  12933. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12934. @item bt601
  12935. @item bt470
  12936. @item smpte170m
  12937. Set color space conforming to:
  12938. @itemize
  12939. @item
  12940. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12941. @item
  12942. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12943. @item
  12944. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12945. @end itemize
  12946. @item smpte240m
  12947. Set color space conforming to SMPTE ST 240:1999.
  12948. @item bt2020
  12949. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12950. @end table
  12951. @item in_range
  12952. @item out_range
  12953. Set in/output YCbCr sample range.
  12954. This allows the autodetected value to be overridden as well as allows forcing
  12955. a specific value used for the output and encoder. If not specified, the
  12956. range depends on the pixel format. Possible values:
  12957. @table @samp
  12958. @item auto/unknown
  12959. Choose automatically.
  12960. @item jpeg/full/pc
  12961. Set full range (0-255 in case of 8-bit luma).
  12962. @item mpeg/limited/tv
  12963. Set "MPEG" range (16-235 in case of 8-bit luma).
  12964. @end table
  12965. @item force_original_aspect_ratio
  12966. Enable decreasing or increasing output video width or height if necessary to
  12967. keep the original aspect ratio. Possible values:
  12968. @table @samp
  12969. @item disable
  12970. Scale the video as specified and disable this feature.
  12971. @item decrease
  12972. The output video dimensions will automatically be decreased if needed.
  12973. @item increase
  12974. The output video dimensions will automatically be increased if needed.
  12975. @end table
  12976. One useful instance of this option is that when you know a specific device's
  12977. maximum allowed resolution, you can use this to limit the output video to
  12978. that, while retaining the aspect ratio. For example, device A allows
  12979. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12980. decrease) and specifying 1280x720 to the command line makes the output
  12981. 1280x533.
  12982. Please note that this is a different thing than specifying -1 for @option{w}
  12983. or @option{h}, you still need to specify the output resolution for this option
  12984. to work.
  12985. @item force_divisible_by
  12986. Ensures that both the output dimensions, width and height, are divisible by the
  12987. given integer when used together with @option{force_original_aspect_ratio}. This
  12988. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12989. This option respects the value set for @option{force_original_aspect_ratio},
  12990. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12991. may be slightly modified.
  12992. This option can be handy if you need to have a video fit within or exceed
  12993. a defined resolution using @option{force_original_aspect_ratio} but also have
  12994. encoder restrictions on width or height divisibility.
  12995. @end table
  12996. The values of the @option{w} and @option{h} options are expressions
  12997. containing the following constants:
  12998. @table @var
  12999. @item in_w
  13000. @item in_h
  13001. The input width and height
  13002. @item iw
  13003. @item ih
  13004. These are the same as @var{in_w} and @var{in_h}.
  13005. @item out_w
  13006. @item out_h
  13007. The output (scaled) width and height
  13008. @item ow
  13009. @item oh
  13010. These are the same as @var{out_w} and @var{out_h}
  13011. @item a
  13012. The same as @var{iw} / @var{ih}
  13013. @item sar
  13014. input sample aspect ratio
  13015. @item dar
  13016. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13017. @item hsub
  13018. @item vsub
  13019. horizontal and vertical input chroma subsample values. For example for the
  13020. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13021. @item ohsub
  13022. @item ovsub
  13023. horizontal and vertical output chroma subsample values. For example for the
  13024. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13025. @item n
  13026. The (sequential) number of the input frame, starting from 0.
  13027. Only available with @code{eval=frame}.
  13028. @item t
  13029. The presentation timestamp of the input frame, expressed as a number of
  13030. seconds. Only available with @code{eval=frame}.
  13031. @item pos
  13032. The position (byte offset) of the frame in the input stream, or NaN if
  13033. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13034. Only available with @code{eval=frame}.
  13035. @end table
  13036. @subsection Examples
  13037. @itemize
  13038. @item
  13039. Scale the input video to a size of 200x100
  13040. @example
  13041. scale=w=200:h=100
  13042. @end example
  13043. This is equivalent to:
  13044. @example
  13045. scale=200:100
  13046. @end example
  13047. or:
  13048. @example
  13049. scale=200x100
  13050. @end example
  13051. @item
  13052. Specify a size abbreviation for the output size:
  13053. @example
  13054. scale=qcif
  13055. @end example
  13056. which can also be written as:
  13057. @example
  13058. scale=size=qcif
  13059. @end example
  13060. @item
  13061. Scale the input to 2x:
  13062. @example
  13063. scale=w=2*iw:h=2*ih
  13064. @end example
  13065. @item
  13066. The above is the same as:
  13067. @example
  13068. scale=2*in_w:2*in_h
  13069. @end example
  13070. @item
  13071. Scale the input to 2x with forced interlaced scaling:
  13072. @example
  13073. scale=2*iw:2*ih:interl=1
  13074. @end example
  13075. @item
  13076. Scale the input to half size:
  13077. @example
  13078. scale=w=iw/2:h=ih/2
  13079. @end example
  13080. @item
  13081. Increase the width, and set the height to the same size:
  13082. @example
  13083. scale=3/2*iw:ow
  13084. @end example
  13085. @item
  13086. Seek Greek harmony:
  13087. @example
  13088. scale=iw:1/PHI*iw
  13089. scale=ih*PHI:ih
  13090. @end example
  13091. @item
  13092. Increase the height, and set the width to 3/2 of the height:
  13093. @example
  13094. scale=w=3/2*oh:h=3/5*ih
  13095. @end example
  13096. @item
  13097. Increase the size, making the size a multiple of the chroma
  13098. subsample values:
  13099. @example
  13100. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  13101. @end example
  13102. @item
  13103. Increase the width to a maximum of 500 pixels,
  13104. keeping the same aspect ratio as the input:
  13105. @example
  13106. scale=w='min(500\, iw*3/2):h=-1'
  13107. @end example
  13108. @item
  13109. Make pixels square by combining scale and setsar:
  13110. @example
  13111. scale='trunc(ih*dar):ih',setsar=1/1
  13112. @end example
  13113. @item
  13114. Make pixels square by combining scale and setsar,
  13115. making sure the resulting resolution is even (required by some codecs):
  13116. @example
  13117. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  13118. @end example
  13119. @end itemize
  13120. @subsection Commands
  13121. This filter supports the following commands:
  13122. @table @option
  13123. @item width, w
  13124. @item height, h
  13125. Set the output video dimension expression.
  13126. The command accepts the same syntax of the corresponding option.
  13127. If the specified expression is not valid, it is kept at its current
  13128. value.
  13129. @end table
  13130. @section scale_npp
  13131. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  13132. format conversion on CUDA video frames. Setting the output width and height
  13133. works in the same way as for the @var{scale} filter.
  13134. The following additional options are accepted:
  13135. @table @option
  13136. @item format
  13137. The pixel format of the output CUDA frames. If set to the string "same" (the
  13138. default), the input format will be kept. Note that automatic format negotiation
  13139. and conversion is not yet supported for hardware frames
  13140. @item interp_algo
  13141. The interpolation algorithm used for resizing. One of the following:
  13142. @table @option
  13143. @item nn
  13144. Nearest neighbour.
  13145. @item linear
  13146. @item cubic
  13147. @item cubic2p_bspline
  13148. 2-parameter cubic (B=1, C=0)
  13149. @item cubic2p_catmullrom
  13150. 2-parameter cubic (B=0, C=1/2)
  13151. @item cubic2p_b05c03
  13152. 2-parameter cubic (B=1/2, C=3/10)
  13153. @item super
  13154. Supersampling
  13155. @item lanczos
  13156. @end table
  13157. @item force_original_aspect_ratio
  13158. Enable decreasing or increasing output video width or height if necessary to
  13159. keep the original aspect ratio. Possible values:
  13160. @table @samp
  13161. @item disable
  13162. Scale the video as specified and disable this feature.
  13163. @item decrease
  13164. The output video dimensions will automatically be decreased if needed.
  13165. @item increase
  13166. The output video dimensions will automatically be increased if needed.
  13167. @end table
  13168. One useful instance of this option is that when you know a specific device's
  13169. maximum allowed resolution, you can use this to limit the output video to
  13170. that, while retaining the aspect ratio. For example, device A allows
  13171. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13172. decrease) and specifying 1280x720 to the command line makes the output
  13173. 1280x533.
  13174. Please note that this is a different thing than specifying -1 for @option{w}
  13175. or @option{h}, you still need to specify the output resolution for this option
  13176. to work.
  13177. @item force_divisible_by
  13178. Ensures that both the output dimensions, width and height, are divisible by the
  13179. given integer when used together with @option{force_original_aspect_ratio}. This
  13180. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13181. This option respects the value set for @option{force_original_aspect_ratio},
  13182. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13183. may be slightly modified.
  13184. This option can be handy if you need to have a video fit within or exceed
  13185. a defined resolution using @option{force_original_aspect_ratio} but also have
  13186. encoder restrictions on width or height divisibility.
  13187. @end table
  13188. @section scale2ref
  13189. Scale (resize) the input video, based on a reference video.
  13190. See the scale filter for available options, scale2ref supports the same but
  13191. uses the reference video instead of the main input as basis. scale2ref also
  13192. supports the following additional constants for the @option{w} and
  13193. @option{h} options:
  13194. @table @var
  13195. @item main_w
  13196. @item main_h
  13197. The main input video's width and height
  13198. @item main_a
  13199. The same as @var{main_w} / @var{main_h}
  13200. @item main_sar
  13201. The main input video's sample aspect ratio
  13202. @item main_dar, mdar
  13203. The main input video's display aspect ratio. Calculated from
  13204. @code{(main_w / main_h) * main_sar}.
  13205. @item main_hsub
  13206. @item main_vsub
  13207. The main input video's horizontal and vertical chroma subsample values.
  13208. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13209. is 1.
  13210. @item main_n
  13211. The (sequential) number of the main input frame, starting from 0.
  13212. Only available with @code{eval=frame}.
  13213. @item main_t
  13214. The presentation timestamp of the main input frame, expressed as a number of
  13215. seconds. Only available with @code{eval=frame}.
  13216. @item main_pos
  13217. The position (byte offset) of the frame in the main input stream, or NaN if
  13218. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13219. Only available with @code{eval=frame}.
  13220. @end table
  13221. @subsection Examples
  13222. @itemize
  13223. @item
  13224. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13225. @example
  13226. 'scale2ref[b][a];[a][b]overlay'
  13227. @end example
  13228. @item
  13229. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13230. @example
  13231. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13232. @end example
  13233. @end itemize
  13234. @subsection Commands
  13235. This filter supports the following commands:
  13236. @table @option
  13237. @item width, w
  13238. @item height, h
  13239. Set the output video dimension expression.
  13240. The command accepts the same syntax of the corresponding option.
  13241. If the specified expression is not valid, it is kept at its current
  13242. value.
  13243. @end table
  13244. @section scroll
  13245. Scroll input video horizontally and/or vertically by constant speed.
  13246. The filter accepts the following options:
  13247. @table @option
  13248. @item horizontal, h
  13249. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13250. Negative values changes scrolling direction.
  13251. @item vertical, v
  13252. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13253. Negative values changes scrolling direction.
  13254. @item hpos
  13255. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13256. @item vpos
  13257. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13258. @end table
  13259. @subsection Commands
  13260. This filter supports the following @ref{commands}:
  13261. @table @option
  13262. @item horizontal, h
  13263. Set the horizontal scrolling speed.
  13264. @item vertical, v
  13265. Set the vertical scrolling speed.
  13266. @end table
  13267. @anchor{scdet}
  13268. @section scdet
  13269. Detect video scene change.
  13270. This filter sets frame metadata with mafd between frame, the scene score, and
  13271. forward the frame to the next filter, so they can use these metadata to detect
  13272. scene change or others.
  13273. In addition, this filter logs a message and sets frame metadata when it detects
  13274. a scene change by @option{threshold}.
  13275. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13276. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13277. to detect scene change.
  13278. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13279. detect scene change with @option{threshold}.
  13280. The filter accepts the following options:
  13281. @table @option
  13282. @item threshold, t
  13283. Set the scene change detection threshold as a percentage of maximum change. Good
  13284. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13285. @code{[0., 100.]}.
  13286. Default value is @code{10.}.
  13287. @item sc_pass, s
  13288. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13289. You can enable it if you want to get snapshot of scene change frames only.
  13290. @end table
  13291. @anchor{selectivecolor}
  13292. @section selectivecolor
  13293. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13294. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13295. by the "purity" of the color (that is, how saturated it already is).
  13296. This filter is similar to the Adobe Photoshop Selective Color tool.
  13297. The filter accepts the following options:
  13298. @table @option
  13299. @item correction_method
  13300. Select color correction method.
  13301. Available values are:
  13302. @table @samp
  13303. @item absolute
  13304. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13305. component value).
  13306. @item relative
  13307. Specified adjustments are relative to the original component value.
  13308. @end table
  13309. Default is @code{absolute}.
  13310. @item reds
  13311. Adjustments for red pixels (pixels where the red component is the maximum)
  13312. @item yellows
  13313. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13314. @item greens
  13315. Adjustments for green pixels (pixels where the green component is the maximum)
  13316. @item cyans
  13317. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13318. @item blues
  13319. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13320. @item magentas
  13321. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13322. @item whites
  13323. Adjustments for white pixels (pixels where all components are greater than 128)
  13324. @item neutrals
  13325. Adjustments for all pixels except pure black and pure white
  13326. @item blacks
  13327. Adjustments for black pixels (pixels where all components are lesser than 128)
  13328. @item psfile
  13329. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13330. @end table
  13331. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13332. 4 space separated floating point adjustment values in the [-1,1] range,
  13333. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13334. pixels of its range.
  13335. @subsection Examples
  13336. @itemize
  13337. @item
  13338. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13339. increase magenta by 27% in blue areas:
  13340. @example
  13341. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13342. @end example
  13343. @item
  13344. Use a Photoshop selective color preset:
  13345. @example
  13346. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13347. @end example
  13348. @end itemize
  13349. @anchor{separatefields}
  13350. @section separatefields
  13351. The @code{separatefields} takes a frame-based video input and splits
  13352. each frame into its components fields, producing a new half height clip
  13353. with twice the frame rate and twice the frame count.
  13354. This filter use field-dominance information in frame to decide which
  13355. of each pair of fields to place first in the output.
  13356. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13357. @section setdar, setsar
  13358. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13359. output video.
  13360. This is done by changing the specified Sample (aka Pixel) Aspect
  13361. Ratio, according to the following equation:
  13362. @example
  13363. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13364. @end example
  13365. Keep in mind that the @code{setdar} filter does not modify the pixel
  13366. dimensions of the video frame. Also, the display aspect ratio set by
  13367. this filter may be changed by later filters in the filterchain,
  13368. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13369. applied.
  13370. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13371. the filter output video.
  13372. Note that as a consequence of the application of this filter, the
  13373. output display aspect ratio will change according to the equation
  13374. above.
  13375. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13376. filter may be changed by later filters in the filterchain, e.g. if
  13377. another "setsar" or a "setdar" filter is applied.
  13378. It accepts the following parameters:
  13379. @table @option
  13380. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13381. Set the aspect ratio used by the filter.
  13382. The parameter can be a floating point number string, an expression, or
  13383. a string of the form @var{num}:@var{den}, where @var{num} and
  13384. @var{den} are the numerator and denominator of the aspect ratio. If
  13385. the parameter is not specified, it is assumed the value "0".
  13386. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13387. should be escaped.
  13388. @item max
  13389. Set the maximum integer value to use for expressing numerator and
  13390. denominator when reducing the expressed aspect ratio to a rational.
  13391. Default value is @code{100}.
  13392. @end table
  13393. The parameter @var{sar} is an expression containing
  13394. the following constants:
  13395. @table @option
  13396. @item E, PI, PHI
  13397. These are approximated values for the mathematical constants e
  13398. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13399. @item w, h
  13400. The input width and height.
  13401. @item a
  13402. These are the same as @var{w} / @var{h}.
  13403. @item sar
  13404. The input sample aspect ratio.
  13405. @item dar
  13406. The input display aspect ratio. It is the same as
  13407. (@var{w} / @var{h}) * @var{sar}.
  13408. @item hsub, vsub
  13409. Horizontal and vertical chroma subsample values. For example, for the
  13410. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13411. @end table
  13412. @subsection Examples
  13413. @itemize
  13414. @item
  13415. To change the display aspect ratio to 16:9, specify one of the following:
  13416. @example
  13417. setdar=dar=1.77777
  13418. setdar=dar=16/9
  13419. @end example
  13420. @item
  13421. To change the sample aspect ratio to 10:11, specify:
  13422. @example
  13423. setsar=sar=10/11
  13424. @end example
  13425. @item
  13426. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13427. 1000 in the aspect ratio reduction, use the command:
  13428. @example
  13429. setdar=ratio=16/9:max=1000
  13430. @end example
  13431. @end itemize
  13432. @anchor{setfield}
  13433. @section setfield
  13434. Force field for the output video frame.
  13435. The @code{setfield} filter marks the interlace type field for the
  13436. output frames. It does not change the input frame, but only sets the
  13437. corresponding property, which affects how the frame is treated by
  13438. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13439. The filter accepts the following options:
  13440. @table @option
  13441. @item mode
  13442. Available values are:
  13443. @table @samp
  13444. @item auto
  13445. Keep the same field property.
  13446. @item bff
  13447. Mark the frame as bottom-field-first.
  13448. @item tff
  13449. Mark the frame as top-field-first.
  13450. @item prog
  13451. Mark the frame as progressive.
  13452. @end table
  13453. @end table
  13454. @anchor{setparams}
  13455. @section setparams
  13456. Force frame parameter for the output video frame.
  13457. The @code{setparams} filter marks interlace and color range for the
  13458. output frames. It does not change the input frame, but only sets the
  13459. corresponding property, which affects how the frame is treated by
  13460. filters/encoders.
  13461. @table @option
  13462. @item field_mode
  13463. Available values are:
  13464. @table @samp
  13465. @item auto
  13466. Keep the same field property (default).
  13467. @item bff
  13468. Mark the frame as bottom-field-first.
  13469. @item tff
  13470. Mark the frame as top-field-first.
  13471. @item prog
  13472. Mark the frame as progressive.
  13473. @end table
  13474. @item range
  13475. Available values are:
  13476. @table @samp
  13477. @item auto
  13478. Keep the same color range property (default).
  13479. @item unspecified, unknown
  13480. Mark the frame as unspecified color range.
  13481. @item limited, tv, mpeg
  13482. Mark the frame as limited range.
  13483. @item full, pc, jpeg
  13484. Mark the frame as full range.
  13485. @end table
  13486. @item color_primaries
  13487. Set the color primaries.
  13488. Available values are:
  13489. @table @samp
  13490. @item auto
  13491. Keep the same color primaries property (default).
  13492. @item bt709
  13493. @item unknown
  13494. @item bt470m
  13495. @item bt470bg
  13496. @item smpte170m
  13497. @item smpte240m
  13498. @item film
  13499. @item bt2020
  13500. @item smpte428
  13501. @item smpte431
  13502. @item smpte432
  13503. @item jedec-p22
  13504. @end table
  13505. @item color_trc
  13506. Set the color transfer.
  13507. Available values are:
  13508. @table @samp
  13509. @item auto
  13510. Keep the same color trc property (default).
  13511. @item bt709
  13512. @item unknown
  13513. @item bt470m
  13514. @item bt470bg
  13515. @item smpte170m
  13516. @item smpte240m
  13517. @item linear
  13518. @item log100
  13519. @item log316
  13520. @item iec61966-2-4
  13521. @item bt1361e
  13522. @item iec61966-2-1
  13523. @item bt2020-10
  13524. @item bt2020-12
  13525. @item smpte2084
  13526. @item smpte428
  13527. @item arib-std-b67
  13528. @end table
  13529. @item colorspace
  13530. Set the colorspace.
  13531. Available values are:
  13532. @table @samp
  13533. @item auto
  13534. Keep the same colorspace property (default).
  13535. @item gbr
  13536. @item bt709
  13537. @item unknown
  13538. @item fcc
  13539. @item bt470bg
  13540. @item smpte170m
  13541. @item smpte240m
  13542. @item ycgco
  13543. @item bt2020nc
  13544. @item bt2020c
  13545. @item smpte2085
  13546. @item chroma-derived-nc
  13547. @item chroma-derived-c
  13548. @item ictcp
  13549. @end table
  13550. @end table
  13551. @section showinfo
  13552. Show a line containing various information for each input video frame.
  13553. The input video is not modified.
  13554. This filter supports the following options:
  13555. @table @option
  13556. @item checksum
  13557. Calculate checksums of each plane. By default enabled.
  13558. @end table
  13559. The shown line contains a sequence of key/value pairs of the form
  13560. @var{key}:@var{value}.
  13561. The following values are shown in the output:
  13562. @table @option
  13563. @item n
  13564. The (sequential) number of the input frame, starting from 0.
  13565. @item pts
  13566. The Presentation TimeStamp of the input frame, expressed as a number of
  13567. time base units. The time base unit depends on the filter input pad.
  13568. @item pts_time
  13569. The Presentation TimeStamp of the input frame, expressed as a number of
  13570. seconds.
  13571. @item pos
  13572. The position of the frame in the input stream, or -1 if this information is
  13573. unavailable and/or meaningless (for example in case of synthetic video).
  13574. @item fmt
  13575. The pixel format name.
  13576. @item sar
  13577. The sample aspect ratio of the input frame, expressed in the form
  13578. @var{num}/@var{den}.
  13579. @item s
  13580. The size of the input frame. For the syntax of this option, check the
  13581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13582. @item i
  13583. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13584. for bottom field first).
  13585. @item iskey
  13586. This is 1 if the frame is a key frame, 0 otherwise.
  13587. @item type
  13588. The picture type of the input frame ("I" for an I-frame, "P" for a
  13589. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13590. Also refer to the documentation of the @code{AVPictureType} enum and of
  13591. the @code{av_get_picture_type_char} function defined in
  13592. @file{libavutil/avutil.h}.
  13593. @item checksum
  13594. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13595. @item plane_checksum
  13596. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13597. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13598. @item mean
  13599. The mean value of pixels in each plane of the input frame, expressed in the form
  13600. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13601. @item stdev
  13602. The standard deviation of pixel values in each plane of the input frame, expressed
  13603. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13604. @end table
  13605. @section showpalette
  13606. Displays the 256 colors palette of each frame. This filter is only relevant for
  13607. @var{pal8} pixel format frames.
  13608. It accepts the following option:
  13609. @table @option
  13610. @item s
  13611. Set the size of the box used to represent one palette color entry. Default is
  13612. @code{30} (for a @code{30x30} pixel box).
  13613. @end table
  13614. @section shuffleframes
  13615. Reorder and/or duplicate and/or drop video frames.
  13616. It accepts the following parameters:
  13617. @table @option
  13618. @item mapping
  13619. Set the destination indexes of input frames.
  13620. This is space or '|' separated list of indexes that maps input frames to output
  13621. frames. Number of indexes also sets maximal value that each index may have.
  13622. '-1' index have special meaning and that is to drop frame.
  13623. @end table
  13624. The first frame has the index 0. The default is to keep the input unchanged.
  13625. @subsection Examples
  13626. @itemize
  13627. @item
  13628. Swap second and third frame of every three frames of the input:
  13629. @example
  13630. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13631. @end example
  13632. @item
  13633. Swap 10th and 1st frame of every ten frames of the input:
  13634. @example
  13635. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13636. @end example
  13637. @end itemize
  13638. @section shufflepixels
  13639. Reorder pixels in video frames.
  13640. This filter accepts the following options:
  13641. @table @option
  13642. @item direction, d
  13643. Set shuffle direction. Can be forward or inverse direction.
  13644. Default direction is forward.
  13645. @item mode, m
  13646. Set shuffle mode. Can be horizontal, vertical or block mode.
  13647. @item width, w
  13648. @item height, h
  13649. Set shuffle block_size. In case of horizontal shuffle mode only width
  13650. part of size is used, and in case of vertical shuffle mode only height
  13651. part of size is used.
  13652. @item seed, s
  13653. Set random seed used with shuffling pixels. Mainly useful to set to be able
  13654. to reverse filtering process to get original input.
  13655. For example, to reverse forward shuffle you need to use same parameters
  13656. and exact same seed and to set direction to inverse.
  13657. @end table
  13658. @section shuffleplanes
  13659. Reorder and/or duplicate video planes.
  13660. It accepts the following parameters:
  13661. @table @option
  13662. @item map0
  13663. The index of the input plane to be used as the first output plane.
  13664. @item map1
  13665. The index of the input plane to be used as the second output plane.
  13666. @item map2
  13667. The index of the input plane to be used as the third output plane.
  13668. @item map3
  13669. The index of the input plane to be used as the fourth output plane.
  13670. @end table
  13671. The first plane has the index 0. The default is to keep the input unchanged.
  13672. @subsection Examples
  13673. @itemize
  13674. @item
  13675. Swap the second and third planes of the input:
  13676. @example
  13677. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13678. @end example
  13679. @end itemize
  13680. @anchor{signalstats}
  13681. @section signalstats
  13682. Evaluate various visual metrics that assist in determining issues associated
  13683. with the digitization of analog video media.
  13684. By default the filter will log these metadata values:
  13685. @table @option
  13686. @item YMIN
  13687. Display the minimal Y value contained within the input frame. Expressed in
  13688. range of [0-255].
  13689. @item YLOW
  13690. Display the Y value at the 10% percentile within the input frame. Expressed in
  13691. range of [0-255].
  13692. @item YAVG
  13693. Display the average Y value within the input frame. Expressed in range of
  13694. [0-255].
  13695. @item YHIGH
  13696. Display the Y value at the 90% percentile within the input frame. Expressed in
  13697. range of [0-255].
  13698. @item YMAX
  13699. Display the maximum Y value contained within the input frame. Expressed in
  13700. range of [0-255].
  13701. @item UMIN
  13702. Display the minimal U value contained within the input frame. Expressed in
  13703. range of [0-255].
  13704. @item ULOW
  13705. Display the U value at the 10% percentile within the input frame. Expressed in
  13706. range of [0-255].
  13707. @item UAVG
  13708. Display the average U value within the input frame. Expressed in range of
  13709. [0-255].
  13710. @item UHIGH
  13711. Display the U value at the 90% percentile within the input frame. Expressed in
  13712. range of [0-255].
  13713. @item UMAX
  13714. Display the maximum U value contained within the input frame. Expressed in
  13715. range of [0-255].
  13716. @item VMIN
  13717. Display the minimal V value contained within the input frame. Expressed in
  13718. range of [0-255].
  13719. @item VLOW
  13720. Display the V value at the 10% percentile within the input frame. Expressed in
  13721. range of [0-255].
  13722. @item VAVG
  13723. Display the average V value within the input frame. Expressed in range of
  13724. [0-255].
  13725. @item VHIGH
  13726. Display the V value at the 90% percentile within the input frame. Expressed in
  13727. range of [0-255].
  13728. @item VMAX
  13729. Display the maximum V value contained within the input frame. Expressed in
  13730. range of [0-255].
  13731. @item SATMIN
  13732. Display the minimal saturation value contained within the input frame.
  13733. Expressed in range of [0-~181.02].
  13734. @item SATLOW
  13735. Display the saturation value at the 10% percentile within the input frame.
  13736. Expressed in range of [0-~181.02].
  13737. @item SATAVG
  13738. Display the average saturation value within the input frame. Expressed in range
  13739. of [0-~181.02].
  13740. @item SATHIGH
  13741. Display the saturation value at the 90% percentile within the input frame.
  13742. Expressed in range of [0-~181.02].
  13743. @item SATMAX
  13744. Display the maximum saturation value contained within the input frame.
  13745. Expressed in range of [0-~181.02].
  13746. @item HUEMED
  13747. Display the median value for hue within the input frame. Expressed in range of
  13748. [0-360].
  13749. @item HUEAVG
  13750. Display the average value for hue within the input frame. Expressed in range of
  13751. [0-360].
  13752. @item YDIF
  13753. Display the average of sample value difference between all values of the Y
  13754. plane in the current frame and corresponding values of the previous input frame.
  13755. Expressed in range of [0-255].
  13756. @item UDIF
  13757. Display the average of sample value difference between all values of the U
  13758. plane in the current frame and corresponding values of the previous input frame.
  13759. Expressed in range of [0-255].
  13760. @item VDIF
  13761. Display the average of sample value difference between all values of the V
  13762. plane in the current frame and corresponding values of the previous input frame.
  13763. Expressed in range of [0-255].
  13764. @item YBITDEPTH
  13765. Display bit depth of Y plane in current frame.
  13766. Expressed in range of [0-16].
  13767. @item UBITDEPTH
  13768. Display bit depth of U plane in current frame.
  13769. Expressed in range of [0-16].
  13770. @item VBITDEPTH
  13771. Display bit depth of V plane in current frame.
  13772. Expressed in range of [0-16].
  13773. @end table
  13774. The filter accepts the following options:
  13775. @table @option
  13776. @item stat
  13777. @item out
  13778. @option{stat} specify an additional form of image analysis.
  13779. @option{out} output video with the specified type of pixel highlighted.
  13780. Both options accept the following values:
  13781. @table @samp
  13782. @item tout
  13783. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13784. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13785. include the results of video dropouts, head clogs, or tape tracking issues.
  13786. @item vrep
  13787. Identify @var{vertical line repetition}. Vertical line repetition includes
  13788. similar rows of pixels within a frame. In born-digital video vertical line
  13789. repetition is common, but this pattern is uncommon in video digitized from an
  13790. analog source. When it occurs in video that results from the digitization of an
  13791. analog source it can indicate concealment from a dropout compensator.
  13792. @item brng
  13793. Identify pixels that fall outside of legal broadcast range.
  13794. @end table
  13795. @item color, c
  13796. Set the highlight color for the @option{out} option. The default color is
  13797. yellow.
  13798. @end table
  13799. @subsection Examples
  13800. @itemize
  13801. @item
  13802. Output data of various video metrics:
  13803. @example
  13804. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13805. @end example
  13806. @item
  13807. Output specific data about the minimum and maximum values of the Y plane per frame:
  13808. @example
  13809. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13810. @end example
  13811. @item
  13812. Playback video while highlighting pixels that are outside of broadcast range in red.
  13813. @example
  13814. ffplay example.mov -vf signalstats="out=brng:color=red"
  13815. @end example
  13816. @item
  13817. Playback video with signalstats metadata drawn over the frame.
  13818. @example
  13819. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13820. @end example
  13821. The contents of signalstat_drawtext.txt used in the command are:
  13822. @example
  13823. time %@{pts:hms@}
  13824. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13825. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13826. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13827. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13828. @end example
  13829. @end itemize
  13830. @anchor{signature}
  13831. @section signature
  13832. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13833. input. In this case the matching between the inputs can be calculated additionally.
  13834. The filter always passes through the first input. The signature of each stream can
  13835. be written into a file.
  13836. It accepts the following options:
  13837. @table @option
  13838. @item detectmode
  13839. Enable or disable the matching process.
  13840. Available values are:
  13841. @table @samp
  13842. @item off
  13843. Disable the calculation of a matching (default).
  13844. @item full
  13845. Calculate the matching for the whole video and output whether the whole video
  13846. matches or only parts.
  13847. @item fast
  13848. Calculate only until a matching is found or the video ends. Should be faster in
  13849. some cases.
  13850. @end table
  13851. @item nb_inputs
  13852. Set the number of inputs. The option value must be a non negative integer.
  13853. Default value is 1.
  13854. @item filename
  13855. Set the path to which the output is written. If there is more than one input,
  13856. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13857. integer), that will be replaced with the input number. If no filename is
  13858. specified, no output will be written. This is the default.
  13859. @item format
  13860. Choose the output format.
  13861. Available values are:
  13862. @table @samp
  13863. @item binary
  13864. Use the specified binary representation (default).
  13865. @item xml
  13866. Use the specified xml representation.
  13867. @end table
  13868. @item th_d
  13869. Set threshold to detect one word as similar. The option value must be an integer
  13870. greater than zero. The default value is 9000.
  13871. @item th_dc
  13872. Set threshold to detect all words as similar. The option value must be an integer
  13873. greater than zero. The default value is 60000.
  13874. @item th_xh
  13875. Set threshold to detect frames as similar. The option value must be an integer
  13876. greater than zero. The default value is 116.
  13877. @item th_di
  13878. Set the minimum length of a sequence in frames to recognize it as matching
  13879. sequence. The option value must be a non negative integer value.
  13880. The default value is 0.
  13881. @item th_it
  13882. Set the minimum relation, that matching frames to all frames must have.
  13883. The option value must be a double value between 0 and 1. The default value is 0.5.
  13884. @end table
  13885. @subsection Examples
  13886. @itemize
  13887. @item
  13888. To calculate the signature of an input video and store it in signature.bin:
  13889. @example
  13890. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13891. @end example
  13892. @item
  13893. To detect whether two videos match and store the signatures in XML format in
  13894. signature0.xml and signature1.xml:
  13895. @example
  13896. 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 -
  13897. @end example
  13898. @end itemize
  13899. @anchor{smartblur}
  13900. @section smartblur
  13901. Blur the input video without impacting the outlines.
  13902. It accepts the following options:
  13903. @table @option
  13904. @item luma_radius, lr
  13905. Set the luma radius. The option value must be a float number in
  13906. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13907. used to blur the image (slower if larger). Default value is 1.0.
  13908. @item luma_strength, ls
  13909. Set the luma strength. The option value must be a float number
  13910. in the range [-1.0,1.0] that configures the blurring. A value included
  13911. in [0.0,1.0] will blur the image whereas a value included in
  13912. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13913. @item luma_threshold, lt
  13914. Set the luma threshold used as a coefficient to determine
  13915. whether a pixel should be blurred or not. The option value must be an
  13916. integer in the range [-30,30]. A value of 0 will filter all the image,
  13917. a value included in [0,30] will filter flat areas and a value included
  13918. in [-30,0] will filter edges. Default value is 0.
  13919. @item chroma_radius, cr
  13920. Set the chroma radius. The option value must be a float number in
  13921. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13922. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13923. @item chroma_strength, cs
  13924. Set the chroma strength. The option value must be a float number
  13925. in the range [-1.0,1.0] that configures the blurring. A value included
  13926. in [0.0,1.0] will blur the image whereas a value included in
  13927. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13928. @item chroma_threshold, ct
  13929. Set the chroma threshold used as a coefficient to determine
  13930. whether a pixel should be blurred or not. The option value must be an
  13931. integer in the range [-30,30]. A value of 0 will filter all the image,
  13932. a value included in [0,30] will filter flat areas and a value included
  13933. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13934. @end table
  13935. If a chroma option is not explicitly set, the corresponding luma value
  13936. is set.
  13937. @section sobel
  13938. Apply sobel operator to input video stream.
  13939. The filter accepts the following option:
  13940. @table @option
  13941. @item planes
  13942. Set which planes will be processed, unprocessed planes will be copied.
  13943. By default value 0xf, all planes will be processed.
  13944. @item scale
  13945. Set value which will be multiplied with filtered result.
  13946. @item delta
  13947. Set value which will be added to filtered result.
  13948. @end table
  13949. @subsection Commands
  13950. This filter supports the all above options as @ref{commands}.
  13951. @anchor{spp}
  13952. @section spp
  13953. Apply a simple postprocessing filter that compresses and decompresses the image
  13954. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13955. and average the results.
  13956. The filter accepts the following options:
  13957. @table @option
  13958. @item quality
  13959. Set quality. This option defines the number of levels for averaging. It accepts
  13960. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13961. effect. A value of @code{6} means the higher quality. For each increment of
  13962. that value the speed drops by a factor of approximately 2. Default value is
  13963. @code{3}.
  13964. @item qp
  13965. Force a constant quantization parameter. If not set, the filter will use the QP
  13966. from the video stream (if available).
  13967. @item mode
  13968. Set thresholding mode. Available modes are:
  13969. @table @samp
  13970. @item hard
  13971. Set hard thresholding (default).
  13972. @item soft
  13973. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13974. @end table
  13975. @item use_bframe_qp
  13976. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13977. option may cause flicker since the B-Frames have often larger QP. Default is
  13978. @code{0} (not enabled).
  13979. @end table
  13980. @subsection Commands
  13981. This filter supports the following commands:
  13982. @table @option
  13983. @item quality, level
  13984. Set quality level. The value @code{max} can be used to set the maximum level,
  13985. currently @code{6}.
  13986. @end table
  13987. @anchor{sr}
  13988. @section sr
  13989. Scale the input by applying one of the super-resolution methods based on
  13990. convolutional neural networks. Supported models:
  13991. @itemize
  13992. @item
  13993. Super-Resolution Convolutional Neural Network model (SRCNN).
  13994. See @url{https://arxiv.org/abs/1501.00092}.
  13995. @item
  13996. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13997. See @url{https://arxiv.org/abs/1609.05158}.
  13998. @end itemize
  13999. Training scripts as well as scripts for model file (.pb) saving can be found at
  14000. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  14001. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  14002. Native model files (.model) can be generated from TensorFlow model
  14003. files (.pb) by using tools/python/convert.py
  14004. The filter accepts the following options:
  14005. @table @option
  14006. @item dnn_backend
  14007. Specify which DNN backend to use for model loading and execution. This option accepts
  14008. the following values:
  14009. @table @samp
  14010. @item native
  14011. Native implementation of DNN loading and execution.
  14012. @item tensorflow
  14013. TensorFlow backend. To enable this backend you
  14014. need to install the TensorFlow for C library (see
  14015. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  14016. @code{--enable-libtensorflow}
  14017. @end table
  14018. Default value is @samp{native}.
  14019. @item model
  14020. Set path to model file specifying network architecture and its parameters.
  14021. Note that different backends use different file formats. TensorFlow backend
  14022. can load files for both formats, while native backend can load files for only
  14023. its format.
  14024. @item scale_factor
  14025. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  14026. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  14027. input upscaled using bicubic upscaling with proper scale factor.
  14028. @end table
  14029. This feature can also be finished with @ref{dnn_processing} filter.
  14030. @section ssim
  14031. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  14032. This filter takes in input two input videos, the first input is
  14033. considered the "main" source and is passed unchanged to the
  14034. output. The second input is used as a "reference" video for computing
  14035. the SSIM.
  14036. Both video inputs must have the same resolution and pixel format for
  14037. this filter to work correctly. Also it assumes that both inputs
  14038. have the same number of frames, which are compared one by one.
  14039. The filter stores the calculated SSIM of each frame.
  14040. The description of the accepted parameters follows.
  14041. @table @option
  14042. @item stats_file, f
  14043. If specified the filter will use the named file to save the SSIM of
  14044. each individual frame. When filename equals "-" the data is sent to
  14045. standard output.
  14046. @end table
  14047. The file printed if @var{stats_file} is selected, contains a sequence of
  14048. key/value pairs of the form @var{key}:@var{value} for each compared
  14049. couple of frames.
  14050. A description of each shown parameter follows:
  14051. @table @option
  14052. @item n
  14053. sequential number of the input frame, starting from 1
  14054. @item Y, U, V, R, G, B
  14055. SSIM of the compared frames for the component specified by the suffix.
  14056. @item All
  14057. SSIM of the compared frames for the whole frame.
  14058. @item dB
  14059. Same as above but in dB representation.
  14060. @end table
  14061. This filter also supports the @ref{framesync} options.
  14062. @subsection Examples
  14063. @itemize
  14064. @item
  14065. For example:
  14066. @example
  14067. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  14068. [main][ref] ssim="stats_file=stats.log" [out]
  14069. @end example
  14070. On this example the input file being processed is compared with the
  14071. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  14072. is stored in @file{stats.log}.
  14073. @item
  14074. Another example with both psnr and ssim at same time:
  14075. @example
  14076. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  14077. @end example
  14078. @item
  14079. Another example with different containers:
  14080. @example
  14081. 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 -
  14082. @end example
  14083. @end itemize
  14084. @section stereo3d
  14085. Convert between different stereoscopic image formats.
  14086. The filters accept the following options:
  14087. @table @option
  14088. @item in
  14089. Set stereoscopic image format of input.
  14090. Available values for input image formats are:
  14091. @table @samp
  14092. @item sbsl
  14093. side by side parallel (left eye left, right eye right)
  14094. @item sbsr
  14095. side by side crosseye (right eye left, left eye right)
  14096. @item sbs2l
  14097. side by side parallel with half width resolution
  14098. (left eye left, right eye right)
  14099. @item sbs2r
  14100. side by side crosseye with half width resolution
  14101. (right eye left, left eye right)
  14102. @item abl
  14103. @item tbl
  14104. above-below (left eye above, right eye below)
  14105. @item abr
  14106. @item tbr
  14107. above-below (right eye above, left eye below)
  14108. @item ab2l
  14109. @item tb2l
  14110. above-below with half height resolution
  14111. (left eye above, right eye below)
  14112. @item ab2r
  14113. @item tb2r
  14114. above-below with half height resolution
  14115. (right eye above, left eye below)
  14116. @item al
  14117. alternating frames (left eye first, right eye second)
  14118. @item ar
  14119. alternating frames (right eye first, left eye second)
  14120. @item irl
  14121. interleaved rows (left eye has top row, right eye starts on next row)
  14122. @item irr
  14123. interleaved rows (right eye has top row, left eye starts on next row)
  14124. @item icl
  14125. interleaved columns, left eye first
  14126. @item icr
  14127. interleaved columns, right eye first
  14128. Default value is @samp{sbsl}.
  14129. @end table
  14130. @item out
  14131. Set stereoscopic image format of output.
  14132. @table @samp
  14133. @item sbsl
  14134. side by side parallel (left eye left, right eye right)
  14135. @item sbsr
  14136. side by side crosseye (right eye left, left eye right)
  14137. @item sbs2l
  14138. side by side parallel with half width resolution
  14139. (left eye left, right eye right)
  14140. @item sbs2r
  14141. side by side crosseye with half width resolution
  14142. (right eye left, left eye right)
  14143. @item abl
  14144. @item tbl
  14145. above-below (left eye above, right eye below)
  14146. @item abr
  14147. @item tbr
  14148. above-below (right eye above, left eye below)
  14149. @item ab2l
  14150. @item tb2l
  14151. above-below with half height resolution
  14152. (left eye above, right eye below)
  14153. @item ab2r
  14154. @item tb2r
  14155. above-below with half height resolution
  14156. (right eye above, left eye below)
  14157. @item al
  14158. alternating frames (left eye first, right eye second)
  14159. @item ar
  14160. alternating frames (right eye first, left eye second)
  14161. @item irl
  14162. interleaved rows (left eye has top row, right eye starts on next row)
  14163. @item irr
  14164. interleaved rows (right eye has top row, left eye starts on next row)
  14165. @item arbg
  14166. anaglyph red/blue gray
  14167. (red filter on left eye, blue filter on right eye)
  14168. @item argg
  14169. anaglyph red/green gray
  14170. (red filter on left eye, green filter on right eye)
  14171. @item arcg
  14172. anaglyph red/cyan gray
  14173. (red filter on left eye, cyan filter on right eye)
  14174. @item arch
  14175. anaglyph red/cyan half colored
  14176. (red filter on left eye, cyan filter on right eye)
  14177. @item arcc
  14178. anaglyph red/cyan color
  14179. (red filter on left eye, cyan filter on right eye)
  14180. @item arcd
  14181. anaglyph red/cyan color optimized with the least squares projection of dubois
  14182. (red filter on left eye, cyan filter on right eye)
  14183. @item agmg
  14184. anaglyph green/magenta gray
  14185. (green filter on left eye, magenta filter on right eye)
  14186. @item agmh
  14187. anaglyph green/magenta half colored
  14188. (green filter on left eye, magenta filter on right eye)
  14189. @item agmc
  14190. anaglyph green/magenta colored
  14191. (green filter on left eye, magenta filter on right eye)
  14192. @item agmd
  14193. anaglyph green/magenta color optimized with the least squares projection of dubois
  14194. (green filter on left eye, magenta filter on right eye)
  14195. @item aybg
  14196. anaglyph yellow/blue gray
  14197. (yellow filter on left eye, blue filter on right eye)
  14198. @item aybh
  14199. anaglyph yellow/blue half colored
  14200. (yellow filter on left eye, blue filter on right eye)
  14201. @item aybc
  14202. anaglyph yellow/blue colored
  14203. (yellow filter on left eye, blue filter on right eye)
  14204. @item aybd
  14205. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14206. (yellow filter on left eye, blue filter on right eye)
  14207. @item ml
  14208. mono output (left eye only)
  14209. @item mr
  14210. mono output (right eye only)
  14211. @item chl
  14212. checkerboard, left eye first
  14213. @item chr
  14214. checkerboard, right eye first
  14215. @item icl
  14216. interleaved columns, left eye first
  14217. @item icr
  14218. interleaved columns, right eye first
  14219. @item hdmi
  14220. HDMI frame pack
  14221. @end table
  14222. Default value is @samp{arcd}.
  14223. @end table
  14224. @subsection Examples
  14225. @itemize
  14226. @item
  14227. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14228. @example
  14229. stereo3d=sbsl:aybd
  14230. @end example
  14231. @item
  14232. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14233. @example
  14234. stereo3d=abl:sbsr
  14235. @end example
  14236. @end itemize
  14237. @section streamselect, astreamselect
  14238. Select video or audio streams.
  14239. The filter accepts the following options:
  14240. @table @option
  14241. @item inputs
  14242. Set number of inputs. Default is 2.
  14243. @item map
  14244. Set input indexes to remap to outputs.
  14245. @end table
  14246. @subsection Commands
  14247. The @code{streamselect} and @code{astreamselect} filter supports the following
  14248. commands:
  14249. @table @option
  14250. @item map
  14251. Set input indexes to remap to outputs.
  14252. @end table
  14253. @subsection Examples
  14254. @itemize
  14255. @item
  14256. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14257. @example
  14258. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14259. @end example
  14260. @item
  14261. Same as above, but for audio:
  14262. @example
  14263. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14264. @end example
  14265. @end itemize
  14266. @anchor{subtitles}
  14267. @section subtitles
  14268. Draw subtitles on top of input video using the libass library.
  14269. To enable compilation of this filter you need to configure FFmpeg with
  14270. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14271. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14272. Alpha) subtitles format.
  14273. The filter accepts the following options:
  14274. @table @option
  14275. @item filename, f
  14276. Set the filename of the subtitle file to read. It must be specified.
  14277. @item original_size
  14278. Specify the size of the original video, the video for which the ASS file
  14279. was composed. For the syntax of this option, check the
  14280. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14281. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14282. correctly scale the fonts if the aspect ratio has been changed.
  14283. @item fontsdir
  14284. Set a directory path containing fonts that can be used by the filter.
  14285. These fonts will be used in addition to whatever the font provider uses.
  14286. @item alpha
  14287. Process alpha channel, by default alpha channel is untouched.
  14288. @item charenc
  14289. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14290. useful if not UTF-8.
  14291. @item stream_index, si
  14292. Set subtitles stream index. @code{subtitles} filter only.
  14293. @item force_style
  14294. Override default style or script info parameters of the subtitles. It accepts a
  14295. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14296. @end table
  14297. If the first key is not specified, it is assumed that the first value
  14298. specifies the @option{filename}.
  14299. For example, to render the file @file{sub.srt} on top of the input
  14300. video, use the command:
  14301. @example
  14302. subtitles=sub.srt
  14303. @end example
  14304. which is equivalent to:
  14305. @example
  14306. subtitles=filename=sub.srt
  14307. @end example
  14308. To render the default subtitles stream from file @file{video.mkv}, use:
  14309. @example
  14310. subtitles=video.mkv
  14311. @end example
  14312. To render the second subtitles stream from that file, use:
  14313. @example
  14314. subtitles=video.mkv:si=1
  14315. @end example
  14316. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14317. @code{DejaVu Serif}, use:
  14318. @example
  14319. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14320. @end example
  14321. @section super2xsai
  14322. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14323. Interpolate) pixel art scaling algorithm.
  14324. Useful for enlarging pixel art images without reducing sharpness.
  14325. @section swaprect
  14326. Swap two rectangular objects in video.
  14327. This filter accepts the following options:
  14328. @table @option
  14329. @item w
  14330. Set object width.
  14331. @item h
  14332. Set object height.
  14333. @item x1
  14334. Set 1st rect x coordinate.
  14335. @item y1
  14336. Set 1st rect y coordinate.
  14337. @item x2
  14338. Set 2nd rect x coordinate.
  14339. @item y2
  14340. Set 2nd rect y coordinate.
  14341. All expressions are evaluated once for each frame.
  14342. @end table
  14343. The all options are expressions containing the following constants:
  14344. @table @option
  14345. @item w
  14346. @item h
  14347. The input width and height.
  14348. @item a
  14349. same as @var{w} / @var{h}
  14350. @item sar
  14351. input sample aspect ratio
  14352. @item dar
  14353. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14354. @item n
  14355. The number of the input frame, starting from 0.
  14356. @item t
  14357. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14358. @item pos
  14359. the position in the file of the input frame, NAN if unknown
  14360. @end table
  14361. @section swapuv
  14362. Swap U & V plane.
  14363. @section tblend
  14364. Blend successive video frames.
  14365. See @ref{blend}
  14366. @section telecine
  14367. Apply telecine process to the video.
  14368. This filter accepts the following options:
  14369. @table @option
  14370. @item first_field
  14371. @table @samp
  14372. @item top, t
  14373. top field first
  14374. @item bottom, b
  14375. bottom field first
  14376. The default value is @code{top}.
  14377. @end table
  14378. @item pattern
  14379. A string of numbers representing the pulldown pattern you wish to apply.
  14380. The default value is @code{23}.
  14381. @end table
  14382. @example
  14383. Some typical patterns:
  14384. NTSC output (30i):
  14385. 27.5p: 32222
  14386. 24p: 23 (classic)
  14387. 24p: 2332 (preferred)
  14388. 20p: 33
  14389. 18p: 334
  14390. 16p: 3444
  14391. PAL output (25i):
  14392. 27.5p: 12222
  14393. 24p: 222222222223 ("Euro pulldown")
  14394. 16.67p: 33
  14395. 16p: 33333334
  14396. @end example
  14397. @section thistogram
  14398. Compute and draw a color distribution histogram for the input video across time.
  14399. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14400. at certain time, this filter shows also past histograms of number of frames defined
  14401. by @code{width} option.
  14402. The computed histogram is a representation of the color component
  14403. distribution in an image.
  14404. The filter accepts the following options:
  14405. @table @option
  14406. @item width, w
  14407. Set width of single color component output. Default value is @code{0}.
  14408. Value of @code{0} means width will be picked from input video.
  14409. This also set number of passed histograms to keep.
  14410. Allowed range is [0, 8192].
  14411. @item display_mode, d
  14412. Set display mode.
  14413. It accepts the following values:
  14414. @table @samp
  14415. @item stack
  14416. Per color component graphs are placed below each other.
  14417. @item parade
  14418. Per color component graphs are placed side by side.
  14419. @item overlay
  14420. Presents information identical to that in the @code{parade}, except
  14421. that the graphs representing color components are superimposed directly
  14422. over one another.
  14423. @end table
  14424. Default is @code{stack}.
  14425. @item levels_mode, m
  14426. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14427. Default is @code{linear}.
  14428. @item components, c
  14429. Set what color components to display.
  14430. Default is @code{7}.
  14431. @item bgopacity, b
  14432. Set background opacity. Default is @code{0.9}.
  14433. @item envelope, e
  14434. Show envelope. Default is disabled.
  14435. @item ecolor, ec
  14436. Set envelope color. Default is @code{gold}.
  14437. @item slide
  14438. Set slide mode.
  14439. Available values for slide is:
  14440. @table @samp
  14441. @item frame
  14442. Draw new frame when right border is reached.
  14443. @item replace
  14444. Replace old columns with new ones.
  14445. @item scroll
  14446. Scroll from right to left.
  14447. @item rscroll
  14448. Scroll from left to right.
  14449. @item picture
  14450. Draw single picture.
  14451. @end table
  14452. Default is @code{replace}.
  14453. @end table
  14454. @section threshold
  14455. Apply threshold effect to video stream.
  14456. This filter needs four video streams to perform thresholding.
  14457. First stream is stream we are filtering.
  14458. Second stream is holding threshold values, third stream is holding min values,
  14459. and last, fourth stream is holding max values.
  14460. The filter accepts the following option:
  14461. @table @option
  14462. @item planes
  14463. Set which planes will be processed, unprocessed planes will be copied.
  14464. By default value 0xf, all planes will be processed.
  14465. @end table
  14466. For example if first stream pixel's component value is less then threshold value
  14467. of pixel component from 2nd threshold stream, third stream value will picked,
  14468. otherwise fourth stream pixel component value will be picked.
  14469. Using color source filter one can perform various types of thresholding:
  14470. @subsection Examples
  14471. @itemize
  14472. @item
  14473. Binary threshold, using gray color as threshold:
  14474. @example
  14475. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14476. @end example
  14477. @item
  14478. Inverted binary threshold, using gray color as threshold:
  14479. @example
  14480. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14481. @end example
  14482. @item
  14483. Truncate binary threshold, using gray color as threshold:
  14484. @example
  14485. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14486. @end example
  14487. @item
  14488. Threshold to zero, using gray color as threshold:
  14489. @example
  14490. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14491. @end example
  14492. @item
  14493. Inverted threshold to zero, using gray color as threshold:
  14494. @example
  14495. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14496. @end example
  14497. @end itemize
  14498. @section thumbnail
  14499. Select the most representative frame in a given sequence of consecutive frames.
  14500. The filter accepts the following options:
  14501. @table @option
  14502. @item n
  14503. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14504. will pick one of them, and then handle the next batch of @var{n} frames until
  14505. the end. Default is @code{100}.
  14506. @end table
  14507. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14508. value will result in a higher memory usage, so a high value is not recommended.
  14509. @subsection Examples
  14510. @itemize
  14511. @item
  14512. Extract one picture each 50 frames:
  14513. @example
  14514. thumbnail=50
  14515. @end example
  14516. @item
  14517. Complete example of a thumbnail creation with @command{ffmpeg}:
  14518. @example
  14519. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14520. @end example
  14521. @end itemize
  14522. @anchor{tile}
  14523. @section tile
  14524. Tile several successive frames together.
  14525. The @ref{untile} filter can do the reverse.
  14526. The filter accepts the following options:
  14527. @table @option
  14528. @item layout
  14529. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14530. this option, check the
  14531. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14532. @item nb_frames
  14533. Set the maximum number of frames to render in the given area. It must be less
  14534. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14535. the area will be used.
  14536. @item margin
  14537. Set the outer border margin in pixels.
  14538. @item padding
  14539. Set the inner border thickness (i.e. the number of pixels between frames). For
  14540. more advanced padding options (such as having different values for the edges),
  14541. refer to the pad video filter.
  14542. @item color
  14543. Specify the color of the unused area. For the syntax of this option, check the
  14544. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14545. The default value of @var{color} is "black".
  14546. @item overlap
  14547. Set the number of frames to overlap when tiling several successive frames together.
  14548. The value must be between @code{0} and @var{nb_frames - 1}.
  14549. @item init_padding
  14550. Set the number of frames to initially be empty before displaying first output frame.
  14551. This controls how soon will one get first output frame.
  14552. The value must be between @code{0} and @var{nb_frames - 1}.
  14553. @end table
  14554. @subsection Examples
  14555. @itemize
  14556. @item
  14557. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14558. @example
  14559. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14560. @end example
  14561. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14562. duplicating each output frame to accommodate the originally detected frame
  14563. rate.
  14564. @item
  14565. Display @code{5} pictures in an area of @code{3x2} frames,
  14566. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14567. mixed flat and named options:
  14568. @example
  14569. tile=3x2:nb_frames=5:padding=7:margin=2
  14570. @end example
  14571. @end itemize
  14572. @section tinterlace
  14573. Perform various types of temporal field interlacing.
  14574. Frames are counted starting from 1, so the first input frame is
  14575. considered odd.
  14576. The filter accepts the following options:
  14577. @table @option
  14578. @item mode
  14579. Specify the mode of the interlacing. This option can also be specified
  14580. as a value alone. See below for a list of values for this option.
  14581. Available values are:
  14582. @table @samp
  14583. @item merge, 0
  14584. Move odd frames into the upper field, even into the lower field,
  14585. generating a double height frame at half frame rate.
  14586. @example
  14587. ------> time
  14588. Input:
  14589. Frame 1 Frame 2 Frame 3 Frame 4
  14590. 11111 22222 33333 44444
  14591. 11111 22222 33333 44444
  14592. 11111 22222 33333 44444
  14593. 11111 22222 33333 44444
  14594. Output:
  14595. 11111 33333
  14596. 22222 44444
  14597. 11111 33333
  14598. 22222 44444
  14599. 11111 33333
  14600. 22222 44444
  14601. 11111 33333
  14602. 22222 44444
  14603. @end example
  14604. @item drop_even, 1
  14605. Only output odd frames, even frames are dropped, generating a frame with
  14606. unchanged height at half frame rate.
  14607. @example
  14608. ------> time
  14609. Input:
  14610. Frame 1 Frame 2 Frame 3 Frame 4
  14611. 11111 22222 33333 44444
  14612. 11111 22222 33333 44444
  14613. 11111 22222 33333 44444
  14614. 11111 22222 33333 44444
  14615. Output:
  14616. 11111 33333
  14617. 11111 33333
  14618. 11111 33333
  14619. 11111 33333
  14620. @end example
  14621. @item drop_odd, 2
  14622. Only output even frames, odd frames are dropped, generating a frame with
  14623. unchanged height at half frame rate.
  14624. @example
  14625. ------> time
  14626. Input:
  14627. Frame 1 Frame 2 Frame 3 Frame 4
  14628. 11111 22222 33333 44444
  14629. 11111 22222 33333 44444
  14630. 11111 22222 33333 44444
  14631. 11111 22222 33333 44444
  14632. Output:
  14633. 22222 44444
  14634. 22222 44444
  14635. 22222 44444
  14636. 22222 44444
  14637. @end example
  14638. @item pad, 3
  14639. Expand each frame to full height, but pad alternate lines with black,
  14640. generating a frame with double height at the same input frame rate.
  14641. @example
  14642. ------> time
  14643. Input:
  14644. Frame 1 Frame 2 Frame 3 Frame 4
  14645. 11111 22222 33333 44444
  14646. 11111 22222 33333 44444
  14647. 11111 22222 33333 44444
  14648. 11111 22222 33333 44444
  14649. Output:
  14650. 11111 ..... 33333 .....
  14651. ..... 22222 ..... 44444
  14652. 11111 ..... 33333 .....
  14653. ..... 22222 ..... 44444
  14654. 11111 ..... 33333 .....
  14655. ..... 22222 ..... 44444
  14656. 11111 ..... 33333 .....
  14657. ..... 22222 ..... 44444
  14658. @end example
  14659. @item interleave_top, 4
  14660. Interleave the upper field from odd frames with the lower field from
  14661. even frames, generating a frame with unchanged height at half frame rate.
  14662. @example
  14663. ------> time
  14664. Input:
  14665. Frame 1 Frame 2 Frame 3 Frame 4
  14666. 11111<- 22222 33333<- 44444
  14667. 11111 22222<- 33333 44444<-
  14668. 11111<- 22222 33333<- 44444
  14669. 11111 22222<- 33333 44444<-
  14670. Output:
  14671. 11111 33333
  14672. 22222 44444
  14673. 11111 33333
  14674. 22222 44444
  14675. @end example
  14676. @item interleave_bottom, 5
  14677. Interleave the lower field from odd frames with the upper field from
  14678. even frames, generating a frame with unchanged height at half frame rate.
  14679. @example
  14680. ------> time
  14681. Input:
  14682. Frame 1 Frame 2 Frame 3 Frame 4
  14683. 11111 22222<- 33333 44444<-
  14684. 11111<- 22222 33333<- 44444
  14685. 11111 22222<- 33333 44444<-
  14686. 11111<- 22222 33333<- 44444
  14687. Output:
  14688. 22222 44444
  14689. 11111 33333
  14690. 22222 44444
  14691. 11111 33333
  14692. @end example
  14693. @item interlacex2, 6
  14694. Double frame rate with unchanged height. Frames are inserted each
  14695. containing the second temporal field from the previous input frame and
  14696. the first temporal field from the next input frame. This mode relies on
  14697. the top_field_first flag. Useful for interlaced video displays with no
  14698. field synchronisation.
  14699. @example
  14700. ------> time
  14701. Input:
  14702. Frame 1 Frame 2 Frame 3 Frame 4
  14703. 11111 22222 33333 44444
  14704. 11111 22222 33333 44444
  14705. 11111 22222 33333 44444
  14706. 11111 22222 33333 44444
  14707. Output:
  14708. 11111 22222 22222 33333 33333 44444 44444
  14709. 11111 11111 22222 22222 33333 33333 44444
  14710. 11111 22222 22222 33333 33333 44444 44444
  14711. 11111 11111 22222 22222 33333 33333 44444
  14712. @end example
  14713. @item mergex2, 7
  14714. Move odd frames into the upper field, even into the lower field,
  14715. generating a double height frame at same frame rate.
  14716. @example
  14717. ------> time
  14718. Input:
  14719. Frame 1 Frame 2 Frame 3 Frame 4
  14720. 11111 22222 33333 44444
  14721. 11111 22222 33333 44444
  14722. 11111 22222 33333 44444
  14723. 11111 22222 33333 44444
  14724. Output:
  14725. 11111 33333 33333 55555
  14726. 22222 22222 44444 44444
  14727. 11111 33333 33333 55555
  14728. 22222 22222 44444 44444
  14729. 11111 33333 33333 55555
  14730. 22222 22222 44444 44444
  14731. 11111 33333 33333 55555
  14732. 22222 22222 44444 44444
  14733. @end example
  14734. @end table
  14735. Numeric values are deprecated but are accepted for backward
  14736. compatibility reasons.
  14737. Default mode is @code{merge}.
  14738. @item flags
  14739. Specify flags influencing the filter process.
  14740. Available value for @var{flags} is:
  14741. @table @option
  14742. @item low_pass_filter, vlpf
  14743. Enable linear vertical low-pass filtering in the filter.
  14744. Vertical low-pass filtering is required when creating an interlaced
  14745. destination from a progressive source which contains high-frequency
  14746. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14747. patterning.
  14748. @item complex_filter, cvlpf
  14749. Enable complex vertical low-pass filtering.
  14750. This will slightly less reduce interlace 'twitter' and Moire
  14751. patterning but better retain detail and subjective sharpness impression.
  14752. @item bypass_il
  14753. Bypass already interlaced frames, only adjust the frame rate.
  14754. @end table
  14755. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14756. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14757. @end table
  14758. @section tmedian
  14759. Pick median pixels from several successive input video frames.
  14760. The filter accepts the following options:
  14761. @table @option
  14762. @item radius
  14763. Set radius of median filter.
  14764. Default is 1. Allowed range is from 1 to 127.
  14765. @item planes
  14766. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14767. @item percentile
  14768. Set median percentile. Default value is @code{0.5}.
  14769. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14770. minimum values, and @code{1} maximum values.
  14771. @end table
  14772. @subsection Commands
  14773. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  14774. @section tmidequalizer
  14775. Apply Temporal Midway Video Equalization effect.
  14776. Midway Video Equalization adjusts a sequence of video frames to have the same
  14777. histograms, while maintaining their dynamics as much as possible. It's
  14778. useful for e.g. matching exposures from a video frames sequence.
  14779. This filter accepts the following option:
  14780. @table @option
  14781. @item radius
  14782. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  14783. @item sigma
  14784. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  14785. Setting this option to 0 effectively does nothing.
  14786. @item planes
  14787. Set which planes to process. Default is @code{15}, which is all available planes.
  14788. @end table
  14789. @section tmix
  14790. Mix successive video frames.
  14791. A description of the accepted options follows.
  14792. @table @option
  14793. @item frames
  14794. The number of successive frames to mix. If unspecified, it defaults to 3.
  14795. @item weights
  14796. Specify weight of each input video frame.
  14797. Each weight is separated by space. If number of weights is smaller than
  14798. number of @var{frames} last specified weight will be used for all remaining
  14799. unset weights.
  14800. @item scale
  14801. Specify scale, if it is set it will be multiplied with sum
  14802. of each weight multiplied with pixel values to give final destination
  14803. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14804. @end table
  14805. @subsection Examples
  14806. @itemize
  14807. @item
  14808. Average 7 successive frames:
  14809. @example
  14810. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14811. @end example
  14812. @item
  14813. Apply simple temporal convolution:
  14814. @example
  14815. tmix=frames=3:weights="-1 3 -1"
  14816. @end example
  14817. @item
  14818. Similar as above but only showing temporal differences:
  14819. @example
  14820. tmix=frames=3:weights="-1 2 -1":scale=1
  14821. @end example
  14822. @end itemize
  14823. @anchor{tonemap}
  14824. @section tonemap
  14825. Tone map colors from different dynamic ranges.
  14826. This filter expects data in single precision floating point, as it needs to
  14827. operate on (and can output) out-of-range values. Another filter, such as
  14828. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14829. The tonemapping algorithms implemented only work on linear light, so input
  14830. data should be linearized beforehand (and possibly correctly tagged).
  14831. @example
  14832. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14833. @end example
  14834. @subsection Options
  14835. The filter accepts the following options.
  14836. @table @option
  14837. @item tonemap
  14838. Set the tone map algorithm to use.
  14839. Possible values are:
  14840. @table @var
  14841. @item none
  14842. Do not apply any tone map, only desaturate overbright pixels.
  14843. @item clip
  14844. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14845. in-range values, while distorting out-of-range values.
  14846. @item linear
  14847. Stretch the entire reference gamut to a linear multiple of the display.
  14848. @item gamma
  14849. Fit a logarithmic transfer between the tone curves.
  14850. @item reinhard
  14851. Preserve overall image brightness with a simple curve, using nonlinear
  14852. contrast, which results in flattening details and degrading color accuracy.
  14853. @item hable
  14854. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14855. of slightly darkening everything. Use it when detail preservation is more
  14856. important than color and brightness accuracy.
  14857. @item mobius
  14858. Smoothly map out-of-range values, while retaining contrast and colors for
  14859. in-range material as much as possible. Use it when color accuracy is more
  14860. important than detail preservation.
  14861. @end table
  14862. Default is none.
  14863. @item param
  14864. Tune the tone mapping algorithm.
  14865. This affects the following algorithms:
  14866. @table @var
  14867. @item none
  14868. Ignored.
  14869. @item linear
  14870. Specifies the scale factor to use while stretching.
  14871. Default to 1.0.
  14872. @item gamma
  14873. Specifies the exponent of the function.
  14874. Default to 1.8.
  14875. @item clip
  14876. Specify an extra linear coefficient to multiply into the signal before clipping.
  14877. Default to 1.0.
  14878. @item reinhard
  14879. Specify the local contrast coefficient at the display peak.
  14880. Default to 0.5, which means that in-gamut values will be about half as bright
  14881. as when clipping.
  14882. @item hable
  14883. Ignored.
  14884. @item mobius
  14885. Specify the transition point from linear to mobius transform. Every value
  14886. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14887. more accurate the result will be, at the cost of losing bright details.
  14888. Default to 0.3, which due to the steep initial slope still preserves in-range
  14889. colors fairly accurately.
  14890. @end table
  14891. @item desat
  14892. Apply desaturation for highlights that exceed this level of brightness. The
  14893. higher the parameter, the more color information will be preserved. This
  14894. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14895. (smoothly) turning into white instead. This makes images feel more natural,
  14896. at the cost of reducing information about out-of-range colors.
  14897. The default of 2.0 is somewhat conservative and will mostly just apply to
  14898. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14899. This option works only if the input frame has a supported color tag.
  14900. @item peak
  14901. Override signal/nominal/reference peak with this value. Useful when the
  14902. embedded peak information in display metadata is not reliable or when tone
  14903. mapping from a lower range to a higher range.
  14904. @end table
  14905. @section tpad
  14906. Temporarily pad video frames.
  14907. The filter accepts the following options:
  14908. @table @option
  14909. @item start
  14910. Specify number of delay frames before input video stream. Default is 0.
  14911. @item stop
  14912. Specify number of padding frames after input video stream.
  14913. Set to -1 to pad indefinitely. Default is 0.
  14914. @item start_mode
  14915. Set kind of frames added to beginning of stream.
  14916. Can be either @var{add} or @var{clone}.
  14917. With @var{add} frames of solid-color are added.
  14918. With @var{clone} frames are clones of first frame.
  14919. Default is @var{add}.
  14920. @item stop_mode
  14921. Set kind of frames added to end of stream.
  14922. Can be either @var{add} or @var{clone}.
  14923. With @var{add} frames of solid-color are added.
  14924. With @var{clone} frames are clones of last frame.
  14925. Default is @var{add}.
  14926. @item start_duration, stop_duration
  14927. Specify the duration of the start/stop delay. See
  14928. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14929. for the accepted syntax.
  14930. These options override @var{start} and @var{stop}. Default is 0.
  14931. @item color
  14932. Specify the color of the padded area. For the syntax of this option,
  14933. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14934. manual,ffmpeg-utils}.
  14935. The default value of @var{color} is "black".
  14936. @end table
  14937. @anchor{transpose}
  14938. @section transpose
  14939. Transpose rows with columns in the input video and optionally flip it.
  14940. It accepts the following parameters:
  14941. @table @option
  14942. @item dir
  14943. Specify the transposition direction.
  14944. Can assume the following values:
  14945. @table @samp
  14946. @item 0, 4, cclock_flip
  14947. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14948. @example
  14949. L.R L.l
  14950. . . -> . .
  14951. l.r R.r
  14952. @end example
  14953. @item 1, 5, clock
  14954. Rotate by 90 degrees clockwise, that is:
  14955. @example
  14956. L.R l.L
  14957. . . -> . .
  14958. l.r r.R
  14959. @end example
  14960. @item 2, 6, cclock
  14961. Rotate by 90 degrees counterclockwise, that is:
  14962. @example
  14963. L.R R.r
  14964. . . -> . .
  14965. l.r L.l
  14966. @end example
  14967. @item 3, 7, clock_flip
  14968. Rotate by 90 degrees clockwise and vertically flip, that is:
  14969. @example
  14970. L.R r.R
  14971. . . -> . .
  14972. l.r l.L
  14973. @end example
  14974. @end table
  14975. For values between 4-7, the transposition is only done if the input
  14976. video geometry is portrait and not landscape. These values are
  14977. deprecated, the @code{passthrough} option should be used instead.
  14978. Numerical values are deprecated, and should be dropped in favor of
  14979. symbolic constants.
  14980. @item passthrough
  14981. Do not apply the transposition if the input geometry matches the one
  14982. specified by the specified value. It accepts the following values:
  14983. @table @samp
  14984. @item none
  14985. Always apply transposition.
  14986. @item portrait
  14987. Preserve portrait geometry (when @var{height} >= @var{width}).
  14988. @item landscape
  14989. Preserve landscape geometry (when @var{width} >= @var{height}).
  14990. @end table
  14991. Default value is @code{none}.
  14992. @end table
  14993. For example to rotate by 90 degrees clockwise and preserve portrait
  14994. layout:
  14995. @example
  14996. transpose=dir=1:passthrough=portrait
  14997. @end example
  14998. The command above can also be specified as:
  14999. @example
  15000. transpose=1:portrait
  15001. @end example
  15002. @section transpose_npp
  15003. Transpose rows with columns in the input video and optionally flip it.
  15004. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  15005. It accepts the following parameters:
  15006. @table @option
  15007. @item dir
  15008. Specify the transposition direction.
  15009. Can assume the following values:
  15010. @table @samp
  15011. @item cclock_flip
  15012. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  15013. @item clock
  15014. Rotate by 90 degrees clockwise.
  15015. @item cclock
  15016. Rotate by 90 degrees counterclockwise.
  15017. @item clock_flip
  15018. Rotate by 90 degrees clockwise and vertically flip.
  15019. @end table
  15020. @item passthrough
  15021. Do not apply the transposition if the input geometry matches the one
  15022. specified by the specified value. It accepts the following values:
  15023. @table @samp
  15024. @item none
  15025. Always apply transposition. (default)
  15026. @item portrait
  15027. Preserve portrait geometry (when @var{height} >= @var{width}).
  15028. @item landscape
  15029. Preserve landscape geometry (when @var{width} >= @var{height}).
  15030. @end table
  15031. @end table
  15032. @section trim
  15033. Trim the input so that the output contains one continuous subpart of the input.
  15034. It accepts the following parameters:
  15035. @table @option
  15036. @item start
  15037. Specify the time of the start of the kept section, i.e. the frame with the
  15038. timestamp @var{start} will be the first frame in the output.
  15039. @item end
  15040. Specify the time of the first frame that will be dropped, i.e. the frame
  15041. immediately preceding the one with the timestamp @var{end} will be the last
  15042. frame in the output.
  15043. @item start_pts
  15044. This is the same as @var{start}, except this option sets the start timestamp
  15045. in timebase units instead of seconds.
  15046. @item end_pts
  15047. This is the same as @var{end}, except this option sets the end timestamp
  15048. in timebase units instead of seconds.
  15049. @item duration
  15050. The maximum duration of the output in seconds.
  15051. @item start_frame
  15052. The number of the first frame that should be passed to the output.
  15053. @item end_frame
  15054. The number of the first frame that should be dropped.
  15055. @end table
  15056. @option{start}, @option{end}, and @option{duration} are expressed as time
  15057. duration specifications; see
  15058. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15059. for the accepted syntax.
  15060. Note that the first two sets of the start/end options and the @option{duration}
  15061. option look at the frame timestamp, while the _frame variants simply count the
  15062. frames that pass through the filter. Also note that this filter does not modify
  15063. the timestamps. If you wish for the output timestamps to start at zero, insert a
  15064. setpts filter after the trim filter.
  15065. If multiple start or end options are set, this filter tries to be greedy and
  15066. keep all the frames that match at least one of the specified constraints. To keep
  15067. only the part that matches all the constraints at once, chain multiple trim
  15068. filters.
  15069. The defaults are such that all the input is kept. So it is possible to set e.g.
  15070. just the end values to keep everything before the specified time.
  15071. Examples:
  15072. @itemize
  15073. @item
  15074. Drop everything except the second minute of input:
  15075. @example
  15076. ffmpeg -i INPUT -vf trim=60:120
  15077. @end example
  15078. @item
  15079. Keep only the first second:
  15080. @example
  15081. ffmpeg -i INPUT -vf trim=duration=1
  15082. @end example
  15083. @end itemize
  15084. @section unpremultiply
  15085. Apply alpha unpremultiply effect to input video stream using first plane
  15086. of second stream as alpha.
  15087. Both streams must have same dimensions and same pixel format.
  15088. The filter accepts the following option:
  15089. @table @option
  15090. @item planes
  15091. Set which planes will be processed, unprocessed planes will be copied.
  15092. By default value 0xf, all planes will be processed.
  15093. If the format has 1 or 2 components, then luma is bit 0.
  15094. If the format has 3 or 4 components:
  15095. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  15096. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  15097. If present, the alpha channel is always the last bit.
  15098. @item inplace
  15099. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15100. @end table
  15101. @anchor{unsharp}
  15102. @section unsharp
  15103. Sharpen or blur the input video.
  15104. It accepts the following parameters:
  15105. @table @option
  15106. @item luma_msize_x, lx
  15107. Set the luma matrix horizontal size. It must be an odd integer between
  15108. 3 and 23. The default value is 5.
  15109. @item luma_msize_y, ly
  15110. Set the luma matrix vertical size. It must be an odd integer between 3
  15111. and 23. The default value is 5.
  15112. @item luma_amount, la
  15113. Set the luma effect strength. It must be a floating point number, reasonable
  15114. values lay between -1.5 and 1.5.
  15115. Negative values will blur the input video, while positive values will
  15116. sharpen it, a value of zero will disable the effect.
  15117. Default value is 1.0.
  15118. @item chroma_msize_x, cx
  15119. Set the chroma matrix horizontal size. It must be an odd integer
  15120. between 3 and 23. The default value is 5.
  15121. @item chroma_msize_y, cy
  15122. Set the chroma matrix vertical size. It must be an odd integer
  15123. between 3 and 23. The default value is 5.
  15124. @item chroma_amount, ca
  15125. Set the chroma effect strength. It must be a floating point number, reasonable
  15126. values lay between -1.5 and 1.5.
  15127. Negative values will blur the input video, while positive values will
  15128. sharpen it, a value of zero will disable the effect.
  15129. Default value is 0.0.
  15130. @end table
  15131. All parameters are optional and default to the equivalent of the
  15132. string '5:5:1.0:5:5:0.0'.
  15133. @subsection Examples
  15134. @itemize
  15135. @item
  15136. Apply strong luma sharpen effect:
  15137. @example
  15138. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  15139. @end example
  15140. @item
  15141. Apply a strong blur of both luma and chroma parameters:
  15142. @example
  15143. unsharp=7:7:-2:7:7:-2
  15144. @end example
  15145. @end itemize
  15146. @anchor{untile}
  15147. @section untile
  15148. Decompose a video made of tiled images into the individual images.
  15149. The frame rate of the output video is the frame rate of the input video
  15150. multiplied by the number of tiles.
  15151. This filter does the reverse of @ref{tile}.
  15152. The filter accepts the following options:
  15153. @table @option
  15154. @item layout
  15155. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15156. this option, check the
  15157. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15158. @end table
  15159. @subsection Examples
  15160. @itemize
  15161. @item
  15162. Produce a 1-second video from a still image file made of 25 frames stacked
  15163. vertically, like an analogic film reel:
  15164. @example
  15165. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  15166. @end example
  15167. @end itemize
  15168. @section uspp
  15169. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  15170. the image at several (or - in the case of @option{quality} level @code{8} - all)
  15171. shifts and average the results.
  15172. The way this differs from the behavior of spp is that uspp actually encodes &
  15173. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  15174. DCT similar to MJPEG.
  15175. The filter accepts the following options:
  15176. @table @option
  15177. @item quality
  15178. Set quality. This option defines the number of levels for averaging. It accepts
  15179. an integer in the range 0-8. If set to @code{0}, the filter will have no
  15180. effect. A value of @code{8} means the higher quality. For each increment of
  15181. that value the speed drops by a factor of approximately 2. Default value is
  15182. @code{3}.
  15183. @item qp
  15184. Force a constant quantization parameter. If not set, the filter will use the QP
  15185. from the video stream (if available).
  15186. @end table
  15187. @section v360
  15188. Convert 360 videos between various formats.
  15189. The filter accepts the following options:
  15190. @table @option
  15191. @item input
  15192. @item output
  15193. Set format of the input/output video.
  15194. Available formats:
  15195. @table @samp
  15196. @item e
  15197. @item equirect
  15198. Equirectangular projection.
  15199. @item c3x2
  15200. @item c6x1
  15201. @item c1x6
  15202. Cubemap with 3x2/6x1/1x6 layout.
  15203. Format specific options:
  15204. @table @option
  15205. @item in_pad
  15206. @item out_pad
  15207. Set padding proportion for the input/output cubemap. Values in decimals.
  15208. Example values:
  15209. @table @samp
  15210. @item 0
  15211. No padding.
  15212. @item 0.01
  15213. 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)
  15214. @end table
  15215. Default value is @b{@samp{0}}.
  15216. Maximum value is @b{@samp{0.1}}.
  15217. @item fin_pad
  15218. @item fout_pad
  15219. Set fixed padding for the input/output cubemap. Values in pixels.
  15220. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15221. @item in_forder
  15222. @item out_forder
  15223. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15224. Designation of directions:
  15225. @table @samp
  15226. @item r
  15227. right
  15228. @item l
  15229. left
  15230. @item u
  15231. up
  15232. @item d
  15233. down
  15234. @item f
  15235. forward
  15236. @item b
  15237. back
  15238. @end table
  15239. Default value is @b{@samp{rludfb}}.
  15240. @item in_frot
  15241. @item out_frot
  15242. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15243. Designation of angles:
  15244. @table @samp
  15245. @item 0
  15246. 0 degrees clockwise
  15247. @item 1
  15248. 90 degrees clockwise
  15249. @item 2
  15250. 180 degrees clockwise
  15251. @item 3
  15252. 270 degrees clockwise
  15253. @end table
  15254. Default value is @b{@samp{000000}}.
  15255. @end table
  15256. @item eac
  15257. Equi-Angular Cubemap.
  15258. @item flat
  15259. @item gnomonic
  15260. @item rectilinear
  15261. Regular video.
  15262. Format specific options:
  15263. @table @option
  15264. @item h_fov
  15265. @item v_fov
  15266. @item d_fov
  15267. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15268. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15269. @item ih_fov
  15270. @item iv_fov
  15271. @item id_fov
  15272. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15273. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15274. @end table
  15275. @item dfisheye
  15276. Dual fisheye.
  15277. Format specific options:
  15278. @table @option
  15279. @item h_fov
  15280. @item v_fov
  15281. @item d_fov
  15282. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15283. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15284. @item ih_fov
  15285. @item iv_fov
  15286. @item id_fov
  15287. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15288. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15289. @end table
  15290. @item barrel
  15291. @item fb
  15292. @item barrelsplit
  15293. Facebook's 360 formats.
  15294. @item sg
  15295. Stereographic format.
  15296. Format specific options:
  15297. @table @option
  15298. @item h_fov
  15299. @item v_fov
  15300. @item d_fov
  15301. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15302. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15303. @item ih_fov
  15304. @item iv_fov
  15305. @item id_fov
  15306. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15307. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15308. @end table
  15309. @item mercator
  15310. Mercator format.
  15311. @item ball
  15312. Ball format, gives significant distortion toward the back.
  15313. @item hammer
  15314. Hammer-Aitoff map projection format.
  15315. @item sinusoidal
  15316. Sinusoidal map projection format.
  15317. @item fisheye
  15318. Fisheye projection.
  15319. Format specific options:
  15320. @table @option
  15321. @item h_fov
  15322. @item v_fov
  15323. @item d_fov
  15324. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15325. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15326. @item ih_fov
  15327. @item iv_fov
  15328. @item id_fov
  15329. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15330. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15331. @end table
  15332. @item pannini
  15333. Pannini projection.
  15334. Format specific options:
  15335. @table @option
  15336. @item h_fov
  15337. Set output pannini parameter.
  15338. @item ih_fov
  15339. Set input pannini parameter.
  15340. @end table
  15341. @item cylindrical
  15342. Cylindrical projection.
  15343. Format specific options:
  15344. @table @option
  15345. @item h_fov
  15346. @item v_fov
  15347. @item d_fov
  15348. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15349. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15350. @item ih_fov
  15351. @item iv_fov
  15352. @item id_fov
  15353. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15354. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15355. @end table
  15356. @item perspective
  15357. Perspective projection. @i{(output only)}
  15358. Format specific options:
  15359. @table @option
  15360. @item v_fov
  15361. Set perspective parameter.
  15362. @end table
  15363. @item tetrahedron
  15364. Tetrahedron projection.
  15365. @item tsp
  15366. Truncated square pyramid projection.
  15367. @item he
  15368. @item hequirect
  15369. Half equirectangular projection.
  15370. @item equisolid
  15371. Equisolid format.
  15372. Format specific options:
  15373. @table @option
  15374. @item h_fov
  15375. @item v_fov
  15376. @item d_fov
  15377. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15378. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15379. @item ih_fov
  15380. @item iv_fov
  15381. @item id_fov
  15382. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15383. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15384. @end table
  15385. @item og
  15386. Orthographic format.
  15387. Format specific options:
  15388. @table @option
  15389. @item h_fov
  15390. @item v_fov
  15391. @item d_fov
  15392. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15393. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15394. @item ih_fov
  15395. @item iv_fov
  15396. @item id_fov
  15397. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15398. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15399. @end table
  15400. @item octahedron
  15401. Octahedron projection.
  15402. @end table
  15403. @item interp
  15404. Set interpolation method.@*
  15405. @i{Note: more complex interpolation methods require much more memory to run.}
  15406. Available methods:
  15407. @table @samp
  15408. @item near
  15409. @item nearest
  15410. Nearest neighbour.
  15411. @item line
  15412. @item linear
  15413. Bilinear interpolation.
  15414. @item lagrange9
  15415. Lagrange9 interpolation.
  15416. @item cube
  15417. @item cubic
  15418. Bicubic interpolation.
  15419. @item lanc
  15420. @item lanczos
  15421. Lanczos interpolation.
  15422. @item sp16
  15423. @item spline16
  15424. Spline16 interpolation.
  15425. @item gauss
  15426. @item gaussian
  15427. Gaussian interpolation.
  15428. @item mitchell
  15429. Mitchell interpolation.
  15430. @end table
  15431. Default value is @b{@samp{line}}.
  15432. @item w
  15433. @item h
  15434. Set the output video resolution.
  15435. Default resolution depends on formats.
  15436. @item in_stereo
  15437. @item out_stereo
  15438. Set the input/output stereo format.
  15439. @table @samp
  15440. @item 2d
  15441. 2D mono
  15442. @item sbs
  15443. Side by side
  15444. @item tb
  15445. Top bottom
  15446. @end table
  15447. Default value is @b{@samp{2d}} for input and output format.
  15448. @item yaw
  15449. @item pitch
  15450. @item roll
  15451. Set rotation for the output video. Values in degrees.
  15452. @item rorder
  15453. Set rotation order for the output video. Choose one item for each position.
  15454. @table @samp
  15455. @item y, Y
  15456. yaw
  15457. @item p, P
  15458. pitch
  15459. @item r, R
  15460. roll
  15461. @end table
  15462. Default value is @b{@samp{ypr}}.
  15463. @item h_flip
  15464. @item v_flip
  15465. @item d_flip
  15466. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15467. @item ih_flip
  15468. @item iv_flip
  15469. Set if input video is flipped horizontally/vertically. Boolean values.
  15470. @item in_trans
  15471. Set if input video is transposed. Boolean value, by default disabled.
  15472. @item out_trans
  15473. Set if output video needs to be transposed. Boolean value, by default disabled.
  15474. @item alpha_mask
  15475. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15476. @end table
  15477. @subsection Examples
  15478. @itemize
  15479. @item
  15480. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15481. @example
  15482. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15483. @end example
  15484. @item
  15485. Extract back view of Equi-Angular Cubemap:
  15486. @example
  15487. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15488. @end example
  15489. @item
  15490. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15491. @example
  15492. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15493. @end example
  15494. @end itemize
  15495. @subsection Commands
  15496. This filter supports subset of above options as @ref{commands}.
  15497. @section vaguedenoiser
  15498. Apply a wavelet based denoiser.
  15499. It transforms each frame from the video input into the wavelet domain,
  15500. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15501. the obtained coefficients. It does an inverse wavelet transform after.
  15502. Due to wavelet properties, it should give a nice smoothed result, and
  15503. reduced noise, without blurring picture features.
  15504. This filter accepts the following options:
  15505. @table @option
  15506. @item threshold
  15507. The filtering strength. The higher, the more filtered the video will be.
  15508. Hard thresholding can use a higher threshold than soft thresholding
  15509. before the video looks overfiltered. Default value is 2.
  15510. @item method
  15511. The filtering method the filter will use.
  15512. It accepts the following values:
  15513. @table @samp
  15514. @item hard
  15515. All values under the threshold will be zeroed.
  15516. @item soft
  15517. All values under the threshold will be zeroed. All values above will be
  15518. reduced by the threshold.
  15519. @item garrote
  15520. Scales or nullifies coefficients - intermediary between (more) soft and
  15521. (less) hard thresholding.
  15522. @end table
  15523. Default is garrote.
  15524. @item nsteps
  15525. Number of times, the wavelet will decompose the picture. Picture can't
  15526. be decomposed beyond a particular point (typically, 8 for a 640x480
  15527. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15528. @item percent
  15529. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15530. @item planes
  15531. A list of the planes to process. By default all planes are processed.
  15532. @item type
  15533. The threshold type the filter will use.
  15534. It accepts the following values:
  15535. @table @samp
  15536. @item universal
  15537. Threshold used is same for all decompositions.
  15538. @item bayes
  15539. Threshold used depends also on each decomposition coefficients.
  15540. @end table
  15541. Default is universal.
  15542. @end table
  15543. @section vectorscope
  15544. Display 2 color component values in the two dimensional graph (which is called
  15545. a vectorscope).
  15546. This filter accepts the following options:
  15547. @table @option
  15548. @item mode, m
  15549. Set vectorscope mode.
  15550. It accepts the following values:
  15551. @table @samp
  15552. @item gray
  15553. @item tint
  15554. Gray values are displayed on graph, higher brightness means more pixels have
  15555. same component color value on location in graph. This is the default mode.
  15556. @item color
  15557. Gray values are displayed on graph. Surrounding pixels values which are not
  15558. present in video frame are drawn in gradient of 2 color components which are
  15559. set by option @code{x} and @code{y}. The 3rd color component is static.
  15560. @item color2
  15561. Actual color components values present in video frame are displayed on graph.
  15562. @item color3
  15563. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15564. on graph increases value of another color component, which is luminance by
  15565. default values of @code{x} and @code{y}.
  15566. @item color4
  15567. Actual colors present in video frame are displayed on graph. If two different
  15568. colors map to same position on graph then color with higher value of component
  15569. not present in graph is picked.
  15570. @item color5
  15571. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15572. component picked from radial gradient.
  15573. @end table
  15574. @item x
  15575. Set which color component will be represented on X-axis. Default is @code{1}.
  15576. @item y
  15577. Set which color component will be represented on Y-axis. Default is @code{2}.
  15578. @item intensity, i
  15579. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15580. of color component which represents frequency of (X, Y) location in graph.
  15581. @item envelope, e
  15582. @table @samp
  15583. @item none
  15584. No envelope, this is default.
  15585. @item instant
  15586. Instant envelope, even darkest single pixel will be clearly highlighted.
  15587. @item peak
  15588. Hold maximum and minimum values presented in graph over time. This way you
  15589. can still spot out of range values without constantly looking at vectorscope.
  15590. @item peak+instant
  15591. Peak and instant envelope combined together.
  15592. @end table
  15593. @item graticule, g
  15594. Set what kind of graticule to draw.
  15595. @table @samp
  15596. @item none
  15597. @item green
  15598. @item color
  15599. @item invert
  15600. @end table
  15601. @item opacity, o
  15602. Set graticule opacity.
  15603. @item flags, f
  15604. Set graticule flags.
  15605. @table @samp
  15606. @item white
  15607. Draw graticule for white point.
  15608. @item black
  15609. Draw graticule for black point.
  15610. @item name
  15611. Draw color points short names.
  15612. @end table
  15613. @item bgopacity, b
  15614. Set background opacity.
  15615. @item lthreshold, l
  15616. Set low threshold for color component not represented on X or Y axis.
  15617. Values lower than this value will be ignored. Default is 0.
  15618. Note this value is multiplied with actual max possible value one pixel component
  15619. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15620. is 0.1 * 255 = 25.
  15621. @item hthreshold, h
  15622. Set high threshold for color component not represented on X or Y axis.
  15623. Values higher than this value will be ignored. Default is 1.
  15624. Note this value is multiplied with actual max possible value one pixel component
  15625. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15626. is 0.9 * 255 = 230.
  15627. @item colorspace, c
  15628. Set what kind of colorspace to use when drawing graticule.
  15629. @table @samp
  15630. @item auto
  15631. @item 601
  15632. @item 709
  15633. @end table
  15634. Default is auto.
  15635. @item tint0, t0
  15636. @item tint1, t1
  15637. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15638. This means no tint, and output will remain gray.
  15639. @end table
  15640. @anchor{vidstabdetect}
  15641. @section vidstabdetect
  15642. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15643. @ref{vidstabtransform} for pass 2.
  15644. This filter generates a file with relative translation and rotation
  15645. transform information about subsequent frames, which is then used by
  15646. the @ref{vidstabtransform} filter.
  15647. To enable compilation of this filter you need to configure FFmpeg with
  15648. @code{--enable-libvidstab}.
  15649. This filter accepts the following options:
  15650. @table @option
  15651. @item result
  15652. Set the path to the file used to write the transforms information.
  15653. Default value is @file{transforms.trf}.
  15654. @item shakiness
  15655. Set how shaky the video is and how quick the camera is. It accepts an
  15656. integer in the range 1-10, a value of 1 means little shakiness, a
  15657. value of 10 means strong shakiness. Default value is 5.
  15658. @item accuracy
  15659. Set the accuracy of the detection process. It must be a value in the
  15660. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15661. accuracy. Default value is 15.
  15662. @item stepsize
  15663. Set stepsize of the search process. The region around minimum is
  15664. scanned with 1 pixel resolution. Default value is 6.
  15665. @item mincontrast
  15666. Set minimum contrast. Below this value a local measurement field is
  15667. discarded. Must be a floating point value in the range 0-1. Default
  15668. value is 0.3.
  15669. @item tripod
  15670. Set reference frame number for tripod mode.
  15671. If enabled, the motion of the frames is compared to a reference frame
  15672. in the filtered stream, identified by the specified number. The idea
  15673. is to compensate all movements in a more-or-less static scene and keep
  15674. the camera view absolutely still.
  15675. If set to 0, it is disabled. The frames are counted starting from 1.
  15676. @item show
  15677. Show fields and transforms in the resulting frames. It accepts an
  15678. integer in the range 0-2. Default value is 0, which disables any
  15679. visualization.
  15680. @end table
  15681. @subsection Examples
  15682. @itemize
  15683. @item
  15684. Use default values:
  15685. @example
  15686. vidstabdetect
  15687. @end example
  15688. @item
  15689. Analyze strongly shaky movie and put the results in file
  15690. @file{mytransforms.trf}:
  15691. @example
  15692. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15693. @end example
  15694. @item
  15695. Visualize the result of internal transformations in the resulting
  15696. video:
  15697. @example
  15698. vidstabdetect=show=1
  15699. @end example
  15700. @item
  15701. Analyze a video with medium shakiness using @command{ffmpeg}:
  15702. @example
  15703. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15704. @end example
  15705. @end itemize
  15706. @anchor{vidstabtransform}
  15707. @section vidstabtransform
  15708. Video stabilization/deshaking: pass 2 of 2,
  15709. see @ref{vidstabdetect} for pass 1.
  15710. Read a file with transform information for each frame and
  15711. apply/compensate them. Together with the @ref{vidstabdetect}
  15712. filter this can be used to deshake videos. See also
  15713. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15714. the @ref{unsharp} filter, see below.
  15715. To enable compilation of this filter you need to configure FFmpeg with
  15716. @code{--enable-libvidstab}.
  15717. @subsection Options
  15718. @table @option
  15719. @item input
  15720. Set path to the file used to read the transforms. Default value is
  15721. @file{transforms.trf}.
  15722. @item smoothing
  15723. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15724. camera movements. Default value is 10.
  15725. For example a number of 10 means that 21 frames are used (10 in the
  15726. past and 10 in the future) to smoothen the motion in the video. A
  15727. larger value leads to a smoother video, but limits the acceleration of
  15728. the camera (pan/tilt movements). 0 is a special case where a static
  15729. camera is simulated.
  15730. @item optalgo
  15731. Set the camera path optimization algorithm.
  15732. Accepted values are:
  15733. @table @samp
  15734. @item gauss
  15735. gaussian kernel low-pass filter on camera motion (default)
  15736. @item avg
  15737. averaging on transformations
  15738. @end table
  15739. @item maxshift
  15740. Set maximal number of pixels to translate frames. Default value is -1,
  15741. meaning no limit.
  15742. @item maxangle
  15743. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15744. value is -1, meaning no limit.
  15745. @item crop
  15746. Specify how to deal with borders that may be visible due to movement
  15747. compensation.
  15748. Available values are:
  15749. @table @samp
  15750. @item keep
  15751. keep image information from previous frame (default)
  15752. @item black
  15753. fill the border black
  15754. @end table
  15755. @item invert
  15756. Invert transforms if set to 1. Default value is 0.
  15757. @item relative
  15758. Consider transforms as relative to previous frame if set to 1,
  15759. absolute if set to 0. Default value is 0.
  15760. @item zoom
  15761. Set percentage to zoom. A positive value will result in a zoom-in
  15762. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15763. zoom).
  15764. @item optzoom
  15765. Set optimal zooming to avoid borders.
  15766. Accepted values are:
  15767. @table @samp
  15768. @item 0
  15769. disabled
  15770. @item 1
  15771. optimal static zoom value is determined (only very strong movements
  15772. will lead to visible borders) (default)
  15773. @item 2
  15774. optimal adaptive zoom value is determined (no borders will be
  15775. visible), see @option{zoomspeed}
  15776. @end table
  15777. Note that the value given at zoom is added to the one calculated here.
  15778. @item zoomspeed
  15779. Set percent to zoom maximally each frame (enabled when
  15780. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15781. 0.25.
  15782. @item interpol
  15783. Specify type of interpolation.
  15784. Available values are:
  15785. @table @samp
  15786. @item no
  15787. no interpolation
  15788. @item linear
  15789. linear only horizontal
  15790. @item bilinear
  15791. linear in both directions (default)
  15792. @item bicubic
  15793. cubic in both directions (slow)
  15794. @end table
  15795. @item tripod
  15796. Enable virtual tripod mode if set to 1, which is equivalent to
  15797. @code{relative=0:smoothing=0}. Default value is 0.
  15798. Use also @code{tripod} option of @ref{vidstabdetect}.
  15799. @item debug
  15800. Increase log verbosity if set to 1. Also the detected global motions
  15801. are written to the temporary file @file{global_motions.trf}. Default
  15802. value is 0.
  15803. @end table
  15804. @subsection Examples
  15805. @itemize
  15806. @item
  15807. Use @command{ffmpeg} for a typical stabilization with default values:
  15808. @example
  15809. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15810. @end example
  15811. Note the use of the @ref{unsharp} filter which is always recommended.
  15812. @item
  15813. Zoom in a bit more and load transform data from a given file:
  15814. @example
  15815. vidstabtransform=zoom=5:input="mytransforms.trf"
  15816. @end example
  15817. @item
  15818. Smoothen the video even more:
  15819. @example
  15820. vidstabtransform=smoothing=30
  15821. @end example
  15822. @end itemize
  15823. @section vflip
  15824. Flip the input video vertically.
  15825. For example, to vertically flip a video with @command{ffmpeg}:
  15826. @example
  15827. ffmpeg -i in.avi -vf "vflip" out.avi
  15828. @end example
  15829. @section vfrdet
  15830. Detect variable frame rate video.
  15831. This filter tries to detect if the input is variable or constant frame rate.
  15832. At end it will output number of frames detected as having variable delta pts,
  15833. and ones with constant delta pts.
  15834. If there was frames with variable delta, than it will also show min, max and
  15835. average delta encountered.
  15836. @section vibrance
  15837. Boost or alter saturation.
  15838. The filter accepts the following options:
  15839. @table @option
  15840. @item intensity
  15841. Set strength of boost if positive value or strength of alter if negative value.
  15842. Default is 0. Allowed range is from -2 to 2.
  15843. @item rbal
  15844. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15845. @item gbal
  15846. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15847. @item bbal
  15848. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15849. @item rlum
  15850. Set the red luma coefficient.
  15851. @item glum
  15852. Set the green luma coefficient.
  15853. @item blum
  15854. Set the blue luma coefficient.
  15855. @item alternate
  15856. If @code{intensity} is negative and this is set to 1, colors will change,
  15857. otherwise colors will be less saturated, more towards gray.
  15858. @end table
  15859. @subsection Commands
  15860. This filter supports the all above options as @ref{commands}.
  15861. @anchor{vignette}
  15862. @section vignette
  15863. Make or reverse a natural vignetting effect.
  15864. The filter accepts the following options:
  15865. @table @option
  15866. @item angle, a
  15867. Set lens angle expression as a number of radians.
  15868. The value is clipped in the @code{[0,PI/2]} range.
  15869. Default value: @code{"PI/5"}
  15870. @item x0
  15871. @item y0
  15872. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15873. by default.
  15874. @item mode
  15875. Set forward/backward mode.
  15876. Available modes are:
  15877. @table @samp
  15878. @item forward
  15879. The larger the distance from the central point, the darker the image becomes.
  15880. @item backward
  15881. The larger the distance from the central point, the brighter the image becomes.
  15882. This can be used to reverse a vignette effect, though there is no automatic
  15883. detection to extract the lens @option{angle} and other settings (yet). It can
  15884. also be used to create a burning effect.
  15885. @end table
  15886. Default value is @samp{forward}.
  15887. @item eval
  15888. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15889. It accepts the following values:
  15890. @table @samp
  15891. @item init
  15892. Evaluate expressions only once during the filter initialization.
  15893. @item frame
  15894. Evaluate expressions for each incoming frame. This is way slower than the
  15895. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15896. allows advanced dynamic expressions.
  15897. @end table
  15898. Default value is @samp{init}.
  15899. @item dither
  15900. Set dithering to reduce the circular banding effects. Default is @code{1}
  15901. (enabled).
  15902. @item aspect
  15903. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15904. Setting this value to the SAR of the input will make a rectangular vignetting
  15905. following the dimensions of the video.
  15906. Default is @code{1/1}.
  15907. @end table
  15908. @subsection Expressions
  15909. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15910. following parameters.
  15911. @table @option
  15912. @item w
  15913. @item h
  15914. input width and height
  15915. @item n
  15916. the number of input frame, starting from 0
  15917. @item pts
  15918. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15919. @var{TB} units, NAN if undefined
  15920. @item r
  15921. frame rate of the input video, NAN if the input frame rate is unknown
  15922. @item t
  15923. the PTS (Presentation TimeStamp) of the filtered video frame,
  15924. expressed in seconds, NAN if undefined
  15925. @item tb
  15926. time base of the input video
  15927. @end table
  15928. @subsection Examples
  15929. @itemize
  15930. @item
  15931. Apply simple strong vignetting effect:
  15932. @example
  15933. vignette=PI/4
  15934. @end example
  15935. @item
  15936. Make a flickering vignetting:
  15937. @example
  15938. vignette='PI/4+random(1)*PI/50':eval=frame
  15939. @end example
  15940. @end itemize
  15941. @section vmafmotion
  15942. Obtain the average VMAF motion score of a video.
  15943. It is one of the component metrics of VMAF.
  15944. The obtained average motion score is printed through the logging system.
  15945. The filter accepts the following options:
  15946. @table @option
  15947. @item stats_file
  15948. If specified, the filter will use the named file to save the motion score of
  15949. each frame with respect to the previous frame.
  15950. When filename equals "-" the data is sent to standard output.
  15951. @end table
  15952. Example:
  15953. @example
  15954. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15955. @end example
  15956. @section vstack
  15957. Stack input videos vertically.
  15958. All streams must be of same pixel format and of same width.
  15959. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15960. to create same output.
  15961. The filter accepts the following options:
  15962. @table @option
  15963. @item inputs
  15964. Set number of input streams. Default is 2.
  15965. @item shortest
  15966. If set to 1, force the output to terminate when the shortest input
  15967. terminates. Default value is 0.
  15968. @end table
  15969. @section w3fdif
  15970. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15971. Deinterlacing Filter").
  15972. Based on the process described by Martin Weston for BBC R&D, and
  15973. implemented based on the de-interlace algorithm written by Jim
  15974. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15975. uses filter coefficients calculated by BBC R&D.
  15976. This filter uses field-dominance information in frame to decide which
  15977. of each pair of fields to place first in the output.
  15978. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15979. There are two sets of filter coefficients, so called "simple"
  15980. and "complex". Which set of filter coefficients is used can
  15981. be set by passing an optional parameter:
  15982. @table @option
  15983. @item filter
  15984. Set the interlacing filter coefficients. Accepts one of the following values:
  15985. @table @samp
  15986. @item simple
  15987. Simple filter coefficient set.
  15988. @item complex
  15989. More-complex filter coefficient set.
  15990. @end table
  15991. Default value is @samp{complex}.
  15992. @item mode
  15993. The interlacing mode to adopt. It accepts one of the following values:
  15994. @table @option
  15995. @item frame
  15996. Output one frame for each frame.
  15997. @item field
  15998. Output one frame for each field.
  15999. @end table
  16000. The default value is @code{field}.
  16001. @item parity
  16002. The picture field parity assumed for the input interlaced video. It accepts one
  16003. of the following values:
  16004. @table @option
  16005. @item tff
  16006. Assume the top field is first.
  16007. @item bff
  16008. Assume the bottom field is first.
  16009. @item auto
  16010. Enable automatic detection of field parity.
  16011. @end table
  16012. The default value is @code{auto}.
  16013. If the interlacing is unknown or the decoder does not export this information,
  16014. top field first will be assumed.
  16015. @item deint
  16016. Specify which frames to deinterlace. Accepts one of the following values:
  16017. @table @samp
  16018. @item all
  16019. Deinterlace all frames,
  16020. @item interlaced
  16021. Only deinterlace frames marked as interlaced.
  16022. @end table
  16023. Default value is @samp{all}.
  16024. @end table
  16025. @subsection Commands
  16026. This filter supports same @ref{commands} as options.
  16027. @section waveform
  16028. Video waveform monitor.
  16029. The waveform monitor plots color component intensity. By default luminance
  16030. only. Each column of the waveform corresponds to a column of pixels in the
  16031. source video.
  16032. It accepts the following options:
  16033. @table @option
  16034. @item mode, m
  16035. Can be either @code{row}, or @code{column}. Default is @code{column}.
  16036. In row mode, the graph on the left side represents color component value 0 and
  16037. the right side represents value = 255. In column mode, the top side represents
  16038. color component value = 0 and bottom side represents value = 255.
  16039. @item intensity, i
  16040. Set intensity. Smaller values are useful to find out how many values of the same
  16041. luminance are distributed across input rows/columns.
  16042. Default value is @code{0.04}. Allowed range is [0, 1].
  16043. @item mirror, r
  16044. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  16045. In mirrored mode, higher values will be represented on the left
  16046. side for @code{row} mode and at the top for @code{column} mode. Default is
  16047. @code{1} (mirrored).
  16048. @item display, d
  16049. Set display mode.
  16050. It accepts the following values:
  16051. @table @samp
  16052. @item overlay
  16053. Presents information identical to that in the @code{parade}, except
  16054. that the graphs representing color components are superimposed directly
  16055. over one another.
  16056. This display mode makes it easier to spot relative differences or similarities
  16057. in overlapping areas of the color components that are supposed to be identical,
  16058. such as neutral whites, grays, or blacks.
  16059. @item stack
  16060. Display separate graph for the color components side by side in
  16061. @code{row} mode or one below the other in @code{column} mode.
  16062. @item parade
  16063. Display separate graph for the color components side by side in
  16064. @code{column} mode or one below the other in @code{row} mode.
  16065. Using this display mode makes it easy to spot color casts in the highlights
  16066. and shadows of an image, by comparing the contours of the top and the bottom
  16067. graphs of each waveform. Since whites, grays, and blacks are characterized
  16068. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  16069. should display three waveforms of roughly equal width/height. If not, the
  16070. correction is easy to perform by making level adjustments the three waveforms.
  16071. @end table
  16072. Default is @code{stack}.
  16073. @item components, c
  16074. Set which color components to display. Default is 1, which means only luminance
  16075. or red color component if input is in RGB colorspace. If is set for example to
  16076. 7 it will display all 3 (if) available color components.
  16077. @item envelope, e
  16078. @table @samp
  16079. @item none
  16080. No envelope, this is default.
  16081. @item instant
  16082. Instant envelope, minimum and maximum values presented in graph will be easily
  16083. visible even with small @code{step} value.
  16084. @item peak
  16085. Hold minimum and maximum values presented in graph across time. This way you
  16086. can still spot out of range values without constantly looking at waveforms.
  16087. @item peak+instant
  16088. Peak and instant envelope combined together.
  16089. @end table
  16090. @item filter, f
  16091. @table @samp
  16092. @item lowpass
  16093. No filtering, this is default.
  16094. @item flat
  16095. Luma and chroma combined together.
  16096. @item aflat
  16097. Similar as above, but shows difference between blue and red chroma.
  16098. @item xflat
  16099. Similar as above, but use different colors.
  16100. @item yflat
  16101. Similar as above, but again with different colors.
  16102. @item chroma
  16103. Displays only chroma.
  16104. @item color
  16105. Displays actual color value on waveform.
  16106. @item acolor
  16107. Similar as above, but with luma showing frequency of chroma values.
  16108. @end table
  16109. @item graticule, g
  16110. Set which graticule to display.
  16111. @table @samp
  16112. @item none
  16113. Do not display graticule.
  16114. @item green
  16115. Display green graticule showing legal broadcast ranges.
  16116. @item orange
  16117. Display orange graticule showing legal broadcast ranges.
  16118. @item invert
  16119. Display invert graticule showing legal broadcast ranges.
  16120. @end table
  16121. @item opacity, o
  16122. Set graticule opacity.
  16123. @item flags, fl
  16124. Set graticule flags.
  16125. @table @samp
  16126. @item numbers
  16127. Draw numbers above lines. By default enabled.
  16128. @item dots
  16129. Draw dots instead of lines.
  16130. @end table
  16131. @item scale, s
  16132. Set scale used for displaying graticule.
  16133. @table @samp
  16134. @item digital
  16135. @item millivolts
  16136. @item ire
  16137. @end table
  16138. Default is digital.
  16139. @item bgopacity, b
  16140. Set background opacity.
  16141. @item tint0, t0
  16142. @item tint1, t1
  16143. Set tint for output.
  16144. Only used with lowpass filter and when display is not overlay and input
  16145. pixel formats are not RGB.
  16146. @end table
  16147. @section weave, doubleweave
  16148. The @code{weave} takes a field-based video input and join
  16149. each two sequential fields into single frame, producing a new double
  16150. height clip with half the frame rate and half the frame count.
  16151. The @code{doubleweave} works same as @code{weave} but without
  16152. halving frame rate and frame count.
  16153. It accepts the following option:
  16154. @table @option
  16155. @item first_field
  16156. Set first field. Available values are:
  16157. @table @samp
  16158. @item top, t
  16159. Set the frame as top-field-first.
  16160. @item bottom, b
  16161. Set the frame as bottom-field-first.
  16162. @end table
  16163. @end table
  16164. @subsection Examples
  16165. @itemize
  16166. @item
  16167. Interlace video using @ref{select} and @ref{separatefields} filter:
  16168. @example
  16169. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  16170. @end example
  16171. @end itemize
  16172. @section xbr
  16173. Apply the xBR high-quality magnification filter which is designed for pixel
  16174. art. It follows a set of edge-detection rules, see
  16175. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  16176. It accepts the following option:
  16177. @table @option
  16178. @item n
  16179. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  16180. @code{3xBR} and @code{4} for @code{4xBR}.
  16181. Default is @code{3}.
  16182. @end table
  16183. @section xfade
  16184. Apply cross fade from one input video stream to another input video stream.
  16185. The cross fade is applied for specified duration.
  16186. The filter accepts the following options:
  16187. @table @option
  16188. @item transition
  16189. Set one of available transition effects:
  16190. @table @samp
  16191. @item custom
  16192. @item fade
  16193. @item wipeleft
  16194. @item wiperight
  16195. @item wipeup
  16196. @item wipedown
  16197. @item slideleft
  16198. @item slideright
  16199. @item slideup
  16200. @item slidedown
  16201. @item circlecrop
  16202. @item rectcrop
  16203. @item distance
  16204. @item fadeblack
  16205. @item fadewhite
  16206. @item radial
  16207. @item smoothleft
  16208. @item smoothright
  16209. @item smoothup
  16210. @item smoothdown
  16211. @item circleopen
  16212. @item circleclose
  16213. @item vertopen
  16214. @item vertclose
  16215. @item horzopen
  16216. @item horzclose
  16217. @item dissolve
  16218. @item pixelize
  16219. @item diagtl
  16220. @item diagtr
  16221. @item diagbl
  16222. @item diagbr
  16223. @item hlslice
  16224. @item hrslice
  16225. @item vuslice
  16226. @item vdslice
  16227. @item hblur
  16228. @item fadegrays
  16229. @item wipetl
  16230. @item wipetr
  16231. @item wipebl
  16232. @item wipebr
  16233. @item squeezeh
  16234. @item squeezev
  16235. @end table
  16236. Default transition effect is fade.
  16237. @item duration
  16238. Set cross fade duration in seconds.
  16239. Default duration is 1 second.
  16240. @item offset
  16241. Set cross fade start relative to first input stream in seconds.
  16242. Default offset is 0.
  16243. @item expr
  16244. Set expression for custom transition effect.
  16245. The expressions can use the following variables and functions:
  16246. @table @option
  16247. @item X
  16248. @item Y
  16249. The coordinates of the current sample.
  16250. @item W
  16251. @item H
  16252. The width and height of the image.
  16253. @item P
  16254. Progress of transition effect.
  16255. @item PLANE
  16256. Currently processed plane.
  16257. @item A
  16258. Return value of first input at current location and plane.
  16259. @item B
  16260. Return value of second input at current location and plane.
  16261. @item a0(x, y)
  16262. @item a1(x, y)
  16263. @item a2(x, y)
  16264. @item a3(x, y)
  16265. Return the value of the pixel at location (@var{x},@var{y}) of the
  16266. first/second/third/fourth component of first input.
  16267. @item b0(x, y)
  16268. @item b1(x, y)
  16269. @item b2(x, y)
  16270. @item b3(x, y)
  16271. Return the value of the pixel at location (@var{x},@var{y}) of the
  16272. first/second/third/fourth component of second input.
  16273. @end table
  16274. @end table
  16275. @subsection Examples
  16276. @itemize
  16277. @item
  16278. Cross fade from one input video to another input video, with fade transition and duration of transition
  16279. of 2 seconds starting at offset of 5 seconds:
  16280. @example
  16281. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16282. @end example
  16283. @end itemize
  16284. @section xmedian
  16285. Pick median pixels from several input videos.
  16286. The filter accepts the following options:
  16287. @table @option
  16288. @item inputs
  16289. Set number of inputs.
  16290. Default is 3. Allowed range is from 3 to 255.
  16291. If number of inputs is even number, than result will be mean value between two median values.
  16292. @item planes
  16293. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16294. @item percentile
  16295. Set median percentile. Default value is @code{0.5}.
  16296. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16297. minimum values, and @code{1} maximum values.
  16298. @end table
  16299. @subsection Commands
  16300. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  16301. @section xstack
  16302. Stack video inputs into custom layout.
  16303. All streams must be of same pixel format.
  16304. The filter accepts the following options:
  16305. @table @option
  16306. @item inputs
  16307. Set number of input streams. Default is 2.
  16308. @item layout
  16309. Specify layout of inputs.
  16310. This option requires the desired layout configuration to be explicitly set by the user.
  16311. This sets position of each video input in output. Each input
  16312. is separated by '|'.
  16313. The first number represents the column, and the second number represents the row.
  16314. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16315. where X is video input from which to take width or height.
  16316. Multiple values can be used when separated by '+'. In such
  16317. case values are summed together.
  16318. Note that if inputs are of different sizes gaps may appear, as not all of
  16319. the output video frame will be filled. Similarly, videos can overlap each
  16320. other if their position doesn't leave enough space for the full frame of
  16321. adjoining videos.
  16322. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16323. a layout must be set by the user.
  16324. @item shortest
  16325. If set to 1, force the output to terminate when the shortest input
  16326. terminates. Default value is 0.
  16327. @item fill
  16328. If set to valid color, all unused pixels will be filled with that color.
  16329. By default fill is set to none, so it is disabled.
  16330. @end table
  16331. @subsection Examples
  16332. @itemize
  16333. @item
  16334. Display 4 inputs into 2x2 grid.
  16335. Layout:
  16336. @example
  16337. input1(0, 0) | input3(w0, 0)
  16338. input2(0, h0) | input4(w0, h0)
  16339. @end example
  16340. @example
  16341. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16342. @end example
  16343. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16344. @item
  16345. Display 4 inputs into 1x4 grid.
  16346. Layout:
  16347. @example
  16348. input1(0, 0)
  16349. input2(0, h0)
  16350. input3(0, h0+h1)
  16351. input4(0, h0+h1+h2)
  16352. @end example
  16353. @example
  16354. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16355. @end example
  16356. Note that if inputs are of different widths, unused space will appear.
  16357. @item
  16358. Display 9 inputs into 3x3 grid.
  16359. Layout:
  16360. @example
  16361. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16362. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16363. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16364. @end example
  16365. @example
  16366. 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
  16367. @end example
  16368. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16369. @item
  16370. Display 16 inputs into 4x4 grid.
  16371. Layout:
  16372. @example
  16373. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16374. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16375. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16376. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16377. @end example
  16378. @example
  16379. 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|
  16380. 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
  16381. @end example
  16382. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16383. @end itemize
  16384. @anchor{yadif}
  16385. @section yadif
  16386. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16387. filter").
  16388. It accepts the following parameters:
  16389. @table @option
  16390. @item mode
  16391. The interlacing mode to adopt. It accepts one of the following values:
  16392. @table @option
  16393. @item 0, send_frame
  16394. Output one frame for each frame.
  16395. @item 1, send_field
  16396. Output one frame for each field.
  16397. @item 2, send_frame_nospatial
  16398. Like @code{send_frame}, but it skips the spatial interlacing check.
  16399. @item 3, send_field_nospatial
  16400. Like @code{send_field}, but it skips the spatial interlacing check.
  16401. @end table
  16402. The default value is @code{send_frame}.
  16403. @item parity
  16404. The picture field parity assumed for the input interlaced video. It accepts one
  16405. of the following values:
  16406. @table @option
  16407. @item 0, tff
  16408. Assume the top field is first.
  16409. @item 1, bff
  16410. Assume the bottom field is first.
  16411. @item -1, auto
  16412. Enable automatic detection of field parity.
  16413. @end table
  16414. The default value is @code{auto}.
  16415. If the interlacing is unknown or the decoder does not export this information,
  16416. top field first will be assumed.
  16417. @item deint
  16418. Specify which frames to deinterlace. Accepts one of the following
  16419. values:
  16420. @table @option
  16421. @item 0, all
  16422. Deinterlace all frames.
  16423. @item 1, interlaced
  16424. Only deinterlace frames marked as interlaced.
  16425. @end table
  16426. The default value is @code{all}.
  16427. @end table
  16428. @section yadif_cuda
  16429. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16430. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16431. and/or nvenc.
  16432. It accepts the following parameters:
  16433. @table @option
  16434. @item mode
  16435. The interlacing mode to adopt. It accepts one of the following values:
  16436. @table @option
  16437. @item 0, send_frame
  16438. Output one frame for each frame.
  16439. @item 1, send_field
  16440. Output one frame for each field.
  16441. @item 2, send_frame_nospatial
  16442. Like @code{send_frame}, but it skips the spatial interlacing check.
  16443. @item 3, send_field_nospatial
  16444. Like @code{send_field}, but it skips the spatial interlacing check.
  16445. @end table
  16446. The default value is @code{send_frame}.
  16447. @item parity
  16448. The picture field parity assumed for the input interlaced video. It accepts one
  16449. of the following values:
  16450. @table @option
  16451. @item 0, tff
  16452. Assume the top field is first.
  16453. @item 1, bff
  16454. Assume the bottom field is first.
  16455. @item -1, auto
  16456. Enable automatic detection of field parity.
  16457. @end table
  16458. The default value is @code{auto}.
  16459. If the interlacing is unknown or the decoder does not export this information,
  16460. top field first will be assumed.
  16461. @item deint
  16462. Specify which frames to deinterlace. Accepts one of the following
  16463. values:
  16464. @table @option
  16465. @item 0, all
  16466. Deinterlace all frames.
  16467. @item 1, interlaced
  16468. Only deinterlace frames marked as interlaced.
  16469. @end table
  16470. The default value is @code{all}.
  16471. @end table
  16472. @section yaepblur
  16473. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16474. The algorithm is described in
  16475. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16476. It accepts the following parameters:
  16477. @table @option
  16478. @item radius, r
  16479. Set the window radius. Default value is 3.
  16480. @item planes, p
  16481. Set which planes to filter. Default is only the first plane.
  16482. @item sigma, s
  16483. Set blur strength. Default value is 128.
  16484. @end table
  16485. @subsection Commands
  16486. This filter supports same @ref{commands} as options.
  16487. @section zoompan
  16488. Apply Zoom & Pan effect.
  16489. This filter accepts the following options:
  16490. @table @option
  16491. @item zoom, z
  16492. Set the zoom expression. Range is 1-10. Default is 1.
  16493. @item x
  16494. @item y
  16495. Set the x and y expression. Default is 0.
  16496. @item d
  16497. Set the duration expression in number of frames.
  16498. This sets for how many number of frames effect will last for
  16499. single input image.
  16500. @item s
  16501. Set the output image size, default is 'hd720'.
  16502. @item fps
  16503. Set the output frame rate, default is '25'.
  16504. @end table
  16505. Each expression can contain the following constants:
  16506. @table @option
  16507. @item in_w, iw
  16508. Input width.
  16509. @item in_h, ih
  16510. Input height.
  16511. @item out_w, ow
  16512. Output width.
  16513. @item out_h, oh
  16514. Output height.
  16515. @item in
  16516. Input frame count.
  16517. @item on
  16518. Output frame count.
  16519. @item in_time, it
  16520. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16521. @item out_time, time, ot
  16522. The output timestamp expressed in seconds.
  16523. @item x
  16524. @item y
  16525. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16526. for current input frame.
  16527. @item px
  16528. @item py
  16529. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16530. not yet such frame (first input frame).
  16531. @item zoom
  16532. Last calculated zoom from 'z' expression for current input frame.
  16533. @item pzoom
  16534. Last calculated zoom of last output frame of previous input frame.
  16535. @item duration
  16536. Number of output frames for current input frame. Calculated from 'd' expression
  16537. for each input frame.
  16538. @item pduration
  16539. number of output frames created for previous input frame
  16540. @item a
  16541. Rational number: input width / input height
  16542. @item sar
  16543. sample aspect ratio
  16544. @item dar
  16545. display aspect ratio
  16546. @end table
  16547. @subsection Examples
  16548. @itemize
  16549. @item
  16550. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16551. @example
  16552. 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
  16553. @end example
  16554. @item
  16555. Zoom in up to 1.5x and pan always at center of picture:
  16556. @example
  16557. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16558. @end example
  16559. @item
  16560. Same as above but without pausing:
  16561. @example
  16562. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16563. @end example
  16564. @item
  16565. Zoom in 2x into center of picture only for the first second of the input video:
  16566. @example
  16567. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16568. @end example
  16569. @end itemize
  16570. @anchor{zscale}
  16571. @section zscale
  16572. Scale (resize) the input video, using the z.lib library:
  16573. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16574. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16575. The zscale filter forces the output display aspect ratio to be the same
  16576. as the input, by changing the output sample aspect ratio.
  16577. If the input image format is different from the format requested by
  16578. the next filter, the zscale filter will convert the input to the
  16579. requested format.
  16580. @subsection Options
  16581. The filter accepts the following options.
  16582. @table @option
  16583. @item width, w
  16584. @item height, h
  16585. Set the output video dimension expression. Default value is the input
  16586. dimension.
  16587. If the @var{width} or @var{w} value is 0, the input width is used for
  16588. the output. If the @var{height} or @var{h} value is 0, the input height
  16589. is used for the output.
  16590. If one and only one of the values is -n with n >= 1, the zscale filter
  16591. will use a value that maintains the aspect ratio of the input image,
  16592. calculated from the other specified dimension. After that it will,
  16593. however, make sure that the calculated dimension is divisible by n and
  16594. adjust the value if necessary.
  16595. If both values are -n with n >= 1, the behavior will be identical to
  16596. both values being set to 0 as previously detailed.
  16597. See below for the list of accepted constants for use in the dimension
  16598. expression.
  16599. @item size, s
  16600. Set the video size. For the syntax of this option, check the
  16601. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16602. @item dither, d
  16603. Set the dither type.
  16604. Possible values are:
  16605. @table @var
  16606. @item none
  16607. @item ordered
  16608. @item random
  16609. @item error_diffusion
  16610. @end table
  16611. Default is none.
  16612. @item filter, f
  16613. Set the resize filter type.
  16614. Possible values are:
  16615. @table @var
  16616. @item point
  16617. @item bilinear
  16618. @item bicubic
  16619. @item spline16
  16620. @item spline36
  16621. @item lanczos
  16622. @end table
  16623. Default is bilinear.
  16624. @item range, r
  16625. Set the color range.
  16626. Possible values are:
  16627. @table @var
  16628. @item input
  16629. @item limited
  16630. @item full
  16631. @end table
  16632. Default is same as input.
  16633. @item primaries, p
  16634. Set the color primaries.
  16635. Possible values are:
  16636. @table @var
  16637. @item input
  16638. @item 709
  16639. @item unspecified
  16640. @item 170m
  16641. @item 240m
  16642. @item 2020
  16643. @end table
  16644. Default is same as input.
  16645. @item transfer, t
  16646. Set the transfer characteristics.
  16647. Possible values are:
  16648. @table @var
  16649. @item input
  16650. @item 709
  16651. @item unspecified
  16652. @item 601
  16653. @item linear
  16654. @item 2020_10
  16655. @item 2020_12
  16656. @item smpte2084
  16657. @item iec61966-2-1
  16658. @item arib-std-b67
  16659. @end table
  16660. Default is same as input.
  16661. @item matrix, m
  16662. Set the colorspace matrix.
  16663. Possible value are:
  16664. @table @var
  16665. @item input
  16666. @item 709
  16667. @item unspecified
  16668. @item 470bg
  16669. @item 170m
  16670. @item 2020_ncl
  16671. @item 2020_cl
  16672. @end table
  16673. Default is same as input.
  16674. @item rangein, rin
  16675. Set the input color range.
  16676. Possible values are:
  16677. @table @var
  16678. @item input
  16679. @item limited
  16680. @item full
  16681. @end table
  16682. Default is same as input.
  16683. @item primariesin, pin
  16684. Set the input color primaries.
  16685. Possible values are:
  16686. @table @var
  16687. @item input
  16688. @item 709
  16689. @item unspecified
  16690. @item 170m
  16691. @item 240m
  16692. @item 2020
  16693. @end table
  16694. Default is same as input.
  16695. @item transferin, tin
  16696. Set the input transfer characteristics.
  16697. Possible values are:
  16698. @table @var
  16699. @item input
  16700. @item 709
  16701. @item unspecified
  16702. @item 601
  16703. @item linear
  16704. @item 2020_10
  16705. @item 2020_12
  16706. @end table
  16707. Default is same as input.
  16708. @item matrixin, min
  16709. Set the input colorspace matrix.
  16710. Possible value are:
  16711. @table @var
  16712. @item input
  16713. @item 709
  16714. @item unspecified
  16715. @item 470bg
  16716. @item 170m
  16717. @item 2020_ncl
  16718. @item 2020_cl
  16719. @end table
  16720. @item chromal, c
  16721. Set the output chroma location.
  16722. Possible values are:
  16723. @table @var
  16724. @item input
  16725. @item left
  16726. @item center
  16727. @item topleft
  16728. @item top
  16729. @item bottomleft
  16730. @item bottom
  16731. @end table
  16732. @item chromalin, cin
  16733. Set the input chroma location.
  16734. Possible values are:
  16735. @table @var
  16736. @item input
  16737. @item left
  16738. @item center
  16739. @item topleft
  16740. @item top
  16741. @item bottomleft
  16742. @item bottom
  16743. @end table
  16744. @item npl
  16745. Set the nominal peak luminance.
  16746. @end table
  16747. The values of the @option{w} and @option{h} options are expressions
  16748. containing the following constants:
  16749. @table @var
  16750. @item in_w
  16751. @item in_h
  16752. The input width and height
  16753. @item iw
  16754. @item ih
  16755. These are the same as @var{in_w} and @var{in_h}.
  16756. @item out_w
  16757. @item out_h
  16758. The output (scaled) width and height
  16759. @item ow
  16760. @item oh
  16761. These are the same as @var{out_w} and @var{out_h}
  16762. @item a
  16763. The same as @var{iw} / @var{ih}
  16764. @item sar
  16765. input sample aspect ratio
  16766. @item dar
  16767. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16768. @item hsub
  16769. @item vsub
  16770. horizontal and vertical input chroma subsample values. For example for the
  16771. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16772. @item ohsub
  16773. @item ovsub
  16774. horizontal and vertical output chroma subsample values. For example for the
  16775. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16776. @end table
  16777. @subsection Commands
  16778. This filter supports the following commands:
  16779. @table @option
  16780. @item width, w
  16781. @item height, h
  16782. Set the output video dimension expression.
  16783. The command accepts the same syntax of the corresponding option.
  16784. If the specified expression is not valid, it is kept at its current
  16785. value.
  16786. @end table
  16787. @c man end VIDEO FILTERS
  16788. @chapter OpenCL Video Filters
  16789. @c man begin OPENCL VIDEO FILTERS
  16790. Below is a description of the currently available OpenCL video filters.
  16791. To enable compilation of these filters you need to configure FFmpeg with
  16792. @code{--enable-opencl}.
  16793. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16794. @table @option
  16795. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16796. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16797. given device parameters.
  16798. @item -filter_hw_device @var{name}
  16799. Pass the hardware device called @var{name} to all filters in any filter graph.
  16800. @end table
  16801. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16802. @itemize
  16803. @item
  16804. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16805. @example
  16806. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16807. @end example
  16808. @end itemize
  16809. 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.
  16810. @section avgblur_opencl
  16811. Apply average blur filter.
  16812. The filter accepts the following options:
  16813. @table @option
  16814. @item sizeX
  16815. Set horizontal radius size.
  16816. Range is @code{[1, 1024]} and default value is @code{1}.
  16817. @item planes
  16818. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16819. @item sizeY
  16820. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16821. @end table
  16822. @subsection Example
  16823. @itemize
  16824. @item
  16825. 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.
  16826. @example
  16827. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16828. @end example
  16829. @end itemize
  16830. @section boxblur_opencl
  16831. Apply a boxblur algorithm to the input video.
  16832. It accepts the following parameters:
  16833. @table @option
  16834. @item luma_radius, lr
  16835. @item luma_power, lp
  16836. @item chroma_radius, cr
  16837. @item chroma_power, cp
  16838. @item alpha_radius, ar
  16839. @item alpha_power, ap
  16840. @end table
  16841. A description of the accepted options follows.
  16842. @table @option
  16843. @item luma_radius, lr
  16844. @item chroma_radius, cr
  16845. @item alpha_radius, ar
  16846. Set an expression for the box radius in pixels used for blurring the
  16847. corresponding input plane.
  16848. The radius value must be a non-negative number, and must not be
  16849. greater than the value of the expression @code{min(w,h)/2} for the
  16850. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16851. planes.
  16852. Default value for @option{luma_radius} is "2". If not specified,
  16853. @option{chroma_radius} and @option{alpha_radius} default to the
  16854. corresponding value set for @option{luma_radius}.
  16855. The expressions can contain the following constants:
  16856. @table @option
  16857. @item w
  16858. @item h
  16859. The input width and height in pixels.
  16860. @item cw
  16861. @item ch
  16862. The input chroma image width and height in pixels.
  16863. @item hsub
  16864. @item vsub
  16865. The horizontal and vertical chroma subsample values. For example, for the
  16866. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16867. @end table
  16868. @item luma_power, lp
  16869. @item chroma_power, cp
  16870. @item alpha_power, ap
  16871. Specify how many times the boxblur filter is applied to the
  16872. corresponding plane.
  16873. Default value for @option{luma_power} is 2. If not specified,
  16874. @option{chroma_power} and @option{alpha_power} default to the
  16875. corresponding value set for @option{luma_power}.
  16876. A value of 0 will disable the effect.
  16877. @end table
  16878. @subsection Examples
  16879. 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.
  16880. @itemize
  16881. @item
  16882. Apply a boxblur filter with the luma, chroma, and alpha radius
  16883. 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.
  16884. @example
  16885. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16886. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16887. @end example
  16888. @item
  16889. 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.
  16890. For the luma plane, a 2x2 box radius will be run once.
  16891. For the chroma plane, a 4x4 box radius will be run 5 times.
  16892. For the alpha plane, a 3x3 box radius will be run 7 times.
  16893. @example
  16894. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16895. @end example
  16896. @end itemize
  16897. @section colorkey_opencl
  16898. RGB colorspace color keying.
  16899. The filter accepts the following options:
  16900. @table @option
  16901. @item color
  16902. The color which will be replaced with transparency.
  16903. @item similarity
  16904. Similarity percentage with the key color.
  16905. 0.01 matches only the exact key color, while 1.0 matches everything.
  16906. @item blend
  16907. Blend percentage.
  16908. 0.0 makes pixels either fully transparent, or not transparent at all.
  16909. Higher values result in semi-transparent pixels, with a higher transparency
  16910. the more similar the pixels color is to the key color.
  16911. @end table
  16912. @subsection Examples
  16913. @itemize
  16914. @item
  16915. Make every semi-green pixel in the input transparent with some slight blending:
  16916. @example
  16917. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16918. @end example
  16919. @end itemize
  16920. @section convolution_opencl
  16921. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16922. The filter accepts the following options:
  16923. @table @option
  16924. @item 0m
  16925. @item 1m
  16926. @item 2m
  16927. @item 3m
  16928. Set matrix for each plane.
  16929. Matrix is sequence of 9, 25 or 49 signed numbers.
  16930. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16931. @item 0rdiv
  16932. @item 1rdiv
  16933. @item 2rdiv
  16934. @item 3rdiv
  16935. Set multiplier for calculated value for each plane.
  16936. If unset or 0, it will be sum of all matrix elements.
  16937. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16938. @item 0bias
  16939. @item 1bias
  16940. @item 2bias
  16941. @item 3bias
  16942. Set bias for each plane. This value is added to the result of the multiplication.
  16943. Useful for making the overall image brighter or darker.
  16944. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16945. @end table
  16946. @subsection Examples
  16947. @itemize
  16948. @item
  16949. Apply sharpen:
  16950. @example
  16951. -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
  16952. @end example
  16953. @item
  16954. Apply blur:
  16955. @example
  16956. -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
  16957. @end example
  16958. @item
  16959. Apply edge enhance:
  16960. @example
  16961. -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
  16962. @end example
  16963. @item
  16964. Apply edge detect:
  16965. @example
  16966. -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
  16967. @end example
  16968. @item
  16969. Apply laplacian edge detector which includes diagonals:
  16970. @example
  16971. -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
  16972. @end example
  16973. @item
  16974. Apply emboss:
  16975. @example
  16976. -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
  16977. @end example
  16978. @end itemize
  16979. @section erosion_opencl
  16980. Apply erosion effect to the video.
  16981. This filter replaces the pixel by the local(3x3) minimum.
  16982. It accepts the following options:
  16983. @table @option
  16984. @item threshold0
  16985. @item threshold1
  16986. @item threshold2
  16987. @item threshold3
  16988. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16989. If @code{0}, plane will remain unchanged.
  16990. @item coordinates
  16991. Flag which specifies the pixel to refer to.
  16992. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16993. Flags to local 3x3 coordinates region centered on @code{x}:
  16994. 1 2 3
  16995. 4 x 5
  16996. 6 7 8
  16997. @end table
  16998. @subsection Example
  16999. @itemize
  17000. @item
  17001. 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.
  17002. @example
  17003. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17004. @end example
  17005. @end itemize
  17006. @section deshake_opencl
  17007. Feature-point based video stabilization filter.
  17008. The filter accepts the following options:
  17009. @table @option
  17010. @item tripod
  17011. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  17012. @item debug
  17013. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  17014. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  17015. Viewing point matches in the output video is only supported for RGB input.
  17016. Defaults to @code{0}.
  17017. @item adaptive_crop
  17018. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  17019. Defaults to @code{1}.
  17020. @item refine_features
  17021. Whether or not feature points should be refined at a sub-pixel level.
  17022. This can be turned off for a slight performance gain at the cost of precision.
  17023. Defaults to @code{1}.
  17024. @item smooth_strength
  17025. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  17026. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  17027. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  17028. Defaults to @code{0.0}.
  17029. @item smooth_window_multiplier
  17030. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  17031. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  17032. Acceptable values range from @code{0.1} to @code{10.0}.
  17033. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  17034. potentially improving smoothness, but also increase latency and memory usage.
  17035. Defaults to @code{2.0}.
  17036. @end table
  17037. @subsection Examples
  17038. @itemize
  17039. @item
  17040. Stabilize a video with a fixed, medium smoothing strength:
  17041. @example
  17042. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  17043. @end example
  17044. @item
  17045. Stabilize a video with debugging (both in console and in rendered video):
  17046. @example
  17047. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  17048. @end example
  17049. @end itemize
  17050. @section dilation_opencl
  17051. Apply dilation effect to the video.
  17052. This filter replaces the pixel by the local(3x3) maximum.
  17053. It accepts the following options:
  17054. @table @option
  17055. @item threshold0
  17056. @item threshold1
  17057. @item threshold2
  17058. @item threshold3
  17059. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  17060. If @code{0}, plane will remain unchanged.
  17061. @item coordinates
  17062. Flag which specifies the pixel to refer to.
  17063. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  17064. Flags to local 3x3 coordinates region centered on @code{x}:
  17065. 1 2 3
  17066. 4 x 5
  17067. 6 7 8
  17068. @end table
  17069. @subsection Example
  17070. @itemize
  17071. @item
  17072. 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.
  17073. @example
  17074. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  17075. @end example
  17076. @end itemize
  17077. @section nlmeans_opencl
  17078. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  17079. @section overlay_opencl
  17080. Overlay one video on top of another.
  17081. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  17082. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  17083. The filter accepts the following options:
  17084. @table @option
  17085. @item x
  17086. Set the x coordinate of the overlaid video on the main video.
  17087. Default value is @code{0}.
  17088. @item y
  17089. Set the y coordinate of the overlaid video on the main video.
  17090. Default value is @code{0}.
  17091. @end table
  17092. @subsection Examples
  17093. @itemize
  17094. @item
  17095. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  17096. @example
  17097. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17098. @end example
  17099. @item
  17100. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  17101. @example
  17102. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  17103. @end example
  17104. @end itemize
  17105. @section pad_opencl
  17106. Add paddings to the input image, and place the original input at the
  17107. provided @var{x}, @var{y} coordinates.
  17108. It accepts the following options:
  17109. @table @option
  17110. @item width, w
  17111. @item height, h
  17112. Specify an expression for the size of the output image with the
  17113. paddings added. If the value for @var{width} or @var{height} is 0, the
  17114. corresponding input size is used for the output.
  17115. The @var{width} expression can reference the value set by the
  17116. @var{height} expression, and vice versa.
  17117. The default value of @var{width} and @var{height} is 0.
  17118. @item x
  17119. @item y
  17120. Specify the offsets to place the input image at within the padded area,
  17121. with respect to the top/left border of the output image.
  17122. The @var{x} expression can reference the value set by the @var{y}
  17123. expression, and vice versa.
  17124. The default value of @var{x} and @var{y} is 0.
  17125. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  17126. so the input image is centered on the padded area.
  17127. @item color
  17128. Specify the color of the padded area. For the syntax of this option,
  17129. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  17130. manual,ffmpeg-utils}.
  17131. @item aspect
  17132. Pad to an aspect instead to a resolution.
  17133. @end table
  17134. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  17135. options are expressions containing the following constants:
  17136. @table @option
  17137. @item in_w
  17138. @item in_h
  17139. The input video width and height.
  17140. @item iw
  17141. @item ih
  17142. These are the same as @var{in_w} and @var{in_h}.
  17143. @item out_w
  17144. @item out_h
  17145. The output width and height (the size of the padded area), as
  17146. specified by the @var{width} and @var{height} expressions.
  17147. @item ow
  17148. @item oh
  17149. These are the same as @var{out_w} and @var{out_h}.
  17150. @item x
  17151. @item y
  17152. The x and y offsets as specified by the @var{x} and @var{y}
  17153. expressions, or NAN if not yet specified.
  17154. @item a
  17155. same as @var{iw} / @var{ih}
  17156. @item sar
  17157. input sample aspect ratio
  17158. @item dar
  17159. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  17160. @end table
  17161. @section prewitt_opencl
  17162. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  17163. The filter accepts the following option:
  17164. @table @option
  17165. @item planes
  17166. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17167. @item scale
  17168. Set value which will be multiplied with filtered result.
  17169. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17170. @item delta
  17171. Set value which will be added to filtered result.
  17172. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17173. @end table
  17174. @subsection Example
  17175. @itemize
  17176. @item
  17177. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  17178. @example
  17179. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17180. @end example
  17181. @end itemize
  17182. @anchor{program_opencl}
  17183. @section program_opencl
  17184. Filter video using an OpenCL program.
  17185. @table @option
  17186. @item source
  17187. OpenCL program source file.
  17188. @item kernel
  17189. Kernel name in program.
  17190. @item inputs
  17191. Number of inputs to the filter. Defaults to 1.
  17192. @item size, s
  17193. Size of output frames. Defaults to the same as the first input.
  17194. @end table
  17195. The @code{program_opencl} filter also supports the @ref{framesync} options.
  17196. The program source file must contain a kernel function with the given name,
  17197. which will be run once for each plane of the output. Each run on a plane
  17198. gets enqueued as a separate 2D global NDRange with one work-item for each
  17199. pixel to be generated. The global ID offset for each work-item is therefore
  17200. the coordinates of a pixel in the destination image.
  17201. The kernel function needs to take the following arguments:
  17202. @itemize
  17203. @item
  17204. Destination image, @var{__write_only image2d_t}.
  17205. This image will become the output; the kernel should write all of it.
  17206. @item
  17207. Frame index, @var{unsigned int}.
  17208. This is a counter starting from zero and increasing by one for each frame.
  17209. @item
  17210. Source images, @var{__read_only image2d_t}.
  17211. These are the most recent images on each input. The kernel may read from
  17212. them to generate the output, but they can't be written to.
  17213. @end itemize
  17214. Example programs:
  17215. @itemize
  17216. @item
  17217. Copy the input to the output (output must be the same size as the input).
  17218. @verbatim
  17219. __kernel void copy(__write_only image2d_t destination,
  17220. unsigned int index,
  17221. __read_only image2d_t source)
  17222. {
  17223. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17224. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17225. float4 value = read_imagef(source, sampler, location);
  17226. write_imagef(destination, location, value);
  17227. }
  17228. @end verbatim
  17229. @item
  17230. Apply a simple transformation, rotating the input by an amount increasing
  17231. with the index counter. Pixel values are linearly interpolated by the
  17232. sampler, and the output need not have the same dimensions as the input.
  17233. @verbatim
  17234. __kernel void rotate_image(__write_only image2d_t dst,
  17235. unsigned int index,
  17236. __read_only image2d_t src)
  17237. {
  17238. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17239. CLK_FILTER_LINEAR);
  17240. float angle = (float)index / 100.0f;
  17241. float2 dst_dim = convert_float2(get_image_dim(dst));
  17242. float2 src_dim = convert_float2(get_image_dim(src));
  17243. float2 dst_cen = dst_dim / 2.0f;
  17244. float2 src_cen = src_dim / 2.0f;
  17245. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17246. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17247. float2 src_pos = {
  17248. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17249. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17250. };
  17251. src_pos = src_pos * src_dim / dst_dim;
  17252. float2 src_loc = src_pos + src_cen;
  17253. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17254. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17255. write_imagef(dst, dst_loc, 0.5f);
  17256. else
  17257. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17258. }
  17259. @end verbatim
  17260. @item
  17261. Blend two inputs together, with the amount of each input used varying
  17262. with the index counter.
  17263. @verbatim
  17264. __kernel void blend_images(__write_only image2d_t dst,
  17265. unsigned int index,
  17266. __read_only image2d_t src1,
  17267. __read_only image2d_t src2)
  17268. {
  17269. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17270. CLK_FILTER_LINEAR);
  17271. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17272. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17273. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17274. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17275. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17276. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17277. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17278. }
  17279. @end verbatim
  17280. @end itemize
  17281. @section roberts_opencl
  17282. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17283. The filter accepts the following option:
  17284. @table @option
  17285. @item planes
  17286. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17287. @item scale
  17288. Set value which will be multiplied with filtered result.
  17289. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17290. @item delta
  17291. Set value which will be added to filtered result.
  17292. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17293. @end table
  17294. @subsection Example
  17295. @itemize
  17296. @item
  17297. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17298. @example
  17299. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17300. @end example
  17301. @end itemize
  17302. @section sobel_opencl
  17303. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17304. The filter accepts the following option:
  17305. @table @option
  17306. @item planes
  17307. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17308. @item scale
  17309. Set value which will be multiplied with filtered result.
  17310. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17311. @item delta
  17312. Set value which will be added to filtered result.
  17313. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17314. @end table
  17315. @subsection Example
  17316. @itemize
  17317. @item
  17318. Apply sobel operator with scale set to 2 and delta set to 10
  17319. @example
  17320. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17321. @end example
  17322. @end itemize
  17323. @section tonemap_opencl
  17324. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17325. It accepts the following parameters:
  17326. @table @option
  17327. @item tonemap
  17328. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17329. @item param
  17330. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17331. @item desat
  17332. Apply desaturation for highlights that exceed this level of brightness. The
  17333. higher the parameter, the more color information will be preserved. This
  17334. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17335. (smoothly) turning into white instead. This makes images feel more natural,
  17336. at the cost of reducing information about out-of-range colors.
  17337. The default value is 0.5, and the algorithm here is a little different from
  17338. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17339. @item threshold
  17340. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17341. is used to detect whether the scene has changed or not. If the distance between
  17342. the current frame average brightness and the current running average exceeds
  17343. a threshold value, we would re-calculate scene average and peak brightness.
  17344. The default value is 0.2.
  17345. @item format
  17346. Specify the output pixel format.
  17347. Currently supported formats are:
  17348. @table @var
  17349. @item p010
  17350. @item nv12
  17351. @end table
  17352. @item range, r
  17353. Set the output color range.
  17354. Possible values are:
  17355. @table @var
  17356. @item tv/mpeg
  17357. @item pc/jpeg
  17358. @end table
  17359. Default is same as input.
  17360. @item primaries, p
  17361. Set the output color primaries.
  17362. Possible values are:
  17363. @table @var
  17364. @item bt709
  17365. @item bt2020
  17366. @end table
  17367. Default is same as input.
  17368. @item transfer, t
  17369. Set the output transfer characteristics.
  17370. Possible values are:
  17371. @table @var
  17372. @item bt709
  17373. @item bt2020
  17374. @end table
  17375. Default is bt709.
  17376. @item matrix, m
  17377. Set the output colorspace matrix.
  17378. Possible value are:
  17379. @table @var
  17380. @item bt709
  17381. @item bt2020
  17382. @end table
  17383. Default is same as input.
  17384. @end table
  17385. @subsection Example
  17386. @itemize
  17387. @item
  17388. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17389. @example
  17390. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17391. @end example
  17392. @end itemize
  17393. @section unsharp_opencl
  17394. Sharpen or blur the input video.
  17395. It accepts the following parameters:
  17396. @table @option
  17397. @item luma_msize_x, lx
  17398. Set the luma matrix horizontal size.
  17399. Range is @code{[1, 23]} and default value is @code{5}.
  17400. @item luma_msize_y, ly
  17401. Set the luma matrix vertical size.
  17402. Range is @code{[1, 23]} and default value is @code{5}.
  17403. @item luma_amount, la
  17404. Set the luma effect strength.
  17405. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17406. Negative values will blur the input video, while positive values will
  17407. sharpen it, a value of zero will disable the effect.
  17408. @item chroma_msize_x, cx
  17409. Set the chroma matrix horizontal size.
  17410. Range is @code{[1, 23]} and default value is @code{5}.
  17411. @item chroma_msize_y, cy
  17412. Set the chroma matrix vertical size.
  17413. Range is @code{[1, 23]} and default value is @code{5}.
  17414. @item chroma_amount, ca
  17415. Set the chroma effect strength.
  17416. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17417. Negative values will blur the input video, while positive values will
  17418. sharpen it, a value of zero will disable the effect.
  17419. @end table
  17420. All parameters are optional and default to the equivalent of the
  17421. string '5:5:1.0:5:5:0.0'.
  17422. @subsection Examples
  17423. @itemize
  17424. @item
  17425. Apply strong luma sharpen effect:
  17426. @example
  17427. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17428. @end example
  17429. @item
  17430. Apply a strong blur of both luma and chroma parameters:
  17431. @example
  17432. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17433. @end example
  17434. @end itemize
  17435. @section xfade_opencl
  17436. Cross fade two videos with custom transition effect by using OpenCL.
  17437. It accepts the following options:
  17438. @table @option
  17439. @item transition
  17440. Set one of possible transition effects.
  17441. @table @option
  17442. @item custom
  17443. Select custom transition effect, the actual transition description
  17444. will be picked from source and kernel options.
  17445. @item fade
  17446. @item wipeleft
  17447. @item wiperight
  17448. @item wipeup
  17449. @item wipedown
  17450. @item slideleft
  17451. @item slideright
  17452. @item slideup
  17453. @item slidedown
  17454. Default transition is fade.
  17455. @end table
  17456. @item source
  17457. OpenCL program source file for custom transition.
  17458. @item kernel
  17459. Set name of kernel to use for custom transition from program source file.
  17460. @item duration
  17461. Set duration of video transition.
  17462. @item offset
  17463. Set time of start of transition relative to first video.
  17464. @end table
  17465. The program source file must contain a kernel function with the given name,
  17466. which will be run once for each plane of the output. Each run on a plane
  17467. gets enqueued as a separate 2D global NDRange with one work-item for each
  17468. pixel to be generated. The global ID offset for each work-item is therefore
  17469. the coordinates of a pixel in the destination image.
  17470. The kernel function needs to take the following arguments:
  17471. @itemize
  17472. @item
  17473. Destination image, @var{__write_only image2d_t}.
  17474. This image will become the output; the kernel should write all of it.
  17475. @item
  17476. First Source image, @var{__read_only image2d_t}.
  17477. Second Source image, @var{__read_only image2d_t}.
  17478. These are the most recent images on each input. The kernel may read from
  17479. them to generate the output, but they can't be written to.
  17480. @item
  17481. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17482. @end itemize
  17483. Example programs:
  17484. @itemize
  17485. @item
  17486. Apply dots curtain transition effect:
  17487. @verbatim
  17488. __kernel void blend_images(__write_only image2d_t dst,
  17489. __read_only image2d_t src1,
  17490. __read_only image2d_t src2,
  17491. float progress)
  17492. {
  17493. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17494. CLK_FILTER_LINEAR);
  17495. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17496. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17497. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17498. rp = rp / dim;
  17499. float2 dots = (float2)(20.0, 20.0);
  17500. float2 center = (float2)(0,0);
  17501. float2 unused;
  17502. float4 val1 = read_imagef(src1, sampler, p);
  17503. float4 val2 = read_imagef(src2, sampler, p);
  17504. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17505. write_imagef(dst, p, next ? val1 : val2);
  17506. }
  17507. @end verbatim
  17508. @end itemize
  17509. @c man end OPENCL VIDEO FILTERS
  17510. @chapter VAAPI Video Filters
  17511. @c man begin VAAPI VIDEO FILTERS
  17512. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17513. To enable compilation of these filters you need to configure FFmpeg with
  17514. @code{--enable-vaapi}.
  17515. 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}
  17516. @section tonemap_vaapi
  17517. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17518. It maps the dynamic range of HDR10 content to the SDR content.
  17519. It currently only accepts HDR10 as input.
  17520. It accepts the following parameters:
  17521. @table @option
  17522. @item format
  17523. Specify the output pixel format.
  17524. Currently supported formats are:
  17525. @table @var
  17526. @item p010
  17527. @item nv12
  17528. @end table
  17529. Default is nv12.
  17530. @item primaries, p
  17531. Set the output color primaries.
  17532. Default is same as input.
  17533. @item transfer, t
  17534. Set the output transfer characteristics.
  17535. Default is bt709.
  17536. @item matrix, m
  17537. Set the output colorspace matrix.
  17538. Default is same as input.
  17539. @end table
  17540. @subsection Example
  17541. @itemize
  17542. @item
  17543. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17544. @example
  17545. tonemap_vaapi=format=p010:t=bt2020-10
  17546. @end example
  17547. @end itemize
  17548. @c man end VAAPI VIDEO FILTERS
  17549. @chapter Video Sources
  17550. @c man begin VIDEO SOURCES
  17551. Below is a description of the currently available video sources.
  17552. @section buffer
  17553. Buffer video frames, and make them available to the filter chain.
  17554. This source is mainly intended for a programmatic use, in particular
  17555. through the interface defined in @file{libavfilter/buffersrc.h}.
  17556. It accepts the following parameters:
  17557. @table @option
  17558. @item video_size
  17559. Specify the size (width and height) of the buffered video frames. For the
  17560. syntax of this option, check the
  17561. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17562. @item width
  17563. The input video width.
  17564. @item height
  17565. The input video height.
  17566. @item pix_fmt
  17567. A string representing the pixel format of the buffered video frames.
  17568. It may be a number corresponding to a pixel format, or a pixel format
  17569. name.
  17570. @item time_base
  17571. Specify the timebase assumed by the timestamps of the buffered frames.
  17572. @item frame_rate
  17573. Specify the frame rate expected for the video stream.
  17574. @item pixel_aspect, sar
  17575. The sample (pixel) aspect ratio of the input video.
  17576. @item sws_param
  17577. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17578. to the filtergraph description to specify swscale flags for automatically
  17579. inserted scalers. See @ref{Filtergraph syntax}.
  17580. @item hw_frames_ctx
  17581. When using a hardware pixel format, this should be a reference to an
  17582. AVHWFramesContext describing input frames.
  17583. @end table
  17584. For example:
  17585. @example
  17586. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17587. @end example
  17588. will instruct the source to accept video frames with size 320x240 and
  17589. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17590. square pixels (1:1 sample aspect ratio).
  17591. Since the pixel format with name "yuv410p" corresponds to the number 6
  17592. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17593. this example corresponds to:
  17594. @example
  17595. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17596. @end example
  17597. Alternatively, the options can be specified as a flat string, but this
  17598. syntax is deprecated:
  17599. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17600. @section cellauto
  17601. Create a pattern generated by an elementary cellular automaton.
  17602. The initial state of the cellular automaton can be defined through the
  17603. @option{filename} and @option{pattern} options. If such options are
  17604. not specified an initial state is created randomly.
  17605. At each new frame a new row in the video is filled with the result of
  17606. the cellular automaton next generation. The behavior when the whole
  17607. frame is filled is defined by the @option{scroll} option.
  17608. This source accepts the following options:
  17609. @table @option
  17610. @item filename, f
  17611. Read the initial cellular automaton state, i.e. the starting row, from
  17612. the specified file.
  17613. In the file, each non-whitespace character is considered an alive
  17614. cell, a newline will terminate the row, and further characters in the
  17615. file will be ignored.
  17616. @item pattern, p
  17617. Read the initial cellular automaton state, i.e. the starting row, from
  17618. the specified string.
  17619. Each non-whitespace character in the string is considered an alive
  17620. cell, a newline will terminate the row, and further characters in the
  17621. string will be ignored.
  17622. @item rate, r
  17623. Set the video rate, that is the number of frames generated per second.
  17624. Default is 25.
  17625. @item random_fill_ratio, ratio
  17626. Set the random fill ratio for the initial cellular automaton row. It
  17627. is a floating point number value ranging from 0 to 1, defaults to
  17628. 1/PHI.
  17629. This option is ignored when a file or a pattern is specified.
  17630. @item random_seed, seed
  17631. Set the seed for filling randomly the initial row, must be an integer
  17632. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17633. set to -1, the filter will try to use a good random seed on a best
  17634. effort basis.
  17635. @item rule
  17636. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17637. Default value is 110.
  17638. @item size, s
  17639. Set the size of the output video. For the syntax of this option, check the
  17640. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17641. If @option{filename} or @option{pattern} is specified, the size is set
  17642. by default to the width of the specified initial state row, and the
  17643. height is set to @var{width} * PHI.
  17644. If @option{size} is set, it must contain the width of the specified
  17645. pattern string, and the specified pattern will be centered in the
  17646. larger row.
  17647. If a filename or a pattern string is not specified, the size value
  17648. defaults to "320x518" (used for a randomly generated initial state).
  17649. @item scroll
  17650. If set to 1, scroll the output upward when all the rows in the output
  17651. have been already filled. If set to 0, the new generated row will be
  17652. written over the top row just after the bottom row is filled.
  17653. Defaults to 1.
  17654. @item start_full, full
  17655. If set to 1, completely fill the output with generated rows before
  17656. outputting the first frame.
  17657. This is the default behavior, for disabling set the value to 0.
  17658. @item stitch
  17659. If set to 1, stitch the left and right row edges together.
  17660. This is the default behavior, for disabling set the value to 0.
  17661. @end table
  17662. @subsection Examples
  17663. @itemize
  17664. @item
  17665. Read the initial state from @file{pattern}, and specify an output of
  17666. size 200x400.
  17667. @example
  17668. cellauto=f=pattern:s=200x400
  17669. @end example
  17670. @item
  17671. Generate a random initial row with a width of 200 cells, with a fill
  17672. ratio of 2/3:
  17673. @example
  17674. cellauto=ratio=2/3:s=200x200
  17675. @end example
  17676. @item
  17677. Create a pattern generated by rule 18 starting by a single alive cell
  17678. centered on an initial row with width 100:
  17679. @example
  17680. cellauto=p=@@:s=100x400:full=0:rule=18
  17681. @end example
  17682. @item
  17683. Specify a more elaborated initial pattern:
  17684. @example
  17685. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17686. @end example
  17687. @end itemize
  17688. @anchor{coreimagesrc}
  17689. @section coreimagesrc
  17690. Video source generated on GPU using Apple's CoreImage API on OSX.
  17691. This video source is a specialized version of the @ref{coreimage} video filter.
  17692. Use a core image generator at the beginning of the applied filterchain to
  17693. generate the content.
  17694. The coreimagesrc video source accepts the following options:
  17695. @table @option
  17696. @item list_generators
  17697. List all available generators along with all their respective options as well as
  17698. possible minimum and maximum values along with the default values.
  17699. @example
  17700. list_generators=true
  17701. @end example
  17702. @item size, s
  17703. Specify the size of the sourced video. For the syntax of this option, check the
  17704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17705. The default value is @code{320x240}.
  17706. @item rate, r
  17707. Specify the frame rate of the sourced video, as the number of frames
  17708. generated per second. It has to be a string in the format
  17709. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17710. number or a valid video frame rate abbreviation. The default value is
  17711. "25".
  17712. @item sar
  17713. Set the sample aspect ratio of the sourced video.
  17714. @item duration, d
  17715. Set the duration of the sourced video. See
  17716. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17717. for the accepted syntax.
  17718. If not specified, or the expressed duration is negative, the video is
  17719. supposed to be generated forever.
  17720. @end table
  17721. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17722. A complete filterchain can be used for further processing of the
  17723. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17724. and examples for details.
  17725. @subsection Examples
  17726. @itemize
  17727. @item
  17728. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17729. given as complete and escaped command-line for Apple's standard bash shell:
  17730. @example
  17731. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17732. @end example
  17733. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17734. need for a nullsrc video source.
  17735. @end itemize
  17736. @section gradients
  17737. Generate several gradients.
  17738. @table @option
  17739. @item size, s
  17740. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17741. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17742. @item rate, r
  17743. Set frame rate, expressed as number of frames per second. Default
  17744. value is "25".
  17745. @item c0, c1, c2, c3, c4, c5, c6, c7
  17746. Set 8 colors. Default values for colors is to pick random one.
  17747. @item x0, y0, y0, y1
  17748. Set gradient line source and destination points. If negative or out of range, random ones
  17749. are picked.
  17750. @item nb_colors, n
  17751. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17752. @item seed
  17753. Set seed for picking gradient line points.
  17754. @item duration, d
  17755. Set the duration of the sourced video. See
  17756. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17757. for the accepted syntax.
  17758. If not specified, or the expressed duration is negative, the video is
  17759. supposed to be generated forever.
  17760. @item speed
  17761. Set speed of gradients rotation.
  17762. @end table
  17763. @section mandelbrot
  17764. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17765. point specified with @var{start_x} and @var{start_y}.
  17766. This source accepts the following options:
  17767. @table @option
  17768. @item end_pts
  17769. Set the terminal pts value. Default value is 400.
  17770. @item end_scale
  17771. Set the terminal scale value.
  17772. Must be a floating point value. Default value is 0.3.
  17773. @item inner
  17774. Set the inner coloring mode, that is the algorithm used to draw the
  17775. Mandelbrot fractal internal region.
  17776. It shall assume one of the following values:
  17777. @table @option
  17778. @item black
  17779. Set black mode.
  17780. @item convergence
  17781. Show time until convergence.
  17782. @item mincol
  17783. Set color based on point closest to the origin of the iterations.
  17784. @item period
  17785. Set period mode.
  17786. @end table
  17787. Default value is @var{mincol}.
  17788. @item bailout
  17789. Set the bailout value. Default value is 10.0.
  17790. @item maxiter
  17791. Set the maximum of iterations performed by the rendering
  17792. algorithm. Default value is 7189.
  17793. @item outer
  17794. Set outer coloring mode.
  17795. It shall assume one of following values:
  17796. @table @option
  17797. @item iteration_count
  17798. Set iteration count mode.
  17799. @item normalized_iteration_count
  17800. set normalized iteration count mode.
  17801. @end table
  17802. Default value is @var{normalized_iteration_count}.
  17803. @item rate, r
  17804. Set frame rate, expressed as number of frames per second. Default
  17805. value is "25".
  17806. @item size, s
  17807. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17808. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17809. @item start_scale
  17810. Set the initial scale value. Default value is 3.0.
  17811. @item start_x
  17812. Set the initial x position. Must be a floating point value between
  17813. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17814. @item start_y
  17815. Set the initial y position. Must be a floating point value between
  17816. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17817. @end table
  17818. @section mptestsrc
  17819. Generate various test patterns, as generated by the MPlayer test filter.
  17820. The size of the generated video is fixed, and is 256x256.
  17821. This source is useful in particular for testing encoding features.
  17822. This source accepts the following options:
  17823. @table @option
  17824. @item rate, r
  17825. Specify the frame rate of the sourced video, as the number of frames
  17826. generated per second. It has to be a string in the format
  17827. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17828. number or a valid video frame rate abbreviation. The default value is
  17829. "25".
  17830. @item duration, d
  17831. Set the duration of the sourced video. See
  17832. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17833. for the accepted syntax.
  17834. If not specified, or the expressed duration is negative, the video is
  17835. supposed to be generated forever.
  17836. @item test, t
  17837. Set the number or the name of the test to perform. Supported tests are:
  17838. @table @option
  17839. @item dc_luma
  17840. @item dc_chroma
  17841. @item freq_luma
  17842. @item freq_chroma
  17843. @item amp_luma
  17844. @item amp_chroma
  17845. @item cbp
  17846. @item mv
  17847. @item ring1
  17848. @item ring2
  17849. @item all
  17850. @item max_frames, m
  17851. Set the maximum number of frames generated for each test, default value is 30.
  17852. @end table
  17853. Default value is "all", which will cycle through the list of all tests.
  17854. @end table
  17855. Some examples:
  17856. @example
  17857. mptestsrc=t=dc_luma
  17858. @end example
  17859. will generate a "dc_luma" test pattern.
  17860. @section frei0r_src
  17861. Provide a frei0r source.
  17862. To enable compilation of this filter you need to install the frei0r
  17863. header and configure FFmpeg with @code{--enable-frei0r}.
  17864. This source accepts the following parameters:
  17865. @table @option
  17866. @item size
  17867. The size of the video to generate. For the syntax of this option, check the
  17868. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17869. @item framerate
  17870. The framerate of the generated video. It may be a string of the form
  17871. @var{num}/@var{den} or a frame rate abbreviation.
  17872. @item filter_name
  17873. The name to the frei0r source to load. For more information regarding frei0r and
  17874. how to set the parameters, read the @ref{frei0r} section in the video filters
  17875. documentation.
  17876. @item filter_params
  17877. A '|'-separated list of parameters to pass to the frei0r source.
  17878. @end table
  17879. For example, to generate a frei0r partik0l source with size 200x200
  17880. and frame rate 10 which is overlaid on the overlay filter main input:
  17881. @example
  17882. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17883. @end example
  17884. @section life
  17885. Generate a life pattern.
  17886. This source is based on a generalization of John Conway's life game.
  17887. The sourced input represents a life grid, each pixel represents a cell
  17888. which can be in one of two possible states, alive or dead. Every cell
  17889. interacts with its eight neighbours, which are the cells that are
  17890. horizontally, vertically, or diagonally adjacent.
  17891. At each interaction the grid evolves according to the adopted rule,
  17892. which specifies the number of neighbor alive cells which will make a
  17893. cell stay alive or born. The @option{rule} option allows one to specify
  17894. the rule to adopt.
  17895. This source accepts the following options:
  17896. @table @option
  17897. @item filename, f
  17898. Set the file from which to read the initial grid state. In the file,
  17899. each non-whitespace character is considered an alive cell, and newline
  17900. is used to delimit the end of each row.
  17901. If this option is not specified, the initial grid is generated
  17902. randomly.
  17903. @item rate, r
  17904. Set the video rate, that is the number of frames generated per second.
  17905. Default is 25.
  17906. @item random_fill_ratio, ratio
  17907. Set the random fill ratio for the initial random grid. It is a
  17908. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17909. It is ignored when a file is specified.
  17910. @item random_seed, seed
  17911. Set the seed for filling the initial random grid, must be an integer
  17912. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17913. set to -1, the filter will try to use a good random seed on a best
  17914. effort basis.
  17915. @item rule
  17916. Set the life rule.
  17917. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17918. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17919. @var{NS} specifies the number of alive neighbor cells which make a
  17920. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17921. which make a dead cell to become alive (i.e. to "born").
  17922. "s" and "b" can be used in place of "S" and "B", respectively.
  17923. Alternatively a rule can be specified by an 18-bits integer. The 9
  17924. high order bits are used to encode the next cell state if it is alive
  17925. for each number of neighbor alive cells, the low order bits specify
  17926. the rule for "borning" new cells. Higher order bits encode for an
  17927. higher number of neighbor cells.
  17928. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17929. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17930. Default value is "S23/B3", which is the original Conway's game of life
  17931. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17932. cells, and will born a new cell if there are three alive cells around
  17933. a dead cell.
  17934. @item size, s
  17935. Set the size of the output video. For the syntax of this option, check the
  17936. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17937. If @option{filename} is specified, the size is set by default to the
  17938. same size of the input file. If @option{size} is set, it must contain
  17939. the size specified in the input file, and the initial grid defined in
  17940. that file is centered in the larger resulting area.
  17941. If a filename is not specified, the size value defaults to "320x240"
  17942. (used for a randomly generated initial grid).
  17943. @item stitch
  17944. If set to 1, stitch the left and right grid edges together, and the
  17945. top and bottom edges also. Defaults to 1.
  17946. @item mold
  17947. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17948. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17949. value from 0 to 255.
  17950. @item life_color
  17951. Set the color of living (or new born) cells.
  17952. @item death_color
  17953. Set the color of dead cells. If @option{mold} is set, this is the first color
  17954. used to represent a dead cell.
  17955. @item mold_color
  17956. Set mold color, for definitely dead and moldy cells.
  17957. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17958. ffmpeg-utils manual,ffmpeg-utils}.
  17959. @end table
  17960. @subsection Examples
  17961. @itemize
  17962. @item
  17963. Read a grid from @file{pattern}, and center it on a grid of size
  17964. 300x300 pixels:
  17965. @example
  17966. life=f=pattern:s=300x300
  17967. @end example
  17968. @item
  17969. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17970. @example
  17971. life=ratio=2/3:s=200x200
  17972. @end example
  17973. @item
  17974. Specify a custom rule for evolving a randomly generated grid:
  17975. @example
  17976. life=rule=S14/B34
  17977. @end example
  17978. @item
  17979. Full example with slow death effect (mold) using @command{ffplay}:
  17980. @example
  17981. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17982. @end example
  17983. @end itemize
  17984. @anchor{allrgb}
  17985. @anchor{allyuv}
  17986. @anchor{color}
  17987. @anchor{haldclutsrc}
  17988. @anchor{nullsrc}
  17989. @anchor{pal75bars}
  17990. @anchor{pal100bars}
  17991. @anchor{rgbtestsrc}
  17992. @anchor{smptebars}
  17993. @anchor{smptehdbars}
  17994. @anchor{testsrc}
  17995. @anchor{testsrc2}
  17996. @anchor{yuvtestsrc}
  17997. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17998. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17999. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  18000. The @code{color} source provides an uniformly colored input.
  18001. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  18002. @ref{haldclut} filter.
  18003. The @code{nullsrc} source returns unprocessed video frames. It is
  18004. mainly useful to be employed in analysis / debugging tools, or as the
  18005. source for filters which ignore the input data.
  18006. The @code{pal75bars} source generates a color bars pattern, based on
  18007. EBU PAL recommendations with 75% color levels.
  18008. The @code{pal100bars} source generates a color bars pattern, based on
  18009. EBU PAL recommendations with 100% color levels.
  18010. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  18011. detecting RGB vs BGR issues. You should see a red, green and blue
  18012. stripe from top to bottom.
  18013. The @code{smptebars} source generates a color bars pattern, based on
  18014. the SMPTE Engineering Guideline EG 1-1990.
  18015. The @code{smptehdbars} source generates a color bars pattern, based on
  18016. the SMPTE RP 219-2002.
  18017. The @code{testsrc} source generates a test video pattern, showing a
  18018. color pattern, a scrolling gradient and a timestamp. This is mainly
  18019. intended for testing purposes.
  18020. The @code{testsrc2} source is similar to testsrc, but supports more
  18021. pixel formats instead of just @code{rgb24}. This allows using it as an
  18022. input for other tests without requiring a format conversion.
  18023. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  18024. see a y, cb and cr stripe from top to bottom.
  18025. The sources accept the following parameters:
  18026. @table @option
  18027. @item level
  18028. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  18029. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  18030. pixels to be used as identity matrix for 3D lookup tables. Each component is
  18031. coded on a @code{1/(N*N)} scale.
  18032. @item color, c
  18033. Specify the color of the source, only available in the @code{color}
  18034. source. For the syntax of this option, check the
  18035. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18036. @item size, s
  18037. Specify the size of the sourced video. For the syntax of this option, check the
  18038. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18039. The default value is @code{320x240}.
  18040. This option is not available with the @code{allrgb}, @code{allyuv}, and
  18041. @code{haldclutsrc} filters.
  18042. @item rate, r
  18043. Specify the frame rate of the sourced video, as the number of frames
  18044. generated per second. It has to be a string in the format
  18045. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  18046. number or a valid video frame rate abbreviation. The default value is
  18047. "25".
  18048. @item duration, d
  18049. Set the duration of the sourced video. See
  18050. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18051. for the accepted syntax.
  18052. If not specified, or the expressed duration is negative, the video is
  18053. supposed to be generated forever.
  18054. Since the frame rate is used as time base, all frames including the last one
  18055. will have their full duration. If the specified duration is not a multiple
  18056. of the frame duration, it will be rounded up.
  18057. @item sar
  18058. Set the sample aspect ratio of the sourced video.
  18059. @item alpha
  18060. Specify the alpha (opacity) of the background, only available in the
  18061. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  18062. 255 (fully opaque, the default).
  18063. @item decimals, n
  18064. Set the number of decimals to show in the timestamp, only available in the
  18065. @code{testsrc} source.
  18066. The displayed timestamp value will correspond to the original
  18067. timestamp value multiplied by the power of 10 of the specified
  18068. value. Default value is 0.
  18069. @end table
  18070. @subsection Examples
  18071. @itemize
  18072. @item
  18073. Generate a video with a duration of 5.3 seconds, with size
  18074. 176x144 and a frame rate of 10 frames per second:
  18075. @example
  18076. testsrc=duration=5.3:size=qcif:rate=10
  18077. @end example
  18078. @item
  18079. The following graph description will generate a red source
  18080. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  18081. frames per second:
  18082. @example
  18083. color=c=red@@0.2:s=qcif:r=10
  18084. @end example
  18085. @item
  18086. If the input content is to be ignored, @code{nullsrc} can be used. The
  18087. following command generates noise in the luminance plane by employing
  18088. the @code{geq} filter:
  18089. @example
  18090. nullsrc=s=256x256, geq=random(1)*255:128:128
  18091. @end example
  18092. @end itemize
  18093. @subsection Commands
  18094. The @code{color} source supports the following commands:
  18095. @table @option
  18096. @item c, color
  18097. Set the color of the created image. Accepts the same syntax of the
  18098. corresponding @option{color} option.
  18099. @end table
  18100. @section openclsrc
  18101. Generate video using an OpenCL program.
  18102. @table @option
  18103. @item source
  18104. OpenCL program source file.
  18105. @item kernel
  18106. Kernel name in program.
  18107. @item size, s
  18108. Size of frames to generate. This must be set.
  18109. @item format
  18110. Pixel format to use for the generated frames. This must be set.
  18111. @item rate, r
  18112. Number of frames generated every second. Default value is '25'.
  18113. @end table
  18114. For details of how the program loading works, see the @ref{program_opencl}
  18115. filter.
  18116. Example programs:
  18117. @itemize
  18118. @item
  18119. Generate a colour ramp by setting pixel values from the position of the pixel
  18120. in the output image. (Note that this will work with all pixel formats, but
  18121. the generated output will not be the same.)
  18122. @verbatim
  18123. __kernel void ramp(__write_only image2d_t dst,
  18124. unsigned int index)
  18125. {
  18126. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18127. float4 val;
  18128. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  18129. write_imagef(dst, loc, val);
  18130. }
  18131. @end verbatim
  18132. @item
  18133. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  18134. @verbatim
  18135. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  18136. unsigned int index)
  18137. {
  18138. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  18139. float4 value = 0.0f;
  18140. int x = loc.x + index;
  18141. int y = loc.y + index;
  18142. while (x > 0 || y > 0) {
  18143. if (x % 3 == 1 && y % 3 == 1) {
  18144. value = 1.0f;
  18145. break;
  18146. }
  18147. x /= 3;
  18148. y /= 3;
  18149. }
  18150. write_imagef(dst, loc, value);
  18151. }
  18152. @end verbatim
  18153. @end itemize
  18154. @section sierpinski
  18155. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  18156. This source accepts the following options:
  18157. @table @option
  18158. @item size, s
  18159. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  18160. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  18161. @item rate, r
  18162. Set frame rate, expressed as number of frames per second. Default
  18163. value is "25".
  18164. @item seed
  18165. Set seed which is used for random panning.
  18166. @item jump
  18167. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  18168. @item type
  18169. Set fractal type, can be default @code{carpet} or @code{triangle}.
  18170. @end table
  18171. @c man end VIDEO SOURCES
  18172. @chapter Video Sinks
  18173. @c man begin VIDEO SINKS
  18174. Below is a description of the currently available video sinks.
  18175. @section buffersink
  18176. Buffer video frames, and make them available to the end of the filter
  18177. graph.
  18178. This sink is mainly intended for programmatic use, in particular
  18179. through the interface defined in @file{libavfilter/buffersink.h}
  18180. or the options system.
  18181. It accepts a pointer to an AVBufferSinkContext structure, which
  18182. defines the incoming buffers' formats, to be passed as the opaque
  18183. parameter to @code{avfilter_init_filter} for initialization.
  18184. @section nullsink
  18185. Null video sink: do absolutely nothing with the input video. It is
  18186. mainly useful as a template and for use in analysis / debugging
  18187. tools.
  18188. @c man end VIDEO SINKS
  18189. @chapter Multimedia Filters
  18190. @c man begin MULTIMEDIA FILTERS
  18191. Below is a description of the currently available multimedia filters.
  18192. @section abitscope
  18193. Convert input audio to a video output, displaying the audio bit scope.
  18194. The filter accepts the following options:
  18195. @table @option
  18196. @item rate, r
  18197. Set frame rate, expressed as number of frames per second. Default
  18198. value is "25".
  18199. @item size, s
  18200. Specify the video size for the output. For the syntax of this option, check the
  18201. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18202. Default value is @code{1024x256}.
  18203. @item colors
  18204. Specify list of colors separated by space or by '|' which will be used to
  18205. draw channels. Unrecognized or missing colors will be replaced
  18206. by white color.
  18207. @end table
  18208. @section adrawgraph
  18209. Draw a graph using input audio metadata.
  18210. See @ref{drawgraph}
  18211. @section agraphmonitor
  18212. See @ref{graphmonitor}.
  18213. @section ahistogram
  18214. Convert input audio to a video output, displaying the volume histogram.
  18215. The filter accepts the following options:
  18216. @table @option
  18217. @item dmode
  18218. Specify how histogram is calculated.
  18219. It accepts the following values:
  18220. @table @samp
  18221. @item single
  18222. Use single histogram for all channels.
  18223. @item separate
  18224. Use separate histogram for each channel.
  18225. @end table
  18226. Default is @code{single}.
  18227. @item rate, r
  18228. Set frame rate, expressed as number of frames per second. Default
  18229. value is "25".
  18230. @item size, s
  18231. Specify the video size for the output. For the syntax of this option, check the
  18232. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18233. Default value is @code{hd720}.
  18234. @item scale
  18235. Set display scale.
  18236. It accepts the following values:
  18237. @table @samp
  18238. @item log
  18239. logarithmic
  18240. @item sqrt
  18241. square root
  18242. @item cbrt
  18243. cubic root
  18244. @item lin
  18245. linear
  18246. @item rlog
  18247. reverse logarithmic
  18248. @end table
  18249. Default is @code{log}.
  18250. @item ascale
  18251. Set amplitude scale.
  18252. It accepts the following values:
  18253. @table @samp
  18254. @item log
  18255. logarithmic
  18256. @item lin
  18257. linear
  18258. @end table
  18259. Default is @code{log}.
  18260. @item acount
  18261. Set how much frames to accumulate in histogram.
  18262. Default is 1. Setting this to -1 accumulates all frames.
  18263. @item rheight
  18264. Set histogram ratio of window height.
  18265. @item slide
  18266. Set sonogram sliding.
  18267. It accepts the following values:
  18268. @table @samp
  18269. @item replace
  18270. replace old rows with new ones.
  18271. @item scroll
  18272. scroll from top to bottom.
  18273. @end table
  18274. Default is @code{replace}.
  18275. @end table
  18276. @section aphasemeter
  18277. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18278. representing mean phase of current audio frame. A video output can also be produced and is
  18279. enabled by default. The audio is passed through as first output.
  18280. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18281. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18282. and @code{1} means channels are in phase.
  18283. The filter accepts the following options, all related to its video output:
  18284. @table @option
  18285. @item rate, r
  18286. Set the output frame rate. Default value is @code{25}.
  18287. @item size, s
  18288. Set the video size for the output. For the syntax of this option, check the
  18289. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18290. Default value is @code{800x400}.
  18291. @item rc
  18292. @item gc
  18293. @item bc
  18294. Specify the red, green, blue contrast. Default values are @code{2},
  18295. @code{7} and @code{1}.
  18296. Allowed range is @code{[0, 255]}.
  18297. @item mpc
  18298. Set color which will be used for drawing median phase. If color is
  18299. @code{none} which is default, no median phase value will be drawn.
  18300. @item video
  18301. Enable video output. Default is enabled.
  18302. @end table
  18303. @subsection phasing detection
  18304. The filter also detects out of phase and mono sequences in stereo streams.
  18305. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18306. The filter accepts the following options for this detection:
  18307. @table @option
  18308. @item phasing
  18309. Enable mono and out of phase detection. Default is disabled.
  18310. @item tolerance, t
  18311. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18312. Allowed range is @code{[0, 1]}.
  18313. @item angle, a
  18314. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18315. Allowed range is @code{[90, 180]}.
  18316. @item duration, d
  18317. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18318. @end table
  18319. @subsection Examples
  18320. @itemize
  18321. @item
  18322. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18323. @example
  18324. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18325. @end example
  18326. @end itemize
  18327. @section avectorscope
  18328. Convert input audio to a video output, representing the audio vector
  18329. scope.
  18330. The filter is used to measure the difference between channels of stereo
  18331. audio stream. A monaural signal, consisting of identical left and right
  18332. signal, results in straight vertical line. Any stereo separation is visible
  18333. as a deviation from this line, creating a Lissajous figure.
  18334. If the straight (or deviation from it) but horizontal line appears this
  18335. indicates that the left and right channels are out of phase.
  18336. The filter accepts the following options:
  18337. @table @option
  18338. @item mode, m
  18339. Set the vectorscope mode.
  18340. Available values are:
  18341. @table @samp
  18342. @item lissajous
  18343. Lissajous rotated by 45 degrees.
  18344. @item lissajous_xy
  18345. Same as above but not rotated.
  18346. @item polar
  18347. Shape resembling half of circle.
  18348. @end table
  18349. Default value is @samp{lissajous}.
  18350. @item size, s
  18351. Set the video size for the output. For the syntax of this option, check the
  18352. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18353. Default value is @code{400x400}.
  18354. @item rate, r
  18355. Set the output frame rate. Default value is @code{25}.
  18356. @item rc
  18357. @item gc
  18358. @item bc
  18359. @item ac
  18360. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18361. @code{160}, @code{80} and @code{255}.
  18362. Allowed range is @code{[0, 255]}.
  18363. @item rf
  18364. @item gf
  18365. @item bf
  18366. @item af
  18367. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18368. @code{10}, @code{5} and @code{5}.
  18369. Allowed range is @code{[0, 255]}.
  18370. @item zoom
  18371. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18372. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18373. @item draw
  18374. Set the vectorscope drawing mode.
  18375. Available values are:
  18376. @table @samp
  18377. @item dot
  18378. Draw dot for each sample.
  18379. @item line
  18380. Draw line between previous and current sample.
  18381. @end table
  18382. Default value is @samp{dot}.
  18383. @item scale
  18384. Specify amplitude scale of audio samples.
  18385. Available values are:
  18386. @table @samp
  18387. @item lin
  18388. Linear.
  18389. @item sqrt
  18390. Square root.
  18391. @item cbrt
  18392. Cubic root.
  18393. @item log
  18394. Logarithmic.
  18395. @end table
  18396. @item swap
  18397. Swap left channel axis with right channel axis.
  18398. @item mirror
  18399. Mirror axis.
  18400. @table @samp
  18401. @item none
  18402. No mirror.
  18403. @item x
  18404. Mirror only x axis.
  18405. @item y
  18406. Mirror only y axis.
  18407. @item xy
  18408. Mirror both axis.
  18409. @end table
  18410. @end table
  18411. @subsection Examples
  18412. @itemize
  18413. @item
  18414. Complete example using @command{ffplay}:
  18415. @example
  18416. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18417. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18418. @end example
  18419. @end itemize
  18420. @section bench, abench
  18421. Benchmark part of a filtergraph.
  18422. The filter accepts the following options:
  18423. @table @option
  18424. @item action
  18425. Start or stop a timer.
  18426. Available values are:
  18427. @table @samp
  18428. @item start
  18429. Get the current time, set it as frame metadata (using the key
  18430. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18431. @item stop
  18432. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18433. the input frame metadata to get the time difference. Time difference, average,
  18434. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18435. @code{min}) are then printed. The timestamps are expressed in seconds.
  18436. @end table
  18437. @end table
  18438. @subsection Examples
  18439. @itemize
  18440. @item
  18441. Benchmark @ref{selectivecolor} filter:
  18442. @example
  18443. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18444. @end example
  18445. @end itemize
  18446. @section concat
  18447. Concatenate audio and video streams, joining them together one after the
  18448. other.
  18449. The filter works on segments of synchronized video and audio streams. All
  18450. segments must have the same number of streams of each type, and that will
  18451. also be the number of streams at output.
  18452. The filter accepts the following options:
  18453. @table @option
  18454. @item n
  18455. Set the number of segments. Default is 2.
  18456. @item v
  18457. Set the number of output video streams, that is also the number of video
  18458. streams in each segment. Default is 1.
  18459. @item a
  18460. Set the number of output audio streams, that is also the number of audio
  18461. streams in each segment. Default is 0.
  18462. @item unsafe
  18463. Activate unsafe mode: do not fail if segments have a different format.
  18464. @end table
  18465. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18466. @var{a} audio outputs.
  18467. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18468. segment, in the same order as the outputs, then the inputs for the second
  18469. segment, etc.
  18470. Related streams do not always have exactly the same duration, for various
  18471. reasons including codec frame size or sloppy authoring. For that reason,
  18472. related synchronized streams (e.g. a video and its audio track) should be
  18473. concatenated at once. The concat filter will use the duration of the longest
  18474. stream in each segment (except the last one), and if necessary pad shorter
  18475. audio streams with silence.
  18476. For this filter to work correctly, all segments must start at timestamp 0.
  18477. All corresponding streams must have the same parameters in all segments; the
  18478. filtering system will automatically select a common pixel format for video
  18479. streams, and a common sample format, sample rate and channel layout for
  18480. audio streams, but other settings, such as resolution, must be converted
  18481. explicitly by the user.
  18482. Different frame rates are acceptable but will result in variable frame rate
  18483. at output; be sure to configure the output file to handle it.
  18484. @subsection Examples
  18485. @itemize
  18486. @item
  18487. Concatenate an opening, an episode and an ending, all in bilingual version
  18488. (video in stream 0, audio in streams 1 and 2):
  18489. @example
  18490. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18491. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18492. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18493. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18494. @end example
  18495. @item
  18496. Concatenate two parts, handling audio and video separately, using the
  18497. (a)movie sources, and adjusting the resolution:
  18498. @example
  18499. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18500. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18501. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18502. @end example
  18503. Note that a desync will happen at the stitch if the audio and video streams
  18504. do not have exactly the same duration in the first file.
  18505. @end itemize
  18506. @subsection Commands
  18507. This filter supports the following commands:
  18508. @table @option
  18509. @item next
  18510. Close the current segment and step to the next one
  18511. @end table
  18512. @anchor{ebur128}
  18513. @section ebur128
  18514. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18515. level. By default, it logs a message at a frequency of 10Hz with the
  18516. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18517. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18518. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18519. sample format is double-precision floating point. The input stream will be converted to
  18520. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18521. after this filter to obtain the original parameters.
  18522. The filter also has a video output (see the @var{video} option) with a real
  18523. time graph to observe the loudness evolution. The graphic contains the logged
  18524. message mentioned above, so it is not printed anymore when this option is set,
  18525. unless the verbose logging is set. The main graphing area contains the
  18526. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18527. the momentary loudness (400 milliseconds), but can optionally be configured
  18528. to instead display short-term loudness (see @var{gauge}).
  18529. The green area marks a +/- 1LU target range around the target loudness
  18530. (-23LUFS by default, unless modified through @var{target}).
  18531. More information about the Loudness Recommendation EBU R128 on
  18532. @url{http://tech.ebu.ch/loudness}.
  18533. The filter accepts the following options:
  18534. @table @option
  18535. @item video
  18536. Activate the video output. The audio stream is passed unchanged whether this
  18537. option is set or no. The video stream will be the first output stream if
  18538. activated. Default is @code{0}.
  18539. @item size
  18540. Set the video size. This option is for video only. For the syntax of this
  18541. option, check the
  18542. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18543. Default and minimum resolution is @code{640x480}.
  18544. @item meter
  18545. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18546. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18547. other integer value between this range is allowed.
  18548. @item metadata
  18549. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18550. into 100ms output frames, each of them containing various loudness information
  18551. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18552. Default is @code{0}.
  18553. @item framelog
  18554. Force the frame logging level.
  18555. Available values are:
  18556. @table @samp
  18557. @item info
  18558. information logging level
  18559. @item verbose
  18560. verbose logging level
  18561. @end table
  18562. By default, the logging level is set to @var{info}. If the @option{video} or
  18563. the @option{metadata} options are set, it switches to @var{verbose}.
  18564. @item peak
  18565. Set peak mode(s).
  18566. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18567. values are:
  18568. @table @samp
  18569. @item none
  18570. Disable any peak mode (default).
  18571. @item sample
  18572. Enable sample-peak mode.
  18573. Simple peak mode looking for the higher sample value. It logs a message
  18574. for sample-peak (identified by @code{SPK}).
  18575. @item true
  18576. Enable true-peak mode.
  18577. If enabled, the peak lookup is done on an over-sampled version of the input
  18578. stream for better peak accuracy. It logs a message for true-peak.
  18579. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18580. This mode requires a build with @code{libswresample}.
  18581. @end table
  18582. @item dualmono
  18583. Treat mono input files as "dual mono". If a mono file is intended for playback
  18584. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18585. If set to @code{true}, this option will compensate for this effect.
  18586. Multi-channel input files are not affected by this option.
  18587. @item panlaw
  18588. Set a specific pan law to be used for the measurement of dual mono files.
  18589. This parameter is optional, and has a default value of -3.01dB.
  18590. @item target
  18591. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18592. This parameter is optional and has a default value of -23LUFS as specified
  18593. by EBU R128. However, material published online may prefer a level of -16LUFS
  18594. (e.g. for use with podcasts or video platforms).
  18595. @item gauge
  18596. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18597. @code{shortterm}. By default the momentary value will be used, but in certain
  18598. scenarios it may be more useful to observe the short term value instead (e.g.
  18599. live mixing).
  18600. @item scale
  18601. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18602. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18603. video output, not the summary or continuous log output.
  18604. @end table
  18605. @subsection Examples
  18606. @itemize
  18607. @item
  18608. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18609. @example
  18610. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18611. @end example
  18612. @item
  18613. Run an analysis with @command{ffmpeg}:
  18614. @example
  18615. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18616. @end example
  18617. @end itemize
  18618. @section interleave, ainterleave
  18619. Temporally interleave frames from several inputs.
  18620. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18621. These filters read frames from several inputs and send the oldest
  18622. queued frame to the output.
  18623. Input streams must have well defined, monotonically increasing frame
  18624. timestamp values.
  18625. In order to submit one frame to output, these filters need to enqueue
  18626. at least one frame for each input, so they cannot work in case one
  18627. input is not yet terminated and will not receive incoming frames.
  18628. For example consider the case when one input is a @code{select} filter
  18629. which always drops input frames. The @code{interleave} filter will keep
  18630. reading from that input, but it will never be able to send new frames
  18631. to output until the input sends an end-of-stream signal.
  18632. Also, depending on inputs synchronization, the filters will drop
  18633. frames in case one input receives more frames than the other ones, and
  18634. the queue is already filled.
  18635. These filters accept the following options:
  18636. @table @option
  18637. @item nb_inputs, n
  18638. Set the number of different inputs, it is 2 by default.
  18639. @item duration
  18640. How to determine the end-of-stream.
  18641. @table @option
  18642. @item longest
  18643. The duration of the longest input. (default)
  18644. @item shortest
  18645. The duration of the shortest input.
  18646. @item first
  18647. The duration of the first input.
  18648. @end table
  18649. @end table
  18650. @subsection Examples
  18651. @itemize
  18652. @item
  18653. Interleave frames belonging to different streams using @command{ffmpeg}:
  18654. @example
  18655. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18656. @end example
  18657. @item
  18658. Add flickering blur effect:
  18659. @example
  18660. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18661. @end example
  18662. @end itemize
  18663. @section metadata, ametadata
  18664. Manipulate frame metadata.
  18665. This filter accepts the following options:
  18666. @table @option
  18667. @item mode
  18668. Set mode of operation of the filter.
  18669. Can be one of the following:
  18670. @table @samp
  18671. @item select
  18672. If both @code{value} and @code{key} is set, select frames
  18673. which have such metadata. If only @code{key} is set, select
  18674. every frame that has such key in metadata.
  18675. @item add
  18676. Add new metadata @code{key} and @code{value}. If key is already available
  18677. do nothing.
  18678. @item modify
  18679. Modify value of already present key.
  18680. @item delete
  18681. If @code{value} is set, delete only keys that have such value.
  18682. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18683. the frame.
  18684. @item print
  18685. Print key and its value if metadata was found. If @code{key} is not set print all
  18686. metadata values available in frame.
  18687. @end table
  18688. @item key
  18689. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18690. @item value
  18691. Set metadata value which will be used. This option is mandatory for
  18692. @code{modify} and @code{add} mode.
  18693. @item function
  18694. Which function to use when comparing metadata value and @code{value}.
  18695. Can be one of following:
  18696. @table @samp
  18697. @item same_str
  18698. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18699. @item starts_with
  18700. Values are interpreted as strings, returns true if metadata value starts with
  18701. the @code{value} option string.
  18702. @item less
  18703. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18704. @item equal
  18705. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18706. @item greater
  18707. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18708. @item expr
  18709. Values are interpreted as floats, returns true if expression from option @code{expr}
  18710. evaluates to true.
  18711. @item ends_with
  18712. Values are interpreted as strings, returns true if metadata value ends with
  18713. the @code{value} option string.
  18714. @end table
  18715. @item expr
  18716. Set expression which is used when @code{function} is set to @code{expr}.
  18717. The expression is evaluated through the eval API and can contain the following
  18718. constants:
  18719. @table @option
  18720. @item VALUE1
  18721. Float representation of @code{value} from metadata key.
  18722. @item VALUE2
  18723. Float representation of @code{value} as supplied by user in @code{value} option.
  18724. @end table
  18725. @item file
  18726. If specified in @code{print} mode, output is written to the named file. Instead of
  18727. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18728. for standard output. If @code{file} option is not set, output is written to the log
  18729. with AV_LOG_INFO loglevel.
  18730. @item direct
  18731. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18732. @end table
  18733. @subsection Examples
  18734. @itemize
  18735. @item
  18736. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18737. between 0 and 1.
  18738. @example
  18739. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18740. @end example
  18741. @item
  18742. Print silencedetect output to file @file{metadata.txt}.
  18743. @example
  18744. silencedetect,ametadata=mode=print:file=metadata.txt
  18745. @end example
  18746. @item
  18747. Direct all metadata to a pipe with file descriptor 4.
  18748. @example
  18749. metadata=mode=print:file='pipe\:4'
  18750. @end example
  18751. @end itemize
  18752. @section perms, aperms
  18753. Set read/write permissions for the output frames.
  18754. These filters are mainly aimed at developers to test direct path in the
  18755. following filter in the filtergraph.
  18756. The filters accept the following options:
  18757. @table @option
  18758. @item mode
  18759. Select the permissions mode.
  18760. It accepts the following values:
  18761. @table @samp
  18762. @item none
  18763. Do nothing. This is the default.
  18764. @item ro
  18765. Set all the output frames read-only.
  18766. @item rw
  18767. Set all the output frames directly writable.
  18768. @item toggle
  18769. Make the frame read-only if writable, and writable if read-only.
  18770. @item random
  18771. Set each output frame read-only or writable randomly.
  18772. @end table
  18773. @item seed
  18774. Set the seed for the @var{random} mode, must be an integer included between
  18775. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18776. @code{-1}, the filter will try to use a good random seed on a best effort
  18777. basis.
  18778. @end table
  18779. Note: in case of auto-inserted filter between the permission filter and the
  18780. following one, the permission might not be received as expected in that
  18781. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18782. perms/aperms filter can avoid this problem.
  18783. @section realtime, arealtime
  18784. Slow down filtering to match real time approximately.
  18785. These filters will pause the filtering for a variable amount of time to
  18786. match the output rate with the input timestamps.
  18787. They are similar to the @option{re} option to @code{ffmpeg}.
  18788. They accept the following options:
  18789. @table @option
  18790. @item limit
  18791. Time limit for the pauses. Any pause longer than that will be considered
  18792. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18793. @item speed
  18794. Speed factor for processing. The value must be a float larger than zero.
  18795. Values larger than 1.0 will result in faster than realtime processing,
  18796. smaller will slow processing down. The @var{limit} is automatically adapted
  18797. accordingly. Default is 1.0.
  18798. A processing speed faster than what is possible without these filters cannot
  18799. be achieved.
  18800. @end table
  18801. @anchor{select}
  18802. @section select, aselect
  18803. Select frames to pass in output.
  18804. This filter accepts the following options:
  18805. @table @option
  18806. @item expr, e
  18807. Set expression, which is evaluated for each input frame.
  18808. If the expression is evaluated to zero, the frame is discarded.
  18809. If the evaluation result is negative or NaN, the frame is sent to the
  18810. first output; otherwise it is sent to the output with index
  18811. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18812. For example a value of @code{1.2} corresponds to the output with index
  18813. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18814. @item outputs, n
  18815. Set the number of outputs. The output to which to send the selected
  18816. frame is based on the result of the evaluation. Default value is 1.
  18817. @end table
  18818. The expression can contain the following constants:
  18819. @table @option
  18820. @item n
  18821. The (sequential) number of the filtered frame, starting from 0.
  18822. @item selected_n
  18823. The (sequential) number of the selected frame, starting from 0.
  18824. @item prev_selected_n
  18825. The sequential number of the last selected frame. It's NAN if undefined.
  18826. @item TB
  18827. The timebase of the input timestamps.
  18828. @item pts
  18829. The PTS (Presentation TimeStamp) of the filtered video frame,
  18830. expressed in @var{TB} units. It's NAN if undefined.
  18831. @item t
  18832. The PTS of the filtered video frame,
  18833. expressed in seconds. It's NAN if undefined.
  18834. @item prev_pts
  18835. The PTS of the previously filtered video frame. It's NAN if undefined.
  18836. @item prev_selected_pts
  18837. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18838. @item prev_selected_t
  18839. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18840. @item start_pts
  18841. The PTS of the first video frame in the video. It's NAN if undefined.
  18842. @item start_t
  18843. The time of the first video frame in the video. It's NAN if undefined.
  18844. @item pict_type @emph{(video only)}
  18845. The type of the filtered frame. It can assume one of the following
  18846. values:
  18847. @table @option
  18848. @item I
  18849. @item P
  18850. @item B
  18851. @item S
  18852. @item SI
  18853. @item SP
  18854. @item BI
  18855. @end table
  18856. @item interlace_type @emph{(video only)}
  18857. The frame interlace type. It can assume one of the following values:
  18858. @table @option
  18859. @item PROGRESSIVE
  18860. The frame is progressive (not interlaced).
  18861. @item TOPFIRST
  18862. The frame is top-field-first.
  18863. @item BOTTOMFIRST
  18864. The frame is bottom-field-first.
  18865. @end table
  18866. @item consumed_sample_n @emph{(audio only)}
  18867. the number of selected samples before the current frame
  18868. @item samples_n @emph{(audio only)}
  18869. the number of samples in the current frame
  18870. @item sample_rate @emph{(audio only)}
  18871. the input sample rate
  18872. @item key
  18873. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18874. @item pos
  18875. the position in the file of the filtered frame, -1 if the information
  18876. is not available (e.g. for synthetic video)
  18877. @item scene @emph{(video only)}
  18878. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18879. probability for the current frame to introduce a new scene, while a higher
  18880. value means the current frame is more likely to be one (see the example below)
  18881. @item concatdec_select
  18882. The concat demuxer can select only part of a concat input file by setting an
  18883. inpoint and an outpoint, but the output packets may not be entirely contained
  18884. in the selected interval. By using this variable, it is possible to skip frames
  18885. generated by the concat demuxer which are not exactly contained in the selected
  18886. interval.
  18887. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18888. and the @var{lavf.concat.duration} packet metadata values which are also
  18889. present in the decoded frames.
  18890. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18891. start_time and either the duration metadata is missing or the frame pts is less
  18892. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18893. missing.
  18894. That basically means that an input frame is selected if its pts is within the
  18895. interval set by the concat demuxer.
  18896. @end table
  18897. The default value of the select expression is "1".
  18898. @subsection Examples
  18899. @itemize
  18900. @item
  18901. Select all frames in input:
  18902. @example
  18903. select
  18904. @end example
  18905. The example above is the same as:
  18906. @example
  18907. select=1
  18908. @end example
  18909. @item
  18910. Skip all frames:
  18911. @example
  18912. select=0
  18913. @end example
  18914. @item
  18915. Select only I-frames:
  18916. @example
  18917. select='eq(pict_type\,I)'
  18918. @end example
  18919. @item
  18920. Select one frame every 100:
  18921. @example
  18922. select='not(mod(n\,100))'
  18923. @end example
  18924. @item
  18925. Select only frames contained in the 10-20 time interval:
  18926. @example
  18927. select=between(t\,10\,20)
  18928. @end example
  18929. @item
  18930. Select only I-frames contained in the 10-20 time interval:
  18931. @example
  18932. select=between(t\,10\,20)*eq(pict_type\,I)
  18933. @end example
  18934. @item
  18935. Select frames with a minimum distance of 10 seconds:
  18936. @example
  18937. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18938. @end example
  18939. @item
  18940. Use aselect to select only audio frames with samples number > 100:
  18941. @example
  18942. aselect='gt(samples_n\,100)'
  18943. @end example
  18944. @item
  18945. Create a mosaic of the first scenes:
  18946. @example
  18947. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18948. @end example
  18949. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18950. choice.
  18951. @item
  18952. Send even and odd frames to separate outputs, and compose them:
  18953. @example
  18954. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18955. @end example
  18956. @item
  18957. Select useful frames from an ffconcat file which is using inpoints and
  18958. outpoints but where the source files are not intra frame only.
  18959. @example
  18960. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18961. @end example
  18962. @end itemize
  18963. @section sendcmd, asendcmd
  18964. Send commands to filters in the filtergraph.
  18965. These filters read commands to be sent to other filters in the
  18966. filtergraph.
  18967. @code{sendcmd} must be inserted between two video filters,
  18968. @code{asendcmd} must be inserted between two audio filters, but apart
  18969. from that they act the same way.
  18970. The specification of commands can be provided in the filter arguments
  18971. with the @var{commands} option, or in a file specified by the
  18972. @var{filename} option.
  18973. These filters accept the following options:
  18974. @table @option
  18975. @item commands, c
  18976. Set the commands to be read and sent to the other filters.
  18977. @item filename, f
  18978. Set the filename of the commands to be read and sent to the other
  18979. filters.
  18980. @end table
  18981. @subsection Commands syntax
  18982. A commands description consists of a sequence of interval
  18983. specifications, comprising a list of commands to be executed when a
  18984. particular event related to that interval occurs. The occurring event
  18985. is typically the current frame time entering or leaving a given time
  18986. interval.
  18987. An interval is specified by the following syntax:
  18988. @example
  18989. @var{START}[-@var{END}] @var{COMMANDS};
  18990. @end example
  18991. The time interval is specified by the @var{START} and @var{END} times.
  18992. @var{END} is optional and defaults to the maximum time.
  18993. The current frame time is considered within the specified interval if
  18994. it is included in the interval [@var{START}, @var{END}), that is when
  18995. the time is greater or equal to @var{START} and is lesser than
  18996. @var{END}.
  18997. @var{COMMANDS} consists of a sequence of one or more command
  18998. specifications, separated by ",", relating to that interval. The
  18999. syntax of a command specification is given by:
  19000. @example
  19001. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  19002. @end example
  19003. @var{FLAGS} is optional and specifies the type of events relating to
  19004. the time interval which enable sending the specified command, and must
  19005. be a non-null sequence of identifier flags separated by "+" or "|" and
  19006. enclosed between "[" and "]".
  19007. The following flags are recognized:
  19008. @table @option
  19009. @item enter
  19010. The command is sent when the current frame timestamp enters the
  19011. specified interval. In other words, the command is sent when the
  19012. previous frame timestamp was not in the given interval, and the
  19013. current is.
  19014. @item leave
  19015. The command is sent when the current frame timestamp leaves the
  19016. specified interval. In other words, the command is sent when the
  19017. previous frame timestamp was in the given interval, and the
  19018. current is not.
  19019. @item expr
  19020. The command @var{ARG} is interpreted as expression and result of
  19021. expression is passed as @var{ARG}.
  19022. The expression is evaluated through the eval API and can contain the following
  19023. constants:
  19024. @table @option
  19025. @item POS
  19026. Original position in the file of the frame, or undefined if undefined
  19027. for the current frame.
  19028. @item PTS
  19029. The presentation timestamp in input.
  19030. @item N
  19031. The count of the input frame for video or audio, starting from 0.
  19032. @item T
  19033. The time in seconds of the current frame.
  19034. @item TS
  19035. The start time in seconds of the current command interval.
  19036. @item TE
  19037. The end time in seconds of the current command interval.
  19038. @item TI
  19039. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  19040. @end table
  19041. @end table
  19042. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  19043. assumed.
  19044. @var{TARGET} specifies the target of the command, usually the name of
  19045. the filter class or a specific filter instance name.
  19046. @var{COMMAND} specifies the name of the command for the target filter.
  19047. @var{ARG} is optional and specifies the optional list of argument for
  19048. the given @var{COMMAND}.
  19049. Between one interval specification and another, whitespaces, or
  19050. sequences of characters starting with @code{#} until the end of line,
  19051. are ignored and can be used to annotate comments.
  19052. A simplified BNF description of the commands specification syntax
  19053. follows:
  19054. @example
  19055. @var{COMMAND_FLAG} ::= "enter" | "leave"
  19056. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  19057. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  19058. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  19059. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  19060. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  19061. @end example
  19062. @subsection Examples
  19063. @itemize
  19064. @item
  19065. Specify audio tempo change at second 4:
  19066. @example
  19067. asendcmd=c='4.0 atempo tempo 1.5',atempo
  19068. @end example
  19069. @item
  19070. Target a specific filter instance:
  19071. @example
  19072. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  19073. @end example
  19074. @item
  19075. Specify a list of drawtext and hue commands in a file.
  19076. @example
  19077. # show text in the interval 5-10
  19078. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  19079. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  19080. # desaturate the image in the interval 15-20
  19081. 15.0-20.0 [enter] hue s 0,
  19082. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  19083. [leave] hue s 1,
  19084. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  19085. # apply an exponential saturation fade-out effect, starting from time 25
  19086. 25 [enter] hue s exp(25-t)
  19087. @end example
  19088. A filtergraph allowing to read and process the above command list
  19089. stored in a file @file{test.cmd}, can be specified with:
  19090. @example
  19091. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  19092. @end example
  19093. @end itemize
  19094. @anchor{setpts}
  19095. @section setpts, asetpts
  19096. Change the PTS (presentation timestamp) of the input frames.
  19097. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  19098. This filter accepts the following options:
  19099. @table @option
  19100. @item expr
  19101. The expression which is evaluated for each frame to construct its timestamp.
  19102. @end table
  19103. The expression is evaluated through the eval API and can contain the following
  19104. constants:
  19105. @table @option
  19106. @item FRAME_RATE, FR
  19107. frame rate, only defined for constant frame-rate video
  19108. @item PTS
  19109. The presentation timestamp in input
  19110. @item N
  19111. The count of the input frame for video or the number of consumed samples,
  19112. not including the current frame for audio, starting from 0.
  19113. @item NB_CONSUMED_SAMPLES
  19114. The number of consumed samples, not including the current frame (only
  19115. audio)
  19116. @item NB_SAMPLES, S
  19117. The number of samples in the current frame (only audio)
  19118. @item SAMPLE_RATE, SR
  19119. The audio sample rate.
  19120. @item STARTPTS
  19121. The PTS of the first frame.
  19122. @item STARTT
  19123. the time in seconds of the first frame
  19124. @item INTERLACED
  19125. State whether the current frame is interlaced.
  19126. @item T
  19127. the time in seconds of the current frame
  19128. @item POS
  19129. original position in the file of the frame, or undefined if undefined
  19130. for the current frame
  19131. @item PREV_INPTS
  19132. The previous input PTS.
  19133. @item PREV_INT
  19134. previous input time in seconds
  19135. @item PREV_OUTPTS
  19136. The previous output PTS.
  19137. @item PREV_OUTT
  19138. previous output time in seconds
  19139. @item RTCTIME
  19140. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  19141. instead.
  19142. @item RTCSTART
  19143. The wallclock (RTC) time at the start of the movie in microseconds.
  19144. @item TB
  19145. The timebase of the input timestamps.
  19146. @end table
  19147. @subsection Examples
  19148. @itemize
  19149. @item
  19150. Start counting PTS from zero
  19151. @example
  19152. setpts=PTS-STARTPTS
  19153. @end example
  19154. @item
  19155. Apply fast motion effect:
  19156. @example
  19157. setpts=0.5*PTS
  19158. @end example
  19159. @item
  19160. Apply slow motion effect:
  19161. @example
  19162. setpts=2.0*PTS
  19163. @end example
  19164. @item
  19165. Set fixed rate of 25 frames per second:
  19166. @example
  19167. setpts=N/(25*TB)
  19168. @end example
  19169. @item
  19170. Set fixed rate 25 fps with some jitter:
  19171. @example
  19172. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  19173. @end example
  19174. @item
  19175. Apply an offset of 10 seconds to the input PTS:
  19176. @example
  19177. setpts=PTS+10/TB
  19178. @end example
  19179. @item
  19180. Generate timestamps from a "live source" and rebase onto the current timebase:
  19181. @example
  19182. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  19183. @end example
  19184. @item
  19185. Generate timestamps by counting samples:
  19186. @example
  19187. asetpts=N/SR/TB
  19188. @end example
  19189. @end itemize
  19190. @section setrange
  19191. Force color range for the output video frame.
  19192. The @code{setrange} filter marks the color range property for the
  19193. output frames. It does not change the input frame, but only sets the
  19194. corresponding property, which affects how the frame is treated by
  19195. following filters.
  19196. The filter accepts the following options:
  19197. @table @option
  19198. @item range
  19199. Available values are:
  19200. @table @samp
  19201. @item auto
  19202. Keep the same color range property.
  19203. @item unspecified, unknown
  19204. Set the color range as unspecified.
  19205. @item limited, tv, mpeg
  19206. Set the color range as limited.
  19207. @item full, pc, jpeg
  19208. Set the color range as full.
  19209. @end table
  19210. @end table
  19211. @section settb, asettb
  19212. Set the timebase to use for the output frames timestamps.
  19213. It is mainly useful for testing timebase configuration.
  19214. It accepts the following parameters:
  19215. @table @option
  19216. @item expr, tb
  19217. The expression which is evaluated into the output timebase.
  19218. @end table
  19219. The value for @option{tb} is an arithmetic expression representing a
  19220. rational. The expression can contain the constants "AVTB" (the default
  19221. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19222. audio only). Default value is "intb".
  19223. @subsection Examples
  19224. @itemize
  19225. @item
  19226. Set the timebase to 1/25:
  19227. @example
  19228. settb=expr=1/25
  19229. @end example
  19230. @item
  19231. Set the timebase to 1/10:
  19232. @example
  19233. settb=expr=0.1
  19234. @end example
  19235. @item
  19236. Set the timebase to 1001/1000:
  19237. @example
  19238. settb=1+0.001
  19239. @end example
  19240. @item
  19241. Set the timebase to 2*intb:
  19242. @example
  19243. settb=2*intb
  19244. @end example
  19245. @item
  19246. Set the default timebase value:
  19247. @example
  19248. settb=AVTB
  19249. @end example
  19250. @end itemize
  19251. @section showcqt
  19252. Convert input audio to a video output representing frequency spectrum
  19253. logarithmically using Brown-Puckette constant Q transform algorithm with
  19254. direct frequency domain coefficient calculation (but the transform itself
  19255. is not really constant Q, instead the Q factor is actually variable/clamped),
  19256. with musical tone scale, from E0 to D#10.
  19257. The filter accepts the following options:
  19258. @table @option
  19259. @item size, s
  19260. Specify the video size for the output. It must be even. For the syntax of this option,
  19261. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19262. Default value is @code{1920x1080}.
  19263. @item fps, rate, r
  19264. Set the output frame rate. Default value is @code{25}.
  19265. @item bar_h
  19266. Set the bargraph height. It must be even. Default value is @code{-1} which
  19267. computes the bargraph height automatically.
  19268. @item axis_h
  19269. Set the axis height. It must be even. Default value is @code{-1} which computes
  19270. the axis height automatically.
  19271. @item sono_h
  19272. Set the sonogram height. It must be even. Default value is @code{-1} which
  19273. computes the sonogram height automatically.
  19274. @item fullhd
  19275. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19276. instead. Default value is @code{1}.
  19277. @item sono_v, volume
  19278. Specify the sonogram volume expression. It can contain variables:
  19279. @table @option
  19280. @item bar_v
  19281. the @var{bar_v} evaluated expression
  19282. @item frequency, freq, f
  19283. the frequency where it is evaluated
  19284. @item timeclamp, tc
  19285. the value of @var{timeclamp} option
  19286. @end table
  19287. and functions:
  19288. @table @option
  19289. @item a_weighting(f)
  19290. A-weighting of equal loudness
  19291. @item b_weighting(f)
  19292. B-weighting of equal loudness
  19293. @item c_weighting(f)
  19294. C-weighting of equal loudness.
  19295. @end table
  19296. Default value is @code{16}.
  19297. @item bar_v, volume2
  19298. Specify the bargraph volume expression. It can contain variables:
  19299. @table @option
  19300. @item sono_v
  19301. the @var{sono_v} evaluated expression
  19302. @item frequency, freq, f
  19303. the frequency where it is evaluated
  19304. @item timeclamp, tc
  19305. the value of @var{timeclamp} option
  19306. @end table
  19307. and functions:
  19308. @table @option
  19309. @item a_weighting(f)
  19310. A-weighting of equal loudness
  19311. @item b_weighting(f)
  19312. B-weighting of equal loudness
  19313. @item c_weighting(f)
  19314. C-weighting of equal loudness.
  19315. @end table
  19316. Default value is @code{sono_v}.
  19317. @item sono_g, gamma
  19318. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19319. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19320. Acceptable range is @code{[1, 7]}.
  19321. @item bar_g, gamma2
  19322. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19323. @code{[1, 7]}.
  19324. @item bar_t
  19325. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19326. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19327. @item timeclamp, tc
  19328. Specify the transform timeclamp. At low frequency, there is trade-off between
  19329. accuracy in time domain and frequency domain. If timeclamp is lower,
  19330. event in time domain is represented more accurately (such as fast bass drum),
  19331. otherwise event in frequency domain is represented more accurately
  19332. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19333. @item attack
  19334. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19335. limits future samples by applying asymmetric windowing in time domain, useful
  19336. when low latency is required. Accepted range is @code{[0, 1]}.
  19337. @item basefreq
  19338. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19339. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19340. @item endfreq
  19341. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19342. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19343. @item coeffclamp
  19344. This option is deprecated and ignored.
  19345. @item tlength
  19346. Specify the transform length in time domain. Use this option to control accuracy
  19347. trade-off between time domain and frequency domain at every frequency sample.
  19348. It can contain variables:
  19349. @table @option
  19350. @item frequency, freq, f
  19351. the frequency where it is evaluated
  19352. @item timeclamp, tc
  19353. the value of @var{timeclamp} option.
  19354. @end table
  19355. Default value is @code{384*tc/(384+tc*f)}.
  19356. @item count
  19357. Specify the transform count for every video frame. Default value is @code{6}.
  19358. Acceptable range is @code{[1, 30]}.
  19359. @item fcount
  19360. Specify the transform count for every single pixel. Default value is @code{0},
  19361. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19362. @item fontfile
  19363. Specify font file for use with freetype to draw the axis. If not specified,
  19364. use embedded font. Note that drawing with font file or embedded font is not
  19365. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19366. option instead.
  19367. @item font
  19368. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19369. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19370. escaping.
  19371. @item fontcolor
  19372. Specify font color expression. This is arithmetic expression that should return
  19373. integer value 0xRRGGBB. It can contain variables:
  19374. @table @option
  19375. @item frequency, freq, f
  19376. the frequency where it is evaluated
  19377. @item timeclamp, tc
  19378. the value of @var{timeclamp} option
  19379. @end table
  19380. and functions:
  19381. @table @option
  19382. @item midi(f)
  19383. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19384. @item r(x), g(x), b(x)
  19385. red, green, and blue value of intensity x.
  19386. @end table
  19387. Default value is @code{st(0, (midi(f)-59.5)/12);
  19388. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19389. r(1-ld(1)) + b(ld(1))}.
  19390. @item axisfile
  19391. Specify image file to draw the axis. This option override @var{fontfile} and
  19392. @var{fontcolor} option.
  19393. @item axis, text
  19394. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19395. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19396. Default value is @code{1}.
  19397. @item csp
  19398. Set colorspace. The accepted values are:
  19399. @table @samp
  19400. @item unspecified
  19401. Unspecified (default)
  19402. @item bt709
  19403. BT.709
  19404. @item fcc
  19405. FCC
  19406. @item bt470bg
  19407. BT.470BG or BT.601-6 625
  19408. @item smpte170m
  19409. SMPTE-170M or BT.601-6 525
  19410. @item smpte240m
  19411. SMPTE-240M
  19412. @item bt2020ncl
  19413. BT.2020 with non-constant luminance
  19414. @end table
  19415. @item cscheme
  19416. Set spectrogram color scheme. This is list of floating point values with format
  19417. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19418. The default is @code{1|0.5|0|0|0.5|1}.
  19419. @end table
  19420. @subsection Examples
  19421. @itemize
  19422. @item
  19423. Playing audio while showing the spectrum:
  19424. @example
  19425. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19426. @end example
  19427. @item
  19428. Same as above, but with frame rate 30 fps:
  19429. @example
  19430. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19431. @end example
  19432. @item
  19433. Playing at 1280x720:
  19434. @example
  19435. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19436. @end example
  19437. @item
  19438. Disable sonogram display:
  19439. @example
  19440. sono_h=0
  19441. @end example
  19442. @item
  19443. A1 and its harmonics: A1, A2, (near)E3, A3:
  19444. @example
  19445. 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),
  19446. asplit[a][out1]; [a] showcqt [out0]'
  19447. @end example
  19448. @item
  19449. Same as above, but with more accuracy in frequency domain:
  19450. @example
  19451. 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),
  19452. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19453. @end example
  19454. @item
  19455. Custom volume:
  19456. @example
  19457. bar_v=10:sono_v=bar_v*a_weighting(f)
  19458. @end example
  19459. @item
  19460. Custom gamma, now spectrum is linear to the amplitude.
  19461. @example
  19462. bar_g=2:sono_g=2
  19463. @end example
  19464. @item
  19465. Custom tlength equation:
  19466. @example
  19467. 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)))'
  19468. @end example
  19469. @item
  19470. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19471. @example
  19472. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19473. @end example
  19474. @item
  19475. Custom font using fontconfig:
  19476. @example
  19477. font='Courier New,Monospace,mono|bold'
  19478. @end example
  19479. @item
  19480. Custom frequency range with custom axis using image file:
  19481. @example
  19482. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19483. @end example
  19484. @end itemize
  19485. @section showfreqs
  19486. Convert input audio to video output representing the audio power spectrum.
  19487. Audio amplitude is on Y-axis while frequency is on X-axis.
  19488. The filter accepts the following options:
  19489. @table @option
  19490. @item size, s
  19491. Specify size of video. For the syntax of this option, check the
  19492. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19493. Default is @code{1024x512}.
  19494. @item mode
  19495. Set display mode.
  19496. This set how each frequency bin will be represented.
  19497. It accepts the following values:
  19498. @table @samp
  19499. @item line
  19500. @item bar
  19501. @item dot
  19502. @end table
  19503. Default is @code{bar}.
  19504. @item ascale
  19505. Set amplitude scale.
  19506. It accepts the following values:
  19507. @table @samp
  19508. @item lin
  19509. Linear scale.
  19510. @item sqrt
  19511. Square root scale.
  19512. @item cbrt
  19513. Cubic root scale.
  19514. @item log
  19515. Logarithmic scale.
  19516. @end table
  19517. Default is @code{log}.
  19518. @item fscale
  19519. Set frequency scale.
  19520. It accepts the following values:
  19521. @table @samp
  19522. @item lin
  19523. Linear scale.
  19524. @item log
  19525. Logarithmic scale.
  19526. @item rlog
  19527. Reverse logarithmic scale.
  19528. @end table
  19529. Default is @code{lin}.
  19530. @item win_size
  19531. Set window size. Allowed range is from 16 to 65536.
  19532. Default is @code{2048}
  19533. @item win_func
  19534. Set windowing function.
  19535. It accepts the following values:
  19536. @table @samp
  19537. @item rect
  19538. @item bartlett
  19539. @item hanning
  19540. @item hamming
  19541. @item blackman
  19542. @item welch
  19543. @item flattop
  19544. @item bharris
  19545. @item bnuttall
  19546. @item bhann
  19547. @item sine
  19548. @item nuttall
  19549. @item lanczos
  19550. @item gauss
  19551. @item tukey
  19552. @item dolph
  19553. @item cauchy
  19554. @item parzen
  19555. @item poisson
  19556. @item bohman
  19557. @end table
  19558. Default is @code{hanning}.
  19559. @item overlap
  19560. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19561. which means optimal overlap for selected window function will be picked.
  19562. @item averaging
  19563. Set time averaging. Setting this to 0 will display current maximal peaks.
  19564. Default is @code{1}, which means time averaging is disabled.
  19565. @item colors
  19566. Specify list of colors separated by space or by '|' which will be used to
  19567. draw channel frequencies. Unrecognized or missing colors will be replaced
  19568. by white color.
  19569. @item cmode
  19570. Set channel display mode.
  19571. It accepts the following values:
  19572. @table @samp
  19573. @item combined
  19574. @item separate
  19575. @end table
  19576. Default is @code{combined}.
  19577. @item minamp
  19578. Set minimum amplitude used in @code{log} amplitude scaler.
  19579. @item data
  19580. Set data display mode.
  19581. It accepts the following values:
  19582. @table @samp
  19583. @item magnitude
  19584. @item phase
  19585. @item delay
  19586. @end table
  19587. Default is @code{magnitude}.
  19588. @end table
  19589. @section showspatial
  19590. Convert stereo input audio to a video output, representing the spatial relationship
  19591. between two channels.
  19592. The filter accepts the following options:
  19593. @table @option
  19594. @item size, s
  19595. Specify the video size for the output. For the syntax of this option, check the
  19596. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19597. Default value is @code{512x512}.
  19598. @item win_size
  19599. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19600. @item win_func
  19601. Set window function.
  19602. It accepts the following values:
  19603. @table @samp
  19604. @item rect
  19605. @item bartlett
  19606. @item hann
  19607. @item hanning
  19608. @item hamming
  19609. @item blackman
  19610. @item welch
  19611. @item flattop
  19612. @item bharris
  19613. @item bnuttall
  19614. @item bhann
  19615. @item sine
  19616. @item nuttall
  19617. @item lanczos
  19618. @item gauss
  19619. @item tukey
  19620. @item dolph
  19621. @item cauchy
  19622. @item parzen
  19623. @item poisson
  19624. @item bohman
  19625. @end table
  19626. Default value is @code{hann}.
  19627. @item overlap
  19628. Set ratio of overlap window. Default value is @code{0.5}.
  19629. When value is @code{1} overlap is set to recommended size for specific
  19630. window function currently used.
  19631. @end table
  19632. @anchor{showspectrum}
  19633. @section showspectrum
  19634. Convert input audio to a video output, representing the audio frequency
  19635. spectrum.
  19636. The filter accepts the following options:
  19637. @table @option
  19638. @item size, s
  19639. Specify the video size for the output. For the syntax of this option, check the
  19640. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19641. Default value is @code{640x512}.
  19642. @item slide
  19643. Specify how the spectrum should slide along the window.
  19644. It accepts the following values:
  19645. @table @samp
  19646. @item replace
  19647. the samples start again on the left when they reach the right
  19648. @item scroll
  19649. the samples scroll from right to left
  19650. @item fullframe
  19651. frames are only produced when the samples reach the right
  19652. @item rscroll
  19653. the samples scroll from left to right
  19654. @end table
  19655. Default value is @code{replace}.
  19656. @item mode
  19657. Specify display mode.
  19658. It accepts the following values:
  19659. @table @samp
  19660. @item combined
  19661. all channels are displayed in the same row
  19662. @item separate
  19663. all channels are displayed in separate rows
  19664. @end table
  19665. Default value is @samp{combined}.
  19666. @item color
  19667. Specify display color mode.
  19668. It accepts the following values:
  19669. @table @samp
  19670. @item channel
  19671. each channel is displayed in a separate color
  19672. @item intensity
  19673. each channel is displayed using the same color scheme
  19674. @item rainbow
  19675. each channel is displayed using the rainbow color scheme
  19676. @item moreland
  19677. each channel is displayed using the moreland color scheme
  19678. @item nebulae
  19679. each channel is displayed using the nebulae color scheme
  19680. @item fire
  19681. each channel is displayed using the fire color scheme
  19682. @item fiery
  19683. each channel is displayed using the fiery color scheme
  19684. @item fruit
  19685. each channel is displayed using the fruit color scheme
  19686. @item cool
  19687. each channel is displayed using the cool color scheme
  19688. @item magma
  19689. each channel is displayed using the magma color scheme
  19690. @item green
  19691. each channel is displayed using the green color scheme
  19692. @item viridis
  19693. each channel is displayed using the viridis color scheme
  19694. @item plasma
  19695. each channel is displayed using the plasma color scheme
  19696. @item cividis
  19697. each channel is displayed using the cividis color scheme
  19698. @item terrain
  19699. each channel is displayed using the terrain color scheme
  19700. @end table
  19701. Default value is @samp{channel}.
  19702. @item scale
  19703. Specify scale used for calculating intensity color values.
  19704. It accepts the following values:
  19705. @table @samp
  19706. @item lin
  19707. linear
  19708. @item sqrt
  19709. square root, default
  19710. @item cbrt
  19711. cubic root
  19712. @item log
  19713. logarithmic
  19714. @item 4thrt
  19715. 4th root
  19716. @item 5thrt
  19717. 5th root
  19718. @end table
  19719. Default value is @samp{sqrt}.
  19720. @item fscale
  19721. Specify frequency scale.
  19722. It accepts the following values:
  19723. @table @samp
  19724. @item lin
  19725. linear
  19726. @item log
  19727. logarithmic
  19728. @end table
  19729. Default value is @samp{lin}.
  19730. @item saturation
  19731. Set saturation modifier for displayed colors. Negative values provide
  19732. alternative color scheme. @code{0} is no saturation at all.
  19733. Saturation must be in [-10.0, 10.0] range.
  19734. Default value is @code{1}.
  19735. @item win_func
  19736. Set window function.
  19737. It accepts the following values:
  19738. @table @samp
  19739. @item rect
  19740. @item bartlett
  19741. @item hann
  19742. @item hanning
  19743. @item hamming
  19744. @item blackman
  19745. @item welch
  19746. @item flattop
  19747. @item bharris
  19748. @item bnuttall
  19749. @item bhann
  19750. @item sine
  19751. @item nuttall
  19752. @item lanczos
  19753. @item gauss
  19754. @item tukey
  19755. @item dolph
  19756. @item cauchy
  19757. @item parzen
  19758. @item poisson
  19759. @item bohman
  19760. @end table
  19761. Default value is @code{hann}.
  19762. @item orientation
  19763. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19764. @code{horizontal}. Default is @code{vertical}.
  19765. @item overlap
  19766. Set ratio of overlap window. Default value is @code{0}.
  19767. When value is @code{1} overlap is set to recommended size for specific
  19768. window function currently used.
  19769. @item gain
  19770. Set scale gain for calculating intensity color values.
  19771. Default value is @code{1}.
  19772. @item data
  19773. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19774. @item rotation
  19775. Set color rotation, must be in [-1.0, 1.0] range.
  19776. Default value is @code{0}.
  19777. @item start
  19778. Set start frequency from which to display spectrogram. Default is @code{0}.
  19779. @item stop
  19780. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19781. @item fps
  19782. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19783. @item legend
  19784. Draw time and frequency axes and legends. Default is disabled.
  19785. @end table
  19786. The usage is very similar to the showwaves filter; see the examples in that
  19787. section.
  19788. @subsection Examples
  19789. @itemize
  19790. @item
  19791. Large window with logarithmic color scaling:
  19792. @example
  19793. showspectrum=s=1280x480:scale=log
  19794. @end example
  19795. @item
  19796. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19797. @example
  19798. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19799. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19800. @end example
  19801. @end itemize
  19802. @section showspectrumpic
  19803. Convert input audio to a single video frame, representing the audio frequency
  19804. spectrum.
  19805. The filter accepts the following options:
  19806. @table @option
  19807. @item size, s
  19808. Specify the video size for the output. For the syntax of this option, check the
  19809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19810. Default value is @code{4096x2048}.
  19811. @item mode
  19812. Specify display mode.
  19813. It accepts the following values:
  19814. @table @samp
  19815. @item combined
  19816. all channels are displayed in the same row
  19817. @item separate
  19818. all channels are displayed in separate rows
  19819. @end table
  19820. Default value is @samp{combined}.
  19821. @item color
  19822. Specify display color mode.
  19823. It accepts the following values:
  19824. @table @samp
  19825. @item channel
  19826. each channel is displayed in a separate color
  19827. @item intensity
  19828. each channel is displayed using the same color scheme
  19829. @item rainbow
  19830. each channel is displayed using the rainbow color scheme
  19831. @item moreland
  19832. each channel is displayed using the moreland color scheme
  19833. @item nebulae
  19834. each channel is displayed using the nebulae color scheme
  19835. @item fire
  19836. each channel is displayed using the fire color scheme
  19837. @item fiery
  19838. each channel is displayed using the fiery color scheme
  19839. @item fruit
  19840. each channel is displayed using the fruit color scheme
  19841. @item cool
  19842. each channel is displayed using the cool color scheme
  19843. @item magma
  19844. each channel is displayed using the magma color scheme
  19845. @item green
  19846. each channel is displayed using the green color scheme
  19847. @item viridis
  19848. each channel is displayed using the viridis color scheme
  19849. @item plasma
  19850. each channel is displayed using the plasma color scheme
  19851. @item cividis
  19852. each channel is displayed using the cividis color scheme
  19853. @item terrain
  19854. each channel is displayed using the terrain color scheme
  19855. @end table
  19856. Default value is @samp{intensity}.
  19857. @item scale
  19858. Specify scale used for calculating intensity color values.
  19859. It accepts the following values:
  19860. @table @samp
  19861. @item lin
  19862. linear
  19863. @item sqrt
  19864. square root, default
  19865. @item cbrt
  19866. cubic root
  19867. @item log
  19868. logarithmic
  19869. @item 4thrt
  19870. 4th root
  19871. @item 5thrt
  19872. 5th root
  19873. @end table
  19874. Default value is @samp{log}.
  19875. @item fscale
  19876. Specify frequency scale.
  19877. It accepts the following values:
  19878. @table @samp
  19879. @item lin
  19880. linear
  19881. @item log
  19882. logarithmic
  19883. @end table
  19884. Default value is @samp{lin}.
  19885. @item saturation
  19886. Set saturation modifier for displayed colors. Negative values provide
  19887. alternative color scheme. @code{0} is no saturation at all.
  19888. Saturation must be in [-10.0, 10.0] range.
  19889. Default value is @code{1}.
  19890. @item win_func
  19891. Set window function.
  19892. It accepts the following values:
  19893. @table @samp
  19894. @item rect
  19895. @item bartlett
  19896. @item hann
  19897. @item hanning
  19898. @item hamming
  19899. @item blackman
  19900. @item welch
  19901. @item flattop
  19902. @item bharris
  19903. @item bnuttall
  19904. @item bhann
  19905. @item sine
  19906. @item nuttall
  19907. @item lanczos
  19908. @item gauss
  19909. @item tukey
  19910. @item dolph
  19911. @item cauchy
  19912. @item parzen
  19913. @item poisson
  19914. @item bohman
  19915. @end table
  19916. Default value is @code{hann}.
  19917. @item orientation
  19918. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19919. @code{horizontal}. Default is @code{vertical}.
  19920. @item gain
  19921. Set scale gain for calculating intensity color values.
  19922. Default value is @code{1}.
  19923. @item legend
  19924. Draw time and frequency axes and legends. Default is enabled.
  19925. @item rotation
  19926. Set color rotation, must be in [-1.0, 1.0] range.
  19927. Default value is @code{0}.
  19928. @item start
  19929. Set start frequency from which to display spectrogram. Default is @code{0}.
  19930. @item stop
  19931. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19932. @end table
  19933. @subsection Examples
  19934. @itemize
  19935. @item
  19936. Extract an audio spectrogram of a whole audio track
  19937. in a 1024x1024 picture using @command{ffmpeg}:
  19938. @example
  19939. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19940. @end example
  19941. @end itemize
  19942. @section showvolume
  19943. Convert input audio volume to a video output.
  19944. The filter accepts the following options:
  19945. @table @option
  19946. @item rate, r
  19947. Set video rate.
  19948. @item b
  19949. Set border width, allowed range is [0, 5]. Default is 1.
  19950. @item w
  19951. Set channel width, allowed range is [80, 8192]. Default is 400.
  19952. @item h
  19953. Set channel height, allowed range is [1, 900]. Default is 20.
  19954. @item f
  19955. Set fade, allowed range is [0, 1]. Default is 0.95.
  19956. @item c
  19957. Set volume color expression.
  19958. The expression can use the following variables:
  19959. @table @option
  19960. @item VOLUME
  19961. Current max volume of channel in dB.
  19962. @item PEAK
  19963. Current peak.
  19964. @item CHANNEL
  19965. Current channel number, starting from 0.
  19966. @end table
  19967. @item t
  19968. If set, displays channel names. Default is enabled.
  19969. @item v
  19970. If set, displays volume values. Default is enabled.
  19971. @item o
  19972. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19973. default is @code{h}.
  19974. @item s
  19975. Set step size, allowed range is [0, 5]. Default is 0, which means
  19976. step is disabled.
  19977. @item p
  19978. Set background opacity, allowed range is [0, 1]. Default is 0.
  19979. @item m
  19980. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19981. default is @code{p}.
  19982. @item ds
  19983. Set display scale, can be linear: @code{lin} or log: @code{log},
  19984. default is @code{lin}.
  19985. @item dm
  19986. In second.
  19987. If set to > 0., display a line for the max level
  19988. in the previous seconds.
  19989. default is disabled: @code{0.}
  19990. @item dmc
  19991. The color of the max line. Use when @code{dm} option is set to > 0.
  19992. default is: @code{orange}
  19993. @end table
  19994. @section showwaves
  19995. Convert input audio to a video output, representing the samples waves.
  19996. The filter accepts the following options:
  19997. @table @option
  19998. @item size, s
  19999. Specify the video size for the output. For the syntax of this option, check the
  20000. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20001. Default value is @code{600x240}.
  20002. @item mode
  20003. Set display mode.
  20004. Available values are:
  20005. @table @samp
  20006. @item point
  20007. Draw a point for each sample.
  20008. @item line
  20009. Draw a vertical line for each sample.
  20010. @item p2p
  20011. Draw a point for each sample and a line between them.
  20012. @item cline
  20013. Draw a centered vertical line for each sample.
  20014. @end table
  20015. Default value is @code{point}.
  20016. @item n
  20017. Set the number of samples which are printed on the same column. A
  20018. larger value will decrease the frame rate. Must be a positive
  20019. integer. This option can be set only if the value for @var{rate}
  20020. is not explicitly specified.
  20021. @item rate, r
  20022. Set the (approximate) output frame rate. This is done by setting the
  20023. option @var{n}. Default value is "25".
  20024. @item split_channels
  20025. Set if channels should be drawn separately or overlap. Default value is 0.
  20026. @item colors
  20027. Set colors separated by '|' which are going to be used for drawing of each channel.
  20028. @item scale
  20029. Set amplitude scale.
  20030. Available values are:
  20031. @table @samp
  20032. @item lin
  20033. Linear.
  20034. @item log
  20035. Logarithmic.
  20036. @item sqrt
  20037. Square root.
  20038. @item cbrt
  20039. Cubic root.
  20040. @end table
  20041. Default is linear.
  20042. @item draw
  20043. Set the draw mode. This is mostly useful to set for high @var{n}.
  20044. Available values are:
  20045. @table @samp
  20046. @item scale
  20047. Scale pixel values for each drawn sample.
  20048. @item full
  20049. Draw every sample directly.
  20050. @end table
  20051. Default value is @code{scale}.
  20052. @end table
  20053. @subsection Examples
  20054. @itemize
  20055. @item
  20056. Output the input file audio and the corresponding video representation
  20057. at the same time:
  20058. @example
  20059. amovie=a.mp3,asplit[out0],showwaves[out1]
  20060. @end example
  20061. @item
  20062. Create a synthetic signal and show it with showwaves, forcing a
  20063. frame rate of 30 frames per second:
  20064. @example
  20065. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  20066. @end example
  20067. @end itemize
  20068. @section showwavespic
  20069. Convert input audio to a single video frame, representing the samples waves.
  20070. The filter accepts the following options:
  20071. @table @option
  20072. @item size, s
  20073. Specify the video size for the output. For the syntax of this option, check the
  20074. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20075. Default value is @code{600x240}.
  20076. @item split_channels
  20077. Set if channels should be drawn separately or overlap. Default value is 0.
  20078. @item colors
  20079. Set colors separated by '|' which are going to be used for drawing of each channel.
  20080. @item scale
  20081. Set amplitude scale.
  20082. Available values are:
  20083. @table @samp
  20084. @item lin
  20085. Linear.
  20086. @item log
  20087. Logarithmic.
  20088. @item sqrt
  20089. Square root.
  20090. @item cbrt
  20091. Cubic root.
  20092. @end table
  20093. Default is linear.
  20094. @item draw
  20095. Set the draw mode.
  20096. Available values are:
  20097. @table @samp
  20098. @item scale
  20099. Scale pixel values for each drawn sample.
  20100. @item full
  20101. Draw every sample directly.
  20102. @end table
  20103. Default value is @code{scale}.
  20104. @item filter
  20105. Set the filter mode.
  20106. Available values are:
  20107. @table @samp
  20108. @item average
  20109. Use average samples values for each drawn sample.
  20110. @item peak
  20111. Use peak samples values for each drawn sample.
  20112. @end table
  20113. Default value is @code{average}.
  20114. @end table
  20115. @subsection Examples
  20116. @itemize
  20117. @item
  20118. Extract a channel split representation of the wave form of a whole audio track
  20119. in a 1024x800 picture using @command{ffmpeg}:
  20120. @example
  20121. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  20122. @end example
  20123. @end itemize
  20124. @section sidedata, asidedata
  20125. Delete frame side data, or select frames based on it.
  20126. This filter accepts the following options:
  20127. @table @option
  20128. @item mode
  20129. Set mode of operation of the filter.
  20130. Can be one of the following:
  20131. @table @samp
  20132. @item select
  20133. Select every frame with side data of @code{type}.
  20134. @item delete
  20135. Delete side data of @code{type}. If @code{type} is not set, delete all side
  20136. data in the frame.
  20137. @end table
  20138. @item type
  20139. Set side data type used with all modes. Must be set for @code{select} mode. For
  20140. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  20141. in @file{libavutil/frame.h}. For example, to choose
  20142. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  20143. @end table
  20144. @section spectrumsynth
  20145. Synthesize audio from 2 input video spectrums, first input stream represents
  20146. magnitude across time and second represents phase across time.
  20147. The filter will transform from frequency domain as displayed in videos back
  20148. to time domain as presented in audio output.
  20149. This filter is primarily created for reversing processed @ref{showspectrum}
  20150. filter outputs, but can synthesize sound from other spectrograms too.
  20151. But in such case results are going to be poor if the phase data is not
  20152. available, because in such cases phase data need to be recreated, usually
  20153. it's just recreated from random noise.
  20154. For best results use gray only output (@code{channel} color mode in
  20155. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  20156. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  20157. @code{data} option. Inputs videos should generally use @code{fullframe}
  20158. slide mode as that saves resources needed for decoding video.
  20159. The filter accepts the following options:
  20160. @table @option
  20161. @item sample_rate
  20162. Specify sample rate of output audio, the sample rate of audio from which
  20163. spectrum was generated may differ.
  20164. @item channels
  20165. Set number of channels represented in input video spectrums.
  20166. @item scale
  20167. Set scale which was used when generating magnitude input spectrum.
  20168. Can be @code{lin} or @code{log}. Default is @code{log}.
  20169. @item slide
  20170. Set slide which was used when generating inputs spectrums.
  20171. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  20172. Default is @code{fullframe}.
  20173. @item win_func
  20174. Set window function used for resynthesis.
  20175. @item overlap
  20176. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20177. which means optimal overlap for selected window function will be picked.
  20178. @item orientation
  20179. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  20180. Default is @code{vertical}.
  20181. @end table
  20182. @subsection Examples
  20183. @itemize
  20184. @item
  20185. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  20186. then resynthesize videos back to audio with spectrumsynth:
  20187. @example
  20188. 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
  20189. 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
  20190. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  20191. @end example
  20192. @end itemize
  20193. @section split, asplit
  20194. Split input into several identical outputs.
  20195. @code{asplit} works with audio input, @code{split} with video.
  20196. The filter accepts a single parameter which specifies the number of outputs. If
  20197. unspecified, it defaults to 2.
  20198. @subsection Examples
  20199. @itemize
  20200. @item
  20201. Create two separate outputs from the same input:
  20202. @example
  20203. [in] split [out0][out1]
  20204. @end example
  20205. @item
  20206. To create 3 or more outputs, you need to specify the number of
  20207. outputs, like in:
  20208. @example
  20209. [in] asplit=3 [out0][out1][out2]
  20210. @end example
  20211. @item
  20212. Create two separate outputs from the same input, one cropped and
  20213. one padded:
  20214. @example
  20215. [in] split [splitout1][splitout2];
  20216. [splitout1] crop=100:100:0:0 [cropout];
  20217. [splitout2] pad=200:200:100:100 [padout];
  20218. @end example
  20219. @item
  20220. Create 5 copies of the input audio with @command{ffmpeg}:
  20221. @example
  20222. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20223. @end example
  20224. @end itemize
  20225. @section zmq, azmq
  20226. Receive commands sent through a libzmq client, and forward them to
  20227. filters in the filtergraph.
  20228. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20229. must be inserted between two video filters, @code{azmq} between two
  20230. audio filters. Both are capable to send messages to any filter type.
  20231. To enable these filters you need to install the libzmq library and
  20232. headers and configure FFmpeg with @code{--enable-libzmq}.
  20233. For more information about libzmq see:
  20234. @url{http://www.zeromq.org/}
  20235. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20236. receives messages sent through a network interface defined by the
  20237. @option{bind_address} (or the abbreviation "@option{b}") option.
  20238. Default value of this option is @file{tcp://localhost:5555}. You may
  20239. want to alter this value to your needs, but do not forget to escape any
  20240. ':' signs (see @ref{filtergraph escaping}).
  20241. The received message must be in the form:
  20242. @example
  20243. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20244. @end example
  20245. @var{TARGET} specifies the target of the command, usually the name of
  20246. the filter class or a specific filter instance name. The default
  20247. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20248. but you can override this by using the @samp{filter_name@@id} syntax
  20249. (see @ref{Filtergraph syntax}).
  20250. @var{COMMAND} specifies the name of the command for the target filter.
  20251. @var{ARG} is optional and specifies the optional argument list for the
  20252. given @var{COMMAND}.
  20253. Upon reception, the message is processed and the corresponding command
  20254. is injected into the filtergraph. Depending on the result, the filter
  20255. will send a reply to the client, adopting the format:
  20256. @example
  20257. @var{ERROR_CODE} @var{ERROR_REASON}
  20258. @var{MESSAGE}
  20259. @end example
  20260. @var{MESSAGE} is optional.
  20261. @subsection Examples
  20262. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20263. be used to send commands processed by these filters.
  20264. Consider the following filtergraph generated by @command{ffplay}.
  20265. In this example the last overlay filter has an instance name. All other
  20266. filters will have default instance names.
  20267. @example
  20268. ffplay -dumpgraph 1 -f lavfi "
  20269. color=s=100x100:c=red [l];
  20270. color=s=100x100:c=blue [r];
  20271. nullsrc=s=200x100, zmq [bg];
  20272. [bg][l] overlay [bg+l];
  20273. [bg+l][r] overlay@@my=x=100 "
  20274. @end example
  20275. To change the color of the left side of the video, the following
  20276. command can be used:
  20277. @example
  20278. echo Parsed_color_0 c yellow | tools/zmqsend
  20279. @end example
  20280. To change the right side:
  20281. @example
  20282. echo Parsed_color_1 c pink | tools/zmqsend
  20283. @end example
  20284. To change the position of the right side:
  20285. @example
  20286. echo overlay@@my x 150 | tools/zmqsend
  20287. @end example
  20288. @c man end MULTIMEDIA FILTERS
  20289. @chapter Multimedia Sources
  20290. @c man begin MULTIMEDIA SOURCES
  20291. Below is a description of the currently available multimedia sources.
  20292. @section amovie
  20293. This is the same as @ref{movie} source, except it selects an audio
  20294. stream by default.
  20295. @anchor{movie}
  20296. @section movie
  20297. Read audio and/or video stream(s) from a movie container.
  20298. It accepts the following parameters:
  20299. @table @option
  20300. @item filename
  20301. The name of the resource to read (not necessarily a file; it can also be a
  20302. device or a stream accessed through some protocol).
  20303. @item format_name, f
  20304. Specifies the format assumed for the movie to read, and can be either
  20305. the name of a container or an input device. If not specified, the
  20306. format is guessed from @var{movie_name} or by probing.
  20307. @item seek_point, sp
  20308. Specifies the seek point in seconds. The frames will be output
  20309. starting from this seek point. The parameter is evaluated with
  20310. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20311. postfix. The default value is "0".
  20312. @item streams, s
  20313. Specifies the streams to read. Several streams can be specified,
  20314. separated by "+". The source will then have as many outputs, in the
  20315. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20316. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20317. respectively the default (best suited) video and audio stream. Default
  20318. is "dv", or "da" if the filter is called as "amovie".
  20319. @item stream_index, si
  20320. Specifies the index of the video stream to read. If the value is -1,
  20321. the most suitable video stream will be automatically selected. The default
  20322. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20323. audio instead of video.
  20324. @item loop
  20325. Specifies how many times to read the stream in sequence.
  20326. If the value is 0, the stream will be looped infinitely.
  20327. Default value is "1".
  20328. Note that when the movie is looped the source timestamps are not
  20329. changed, so it will generate non monotonically increasing timestamps.
  20330. @item discontinuity
  20331. Specifies the time difference between frames above which the point is
  20332. considered a timestamp discontinuity which is removed by adjusting the later
  20333. timestamps.
  20334. @end table
  20335. It allows overlaying a second video on top of the main input of
  20336. a filtergraph, as shown in this graph:
  20337. @example
  20338. input -----------> deltapts0 --> overlay --> output
  20339. ^
  20340. |
  20341. movie --> scale--> deltapts1 -------+
  20342. @end example
  20343. @subsection Examples
  20344. @itemize
  20345. @item
  20346. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20347. on top of the input labelled "in":
  20348. @example
  20349. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20350. [in] setpts=PTS-STARTPTS [main];
  20351. [main][over] overlay=16:16 [out]
  20352. @end example
  20353. @item
  20354. Read from a video4linux2 device, and overlay it on top of the input
  20355. labelled "in":
  20356. @example
  20357. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20358. [in] setpts=PTS-STARTPTS [main];
  20359. [main][over] overlay=16:16 [out]
  20360. @end example
  20361. @item
  20362. Read the first video stream and the audio stream with id 0x81 from
  20363. dvd.vob; the video is connected to the pad named "video" and the audio is
  20364. connected to the pad named "audio":
  20365. @example
  20366. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20367. @end example
  20368. @end itemize
  20369. @subsection Commands
  20370. Both movie and amovie support the following commands:
  20371. @table @option
  20372. @item seek
  20373. Perform seek using "av_seek_frame".
  20374. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20375. @itemize
  20376. @item
  20377. @var{stream_index}: If stream_index is -1, a default
  20378. stream is selected, and @var{timestamp} is automatically converted
  20379. from AV_TIME_BASE units to the stream specific time_base.
  20380. @item
  20381. @var{timestamp}: Timestamp in AVStream.time_base units
  20382. or, if no stream is specified, in AV_TIME_BASE units.
  20383. @item
  20384. @var{flags}: Flags which select direction and seeking mode.
  20385. @end itemize
  20386. @item get_duration
  20387. Get movie duration in AV_TIME_BASE units.
  20388. @end table
  20389. @c man end MULTIMEDIA SOURCES