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.

26471 lines
702KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @section acue
  505. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  506. filter.
  507. @section adeclick
  508. Remove impulsive noise from input audio.
  509. Samples detected as impulsive noise are replaced by interpolated samples using
  510. autoregressive modelling.
  511. @table @option
  512. @item w
  513. Set window size, in milliseconds. Allowed range is from @code{10} to
  514. @code{100}. Default value is @code{55} milliseconds.
  515. This sets size of window which will be processed at once.
  516. @item o
  517. Set window overlap, in percentage of window size. Allowed range is from
  518. @code{50} to @code{95}. Default value is @code{75} percent.
  519. Setting this to a very high value increases impulsive noise removal but makes
  520. whole process much slower.
  521. @item a
  522. Set autoregression order, in percentage of window size. Allowed range is from
  523. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  524. controls quality of interpolated samples using neighbour good samples.
  525. @item t
  526. Set threshold value. Allowed range is from @code{1} to @code{100}.
  527. Default value is @code{2}.
  528. This controls the strength of impulsive noise which is going to be removed.
  529. The lower value, the more samples will be detected as impulsive noise.
  530. @item b
  531. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  532. @code{10}. Default value is @code{2}.
  533. If any two samples detected as noise are spaced less than this value then any
  534. sample between those two samples will be also detected as noise.
  535. @item m
  536. Set overlap method.
  537. It accepts the following values:
  538. @table @option
  539. @item a
  540. Select overlap-add method. Even not interpolated samples are slightly
  541. changed with this method.
  542. @item s
  543. Select overlap-save method. Not interpolated samples remain unchanged.
  544. @end table
  545. Default value is @code{a}.
  546. @end table
  547. @section adeclip
  548. Remove clipped samples from input audio.
  549. Samples detected as clipped are replaced by interpolated samples using
  550. autoregressive modelling.
  551. @table @option
  552. @item w
  553. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  554. Default value is @code{55} milliseconds.
  555. This sets size of window which will be processed at once.
  556. @item o
  557. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  558. to @code{95}. Default value is @code{75} percent.
  559. @item a
  560. Set autoregression order, in percentage of window size. Allowed range is from
  561. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  562. quality of interpolated samples using neighbour good samples.
  563. @item t
  564. Set threshold value. Allowed range is from @code{1} to @code{100}.
  565. Default value is @code{10}. Higher values make clip detection less aggressive.
  566. @item n
  567. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  568. Default value is @code{1000}. Higher values make clip detection less aggressive.
  569. @item m
  570. Set overlap method.
  571. It accepts the following values:
  572. @table @option
  573. @item a
  574. Select overlap-add method. Even not interpolated samples are slightly changed
  575. with this method.
  576. @item s
  577. Select overlap-save method. Not interpolated samples remain unchanged.
  578. @end table
  579. Default value is @code{a}.
  580. @end table
  581. @section adelay
  582. Delay one or more audio channels.
  583. Samples in delayed channel are filled with silence.
  584. The filter accepts the following option:
  585. @table @option
  586. @item delays
  587. Set list of delays in milliseconds for each channel separated by '|'.
  588. Unused delays will be silently ignored. If number of given delays is
  589. smaller than number of channels all remaining channels will not be delayed.
  590. If you want to delay exact number of samples, append 'S' to number.
  591. If you want instead to delay in seconds, append 's' to number.
  592. @item all
  593. Use last set delay for all remaining channels. By default is disabled.
  594. This option if enabled changes how option @code{delays} is interpreted.
  595. @end table
  596. @subsection Examples
  597. @itemize
  598. @item
  599. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  600. the second channel (and any other channels that may be present) unchanged.
  601. @example
  602. adelay=1500|0|500
  603. @end example
  604. @item
  605. Delay second channel by 500 samples, the third channel by 700 samples and leave
  606. the first channel (and any other channels that may be present) unchanged.
  607. @example
  608. adelay=0|500S|700S
  609. @end example
  610. @item
  611. Delay all channels by same number of samples:
  612. @example
  613. adelay=delays=64S:all=1
  614. @end example
  615. @end itemize
  616. @section adenorm
  617. Remedy denormals in audio by adding extremely low-level noise.
  618. This filter shall be placed before any filter that can produce denormals.
  619. A description of the accepted parameters follows.
  620. @table @option
  621. @item level
  622. Set level of added noise in dB. Default is @code{-351}.
  623. Allowed range is from -451 to -90.
  624. @item type
  625. Set type of added noise.
  626. @table @option
  627. @item dc
  628. Add DC signal.
  629. @item ac
  630. Add AC signal.
  631. @item square
  632. Add square signal.
  633. @item pulse
  634. Add pulse signal.
  635. @end table
  636. Default is @code{dc}.
  637. @end table
  638. @subsection Commands
  639. This filter supports the all above options as @ref{commands}.
  640. @section aderivative, aintegral
  641. Compute derivative/integral of audio stream.
  642. Applying both filters one after another produces original audio.
  643. @section aecho
  644. Apply echoing to the input audio.
  645. Echoes are reflected sound and can occur naturally amongst mountains
  646. (and sometimes large buildings) when talking or shouting; digital echo
  647. effects emulate this behaviour and are often used to help fill out the
  648. sound of a single instrument or vocal. The time difference between the
  649. original signal and the reflection is the @code{delay}, and the
  650. loudness of the reflected signal is the @code{decay}.
  651. Multiple echoes can have different delays and decays.
  652. A description of the accepted parameters follows.
  653. @table @option
  654. @item in_gain
  655. Set input gain of reflected signal. Default is @code{0.6}.
  656. @item out_gain
  657. Set output gain of reflected signal. Default is @code{0.3}.
  658. @item delays
  659. Set list of time intervals in milliseconds between original signal and reflections
  660. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  661. Default is @code{1000}.
  662. @item decays
  663. Set list of loudness of reflected signals separated by '|'.
  664. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  665. Default is @code{0.5}.
  666. @end table
  667. @subsection Examples
  668. @itemize
  669. @item
  670. Make it sound as if there are twice as many instruments as are actually playing:
  671. @example
  672. aecho=0.8:0.88:60:0.4
  673. @end example
  674. @item
  675. If delay is very short, then it sounds like a (metallic) robot playing music:
  676. @example
  677. aecho=0.8:0.88:6:0.4
  678. @end example
  679. @item
  680. A longer delay will sound like an open air concert in the mountains:
  681. @example
  682. aecho=0.8:0.9:1000:0.3
  683. @end example
  684. @item
  685. Same as above but with one more mountain:
  686. @example
  687. aecho=0.8:0.9:1000|1800:0.3|0.25
  688. @end example
  689. @end itemize
  690. @section aemphasis
  691. Audio emphasis filter creates or restores material directly taken from LPs or
  692. emphased CDs with different filter curves. E.g. to store music on vinyl the
  693. signal has to be altered by a filter first to even out the disadvantages of
  694. this recording medium.
  695. Once the material is played back the inverse filter has to be applied to
  696. restore the distortion of the frequency response.
  697. The filter accepts the following options:
  698. @table @option
  699. @item level_in
  700. Set input gain.
  701. @item level_out
  702. Set output gain.
  703. @item mode
  704. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  705. use @code{production} mode. Default is @code{reproduction} mode.
  706. @item type
  707. Set filter type. Selects medium. Can be one of the following:
  708. @table @option
  709. @item col
  710. select Columbia.
  711. @item emi
  712. select EMI.
  713. @item bsi
  714. select BSI (78RPM).
  715. @item riaa
  716. select RIAA.
  717. @item cd
  718. select Compact Disc (CD).
  719. @item 50fm
  720. select 50µs (FM).
  721. @item 75fm
  722. select 75µs (FM).
  723. @item 50kf
  724. select 50µs (FM-KF).
  725. @item 75kf
  726. select 75µs (FM-KF).
  727. @end table
  728. @end table
  729. @subsection Commands
  730. This filter supports the all above options as @ref{commands}.
  731. @section aeval
  732. Modify an audio signal according to the specified expressions.
  733. This filter accepts one or more expressions (one for each channel),
  734. which are evaluated and used to modify a corresponding audio signal.
  735. It accepts the following parameters:
  736. @table @option
  737. @item exprs
  738. Set the '|'-separated expressions list for each separate channel. If
  739. the number of input channels is greater than the number of
  740. expressions, the last specified expression is used for the remaining
  741. output channels.
  742. @item channel_layout, c
  743. Set output channel layout. If not specified, the channel layout is
  744. specified by the number of expressions. If set to @samp{same}, it will
  745. use by default the same input channel layout.
  746. @end table
  747. Each expression in @var{exprs} can contain the following constants and functions:
  748. @table @option
  749. @item ch
  750. channel number of the current expression
  751. @item n
  752. number of the evaluated sample, starting from 0
  753. @item s
  754. sample rate
  755. @item t
  756. time of the evaluated sample expressed in seconds
  757. @item nb_in_channels
  758. @item nb_out_channels
  759. input and output number of channels
  760. @item val(CH)
  761. the value of input channel with number @var{CH}
  762. @end table
  763. Note: this filter is slow. For faster processing you should use a
  764. dedicated filter.
  765. @subsection Examples
  766. @itemize
  767. @item
  768. Half volume:
  769. @example
  770. aeval=val(ch)/2:c=same
  771. @end example
  772. @item
  773. Invert phase of the second channel:
  774. @example
  775. aeval=val(0)|-val(1)
  776. @end example
  777. @end itemize
  778. @anchor{afade}
  779. @section afade
  780. Apply fade-in/out effect to input audio.
  781. A description of the accepted parameters follows.
  782. @table @option
  783. @item type, t
  784. Specify the effect type, can be either @code{in} for fade-in, or
  785. @code{out} for a fade-out effect. Default is @code{in}.
  786. @item start_sample, ss
  787. Specify the number of the start sample for starting to apply the fade
  788. effect. Default is 0.
  789. @item nb_samples, ns
  790. Specify the number of samples for which the fade effect has to last. At
  791. the end of the fade-in effect the output audio will have the same
  792. volume as the input audio, at the end of the fade-out transition
  793. the output audio will be silence. Default is 44100.
  794. @item start_time, st
  795. Specify the start time of the fade effect. Default is 0.
  796. The value must be specified as a time duration; see
  797. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  798. for the accepted syntax.
  799. If set this option is used instead of @var{start_sample}.
  800. @item duration, d
  801. Specify the duration of the fade effect. See
  802. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  803. for the accepted syntax.
  804. At the end of the fade-in effect the output audio will have the same
  805. volume as the input audio, at the end of the fade-out transition
  806. the output audio will be silence.
  807. By default the duration is determined by @var{nb_samples}.
  808. If set this option is used instead of @var{nb_samples}.
  809. @item curve
  810. Set curve for fade transition.
  811. It accepts the following values:
  812. @table @option
  813. @item tri
  814. select triangular, linear slope (default)
  815. @item qsin
  816. select quarter of sine wave
  817. @item hsin
  818. select half of sine wave
  819. @item esin
  820. select exponential sine wave
  821. @item log
  822. select logarithmic
  823. @item ipar
  824. select inverted parabola
  825. @item qua
  826. select quadratic
  827. @item cub
  828. select cubic
  829. @item squ
  830. select square root
  831. @item cbr
  832. select cubic root
  833. @item par
  834. select parabola
  835. @item exp
  836. select exponential
  837. @item iqsin
  838. select inverted quarter of sine wave
  839. @item ihsin
  840. select inverted half of sine wave
  841. @item dese
  842. select double-exponential seat
  843. @item desi
  844. select double-exponential sigmoid
  845. @item losi
  846. select logistic sigmoid
  847. @item sinc
  848. select sine cardinal function
  849. @item isinc
  850. select inverted sine cardinal function
  851. @item nofade
  852. no fade applied
  853. @end table
  854. @end table
  855. @subsection Examples
  856. @itemize
  857. @item
  858. Fade in first 15 seconds of audio:
  859. @example
  860. afade=t=in:ss=0:d=15
  861. @end example
  862. @item
  863. Fade out last 25 seconds of a 900 seconds audio:
  864. @example
  865. afade=t=out:st=875:d=25
  866. @end example
  867. @end itemize
  868. @section afftdn
  869. Denoise audio samples with FFT.
  870. A description of the accepted parameters follows.
  871. @table @option
  872. @item nr
  873. Set the noise reduction in dB, allowed range is 0.01 to 97.
  874. Default value is 12 dB.
  875. @item nf
  876. Set the noise floor in dB, allowed range is -80 to -20.
  877. Default value is -50 dB.
  878. @item nt
  879. Set the noise type.
  880. It accepts the following values:
  881. @table @option
  882. @item w
  883. Select white noise.
  884. @item v
  885. Select vinyl noise.
  886. @item s
  887. Select shellac noise.
  888. @item c
  889. Select custom noise, defined in @code{bn} option.
  890. Default value is white noise.
  891. @end table
  892. @item bn
  893. Set custom band noise for every one of 15 bands.
  894. Bands are separated by ' ' or '|'.
  895. @item rf
  896. Set the residual floor in dB, allowed range is -80 to -20.
  897. Default value is -38 dB.
  898. @item tn
  899. Enable noise tracking. By default is disabled.
  900. With this enabled, noise floor is automatically adjusted.
  901. @item tr
  902. Enable residual tracking. By default is disabled.
  903. @item om
  904. Set the output mode.
  905. It accepts the following values:
  906. @table @option
  907. @item i
  908. Pass input unchanged.
  909. @item o
  910. Pass noise filtered out.
  911. @item n
  912. Pass only noise.
  913. Default value is @var{o}.
  914. @end table
  915. @end table
  916. @subsection Commands
  917. This filter supports the following commands:
  918. @table @option
  919. @item sample_noise, sn
  920. Start or stop measuring noise profile.
  921. Syntax for the command is : "start" or "stop" string.
  922. After measuring noise profile is stopped it will be
  923. automatically applied in filtering.
  924. @item noise_reduction, nr
  925. Change noise reduction. Argument is single float number.
  926. Syntax for the command is : "@var{noise_reduction}"
  927. @item noise_floor, nf
  928. Change noise floor. Argument is single float number.
  929. Syntax for the command is : "@var{noise_floor}"
  930. @item output_mode, om
  931. Change output mode operation.
  932. Syntax for the command is : "i", "o" or "n" string.
  933. @end table
  934. @section afftfilt
  935. Apply arbitrary expressions to samples in frequency domain.
  936. @table @option
  937. @item real
  938. Set frequency domain real expression for each separate channel separated
  939. by '|'. Default is "re".
  940. If the number of input channels is greater than the number of
  941. expressions, the last specified expression is used for the remaining
  942. output channels.
  943. @item imag
  944. Set frequency domain imaginary expression for each separate channel
  945. separated by '|'. Default is "im".
  946. Each expression in @var{real} and @var{imag} can contain the following
  947. constants and functions:
  948. @table @option
  949. @item sr
  950. sample rate
  951. @item b
  952. current frequency bin number
  953. @item nb
  954. number of available bins
  955. @item ch
  956. channel number of the current expression
  957. @item chs
  958. number of channels
  959. @item pts
  960. current frame pts
  961. @item re
  962. current real part of frequency bin of current channel
  963. @item im
  964. current imaginary part of frequency bin of current channel
  965. @item real(b, ch)
  966. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  967. @item imag(b, ch)
  968. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  969. @end table
  970. @item win_size
  971. Set window size. Allowed range is from 16 to 131072.
  972. Default is @code{4096}
  973. @item win_func
  974. Set window function. Default is @code{hann}.
  975. @item overlap
  976. Set window overlap. If set to 1, the recommended overlap for selected
  977. window function will be picked. Default is @code{0.75}.
  978. @end table
  979. @subsection Examples
  980. @itemize
  981. @item
  982. Leave almost only low frequencies in audio:
  983. @example
  984. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  985. @end example
  986. @item
  987. Apply robotize effect:
  988. @example
  989. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  990. @end example
  991. @item
  992. Apply whisper effect:
  993. @example
  994. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  995. @end example
  996. @end itemize
  997. @anchor{afir}
  998. @section afir
  999. Apply an arbitrary Finite Impulse Response filter.
  1000. This filter is designed for applying long FIR filters,
  1001. up to 60 seconds long.
  1002. It can be used as component for digital crossover filters,
  1003. room equalization, cross talk cancellation, wavefield synthesis,
  1004. auralization, ambiophonics, ambisonics and spatialization.
  1005. This filter uses the streams higher than first one as FIR coefficients.
  1006. If the non-first stream holds a single channel, it will be used
  1007. for all input channels in the first stream, otherwise
  1008. the number of channels in the non-first stream must be same as
  1009. the number of channels in the first stream.
  1010. It accepts the following parameters:
  1011. @table @option
  1012. @item dry
  1013. Set dry gain. This sets input gain.
  1014. @item wet
  1015. Set wet gain. This sets final output gain.
  1016. @item length
  1017. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1018. @item gtype
  1019. Enable applying gain measured from power of IR.
  1020. Set which approach to use for auto gain measurement.
  1021. @table @option
  1022. @item none
  1023. Do not apply any gain.
  1024. @item peak
  1025. select peak gain, very conservative approach. This is default value.
  1026. @item dc
  1027. select DC gain, limited application.
  1028. @item gn
  1029. select gain to noise approach, this is most popular one.
  1030. @end table
  1031. @item irgain
  1032. Set gain to be applied to IR coefficients before filtering.
  1033. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1034. @item irfmt
  1035. Set format of IR stream. Can be @code{mono} or @code{input}.
  1036. Default is @code{input}.
  1037. @item maxir
  1038. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1039. Allowed range is 0.1 to 60 seconds.
  1040. @item response
  1041. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1042. By default it is disabled.
  1043. @item channel
  1044. Set for which IR channel to display frequency response. By default is first channel
  1045. displayed. This option is used only when @var{response} is enabled.
  1046. @item size
  1047. Set video stream size. This option is used only when @var{response} is enabled.
  1048. @item rate
  1049. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1050. @item minp
  1051. Set minimal partition size used for convolution. Default is @var{8192}.
  1052. Allowed range is from @var{1} to @var{32768}.
  1053. Lower values decreases latency at cost of higher CPU usage.
  1054. @item maxp
  1055. Set maximal partition size used for convolution. Default is @var{8192}.
  1056. Allowed range is from @var{8} to @var{32768}.
  1057. Lower values may increase CPU usage.
  1058. @item nbirs
  1059. Set number of input impulse responses streams which will be switchable at runtime.
  1060. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1061. @item ir
  1062. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1063. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1064. This option can be changed at runtime via @ref{commands}.
  1065. @end table
  1066. @subsection Examples
  1067. @itemize
  1068. @item
  1069. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1070. @example
  1071. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1072. @end example
  1073. @end itemize
  1074. @anchor{aformat}
  1075. @section aformat
  1076. Set output format constraints for the input audio. The framework will
  1077. negotiate the most appropriate format to minimize conversions.
  1078. It accepts the following parameters:
  1079. @table @option
  1080. @item sample_fmts, f
  1081. A '|'-separated list of requested sample formats.
  1082. @item sample_rates, r
  1083. A '|'-separated list of requested sample rates.
  1084. @item channel_layouts, cl
  1085. A '|'-separated list of requested channel layouts.
  1086. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1087. for the required syntax.
  1088. @end table
  1089. If a parameter is omitted, all values are allowed.
  1090. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1091. @example
  1092. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1093. @end example
  1094. @section afreqshift
  1095. Apply frequency shift to input audio samples.
  1096. The filter accepts the following options:
  1097. @table @option
  1098. @item shift
  1099. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1100. Default value is 0.0.
  1101. @item level
  1102. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1103. Default value is 1.0.
  1104. @end table
  1105. @subsection Commands
  1106. This filter supports the all above options as @ref{commands}.
  1107. @section agate
  1108. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1109. processing reduces disturbing noise between useful signals.
  1110. Gating is done by detecting the volume below a chosen level @var{threshold}
  1111. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1112. floor is set via @var{range}. Because an exact manipulation of the signal
  1113. would cause distortion of the waveform the reduction can be levelled over
  1114. time. This is done by setting @var{attack} and @var{release}.
  1115. @var{attack} determines how long the signal has to fall below the threshold
  1116. before any reduction will occur and @var{release} sets the time the signal
  1117. has to rise above the threshold to reduce the reduction again.
  1118. Shorter signals than the chosen attack time will be left untouched.
  1119. @table @option
  1120. @item level_in
  1121. Set input level before filtering.
  1122. Default is 1. Allowed range is from 0.015625 to 64.
  1123. @item mode
  1124. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1125. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1126. will be amplified, expanding dynamic range in upward direction.
  1127. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1128. @item range
  1129. Set the level of gain reduction when the signal is below the threshold.
  1130. Default is 0.06125. Allowed range is from 0 to 1.
  1131. Setting this to 0 disables reduction and then filter behaves like expander.
  1132. @item threshold
  1133. If a signal rises above this level the gain reduction is released.
  1134. Default is 0.125. Allowed range is from 0 to 1.
  1135. @item ratio
  1136. Set a ratio by which the signal is reduced.
  1137. Default is 2. Allowed range is from 1 to 9000.
  1138. @item attack
  1139. Amount of milliseconds the signal has to rise above the threshold before gain
  1140. reduction stops.
  1141. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1142. @item release
  1143. Amount of milliseconds the signal has to fall below the threshold before the
  1144. reduction is increased again. Default is 250 milliseconds.
  1145. Allowed range is from 0.01 to 9000.
  1146. @item makeup
  1147. Set amount of amplification of signal after processing.
  1148. Default is 1. Allowed range is from 1 to 64.
  1149. @item knee
  1150. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1151. Default is 2.828427125. Allowed range is from 1 to 8.
  1152. @item detection
  1153. Choose if exact signal should be taken for detection or an RMS like one.
  1154. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1155. @item link
  1156. Choose if the average level between all channels or the louder channel affects
  1157. the reduction.
  1158. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1159. @end table
  1160. @subsection Commands
  1161. This filter supports the all above options as @ref{commands}.
  1162. @section aiir
  1163. Apply an arbitrary Infinite Impulse Response filter.
  1164. It accepts the following parameters:
  1165. @table @option
  1166. @item zeros, z
  1167. Set B/numerator/zeros/reflection coefficients.
  1168. @item poles, p
  1169. Set A/denominator/poles/ladder coefficients.
  1170. @item gains, k
  1171. Set channels gains.
  1172. @item dry_gain
  1173. Set input gain.
  1174. @item wet_gain
  1175. Set output gain.
  1176. @item format, f
  1177. Set coefficients format.
  1178. @table @samp
  1179. @item ll
  1180. lattice-ladder function
  1181. @item sf
  1182. analog transfer function
  1183. @item tf
  1184. digital transfer function
  1185. @item zp
  1186. Z-plane zeros/poles, cartesian (default)
  1187. @item pr
  1188. Z-plane zeros/poles, polar radians
  1189. @item pd
  1190. Z-plane zeros/poles, polar degrees
  1191. @item sp
  1192. S-plane zeros/poles
  1193. @end table
  1194. @item process, r
  1195. Set type of processing.
  1196. @table @samp
  1197. @item d
  1198. direct processing
  1199. @item s
  1200. serial processing
  1201. @item p
  1202. parallel processing
  1203. @end table
  1204. @item precision, e
  1205. Set filtering precision.
  1206. @table @samp
  1207. @item dbl
  1208. double-precision floating-point (default)
  1209. @item flt
  1210. single-precision floating-point
  1211. @item i32
  1212. 32-bit integers
  1213. @item i16
  1214. 16-bit integers
  1215. @end table
  1216. @item normalize, n
  1217. Normalize filter coefficients, by default is enabled.
  1218. Enabling it will normalize magnitude response at DC to 0dB.
  1219. @item mix
  1220. How much to use filtered signal in output. Default is 1.
  1221. Range is between 0 and 1.
  1222. @item response
  1223. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1224. By default it is disabled.
  1225. @item channel
  1226. Set for which IR channel to display frequency response. By default is first channel
  1227. displayed. This option is used only when @var{response} is enabled.
  1228. @item size
  1229. Set video stream size. This option is used only when @var{response} is enabled.
  1230. @end table
  1231. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1232. order.
  1233. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1234. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1235. imaginary unit.
  1236. Different coefficients and gains can be provided for every channel, in such case
  1237. use '|' to separate coefficients or gains. Last provided coefficients will be
  1238. used for all remaining channels.
  1239. @subsection Examples
  1240. @itemize
  1241. @item
  1242. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1243. @example
  1244. 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
  1245. @end example
  1246. @item
  1247. Same as above but in @code{zp} format:
  1248. @example
  1249. 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
  1250. @end example
  1251. @item
  1252. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1253. @example
  1254. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1255. @end example
  1256. @end itemize
  1257. @section alimiter
  1258. The limiter prevents an input signal from rising over a desired threshold.
  1259. This limiter uses lookahead technology to prevent your signal from distorting.
  1260. It means that there is a small delay after the signal is processed. Keep in mind
  1261. that the delay it produces is the attack time you set.
  1262. The filter accepts the following options:
  1263. @table @option
  1264. @item level_in
  1265. Set input gain. Default is 1.
  1266. @item level_out
  1267. Set output gain. Default is 1.
  1268. @item limit
  1269. Don't let signals above this level pass the limiter. Default is 1.
  1270. @item attack
  1271. The limiter will reach its attenuation level in this amount of time in
  1272. milliseconds. Default is 5 milliseconds.
  1273. @item release
  1274. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1275. Default is 50 milliseconds.
  1276. @item asc
  1277. When gain reduction is always needed ASC takes care of releasing to an
  1278. average reduction level rather than reaching a reduction of 0 in the release
  1279. time.
  1280. @item asc_level
  1281. Select how much the release time is affected by ASC, 0 means nearly no changes
  1282. in release time while 1 produces higher release times.
  1283. @item level
  1284. Auto level output signal. Default is enabled.
  1285. This normalizes audio back to 0dB if enabled.
  1286. @end table
  1287. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1288. with @ref{aresample} before applying this filter.
  1289. @section allpass
  1290. Apply a two-pole all-pass filter with central frequency (in Hz)
  1291. @var{frequency}, and filter-width @var{width}.
  1292. An all-pass filter changes the audio's frequency to phase relationship
  1293. without changing its frequency to amplitude relationship.
  1294. The filter accepts the following options:
  1295. @table @option
  1296. @item frequency, f
  1297. Set frequency in Hz.
  1298. @item width_type, t
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @item k
  1310. kHz
  1311. @end table
  1312. @item width, w
  1313. Specify the band-width of a filter in width_type units.
  1314. @item mix, m
  1315. How much to use filtered signal in output. Default is 1.
  1316. Range is between 0 and 1.
  1317. @item channels, c
  1318. Specify which channels to filter, by default all available are filtered.
  1319. @item normalize, n
  1320. Normalize biquad coefficients, by default is disabled.
  1321. Enabling it will normalize magnitude response at DC to 0dB.
  1322. @item order, o
  1323. Set the filter order, can be 1 or 2. Default is 2.
  1324. @item transform, a
  1325. Set transform type of IIR filter.
  1326. @table @option
  1327. @item di
  1328. @item dii
  1329. @item tdii
  1330. @item latt
  1331. @end table
  1332. @item precision, r
  1333. Set precison of filtering.
  1334. @table @option
  1335. @item auto
  1336. Pick automatic sample format depending on surround filters.
  1337. @item s16
  1338. Always use signed 16-bit.
  1339. @item s32
  1340. Always use signed 32-bit.
  1341. @item f32
  1342. Always use float 32-bit.
  1343. @item f64
  1344. Always use float 64-bit.
  1345. @end table
  1346. @end table
  1347. @subsection Commands
  1348. This filter supports the following commands:
  1349. @table @option
  1350. @item frequency, f
  1351. Change allpass frequency.
  1352. Syntax for the command is : "@var{frequency}"
  1353. @item width_type, t
  1354. Change allpass width_type.
  1355. Syntax for the command is : "@var{width_type}"
  1356. @item width, w
  1357. Change allpass width.
  1358. Syntax for the command is : "@var{width}"
  1359. @item mix, m
  1360. Change allpass mix.
  1361. Syntax for the command is : "@var{mix}"
  1362. @end table
  1363. @section aloop
  1364. Loop audio samples.
  1365. The filter accepts the following options:
  1366. @table @option
  1367. @item loop
  1368. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1369. Default is 0.
  1370. @item size
  1371. Set maximal number of samples. Default is 0.
  1372. @item start
  1373. Set first sample of loop. Default is 0.
  1374. @end table
  1375. @anchor{amerge}
  1376. @section amerge
  1377. Merge two or more audio streams into a single multi-channel stream.
  1378. The filter accepts the following options:
  1379. @table @option
  1380. @item inputs
  1381. Set the number of inputs. Default is 2.
  1382. @end table
  1383. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1384. the channel layout of the output will be set accordingly and the channels
  1385. will be reordered as necessary. If the channel layouts of the inputs are not
  1386. disjoint, the output will have all the channels of the first input then all
  1387. the channels of the second input, in that order, and the channel layout of
  1388. the output will be the default value corresponding to the total number of
  1389. channels.
  1390. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1391. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1392. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1393. first input, b1 is the first channel of the second input).
  1394. On the other hand, if both input are in stereo, the output channels will be
  1395. in the default order: a1, a2, b1, b2, and the channel layout will be
  1396. arbitrarily set to 4.0, which may or may not be the expected value.
  1397. All inputs must have the same sample rate, and format.
  1398. If inputs do not have the same duration, the output will stop with the
  1399. shortest.
  1400. @subsection Examples
  1401. @itemize
  1402. @item
  1403. Merge two mono files into a stereo stream:
  1404. @example
  1405. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1406. @end example
  1407. @item
  1408. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1409. @example
  1410. 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
  1411. @end example
  1412. @end itemize
  1413. @section amix
  1414. Mixes multiple audio inputs into a single output.
  1415. Note that this filter only supports float samples (the @var{amerge}
  1416. and @var{pan} audio filters support many formats). If the @var{amix}
  1417. input has integer samples then @ref{aresample} will be automatically
  1418. inserted to perform the conversion to float samples.
  1419. For example
  1420. @example
  1421. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1422. @end example
  1423. will mix 3 input audio streams to a single output with the same duration as the
  1424. first input and a dropout transition time of 3 seconds.
  1425. It accepts the following parameters:
  1426. @table @option
  1427. @item inputs
  1428. The number of inputs. If unspecified, it defaults to 2.
  1429. @item duration
  1430. How to determine the end-of-stream.
  1431. @table @option
  1432. @item longest
  1433. The duration of the longest input. (default)
  1434. @item shortest
  1435. The duration of the shortest input.
  1436. @item first
  1437. The duration of the first input.
  1438. @end table
  1439. @item dropout_transition
  1440. The transition time, in seconds, for volume renormalization when an input
  1441. stream ends. The default value is 2 seconds.
  1442. @item weights
  1443. Specify weight of each input audio stream as sequence.
  1444. Each weight is separated by space. By default all inputs have same weight.
  1445. @end table
  1446. @subsection Commands
  1447. This filter supports the following commands:
  1448. @table @option
  1449. @item weights
  1450. Syntax is same as option with same name.
  1451. @end table
  1452. @section amultiply
  1453. Multiply first audio stream with second audio stream and store result
  1454. in output audio stream. Multiplication is done by multiplying each
  1455. sample from first stream with sample at same position from second stream.
  1456. With this element-wise multiplication one can create amplitude fades and
  1457. amplitude modulations.
  1458. @section anequalizer
  1459. High-order parametric multiband equalizer for each channel.
  1460. It accepts the following parameters:
  1461. @table @option
  1462. @item params
  1463. This option string is in format:
  1464. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1465. Each equalizer band is separated by '|'.
  1466. @table @option
  1467. @item chn
  1468. Set channel number to which equalization will be applied.
  1469. If input doesn't have that channel the entry is ignored.
  1470. @item f
  1471. Set central frequency for band.
  1472. If input doesn't have that frequency the entry is ignored.
  1473. @item w
  1474. Set band width in Hertz.
  1475. @item g
  1476. Set band gain in dB.
  1477. @item t
  1478. Set filter type for band, optional, can be:
  1479. @table @samp
  1480. @item 0
  1481. Butterworth, this is default.
  1482. @item 1
  1483. Chebyshev type 1.
  1484. @item 2
  1485. Chebyshev type 2.
  1486. @end table
  1487. @end table
  1488. @item curves
  1489. With this option activated frequency response of anequalizer is displayed
  1490. in video stream.
  1491. @item size
  1492. Set video stream size. Only useful if curves option is activated.
  1493. @item mgain
  1494. Set max gain that will be displayed. Only useful if curves option is activated.
  1495. Setting this to a reasonable value makes it possible to display gain which is derived from
  1496. neighbour bands which are too close to each other and thus produce higher gain
  1497. when both are activated.
  1498. @item fscale
  1499. Set frequency scale used to draw frequency response in video output.
  1500. Can be linear or logarithmic. Default is logarithmic.
  1501. @item colors
  1502. Set color for each channel curve which is going to be displayed in video stream.
  1503. This is list of color names separated by space or by '|'.
  1504. Unrecognised or missing colors will be replaced by white color.
  1505. @end table
  1506. @subsection Examples
  1507. @itemize
  1508. @item
  1509. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1510. for first 2 channels using Chebyshev type 1 filter:
  1511. @example
  1512. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1513. @end example
  1514. @end itemize
  1515. @subsection Commands
  1516. This filter supports the following commands:
  1517. @table @option
  1518. @item change
  1519. Alter existing filter parameters.
  1520. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1521. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1522. error is returned.
  1523. @var{freq} set new frequency parameter.
  1524. @var{width} set new width parameter in Hertz.
  1525. @var{gain} set new gain parameter in dB.
  1526. Full filter invocation with asendcmd may look like this:
  1527. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1528. @end table
  1529. @section anlmdn
  1530. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1531. Each sample is adjusted by looking for other samples with similar contexts. This
  1532. context similarity is defined by comparing their surrounding patches of size
  1533. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1534. The filter accepts the following options:
  1535. @table @option
  1536. @item s
  1537. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1538. @item p
  1539. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1540. Default value is 2 milliseconds.
  1541. @item r
  1542. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1543. Default value is 6 milliseconds.
  1544. @item o
  1545. Set the output mode.
  1546. It accepts the following values:
  1547. @table @option
  1548. @item i
  1549. Pass input unchanged.
  1550. @item o
  1551. Pass noise filtered out.
  1552. @item n
  1553. Pass only noise.
  1554. Default value is @var{o}.
  1555. @end table
  1556. @item m
  1557. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1558. @end table
  1559. @subsection Commands
  1560. This filter supports the all above options as @ref{commands}.
  1561. @section anlms
  1562. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1563. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1564. relate to producing the least mean square of the error signal (difference between the desired,
  1565. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1566. A description of the accepted options follows.
  1567. @table @option
  1568. @item order
  1569. Set filter order.
  1570. @item mu
  1571. Set filter mu.
  1572. @item eps
  1573. Set the filter eps.
  1574. @item leakage
  1575. Set the filter leakage.
  1576. @item out_mode
  1577. It accepts the following values:
  1578. @table @option
  1579. @item i
  1580. Pass the 1st input.
  1581. @item d
  1582. Pass the 2nd input.
  1583. @item o
  1584. Pass filtered samples.
  1585. @item n
  1586. Pass difference between desired and filtered samples.
  1587. Default value is @var{o}.
  1588. @end table
  1589. @end table
  1590. @subsection Examples
  1591. @itemize
  1592. @item
  1593. One of many usages of this filter is noise reduction, input audio is filtered
  1594. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1595. @example
  1596. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1597. @end example
  1598. @end itemize
  1599. @subsection Commands
  1600. This filter supports the same commands as options, excluding option @code{order}.
  1601. @section anull
  1602. Pass the audio source unchanged to the output.
  1603. @section apad
  1604. Pad the end of an audio stream with silence.
  1605. This can be used together with @command{ffmpeg} @option{-shortest} to
  1606. extend audio streams to the same length as the video stream.
  1607. A description of the accepted options follows.
  1608. @table @option
  1609. @item packet_size
  1610. Set silence packet size. Default value is 4096.
  1611. @item pad_len
  1612. Set the number of samples of silence to add to the end. After the
  1613. value is reached, the stream is terminated. This option is mutually
  1614. exclusive with @option{whole_len}.
  1615. @item whole_len
  1616. Set the minimum total number of samples in the output audio stream. If
  1617. the value is longer than the input audio length, silence is added to
  1618. the end, until the value is reached. This option is mutually exclusive
  1619. with @option{pad_len}.
  1620. @item pad_dur
  1621. Specify the duration of samples of silence to add. See
  1622. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1623. for the accepted syntax. Used only if set to non-zero value.
  1624. @item whole_dur
  1625. Specify the minimum total duration in the output audio stream. See
  1626. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1627. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1628. the input audio length, silence is added to the end, until the value is reached.
  1629. This option is mutually exclusive with @option{pad_dur}
  1630. @end table
  1631. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1632. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1633. the input stream indefinitely.
  1634. @subsection Examples
  1635. @itemize
  1636. @item
  1637. Add 1024 samples of silence to the end of the input:
  1638. @example
  1639. apad=pad_len=1024
  1640. @end example
  1641. @item
  1642. Make sure the audio output will contain at least 10000 samples, pad
  1643. the input with silence if required:
  1644. @example
  1645. apad=whole_len=10000
  1646. @end example
  1647. @item
  1648. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1649. video stream will always result the shortest and will be converted
  1650. until the end in the output file when using the @option{shortest}
  1651. option:
  1652. @example
  1653. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1654. @end example
  1655. @end itemize
  1656. @section aphaser
  1657. Add a phasing effect to the input audio.
  1658. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1659. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1660. A description of the accepted parameters follows.
  1661. @table @option
  1662. @item in_gain
  1663. Set input gain. Default is 0.4.
  1664. @item out_gain
  1665. Set output gain. Default is 0.74
  1666. @item delay
  1667. Set delay in milliseconds. Default is 3.0.
  1668. @item decay
  1669. Set decay. Default is 0.4.
  1670. @item speed
  1671. Set modulation speed in Hz. Default is 0.5.
  1672. @item type
  1673. Set modulation type. Default is triangular.
  1674. It accepts the following values:
  1675. @table @samp
  1676. @item triangular, t
  1677. @item sinusoidal, s
  1678. @end table
  1679. @end table
  1680. @section aphaseshift
  1681. Apply phase shift to input audio samples.
  1682. The filter accepts the following options:
  1683. @table @option
  1684. @item shift
  1685. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1686. Default value is 0.0.
  1687. @item level
  1688. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1689. Default value is 1.0.
  1690. @end table
  1691. @subsection Commands
  1692. This filter supports the all above options as @ref{commands}.
  1693. @section apulsator
  1694. Audio pulsator is something between an autopanner and a tremolo.
  1695. But it can produce funny stereo effects as well. Pulsator changes the volume
  1696. of the left and right channel based on a LFO (low frequency oscillator) with
  1697. different waveforms and shifted phases.
  1698. This filter have the ability to define an offset between left and right
  1699. channel. An offset of 0 means that both LFO shapes match each other.
  1700. The left and right channel are altered equally - a conventional tremolo.
  1701. An offset of 50% means that the shape of the right channel is exactly shifted
  1702. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1703. an autopanner. At 1 both curves match again. Every setting in between moves the
  1704. phase shift gapless between all stages and produces some "bypassing" sounds with
  1705. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1706. the 0.5) the faster the signal passes from the left to the right speaker.
  1707. The filter accepts the following options:
  1708. @table @option
  1709. @item level_in
  1710. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1711. @item level_out
  1712. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1713. @item mode
  1714. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1715. sawup or sawdown. Default is sine.
  1716. @item amount
  1717. Set modulation. Define how much of original signal is affected by the LFO.
  1718. @item offset_l
  1719. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1720. @item offset_r
  1721. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1722. @item width
  1723. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1724. @item timing
  1725. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1726. @item bpm
  1727. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1728. is set to bpm.
  1729. @item ms
  1730. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1731. is set to ms.
  1732. @item hz
  1733. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1734. if timing is set to hz.
  1735. @end table
  1736. @anchor{aresample}
  1737. @section aresample
  1738. Resample the input audio to the specified parameters, using the
  1739. libswresample library. If none are specified then the filter will
  1740. automatically convert between its input and output.
  1741. This filter is also able to stretch/squeeze the audio data to make it match
  1742. the timestamps or to inject silence / cut out audio to make it match the
  1743. timestamps, do a combination of both or do neither.
  1744. The filter accepts the syntax
  1745. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1746. expresses a sample rate and @var{resampler_options} is a list of
  1747. @var{key}=@var{value} pairs, separated by ":". See the
  1748. @ref{Resampler Options,,"Resampler Options" section in the
  1749. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1750. for the complete list of supported options.
  1751. @subsection Examples
  1752. @itemize
  1753. @item
  1754. Resample the input audio to 44100Hz:
  1755. @example
  1756. aresample=44100
  1757. @end example
  1758. @item
  1759. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1760. samples per second compensation:
  1761. @example
  1762. aresample=async=1000
  1763. @end example
  1764. @end itemize
  1765. @section areverse
  1766. Reverse an audio clip.
  1767. Warning: This filter requires memory to buffer the entire clip, so trimming
  1768. is suggested.
  1769. @subsection Examples
  1770. @itemize
  1771. @item
  1772. Take the first 5 seconds of a clip, and reverse it.
  1773. @example
  1774. atrim=end=5,areverse
  1775. @end example
  1776. @end itemize
  1777. @section arnndn
  1778. Reduce noise from speech using Recurrent Neural Networks.
  1779. This filter accepts the following options:
  1780. @table @option
  1781. @item model, m
  1782. Set train model file to load. This option is always required.
  1783. @item mix
  1784. Set how much to mix filtered samples into final output.
  1785. Allowed range is from -1 to 1. Default value is 1.
  1786. Negative values are special, they set how much to keep filtered noise
  1787. in the final filter output. Set this option to -1 to hear actual
  1788. noise removed from input signal.
  1789. @end table
  1790. @section asetnsamples
  1791. Set the number of samples per each output audio frame.
  1792. The last output packet may contain a different number of samples, as
  1793. the filter will flush all the remaining samples when the input audio
  1794. signals its end.
  1795. The filter accepts the following options:
  1796. @table @option
  1797. @item nb_out_samples, n
  1798. Set the number of frames per each output audio frame. The number is
  1799. intended as the number of samples @emph{per each channel}.
  1800. Default value is 1024.
  1801. @item pad, p
  1802. If set to 1, the filter will pad the last audio frame with zeroes, so
  1803. that the last frame will contain the same number of samples as the
  1804. previous ones. Default value is 1.
  1805. @end table
  1806. For example, to set the number of per-frame samples to 1234 and
  1807. disable padding for the last frame, use:
  1808. @example
  1809. asetnsamples=n=1234:p=0
  1810. @end example
  1811. @section asetrate
  1812. Set the sample rate without altering the PCM data.
  1813. This will result in a change of speed and pitch.
  1814. The filter accepts the following options:
  1815. @table @option
  1816. @item sample_rate, r
  1817. Set the output sample rate. Default is 44100 Hz.
  1818. @end table
  1819. @section ashowinfo
  1820. Show a line containing various information for each input audio frame.
  1821. The input audio is not modified.
  1822. The shown line contains a sequence of key/value pairs of the form
  1823. @var{key}:@var{value}.
  1824. The following values are shown in the output:
  1825. @table @option
  1826. @item n
  1827. The (sequential) number of the input frame, starting from 0.
  1828. @item pts
  1829. The presentation timestamp of the input frame, in time base units; the time base
  1830. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1831. @item pts_time
  1832. The presentation timestamp of the input frame in seconds.
  1833. @item pos
  1834. position of the frame in the input stream, -1 if this information in
  1835. unavailable and/or meaningless (for example in case of synthetic audio)
  1836. @item fmt
  1837. The sample format.
  1838. @item chlayout
  1839. The channel layout.
  1840. @item rate
  1841. The sample rate for the audio frame.
  1842. @item nb_samples
  1843. The number of samples (per channel) in the frame.
  1844. @item checksum
  1845. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1846. audio, the data is treated as if all the planes were concatenated.
  1847. @item plane_checksums
  1848. A list of Adler-32 checksums for each data plane.
  1849. @end table
  1850. @section asoftclip
  1851. Apply audio soft clipping.
  1852. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1853. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1854. This filter accepts the following options:
  1855. @table @option
  1856. @item type
  1857. Set type of soft-clipping.
  1858. It accepts the following values:
  1859. @table @option
  1860. @item hard
  1861. @item tanh
  1862. @item atan
  1863. @item cubic
  1864. @item exp
  1865. @item alg
  1866. @item quintic
  1867. @item sin
  1868. @item erf
  1869. @end table
  1870. @item param
  1871. Set additional parameter which controls sigmoid function.
  1872. @item oversample
  1873. Set oversampling factor.
  1874. @end table
  1875. @subsection Commands
  1876. This filter supports the all above options as @ref{commands}.
  1877. @section asr
  1878. Automatic Speech Recognition
  1879. This filter uses PocketSphinx for speech recognition. To enable
  1880. compilation of this filter, you need to configure FFmpeg with
  1881. @code{--enable-pocketsphinx}.
  1882. It accepts the following options:
  1883. @table @option
  1884. @item rate
  1885. Set sampling rate of input audio. Defaults is @code{16000}.
  1886. This need to match speech models, otherwise one will get poor results.
  1887. @item hmm
  1888. Set dictionary containing acoustic model files.
  1889. @item dict
  1890. Set pronunciation dictionary.
  1891. @item lm
  1892. Set language model file.
  1893. @item lmctl
  1894. Set language model set.
  1895. @item lmname
  1896. Set which language model to use.
  1897. @item logfn
  1898. Set output for log messages.
  1899. @end table
  1900. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1901. @anchor{astats}
  1902. @section astats
  1903. Display time domain statistical information about the audio channels.
  1904. Statistics are calculated and displayed for each audio channel and,
  1905. where applicable, an overall figure is also given.
  1906. It accepts the following option:
  1907. @table @option
  1908. @item length
  1909. Short window length in seconds, used for peak and trough RMS measurement.
  1910. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1911. @item metadata
  1912. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1913. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1914. disabled.
  1915. Available keys for each channel are:
  1916. DC_offset
  1917. Min_level
  1918. Max_level
  1919. Min_difference
  1920. Max_difference
  1921. Mean_difference
  1922. RMS_difference
  1923. Peak_level
  1924. RMS_peak
  1925. RMS_trough
  1926. Crest_factor
  1927. Flat_factor
  1928. Peak_count
  1929. Noise_floor
  1930. Noise_floor_count
  1931. Bit_depth
  1932. Dynamic_range
  1933. Zero_crossings
  1934. Zero_crossings_rate
  1935. Number_of_NaNs
  1936. Number_of_Infs
  1937. Number_of_denormals
  1938. and for Overall:
  1939. DC_offset
  1940. Min_level
  1941. Max_level
  1942. Min_difference
  1943. Max_difference
  1944. Mean_difference
  1945. RMS_difference
  1946. Peak_level
  1947. RMS_level
  1948. RMS_peak
  1949. RMS_trough
  1950. Flat_factor
  1951. Peak_count
  1952. Noise_floor
  1953. Noise_floor_count
  1954. Bit_depth
  1955. Number_of_samples
  1956. Number_of_NaNs
  1957. Number_of_Infs
  1958. Number_of_denormals
  1959. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1960. this @code{lavfi.astats.Overall.Peak_count}.
  1961. For description what each key means read below.
  1962. @item reset
  1963. Set number of frame after which stats are going to be recalculated.
  1964. Default is disabled.
  1965. @item measure_perchannel
  1966. Select the entries which need to be measured per channel. The metadata keys can
  1967. be used as flags, default is @option{all} which measures everything.
  1968. @option{none} disables all per channel measurement.
  1969. @item measure_overall
  1970. Select the entries which need to be measured overall. The metadata keys can
  1971. be used as flags, default is @option{all} which measures everything.
  1972. @option{none} disables all overall measurement.
  1973. @end table
  1974. A description of each shown parameter follows:
  1975. @table @option
  1976. @item DC offset
  1977. Mean amplitude displacement from zero.
  1978. @item Min level
  1979. Minimal sample level.
  1980. @item Max level
  1981. Maximal sample level.
  1982. @item Min difference
  1983. Minimal difference between two consecutive samples.
  1984. @item Max difference
  1985. Maximal difference between two consecutive samples.
  1986. @item Mean difference
  1987. Mean difference between two consecutive samples.
  1988. The average of each difference between two consecutive samples.
  1989. @item RMS difference
  1990. Root Mean Square difference between two consecutive samples.
  1991. @item Peak level dB
  1992. @item RMS level dB
  1993. Standard peak and RMS level measured in dBFS.
  1994. @item RMS peak dB
  1995. @item RMS trough dB
  1996. Peak and trough values for RMS level measured over a short window.
  1997. @item Crest factor
  1998. Standard ratio of peak to RMS level (note: not in dB).
  1999. @item Flat factor
  2000. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2001. (i.e. either @var{Min level} or @var{Max level}).
  2002. @item Peak count
  2003. Number of occasions (not the number of samples) that the signal attained either
  2004. @var{Min level} or @var{Max level}.
  2005. @item Noise floor dB
  2006. Minimum local peak measured in dBFS over a short window.
  2007. @item Noise floor count
  2008. Number of occasions (not the number of samples) that the signal attained
  2009. @var{Noise floor}.
  2010. @item Bit depth
  2011. Overall bit depth of audio. Number of bits used for each sample.
  2012. @item Dynamic range
  2013. Measured dynamic range of audio in dB.
  2014. @item Zero crossings
  2015. Number of points where the waveform crosses the zero level axis.
  2016. @item Zero crossings rate
  2017. Rate of Zero crossings and number of audio samples.
  2018. @end table
  2019. @section asubboost
  2020. Boost subwoofer frequencies.
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item dry
  2024. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2025. Default value is 0.7.
  2026. @item wet
  2027. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2028. Default value is 0.7.
  2029. @item decay
  2030. Set delay line decay gain value. Allowed range is from 0 to 1.
  2031. Default value is 0.7.
  2032. @item feedback
  2033. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2034. Default value is 0.9.
  2035. @item cutoff
  2036. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2037. Default value is 100.
  2038. @item slope
  2039. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2040. Default value is 0.5.
  2041. @item delay
  2042. Set delay. Allowed range is from 1 to 100.
  2043. Default value is 20.
  2044. @end table
  2045. @subsection Commands
  2046. This filter supports the all above options as @ref{commands}.
  2047. @section asubcut
  2048. Cut subwoofer frequencies.
  2049. This filter allows to set custom, steeper
  2050. roll off than highpass filter, and thus is able to more attenuate
  2051. frequency content in stop-band.
  2052. The filter accepts the following options:
  2053. @table @option
  2054. @item cutoff
  2055. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2056. Default value is 20.
  2057. @item order
  2058. Set filter order. Available values are from 3 to 20.
  2059. Default value is 10.
  2060. @item level
  2061. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2062. @end table
  2063. @subsection Commands
  2064. This filter supports the all above options as @ref{commands}.
  2065. @section asupercut
  2066. Cut super frequencies.
  2067. The filter accepts the following options:
  2068. @table @option
  2069. @item cutoff
  2070. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2071. Default value is 20000.
  2072. @item order
  2073. Set filter order. Available values are from 3 to 20.
  2074. Default value is 10.
  2075. @item level
  2076. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2077. @end table
  2078. @subsection Commands
  2079. This filter supports the all above options as @ref{commands}.
  2080. @section atempo
  2081. Adjust audio tempo.
  2082. The filter accepts exactly one parameter, the audio tempo. If not
  2083. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2084. be in the [0.5, 100.0] range.
  2085. Note that tempo greater than 2 will skip some samples rather than
  2086. blend them in. If for any reason this is a concern it is always
  2087. possible to daisy-chain several instances of atempo to achieve the
  2088. desired product tempo.
  2089. @subsection Examples
  2090. @itemize
  2091. @item
  2092. Slow down audio to 80% tempo:
  2093. @example
  2094. atempo=0.8
  2095. @end example
  2096. @item
  2097. To speed up audio to 300% tempo:
  2098. @example
  2099. atempo=3
  2100. @end example
  2101. @item
  2102. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2103. @example
  2104. atempo=sqrt(3),atempo=sqrt(3)
  2105. @end example
  2106. @end itemize
  2107. @subsection Commands
  2108. This filter supports the following commands:
  2109. @table @option
  2110. @item tempo
  2111. Change filter tempo scale factor.
  2112. Syntax for the command is : "@var{tempo}"
  2113. @end table
  2114. @section atrim
  2115. Trim the input so that the output contains one continuous subpart of the input.
  2116. It accepts the following parameters:
  2117. @table @option
  2118. @item start
  2119. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2120. sample with the timestamp @var{start} will be the first sample in the output.
  2121. @item end
  2122. Specify time of the first audio sample that will be dropped, i.e. the
  2123. audio sample immediately preceding the one with the timestamp @var{end} will be
  2124. the last sample in the output.
  2125. @item start_pts
  2126. Same as @var{start}, except this option sets the start timestamp in samples
  2127. instead of seconds.
  2128. @item end_pts
  2129. Same as @var{end}, except this option sets the end timestamp in samples instead
  2130. of seconds.
  2131. @item duration
  2132. The maximum duration of the output in seconds.
  2133. @item start_sample
  2134. The number of the first sample that should be output.
  2135. @item end_sample
  2136. The number of the first sample that should be dropped.
  2137. @end table
  2138. @option{start}, @option{end}, and @option{duration} are expressed as time
  2139. duration specifications; see
  2140. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2141. Note that the first two sets of the start/end options and the @option{duration}
  2142. option look at the frame timestamp, while the _sample options simply count the
  2143. samples that pass through the filter. So start/end_pts and start/end_sample will
  2144. give different results when the timestamps are wrong, inexact or do not start at
  2145. zero. Also note that this filter does not modify the timestamps. If you wish
  2146. to have the output timestamps start at zero, insert the asetpts filter after the
  2147. atrim filter.
  2148. If multiple start or end options are set, this filter tries to be greedy and
  2149. keep all samples that match at least one of the specified constraints. To keep
  2150. only the part that matches all the constraints at once, chain multiple atrim
  2151. filters.
  2152. The defaults are such that all the input is kept. So it is possible to set e.g.
  2153. just the end values to keep everything before the specified time.
  2154. Examples:
  2155. @itemize
  2156. @item
  2157. Drop everything except the second minute of input:
  2158. @example
  2159. ffmpeg -i INPUT -af atrim=60:120
  2160. @end example
  2161. @item
  2162. Keep only the first 1000 samples:
  2163. @example
  2164. ffmpeg -i INPUT -af atrim=end_sample=1000
  2165. @end example
  2166. @end itemize
  2167. @section axcorrelate
  2168. Calculate normalized cross-correlation between two input audio streams.
  2169. Resulted samples are always between -1 and 1 inclusive.
  2170. If result is 1 it means two input samples are highly correlated in that selected segment.
  2171. Result 0 means they are not correlated at all.
  2172. If result is -1 it means two input samples are out of phase, which means they cancel each
  2173. other.
  2174. The filter accepts the following options:
  2175. @table @option
  2176. @item size
  2177. Set size of segment over which cross-correlation is calculated.
  2178. Default is 256. Allowed range is from 2 to 131072.
  2179. @item algo
  2180. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2181. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2182. are always zero and thus need much less calculations to make.
  2183. This is generally not true, but is valid for typical audio streams.
  2184. @end table
  2185. @subsection Examples
  2186. @itemize
  2187. @item
  2188. Calculate correlation between channels in stereo audio stream:
  2189. @example
  2190. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2191. @end example
  2192. @end itemize
  2193. @section bandpass
  2194. Apply a two-pole Butterworth band-pass filter with central
  2195. frequency @var{frequency}, and (3dB-point) band-width width.
  2196. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2197. instead of the default: constant 0dB peak gain.
  2198. The filter roll off at 6dB per octave (20dB per decade).
  2199. The filter accepts the following options:
  2200. @table @option
  2201. @item frequency, f
  2202. Set the filter's central frequency. Default is @code{3000}.
  2203. @item csg
  2204. Constant skirt gain if set to 1. Defaults to 0.
  2205. @item width_type, t
  2206. Set method to specify band-width of filter.
  2207. @table @option
  2208. @item h
  2209. Hz
  2210. @item q
  2211. Q-Factor
  2212. @item o
  2213. octave
  2214. @item s
  2215. slope
  2216. @item k
  2217. kHz
  2218. @end table
  2219. @item width, w
  2220. Specify the band-width of a filter in width_type units.
  2221. @item mix, m
  2222. How much to use filtered signal in output. Default is 1.
  2223. Range is between 0 and 1.
  2224. @item channels, c
  2225. Specify which channels to filter, by default all available are filtered.
  2226. @item normalize, n
  2227. Normalize biquad coefficients, by default is disabled.
  2228. Enabling it will normalize magnitude response at DC to 0dB.
  2229. @item transform, a
  2230. Set transform type of IIR filter.
  2231. @table @option
  2232. @item di
  2233. @item dii
  2234. @item tdii
  2235. @item latt
  2236. @end table
  2237. @item precision, r
  2238. Set precison of filtering.
  2239. @table @option
  2240. @item auto
  2241. Pick automatic sample format depending on surround filters.
  2242. @item s16
  2243. Always use signed 16-bit.
  2244. @item s32
  2245. Always use signed 32-bit.
  2246. @item f32
  2247. Always use float 32-bit.
  2248. @item f64
  2249. Always use float 64-bit.
  2250. @end table
  2251. @end table
  2252. @subsection Commands
  2253. This filter supports the following commands:
  2254. @table @option
  2255. @item frequency, f
  2256. Change bandpass frequency.
  2257. Syntax for the command is : "@var{frequency}"
  2258. @item width_type, t
  2259. Change bandpass width_type.
  2260. Syntax for the command is : "@var{width_type}"
  2261. @item width, w
  2262. Change bandpass width.
  2263. Syntax for the command is : "@var{width}"
  2264. @item mix, m
  2265. Change bandpass mix.
  2266. Syntax for the command is : "@var{mix}"
  2267. @end table
  2268. @section bandreject
  2269. Apply a two-pole Butterworth band-reject filter with central
  2270. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2271. The filter roll off at 6dB per octave (20dB per decade).
  2272. The filter accepts the following options:
  2273. @table @option
  2274. @item frequency, f
  2275. Set the filter's central frequency. Default is @code{3000}.
  2276. @item width_type, t
  2277. Set method to specify band-width of filter.
  2278. @table @option
  2279. @item h
  2280. Hz
  2281. @item q
  2282. Q-Factor
  2283. @item o
  2284. octave
  2285. @item s
  2286. slope
  2287. @item k
  2288. kHz
  2289. @end table
  2290. @item width, w
  2291. Specify the band-width of a filter in width_type units.
  2292. @item mix, m
  2293. How much to use filtered signal in output. Default is 1.
  2294. Range is between 0 and 1.
  2295. @item channels, c
  2296. Specify which channels to filter, by default all available are filtered.
  2297. @item normalize, n
  2298. Normalize biquad coefficients, by default is disabled.
  2299. Enabling it will normalize magnitude response at DC to 0dB.
  2300. @item transform, a
  2301. Set transform type of IIR filter.
  2302. @table @option
  2303. @item di
  2304. @item dii
  2305. @item tdii
  2306. @item latt
  2307. @end table
  2308. @item precision, r
  2309. Set precison of filtering.
  2310. @table @option
  2311. @item auto
  2312. Pick automatic sample format depending on surround filters.
  2313. @item s16
  2314. Always use signed 16-bit.
  2315. @item s32
  2316. Always use signed 32-bit.
  2317. @item f32
  2318. Always use float 32-bit.
  2319. @item f64
  2320. Always use float 64-bit.
  2321. @end table
  2322. @end table
  2323. @subsection Commands
  2324. This filter supports the following commands:
  2325. @table @option
  2326. @item frequency, f
  2327. Change bandreject frequency.
  2328. Syntax for the command is : "@var{frequency}"
  2329. @item width_type, t
  2330. Change bandreject width_type.
  2331. Syntax for the command is : "@var{width_type}"
  2332. @item width, w
  2333. Change bandreject width.
  2334. Syntax for the command is : "@var{width}"
  2335. @item mix, m
  2336. Change bandreject mix.
  2337. Syntax for the command is : "@var{mix}"
  2338. @end table
  2339. @section bass, lowshelf
  2340. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2341. shelving filter with a response similar to that of a standard
  2342. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2343. The filter accepts the following options:
  2344. @table @option
  2345. @item gain, g
  2346. Give the gain at 0 Hz. Its useful range is about -20
  2347. (for a large cut) to +20 (for a large boost).
  2348. Beware of clipping when using a positive gain.
  2349. @item frequency, f
  2350. Set the filter's central frequency and so can be used
  2351. to extend or reduce the frequency range to be boosted or cut.
  2352. The default value is @code{100} Hz.
  2353. @item width_type, t
  2354. Set method to specify band-width of filter.
  2355. @table @option
  2356. @item h
  2357. Hz
  2358. @item q
  2359. Q-Factor
  2360. @item o
  2361. octave
  2362. @item s
  2363. slope
  2364. @item k
  2365. kHz
  2366. @end table
  2367. @item width, w
  2368. Determine how steep is the filter's shelf transition.
  2369. @item mix, m
  2370. How much to use filtered signal in output. Default is 1.
  2371. Range is between 0 and 1.
  2372. @item channels, c
  2373. Specify which channels to filter, by default all available are filtered.
  2374. @item normalize, n
  2375. Normalize biquad coefficients, by default is disabled.
  2376. Enabling it will normalize magnitude response at DC to 0dB.
  2377. @item transform, a
  2378. Set transform type of IIR filter.
  2379. @table @option
  2380. @item di
  2381. @item dii
  2382. @item tdii
  2383. @item latt
  2384. @end table
  2385. @item precision, r
  2386. Set precison of filtering.
  2387. @table @option
  2388. @item auto
  2389. Pick automatic sample format depending on surround filters.
  2390. @item s16
  2391. Always use signed 16-bit.
  2392. @item s32
  2393. Always use signed 32-bit.
  2394. @item f32
  2395. Always use float 32-bit.
  2396. @item f64
  2397. Always use float 64-bit.
  2398. @end table
  2399. @end table
  2400. @subsection Commands
  2401. This filter supports the following commands:
  2402. @table @option
  2403. @item frequency, f
  2404. Change bass frequency.
  2405. Syntax for the command is : "@var{frequency}"
  2406. @item width_type, t
  2407. Change bass width_type.
  2408. Syntax for the command is : "@var{width_type}"
  2409. @item width, w
  2410. Change bass width.
  2411. Syntax for the command is : "@var{width}"
  2412. @item gain, g
  2413. Change bass gain.
  2414. Syntax for the command is : "@var{gain}"
  2415. @item mix, m
  2416. Change bass mix.
  2417. Syntax for the command is : "@var{mix}"
  2418. @end table
  2419. @section biquad
  2420. Apply a biquad IIR filter with the given coefficients.
  2421. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2422. are the numerator and denominator coefficients respectively.
  2423. and @var{channels}, @var{c} specify which channels to filter, by default all
  2424. available are filtered.
  2425. @subsection Commands
  2426. This filter supports the following commands:
  2427. @table @option
  2428. @item a0
  2429. @item a1
  2430. @item a2
  2431. @item b0
  2432. @item b1
  2433. @item b2
  2434. Change biquad parameter.
  2435. Syntax for the command is : "@var{value}"
  2436. @item mix, m
  2437. How much to use filtered signal in output. Default is 1.
  2438. Range is between 0 and 1.
  2439. @item channels, c
  2440. Specify which channels to filter, by default all available are filtered.
  2441. @item normalize, n
  2442. Normalize biquad coefficients, by default is disabled.
  2443. Enabling it will normalize magnitude response at DC to 0dB.
  2444. @item transform, a
  2445. Set transform type of IIR filter.
  2446. @table @option
  2447. @item di
  2448. @item dii
  2449. @item tdii
  2450. @item latt
  2451. @end table
  2452. @item precision, r
  2453. Set precison of filtering.
  2454. @table @option
  2455. @item auto
  2456. Pick automatic sample format depending on surround filters.
  2457. @item s16
  2458. Always use signed 16-bit.
  2459. @item s32
  2460. Always use signed 32-bit.
  2461. @item f32
  2462. Always use float 32-bit.
  2463. @item f64
  2464. Always use float 64-bit.
  2465. @end table
  2466. @end table
  2467. @section bs2b
  2468. Bauer stereo to binaural transformation, which improves headphone listening of
  2469. stereo audio records.
  2470. To enable compilation of this filter you need to configure FFmpeg with
  2471. @code{--enable-libbs2b}.
  2472. It accepts the following parameters:
  2473. @table @option
  2474. @item profile
  2475. Pre-defined crossfeed level.
  2476. @table @option
  2477. @item default
  2478. Default level (fcut=700, feed=50).
  2479. @item cmoy
  2480. Chu Moy circuit (fcut=700, feed=60).
  2481. @item jmeier
  2482. Jan Meier circuit (fcut=650, feed=95).
  2483. @end table
  2484. @item fcut
  2485. Cut frequency (in Hz).
  2486. @item feed
  2487. Feed level (in Hz).
  2488. @end table
  2489. @section channelmap
  2490. Remap input channels to new locations.
  2491. It accepts the following parameters:
  2492. @table @option
  2493. @item map
  2494. Map channels from input to output. The argument is a '|'-separated list of
  2495. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2496. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2497. channel (e.g. FL for front left) or its index in the input channel layout.
  2498. @var{out_channel} is the name of the output channel or its index in the output
  2499. channel layout. If @var{out_channel} is not given then it is implicitly an
  2500. index, starting with zero and increasing by one for each mapping.
  2501. @item channel_layout
  2502. The channel layout of the output stream.
  2503. @end table
  2504. If no mapping is present, the filter will implicitly map input channels to
  2505. output channels, preserving indices.
  2506. @subsection Examples
  2507. @itemize
  2508. @item
  2509. For example, assuming a 5.1+downmix input MOV file,
  2510. @example
  2511. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2512. @end example
  2513. will create an output WAV file tagged as stereo from the downmix channels of
  2514. the input.
  2515. @item
  2516. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2517. @example
  2518. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2519. @end example
  2520. @end itemize
  2521. @section channelsplit
  2522. Split each channel from an input audio stream into a separate output stream.
  2523. It accepts the following parameters:
  2524. @table @option
  2525. @item channel_layout
  2526. The channel layout of the input stream. The default is "stereo".
  2527. @item channels
  2528. A channel layout describing the channels to be extracted as separate output streams
  2529. or "all" to extract each input channel as a separate stream. The default is "all".
  2530. Choosing channels not present in channel layout in the input will result in an error.
  2531. @end table
  2532. @subsection Examples
  2533. @itemize
  2534. @item
  2535. For example, assuming a stereo input MP3 file,
  2536. @example
  2537. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2538. @end example
  2539. will create an output Matroska file with two audio streams, one containing only
  2540. the left channel and the other the right channel.
  2541. @item
  2542. Split a 5.1 WAV file into per-channel files:
  2543. @example
  2544. ffmpeg -i in.wav -filter_complex
  2545. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2546. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2547. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2548. side_right.wav
  2549. @end example
  2550. @item
  2551. Extract only LFE from a 5.1 WAV file:
  2552. @example
  2553. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2554. -map '[LFE]' lfe.wav
  2555. @end example
  2556. @end itemize
  2557. @section chorus
  2558. Add a chorus effect to the audio.
  2559. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2560. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2561. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2562. The modulation depth defines the range the modulated delay is played before or after
  2563. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2564. sound tuned around the original one, like in a chorus where some vocals are slightly
  2565. off key.
  2566. It accepts the following parameters:
  2567. @table @option
  2568. @item in_gain
  2569. Set input gain. Default is 0.4.
  2570. @item out_gain
  2571. Set output gain. Default is 0.4.
  2572. @item delays
  2573. Set delays. A typical delay is around 40ms to 60ms.
  2574. @item decays
  2575. Set decays.
  2576. @item speeds
  2577. Set speeds.
  2578. @item depths
  2579. Set depths.
  2580. @end table
  2581. @subsection Examples
  2582. @itemize
  2583. @item
  2584. A single delay:
  2585. @example
  2586. chorus=0.7:0.9:55:0.4:0.25:2
  2587. @end example
  2588. @item
  2589. Two delays:
  2590. @example
  2591. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2592. @end example
  2593. @item
  2594. Fuller sounding chorus with three delays:
  2595. @example
  2596. 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
  2597. @end example
  2598. @end itemize
  2599. @section compand
  2600. Compress or expand the audio's dynamic range.
  2601. It accepts the following parameters:
  2602. @table @option
  2603. @item attacks
  2604. @item decays
  2605. A list of times in seconds for each channel over which the instantaneous level
  2606. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2607. increase of volume and @var{decays} refers to decrease of volume. For most
  2608. situations, the attack time (response to the audio getting louder) should be
  2609. shorter than the decay time, because the human ear is more sensitive to sudden
  2610. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2611. a typical value for decay is 0.8 seconds.
  2612. If specified number of attacks & decays is lower than number of channels, the last
  2613. set attack/decay will be used for all remaining channels.
  2614. @item points
  2615. A list of points for the transfer function, specified in dB relative to the
  2616. maximum possible signal amplitude. Each key points list must be defined using
  2617. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2618. @code{x0/y0 x1/y1 x2/y2 ....}
  2619. The input values must be in strictly increasing order but the transfer function
  2620. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2621. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2622. function are @code{-70/-70|-60/-20|1/0}.
  2623. @item soft-knee
  2624. Set the curve radius in dB for all joints. It defaults to 0.01.
  2625. @item gain
  2626. Set the additional gain in dB to be applied at all points on the transfer
  2627. function. This allows for easy adjustment of the overall gain.
  2628. It defaults to 0.
  2629. @item volume
  2630. Set an initial volume, in dB, to be assumed for each channel when filtering
  2631. starts. This permits the user to supply a nominal level initially, so that, for
  2632. example, a very large gain is not applied to initial signal levels before the
  2633. companding has begun to operate. A typical value for audio which is initially
  2634. quiet is -90 dB. It defaults to 0.
  2635. @item delay
  2636. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2637. delayed before being fed to the volume adjuster. Specifying a delay
  2638. approximately equal to the attack/decay times allows the filter to effectively
  2639. operate in predictive rather than reactive mode. It defaults to 0.
  2640. @end table
  2641. @subsection Examples
  2642. @itemize
  2643. @item
  2644. Make music with both quiet and loud passages suitable for listening to in a
  2645. noisy environment:
  2646. @example
  2647. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2648. @end example
  2649. Another example for audio with whisper and explosion parts:
  2650. @example
  2651. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2652. @end example
  2653. @item
  2654. A noise gate for when the noise is at a lower level than the signal:
  2655. @example
  2656. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2657. @end example
  2658. @item
  2659. Here is another noise gate, this time for when the noise is at a higher level
  2660. than the signal (making it, in some ways, similar to squelch):
  2661. @example
  2662. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2663. @end example
  2664. @item
  2665. 2:1 compression starting at -6dB:
  2666. @example
  2667. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2668. @end example
  2669. @item
  2670. 2:1 compression starting at -9dB:
  2671. @example
  2672. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2673. @end example
  2674. @item
  2675. 2:1 compression starting at -12dB:
  2676. @example
  2677. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2678. @end example
  2679. @item
  2680. 2:1 compression starting at -18dB:
  2681. @example
  2682. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2683. @end example
  2684. @item
  2685. 3:1 compression starting at -15dB:
  2686. @example
  2687. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2688. @end example
  2689. @item
  2690. Compressor/Gate:
  2691. @example
  2692. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2693. @end example
  2694. @item
  2695. Expander:
  2696. @example
  2697. 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
  2698. @end example
  2699. @item
  2700. Hard limiter at -6dB:
  2701. @example
  2702. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2703. @end example
  2704. @item
  2705. Hard limiter at -12dB:
  2706. @example
  2707. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2708. @end example
  2709. @item
  2710. Hard noise gate at -35 dB:
  2711. @example
  2712. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2713. @end example
  2714. @item
  2715. Soft limiter:
  2716. @example
  2717. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2718. @end example
  2719. @end itemize
  2720. @section compensationdelay
  2721. Compensation Delay Line is a metric based delay to compensate differing
  2722. positions of microphones or speakers.
  2723. For example, you have recorded guitar with two microphones placed in
  2724. different locations. Because the front of sound wave has fixed speed in
  2725. normal conditions, the phasing of microphones can vary and depends on
  2726. their location and interposition. The best sound mix can be achieved when
  2727. these microphones are in phase (synchronized). Note that a distance of
  2728. ~30 cm between microphones makes one microphone capture the signal in
  2729. antiphase to the other microphone. That makes the final mix sound moody.
  2730. This filter helps to solve phasing problems by adding different delays
  2731. to each microphone track and make them synchronized.
  2732. The best result can be reached when you take one track as base and
  2733. synchronize other tracks one by one with it.
  2734. Remember that synchronization/delay tolerance depends on sample rate, too.
  2735. Higher sample rates will give more tolerance.
  2736. The filter accepts the following parameters:
  2737. @table @option
  2738. @item mm
  2739. Set millimeters distance. This is compensation distance for fine tuning.
  2740. Default is 0.
  2741. @item cm
  2742. Set cm distance. This is compensation distance for tightening distance setup.
  2743. Default is 0.
  2744. @item m
  2745. Set meters distance. This is compensation distance for hard distance setup.
  2746. Default is 0.
  2747. @item dry
  2748. Set dry amount. Amount of unprocessed (dry) signal.
  2749. Default is 0.
  2750. @item wet
  2751. Set wet amount. Amount of processed (wet) signal.
  2752. Default is 1.
  2753. @item temp
  2754. Set temperature in degrees Celsius. This is the temperature of the environment.
  2755. Default is 20.
  2756. @end table
  2757. @section crossfeed
  2758. Apply headphone crossfeed filter.
  2759. Crossfeed is the process of blending the left and right channels of stereo
  2760. audio recording.
  2761. It is mainly used to reduce extreme stereo separation of low frequencies.
  2762. The intent is to produce more speaker like sound to the listener.
  2763. The filter accepts the following options:
  2764. @table @option
  2765. @item strength
  2766. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2767. This sets gain of low shelf filter for side part of stereo image.
  2768. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2769. @item range
  2770. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2771. This sets cut off frequency of low shelf filter. Default is cut off near
  2772. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2773. @item slope
  2774. Set curve slope of low shelf filter. Default is 0.5.
  2775. Allowed range is from 0.01 to 1.
  2776. @item level_in
  2777. Set input gain. Default is 0.9.
  2778. @item level_out
  2779. Set output gain. Default is 1.
  2780. @end table
  2781. @subsection Commands
  2782. This filter supports the all above options as @ref{commands}.
  2783. @section crystalizer
  2784. Simple algorithm to expand audio dynamic range.
  2785. The filter accepts the following options:
  2786. @table @option
  2787. @item i
  2788. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2789. (unchanged sound) to 10.0 (maximum effect).
  2790. @item c
  2791. Enable clipping. By default is enabled.
  2792. @end table
  2793. @subsection Commands
  2794. This filter supports the all above options as @ref{commands}.
  2795. @section dcshift
  2796. Apply a DC shift to the audio.
  2797. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2798. in the recording chain) from the audio. The effect of a DC offset is reduced
  2799. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2800. a signal has a DC offset.
  2801. @table @option
  2802. @item shift
  2803. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2804. the audio.
  2805. @item limitergain
  2806. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2807. used to prevent clipping.
  2808. @end table
  2809. @section deesser
  2810. Apply de-essing to the audio samples.
  2811. @table @option
  2812. @item i
  2813. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2814. Default is 0.
  2815. @item m
  2816. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2817. Default is 0.5.
  2818. @item f
  2819. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2820. Default is 0.5.
  2821. @item s
  2822. Set the output mode.
  2823. It accepts the following values:
  2824. @table @option
  2825. @item i
  2826. Pass input unchanged.
  2827. @item o
  2828. Pass ess filtered out.
  2829. @item e
  2830. Pass only ess.
  2831. Default value is @var{o}.
  2832. @end table
  2833. @end table
  2834. @section drmeter
  2835. Measure audio dynamic range.
  2836. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2837. is found in transition material. And anything less that 8 have very poor dynamics
  2838. and is very compressed.
  2839. The filter accepts the following options:
  2840. @table @option
  2841. @item length
  2842. Set window length in seconds used to split audio into segments of equal length.
  2843. Default is 3 seconds.
  2844. @end table
  2845. @section dynaudnorm
  2846. Dynamic Audio Normalizer.
  2847. This filter applies a certain amount of gain to the input audio in order
  2848. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2849. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2850. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2851. This allows for applying extra gain to the "quiet" sections of the audio
  2852. while avoiding distortions or clipping the "loud" sections. In other words:
  2853. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2854. sections, in the sense that the volume of each section is brought to the
  2855. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2856. this goal *without* applying "dynamic range compressing". It will retain 100%
  2857. of the dynamic range *within* each section of the audio file.
  2858. @table @option
  2859. @item framelen, f
  2860. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2861. Default is 500 milliseconds.
  2862. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2863. referred to as frames. This is required, because a peak magnitude has no
  2864. meaning for just a single sample value. Instead, we need to determine the
  2865. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2866. normalizer would simply use the peak magnitude of the complete file, the
  2867. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2868. frame. The length of a frame is specified in milliseconds. By default, the
  2869. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2870. been found to give good results with most files.
  2871. Note that the exact frame length, in number of samples, will be determined
  2872. automatically, based on the sampling rate of the individual input audio file.
  2873. @item gausssize, g
  2874. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2875. number. Default is 31.
  2876. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2877. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2878. is specified in frames, centered around the current frame. For the sake of
  2879. simplicity, this must be an odd number. Consequently, the default value of 31
  2880. takes into account the current frame, as well as the 15 preceding frames and
  2881. the 15 subsequent frames. Using a larger window results in a stronger
  2882. smoothing effect and thus in less gain variation, i.e. slower gain
  2883. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2884. effect and thus in more gain variation, i.e. faster gain adaptation.
  2885. In other words, the more you increase this value, the more the Dynamic Audio
  2886. Normalizer will behave like a "traditional" normalization filter. On the
  2887. contrary, the more you decrease this value, the more the Dynamic Audio
  2888. Normalizer will behave like a dynamic range compressor.
  2889. @item peak, p
  2890. Set the target peak value. This specifies the highest permissible magnitude
  2891. level for the normalized audio input. This filter will try to approach the
  2892. target peak magnitude as closely as possible, but at the same time it also
  2893. makes sure that the normalized signal will never exceed the peak magnitude.
  2894. A frame's maximum local gain factor is imposed directly by the target peak
  2895. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2896. It is not recommended to go above this value.
  2897. @item maxgain, m
  2898. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2899. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2900. factor for each input frame, i.e. the maximum gain factor that does not
  2901. result in clipping or distortion. The maximum gain factor is determined by
  2902. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2903. additionally bounds the frame's maximum gain factor by a predetermined
  2904. (global) maximum gain factor. This is done in order to avoid excessive gain
  2905. factors in "silent" or almost silent frames. By default, the maximum gain
  2906. factor is 10.0, For most inputs the default value should be sufficient and
  2907. it usually is not recommended to increase this value. Though, for input
  2908. with an extremely low overall volume level, it may be necessary to allow even
  2909. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2910. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2911. Instead, a "sigmoid" threshold function will be applied. This way, the
  2912. gain factors will smoothly approach the threshold value, but never exceed that
  2913. value.
  2914. @item targetrms, r
  2915. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2916. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2917. This means that the maximum local gain factor for each frame is defined
  2918. (only) by the frame's highest magnitude sample. This way, the samples can
  2919. be amplified as much as possible without exceeding the maximum signal
  2920. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2921. Normalizer can also take into account the frame's root mean square,
  2922. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2923. determine the power of a time-varying signal. It is therefore considered
  2924. that the RMS is a better approximation of the "perceived loudness" than
  2925. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2926. frames to a constant RMS value, a uniform "perceived loudness" can be
  2927. established. If a target RMS value has been specified, a frame's local gain
  2928. factor is defined as the factor that would result in exactly that RMS value.
  2929. Note, however, that the maximum local gain factor is still restricted by the
  2930. frame's highest magnitude sample, in order to prevent clipping.
  2931. @item coupling, n
  2932. Enable channels coupling. By default is enabled.
  2933. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2934. amount. This means the same gain factor will be applied to all channels, i.e.
  2935. the maximum possible gain factor is determined by the "loudest" channel.
  2936. However, in some recordings, it may happen that the volume of the different
  2937. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2938. In this case, this option can be used to disable the channel coupling. This way,
  2939. the gain factor will be determined independently for each channel, depending
  2940. only on the individual channel's highest magnitude sample. This allows for
  2941. harmonizing the volume of the different channels.
  2942. @item correctdc, c
  2943. Enable DC bias correction. By default is disabled.
  2944. An audio signal (in the time domain) is a sequence of sample values.
  2945. In the Dynamic Audio Normalizer these sample values are represented in the
  2946. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2947. audio signal, or "waveform", should be centered around the zero point.
  2948. That means if we calculate the mean value of all samples in a file, or in a
  2949. single frame, then the result should be 0.0 or at least very close to that
  2950. value. If, however, there is a significant deviation of the mean value from
  2951. 0.0, in either positive or negative direction, this is referred to as a
  2952. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2953. Audio Normalizer provides optional DC bias correction.
  2954. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2955. the mean value, or "DC correction" offset, of each input frame and subtract
  2956. that value from all of the frame's sample values which ensures those samples
  2957. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2958. boundaries, the DC correction offset values will be interpolated smoothly
  2959. between neighbouring frames.
  2960. @item altboundary, b
  2961. Enable alternative boundary mode. By default is disabled.
  2962. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2963. around each frame. This includes the preceding frames as well as the
  2964. subsequent frames. However, for the "boundary" frames, located at the very
  2965. beginning and at the very end of the audio file, not all neighbouring
  2966. frames are available. In particular, for the first few frames in the audio
  2967. file, the preceding frames are not known. And, similarly, for the last few
  2968. frames in the audio file, the subsequent frames are not known. Thus, the
  2969. question arises which gain factors should be assumed for the missing frames
  2970. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2971. to deal with this situation. The default boundary mode assumes a gain factor
  2972. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2973. "fade out" at the beginning and at the end of the input, respectively.
  2974. @item compress, s
  2975. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2976. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2977. compression. This means that signal peaks will not be pruned and thus the
  2978. full dynamic range will be retained within each local neighbourhood. However,
  2979. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2980. normalization algorithm with a more "traditional" compression.
  2981. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2982. (thresholding) function. If (and only if) the compression feature is enabled,
  2983. all input frames will be processed by a soft knee thresholding function prior
  2984. to the actual normalization process. Put simply, the thresholding function is
  2985. going to prune all samples whose magnitude exceeds a certain threshold value.
  2986. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2987. value. Instead, the threshold value will be adjusted for each individual
  2988. frame.
  2989. In general, smaller parameters result in stronger compression, and vice versa.
  2990. Values below 3.0 are not recommended, because audible distortion may appear.
  2991. @item threshold, t
  2992. Set the target threshold value. This specifies the lowest permissible
  2993. magnitude level for the audio input which will be normalized.
  2994. If input frame volume is above this value frame will be normalized.
  2995. Otherwise frame may not be normalized at all. The default value is set
  2996. to 0, which means all input frames will be normalized.
  2997. This option is mostly useful if digital noise is not wanted to be amplified.
  2998. @end table
  2999. @subsection Commands
  3000. This filter supports the all above options as @ref{commands}.
  3001. @section earwax
  3002. Make audio easier to listen to on headphones.
  3003. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3004. so that when listened to on headphones the stereo image is moved from
  3005. inside your head (standard for headphones) to outside and in front of
  3006. the listener (standard for speakers).
  3007. Ported from SoX.
  3008. @section equalizer
  3009. Apply a two-pole peaking equalisation (EQ) filter. With this
  3010. filter, the signal-level at and around a selected frequency can
  3011. be increased or decreased, whilst (unlike bandpass and bandreject
  3012. filters) that at all other frequencies is unchanged.
  3013. In order to produce complex equalisation curves, this filter can
  3014. be given several times, each with a different central frequency.
  3015. The filter accepts the following options:
  3016. @table @option
  3017. @item frequency, f
  3018. Set the filter's central frequency in Hz.
  3019. @item width_type, t
  3020. Set method to specify band-width of filter.
  3021. @table @option
  3022. @item h
  3023. Hz
  3024. @item q
  3025. Q-Factor
  3026. @item o
  3027. octave
  3028. @item s
  3029. slope
  3030. @item k
  3031. kHz
  3032. @end table
  3033. @item width, w
  3034. Specify the band-width of a filter in width_type units.
  3035. @item gain, g
  3036. Set the required gain or attenuation in dB.
  3037. Beware of clipping when using a positive gain.
  3038. @item mix, m
  3039. How much to use filtered signal in output. Default is 1.
  3040. Range is between 0 and 1.
  3041. @item channels, c
  3042. Specify which channels to filter, by default all available are filtered.
  3043. @item normalize, n
  3044. Normalize biquad coefficients, by default is disabled.
  3045. Enabling it will normalize magnitude response at DC to 0dB.
  3046. @item transform, a
  3047. Set transform type of IIR filter.
  3048. @table @option
  3049. @item di
  3050. @item dii
  3051. @item tdii
  3052. @item latt
  3053. @end table
  3054. @item precision, r
  3055. Set precison of filtering.
  3056. @table @option
  3057. @item auto
  3058. Pick automatic sample format depending on surround filters.
  3059. @item s16
  3060. Always use signed 16-bit.
  3061. @item s32
  3062. Always use signed 32-bit.
  3063. @item f32
  3064. Always use float 32-bit.
  3065. @item f64
  3066. Always use float 64-bit.
  3067. @end table
  3068. @end table
  3069. @subsection Examples
  3070. @itemize
  3071. @item
  3072. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3073. @example
  3074. equalizer=f=1000:t=h:width=200:g=-10
  3075. @end example
  3076. @item
  3077. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3078. @example
  3079. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3080. @end example
  3081. @end itemize
  3082. @subsection Commands
  3083. This filter supports the following commands:
  3084. @table @option
  3085. @item frequency, f
  3086. Change equalizer frequency.
  3087. Syntax for the command is : "@var{frequency}"
  3088. @item width_type, t
  3089. Change equalizer width_type.
  3090. Syntax for the command is : "@var{width_type}"
  3091. @item width, w
  3092. Change equalizer width.
  3093. Syntax for the command is : "@var{width}"
  3094. @item gain, g
  3095. Change equalizer gain.
  3096. Syntax for the command is : "@var{gain}"
  3097. @item mix, m
  3098. Change equalizer mix.
  3099. Syntax for the command is : "@var{mix}"
  3100. @end table
  3101. @section extrastereo
  3102. Linearly increases the difference between left and right channels which
  3103. adds some sort of "live" effect to playback.
  3104. The filter accepts the following options:
  3105. @table @option
  3106. @item m
  3107. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3108. (average of both channels), with 1.0 sound will be unchanged, with
  3109. -1.0 left and right channels will be swapped.
  3110. @item c
  3111. Enable clipping. By default is enabled.
  3112. @end table
  3113. @subsection Commands
  3114. This filter supports the all above options as @ref{commands}.
  3115. @section firequalizer
  3116. Apply FIR Equalization using arbitrary frequency response.
  3117. The filter accepts the following option:
  3118. @table @option
  3119. @item gain
  3120. Set gain curve equation (in dB). The expression can contain variables:
  3121. @table @option
  3122. @item f
  3123. the evaluated frequency
  3124. @item sr
  3125. sample rate
  3126. @item ch
  3127. channel number, set to 0 when multichannels evaluation is disabled
  3128. @item chid
  3129. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3130. multichannels evaluation is disabled
  3131. @item chs
  3132. number of channels
  3133. @item chlayout
  3134. channel_layout, see libavutil/channel_layout.h
  3135. @end table
  3136. and functions:
  3137. @table @option
  3138. @item gain_interpolate(f)
  3139. interpolate gain on frequency f based on gain_entry
  3140. @item cubic_interpolate(f)
  3141. same as gain_interpolate, but smoother
  3142. @end table
  3143. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3144. @item gain_entry
  3145. Set gain entry for gain_interpolate function. The expression can
  3146. contain functions:
  3147. @table @option
  3148. @item entry(f, g)
  3149. store gain entry at frequency f with value g
  3150. @end table
  3151. This option is also available as command.
  3152. @item delay
  3153. Set filter delay in seconds. Higher value means more accurate.
  3154. Default is @code{0.01}.
  3155. @item accuracy
  3156. Set filter accuracy in Hz. Lower value means more accurate.
  3157. Default is @code{5}.
  3158. @item wfunc
  3159. Set window function. Acceptable values are:
  3160. @table @option
  3161. @item rectangular
  3162. rectangular window, useful when gain curve is already smooth
  3163. @item hann
  3164. hann window (default)
  3165. @item hamming
  3166. hamming window
  3167. @item blackman
  3168. blackman window
  3169. @item nuttall3
  3170. 3-terms continuous 1st derivative nuttall window
  3171. @item mnuttall3
  3172. minimum 3-terms discontinuous nuttall window
  3173. @item nuttall
  3174. 4-terms continuous 1st derivative nuttall window
  3175. @item bnuttall
  3176. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3177. @item bharris
  3178. blackman-harris window
  3179. @item tukey
  3180. tukey window
  3181. @end table
  3182. @item fixed
  3183. If enabled, use fixed number of audio samples. This improves speed when
  3184. filtering with large delay. Default is disabled.
  3185. @item multi
  3186. Enable multichannels evaluation on gain. Default is disabled.
  3187. @item zero_phase
  3188. Enable zero phase mode by subtracting timestamp to compensate delay.
  3189. Default is disabled.
  3190. @item scale
  3191. Set scale used by gain. Acceptable values are:
  3192. @table @option
  3193. @item linlin
  3194. linear frequency, linear gain
  3195. @item linlog
  3196. linear frequency, logarithmic (in dB) gain (default)
  3197. @item loglin
  3198. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3199. @item loglog
  3200. logarithmic frequency, logarithmic gain
  3201. @end table
  3202. @item dumpfile
  3203. Set file for dumping, suitable for gnuplot.
  3204. @item dumpscale
  3205. Set scale for dumpfile. Acceptable values are same with scale option.
  3206. Default is linlog.
  3207. @item fft2
  3208. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3209. Default is disabled.
  3210. @item min_phase
  3211. Enable minimum phase impulse response. Default is disabled.
  3212. @end table
  3213. @subsection Examples
  3214. @itemize
  3215. @item
  3216. lowpass at 1000 Hz:
  3217. @example
  3218. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3219. @end example
  3220. @item
  3221. lowpass at 1000 Hz with gain_entry:
  3222. @example
  3223. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3224. @end example
  3225. @item
  3226. custom equalization:
  3227. @example
  3228. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3229. @end example
  3230. @item
  3231. higher delay with zero phase to compensate delay:
  3232. @example
  3233. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3234. @end example
  3235. @item
  3236. lowpass on left channel, highpass on right channel:
  3237. @example
  3238. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3239. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3240. @end example
  3241. @end itemize
  3242. @section flanger
  3243. Apply a flanging effect to the audio.
  3244. The filter accepts the following options:
  3245. @table @option
  3246. @item delay
  3247. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3248. @item depth
  3249. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3250. @item regen
  3251. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3252. Default value is 0.
  3253. @item width
  3254. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3255. Default value is 71.
  3256. @item speed
  3257. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3258. @item shape
  3259. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3260. Default value is @var{sinusoidal}.
  3261. @item phase
  3262. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3263. Default value is 25.
  3264. @item interp
  3265. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3266. Default is @var{linear}.
  3267. @end table
  3268. @section haas
  3269. Apply Haas effect to audio.
  3270. Note that this makes most sense to apply on mono signals.
  3271. With this filter applied to mono signals it give some directionality and
  3272. stretches its stereo image.
  3273. The filter accepts the following options:
  3274. @table @option
  3275. @item level_in
  3276. Set input level. By default is @var{1}, or 0dB
  3277. @item level_out
  3278. Set output level. By default is @var{1}, or 0dB.
  3279. @item side_gain
  3280. Set gain applied to side part of signal. By default is @var{1}.
  3281. @item middle_source
  3282. Set kind of middle source. Can be one of the following:
  3283. @table @samp
  3284. @item left
  3285. Pick left channel.
  3286. @item right
  3287. Pick right channel.
  3288. @item mid
  3289. Pick middle part signal of stereo image.
  3290. @item side
  3291. Pick side part signal of stereo image.
  3292. @end table
  3293. @item middle_phase
  3294. Change middle phase. By default is disabled.
  3295. @item left_delay
  3296. Set left channel delay. By default is @var{2.05} milliseconds.
  3297. @item left_balance
  3298. Set left channel balance. By default is @var{-1}.
  3299. @item left_gain
  3300. Set left channel gain. By default is @var{1}.
  3301. @item left_phase
  3302. Change left phase. By default is disabled.
  3303. @item right_delay
  3304. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3305. @item right_balance
  3306. Set right channel balance. By default is @var{1}.
  3307. @item right_gain
  3308. Set right channel gain. By default is @var{1}.
  3309. @item right_phase
  3310. Change right phase. By default is enabled.
  3311. @end table
  3312. @section hdcd
  3313. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3314. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3315. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3316. of HDCD, and detects the Transient Filter flag.
  3317. @example
  3318. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3319. @end example
  3320. When using the filter with wav, note the default encoding for wav is 16-bit,
  3321. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3322. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3323. @example
  3324. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3325. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3326. @end example
  3327. The filter accepts the following options:
  3328. @table @option
  3329. @item disable_autoconvert
  3330. Disable any automatic format conversion or resampling in the filter graph.
  3331. @item process_stereo
  3332. Process the stereo channels together. If target_gain does not match between
  3333. channels, consider it invalid and use the last valid target_gain.
  3334. @item cdt_ms
  3335. Set the code detect timer period in ms.
  3336. @item force_pe
  3337. Always extend peaks above -3dBFS even if PE isn't signaled.
  3338. @item analyze_mode
  3339. Replace audio with a solid tone and adjust the amplitude to signal some
  3340. specific aspect of the decoding process. The output file can be loaded in
  3341. an audio editor alongside the original to aid analysis.
  3342. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3343. Modes are:
  3344. @table @samp
  3345. @item 0, off
  3346. Disabled
  3347. @item 1, lle
  3348. Gain adjustment level at each sample
  3349. @item 2, pe
  3350. Samples where peak extend occurs
  3351. @item 3, cdt
  3352. Samples where the code detect timer is active
  3353. @item 4, tgm
  3354. Samples where the target gain does not match between channels
  3355. @end table
  3356. @end table
  3357. @section headphone
  3358. Apply head-related transfer functions (HRTFs) to create virtual
  3359. loudspeakers around the user for binaural listening via headphones.
  3360. The HRIRs are provided via additional streams, for each channel
  3361. one stereo input stream is needed.
  3362. The filter accepts the following options:
  3363. @table @option
  3364. @item map
  3365. Set mapping of input streams for convolution.
  3366. The argument is a '|'-separated list of channel names in order as they
  3367. are given as additional stream inputs for filter.
  3368. This also specify number of input streams. Number of input streams
  3369. must be not less than number of channels in first stream plus one.
  3370. @item gain
  3371. Set gain applied to audio. Value is in dB. Default is 0.
  3372. @item type
  3373. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3374. processing audio in time domain which is slow.
  3375. @var{freq} is processing audio in frequency domain which is fast.
  3376. Default is @var{freq}.
  3377. @item lfe
  3378. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3379. @item size
  3380. Set size of frame in number of samples which will be processed at once.
  3381. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3382. @item hrir
  3383. Set format of hrir stream.
  3384. Default value is @var{stereo}. Alternative value is @var{multich}.
  3385. If value is set to @var{stereo}, number of additional streams should
  3386. be greater or equal to number of input channels in first input stream.
  3387. Also each additional stream should have stereo number of channels.
  3388. If value is set to @var{multich}, number of additional streams should
  3389. be exactly one. Also number of input channels of additional stream
  3390. should be equal or greater than twice number of channels of first input
  3391. stream.
  3392. @end table
  3393. @subsection Examples
  3394. @itemize
  3395. @item
  3396. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3397. each amovie filter use stereo file with IR coefficients as input.
  3398. The files give coefficients for each position of virtual loudspeaker:
  3399. @example
  3400. ffmpeg -i input.wav
  3401. -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"
  3402. output.wav
  3403. @end example
  3404. @item
  3405. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3406. but now in @var{multich} @var{hrir} format.
  3407. @example
  3408. 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"
  3409. output.wav
  3410. @end example
  3411. @end itemize
  3412. @section highpass
  3413. Apply a high-pass filter with 3dB point frequency.
  3414. The filter can be either single-pole, or double-pole (the default).
  3415. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3416. The filter accepts the following options:
  3417. @table @option
  3418. @item frequency, f
  3419. Set frequency in Hz. Default is 3000.
  3420. @item poles, p
  3421. Set number of poles. Default is 2.
  3422. @item width_type, t
  3423. Set method to specify band-width of filter.
  3424. @table @option
  3425. @item h
  3426. Hz
  3427. @item q
  3428. Q-Factor
  3429. @item o
  3430. octave
  3431. @item s
  3432. slope
  3433. @item k
  3434. kHz
  3435. @end table
  3436. @item width, w
  3437. Specify the band-width of a filter in width_type units.
  3438. Applies only to double-pole filter.
  3439. The default is 0.707q and gives a Butterworth response.
  3440. @item mix, m
  3441. How much to use filtered signal in output. Default is 1.
  3442. Range is between 0 and 1.
  3443. @item channels, c
  3444. Specify which channels to filter, by default all available are filtered.
  3445. @item normalize, n
  3446. Normalize biquad coefficients, by default is disabled.
  3447. Enabling it will normalize magnitude response at DC to 0dB.
  3448. @item transform, a
  3449. Set transform type of IIR filter.
  3450. @table @option
  3451. @item di
  3452. @item dii
  3453. @item tdii
  3454. @item latt
  3455. @end table
  3456. @item precision, r
  3457. Set precison of filtering.
  3458. @table @option
  3459. @item auto
  3460. Pick automatic sample format depending on surround filters.
  3461. @item s16
  3462. Always use signed 16-bit.
  3463. @item s32
  3464. Always use signed 32-bit.
  3465. @item f32
  3466. Always use float 32-bit.
  3467. @item f64
  3468. Always use float 64-bit.
  3469. @end table
  3470. @end table
  3471. @subsection Commands
  3472. This filter supports the following commands:
  3473. @table @option
  3474. @item frequency, f
  3475. Change highpass frequency.
  3476. Syntax for the command is : "@var{frequency}"
  3477. @item width_type, t
  3478. Change highpass width_type.
  3479. Syntax for the command is : "@var{width_type}"
  3480. @item width, w
  3481. Change highpass width.
  3482. Syntax for the command is : "@var{width}"
  3483. @item mix, m
  3484. Change highpass mix.
  3485. Syntax for the command is : "@var{mix}"
  3486. @end table
  3487. @section join
  3488. Join multiple input streams into one multi-channel stream.
  3489. It accepts the following parameters:
  3490. @table @option
  3491. @item inputs
  3492. The number of input streams. It defaults to 2.
  3493. @item channel_layout
  3494. The desired output channel layout. It defaults to stereo.
  3495. @item map
  3496. Map channels from inputs to output. The argument is a '|'-separated list of
  3497. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3498. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3499. can be either the name of the input channel (e.g. FL for front left) or its
  3500. index in the specified input stream. @var{out_channel} is the name of the output
  3501. channel.
  3502. @end table
  3503. The filter will attempt to guess the mappings when they are not specified
  3504. explicitly. It does so by first trying to find an unused matching input channel
  3505. and if that fails it picks the first unused input channel.
  3506. Join 3 inputs (with properly set channel layouts):
  3507. @example
  3508. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3509. @end example
  3510. Build a 5.1 output from 6 single-channel streams:
  3511. @example
  3512. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3513. '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'
  3514. out
  3515. @end example
  3516. @section ladspa
  3517. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3518. To enable compilation of this filter you need to configure FFmpeg with
  3519. @code{--enable-ladspa}.
  3520. @table @option
  3521. @item file, f
  3522. Specifies the name of LADSPA plugin library to load. If the environment
  3523. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3524. each one of the directories specified by the colon separated list in
  3525. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3526. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3527. @file{/usr/lib/ladspa/}.
  3528. @item plugin, p
  3529. Specifies the plugin within the library. Some libraries contain only
  3530. one plugin, but others contain many of them. If this is not set filter
  3531. will list all available plugins within the specified library.
  3532. @item controls, c
  3533. Set the '|' separated list of controls which are zero or more floating point
  3534. values that determine the behavior of the loaded plugin (for example delay,
  3535. threshold or gain).
  3536. Controls need to be defined using the following syntax:
  3537. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3538. @var{valuei} is the value set on the @var{i}-th control.
  3539. Alternatively they can be also defined using the following syntax:
  3540. @var{value0}|@var{value1}|@var{value2}|..., where
  3541. @var{valuei} is the value set on the @var{i}-th control.
  3542. If @option{controls} is set to @code{help}, all available controls and
  3543. their valid ranges are printed.
  3544. @item sample_rate, s
  3545. Specify the sample rate, default to 44100. Only used if plugin have
  3546. zero inputs.
  3547. @item nb_samples, n
  3548. Set the number of samples per channel per each output frame, default
  3549. is 1024. Only used if plugin have zero inputs.
  3550. @item duration, d
  3551. Set the minimum duration of the sourced audio. See
  3552. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3553. for the accepted syntax.
  3554. Note that the resulting duration may be greater than the specified duration,
  3555. as the generated audio is always cut at the end of a complete frame.
  3556. If not specified, or the expressed duration is negative, the audio is
  3557. supposed to be generated forever.
  3558. Only used if plugin have zero inputs.
  3559. @item latency, l
  3560. Enable latency compensation, by default is disabled.
  3561. Only used if plugin have inputs.
  3562. @end table
  3563. @subsection Examples
  3564. @itemize
  3565. @item
  3566. List all available plugins within amp (LADSPA example plugin) library:
  3567. @example
  3568. ladspa=file=amp
  3569. @end example
  3570. @item
  3571. List all available controls and their valid ranges for @code{vcf_notch}
  3572. plugin from @code{VCF} library:
  3573. @example
  3574. ladspa=f=vcf:p=vcf_notch:c=help
  3575. @end example
  3576. @item
  3577. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3578. plugin library:
  3579. @example
  3580. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3581. @end example
  3582. @item
  3583. Add reverberation to the audio using TAP-plugins
  3584. (Tom's Audio Processing plugins):
  3585. @example
  3586. ladspa=file=tap_reverb:tap_reverb
  3587. @end example
  3588. @item
  3589. Generate white noise, with 0.2 amplitude:
  3590. @example
  3591. ladspa=file=cmt:noise_source_white:c=c0=.2
  3592. @end example
  3593. @item
  3594. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3595. @code{C* Audio Plugin Suite} (CAPS) library:
  3596. @example
  3597. ladspa=file=caps:Click:c=c1=20'
  3598. @end example
  3599. @item
  3600. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3601. @example
  3602. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3603. @end example
  3604. @item
  3605. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3606. @code{SWH Plugins} collection:
  3607. @example
  3608. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3609. @end example
  3610. @item
  3611. Attenuate low frequencies using Multiband EQ from Steve Harris
  3612. @code{SWH Plugins} collection:
  3613. @example
  3614. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3615. @end example
  3616. @item
  3617. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3618. (CAPS) library:
  3619. @example
  3620. ladspa=caps:Narrower
  3621. @end example
  3622. @item
  3623. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3624. @example
  3625. ladspa=caps:White:.2
  3626. @end example
  3627. @item
  3628. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3629. @example
  3630. ladspa=caps:Fractal:c=c1=1
  3631. @end example
  3632. @item
  3633. Dynamic volume normalization using @code{VLevel} plugin:
  3634. @example
  3635. ladspa=vlevel-ladspa:vlevel_mono
  3636. @end example
  3637. @end itemize
  3638. @subsection Commands
  3639. This filter supports the following commands:
  3640. @table @option
  3641. @item cN
  3642. Modify the @var{N}-th control value.
  3643. If the specified value is not valid, it is ignored and prior one is kept.
  3644. @end table
  3645. @section loudnorm
  3646. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3647. Support for both single pass (livestreams, files) and double pass (files) modes.
  3648. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  3649. detect true peaks, the audio stream will be upsampled to 192 kHz.
  3650. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3651. The filter accepts the following options:
  3652. @table @option
  3653. @item I, i
  3654. Set integrated loudness target.
  3655. Range is -70.0 - -5.0. Default value is -24.0.
  3656. @item LRA, lra
  3657. Set loudness range target.
  3658. Range is 1.0 - 20.0. Default value is 7.0.
  3659. @item TP, tp
  3660. Set maximum true peak.
  3661. Range is -9.0 - +0.0. Default value is -2.0.
  3662. @item measured_I, measured_i
  3663. Measured IL of input file.
  3664. Range is -99.0 - +0.0.
  3665. @item measured_LRA, measured_lra
  3666. Measured LRA of input file.
  3667. Range is 0.0 - 99.0.
  3668. @item measured_TP, measured_tp
  3669. Measured true peak of input file.
  3670. Range is -99.0 - +99.0.
  3671. @item measured_thresh
  3672. Measured threshold of input file.
  3673. Range is -99.0 - +0.0.
  3674. @item offset
  3675. Set offset gain. Gain is applied before the true-peak limiter.
  3676. Range is -99.0 - +99.0. Default is +0.0.
  3677. @item linear
  3678. Normalize by linearly scaling the source audio.
  3679. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  3680. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  3681. be lower than source LRA and the change in integrated loudness shouldn't
  3682. result in a true peak which exceeds the target TP. If any of these
  3683. conditions aren't met, normalization mode will revert to @var{dynamic}.
  3684. Options are @code{true} or @code{false}. Default is @code{true}.
  3685. @item dual_mono
  3686. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3687. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3688. If set to @code{true}, this option will compensate for this effect.
  3689. Multi-channel input files are not affected by this option.
  3690. Options are true or false. Default is false.
  3691. @item print_format
  3692. Set print format for stats. Options are summary, json, or none.
  3693. Default value is none.
  3694. @end table
  3695. @section lowpass
  3696. Apply a low-pass filter with 3dB point frequency.
  3697. The filter can be either single-pole or double-pole (the default).
  3698. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3699. The filter accepts the following options:
  3700. @table @option
  3701. @item frequency, f
  3702. Set frequency in Hz. Default is 500.
  3703. @item poles, p
  3704. Set number of poles. Default is 2.
  3705. @item width_type, t
  3706. Set method to specify band-width of filter.
  3707. @table @option
  3708. @item h
  3709. Hz
  3710. @item q
  3711. Q-Factor
  3712. @item o
  3713. octave
  3714. @item s
  3715. slope
  3716. @item k
  3717. kHz
  3718. @end table
  3719. @item width, w
  3720. Specify the band-width of a filter in width_type units.
  3721. Applies only to double-pole filter.
  3722. The default is 0.707q and gives a Butterworth response.
  3723. @item mix, m
  3724. How much to use filtered signal in output. Default is 1.
  3725. Range is between 0 and 1.
  3726. @item channels, c
  3727. Specify which channels to filter, by default all available are filtered.
  3728. @item normalize, n
  3729. Normalize biquad coefficients, by default is disabled.
  3730. Enabling it will normalize magnitude response at DC to 0dB.
  3731. @item transform, a
  3732. Set transform type of IIR filter.
  3733. @table @option
  3734. @item di
  3735. @item dii
  3736. @item tdii
  3737. @item latt
  3738. @end table
  3739. @item precision, r
  3740. Set precison of filtering.
  3741. @table @option
  3742. @item auto
  3743. Pick automatic sample format depending on surround filters.
  3744. @item s16
  3745. Always use signed 16-bit.
  3746. @item s32
  3747. Always use signed 32-bit.
  3748. @item f32
  3749. Always use float 32-bit.
  3750. @item f64
  3751. Always use float 64-bit.
  3752. @end table
  3753. @end table
  3754. @subsection Examples
  3755. @itemize
  3756. @item
  3757. Lowpass only LFE channel, it LFE is not present it does nothing:
  3758. @example
  3759. lowpass=c=LFE
  3760. @end example
  3761. @end itemize
  3762. @subsection Commands
  3763. This filter supports the following commands:
  3764. @table @option
  3765. @item frequency, f
  3766. Change lowpass frequency.
  3767. Syntax for the command is : "@var{frequency}"
  3768. @item width_type, t
  3769. Change lowpass width_type.
  3770. Syntax for the command is : "@var{width_type}"
  3771. @item width, w
  3772. Change lowpass width.
  3773. Syntax for the command is : "@var{width}"
  3774. @item mix, m
  3775. Change lowpass mix.
  3776. Syntax for the command is : "@var{mix}"
  3777. @end table
  3778. @section lv2
  3779. Load a LV2 (LADSPA Version 2) plugin.
  3780. To enable compilation of this filter you need to configure FFmpeg with
  3781. @code{--enable-lv2}.
  3782. @table @option
  3783. @item plugin, p
  3784. Specifies the plugin URI. You may need to escape ':'.
  3785. @item controls, c
  3786. Set the '|' separated list of controls which are zero or more floating point
  3787. values that determine the behavior of the loaded plugin (for example delay,
  3788. threshold or gain).
  3789. If @option{controls} is set to @code{help}, all available controls and
  3790. their valid ranges are printed.
  3791. @item sample_rate, s
  3792. Specify the sample rate, default to 44100. Only used if plugin have
  3793. zero inputs.
  3794. @item nb_samples, n
  3795. Set the number of samples per channel per each output frame, default
  3796. is 1024. Only used if plugin have zero inputs.
  3797. @item duration, d
  3798. Set the minimum duration of the sourced audio. See
  3799. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3800. for the accepted syntax.
  3801. Note that the resulting duration may be greater than the specified duration,
  3802. as the generated audio is always cut at the end of a complete frame.
  3803. If not specified, or the expressed duration is negative, the audio is
  3804. supposed to be generated forever.
  3805. Only used if plugin have zero inputs.
  3806. @end table
  3807. @subsection Examples
  3808. @itemize
  3809. @item
  3810. Apply bass enhancer plugin from Calf:
  3811. @example
  3812. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3813. @end example
  3814. @item
  3815. Apply vinyl plugin from Calf:
  3816. @example
  3817. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3818. @end example
  3819. @item
  3820. Apply bit crusher plugin from ArtyFX:
  3821. @example
  3822. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3823. @end example
  3824. @end itemize
  3825. @section mcompand
  3826. Multiband Compress or expand the audio's dynamic range.
  3827. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3828. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3829. response when absent compander action.
  3830. It accepts the following parameters:
  3831. @table @option
  3832. @item args
  3833. This option syntax is:
  3834. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3835. For explanation of each item refer to compand filter documentation.
  3836. @end table
  3837. @anchor{pan}
  3838. @section pan
  3839. Mix channels with specific gain levels. The filter accepts the output
  3840. channel layout followed by a set of channels definitions.
  3841. This filter is also designed to efficiently remap the channels of an audio
  3842. stream.
  3843. The filter accepts parameters of the form:
  3844. "@var{l}|@var{outdef}|@var{outdef}|..."
  3845. @table @option
  3846. @item l
  3847. output channel layout or number of channels
  3848. @item outdef
  3849. output channel specification, of the form:
  3850. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3851. @item out_name
  3852. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3853. number (c0, c1, etc.)
  3854. @item gain
  3855. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3856. @item in_name
  3857. input channel to use, see out_name for details; it is not possible to mix
  3858. named and numbered input channels
  3859. @end table
  3860. If the `=' in a channel specification is replaced by `<', then the gains for
  3861. that specification will be renormalized so that the total is 1, thus
  3862. avoiding clipping noise.
  3863. @subsection Mixing examples
  3864. For example, if you want to down-mix from stereo to mono, but with a bigger
  3865. factor for the left channel:
  3866. @example
  3867. pan=1c|c0=0.9*c0+0.1*c1
  3868. @end example
  3869. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3870. 7-channels surround:
  3871. @example
  3872. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3873. @end example
  3874. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3875. that should be preferred (see "-ac" option) unless you have very specific
  3876. needs.
  3877. @subsection Remapping examples
  3878. The channel remapping will be effective if, and only if:
  3879. @itemize
  3880. @item gain coefficients are zeroes or ones,
  3881. @item only one input per channel output,
  3882. @end itemize
  3883. If all these conditions are satisfied, the filter will notify the user ("Pure
  3884. channel mapping detected"), and use an optimized and lossless method to do the
  3885. remapping.
  3886. For example, if you have a 5.1 source and want a stereo audio stream by
  3887. dropping the extra channels:
  3888. @example
  3889. pan="stereo| c0=FL | c1=FR"
  3890. @end example
  3891. Given the same source, you can also switch front left and front right channels
  3892. and keep the input channel layout:
  3893. @example
  3894. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3895. @end example
  3896. If the input is a stereo audio stream, you can mute the front left channel (and
  3897. still keep the stereo channel layout) with:
  3898. @example
  3899. pan="stereo|c1=c1"
  3900. @end example
  3901. Still with a stereo audio stream input, you can copy the right channel in both
  3902. front left and right:
  3903. @example
  3904. pan="stereo| c0=FR | c1=FR"
  3905. @end example
  3906. @section replaygain
  3907. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3908. outputs it unchanged.
  3909. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3910. @section resample
  3911. Convert the audio sample format, sample rate and channel layout. It is
  3912. not meant to be used directly.
  3913. @section rubberband
  3914. Apply time-stretching and pitch-shifting with librubberband.
  3915. To enable compilation of this filter, you need to configure FFmpeg with
  3916. @code{--enable-librubberband}.
  3917. The filter accepts the following options:
  3918. @table @option
  3919. @item tempo
  3920. Set tempo scale factor.
  3921. @item pitch
  3922. Set pitch scale factor.
  3923. @item transients
  3924. Set transients detector.
  3925. Possible values are:
  3926. @table @var
  3927. @item crisp
  3928. @item mixed
  3929. @item smooth
  3930. @end table
  3931. @item detector
  3932. Set detector.
  3933. Possible values are:
  3934. @table @var
  3935. @item compound
  3936. @item percussive
  3937. @item soft
  3938. @end table
  3939. @item phase
  3940. Set phase.
  3941. Possible values are:
  3942. @table @var
  3943. @item laminar
  3944. @item independent
  3945. @end table
  3946. @item window
  3947. Set processing window size.
  3948. Possible values are:
  3949. @table @var
  3950. @item standard
  3951. @item short
  3952. @item long
  3953. @end table
  3954. @item smoothing
  3955. Set smoothing.
  3956. Possible values are:
  3957. @table @var
  3958. @item off
  3959. @item on
  3960. @end table
  3961. @item formant
  3962. Enable formant preservation when shift pitching.
  3963. Possible values are:
  3964. @table @var
  3965. @item shifted
  3966. @item preserved
  3967. @end table
  3968. @item pitchq
  3969. Set pitch quality.
  3970. Possible values are:
  3971. @table @var
  3972. @item quality
  3973. @item speed
  3974. @item consistency
  3975. @end table
  3976. @item channels
  3977. Set channels.
  3978. Possible values are:
  3979. @table @var
  3980. @item apart
  3981. @item together
  3982. @end table
  3983. @end table
  3984. @subsection Commands
  3985. This filter supports the following commands:
  3986. @table @option
  3987. @item tempo
  3988. Change filter tempo scale factor.
  3989. Syntax for the command is : "@var{tempo}"
  3990. @item pitch
  3991. Change filter pitch scale factor.
  3992. Syntax for the command is : "@var{pitch}"
  3993. @end table
  3994. @section sidechaincompress
  3995. This filter acts like normal compressor but has the ability to compress
  3996. detected signal using second input signal.
  3997. It needs two input streams and returns one output stream.
  3998. First input stream will be processed depending on second stream signal.
  3999. The filtered signal then can be filtered with other filters in later stages of
  4000. processing. See @ref{pan} and @ref{amerge} filter.
  4001. The filter accepts the following options:
  4002. @table @option
  4003. @item level_in
  4004. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4005. @item mode
  4006. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4007. Default is @code{downward}.
  4008. @item threshold
  4009. If a signal of second stream raises above this level it will affect the gain
  4010. reduction of first stream.
  4011. By default is 0.125. Range is between 0.00097563 and 1.
  4012. @item ratio
  4013. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4014. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4015. Default is 2. Range is between 1 and 20.
  4016. @item attack
  4017. Amount of milliseconds the signal has to rise above the threshold before gain
  4018. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4019. @item release
  4020. Amount of milliseconds the signal has to fall below the threshold before
  4021. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4022. @item makeup
  4023. Set the amount by how much signal will be amplified after processing.
  4024. Default is 1. Range is from 1 to 64.
  4025. @item knee
  4026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4027. Default is 2.82843. Range is between 1 and 8.
  4028. @item link
  4029. Choose if the @code{average} level between all channels of side-chain stream
  4030. or the louder(@code{maximum}) channel of side-chain stream affects the
  4031. reduction. Default is @code{average}.
  4032. @item detection
  4033. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4034. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4035. @item level_sc
  4036. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4037. @item mix
  4038. How much to use compressed signal in output. Default is 1.
  4039. Range is between 0 and 1.
  4040. @end table
  4041. @subsection Commands
  4042. This filter supports the all above options as @ref{commands}.
  4043. @subsection Examples
  4044. @itemize
  4045. @item
  4046. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4047. depending on the signal of 2nd input and later compressed signal to be
  4048. merged with 2nd input:
  4049. @example
  4050. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4051. @end example
  4052. @end itemize
  4053. @section sidechaingate
  4054. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4055. filter the detected signal before sending it to the gain reduction stage.
  4056. Normally a gate uses the full range signal to detect a level above the
  4057. threshold.
  4058. For example: If you cut all lower frequencies from your sidechain signal
  4059. the gate will decrease the volume of your track only if not enough highs
  4060. appear. With this technique you are able to reduce the resonation of a
  4061. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4062. guitar.
  4063. It needs two input streams and returns one output stream.
  4064. First input stream will be processed depending on second stream signal.
  4065. The filter accepts the following options:
  4066. @table @option
  4067. @item level_in
  4068. Set input level before filtering.
  4069. Default is 1. Allowed range is from 0.015625 to 64.
  4070. @item mode
  4071. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4072. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4073. will be amplified, expanding dynamic range in upward direction.
  4074. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4075. @item range
  4076. Set the level of gain reduction when the signal is below the threshold.
  4077. Default is 0.06125. Allowed range is from 0 to 1.
  4078. Setting this to 0 disables reduction and then filter behaves like expander.
  4079. @item threshold
  4080. If a signal rises above this level the gain reduction is released.
  4081. Default is 0.125. Allowed range is from 0 to 1.
  4082. @item ratio
  4083. Set a ratio about which the signal is reduced.
  4084. Default is 2. Allowed range is from 1 to 9000.
  4085. @item attack
  4086. Amount of milliseconds the signal has to rise above the threshold before gain
  4087. reduction stops.
  4088. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4089. @item release
  4090. Amount of milliseconds the signal has to fall below the threshold before the
  4091. reduction is increased again. Default is 250 milliseconds.
  4092. Allowed range is from 0.01 to 9000.
  4093. @item makeup
  4094. Set amount of amplification of signal after processing.
  4095. Default is 1. Allowed range is from 1 to 64.
  4096. @item knee
  4097. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4098. Default is 2.828427125. Allowed range is from 1 to 8.
  4099. @item detection
  4100. Choose if exact signal should be taken for detection or an RMS like one.
  4101. Default is rms. Can be peak or rms.
  4102. @item link
  4103. Choose if the average level between all channels or the louder channel affects
  4104. the reduction.
  4105. Default is average. Can be average or maximum.
  4106. @item level_sc
  4107. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4108. @end table
  4109. @subsection Commands
  4110. This filter supports the all above options as @ref{commands}.
  4111. @section silencedetect
  4112. Detect silence in an audio stream.
  4113. This filter logs a message when it detects that the input audio volume is less
  4114. or equal to a noise tolerance value for a duration greater or equal to the
  4115. minimum detected noise duration.
  4116. The printed times and duration are expressed in seconds. The
  4117. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4118. is set on the first frame whose timestamp equals or exceeds the detection
  4119. duration and it contains the timestamp of the first frame of the silence.
  4120. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4121. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4122. keys are set on the first frame after the silence. If @option{mono} is
  4123. enabled, and each channel is evaluated separately, the @code{.X}
  4124. suffixed keys are used, and @code{X} corresponds to the channel number.
  4125. The filter accepts the following options:
  4126. @table @option
  4127. @item noise, n
  4128. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4129. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4130. @item duration, d
  4131. Set silence duration until notification (default is 2 seconds). See
  4132. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4133. for the accepted syntax.
  4134. @item mono, m
  4135. Process each channel separately, instead of combined. By default is disabled.
  4136. @end table
  4137. @subsection Examples
  4138. @itemize
  4139. @item
  4140. Detect 5 seconds of silence with -50dB noise tolerance:
  4141. @example
  4142. silencedetect=n=-50dB:d=5
  4143. @end example
  4144. @item
  4145. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4146. tolerance in @file{silence.mp3}:
  4147. @example
  4148. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4149. @end example
  4150. @end itemize
  4151. @section silenceremove
  4152. Remove silence from the beginning, middle or end of the audio.
  4153. The filter accepts the following options:
  4154. @table @option
  4155. @item start_periods
  4156. This value is used to indicate if audio should be trimmed at beginning of
  4157. the audio. A value of zero indicates no silence should be trimmed from the
  4158. beginning. When specifying a non-zero value, it trims audio up until it
  4159. finds non-silence. Normally, when trimming silence from beginning of audio
  4160. the @var{start_periods} will be @code{1} but it can be increased to higher
  4161. values to trim all audio up to specific count of non-silence periods.
  4162. Default value is @code{0}.
  4163. @item start_duration
  4164. Specify the amount of time that non-silence must be detected before it stops
  4165. trimming audio. By increasing the duration, bursts of noises can be treated
  4166. as silence and trimmed off. Default value is @code{0}.
  4167. @item start_threshold
  4168. This indicates what sample value should be treated as silence. For digital
  4169. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4170. you may wish to increase the value to account for background noise.
  4171. Can be specified in dB (in case "dB" is appended to the specified value)
  4172. or amplitude ratio. Default value is @code{0}.
  4173. @item start_silence
  4174. Specify max duration of silence at beginning that will be kept after
  4175. trimming. Default is 0, which is equal to trimming all samples detected
  4176. as silence.
  4177. @item start_mode
  4178. Specify mode of detection of silence end in start of multi-channel audio.
  4179. Can be @var{any} or @var{all}. Default is @var{any}.
  4180. With @var{any}, any sample that is detected as non-silence will cause
  4181. stopped trimming of silence.
  4182. With @var{all}, only if all channels are detected as non-silence will cause
  4183. stopped trimming of silence.
  4184. @item stop_periods
  4185. Set the count for trimming silence from the end of audio.
  4186. To remove silence from the middle of a file, specify a @var{stop_periods}
  4187. that is negative. This value is then treated as a positive value and is
  4188. used to indicate the effect should restart processing as specified by
  4189. @var{start_periods}, making it suitable for removing periods of silence
  4190. in the middle of the audio.
  4191. Default value is @code{0}.
  4192. @item stop_duration
  4193. Specify a duration of silence that must exist before audio is not copied any
  4194. more. By specifying a higher duration, silence that is wanted can be left in
  4195. the audio.
  4196. Default value is @code{0}.
  4197. @item stop_threshold
  4198. This is the same as @option{start_threshold} but for trimming silence from
  4199. the end of audio.
  4200. Can be specified in dB (in case "dB" is appended to the specified value)
  4201. or amplitude ratio. Default value is @code{0}.
  4202. @item stop_silence
  4203. Specify max duration of silence at end that will be kept after
  4204. trimming. Default is 0, which is equal to trimming all samples detected
  4205. as silence.
  4206. @item stop_mode
  4207. Specify mode of detection of silence start in end of multi-channel audio.
  4208. Can be @var{any} or @var{all}. Default is @var{any}.
  4209. With @var{any}, any sample that is detected as non-silence will cause
  4210. stopped trimming of silence.
  4211. With @var{all}, only if all channels are detected as non-silence will cause
  4212. stopped trimming of silence.
  4213. @item detection
  4214. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4215. and works better with digital silence which is exactly 0.
  4216. Default value is @code{rms}.
  4217. @item window
  4218. Set duration in number of seconds used to calculate size of window in number
  4219. of samples for detecting silence.
  4220. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4221. @end table
  4222. @subsection Examples
  4223. @itemize
  4224. @item
  4225. The following example shows how this filter can be used to start a recording
  4226. that does not contain the delay at the start which usually occurs between
  4227. pressing the record button and the start of the performance:
  4228. @example
  4229. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4230. @end example
  4231. @item
  4232. Trim all silence encountered from beginning to end where there is more than 1
  4233. second of silence in audio:
  4234. @example
  4235. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4236. @end example
  4237. @item
  4238. Trim all digital silence samples, using peak detection, from beginning to end
  4239. where there is more than 0 samples of digital silence in audio and digital
  4240. silence is detected in all channels at same positions in stream:
  4241. @example
  4242. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4243. @end example
  4244. @end itemize
  4245. @section sofalizer
  4246. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4247. loudspeakers around the user for binaural listening via headphones (audio
  4248. formats up to 9 channels supported).
  4249. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4250. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4251. Austrian Academy of Sciences.
  4252. To enable compilation of this filter you need to configure FFmpeg with
  4253. @code{--enable-libmysofa}.
  4254. The filter accepts the following options:
  4255. @table @option
  4256. @item sofa
  4257. Set the SOFA file used for rendering.
  4258. @item gain
  4259. Set gain applied to audio. Value is in dB. Default is 0.
  4260. @item rotation
  4261. Set rotation of virtual loudspeakers in deg. Default is 0.
  4262. @item elevation
  4263. Set elevation of virtual speakers in deg. Default is 0.
  4264. @item radius
  4265. Set distance in meters between loudspeakers and the listener with near-field
  4266. HRTFs. Default is 1.
  4267. @item type
  4268. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4269. processing audio in time domain which is slow.
  4270. @var{freq} is processing audio in frequency domain which is fast.
  4271. Default is @var{freq}.
  4272. @item speakers
  4273. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4274. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4275. Each virtual loudspeaker is described with short channel name following with
  4276. azimuth and elevation in degrees.
  4277. Each virtual loudspeaker description is separated by '|'.
  4278. For example to override front left and front right channel positions use:
  4279. 'speakers=FL 45 15|FR 345 15'.
  4280. Descriptions with unrecognised channel names are ignored.
  4281. @item lfegain
  4282. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4283. @item framesize
  4284. Set custom frame size in number of samples. Default is 1024.
  4285. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4286. is set to @var{freq}.
  4287. @item normalize
  4288. Should all IRs be normalized upon importing SOFA file.
  4289. By default is enabled.
  4290. @item interpolate
  4291. Should nearest IRs be interpolated with neighbor IRs if exact position
  4292. does not match. By default is disabled.
  4293. @item minphase
  4294. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4295. @item anglestep
  4296. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4297. @item radstep
  4298. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4299. @end table
  4300. @subsection Examples
  4301. @itemize
  4302. @item
  4303. Using ClubFritz6 sofa file:
  4304. @example
  4305. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4306. @end example
  4307. @item
  4308. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4309. @example
  4310. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4311. @end example
  4312. @item
  4313. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4314. and also with custom gain:
  4315. @example
  4316. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4317. @end example
  4318. @end itemize
  4319. @section speechnorm
  4320. Speech Normalizer.
  4321. This filter expands or compresses each half-cycle of audio samples
  4322. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4323. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4324. The filter accepts the following options:
  4325. @table @option
  4326. @item peak, p
  4327. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4328. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4329. @item expansion, e
  4330. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4331. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4332. would be such that local peak value reaches target peak value but never to surpass it and that
  4333. ratio between new and previous peak value does not surpass this option value.
  4334. @item compression, c
  4335. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4336. This option controls maximum local half-cycle of samples compression. This option is used
  4337. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4338. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4339. that peak's half-cycle will be compressed by current compression factor.
  4340. @item threshold, t
  4341. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4342. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4343. Any half-cycle samples with their local peak value below or same as this option value will be
  4344. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4345. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4346. @item raise, r
  4347. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4348. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4349. each new half-cycle until it reaches @option{expansion} value.
  4350. Setting this options too high may lead to distortions.
  4351. @item fall, f
  4352. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4353. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4354. each new half-cycle until it reaches @option{compression} value.
  4355. @item channels, h
  4356. Specify which channels to filter, by default all available channels are filtered.
  4357. @item invert, i
  4358. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4359. option. When enabled any half-cycle of samples with their local peak value below or same as
  4360. @option{threshold} option will be expanded otherwise it will be compressed.
  4361. @item link, l
  4362. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4363. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4364. is enabled the minimum of all possible gains for each filtered channel is used.
  4365. @end table
  4366. @subsection Commands
  4367. This filter supports the all above options as @ref{commands}.
  4368. @section stereotools
  4369. This filter has some handy utilities to manage stereo signals, for converting
  4370. M/S stereo recordings to L/R signal while having control over the parameters
  4371. or spreading the stereo image of master track.
  4372. The filter accepts the following options:
  4373. @table @option
  4374. @item level_in
  4375. Set input level before filtering for both channels. Defaults is 1.
  4376. Allowed range is from 0.015625 to 64.
  4377. @item level_out
  4378. Set output level after filtering for both channels. Defaults is 1.
  4379. Allowed range is from 0.015625 to 64.
  4380. @item balance_in
  4381. Set input balance between both channels. Default is 0.
  4382. Allowed range is from -1 to 1.
  4383. @item balance_out
  4384. Set output balance between both channels. Default is 0.
  4385. Allowed range is from -1 to 1.
  4386. @item softclip
  4387. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4388. clipping. Disabled by default.
  4389. @item mutel
  4390. Mute the left channel. Disabled by default.
  4391. @item muter
  4392. Mute the right channel. Disabled by default.
  4393. @item phasel
  4394. Change the phase of the left channel. Disabled by default.
  4395. @item phaser
  4396. Change the phase of the right channel. Disabled by default.
  4397. @item mode
  4398. Set stereo mode. Available values are:
  4399. @table @samp
  4400. @item lr>lr
  4401. Left/Right to Left/Right, this is default.
  4402. @item lr>ms
  4403. Left/Right to Mid/Side.
  4404. @item ms>lr
  4405. Mid/Side to Left/Right.
  4406. @item lr>ll
  4407. Left/Right to Left/Left.
  4408. @item lr>rr
  4409. Left/Right to Right/Right.
  4410. @item lr>l+r
  4411. Left/Right to Left + Right.
  4412. @item lr>rl
  4413. Left/Right to Right/Left.
  4414. @item ms>ll
  4415. Mid/Side to Left/Left.
  4416. @item ms>rr
  4417. Mid/Side to Right/Right.
  4418. @item ms>rl
  4419. Mid/Side to Right/Left.
  4420. @item lr>l-r
  4421. Left/Right to Left - Right.
  4422. @end table
  4423. @item slev
  4424. Set level of side signal. Default is 1.
  4425. Allowed range is from 0.015625 to 64.
  4426. @item sbal
  4427. Set balance of side signal. Default is 0.
  4428. Allowed range is from -1 to 1.
  4429. @item mlev
  4430. Set level of the middle signal. Default is 1.
  4431. Allowed range is from 0.015625 to 64.
  4432. @item mpan
  4433. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4434. @item base
  4435. Set stereo base between mono and inversed channels. Default is 0.
  4436. Allowed range is from -1 to 1.
  4437. @item delay
  4438. Set delay in milliseconds how much to delay left from right channel and
  4439. vice versa. Default is 0. Allowed range is from -20 to 20.
  4440. @item sclevel
  4441. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4442. @item phase
  4443. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4444. @item bmode_in, bmode_out
  4445. Set balance mode for balance_in/balance_out option.
  4446. Can be one of the following:
  4447. @table @samp
  4448. @item balance
  4449. Classic balance mode. Attenuate one channel at time.
  4450. Gain is raised up to 1.
  4451. @item amplitude
  4452. Similar as classic mode above but gain is raised up to 2.
  4453. @item power
  4454. Equal power distribution, from -6dB to +6dB range.
  4455. @end table
  4456. @end table
  4457. @subsection Commands
  4458. This filter supports the all above options as @ref{commands}.
  4459. @subsection Examples
  4460. @itemize
  4461. @item
  4462. Apply karaoke like effect:
  4463. @example
  4464. stereotools=mlev=0.015625
  4465. @end example
  4466. @item
  4467. Convert M/S signal to L/R:
  4468. @example
  4469. "stereotools=mode=ms>lr"
  4470. @end example
  4471. @end itemize
  4472. @section stereowiden
  4473. This filter enhance the stereo effect by suppressing signal common to both
  4474. channels and by delaying the signal of left into right and vice versa,
  4475. thereby widening the stereo effect.
  4476. The filter accepts the following options:
  4477. @table @option
  4478. @item delay
  4479. Time in milliseconds of the delay of left signal into right and vice versa.
  4480. Default is 20 milliseconds.
  4481. @item feedback
  4482. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4483. effect of left signal in right output and vice versa which gives widening
  4484. effect. Default is 0.3.
  4485. @item crossfeed
  4486. Cross feed of left into right with inverted phase. This helps in suppressing
  4487. the mono. If the value is 1 it will cancel all the signal common to both
  4488. channels. Default is 0.3.
  4489. @item drymix
  4490. Set level of input signal of original channel. Default is 0.8.
  4491. @end table
  4492. @subsection Commands
  4493. This filter supports the all above options except @code{delay} as @ref{commands}.
  4494. @section superequalizer
  4495. Apply 18 band equalizer.
  4496. The filter accepts the following options:
  4497. @table @option
  4498. @item 1b
  4499. Set 65Hz band gain.
  4500. @item 2b
  4501. Set 92Hz band gain.
  4502. @item 3b
  4503. Set 131Hz band gain.
  4504. @item 4b
  4505. Set 185Hz band gain.
  4506. @item 5b
  4507. Set 262Hz band gain.
  4508. @item 6b
  4509. Set 370Hz band gain.
  4510. @item 7b
  4511. Set 523Hz band gain.
  4512. @item 8b
  4513. Set 740Hz band gain.
  4514. @item 9b
  4515. Set 1047Hz band gain.
  4516. @item 10b
  4517. Set 1480Hz band gain.
  4518. @item 11b
  4519. Set 2093Hz band gain.
  4520. @item 12b
  4521. Set 2960Hz band gain.
  4522. @item 13b
  4523. Set 4186Hz band gain.
  4524. @item 14b
  4525. Set 5920Hz band gain.
  4526. @item 15b
  4527. Set 8372Hz band gain.
  4528. @item 16b
  4529. Set 11840Hz band gain.
  4530. @item 17b
  4531. Set 16744Hz band gain.
  4532. @item 18b
  4533. Set 20000Hz band gain.
  4534. @end table
  4535. @section surround
  4536. Apply audio surround upmix filter.
  4537. This filter allows to produce multichannel output from audio stream.
  4538. The filter accepts the following options:
  4539. @table @option
  4540. @item chl_out
  4541. Set output channel layout. By default, this is @var{5.1}.
  4542. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4543. for the required syntax.
  4544. @item chl_in
  4545. Set input channel layout. By default, this is @var{stereo}.
  4546. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4547. for the required syntax.
  4548. @item level_in
  4549. Set input volume level. By default, this is @var{1}.
  4550. @item level_out
  4551. Set output volume level. By default, this is @var{1}.
  4552. @item lfe
  4553. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4554. @item lfe_low
  4555. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4556. @item lfe_high
  4557. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4558. @item lfe_mode
  4559. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4560. In @var{add} mode, LFE channel is created from input audio and added to output.
  4561. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4562. also all non-LFE output channels are subtracted with output LFE channel.
  4563. @item angle
  4564. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4565. Default is @var{90}.
  4566. @item fc_in
  4567. Set front center input volume. By default, this is @var{1}.
  4568. @item fc_out
  4569. Set front center output volume. By default, this is @var{1}.
  4570. @item fl_in
  4571. Set front left input volume. By default, this is @var{1}.
  4572. @item fl_out
  4573. Set front left output volume. By default, this is @var{1}.
  4574. @item fr_in
  4575. Set front right input volume. By default, this is @var{1}.
  4576. @item fr_out
  4577. Set front right output volume. By default, this is @var{1}.
  4578. @item sl_in
  4579. Set side left input volume. By default, this is @var{1}.
  4580. @item sl_out
  4581. Set side left output volume. By default, this is @var{1}.
  4582. @item sr_in
  4583. Set side right input volume. By default, this is @var{1}.
  4584. @item sr_out
  4585. Set side right output volume. By default, this is @var{1}.
  4586. @item bl_in
  4587. Set back left input volume. By default, this is @var{1}.
  4588. @item bl_out
  4589. Set back left output volume. By default, this is @var{1}.
  4590. @item br_in
  4591. Set back right input volume. By default, this is @var{1}.
  4592. @item br_out
  4593. Set back right output volume. By default, this is @var{1}.
  4594. @item bc_in
  4595. Set back center input volume. By default, this is @var{1}.
  4596. @item bc_out
  4597. Set back center output volume. By default, this is @var{1}.
  4598. @item lfe_in
  4599. Set LFE input volume. By default, this is @var{1}.
  4600. @item lfe_out
  4601. Set LFE output volume. By default, this is @var{1}.
  4602. @item allx
  4603. Set spread usage of stereo image across X axis for all channels.
  4604. @item ally
  4605. Set spread usage of stereo image across Y axis for all channels.
  4606. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4607. Set spread usage of stereo image across X axis for each channel.
  4608. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4609. Set spread usage of stereo image across Y axis for each channel.
  4610. @item win_size
  4611. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4612. @item win_func
  4613. Set window function.
  4614. It accepts the following values:
  4615. @table @samp
  4616. @item rect
  4617. @item bartlett
  4618. @item hann, hanning
  4619. @item hamming
  4620. @item blackman
  4621. @item welch
  4622. @item flattop
  4623. @item bharris
  4624. @item bnuttall
  4625. @item bhann
  4626. @item sine
  4627. @item nuttall
  4628. @item lanczos
  4629. @item gauss
  4630. @item tukey
  4631. @item dolph
  4632. @item cauchy
  4633. @item parzen
  4634. @item poisson
  4635. @item bohman
  4636. @end table
  4637. Default is @code{hann}.
  4638. @item overlap
  4639. Set window overlap. If set to 1, the recommended overlap for selected
  4640. window function will be picked. Default is @code{0.5}.
  4641. @end table
  4642. @section treble, highshelf
  4643. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4644. shelving filter with a response similar to that of a standard
  4645. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4646. The filter accepts the following options:
  4647. @table @option
  4648. @item gain, g
  4649. Give the gain at whichever is the lower of ~22 kHz and the
  4650. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4651. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4652. @item frequency, f
  4653. Set the filter's central frequency and so can be used
  4654. to extend or reduce the frequency range to be boosted or cut.
  4655. The default value is @code{3000} Hz.
  4656. @item width_type, t
  4657. Set method to specify band-width of filter.
  4658. @table @option
  4659. @item h
  4660. Hz
  4661. @item q
  4662. Q-Factor
  4663. @item o
  4664. octave
  4665. @item s
  4666. slope
  4667. @item k
  4668. kHz
  4669. @end table
  4670. @item width, w
  4671. Determine how steep is the filter's shelf transition.
  4672. @item mix, m
  4673. How much to use filtered signal in output. Default is 1.
  4674. Range is between 0 and 1.
  4675. @item channels, c
  4676. Specify which channels to filter, by default all available are filtered.
  4677. @item normalize, n
  4678. Normalize biquad coefficients, by default is disabled.
  4679. Enabling it will normalize magnitude response at DC to 0dB.
  4680. @item transform, a
  4681. Set transform type of IIR filter.
  4682. @table @option
  4683. @item di
  4684. @item dii
  4685. @item tdii
  4686. @item latt
  4687. @end table
  4688. @item precision, r
  4689. Set precison of filtering.
  4690. @table @option
  4691. @item auto
  4692. Pick automatic sample format depending on surround filters.
  4693. @item s16
  4694. Always use signed 16-bit.
  4695. @item s32
  4696. Always use signed 32-bit.
  4697. @item f32
  4698. Always use float 32-bit.
  4699. @item f64
  4700. Always use float 64-bit.
  4701. @end table
  4702. @end table
  4703. @subsection Commands
  4704. This filter supports the following commands:
  4705. @table @option
  4706. @item frequency, f
  4707. Change treble frequency.
  4708. Syntax for the command is : "@var{frequency}"
  4709. @item width_type, t
  4710. Change treble width_type.
  4711. Syntax for the command is : "@var{width_type}"
  4712. @item width, w
  4713. Change treble width.
  4714. Syntax for the command is : "@var{width}"
  4715. @item gain, g
  4716. Change treble gain.
  4717. Syntax for the command is : "@var{gain}"
  4718. @item mix, m
  4719. Change treble mix.
  4720. Syntax for the command is : "@var{mix}"
  4721. @end table
  4722. @section tremolo
  4723. Sinusoidal amplitude modulation.
  4724. The filter accepts the following options:
  4725. @table @option
  4726. @item f
  4727. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4728. (20 Hz or lower) will result in a tremolo effect.
  4729. This filter may also be used as a ring modulator by specifying
  4730. a modulation frequency higher than 20 Hz.
  4731. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4732. @item d
  4733. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4734. Default value is 0.5.
  4735. @end table
  4736. @section vibrato
  4737. Sinusoidal phase modulation.
  4738. The filter accepts the following options:
  4739. @table @option
  4740. @item f
  4741. Modulation frequency in Hertz.
  4742. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4743. @item d
  4744. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4745. Default value is 0.5.
  4746. @end table
  4747. @section volume
  4748. Adjust the input audio volume.
  4749. It accepts the following parameters:
  4750. @table @option
  4751. @item volume
  4752. Set audio volume expression.
  4753. Output values are clipped to the maximum value.
  4754. The output audio volume is given by the relation:
  4755. @example
  4756. @var{output_volume} = @var{volume} * @var{input_volume}
  4757. @end example
  4758. The default value for @var{volume} is "1.0".
  4759. @item precision
  4760. This parameter represents the mathematical precision.
  4761. It determines which input sample formats will be allowed, which affects the
  4762. precision of the volume scaling.
  4763. @table @option
  4764. @item fixed
  4765. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4766. @item float
  4767. 32-bit floating-point; this limits input sample format to FLT. (default)
  4768. @item double
  4769. 64-bit floating-point; this limits input sample format to DBL.
  4770. @end table
  4771. @item replaygain
  4772. Choose the behaviour on encountering ReplayGain side data in input frames.
  4773. @table @option
  4774. @item drop
  4775. Remove ReplayGain side data, ignoring its contents (the default).
  4776. @item ignore
  4777. Ignore ReplayGain side data, but leave it in the frame.
  4778. @item track
  4779. Prefer the track gain, if present.
  4780. @item album
  4781. Prefer the album gain, if present.
  4782. @end table
  4783. @item replaygain_preamp
  4784. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4785. Default value for @var{replaygain_preamp} is 0.0.
  4786. @item replaygain_noclip
  4787. Prevent clipping by limiting the gain applied.
  4788. Default value for @var{replaygain_noclip} is 1.
  4789. @item eval
  4790. Set when the volume expression is evaluated.
  4791. It accepts the following values:
  4792. @table @samp
  4793. @item once
  4794. only evaluate expression once during the filter initialization, or
  4795. when the @samp{volume} command is sent
  4796. @item frame
  4797. evaluate expression for each incoming frame
  4798. @end table
  4799. Default value is @samp{once}.
  4800. @end table
  4801. The volume expression can contain the following parameters.
  4802. @table @option
  4803. @item n
  4804. frame number (starting at zero)
  4805. @item nb_channels
  4806. number of channels
  4807. @item nb_consumed_samples
  4808. number of samples consumed by the filter
  4809. @item nb_samples
  4810. number of samples in the current frame
  4811. @item pos
  4812. original frame position in the file
  4813. @item pts
  4814. frame PTS
  4815. @item sample_rate
  4816. sample rate
  4817. @item startpts
  4818. PTS at start of stream
  4819. @item startt
  4820. time at start of stream
  4821. @item t
  4822. frame time
  4823. @item tb
  4824. timestamp timebase
  4825. @item volume
  4826. last set volume value
  4827. @end table
  4828. Note that when @option{eval} is set to @samp{once} only the
  4829. @var{sample_rate} and @var{tb} variables are available, all other
  4830. variables will evaluate to NAN.
  4831. @subsection Commands
  4832. This filter supports the following commands:
  4833. @table @option
  4834. @item volume
  4835. Modify the volume expression.
  4836. The command accepts the same syntax of the corresponding option.
  4837. If the specified expression is not valid, it is kept at its current
  4838. value.
  4839. @end table
  4840. @subsection Examples
  4841. @itemize
  4842. @item
  4843. Halve the input audio volume:
  4844. @example
  4845. volume=volume=0.5
  4846. volume=volume=1/2
  4847. volume=volume=-6.0206dB
  4848. @end example
  4849. In all the above example the named key for @option{volume} can be
  4850. omitted, for example like in:
  4851. @example
  4852. volume=0.5
  4853. @end example
  4854. @item
  4855. Increase input audio power by 6 decibels using fixed-point precision:
  4856. @example
  4857. volume=volume=6dB:precision=fixed
  4858. @end example
  4859. @item
  4860. Fade volume after time 10 with an annihilation period of 5 seconds:
  4861. @example
  4862. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4863. @end example
  4864. @end itemize
  4865. @section volumedetect
  4866. Detect the volume of the input video.
  4867. The filter has no parameters. The input is not modified. Statistics about
  4868. the volume will be printed in the log when the input stream end is reached.
  4869. In particular it will show the mean volume (root mean square), maximum
  4870. volume (on a per-sample basis), and the beginning of a histogram of the
  4871. registered volume values (from the maximum value to a cumulated 1/1000 of
  4872. the samples).
  4873. All volumes are in decibels relative to the maximum PCM value.
  4874. @subsection Examples
  4875. Here is an excerpt of the output:
  4876. @example
  4877. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4878. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4879. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4880. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4881. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4882. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4883. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4884. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4885. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4886. @end example
  4887. It means that:
  4888. @itemize
  4889. @item
  4890. The mean square energy is approximately -27 dB, or 10^-2.7.
  4891. @item
  4892. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4893. @item
  4894. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4895. @end itemize
  4896. In other words, raising the volume by +4 dB does not cause any clipping,
  4897. raising it by +5 dB causes clipping for 6 samples, etc.
  4898. @c man end AUDIO FILTERS
  4899. @chapter Audio Sources
  4900. @c man begin AUDIO SOURCES
  4901. Below is a description of the currently available audio sources.
  4902. @section abuffer
  4903. Buffer audio frames, and make them available to the filter chain.
  4904. This source is mainly intended for a programmatic use, in particular
  4905. through the interface defined in @file{libavfilter/buffersrc.h}.
  4906. It accepts the following parameters:
  4907. @table @option
  4908. @item time_base
  4909. The timebase which will be used for timestamps of submitted frames. It must be
  4910. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4911. @item sample_rate
  4912. The sample rate of the incoming audio buffers.
  4913. @item sample_fmt
  4914. The sample format of the incoming audio buffers.
  4915. Either a sample format name or its corresponding integer representation from
  4916. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4917. @item channel_layout
  4918. The channel layout of the incoming audio buffers.
  4919. Either a channel layout name from channel_layout_map in
  4920. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4921. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4922. @item channels
  4923. The number of channels of the incoming audio buffers.
  4924. If both @var{channels} and @var{channel_layout} are specified, then they
  4925. must be consistent.
  4926. @end table
  4927. @subsection Examples
  4928. @example
  4929. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4930. @end example
  4931. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4932. Since the sample format with name "s16p" corresponds to the number
  4933. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4934. equivalent to:
  4935. @example
  4936. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4937. @end example
  4938. @section aevalsrc
  4939. Generate an audio signal specified by an expression.
  4940. This source accepts in input one or more expressions (one for each
  4941. channel), which are evaluated and used to generate a corresponding
  4942. audio signal.
  4943. This source accepts the following options:
  4944. @table @option
  4945. @item exprs
  4946. Set the '|'-separated expressions list for each separate channel. In case the
  4947. @option{channel_layout} option is not specified, the selected channel layout
  4948. depends on the number of provided expressions. Otherwise the last
  4949. specified expression is applied to the remaining output channels.
  4950. @item channel_layout, c
  4951. Set the channel layout. The number of channels in the specified layout
  4952. must be equal to the number of specified expressions.
  4953. @item duration, d
  4954. Set the minimum duration of the sourced audio. See
  4955. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4956. for the accepted syntax.
  4957. Note that the resulting duration may be greater than the specified
  4958. duration, as the generated audio is always cut at the end of a
  4959. complete frame.
  4960. If not specified, or the expressed duration is negative, the audio is
  4961. supposed to be generated forever.
  4962. @item nb_samples, n
  4963. Set the number of samples per channel per each output frame,
  4964. default to 1024.
  4965. @item sample_rate, s
  4966. Specify the sample rate, default to 44100.
  4967. @end table
  4968. Each expression in @var{exprs} can contain the following constants:
  4969. @table @option
  4970. @item n
  4971. number of the evaluated sample, starting from 0
  4972. @item t
  4973. time of the evaluated sample expressed in seconds, starting from 0
  4974. @item s
  4975. sample rate
  4976. @end table
  4977. @subsection Examples
  4978. @itemize
  4979. @item
  4980. Generate silence:
  4981. @example
  4982. aevalsrc=0
  4983. @end example
  4984. @item
  4985. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4986. 8000 Hz:
  4987. @example
  4988. aevalsrc="sin(440*2*PI*t):s=8000"
  4989. @end example
  4990. @item
  4991. Generate a two channels signal, specify the channel layout (Front
  4992. Center + Back Center) explicitly:
  4993. @example
  4994. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4995. @end example
  4996. @item
  4997. Generate white noise:
  4998. @example
  4999. aevalsrc="-2+random(0)"
  5000. @end example
  5001. @item
  5002. Generate an amplitude modulated signal:
  5003. @example
  5004. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5005. @end example
  5006. @item
  5007. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5008. @example
  5009. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5010. @end example
  5011. @end itemize
  5012. @section afirsrc
  5013. Generate a FIR coefficients using frequency sampling method.
  5014. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5015. The filter accepts the following options:
  5016. @table @option
  5017. @item taps, t
  5018. Set number of filter coefficents in output audio stream.
  5019. Default value is 1025.
  5020. @item frequency, f
  5021. Set frequency points from where magnitude and phase are set.
  5022. This must be in non decreasing order, and first element must be 0, while last element
  5023. must be 1. Elements are separated by white spaces.
  5024. @item magnitude, m
  5025. Set magnitude value for every frequency point set by @option{frequency}.
  5026. Number of values must be same as number of frequency points.
  5027. Values are separated by white spaces.
  5028. @item phase, p
  5029. Set phase value for every frequency point set by @option{frequency}.
  5030. Number of values must be same as number of frequency points.
  5031. Values are separated by white spaces.
  5032. @item sample_rate, r
  5033. Set sample rate, default is 44100.
  5034. @item nb_samples, n
  5035. Set number of samples per each frame. Default is 1024.
  5036. @item win_func, w
  5037. Set window function. Default is blackman.
  5038. @end table
  5039. @section anullsrc
  5040. The null audio source, return unprocessed audio frames. It is mainly useful
  5041. as a template and to be employed in analysis / debugging tools, or as
  5042. the source for filters which ignore the input data (for example the sox
  5043. synth filter).
  5044. This source accepts the following options:
  5045. @table @option
  5046. @item channel_layout, cl
  5047. Specifies the channel layout, and can be either an integer or a string
  5048. representing a channel layout. The default value of @var{channel_layout}
  5049. is "stereo".
  5050. Check the channel_layout_map definition in
  5051. @file{libavutil/channel_layout.c} for the mapping between strings and
  5052. channel layout values.
  5053. @item sample_rate, r
  5054. Specifies the sample rate, and defaults to 44100.
  5055. @item nb_samples, n
  5056. Set the number of samples per requested frames.
  5057. @item duration, d
  5058. Set the duration of the sourced audio. See
  5059. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5060. for the accepted syntax.
  5061. If not specified, or the expressed duration is negative, the audio is
  5062. supposed to be generated forever.
  5063. @end table
  5064. @subsection Examples
  5065. @itemize
  5066. @item
  5067. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5068. @example
  5069. anullsrc=r=48000:cl=4
  5070. @end example
  5071. @item
  5072. Do the same operation with a more obvious syntax:
  5073. @example
  5074. anullsrc=r=48000:cl=mono
  5075. @end example
  5076. @end itemize
  5077. All the parameters need to be explicitly defined.
  5078. @section flite
  5079. Synthesize a voice utterance using the libflite library.
  5080. To enable compilation of this filter you need to configure FFmpeg with
  5081. @code{--enable-libflite}.
  5082. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5083. The filter accepts the following options:
  5084. @table @option
  5085. @item list_voices
  5086. If set to 1, list the names of the available voices and exit
  5087. immediately. Default value is 0.
  5088. @item nb_samples, n
  5089. Set the maximum number of samples per frame. Default value is 512.
  5090. @item textfile
  5091. Set the filename containing the text to speak.
  5092. @item text
  5093. Set the text to speak.
  5094. @item voice, v
  5095. Set the voice to use for the speech synthesis. Default value is
  5096. @code{kal}. See also the @var{list_voices} option.
  5097. @end table
  5098. @subsection Examples
  5099. @itemize
  5100. @item
  5101. Read from file @file{speech.txt}, and synthesize the text using the
  5102. standard flite voice:
  5103. @example
  5104. flite=textfile=speech.txt
  5105. @end example
  5106. @item
  5107. Read the specified text selecting the @code{slt} voice:
  5108. @example
  5109. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5110. @end example
  5111. @item
  5112. Input text to ffmpeg:
  5113. @example
  5114. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5115. @end example
  5116. @item
  5117. Make @file{ffplay} speak the specified text, using @code{flite} and
  5118. the @code{lavfi} device:
  5119. @example
  5120. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5121. @end example
  5122. @end itemize
  5123. For more information about libflite, check:
  5124. @url{http://www.festvox.org/flite/}
  5125. @section anoisesrc
  5126. Generate a noise audio signal.
  5127. The filter accepts the following options:
  5128. @table @option
  5129. @item sample_rate, r
  5130. Specify the sample rate. Default value is 48000 Hz.
  5131. @item amplitude, a
  5132. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5133. is 1.0.
  5134. @item duration, d
  5135. Specify the duration of the generated audio stream. Not specifying this option
  5136. results in noise with an infinite length.
  5137. @item color, colour, c
  5138. Specify the color of noise. Available noise colors are white, pink, brown,
  5139. blue, violet and velvet. Default color is white.
  5140. @item seed, s
  5141. Specify a value used to seed the PRNG.
  5142. @item nb_samples, n
  5143. Set the number of samples per each output frame, default is 1024.
  5144. @end table
  5145. @subsection Examples
  5146. @itemize
  5147. @item
  5148. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5149. @example
  5150. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5151. @end example
  5152. @end itemize
  5153. @section hilbert
  5154. Generate odd-tap Hilbert transform FIR coefficients.
  5155. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5156. the signal by 90 degrees.
  5157. This is used in many matrix coding schemes and for analytic signal generation.
  5158. The process is often written as a multiplication by i (or j), the imaginary unit.
  5159. The filter accepts the following options:
  5160. @table @option
  5161. @item sample_rate, s
  5162. Set sample rate, default is 44100.
  5163. @item taps, t
  5164. Set length of FIR filter, default is 22051.
  5165. @item nb_samples, n
  5166. Set number of samples per each frame.
  5167. @item win_func, w
  5168. Set window function to be used when generating FIR coefficients.
  5169. @end table
  5170. @section sinc
  5171. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5172. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5173. The filter accepts the following options:
  5174. @table @option
  5175. @item sample_rate, r
  5176. Set sample rate, default is 44100.
  5177. @item nb_samples, n
  5178. Set number of samples per each frame. Default is 1024.
  5179. @item hp
  5180. Set high-pass frequency. Default is 0.
  5181. @item lp
  5182. Set low-pass frequency. Default is 0.
  5183. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5184. is higher than 0 then filter will create band-pass filter coefficients,
  5185. otherwise band-reject filter coefficients.
  5186. @item phase
  5187. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5188. @item beta
  5189. Set Kaiser window beta.
  5190. @item att
  5191. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5192. @item round
  5193. Enable rounding, by default is disabled.
  5194. @item hptaps
  5195. Set number of taps for high-pass filter.
  5196. @item lptaps
  5197. Set number of taps for low-pass filter.
  5198. @end table
  5199. @section sine
  5200. Generate an audio signal made of a sine wave with amplitude 1/8.
  5201. The audio signal is bit-exact.
  5202. The filter accepts the following options:
  5203. @table @option
  5204. @item frequency, f
  5205. Set the carrier frequency. Default is 440 Hz.
  5206. @item beep_factor, b
  5207. Enable a periodic beep every second with frequency @var{beep_factor} times
  5208. the carrier frequency. Default is 0, meaning the beep is disabled.
  5209. @item sample_rate, r
  5210. Specify the sample rate, default is 44100.
  5211. @item duration, d
  5212. Specify the duration of the generated audio stream.
  5213. @item samples_per_frame
  5214. Set the number of samples per output frame.
  5215. The expression can contain the following constants:
  5216. @table @option
  5217. @item n
  5218. The (sequential) number of the output audio frame, starting from 0.
  5219. @item pts
  5220. The PTS (Presentation TimeStamp) of the output audio frame,
  5221. expressed in @var{TB} units.
  5222. @item t
  5223. The PTS of the output audio frame, expressed in seconds.
  5224. @item TB
  5225. The timebase of the output audio frames.
  5226. @end table
  5227. Default is @code{1024}.
  5228. @end table
  5229. @subsection Examples
  5230. @itemize
  5231. @item
  5232. Generate a simple 440 Hz sine wave:
  5233. @example
  5234. sine
  5235. @end example
  5236. @item
  5237. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5238. @example
  5239. sine=220:4:d=5
  5240. sine=f=220:b=4:d=5
  5241. sine=frequency=220:beep_factor=4:duration=5
  5242. @end example
  5243. @item
  5244. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5245. pattern:
  5246. @example
  5247. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5248. @end example
  5249. @end itemize
  5250. @c man end AUDIO SOURCES
  5251. @chapter Audio Sinks
  5252. @c man begin AUDIO SINKS
  5253. Below is a description of the currently available audio sinks.
  5254. @section abuffersink
  5255. Buffer audio frames, and make them available to the end of filter chain.
  5256. This sink is mainly intended for programmatic use, in particular
  5257. through the interface defined in @file{libavfilter/buffersink.h}
  5258. or the options system.
  5259. It accepts a pointer to an AVABufferSinkContext structure, which
  5260. defines the incoming buffers' formats, to be passed as the opaque
  5261. parameter to @code{avfilter_init_filter} for initialization.
  5262. @section anullsink
  5263. Null audio sink; do absolutely nothing with the input audio. It is
  5264. mainly useful as a template and for use in analysis / debugging
  5265. tools.
  5266. @c man end AUDIO SINKS
  5267. @chapter Video Filters
  5268. @c man begin VIDEO FILTERS
  5269. When you configure your FFmpeg build, you can disable any of the
  5270. existing filters using @code{--disable-filters}.
  5271. The configure output will show the video filters included in your
  5272. build.
  5273. Below is a description of the currently available video filters.
  5274. @section addroi
  5275. Mark a region of interest in a video frame.
  5276. The frame data is passed through unchanged, but metadata is attached
  5277. to the frame indicating regions of interest which can affect the
  5278. behaviour of later encoding. Multiple regions can be marked by
  5279. applying the filter multiple times.
  5280. @table @option
  5281. @item x
  5282. Region distance in pixels from the left edge of the frame.
  5283. @item y
  5284. Region distance in pixels from the top edge of the frame.
  5285. @item w
  5286. Region width in pixels.
  5287. @item h
  5288. Region height in pixels.
  5289. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5290. and may contain the following variables:
  5291. @table @option
  5292. @item iw
  5293. Width of the input frame.
  5294. @item ih
  5295. Height of the input frame.
  5296. @end table
  5297. @item qoffset
  5298. Quantisation offset to apply within the region.
  5299. This must be a real value in the range -1 to +1. A value of zero
  5300. indicates no quality change. A negative value asks for better quality
  5301. (less quantisation), while a positive value asks for worse quality
  5302. (greater quantisation).
  5303. The range is calibrated so that the extreme values indicate the
  5304. largest possible offset - if the rest of the frame is encoded with the
  5305. worst possible quality, an offset of -1 indicates that this region
  5306. should be encoded with the best possible quality anyway. Intermediate
  5307. values are then interpolated in some codec-dependent way.
  5308. For example, in 10-bit H.264 the quantisation parameter varies between
  5309. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5310. this region should be encoded with a QP around one-tenth of the full
  5311. range better than the rest of the frame. So, if most of the frame
  5312. were to be encoded with a QP of around 30, this region would get a QP
  5313. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5314. An extreme value of -1 would indicate that this region should be
  5315. encoded with the best possible quality regardless of the treatment of
  5316. the rest of the frame - that is, should be encoded at a QP of -12.
  5317. @item clear
  5318. If set to true, remove any existing regions of interest marked on the
  5319. frame before adding the new one.
  5320. @end table
  5321. @subsection Examples
  5322. @itemize
  5323. @item
  5324. Mark the centre quarter of the frame as interesting.
  5325. @example
  5326. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5327. @end example
  5328. @item
  5329. Mark the 100-pixel-wide region on the left edge of the frame as very
  5330. uninteresting (to be encoded at much lower quality than the rest of
  5331. the frame).
  5332. @example
  5333. addroi=0:0:100:ih:+1/5
  5334. @end example
  5335. @end itemize
  5336. @section alphaextract
  5337. Extract the alpha component from the input as a grayscale video. This
  5338. is especially useful with the @var{alphamerge} filter.
  5339. @section alphamerge
  5340. Add or replace the alpha component of the primary input with the
  5341. grayscale value of a second input. This is intended for use with
  5342. @var{alphaextract} to allow the transmission or storage of frame
  5343. sequences that have alpha in a format that doesn't support an alpha
  5344. channel.
  5345. For example, to reconstruct full frames from a normal YUV-encoded video
  5346. and a separate video created with @var{alphaextract}, you might use:
  5347. @example
  5348. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5349. @end example
  5350. @section amplify
  5351. Amplify differences between current pixel and pixels of adjacent frames in
  5352. same pixel location.
  5353. This filter accepts the following options:
  5354. @table @option
  5355. @item radius
  5356. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5357. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5358. @item factor
  5359. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5360. @item threshold
  5361. Set threshold for difference amplification. Any difference greater or equal to
  5362. this value will not alter source pixel. Default is 10.
  5363. Allowed range is from 0 to 65535.
  5364. @item tolerance
  5365. Set tolerance for difference amplification. Any difference lower to
  5366. this value will not alter source pixel. Default is 0.
  5367. Allowed range is from 0 to 65535.
  5368. @item low
  5369. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5370. This option controls maximum possible value that will decrease source pixel value.
  5371. @item high
  5372. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5373. This option controls maximum possible value that will increase source pixel value.
  5374. @item planes
  5375. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5376. @end table
  5377. @subsection Commands
  5378. This filter supports the following @ref{commands} that corresponds to option of same name:
  5379. @table @option
  5380. @item factor
  5381. @item threshold
  5382. @item tolerance
  5383. @item low
  5384. @item high
  5385. @item planes
  5386. @end table
  5387. @section ass
  5388. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5389. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5390. Substation Alpha) subtitles files.
  5391. This filter accepts the following option in addition to the common options from
  5392. the @ref{subtitles} filter:
  5393. @table @option
  5394. @item shaping
  5395. Set the shaping engine
  5396. Available values are:
  5397. @table @samp
  5398. @item auto
  5399. The default libass shaping engine, which is the best available.
  5400. @item simple
  5401. Fast, font-agnostic shaper that can do only substitutions
  5402. @item complex
  5403. Slower shaper using OpenType for substitutions and positioning
  5404. @end table
  5405. The default is @code{auto}.
  5406. @end table
  5407. @section atadenoise
  5408. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5409. The filter accepts the following options:
  5410. @table @option
  5411. @item 0a
  5412. Set threshold A for 1st plane. Default is 0.02.
  5413. Valid range is 0 to 0.3.
  5414. @item 0b
  5415. Set threshold B for 1st plane. Default is 0.04.
  5416. Valid range is 0 to 5.
  5417. @item 1a
  5418. Set threshold A for 2nd plane. Default is 0.02.
  5419. Valid range is 0 to 0.3.
  5420. @item 1b
  5421. Set threshold B for 2nd plane. Default is 0.04.
  5422. Valid range is 0 to 5.
  5423. @item 2a
  5424. Set threshold A for 3rd plane. Default is 0.02.
  5425. Valid range is 0 to 0.3.
  5426. @item 2b
  5427. Set threshold B for 3rd plane. Default is 0.04.
  5428. Valid range is 0 to 5.
  5429. Threshold A is designed to react on abrupt changes in the input signal and
  5430. threshold B is designed to react on continuous changes in the input signal.
  5431. @item s
  5432. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5433. number in range [5, 129].
  5434. @item p
  5435. Set what planes of frame filter will use for averaging. Default is all.
  5436. @item a
  5437. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5438. Alternatively can be set to @code{s} serial.
  5439. Parallel can be faster then serial, while other way around is never true.
  5440. Parallel will abort early on first change being greater then thresholds, while serial
  5441. will continue processing other side of frames if they are equal or below thresholds.
  5442. @end table
  5443. @subsection Commands
  5444. This filter supports same @ref{commands} as options except option @code{s}.
  5445. The command accepts the same syntax of the corresponding option.
  5446. @section avgblur
  5447. Apply average blur filter.
  5448. The filter accepts the following options:
  5449. @table @option
  5450. @item sizeX
  5451. Set horizontal radius size.
  5452. @item planes
  5453. Set which planes to filter. By default all planes are filtered.
  5454. @item sizeY
  5455. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5456. Default is @code{0}.
  5457. @end table
  5458. @subsection Commands
  5459. This filter supports same commands as options.
  5460. The command accepts the same syntax of the corresponding option.
  5461. If the specified expression is not valid, it is kept at its current
  5462. value.
  5463. @section bbox
  5464. Compute the bounding box for the non-black pixels in the input frame
  5465. luminance plane.
  5466. This filter computes the bounding box containing all the pixels with a
  5467. luminance value greater than the minimum allowed value.
  5468. The parameters describing the bounding box are printed on the filter
  5469. log.
  5470. The filter accepts the following option:
  5471. @table @option
  5472. @item min_val
  5473. Set the minimal luminance value. Default is @code{16}.
  5474. @end table
  5475. @section bilateral
  5476. Apply bilateral filter, spatial smoothing while preserving edges.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item sigmaS
  5480. Set sigma of gaussian function to calculate spatial weight.
  5481. Allowed range is 0 to 512. Default is 0.1.
  5482. @item sigmaR
  5483. Set sigma of gaussian function to calculate range weight.
  5484. Allowed range is 0 to 1. Default is 0.1.
  5485. @item planes
  5486. Set planes to filter. Default is first only.
  5487. @end table
  5488. @section bitplanenoise
  5489. Show and measure bit plane noise.
  5490. The filter accepts the following options:
  5491. @table @option
  5492. @item bitplane
  5493. Set which plane to analyze. Default is @code{1}.
  5494. @item filter
  5495. Filter out noisy pixels from @code{bitplane} set above.
  5496. Default is disabled.
  5497. @end table
  5498. @section blackdetect
  5499. Detect video intervals that are (almost) completely black. Can be
  5500. useful to detect chapter transitions, commercials, or invalid
  5501. recordings.
  5502. The filter outputs its detection analysis to both the log as well as
  5503. frame metadata. If a black segment of at least the specified minimum
  5504. duration is found, a line with the start and end timestamps as well
  5505. as duration is printed to the log with level @code{info}. In addition,
  5506. a log line with level @code{debug} is printed per frame showing the
  5507. black amount detected for that frame.
  5508. The filter also attaches metadata to the first frame of a black
  5509. segment with key @code{lavfi.black_start} and to the first frame
  5510. after the black segment ends with key @code{lavfi.black_end}. The
  5511. value is the frame's timestamp. This metadata is added regardless
  5512. of the minimum duration specified.
  5513. The filter accepts the following options:
  5514. @table @option
  5515. @item black_min_duration, d
  5516. Set the minimum detected black duration expressed in seconds. It must
  5517. be a non-negative floating point number.
  5518. Default value is 2.0.
  5519. @item picture_black_ratio_th, pic_th
  5520. Set the threshold for considering a picture "black".
  5521. Express the minimum value for the ratio:
  5522. @example
  5523. @var{nb_black_pixels} / @var{nb_pixels}
  5524. @end example
  5525. for which a picture is considered black.
  5526. Default value is 0.98.
  5527. @item pixel_black_th, pix_th
  5528. Set the threshold for considering a pixel "black".
  5529. The threshold expresses the maximum pixel luminance value for which a
  5530. pixel is considered "black". The provided value is scaled according to
  5531. the following equation:
  5532. @example
  5533. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5534. @end example
  5535. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5536. the input video format, the range is [0-255] for YUV full-range
  5537. formats and [16-235] for YUV non full-range formats.
  5538. Default value is 0.10.
  5539. @end table
  5540. The following example sets the maximum pixel threshold to the minimum
  5541. value, and detects only black intervals of 2 or more seconds:
  5542. @example
  5543. blackdetect=d=2:pix_th=0.00
  5544. @end example
  5545. @section blackframe
  5546. Detect frames that are (almost) completely black. Can be useful to
  5547. detect chapter transitions or commercials. Output lines consist of
  5548. the frame number of the detected frame, the percentage of blackness,
  5549. the position in the file if known or -1 and the timestamp in seconds.
  5550. In order to display the output lines, you need to set the loglevel at
  5551. least to the AV_LOG_INFO value.
  5552. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5553. The value represents the percentage of pixels in the picture that
  5554. are below the threshold value.
  5555. It accepts the following parameters:
  5556. @table @option
  5557. @item amount
  5558. The percentage of the pixels that have to be below the threshold; it defaults to
  5559. @code{98}.
  5560. @item threshold, thresh
  5561. The threshold below which a pixel value is considered black; it defaults to
  5562. @code{32}.
  5563. @end table
  5564. @anchor{blend}
  5565. @section blend
  5566. Blend two video frames into each other.
  5567. The @code{blend} filter takes two input streams and outputs one
  5568. stream, the first input is the "top" layer and second input is
  5569. "bottom" layer. By default, the output terminates when the longest input terminates.
  5570. The @code{tblend} (time blend) filter takes two consecutive frames
  5571. from one single stream, and outputs the result obtained by blending
  5572. the new frame on top of the old frame.
  5573. A description of the accepted options follows.
  5574. @table @option
  5575. @item c0_mode
  5576. @item c1_mode
  5577. @item c2_mode
  5578. @item c3_mode
  5579. @item all_mode
  5580. Set blend mode for specific pixel component or all pixel components in case
  5581. of @var{all_mode}. Default value is @code{normal}.
  5582. Available values for component modes are:
  5583. @table @samp
  5584. @item addition
  5585. @item grainmerge
  5586. @item and
  5587. @item average
  5588. @item burn
  5589. @item darken
  5590. @item difference
  5591. @item grainextract
  5592. @item divide
  5593. @item dodge
  5594. @item freeze
  5595. @item exclusion
  5596. @item extremity
  5597. @item glow
  5598. @item hardlight
  5599. @item hardmix
  5600. @item heat
  5601. @item lighten
  5602. @item linearlight
  5603. @item multiply
  5604. @item multiply128
  5605. @item negation
  5606. @item normal
  5607. @item or
  5608. @item overlay
  5609. @item phoenix
  5610. @item pinlight
  5611. @item reflect
  5612. @item screen
  5613. @item softlight
  5614. @item subtract
  5615. @item vividlight
  5616. @item xor
  5617. @end table
  5618. @item c0_opacity
  5619. @item c1_opacity
  5620. @item c2_opacity
  5621. @item c3_opacity
  5622. @item all_opacity
  5623. Set blend opacity for specific pixel component or all pixel components in case
  5624. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  5625. @item c0_expr
  5626. @item c1_expr
  5627. @item c2_expr
  5628. @item c3_expr
  5629. @item all_expr
  5630. Set blend expression for specific pixel component or all pixel components in case
  5631. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  5632. The expressions can use the following variables:
  5633. @table @option
  5634. @item N
  5635. The sequential number of the filtered frame, starting from @code{0}.
  5636. @item X
  5637. @item Y
  5638. the coordinates of the current sample
  5639. @item W
  5640. @item H
  5641. the width and height of currently filtered plane
  5642. @item SW
  5643. @item SH
  5644. Width and height scale for the plane being filtered. It is the
  5645. ratio between the dimensions of the current plane to the luma plane,
  5646. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5647. the luma plane and @code{0.5,0.5} for the chroma planes.
  5648. @item T
  5649. Time of the current frame, expressed in seconds.
  5650. @item TOP, A
  5651. Value of pixel component at current location for first video frame (top layer).
  5652. @item BOTTOM, B
  5653. Value of pixel component at current location for second video frame (bottom layer).
  5654. @end table
  5655. @end table
  5656. The @code{blend} filter also supports the @ref{framesync} options.
  5657. @subsection Examples
  5658. @itemize
  5659. @item
  5660. Apply transition from bottom layer to top layer in first 10 seconds:
  5661. @example
  5662. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5663. @end example
  5664. @item
  5665. Apply linear horizontal transition from top layer to bottom layer:
  5666. @example
  5667. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5668. @end example
  5669. @item
  5670. Apply 1x1 checkerboard effect:
  5671. @example
  5672. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5673. @end example
  5674. @item
  5675. Apply uncover left effect:
  5676. @example
  5677. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5678. @end example
  5679. @item
  5680. Apply uncover down effect:
  5681. @example
  5682. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5683. @end example
  5684. @item
  5685. Apply uncover up-left effect:
  5686. @example
  5687. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5688. @end example
  5689. @item
  5690. Split diagonally video and shows top and bottom layer on each side:
  5691. @example
  5692. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5693. @end example
  5694. @item
  5695. Display differences between the current and the previous frame:
  5696. @example
  5697. tblend=all_mode=grainextract
  5698. @end example
  5699. @end itemize
  5700. @section bm3d
  5701. Denoise frames using Block-Matching 3D algorithm.
  5702. The filter accepts the following options.
  5703. @table @option
  5704. @item sigma
  5705. Set denoising strength. Default value is 1.
  5706. Allowed range is from 0 to 999.9.
  5707. The denoising algorithm is very sensitive to sigma, so adjust it
  5708. according to the source.
  5709. @item block
  5710. Set local patch size. This sets dimensions in 2D.
  5711. @item bstep
  5712. Set sliding step for processing blocks. Default value is 4.
  5713. Allowed range is from 1 to 64.
  5714. Smaller values allows processing more reference blocks and is slower.
  5715. @item group
  5716. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5717. When set to 1, no block matching is done. Larger values allows more blocks
  5718. in single group.
  5719. Allowed range is from 1 to 256.
  5720. @item range
  5721. Set radius for search block matching. Default is 9.
  5722. Allowed range is from 1 to INT32_MAX.
  5723. @item mstep
  5724. Set step between two search locations for block matching. Default is 1.
  5725. Allowed range is from 1 to 64. Smaller is slower.
  5726. @item thmse
  5727. Set threshold of mean square error for block matching. Valid range is 0 to
  5728. INT32_MAX.
  5729. @item hdthr
  5730. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5731. Larger values results in stronger hard-thresholding filtering in frequency
  5732. domain.
  5733. @item estim
  5734. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5735. Default is @code{basic}.
  5736. @item ref
  5737. If enabled, filter will use 2nd stream for block matching.
  5738. Default is disabled for @code{basic} value of @var{estim} option,
  5739. and always enabled if value of @var{estim} is @code{final}.
  5740. @item planes
  5741. Set planes to filter. Default is all available except alpha.
  5742. @end table
  5743. @subsection Examples
  5744. @itemize
  5745. @item
  5746. Basic filtering with bm3d:
  5747. @example
  5748. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5749. @end example
  5750. @item
  5751. Same as above, but filtering only luma:
  5752. @example
  5753. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5754. @end example
  5755. @item
  5756. Same as above, but with both estimation modes:
  5757. @example
  5758. 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
  5759. @end example
  5760. @item
  5761. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5762. @example
  5763. 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
  5764. @end example
  5765. @end itemize
  5766. @section boxblur
  5767. Apply a boxblur algorithm to the input video.
  5768. It accepts the following parameters:
  5769. @table @option
  5770. @item luma_radius, lr
  5771. @item luma_power, lp
  5772. @item chroma_radius, cr
  5773. @item chroma_power, cp
  5774. @item alpha_radius, ar
  5775. @item alpha_power, ap
  5776. @end table
  5777. A description of the accepted options follows.
  5778. @table @option
  5779. @item luma_radius, lr
  5780. @item chroma_radius, cr
  5781. @item alpha_radius, ar
  5782. Set an expression for the box radius in pixels used for blurring the
  5783. corresponding input plane.
  5784. The radius value must be a non-negative number, and must not be
  5785. greater than the value of the expression @code{min(w,h)/2} for the
  5786. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5787. planes.
  5788. Default value for @option{luma_radius} is "2". If not specified,
  5789. @option{chroma_radius} and @option{alpha_radius} default to the
  5790. corresponding value set for @option{luma_radius}.
  5791. The expressions can contain the following constants:
  5792. @table @option
  5793. @item w
  5794. @item h
  5795. The input width and height in pixels.
  5796. @item cw
  5797. @item ch
  5798. The input chroma image width and height in pixels.
  5799. @item hsub
  5800. @item vsub
  5801. The horizontal and vertical chroma subsample values. For example, for the
  5802. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5803. @end table
  5804. @item luma_power, lp
  5805. @item chroma_power, cp
  5806. @item alpha_power, ap
  5807. Specify how many times the boxblur filter is applied to the
  5808. corresponding plane.
  5809. Default value for @option{luma_power} is 2. If not specified,
  5810. @option{chroma_power} and @option{alpha_power} default to the
  5811. corresponding value set for @option{luma_power}.
  5812. A value of 0 will disable the effect.
  5813. @end table
  5814. @subsection Examples
  5815. @itemize
  5816. @item
  5817. Apply a boxblur filter with the luma, chroma, and alpha radii
  5818. set to 2:
  5819. @example
  5820. boxblur=luma_radius=2:luma_power=1
  5821. boxblur=2:1
  5822. @end example
  5823. @item
  5824. Set the luma radius to 2, and alpha and chroma radius to 0:
  5825. @example
  5826. boxblur=2:1:cr=0:ar=0
  5827. @end example
  5828. @item
  5829. Set the luma and chroma radii to a fraction of the video dimension:
  5830. @example
  5831. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5832. @end example
  5833. @end itemize
  5834. @section bwdif
  5835. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5836. Deinterlacing Filter").
  5837. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5838. interpolation algorithms.
  5839. It accepts the following parameters:
  5840. @table @option
  5841. @item mode
  5842. The interlacing mode to adopt. It accepts one of the following values:
  5843. @table @option
  5844. @item 0, send_frame
  5845. Output one frame for each frame.
  5846. @item 1, send_field
  5847. Output one frame for each field.
  5848. @end table
  5849. The default value is @code{send_field}.
  5850. @item parity
  5851. The picture field parity assumed for the input interlaced video. It accepts one
  5852. of the following values:
  5853. @table @option
  5854. @item 0, tff
  5855. Assume the top field is first.
  5856. @item 1, bff
  5857. Assume the bottom field is first.
  5858. @item -1, auto
  5859. Enable automatic detection of field parity.
  5860. @end table
  5861. The default value is @code{auto}.
  5862. If the interlacing is unknown or the decoder does not export this information,
  5863. top field first will be assumed.
  5864. @item deint
  5865. Specify which frames to deinterlace. Accepts one of the following
  5866. values:
  5867. @table @option
  5868. @item 0, all
  5869. Deinterlace all frames.
  5870. @item 1, interlaced
  5871. Only deinterlace frames marked as interlaced.
  5872. @end table
  5873. The default value is @code{all}.
  5874. @end table
  5875. @section cas
  5876. Apply Contrast Adaptive Sharpen filter to video stream.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item strength
  5880. Set the sharpening strength. Default value is 0.
  5881. @item planes
  5882. Set planes to filter. Default value is to filter all
  5883. planes except alpha plane.
  5884. @end table
  5885. @section chromahold
  5886. Remove all color information for all colors except for certain one.
  5887. The filter accepts the following options:
  5888. @table @option
  5889. @item color
  5890. The color which will not be replaced with neutral chroma.
  5891. @item similarity
  5892. Similarity percentage with the above color.
  5893. 0.01 matches only the exact key color, while 1.0 matches everything.
  5894. @item blend
  5895. Blend percentage.
  5896. 0.0 makes pixels either fully gray, or not gray at all.
  5897. Higher values result in more preserved color.
  5898. @item yuv
  5899. Signals that the color passed is already in YUV instead of RGB.
  5900. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5901. This can be used to pass exact YUV values as hexadecimal numbers.
  5902. @end table
  5903. @subsection Commands
  5904. This filter supports same @ref{commands} as options.
  5905. The command accepts the same syntax of the corresponding option.
  5906. If the specified expression is not valid, it is kept at its current
  5907. value.
  5908. @section chromakey
  5909. YUV colorspace color/chroma keying.
  5910. The filter accepts the following options:
  5911. @table @option
  5912. @item color
  5913. The color which will be replaced with transparency.
  5914. @item similarity
  5915. Similarity percentage with the key color.
  5916. 0.01 matches only the exact key color, while 1.0 matches everything.
  5917. @item blend
  5918. Blend percentage.
  5919. 0.0 makes pixels either fully transparent, or not transparent at all.
  5920. Higher values result in semi-transparent pixels, with a higher transparency
  5921. the more similar the pixels color is to the key color.
  5922. @item yuv
  5923. Signals that the color passed is already in YUV instead of RGB.
  5924. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5925. This can be used to pass exact YUV values as hexadecimal numbers.
  5926. @end table
  5927. @subsection Commands
  5928. This filter supports same @ref{commands} as options.
  5929. The command accepts the same syntax of the corresponding option.
  5930. If the specified expression is not valid, it is kept at its current
  5931. value.
  5932. @subsection Examples
  5933. @itemize
  5934. @item
  5935. Make every green pixel in the input image transparent:
  5936. @example
  5937. ffmpeg -i input.png -vf chromakey=green out.png
  5938. @end example
  5939. @item
  5940. Overlay a greenscreen-video on top of a static black background.
  5941. @example
  5942. 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
  5943. @end example
  5944. @end itemize
  5945. @section chromanr
  5946. Reduce chrominance noise.
  5947. The filter accepts the following options:
  5948. @table @option
  5949. @item thres
  5950. Set threshold for averaging chrominance values.
  5951. Sum of absolute difference of U and V pixel components or current
  5952. pixel and neighbour pixels lower than this threshold will be used in
  5953. averaging. Luma component is left unchanged and is copied to output.
  5954. Default value is 30. Allowed range is from 1 to 200.
  5955. @item sizew
  5956. Set horizontal radius of rectangle used for averaging.
  5957. Allowed range is from 1 to 100. Default value is 5.
  5958. @item sizeh
  5959. Set vertical radius of rectangle used for averaging.
  5960. Allowed range is from 1 to 100. Default value is 5.
  5961. @item stepw
  5962. Set horizontal step when averaging. Default value is 1.
  5963. Allowed range is from 1 to 50.
  5964. Mostly useful to speed-up filtering.
  5965. @item steph
  5966. Set vertical step when averaging. Default value is 1.
  5967. Allowed range is from 1 to 50.
  5968. Mostly useful to speed-up filtering.
  5969. @end table
  5970. @subsection Commands
  5971. This filter supports same @ref{commands} as options.
  5972. The command accepts the same syntax of the corresponding option.
  5973. @section chromashift
  5974. Shift chroma pixels horizontally and/or vertically.
  5975. The filter accepts the following options:
  5976. @table @option
  5977. @item cbh
  5978. Set amount to shift chroma-blue horizontally.
  5979. @item cbv
  5980. Set amount to shift chroma-blue vertically.
  5981. @item crh
  5982. Set amount to shift chroma-red horizontally.
  5983. @item crv
  5984. Set amount to shift chroma-red vertically.
  5985. @item edge
  5986. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5987. @end table
  5988. @subsection Commands
  5989. This filter supports the all above options as @ref{commands}.
  5990. @section ciescope
  5991. Display CIE color diagram with pixels overlaid onto it.
  5992. The filter accepts the following options:
  5993. @table @option
  5994. @item system
  5995. Set color system.
  5996. @table @samp
  5997. @item ntsc, 470m
  5998. @item ebu, 470bg
  5999. @item smpte
  6000. @item 240m
  6001. @item apple
  6002. @item widergb
  6003. @item cie1931
  6004. @item rec709, hdtv
  6005. @item uhdtv, rec2020
  6006. @item dcip3
  6007. @end table
  6008. @item cie
  6009. Set CIE system.
  6010. @table @samp
  6011. @item xyy
  6012. @item ucs
  6013. @item luv
  6014. @end table
  6015. @item gamuts
  6016. Set what gamuts to draw.
  6017. See @code{system} option for available values.
  6018. @item size, s
  6019. Set ciescope size, by default set to 512.
  6020. @item intensity, i
  6021. Set intensity used to map input pixel values to CIE diagram.
  6022. @item contrast
  6023. Set contrast used to draw tongue colors that are out of active color system gamut.
  6024. @item corrgamma
  6025. Correct gamma displayed on scope, by default enabled.
  6026. @item showwhite
  6027. Show white point on CIE diagram, by default disabled.
  6028. @item gamma
  6029. Set input gamma. Used only with XYZ input color space.
  6030. @end table
  6031. @section codecview
  6032. Visualize information exported by some codecs.
  6033. Some codecs can export information through frames using side-data or other
  6034. means. For example, some MPEG based codecs export motion vectors through the
  6035. @var{export_mvs} flag in the codec @option{flags2} option.
  6036. The filter accepts the following option:
  6037. @table @option
  6038. @item mv
  6039. Set motion vectors to visualize.
  6040. Available flags for @var{mv} are:
  6041. @table @samp
  6042. @item pf
  6043. forward predicted MVs of P-frames
  6044. @item bf
  6045. forward predicted MVs of B-frames
  6046. @item bb
  6047. backward predicted MVs of B-frames
  6048. @end table
  6049. @item qp
  6050. Display quantization parameters using the chroma planes.
  6051. @item mv_type, mvt
  6052. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6053. Available flags for @var{mv_type} are:
  6054. @table @samp
  6055. @item fp
  6056. forward predicted MVs
  6057. @item bp
  6058. backward predicted MVs
  6059. @end table
  6060. @item frame_type, ft
  6061. Set frame type to visualize motion vectors of.
  6062. Available flags for @var{frame_type} are:
  6063. @table @samp
  6064. @item if
  6065. intra-coded frames (I-frames)
  6066. @item pf
  6067. predicted frames (P-frames)
  6068. @item bf
  6069. bi-directionally predicted frames (B-frames)
  6070. @end table
  6071. @end table
  6072. @subsection Examples
  6073. @itemize
  6074. @item
  6075. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6076. @example
  6077. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6078. @end example
  6079. @item
  6080. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6081. @example
  6082. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6083. @end example
  6084. @end itemize
  6085. @section colorbalance
  6086. Modify intensity of primary colors (red, green and blue) of input frames.
  6087. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6088. regions for the red-cyan, green-magenta or blue-yellow balance.
  6089. A positive adjustment value shifts the balance towards the primary color, a negative
  6090. value towards the complementary color.
  6091. The filter accepts the following options:
  6092. @table @option
  6093. @item rs
  6094. @item gs
  6095. @item bs
  6096. Adjust red, green and blue shadows (darkest pixels).
  6097. @item rm
  6098. @item gm
  6099. @item bm
  6100. Adjust red, green and blue midtones (medium pixels).
  6101. @item rh
  6102. @item gh
  6103. @item bh
  6104. Adjust red, green and blue highlights (brightest pixels).
  6105. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6106. @item pl
  6107. Preserve lightness when changing color balance. Default is disabled.
  6108. @end table
  6109. @subsection Examples
  6110. @itemize
  6111. @item
  6112. Add red color cast to shadows:
  6113. @example
  6114. colorbalance=rs=.3
  6115. @end example
  6116. @end itemize
  6117. @subsection Commands
  6118. This filter supports the all above options as @ref{commands}.
  6119. @section colorchannelmixer
  6120. Adjust video input frames by re-mixing color channels.
  6121. This filter modifies a color channel by adding the values associated to
  6122. the other channels of the same pixels. For example if the value to
  6123. modify is red, the output value will be:
  6124. @example
  6125. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6126. @end example
  6127. The filter accepts the following options:
  6128. @table @option
  6129. @item rr
  6130. @item rg
  6131. @item rb
  6132. @item ra
  6133. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6134. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6135. @item gr
  6136. @item gg
  6137. @item gb
  6138. @item ga
  6139. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6140. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6141. @item br
  6142. @item bg
  6143. @item bb
  6144. @item ba
  6145. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6146. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6147. @item ar
  6148. @item ag
  6149. @item ab
  6150. @item aa
  6151. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6152. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6153. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6154. @end table
  6155. @subsection Examples
  6156. @itemize
  6157. @item
  6158. Convert source to grayscale:
  6159. @example
  6160. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6161. @end example
  6162. @item
  6163. Simulate sepia tones:
  6164. @example
  6165. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6166. @end example
  6167. @end itemize
  6168. @subsection Commands
  6169. This filter supports the all above options as @ref{commands}.
  6170. @section colorkey
  6171. RGB colorspace color keying.
  6172. The filter accepts the following options:
  6173. @table @option
  6174. @item color
  6175. The color which will be replaced with transparency.
  6176. @item similarity
  6177. Similarity percentage with the key color.
  6178. 0.01 matches only the exact key color, while 1.0 matches everything.
  6179. @item blend
  6180. Blend percentage.
  6181. 0.0 makes pixels either fully transparent, or not transparent at all.
  6182. Higher values result in semi-transparent pixels, with a higher transparency
  6183. the more similar the pixels color is to the key color.
  6184. @end table
  6185. @subsection Examples
  6186. @itemize
  6187. @item
  6188. Make every green pixel in the input image transparent:
  6189. @example
  6190. ffmpeg -i input.png -vf colorkey=green out.png
  6191. @end example
  6192. @item
  6193. Overlay a greenscreen-video on top of a static background image.
  6194. @example
  6195. 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
  6196. @end example
  6197. @end itemize
  6198. @subsection Commands
  6199. This filter supports same @ref{commands} as options.
  6200. The command accepts the same syntax of the corresponding option.
  6201. If the specified expression is not valid, it is kept at its current
  6202. value.
  6203. @section colorhold
  6204. Remove all color information for all RGB colors except for certain one.
  6205. The filter accepts the following options:
  6206. @table @option
  6207. @item color
  6208. The color which will not be replaced with neutral gray.
  6209. @item similarity
  6210. Similarity percentage with the above color.
  6211. 0.01 matches only the exact key color, while 1.0 matches everything.
  6212. @item blend
  6213. Blend percentage. 0.0 makes pixels fully gray.
  6214. Higher values result in more preserved color.
  6215. @end table
  6216. @subsection Commands
  6217. This filter supports same @ref{commands} as options.
  6218. The command accepts the same syntax of the corresponding option.
  6219. If the specified expression is not valid, it is kept at its current
  6220. value.
  6221. @section colorlevels
  6222. Adjust video input frames using levels.
  6223. The filter accepts the following options:
  6224. @table @option
  6225. @item rimin
  6226. @item gimin
  6227. @item bimin
  6228. @item aimin
  6229. Adjust red, green, blue and alpha input black point.
  6230. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6231. @item rimax
  6232. @item gimax
  6233. @item bimax
  6234. @item aimax
  6235. Adjust red, green, blue and alpha input white point.
  6236. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6237. Input levels are used to lighten highlights (bright tones), darken shadows
  6238. (dark tones), change the balance of bright and dark tones.
  6239. @item romin
  6240. @item gomin
  6241. @item bomin
  6242. @item aomin
  6243. Adjust red, green, blue and alpha output black point.
  6244. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6245. @item romax
  6246. @item gomax
  6247. @item bomax
  6248. @item aomax
  6249. Adjust red, green, blue and alpha output white point.
  6250. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6251. Output levels allows manual selection of a constrained output level range.
  6252. @end table
  6253. @subsection Examples
  6254. @itemize
  6255. @item
  6256. Make video output darker:
  6257. @example
  6258. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6259. @end example
  6260. @item
  6261. Increase contrast:
  6262. @example
  6263. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6264. @end example
  6265. @item
  6266. Make video output lighter:
  6267. @example
  6268. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6269. @end example
  6270. @item
  6271. Increase brightness:
  6272. @example
  6273. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6274. @end example
  6275. @end itemize
  6276. @subsection Commands
  6277. This filter supports the all above options as @ref{commands}.
  6278. @section colormatrix
  6279. Convert color matrix.
  6280. The filter accepts the following options:
  6281. @table @option
  6282. @item src
  6283. @item dst
  6284. Specify the source and destination color matrix. Both values must be
  6285. specified.
  6286. The accepted values are:
  6287. @table @samp
  6288. @item bt709
  6289. BT.709
  6290. @item fcc
  6291. FCC
  6292. @item bt601
  6293. BT.601
  6294. @item bt470
  6295. BT.470
  6296. @item bt470bg
  6297. BT.470BG
  6298. @item smpte170m
  6299. SMPTE-170M
  6300. @item smpte240m
  6301. SMPTE-240M
  6302. @item bt2020
  6303. BT.2020
  6304. @end table
  6305. @end table
  6306. For example to convert from BT.601 to SMPTE-240M, use the command:
  6307. @example
  6308. colormatrix=bt601:smpte240m
  6309. @end example
  6310. @section colorspace
  6311. Convert colorspace, transfer characteristics or color primaries.
  6312. Input video needs to have an even size.
  6313. The filter accepts the following options:
  6314. @table @option
  6315. @anchor{all}
  6316. @item all
  6317. Specify all color properties at once.
  6318. The accepted values are:
  6319. @table @samp
  6320. @item bt470m
  6321. BT.470M
  6322. @item bt470bg
  6323. BT.470BG
  6324. @item bt601-6-525
  6325. BT.601-6 525
  6326. @item bt601-6-625
  6327. BT.601-6 625
  6328. @item bt709
  6329. BT.709
  6330. @item smpte170m
  6331. SMPTE-170M
  6332. @item smpte240m
  6333. SMPTE-240M
  6334. @item bt2020
  6335. BT.2020
  6336. @end table
  6337. @anchor{space}
  6338. @item space
  6339. Specify output colorspace.
  6340. The accepted values are:
  6341. @table @samp
  6342. @item bt709
  6343. BT.709
  6344. @item fcc
  6345. FCC
  6346. @item bt470bg
  6347. BT.470BG or BT.601-6 625
  6348. @item smpte170m
  6349. SMPTE-170M or BT.601-6 525
  6350. @item smpte240m
  6351. SMPTE-240M
  6352. @item ycgco
  6353. YCgCo
  6354. @item bt2020ncl
  6355. BT.2020 with non-constant luminance
  6356. @end table
  6357. @anchor{trc}
  6358. @item trc
  6359. Specify output transfer characteristics.
  6360. The accepted values are:
  6361. @table @samp
  6362. @item bt709
  6363. BT.709
  6364. @item bt470m
  6365. BT.470M
  6366. @item bt470bg
  6367. BT.470BG
  6368. @item gamma22
  6369. Constant gamma of 2.2
  6370. @item gamma28
  6371. Constant gamma of 2.8
  6372. @item smpte170m
  6373. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6374. @item smpte240m
  6375. SMPTE-240M
  6376. @item srgb
  6377. SRGB
  6378. @item iec61966-2-1
  6379. iec61966-2-1
  6380. @item iec61966-2-4
  6381. iec61966-2-4
  6382. @item xvycc
  6383. xvycc
  6384. @item bt2020-10
  6385. BT.2020 for 10-bits content
  6386. @item bt2020-12
  6387. BT.2020 for 12-bits content
  6388. @end table
  6389. @anchor{primaries}
  6390. @item primaries
  6391. Specify output color primaries.
  6392. The accepted values are:
  6393. @table @samp
  6394. @item bt709
  6395. BT.709
  6396. @item bt470m
  6397. BT.470M
  6398. @item bt470bg
  6399. BT.470BG or BT.601-6 625
  6400. @item smpte170m
  6401. SMPTE-170M or BT.601-6 525
  6402. @item smpte240m
  6403. SMPTE-240M
  6404. @item film
  6405. film
  6406. @item smpte431
  6407. SMPTE-431
  6408. @item smpte432
  6409. SMPTE-432
  6410. @item bt2020
  6411. BT.2020
  6412. @item jedec-p22
  6413. JEDEC P22 phosphors
  6414. @end table
  6415. @anchor{range}
  6416. @item range
  6417. Specify output color range.
  6418. The accepted values are:
  6419. @table @samp
  6420. @item tv
  6421. TV (restricted) range
  6422. @item mpeg
  6423. MPEG (restricted) range
  6424. @item pc
  6425. PC (full) range
  6426. @item jpeg
  6427. JPEG (full) range
  6428. @end table
  6429. @item format
  6430. Specify output color format.
  6431. The accepted values are:
  6432. @table @samp
  6433. @item yuv420p
  6434. YUV 4:2:0 planar 8-bits
  6435. @item yuv420p10
  6436. YUV 4:2:0 planar 10-bits
  6437. @item yuv420p12
  6438. YUV 4:2:0 planar 12-bits
  6439. @item yuv422p
  6440. YUV 4:2:2 planar 8-bits
  6441. @item yuv422p10
  6442. YUV 4:2:2 planar 10-bits
  6443. @item yuv422p12
  6444. YUV 4:2:2 planar 12-bits
  6445. @item yuv444p
  6446. YUV 4:4:4 planar 8-bits
  6447. @item yuv444p10
  6448. YUV 4:4:4 planar 10-bits
  6449. @item yuv444p12
  6450. YUV 4:4:4 planar 12-bits
  6451. @end table
  6452. @item fast
  6453. Do a fast conversion, which skips gamma/primary correction. This will take
  6454. significantly less CPU, but will be mathematically incorrect. To get output
  6455. compatible with that produced by the colormatrix filter, use fast=1.
  6456. @item dither
  6457. Specify dithering mode.
  6458. The accepted values are:
  6459. @table @samp
  6460. @item none
  6461. No dithering
  6462. @item fsb
  6463. Floyd-Steinberg dithering
  6464. @end table
  6465. @item wpadapt
  6466. Whitepoint adaptation mode.
  6467. The accepted values are:
  6468. @table @samp
  6469. @item bradford
  6470. Bradford whitepoint adaptation
  6471. @item vonkries
  6472. von Kries whitepoint adaptation
  6473. @item identity
  6474. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  6475. @end table
  6476. @item iall
  6477. Override all input properties at once. Same accepted values as @ref{all}.
  6478. @item ispace
  6479. Override input colorspace. Same accepted values as @ref{space}.
  6480. @item iprimaries
  6481. Override input color primaries. Same accepted values as @ref{primaries}.
  6482. @item itrc
  6483. Override input transfer characteristics. Same accepted values as @ref{trc}.
  6484. @item irange
  6485. Override input color range. Same accepted values as @ref{range}.
  6486. @end table
  6487. The filter converts the transfer characteristics, color space and color
  6488. primaries to the specified user values. The output value, if not specified,
  6489. is set to a default value based on the "all" property. If that property is
  6490. also not specified, the filter will log an error. The output color range and
  6491. format default to the same value as the input color range and format. The
  6492. input transfer characteristics, color space, color primaries and color range
  6493. should be set on the input data. If any of these are missing, the filter will
  6494. log an error and no conversion will take place.
  6495. For example to convert the input to SMPTE-240M, use the command:
  6496. @example
  6497. colorspace=smpte240m
  6498. @end example
  6499. @section convolution
  6500. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  6501. The filter accepts the following options:
  6502. @table @option
  6503. @item 0m
  6504. @item 1m
  6505. @item 2m
  6506. @item 3m
  6507. Set matrix for each plane.
  6508. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  6509. and from 1 to 49 odd number of signed integers in @var{row} mode.
  6510. @item 0rdiv
  6511. @item 1rdiv
  6512. @item 2rdiv
  6513. @item 3rdiv
  6514. Set multiplier for calculated value for each plane.
  6515. If unset or 0, it will be sum of all matrix elements.
  6516. @item 0bias
  6517. @item 1bias
  6518. @item 2bias
  6519. @item 3bias
  6520. Set bias for each plane. This value is added to the result of the multiplication.
  6521. Useful for making the overall image brighter or darker. Default is 0.0.
  6522. @item 0mode
  6523. @item 1mode
  6524. @item 2mode
  6525. @item 3mode
  6526. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  6527. Default is @var{square}.
  6528. @end table
  6529. @subsection Examples
  6530. @itemize
  6531. @item
  6532. Apply sharpen:
  6533. @example
  6534. 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"
  6535. @end example
  6536. @item
  6537. Apply blur:
  6538. @example
  6539. 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"
  6540. @end example
  6541. @item
  6542. Apply edge enhance:
  6543. @example
  6544. 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"
  6545. @end example
  6546. @item
  6547. Apply edge detect:
  6548. @example
  6549. 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"
  6550. @end example
  6551. @item
  6552. Apply laplacian edge detector which includes diagonals:
  6553. @example
  6554. 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"
  6555. @end example
  6556. @item
  6557. Apply emboss:
  6558. @example
  6559. 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"
  6560. @end example
  6561. @end itemize
  6562. @section convolve
  6563. Apply 2D convolution of video stream in frequency domain using second stream
  6564. as impulse.
  6565. The filter accepts the following options:
  6566. @table @option
  6567. @item planes
  6568. Set which planes to process.
  6569. @item impulse
  6570. Set which impulse video frames will be processed, can be @var{first}
  6571. or @var{all}. Default is @var{all}.
  6572. @end table
  6573. The @code{convolve} filter also supports the @ref{framesync} options.
  6574. @section copy
  6575. Copy the input video source unchanged to the output. This is mainly useful for
  6576. testing purposes.
  6577. @anchor{coreimage}
  6578. @section coreimage
  6579. Video filtering on GPU using Apple's CoreImage API on OSX.
  6580. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  6581. processed by video hardware. However, software-based OpenGL implementations
  6582. exist which means there is no guarantee for hardware processing. It depends on
  6583. the respective OSX.
  6584. There are many filters and image generators provided by Apple that come with a
  6585. large variety of options. The filter has to be referenced by its name along
  6586. with its options.
  6587. The coreimage filter accepts the following options:
  6588. @table @option
  6589. @item list_filters
  6590. List all available filters and generators along with all their respective
  6591. options as well as possible minimum and maximum values along with the default
  6592. values.
  6593. @example
  6594. list_filters=true
  6595. @end example
  6596. @item filter
  6597. Specify all filters by their respective name and options.
  6598. Use @var{list_filters} to determine all valid filter names and options.
  6599. Numerical options are specified by a float value and are automatically clamped
  6600. to their respective value range. Vector and color options have to be specified
  6601. by a list of space separated float values. Character escaping has to be done.
  6602. A special option name @code{default} is available to use default options for a
  6603. filter.
  6604. It is required to specify either @code{default} or at least one of the filter options.
  6605. All omitted options are used with their default values.
  6606. The syntax of the filter string is as follows:
  6607. @example
  6608. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  6609. @end example
  6610. @item output_rect
  6611. Specify a rectangle where the output of the filter chain is copied into the
  6612. input image. It is given by a list of space separated float values:
  6613. @example
  6614. output_rect=x\ y\ width\ height
  6615. @end example
  6616. If not given, the output rectangle equals the dimensions of the input image.
  6617. The output rectangle is automatically cropped at the borders of the input
  6618. image. Negative values are valid for each component.
  6619. @example
  6620. output_rect=25\ 25\ 100\ 100
  6621. @end example
  6622. @end table
  6623. Several filters can be chained for successive processing without GPU-HOST
  6624. transfers allowing for fast processing of complex filter chains.
  6625. Currently, only filters with zero (generators) or exactly one (filters) input
  6626. image and one output image are supported. Also, transition filters are not yet
  6627. usable as intended.
  6628. Some filters generate output images with additional padding depending on the
  6629. respective filter kernel. The padding is automatically removed to ensure the
  6630. filter output has the same size as the input image.
  6631. For image generators, the size of the output image is determined by the
  6632. previous output image of the filter chain or the input image of the whole
  6633. filterchain, respectively. The generators do not use the pixel information of
  6634. this image to generate their output. However, the generated output is
  6635. blended onto this image, resulting in partial or complete coverage of the
  6636. output image.
  6637. The @ref{coreimagesrc} video source can be used for generating input images
  6638. which are directly fed into the filter chain. By using it, providing input
  6639. images by another video source or an input video is not required.
  6640. @subsection Examples
  6641. @itemize
  6642. @item
  6643. List all filters available:
  6644. @example
  6645. coreimage=list_filters=true
  6646. @end example
  6647. @item
  6648. Use the CIBoxBlur filter with default options to blur an image:
  6649. @example
  6650. coreimage=filter=CIBoxBlur@@default
  6651. @end example
  6652. @item
  6653. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  6654. its center at 100x100 and a radius of 50 pixels:
  6655. @example
  6656. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  6657. @end example
  6658. @item
  6659. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  6660. given as complete and escaped command-line for Apple's standard bash shell:
  6661. @example
  6662. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  6663. @end example
  6664. @end itemize
  6665. @section cover_rect
  6666. Cover a rectangular object
  6667. It accepts the following options:
  6668. @table @option
  6669. @item cover
  6670. Filepath of the optional cover image, needs to be in yuv420.
  6671. @item mode
  6672. Set covering mode.
  6673. It accepts the following values:
  6674. @table @samp
  6675. @item cover
  6676. cover it by the supplied image
  6677. @item blur
  6678. cover it by interpolating the surrounding pixels
  6679. @end table
  6680. Default value is @var{blur}.
  6681. @end table
  6682. @subsection Examples
  6683. @itemize
  6684. @item
  6685. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  6686. @example
  6687. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6688. @end example
  6689. @end itemize
  6690. @section crop
  6691. Crop the input video to given dimensions.
  6692. It accepts the following parameters:
  6693. @table @option
  6694. @item w, out_w
  6695. The width of the output video. It defaults to @code{iw}.
  6696. This expression is evaluated only once during the filter
  6697. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  6698. @item h, out_h
  6699. The height of the output video. It defaults to @code{ih}.
  6700. This expression is evaluated only once during the filter
  6701. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  6702. @item x
  6703. The horizontal position, in the input video, of the left edge of the output
  6704. video. It defaults to @code{(in_w-out_w)/2}.
  6705. This expression is evaluated per-frame.
  6706. @item y
  6707. The vertical position, in the input video, of the top edge of the output video.
  6708. It defaults to @code{(in_h-out_h)/2}.
  6709. This expression is evaluated per-frame.
  6710. @item keep_aspect
  6711. If set to 1 will force the output display aspect ratio
  6712. to be the same of the input, by changing the output sample aspect
  6713. ratio. It defaults to 0.
  6714. @item exact
  6715. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6716. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6717. It defaults to 0.
  6718. @end table
  6719. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6720. expressions containing the following constants:
  6721. @table @option
  6722. @item x
  6723. @item y
  6724. The computed values for @var{x} and @var{y}. They are evaluated for
  6725. each new frame.
  6726. @item in_w
  6727. @item in_h
  6728. The input width and height.
  6729. @item iw
  6730. @item ih
  6731. These are the same as @var{in_w} and @var{in_h}.
  6732. @item out_w
  6733. @item out_h
  6734. The output (cropped) width and height.
  6735. @item ow
  6736. @item oh
  6737. These are the same as @var{out_w} and @var{out_h}.
  6738. @item a
  6739. same as @var{iw} / @var{ih}
  6740. @item sar
  6741. input sample aspect ratio
  6742. @item dar
  6743. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6744. @item hsub
  6745. @item vsub
  6746. horizontal and vertical chroma subsample values. For example for the
  6747. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6748. @item n
  6749. The number of the input frame, starting from 0.
  6750. @item pos
  6751. the position in the file of the input frame, NAN if unknown
  6752. @item t
  6753. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6754. @end table
  6755. The expression for @var{out_w} may depend on the value of @var{out_h},
  6756. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6757. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6758. evaluated after @var{out_w} and @var{out_h}.
  6759. The @var{x} and @var{y} parameters specify the expressions for the
  6760. position of the top-left corner of the output (non-cropped) area. They
  6761. are evaluated for each frame. If the evaluated value is not valid, it
  6762. is approximated to the nearest valid value.
  6763. The expression for @var{x} may depend on @var{y}, and the expression
  6764. for @var{y} may depend on @var{x}.
  6765. @subsection Examples
  6766. @itemize
  6767. @item
  6768. Crop area with size 100x100 at position (12,34).
  6769. @example
  6770. crop=100:100:12:34
  6771. @end example
  6772. Using named options, the example above becomes:
  6773. @example
  6774. crop=w=100:h=100:x=12:y=34
  6775. @end example
  6776. @item
  6777. Crop the central input area with size 100x100:
  6778. @example
  6779. crop=100:100
  6780. @end example
  6781. @item
  6782. Crop the central input area with size 2/3 of the input video:
  6783. @example
  6784. crop=2/3*in_w:2/3*in_h
  6785. @end example
  6786. @item
  6787. Crop the input video central square:
  6788. @example
  6789. crop=out_w=in_h
  6790. crop=in_h
  6791. @end example
  6792. @item
  6793. Delimit the rectangle with the top-left corner placed at position
  6794. 100:100 and the right-bottom corner corresponding to the right-bottom
  6795. corner of the input image.
  6796. @example
  6797. crop=in_w-100:in_h-100:100:100
  6798. @end example
  6799. @item
  6800. Crop 10 pixels from the left and right borders, and 20 pixels from
  6801. the top and bottom borders
  6802. @example
  6803. crop=in_w-2*10:in_h-2*20
  6804. @end example
  6805. @item
  6806. Keep only the bottom right quarter of the input image:
  6807. @example
  6808. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6809. @end example
  6810. @item
  6811. Crop height for getting Greek harmony:
  6812. @example
  6813. crop=in_w:1/PHI*in_w
  6814. @end example
  6815. @item
  6816. Apply trembling effect:
  6817. @example
  6818. 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)
  6819. @end example
  6820. @item
  6821. Apply erratic camera effect depending on timestamp:
  6822. @example
  6823. 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)"
  6824. @end example
  6825. @item
  6826. Set x depending on the value of y:
  6827. @example
  6828. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6829. @end example
  6830. @end itemize
  6831. @subsection Commands
  6832. This filter supports the following commands:
  6833. @table @option
  6834. @item w, out_w
  6835. @item h, out_h
  6836. @item x
  6837. @item y
  6838. Set width/height of the output video and the horizontal/vertical position
  6839. in the input video.
  6840. The command accepts the same syntax of the corresponding option.
  6841. If the specified expression is not valid, it is kept at its current
  6842. value.
  6843. @end table
  6844. @section cropdetect
  6845. Auto-detect the crop size.
  6846. It calculates the necessary cropping parameters and prints the
  6847. recommended parameters via the logging system. The detected dimensions
  6848. correspond to the non-black area of the input video.
  6849. It accepts the following parameters:
  6850. @table @option
  6851. @item limit
  6852. Set higher black value threshold, which can be optionally specified
  6853. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6854. value greater to the set value is considered non-black. It defaults to 24.
  6855. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6856. on the bitdepth of the pixel format.
  6857. @item round
  6858. The value which the width/height should be divisible by. It defaults to
  6859. 16. The offset is automatically adjusted to center the video. Use 2 to
  6860. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6861. encoding to most video codecs.
  6862. @item reset_count, reset
  6863. Set the counter that determines after how many frames cropdetect will
  6864. reset the previously detected largest video area and start over to
  6865. detect the current optimal crop area. Default value is 0.
  6866. This can be useful when channel logos distort the video area. 0
  6867. indicates 'never reset', and returns the largest area encountered during
  6868. playback.
  6869. @end table
  6870. @anchor{cue}
  6871. @section cue
  6872. Delay video filtering until a given wallclock timestamp. The filter first
  6873. passes on @option{preroll} amount of frames, then it buffers at most
  6874. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6875. it forwards the buffered frames and also any subsequent frames coming in its
  6876. input.
  6877. The filter can be used synchronize the output of multiple ffmpeg processes for
  6878. realtime output devices like decklink. By putting the delay in the filtering
  6879. chain and pre-buffering frames the process can pass on data to output almost
  6880. immediately after the target wallclock timestamp is reached.
  6881. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6882. some use cases.
  6883. @table @option
  6884. @item cue
  6885. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6886. @item preroll
  6887. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6888. @item buffer
  6889. The maximum duration of content to buffer before waiting for the cue expressed
  6890. in seconds. Default is 0.
  6891. @end table
  6892. @anchor{curves}
  6893. @section curves
  6894. Apply color adjustments using curves.
  6895. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6896. component (red, green and blue) has its values defined by @var{N} key points
  6897. tied from each other using a smooth curve. The x-axis represents the pixel
  6898. values from the input frame, and the y-axis the new pixel values to be set for
  6899. the output frame.
  6900. By default, a component curve is defined by the two points @var{(0;0)} and
  6901. @var{(1;1)}. This creates a straight line where each original pixel value is
  6902. "adjusted" to its own value, which means no change to the image.
  6903. The filter allows you to redefine these two points and add some more. A new
  6904. curve (using a natural cubic spline interpolation) will be define to pass
  6905. smoothly through all these new coordinates. The new defined points needs to be
  6906. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6907. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6908. the vector spaces, the values will be clipped accordingly.
  6909. The filter accepts the following options:
  6910. @table @option
  6911. @item preset
  6912. Select one of the available color presets. This option can be used in addition
  6913. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6914. options takes priority on the preset values.
  6915. Available presets are:
  6916. @table @samp
  6917. @item none
  6918. @item color_negative
  6919. @item cross_process
  6920. @item darker
  6921. @item increase_contrast
  6922. @item lighter
  6923. @item linear_contrast
  6924. @item medium_contrast
  6925. @item negative
  6926. @item strong_contrast
  6927. @item vintage
  6928. @end table
  6929. Default is @code{none}.
  6930. @item master, m
  6931. Set the master key points. These points will define a second pass mapping. It
  6932. is sometimes called a "luminance" or "value" mapping. It can be used with
  6933. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6934. post-processing LUT.
  6935. @item red, r
  6936. Set the key points for the red component.
  6937. @item green, g
  6938. Set the key points for the green component.
  6939. @item blue, b
  6940. Set the key points for the blue component.
  6941. @item all
  6942. Set the key points for all components (not including master).
  6943. Can be used in addition to the other key points component
  6944. options. In this case, the unset component(s) will fallback on this
  6945. @option{all} setting.
  6946. @item psfile
  6947. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6948. @item plot
  6949. Save Gnuplot script of the curves in specified file.
  6950. @end table
  6951. To avoid some filtergraph syntax conflicts, each key points list need to be
  6952. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6953. @subsection Examples
  6954. @itemize
  6955. @item
  6956. Increase slightly the middle level of blue:
  6957. @example
  6958. curves=blue='0/0 0.5/0.58 1/1'
  6959. @end example
  6960. @item
  6961. Vintage effect:
  6962. @example
  6963. 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'
  6964. @end example
  6965. Here we obtain the following coordinates for each components:
  6966. @table @var
  6967. @item red
  6968. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6969. @item green
  6970. @code{(0;0) (0.50;0.48) (1;1)}
  6971. @item blue
  6972. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6973. @end table
  6974. @item
  6975. The previous example can also be achieved with the associated built-in preset:
  6976. @example
  6977. curves=preset=vintage
  6978. @end example
  6979. @item
  6980. Or simply:
  6981. @example
  6982. curves=vintage
  6983. @end example
  6984. @item
  6985. Use a Photoshop preset and redefine the points of the green component:
  6986. @example
  6987. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6988. @end example
  6989. @item
  6990. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6991. and @command{gnuplot}:
  6992. @example
  6993. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6994. gnuplot -p /tmp/curves.plt
  6995. @end example
  6996. @end itemize
  6997. @section datascope
  6998. Video data analysis filter.
  6999. This filter shows hexadecimal pixel values of part of video.
  7000. The filter accepts the following options:
  7001. @table @option
  7002. @item size, s
  7003. Set output video size.
  7004. @item x
  7005. Set x offset from where to pick pixels.
  7006. @item y
  7007. Set y offset from where to pick pixels.
  7008. @item mode
  7009. Set scope mode, can be one of the following:
  7010. @table @samp
  7011. @item mono
  7012. Draw hexadecimal pixel values with white color on black background.
  7013. @item color
  7014. Draw hexadecimal pixel values with input video pixel color on black
  7015. background.
  7016. @item color2
  7017. Draw hexadecimal pixel values on color background picked from input video,
  7018. the text color is picked in such way so its always visible.
  7019. @end table
  7020. @item axis
  7021. Draw rows and columns numbers on left and top of video.
  7022. @item opacity
  7023. Set background opacity.
  7024. @item format
  7025. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7026. @end table
  7027. @section dblur
  7028. Apply Directional blur filter.
  7029. The filter accepts the following options:
  7030. @table @option
  7031. @item angle
  7032. Set angle of directional blur. Default is @code{45}.
  7033. @item radius
  7034. Set radius of directional blur. Default is @code{5}.
  7035. @item planes
  7036. Set which planes to filter. By default all planes are filtered.
  7037. @end table
  7038. @subsection Commands
  7039. This filter supports same @ref{commands} as options.
  7040. The command accepts the same syntax of the corresponding option.
  7041. If the specified expression is not valid, it is kept at its current
  7042. value.
  7043. @section dctdnoiz
  7044. Denoise frames using 2D DCT (frequency domain filtering).
  7045. This filter is not designed for real time.
  7046. The filter accepts the following options:
  7047. @table @option
  7048. @item sigma, s
  7049. Set the noise sigma constant.
  7050. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7051. coefficient (absolute value) below this threshold with be dropped.
  7052. If you need a more advanced filtering, see @option{expr}.
  7053. Default is @code{0}.
  7054. @item overlap
  7055. Set number overlapping pixels for each block. Since the filter can be slow, you
  7056. may want to reduce this value, at the cost of a less effective filter and the
  7057. risk of various artefacts.
  7058. If the overlapping value doesn't permit processing the whole input width or
  7059. height, a warning will be displayed and according borders won't be denoised.
  7060. Default value is @var{blocksize}-1, which is the best possible setting.
  7061. @item expr, e
  7062. Set the coefficient factor expression.
  7063. For each coefficient of a DCT block, this expression will be evaluated as a
  7064. multiplier value for the coefficient.
  7065. If this is option is set, the @option{sigma} option will be ignored.
  7066. The absolute value of the coefficient can be accessed through the @var{c}
  7067. variable.
  7068. @item n
  7069. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7070. @var{blocksize}, which is the width and height of the processed blocks.
  7071. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7072. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7073. on the speed processing. Also, a larger block size does not necessarily means a
  7074. better de-noising.
  7075. @end table
  7076. @subsection Examples
  7077. Apply a denoise with a @option{sigma} of @code{4.5}:
  7078. @example
  7079. dctdnoiz=4.5
  7080. @end example
  7081. The same operation can be achieved using the expression system:
  7082. @example
  7083. dctdnoiz=e='gte(c, 4.5*3)'
  7084. @end example
  7085. Violent denoise using a block size of @code{16x16}:
  7086. @example
  7087. dctdnoiz=15:n=4
  7088. @end example
  7089. @section deband
  7090. Remove banding artifacts from input video.
  7091. It works by replacing banded pixels with average value of referenced pixels.
  7092. The filter accepts the following options:
  7093. @table @option
  7094. @item 1thr
  7095. @item 2thr
  7096. @item 3thr
  7097. @item 4thr
  7098. Set banding detection threshold for each plane. Default is 0.02.
  7099. Valid range is 0.00003 to 0.5.
  7100. If difference between current pixel and reference pixel is less than threshold,
  7101. it will be considered as banded.
  7102. @item range, r
  7103. Banding detection range in pixels. Default is 16. If positive, random number
  7104. in range 0 to set value will be used. If negative, exact absolute value
  7105. will be used.
  7106. The range defines square of four pixels around current pixel.
  7107. @item direction, d
  7108. Set direction in radians from which four pixel will be compared. If positive,
  7109. random direction from 0 to set direction will be picked. If negative, exact of
  7110. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7111. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7112. column.
  7113. @item blur, b
  7114. If enabled, current pixel is compared with average value of all four
  7115. surrounding pixels. The default is enabled. If disabled current pixel is
  7116. compared with all four surrounding pixels. The pixel is considered banded
  7117. if only all four differences with surrounding pixels are less than threshold.
  7118. @item coupling, c
  7119. If enabled, current pixel is changed if and only if all pixel components are banded,
  7120. e.g. banding detection threshold is triggered for all color components.
  7121. The default is disabled.
  7122. @end table
  7123. @section deblock
  7124. Remove blocking artifacts from input video.
  7125. The filter accepts the following options:
  7126. @table @option
  7127. @item filter
  7128. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7129. This controls what kind of deblocking is applied.
  7130. @item block
  7131. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7132. @item alpha
  7133. @item beta
  7134. @item gamma
  7135. @item delta
  7136. Set blocking detection thresholds. Allowed range is 0 to 1.
  7137. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7138. Using higher threshold gives more deblocking strength.
  7139. Setting @var{alpha} controls threshold detection at exact edge of block.
  7140. Remaining options controls threshold detection near the edge. Each one for
  7141. below/above or left/right. Setting any of those to @var{0} disables
  7142. deblocking.
  7143. @item planes
  7144. Set planes to filter. Default is to filter all available planes.
  7145. @end table
  7146. @subsection Examples
  7147. @itemize
  7148. @item
  7149. Deblock using weak filter and block size of 4 pixels.
  7150. @example
  7151. deblock=filter=weak:block=4
  7152. @end example
  7153. @item
  7154. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7155. deblocking more edges.
  7156. @example
  7157. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7158. @end example
  7159. @item
  7160. Similar as above, but filter only first plane.
  7161. @example
  7162. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7163. @end example
  7164. @item
  7165. Similar as above, but filter only second and third plane.
  7166. @example
  7167. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7168. @end example
  7169. @end itemize
  7170. @anchor{decimate}
  7171. @section decimate
  7172. Drop duplicated frames at regular intervals.
  7173. The filter accepts the following options:
  7174. @table @option
  7175. @item cycle
  7176. Set the number of frames from which one will be dropped. Setting this to
  7177. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7178. Default is @code{5}.
  7179. @item dupthresh
  7180. Set the threshold for duplicate detection. If the difference metric for a frame
  7181. is less than or equal to this value, then it is declared as duplicate. Default
  7182. is @code{1.1}
  7183. @item scthresh
  7184. Set scene change threshold. Default is @code{15}.
  7185. @item blockx
  7186. @item blocky
  7187. Set the size of the x and y-axis blocks used during metric calculations.
  7188. Larger blocks give better noise suppression, but also give worse detection of
  7189. small movements. Must be a power of two. Default is @code{32}.
  7190. @item ppsrc
  7191. Mark main input as a pre-processed input and activate clean source input
  7192. stream. This allows the input to be pre-processed with various filters to help
  7193. the metrics calculation while keeping the frame selection lossless. When set to
  7194. @code{1}, the first stream is for the pre-processed input, and the second
  7195. stream is the clean source from where the kept frames are chosen. Default is
  7196. @code{0}.
  7197. @item chroma
  7198. Set whether or not chroma is considered in the metric calculations. Default is
  7199. @code{1}.
  7200. @end table
  7201. @section deconvolve
  7202. Apply 2D deconvolution of video stream in frequency domain using second stream
  7203. as impulse.
  7204. The filter accepts the following options:
  7205. @table @option
  7206. @item planes
  7207. Set which planes to process.
  7208. @item impulse
  7209. Set which impulse video frames will be processed, can be @var{first}
  7210. or @var{all}. Default is @var{all}.
  7211. @item noise
  7212. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7213. and height are not same and not power of 2 or if stream prior to convolving
  7214. had noise.
  7215. @end table
  7216. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7217. @section dedot
  7218. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7219. It accepts the following options:
  7220. @table @option
  7221. @item m
  7222. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7223. @var{rainbows} for cross-color reduction.
  7224. @item lt
  7225. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7226. @item tl
  7227. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7228. @item tc
  7229. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7230. @item ct
  7231. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7232. @end table
  7233. @section deflate
  7234. Apply deflate effect to the video.
  7235. This filter replaces the pixel by the local(3x3) average by taking into account
  7236. only values lower than the pixel.
  7237. It accepts the following options:
  7238. @table @option
  7239. @item threshold0
  7240. @item threshold1
  7241. @item threshold2
  7242. @item threshold3
  7243. Limit the maximum change for each plane, default is 65535.
  7244. If 0, plane will remain unchanged.
  7245. @end table
  7246. @subsection Commands
  7247. This filter supports the all above options as @ref{commands}.
  7248. @section deflicker
  7249. Remove temporal frame luminance variations.
  7250. It accepts the following options:
  7251. @table @option
  7252. @item size, s
  7253. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7254. @item mode, m
  7255. Set averaging mode to smooth temporal luminance variations.
  7256. Available values are:
  7257. @table @samp
  7258. @item am
  7259. Arithmetic mean
  7260. @item gm
  7261. Geometric mean
  7262. @item hm
  7263. Harmonic mean
  7264. @item qm
  7265. Quadratic mean
  7266. @item cm
  7267. Cubic mean
  7268. @item pm
  7269. Power mean
  7270. @item median
  7271. Median
  7272. @end table
  7273. @item bypass
  7274. Do not actually modify frame. Useful when one only wants metadata.
  7275. @end table
  7276. @section dejudder
  7277. Remove judder produced by partially interlaced telecined content.
  7278. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7279. source was partially telecined content then the output of @code{pullup,dejudder}
  7280. will have a variable frame rate. May change the recorded frame rate of the
  7281. container. Aside from that change, this filter will not affect constant frame
  7282. rate video.
  7283. The option available in this filter is:
  7284. @table @option
  7285. @item cycle
  7286. Specify the length of the window over which the judder repeats.
  7287. Accepts any integer greater than 1. Useful values are:
  7288. @table @samp
  7289. @item 4
  7290. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7291. @item 5
  7292. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7293. @item 20
  7294. If a mixture of the two.
  7295. @end table
  7296. The default is @samp{4}.
  7297. @end table
  7298. @section delogo
  7299. Suppress a TV station logo by a simple interpolation of the surrounding
  7300. pixels. Just set a rectangle covering the logo and watch it disappear
  7301. (and sometimes something even uglier appear - your mileage may vary).
  7302. It accepts the following parameters:
  7303. @table @option
  7304. @item x
  7305. @item y
  7306. Specify the top left corner coordinates of the logo. They must be
  7307. specified.
  7308. @item w
  7309. @item h
  7310. Specify the width and height of the logo to clear. They must be
  7311. specified.
  7312. @item band, t
  7313. Specify the thickness of the fuzzy edge of the rectangle (added to
  7314. @var{w} and @var{h}). The default value is 1. This option is
  7315. deprecated, setting higher values should no longer be necessary and
  7316. is not recommended.
  7317. @item show
  7318. When set to 1, a green rectangle is drawn on the screen to simplify
  7319. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7320. The default value is 0.
  7321. The rectangle is drawn on the outermost pixels which will be (partly)
  7322. replaced with interpolated values. The values of the next pixels
  7323. immediately outside this rectangle in each direction will be used to
  7324. compute the interpolated pixel values inside the rectangle.
  7325. @end table
  7326. @subsection Examples
  7327. @itemize
  7328. @item
  7329. Set a rectangle covering the area with top left corner coordinates 0,0
  7330. and size 100x77, and a band of size 10:
  7331. @example
  7332. delogo=x=0:y=0:w=100:h=77:band=10
  7333. @end example
  7334. @end itemize
  7335. @anchor{derain}
  7336. @section derain
  7337. Remove the rain in the input image/video by applying the derain methods based on
  7338. convolutional neural networks. Supported models:
  7339. @itemize
  7340. @item
  7341. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7342. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7343. @end itemize
  7344. Training as well as model generation scripts are provided in
  7345. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7346. Native model files (.model) can be generated from TensorFlow model
  7347. files (.pb) by using tools/python/convert.py
  7348. The filter accepts the following options:
  7349. @table @option
  7350. @item filter_type
  7351. Specify which filter to use. This option accepts the following values:
  7352. @table @samp
  7353. @item derain
  7354. Derain filter. To conduct derain filter, you need to use a derain model.
  7355. @item dehaze
  7356. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7357. @end table
  7358. Default value is @samp{derain}.
  7359. @item dnn_backend
  7360. Specify which DNN backend to use for model loading and execution. This option accepts
  7361. the following values:
  7362. @table @samp
  7363. @item native
  7364. Native implementation of DNN loading and execution.
  7365. @item tensorflow
  7366. TensorFlow backend. To enable this backend you
  7367. need to install the TensorFlow for C library (see
  7368. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7369. @code{--enable-libtensorflow}
  7370. @end table
  7371. Default value is @samp{native}.
  7372. @item model
  7373. Set path to model file specifying network architecture and its parameters.
  7374. Note that different backends use different file formats. TensorFlow and native
  7375. backend can load files for only its format.
  7376. @end table
  7377. It can also be finished with @ref{dnn_processing} filter.
  7378. @section deshake
  7379. Attempt to fix small changes in horizontal and/or vertical shift. This
  7380. filter helps remove camera shake from hand-holding a camera, bumping a
  7381. tripod, moving on a vehicle, etc.
  7382. The filter accepts the following options:
  7383. @table @option
  7384. @item x
  7385. @item y
  7386. @item w
  7387. @item h
  7388. Specify a rectangular area where to limit the search for motion
  7389. vectors.
  7390. If desired the search for motion vectors can be limited to a
  7391. rectangular area of the frame defined by its top left corner, width
  7392. and height. These parameters have the same meaning as the drawbox
  7393. filter which can be used to visualise the position of the bounding
  7394. box.
  7395. This is useful when simultaneous movement of subjects within the frame
  7396. might be confused for camera motion by the motion vector search.
  7397. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7398. then the full frame is used. This allows later options to be set
  7399. without specifying the bounding box for the motion vector search.
  7400. Default - search the whole frame.
  7401. @item rx
  7402. @item ry
  7403. Specify the maximum extent of movement in x and y directions in the
  7404. range 0-64 pixels. Default 16.
  7405. @item edge
  7406. Specify how to generate pixels to fill blanks at the edge of the
  7407. frame. Available values are:
  7408. @table @samp
  7409. @item blank, 0
  7410. Fill zeroes at blank locations
  7411. @item original, 1
  7412. Original image at blank locations
  7413. @item clamp, 2
  7414. Extruded edge value at blank locations
  7415. @item mirror, 3
  7416. Mirrored edge at blank locations
  7417. @end table
  7418. Default value is @samp{mirror}.
  7419. @item blocksize
  7420. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7421. default 8.
  7422. @item contrast
  7423. Specify the contrast threshold for blocks. Only blocks with more than
  7424. the specified contrast (difference between darkest and lightest
  7425. pixels) will be considered. Range 1-255, default 125.
  7426. @item search
  7427. Specify the search strategy. Available values are:
  7428. @table @samp
  7429. @item exhaustive, 0
  7430. Set exhaustive search
  7431. @item less, 1
  7432. Set less exhaustive search.
  7433. @end table
  7434. Default value is @samp{exhaustive}.
  7435. @item filename
  7436. If set then a detailed log of the motion search is written to the
  7437. specified file.
  7438. @end table
  7439. @section despill
  7440. Remove unwanted contamination of foreground colors, caused by reflected color of
  7441. greenscreen or bluescreen.
  7442. This filter accepts the following options:
  7443. @table @option
  7444. @item type
  7445. Set what type of despill to use.
  7446. @item mix
  7447. Set how spillmap will be generated.
  7448. @item expand
  7449. Set how much to get rid of still remaining spill.
  7450. @item red
  7451. Controls amount of red in spill area.
  7452. @item green
  7453. Controls amount of green in spill area.
  7454. Should be -1 for greenscreen.
  7455. @item blue
  7456. Controls amount of blue in spill area.
  7457. Should be -1 for bluescreen.
  7458. @item brightness
  7459. Controls brightness of spill area, preserving colors.
  7460. @item alpha
  7461. Modify alpha from generated spillmap.
  7462. @end table
  7463. @subsection Commands
  7464. This filter supports the all above options as @ref{commands}.
  7465. @section detelecine
  7466. Apply an exact inverse of the telecine operation. It requires a predefined
  7467. pattern specified using the pattern option which must be the same as that passed
  7468. to the telecine filter.
  7469. This filter accepts the following options:
  7470. @table @option
  7471. @item first_field
  7472. @table @samp
  7473. @item top, t
  7474. top field first
  7475. @item bottom, b
  7476. bottom field first
  7477. The default value is @code{top}.
  7478. @end table
  7479. @item pattern
  7480. A string of numbers representing the pulldown pattern you wish to apply.
  7481. The default value is @code{23}.
  7482. @item start_frame
  7483. A number representing position of the first frame with respect to the telecine
  7484. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7485. @end table
  7486. @section dilation
  7487. Apply dilation effect to the video.
  7488. This filter replaces the pixel by the local(3x3) maximum.
  7489. It accepts the following options:
  7490. @table @option
  7491. @item threshold0
  7492. @item threshold1
  7493. @item threshold2
  7494. @item threshold3
  7495. Limit the maximum change for each plane, default is 65535.
  7496. If 0, plane will remain unchanged.
  7497. @item coordinates
  7498. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7499. pixels are used.
  7500. Flags to local 3x3 coordinates maps like this:
  7501. 1 2 3
  7502. 4 5
  7503. 6 7 8
  7504. @end table
  7505. @subsection Commands
  7506. This filter supports the all above options as @ref{commands}.
  7507. @section displace
  7508. Displace pixels as indicated by second and third input stream.
  7509. It takes three input streams and outputs one stream, the first input is the
  7510. source, and second and third input are displacement maps.
  7511. The second input specifies how much to displace pixels along the
  7512. x-axis, while the third input specifies how much to displace pixels
  7513. along the y-axis.
  7514. If one of displacement map streams terminates, last frame from that
  7515. displacement map will be used.
  7516. Note that once generated, displacements maps can be reused over and over again.
  7517. A description of the accepted options follows.
  7518. @table @option
  7519. @item edge
  7520. Set displace behavior for pixels that are out of range.
  7521. Available values are:
  7522. @table @samp
  7523. @item blank
  7524. Missing pixels are replaced by black pixels.
  7525. @item smear
  7526. Adjacent pixels will spread out to replace missing pixels.
  7527. @item wrap
  7528. Out of range pixels are wrapped so they point to pixels of other side.
  7529. @item mirror
  7530. Out of range pixels will be replaced with mirrored pixels.
  7531. @end table
  7532. Default is @samp{smear}.
  7533. @end table
  7534. @subsection Examples
  7535. @itemize
  7536. @item
  7537. Add ripple effect to rgb input of video size hd720:
  7538. @example
  7539. 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
  7540. @end example
  7541. @item
  7542. Add wave effect to rgb input of video size hd720:
  7543. @example
  7544. 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
  7545. @end example
  7546. @end itemize
  7547. @anchor{dnn_processing}
  7548. @section dnn_processing
  7549. Do image processing with deep neural networks. It works together with another filter
  7550. which converts the pixel format of the Frame to what the dnn network requires.
  7551. The filter accepts the following options:
  7552. @table @option
  7553. @item dnn_backend
  7554. Specify which DNN backend to use for model loading and execution. This option accepts
  7555. the following values:
  7556. @table @samp
  7557. @item native
  7558. Native implementation of DNN loading and execution.
  7559. @item tensorflow
  7560. TensorFlow backend. To enable this backend you
  7561. need to install the TensorFlow for C library (see
  7562. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7563. @code{--enable-libtensorflow}
  7564. @item openvino
  7565. OpenVINO backend. To enable this backend you
  7566. need to build and install the OpenVINO for C library (see
  7567. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7568. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7569. be needed if the header files and libraries are not installed into system path)
  7570. @end table
  7571. Default value is @samp{native}.
  7572. @item model
  7573. Set path to model file specifying network architecture and its parameters.
  7574. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7575. backend can load files for only its format.
  7576. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7577. @item input
  7578. Set the input name of the dnn network.
  7579. @item output
  7580. Set the output name of the dnn network.
  7581. @end table
  7582. @subsection Examples
  7583. @itemize
  7584. @item
  7585. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7586. @example
  7587. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7588. @end example
  7589. @item
  7590. Halve the pixel value of the frame with format gray32f:
  7591. @example
  7592. 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
  7593. @end example
  7594. @item
  7595. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7596. @example
  7597. ./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
  7598. @end example
  7599. @item
  7600. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7601. @example
  7602. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7603. @end example
  7604. @end itemize
  7605. @section drawbox
  7606. Draw a colored box on the input image.
  7607. It accepts the following parameters:
  7608. @table @option
  7609. @item x
  7610. @item y
  7611. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7612. @item width, w
  7613. @item height, h
  7614. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7615. the input width and height. It defaults to 0.
  7616. @item color, c
  7617. Specify the color of the box to write. For the general syntax of this option,
  7618. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7619. value @code{invert} is used, the box edge color is the same as the
  7620. video with inverted luma.
  7621. @item thickness, t
  7622. The expression which sets the thickness of the box edge.
  7623. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7624. See below for the list of accepted constants.
  7625. @item replace
  7626. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7627. will overwrite the video's color and alpha pixels.
  7628. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7629. @end table
  7630. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7631. following constants:
  7632. @table @option
  7633. @item dar
  7634. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7635. @item hsub
  7636. @item vsub
  7637. horizontal and vertical chroma subsample values. For example for the
  7638. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7639. @item in_h, ih
  7640. @item in_w, iw
  7641. The input width and height.
  7642. @item sar
  7643. The input sample aspect ratio.
  7644. @item x
  7645. @item y
  7646. The x and y offset coordinates where the box is drawn.
  7647. @item w
  7648. @item h
  7649. The width and height of the drawn box.
  7650. @item t
  7651. The thickness of the drawn box.
  7652. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7653. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7654. @end table
  7655. @subsection Examples
  7656. @itemize
  7657. @item
  7658. Draw a black box around the edge of the input image:
  7659. @example
  7660. drawbox
  7661. @end example
  7662. @item
  7663. Draw a box with color red and an opacity of 50%:
  7664. @example
  7665. drawbox=10:20:200:60:red@@0.5
  7666. @end example
  7667. The previous example can be specified as:
  7668. @example
  7669. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7670. @end example
  7671. @item
  7672. Fill the box with pink color:
  7673. @example
  7674. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7675. @end example
  7676. @item
  7677. Draw a 2-pixel red 2.40:1 mask:
  7678. @example
  7679. 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
  7680. @end example
  7681. @end itemize
  7682. @subsection Commands
  7683. This filter supports same commands as options.
  7684. The command accepts the same syntax of the corresponding option.
  7685. If the specified expression is not valid, it is kept at its current
  7686. value.
  7687. @anchor{drawgraph}
  7688. @section drawgraph
  7689. Draw a graph using input video metadata.
  7690. It accepts the following parameters:
  7691. @table @option
  7692. @item m1
  7693. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7694. @item fg1
  7695. Set 1st foreground color expression.
  7696. @item m2
  7697. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7698. @item fg2
  7699. Set 2nd foreground color expression.
  7700. @item m3
  7701. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7702. @item fg3
  7703. Set 3rd foreground color expression.
  7704. @item m4
  7705. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7706. @item fg4
  7707. Set 4th foreground color expression.
  7708. @item min
  7709. Set minimal value of metadata value.
  7710. @item max
  7711. Set maximal value of metadata value.
  7712. @item bg
  7713. Set graph background color. Default is white.
  7714. @item mode
  7715. Set graph mode.
  7716. Available values for mode is:
  7717. @table @samp
  7718. @item bar
  7719. @item dot
  7720. @item line
  7721. @end table
  7722. Default is @code{line}.
  7723. @item slide
  7724. Set slide mode.
  7725. Available values for slide is:
  7726. @table @samp
  7727. @item frame
  7728. Draw new frame when right border is reached.
  7729. @item replace
  7730. Replace old columns with new ones.
  7731. @item scroll
  7732. Scroll from right to left.
  7733. @item rscroll
  7734. Scroll from left to right.
  7735. @item picture
  7736. Draw single picture.
  7737. @end table
  7738. Default is @code{frame}.
  7739. @item size
  7740. Set size of graph video. For the syntax of this option, check the
  7741. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7742. The default value is @code{900x256}.
  7743. @item rate, r
  7744. Set the output frame rate. Default value is @code{25}.
  7745. The foreground color expressions can use the following variables:
  7746. @table @option
  7747. @item MIN
  7748. Minimal value of metadata value.
  7749. @item MAX
  7750. Maximal value of metadata value.
  7751. @item VAL
  7752. Current metadata key value.
  7753. @end table
  7754. The color is defined as 0xAABBGGRR.
  7755. @end table
  7756. Example using metadata from @ref{signalstats} filter:
  7757. @example
  7758. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7759. @end example
  7760. Example using metadata from @ref{ebur128} filter:
  7761. @example
  7762. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7763. @end example
  7764. @section drawgrid
  7765. Draw a grid on the input image.
  7766. It accepts the following parameters:
  7767. @table @option
  7768. @item x
  7769. @item y
  7770. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7771. @item width, w
  7772. @item height, h
  7773. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7774. input width and height, respectively, minus @code{thickness}, so image gets
  7775. framed. Default to 0.
  7776. @item color, c
  7777. Specify the color of the grid. For the general syntax of this option,
  7778. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7779. value @code{invert} is used, the grid color is the same as the
  7780. video with inverted luma.
  7781. @item thickness, t
  7782. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7783. See below for the list of accepted constants.
  7784. @item replace
  7785. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7786. will overwrite the video's color and alpha pixels.
  7787. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7788. @end table
  7789. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7790. following constants:
  7791. @table @option
  7792. @item dar
  7793. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7794. @item hsub
  7795. @item vsub
  7796. horizontal and vertical chroma subsample values. For example for the
  7797. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7798. @item in_h, ih
  7799. @item in_w, iw
  7800. The input grid cell width and height.
  7801. @item sar
  7802. The input sample aspect ratio.
  7803. @item x
  7804. @item y
  7805. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7806. @item w
  7807. @item h
  7808. The width and height of the drawn cell.
  7809. @item t
  7810. The thickness of the drawn cell.
  7811. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7812. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7813. @end table
  7814. @subsection Examples
  7815. @itemize
  7816. @item
  7817. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7818. @example
  7819. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7820. @end example
  7821. @item
  7822. Draw a white 3x3 grid with an opacity of 50%:
  7823. @example
  7824. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7825. @end example
  7826. @end itemize
  7827. @subsection Commands
  7828. This filter supports same commands as options.
  7829. The command accepts the same syntax of the corresponding option.
  7830. If the specified expression is not valid, it is kept at its current
  7831. value.
  7832. @anchor{drawtext}
  7833. @section drawtext
  7834. Draw a text string or text from a specified file on top of a video, using the
  7835. libfreetype library.
  7836. To enable compilation of this filter, you need to configure FFmpeg with
  7837. @code{--enable-libfreetype}.
  7838. To enable default font fallback and the @var{font} option you need to
  7839. configure FFmpeg with @code{--enable-libfontconfig}.
  7840. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7841. @code{--enable-libfribidi}.
  7842. @subsection Syntax
  7843. It accepts the following parameters:
  7844. @table @option
  7845. @item box
  7846. Used to draw a box around text using the background color.
  7847. The value must be either 1 (enable) or 0 (disable).
  7848. The default value of @var{box} is 0.
  7849. @item boxborderw
  7850. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7851. The default value of @var{boxborderw} is 0.
  7852. @item boxcolor
  7853. The color to be used for drawing box around text. For the syntax of this
  7854. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7855. The default value of @var{boxcolor} is "white".
  7856. @item line_spacing
  7857. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7858. The default value of @var{line_spacing} is 0.
  7859. @item borderw
  7860. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7861. The default value of @var{borderw} is 0.
  7862. @item bordercolor
  7863. Set the color to be used for drawing border around text. For the syntax of this
  7864. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7865. The default value of @var{bordercolor} is "black".
  7866. @item expansion
  7867. Select how the @var{text} is expanded. Can be either @code{none},
  7868. @code{strftime} (deprecated) or
  7869. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7870. below for details.
  7871. @item basetime
  7872. Set a start time for the count. Value is in microseconds. Only applied
  7873. in the deprecated strftime expansion mode. To emulate in normal expansion
  7874. mode use the @code{pts} function, supplying the start time (in seconds)
  7875. as the second argument.
  7876. @item fix_bounds
  7877. If true, check and fix text coords to avoid clipping.
  7878. @item fontcolor
  7879. The color to be used for drawing fonts. For the syntax of this option, check
  7880. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7881. The default value of @var{fontcolor} is "black".
  7882. @item fontcolor_expr
  7883. String which is expanded the same way as @var{text} to obtain dynamic
  7884. @var{fontcolor} value. By default this option has empty value and is not
  7885. processed. When this option is set, it overrides @var{fontcolor} option.
  7886. @item font
  7887. The font family to be used for drawing text. By default Sans.
  7888. @item fontfile
  7889. The font file to be used for drawing text. The path must be included.
  7890. This parameter is mandatory if the fontconfig support is disabled.
  7891. @item alpha
  7892. Draw the text applying alpha blending. The value can
  7893. be a number between 0.0 and 1.0.
  7894. The expression accepts the same variables @var{x, y} as well.
  7895. The default value is 1.
  7896. Please see @var{fontcolor_expr}.
  7897. @item fontsize
  7898. The font size to be used for drawing text.
  7899. The default value of @var{fontsize} is 16.
  7900. @item text_shaping
  7901. If set to 1, attempt to shape the text (for example, reverse the order of
  7902. right-to-left text and join Arabic characters) before drawing it.
  7903. Otherwise, just draw the text exactly as given.
  7904. By default 1 (if supported).
  7905. @item ft_load_flags
  7906. The flags to be used for loading the fonts.
  7907. The flags map the corresponding flags supported by libfreetype, and are
  7908. a combination of the following values:
  7909. @table @var
  7910. @item default
  7911. @item no_scale
  7912. @item no_hinting
  7913. @item render
  7914. @item no_bitmap
  7915. @item vertical_layout
  7916. @item force_autohint
  7917. @item crop_bitmap
  7918. @item pedantic
  7919. @item ignore_global_advance_width
  7920. @item no_recurse
  7921. @item ignore_transform
  7922. @item monochrome
  7923. @item linear_design
  7924. @item no_autohint
  7925. @end table
  7926. Default value is "default".
  7927. For more information consult the documentation for the FT_LOAD_*
  7928. libfreetype flags.
  7929. @item shadowcolor
  7930. The color to be used for drawing a shadow behind the drawn text. For the
  7931. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7932. ffmpeg-utils manual,ffmpeg-utils}.
  7933. The default value of @var{shadowcolor} is "black".
  7934. @item shadowx
  7935. @item shadowy
  7936. The x and y offsets for the text shadow position with respect to the
  7937. position of the text. They can be either positive or negative
  7938. values. The default value for both is "0".
  7939. @item start_number
  7940. The starting frame number for the n/frame_num variable. The default value
  7941. is "0".
  7942. @item tabsize
  7943. The size in number of spaces to use for rendering the tab.
  7944. Default value is 4.
  7945. @item timecode
  7946. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7947. format. It can be used with or without text parameter. @var{timecode_rate}
  7948. option must be specified.
  7949. @item timecode_rate, rate, r
  7950. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7951. integer. Minimum value is "1".
  7952. Drop-frame timecode is supported for frame rates 30 & 60.
  7953. @item tc24hmax
  7954. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7955. Default is 0 (disabled).
  7956. @item text
  7957. The text string to be drawn. The text must be a sequence of UTF-8
  7958. encoded characters.
  7959. This parameter is mandatory if no file is specified with the parameter
  7960. @var{textfile}.
  7961. @item textfile
  7962. A text file containing text to be drawn. The text must be a sequence
  7963. of UTF-8 encoded characters.
  7964. This parameter is mandatory if no text string is specified with the
  7965. parameter @var{text}.
  7966. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7967. @item reload
  7968. If set to 1, the @var{textfile} will be reloaded before each frame.
  7969. Be sure to update it atomically, or it may be read partially, or even fail.
  7970. @item x
  7971. @item y
  7972. The expressions which specify the offsets where text will be drawn
  7973. within the video frame. They are relative to the top/left border of the
  7974. output image.
  7975. The default value of @var{x} and @var{y} is "0".
  7976. See below for the list of accepted constants and functions.
  7977. @end table
  7978. The parameters for @var{x} and @var{y} are expressions containing the
  7979. following constants and functions:
  7980. @table @option
  7981. @item dar
  7982. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7983. @item hsub
  7984. @item vsub
  7985. horizontal and vertical chroma subsample values. For example for the
  7986. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7987. @item line_h, lh
  7988. the height of each text line
  7989. @item main_h, h, H
  7990. the input height
  7991. @item main_w, w, W
  7992. the input width
  7993. @item max_glyph_a, ascent
  7994. the maximum distance from the baseline to the highest/upper grid
  7995. coordinate used to place a glyph outline point, for all the rendered
  7996. glyphs.
  7997. It is a positive value, due to the grid's orientation with the Y axis
  7998. upwards.
  7999. @item max_glyph_d, descent
  8000. the maximum distance from the baseline to the lowest grid coordinate
  8001. used to place a glyph outline point, for all the rendered glyphs.
  8002. This is a negative value, due to the grid's orientation, with the Y axis
  8003. upwards.
  8004. @item max_glyph_h
  8005. maximum glyph height, that is the maximum height for all the glyphs
  8006. contained in the rendered text, it is equivalent to @var{ascent} -
  8007. @var{descent}.
  8008. @item max_glyph_w
  8009. maximum glyph width, that is the maximum width for all the glyphs
  8010. contained in the rendered text
  8011. @item n
  8012. the number of input frame, starting from 0
  8013. @item rand(min, max)
  8014. return a random number included between @var{min} and @var{max}
  8015. @item sar
  8016. The input sample aspect ratio.
  8017. @item t
  8018. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8019. @item text_h, th
  8020. the height of the rendered text
  8021. @item text_w, tw
  8022. the width of the rendered text
  8023. @item x
  8024. @item y
  8025. the x and y offset coordinates where the text is drawn.
  8026. These parameters allow the @var{x} and @var{y} expressions to refer
  8027. to each other, so you can for example specify @code{y=x/dar}.
  8028. @item pict_type
  8029. A one character description of the current frame's picture type.
  8030. @item pkt_pos
  8031. The current packet's position in the input file or stream
  8032. (in bytes, from the start of the input). A value of -1 indicates
  8033. this info is not available.
  8034. @item pkt_duration
  8035. The current packet's duration, in seconds.
  8036. @item pkt_size
  8037. The current packet's size (in bytes).
  8038. @end table
  8039. @anchor{drawtext_expansion}
  8040. @subsection Text expansion
  8041. If @option{expansion} is set to @code{strftime},
  8042. the filter recognizes strftime() sequences in the provided text and
  8043. expands them accordingly. Check the documentation of strftime(). This
  8044. feature is deprecated.
  8045. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8046. If @option{expansion} is set to @code{normal} (which is the default),
  8047. the following expansion mechanism is used.
  8048. The backslash character @samp{\}, followed by any character, always expands to
  8049. the second character.
  8050. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8051. braces is a function name, possibly followed by arguments separated by ':'.
  8052. If the arguments contain special characters or delimiters (':' or '@}'),
  8053. they should be escaped.
  8054. Note that they probably must also be escaped as the value for the
  8055. @option{text} option in the filter argument string and as the filter
  8056. argument in the filtergraph description, and possibly also for the shell,
  8057. that makes up to four levels of escaping; using a text file avoids these
  8058. problems.
  8059. The following functions are available:
  8060. @table @command
  8061. @item expr, e
  8062. The expression evaluation result.
  8063. It must take one argument specifying the expression to be evaluated,
  8064. which accepts the same constants and functions as the @var{x} and
  8065. @var{y} values. Note that not all constants should be used, for
  8066. example the text size is not known when evaluating the expression, so
  8067. the constants @var{text_w} and @var{text_h} will have an undefined
  8068. value.
  8069. @item expr_int_format, eif
  8070. Evaluate the expression's value and output as formatted integer.
  8071. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8072. The second argument specifies the output format. Allowed values are @samp{x},
  8073. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8074. @code{printf} function.
  8075. The third parameter is optional and sets the number of positions taken by the output.
  8076. It can be used to add padding with zeros from the left.
  8077. @item gmtime
  8078. The time at which the filter is running, expressed in UTC.
  8079. It can accept an argument: a strftime() format string.
  8080. @item localtime
  8081. The time at which the filter is running, expressed in the local time zone.
  8082. It can accept an argument: a strftime() format string.
  8083. @item metadata
  8084. Frame metadata. Takes one or two arguments.
  8085. The first argument is mandatory and specifies the metadata key.
  8086. The second argument is optional and specifies a default value, used when the
  8087. metadata key is not found or empty.
  8088. Available metadata can be identified by inspecting entries
  8089. starting with TAG included within each frame section
  8090. printed by running @code{ffprobe -show_frames}.
  8091. String metadata generated in filters leading to
  8092. the drawtext filter are also available.
  8093. @item n, frame_num
  8094. The frame number, starting from 0.
  8095. @item pict_type
  8096. A one character description of the current picture type.
  8097. @item pts
  8098. The timestamp of the current frame.
  8099. It can take up to three arguments.
  8100. The first argument is the format of the timestamp; it defaults to @code{flt}
  8101. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8102. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8103. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8104. @code{localtime} stands for the timestamp of the frame formatted as
  8105. local time zone time.
  8106. The second argument is an offset added to the timestamp.
  8107. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8108. supplied to present the hour part of the formatted timestamp in 24h format
  8109. (00-23).
  8110. If the format is set to @code{localtime} or @code{gmtime},
  8111. a third argument may be supplied: a strftime() format string.
  8112. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8113. @end table
  8114. @subsection Commands
  8115. This filter supports altering parameters via commands:
  8116. @table @option
  8117. @item reinit
  8118. Alter existing filter parameters.
  8119. Syntax for the argument is the same as for filter invocation, e.g.
  8120. @example
  8121. fontsize=56:fontcolor=green:text='Hello World'
  8122. @end example
  8123. Full filter invocation with sendcmd would look like this:
  8124. @example
  8125. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8126. @end example
  8127. @end table
  8128. If the entire argument can't be parsed or applied as valid values then the filter will
  8129. continue with its existing parameters.
  8130. @subsection Examples
  8131. @itemize
  8132. @item
  8133. Draw "Test Text" with font FreeSerif, using the default values for the
  8134. optional parameters.
  8135. @example
  8136. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8137. @end example
  8138. @item
  8139. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8140. and y=50 (counting from the top-left corner of the screen), text is
  8141. yellow with a red box around it. Both the text and the box have an
  8142. opacity of 20%.
  8143. @example
  8144. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8145. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8146. @end example
  8147. Note that the double quotes are not necessary if spaces are not used
  8148. within the parameter list.
  8149. @item
  8150. Show the text at the center of the video frame:
  8151. @example
  8152. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8153. @end example
  8154. @item
  8155. Show the text at a random position, switching to a new position every 30 seconds:
  8156. @example
  8157. 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)"
  8158. @end example
  8159. @item
  8160. Show a text line sliding from right to left in the last row of the video
  8161. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8162. with no newlines.
  8163. @example
  8164. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8165. @end example
  8166. @item
  8167. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8168. @example
  8169. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8170. @end example
  8171. @item
  8172. Draw a single green letter "g", at the center of the input video.
  8173. The glyph baseline is placed at half screen height.
  8174. @example
  8175. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8176. @end example
  8177. @item
  8178. Show text for 1 second every 3 seconds:
  8179. @example
  8180. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8181. @end example
  8182. @item
  8183. Use fontconfig to set the font. Note that the colons need to be escaped.
  8184. @example
  8185. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8186. @end example
  8187. @item
  8188. Draw "Test Text" with font size dependent on height of the video.
  8189. @example
  8190. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8191. @end example
  8192. @item
  8193. Print the date of a real-time encoding (see strftime(3)):
  8194. @example
  8195. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8196. @end example
  8197. @item
  8198. Show text fading in and out (appearing/disappearing):
  8199. @example
  8200. #!/bin/sh
  8201. DS=1.0 # display start
  8202. DE=10.0 # display end
  8203. FID=1.5 # fade in duration
  8204. FOD=5 # fade out duration
  8205. 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 @}"
  8206. @end example
  8207. @item
  8208. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8209. and the @option{fontsize} value are included in the @option{y} offset.
  8210. @example
  8211. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8212. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8213. @end example
  8214. @item
  8215. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8216. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8217. must have option @option{-export_path_metadata 1} for the special metadata fields
  8218. to be available for filters.
  8219. @example
  8220. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8221. @end example
  8222. @end itemize
  8223. For more information about libfreetype, check:
  8224. @url{http://www.freetype.org/}.
  8225. For more information about fontconfig, check:
  8226. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8227. For more information about libfribidi, check:
  8228. @url{http://fribidi.org/}.
  8229. @section edgedetect
  8230. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8231. The filter accepts the following options:
  8232. @table @option
  8233. @item low
  8234. @item high
  8235. Set low and high threshold values used by the Canny thresholding
  8236. algorithm.
  8237. The high threshold selects the "strong" edge pixels, which are then
  8238. connected through 8-connectivity with the "weak" edge pixels selected
  8239. by the low threshold.
  8240. @var{low} and @var{high} threshold values must be chosen in the range
  8241. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8242. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8243. is @code{50/255}.
  8244. @item mode
  8245. Define the drawing mode.
  8246. @table @samp
  8247. @item wires
  8248. Draw white/gray wires on black background.
  8249. @item colormix
  8250. Mix the colors to create a paint/cartoon effect.
  8251. @item canny
  8252. Apply Canny edge detector on all selected planes.
  8253. @end table
  8254. Default value is @var{wires}.
  8255. @item planes
  8256. Select planes for filtering. By default all available planes are filtered.
  8257. @end table
  8258. @subsection Examples
  8259. @itemize
  8260. @item
  8261. Standard edge detection with custom values for the hysteresis thresholding:
  8262. @example
  8263. edgedetect=low=0.1:high=0.4
  8264. @end example
  8265. @item
  8266. Painting effect without thresholding:
  8267. @example
  8268. edgedetect=mode=colormix:high=0
  8269. @end example
  8270. @end itemize
  8271. @section elbg
  8272. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8273. For each input image, the filter will compute the optimal mapping from
  8274. the input to the output given the codebook length, that is the number
  8275. of distinct output colors.
  8276. This filter accepts the following options.
  8277. @table @option
  8278. @item codebook_length, l
  8279. Set codebook length. The value must be a positive integer, and
  8280. represents the number of distinct output colors. Default value is 256.
  8281. @item nb_steps, n
  8282. Set the maximum number of iterations to apply for computing the optimal
  8283. mapping. The higher the value the better the result and the higher the
  8284. computation time. Default value is 1.
  8285. @item seed, s
  8286. Set a random seed, must be an integer included between 0 and
  8287. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8288. will try to use a good random seed on a best effort basis.
  8289. @item pal8
  8290. Set pal8 output pixel format. This option does not work with codebook
  8291. length greater than 256.
  8292. @end table
  8293. @section entropy
  8294. Measure graylevel entropy in histogram of color channels of video frames.
  8295. It accepts the following parameters:
  8296. @table @option
  8297. @item mode
  8298. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8299. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8300. between neighbour histogram values.
  8301. @end table
  8302. @section eq
  8303. Set brightness, contrast, saturation and approximate gamma adjustment.
  8304. The filter accepts the following options:
  8305. @table @option
  8306. @item contrast
  8307. Set the contrast expression. The value must be a float value in range
  8308. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8309. @item brightness
  8310. Set the brightness expression. The value must be a float value in
  8311. range @code{-1.0} to @code{1.0}. The default value is "0".
  8312. @item saturation
  8313. Set the saturation expression. The value must be a float in
  8314. range @code{0.0} to @code{3.0}. The default value is "1".
  8315. @item gamma
  8316. Set the gamma expression. The value must be a float in range
  8317. @code{0.1} to @code{10.0}. The default value is "1".
  8318. @item gamma_r
  8319. Set the gamma expression for red. The value must be a float in
  8320. range @code{0.1} to @code{10.0}. The default value is "1".
  8321. @item gamma_g
  8322. Set the gamma expression for green. The value must be a float in range
  8323. @code{0.1} to @code{10.0}. The default value is "1".
  8324. @item gamma_b
  8325. Set the gamma expression for blue. The value must be a float in range
  8326. @code{0.1} to @code{10.0}. The default value is "1".
  8327. @item gamma_weight
  8328. Set the gamma weight expression. It can be used to reduce the effect
  8329. of a high gamma value on bright image areas, e.g. keep them from
  8330. getting overamplified and just plain white. The value must be a float
  8331. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8332. gamma correction all the way down while @code{1.0} leaves it at its
  8333. full strength. Default is "1".
  8334. @item eval
  8335. Set when the expressions for brightness, contrast, saturation and
  8336. gamma expressions are evaluated.
  8337. It accepts the following values:
  8338. @table @samp
  8339. @item init
  8340. only evaluate expressions once during the filter initialization or
  8341. when a command is processed
  8342. @item frame
  8343. evaluate expressions for each incoming frame
  8344. @end table
  8345. Default value is @samp{init}.
  8346. @end table
  8347. The expressions accept the following parameters:
  8348. @table @option
  8349. @item n
  8350. frame count of the input frame starting from 0
  8351. @item pos
  8352. byte position of the corresponding packet in the input file, NAN if
  8353. unspecified
  8354. @item r
  8355. frame rate of the input video, NAN if the input frame rate is unknown
  8356. @item t
  8357. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8358. @end table
  8359. @subsection Commands
  8360. The filter supports the following commands:
  8361. @table @option
  8362. @item contrast
  8363. Set the contrast expression.
  8364. @item brightness
  8365. Set the brightness expression.
  8366. @item saturation
  8367. Set the saturation expression.
  8368. @item gamma
  8369. Set the gamma expression.
  8370. @item gamma_r
  8371. Set the gamma_r expression.
  8372. @item gamma_g
  8373. Set gamma_g expression.
  8374. @item gamma_b
  8375. Set gamma_b expression.
  8376. @item gamma_weight
  8377. Set gamma_weight expression.
  8378. The command accepts the same syntax of the corresponding option.
  8379. If the specified expression is not valid, it is kept at its current
  8380. value.
  8381. @end table
  8382. @section erosion
  8383. Apply erosion effect to the video.
  8384. This filter replaces the pixel by the local(3x3) minimum.
  8385. It accepts the following options:
  8386. @table @option
  8387. @item threshold0
  8388. @item threshold1
  8389. @item threshold2
  8390. @item threshold3
  8391. Limit the maximum change for each plane, default is 65535.
  8392. If 0, plane will remain unchanged.
  8393. @item coordinates
  8394. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8395. pixels are used.
  8396. Flags to local 3x3 coordinates maps like this:
  8397. 1 2 3
  8398. 4 5
  8399. 6 7 8
  8400. @end table
  8401. @subsection Commands
  8402. This filter supports the all above options as @ref{commands}.
  8403. @section extractplanes
  8404. Extract color channel components from input video stream into
  8405. separate grayscale video streams.
  8406. The filter accepts the following option:
  8407. @table @option
  8408. @item planes
  8409. Set plane(s) to extract.
  8410. Available values for planes are:
  8411. @table @samp
  8412. @item y
  8413. @item u
  8414. @item v
  8415. @item a
  8416. @item r
  8417. @item g
  8418. @item b
  8419. @end table
  8420. Choosing planes not available in the input will result in an error.
  8421. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8422. with @code{y}, @code{u}, @code{v} planes at same time.
  8423. @end table
  8424. @subsection Examples
  8425. @itemize
  8426. @item
  8427. Extract luma, u and v color channel component from input video frame
  8428. into 3 grayscale outputs:
  8429. @example
  8430. 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
  8431. @end example
  8432. @end itemize
  8433. @section fade
  8434. Apply a fade-in/out effect to the input video.
  8435. It accepts the following parameters:
  8436. @table @option
  8437. @item type, t
  8438. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8439. effect.
  8440. Default is @code{in}.
  8441. @item start_frame, s
  8442. Specify the number of the frame to start applying the fade
  8443. effect at. Default is 0.
  8444. @item nb_frames, n
  8445. The number of frames that the fade effect lasts. At the end of the
  8446. fade-in effect, the output video will have the same intensity as the input video.
  8447. At the end of the fade-out transition, the output video will be filled with the
  8448. selected @option{color}.
  8449. Default is 25.
  8450. @item alpha
  8451. If set to 1, fade only alpha channel, if one exists on the input.
  8452. Default value is 0.
  8453. @item start_time, st
  8454. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8455. effect. If both start_frame and start_time are specified, the fade will start at
  8456. whichever comes last. Default is 0.
  8457. @item duration, d
  8458. The number of seconds for which the fade effect has to last. At the end of the
  8459. fade-in effect the output video will have the same intensity as the input video,
  8460. at the end of the fade-out transition the output video will be filled with the
  8461. selected @option{color}.
  8462. If both duration and nb_frames are specified, duration is used. Default is 0
  8463. (nb_frames is used by default).
  8464. @item color, c
  8465. Specify the color of the fade. Default is "black".
  8466. @end table
  8467. @subsection Examples
  8468. @itemize
  8469. @item
  8470. Fade in the first 30 frames of video:
  8471. @example
  8472. fade=in:0:30
  8473. @end example
  8474. The command above is equivalent to:
  8475. @example
  8476. fade=t=in:s=0:n=30
  8477. @end example
  8478. @item
  8479. Fade out the last 45 frames of a 200-frame video:
  8480. @example
  8481. fade=out:155:45
  8482. fade=type=out:start_frame=155:nb_frames=45
  8483. @end example
  8484. @item
  8485. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8486. @example
  8487. fade=in:0:25, fade=out:975:25
  8488. @end example
  8489. @item
  8490. Make the first 5 frames yellow, then fade in from frame 5-24:
  8491. @example
  8492. fade=in:5:20:color=yellow
  8493. @end example
  8494. @item
  8495. Fade in alpha over first 25 frames of video:
  8496. @example
  8497. fade=in:0:25:alpha=1
  8498. @end example
  8499. @item
  8500. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8501. @example
  8502. fade=t=in:st=5.5:d=0.5
  8503. @end example
  8504. @end itemize
  8505. @section fftdnoiz
  8506. Denoise frames using 3D FFT (frequency domain filtering).
  8507. The filter accepts the following options:
  8508. @table @option
  8509. @item sigma
  8510. Set the noise sigma constant. This sets denoising strength.
  8511. Default value is 1. Allowed range is from 0 to 30.
  8512. Using very high sigma with low overlap may give blocking artifacts.
  8513. @item amount
  8514. Set amount of denoising. By default all detected noise is reduced.
  8515. Default value is 1. Allowed range is from 0 to 1.
  8516. @item block
  8517. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8518. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8519. block size in pixels is 2^4 which is 16.
  8520. @item overlap
  8521. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8522. @item prev
  8523. Set number of previous frames to use for denoising. By default is set to 0.
  8524. @item next
  8525. Set number of next frames to to use for denoising. By default is set to 0.
  8526. @item planes
  8527. Set planes which will be filtered, by default are all available filtered
  8528. except alpha.
  8529. @end table
  8530. @section fftfilt
  8531. Apply arbitrary expressions to samples in frequency domain
  8532. @table @option
  8533. @item dc_Y
  8534. Adjust the dc value (gain) of the luma plane of the image. The filter
  8535. accepts an integer value in range @code{0} to @code{1000}. The default
  8536. value is set to @code{0}.
  8537. @item dc_U
  8538. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8539. filter accepts an integer value in range @code{0} to @code{1000}. The
  8540. default value is set to @code{0}.
  8541. @item dc_V
  8542. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8543. filter accepts an integer value in range @code{0} to @code{1000}. The
  8544. default value is set to @code{0}.
  8545. @item weight_Y
  8546. Set the frequency domain weight expression for the luma plane.
  8547. @item weight_U
  8548. Set the frequency domain weight expression for the 1st chroma plane.
  8549. @item weight_V
  8550. Set the frequency domain weight expression for the 2nd chroma plane.
  8551. @item eval
  8552. Set when the expressions are evaluated.
  8553. It accepts the following values:
  8554. @table @samp
  8555. @item init
  8556. Only evaluate expressions once during the filter initialization.
  8557. @item frame
  8558. Evaluate expressions for each incoming frame.
  8559. @end table
  8560. Default value is @samp{init}.
  8561. The filter accepts the following variables:
  8562. @item X
  8563. @item Y
  8564. The coordinates of the current sample.
  8565. @item W
  8566. @item H
  8567. The width and height of the image.
  8568. @item N
  8569. The number of input frame, starting from 0.
  8570. @end table
  8571. @subsection Examples
  8572. @itemize
  8573. @item
  8574. High-pass:
  8575. @example
  8576. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8577. @end example
  8578. @item
  8579. Low-pass:
  8580. @example
  8581. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8582. @end example
  8583. @item
  8584. Sharpen:
  8585. @example
  8586. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8587. @end example
  8588. @item
  8589. Blur:
  8590. @example
  8591. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8592. @end example
  8593. @end itemize
  8594. @section field
  8595. Extract a single field from an interlaced image using stride
  8596. arithmetic to avoid wasting CPU time. The output frames are marked as
  8597. non-interlaced.
  8598. The filter accepts the following options:
  8599. @table @option
  8600. @item type
  8601. Specify whether to extract the top (if the value is @code{0} or
  8602. @code{top}) or the bottom field (if the value is @code{1} or
  8603. @code{bottom}).
  8604. @end table
  8605. @section fieldhint
  8606. Create new frames by copying the top and bottom fields from surrounding frames
  8607. supplied as numbers by the hint file.
  8608. @table @option
  8609. @item hint
  8610. Set file containing hints: absolute/relative frame numbers.
  8611. There must be one line for each frame in a clip. Each line must contain two
  8612. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8613. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8614. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8615. for @code{relative} mode. First number tells from which frame to pick up top
  8616. field and second number tells from which frame to pick up bottom field.
  8617. If optionally followed by @code{+} output frame will be marked as interlaced,
  8618. else if followed by @code{-} output frame will be marked as progressive, else
  8619. it will be marked same as input frame.
  8620. If optionally followed by @code{t} output frame will use only top field, or in
  8621. case of @code{b} it will use only bottom field.
  8622. If line starts with @code{#} or @code{;} that line is skipped.
  8623. @item mode
  8624. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8625. @end table
  8626. Example of first several lines of @code{hint} file for @code{relative} mode:
  8627. @example
  8628. 0,0 - # first frame
  8629. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8630. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8631. 1,0 -
  8632. 0,0 -
  8633. 0,0 -
  8634. 1,0 -
  8635. 1,0 -
  8636. 1,0 -
  8637. 0,0 -
  8638. 0,0 -
  8639. 1,0 -
  8640. 1,0 -
  8641. 1,0 -
  8642. 0,0 -
  8643. @end example
  8644. @section fieldmatch
  8645. Field matching filter for inverse telecine. It is meant to reconstruct the
  8646. progressive frames from a telecined stream. The filter does not drop duplicated
  8647. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8648. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8649. The separation of the field matching and the decimation is notably motivated by
  8650. the possibility of inserting a de-interlacing filter fallback between the two.
  8651. If the source has mixed telecined and real interlaced content,
  8652. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8653. But these remaining combed frames will be marked as interlaced, and thus can be
  8654. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8655. In addition to the various configuration options, @code{fieldmatch} can take an
  8656. optional second stream, activated through the @option{ppsrc} option. If
  8657. enabled, the frames reconstruction will be based on the fields and frames from
  8658. this second stream. This allows the first input to be pre-processed in order to
  8659. help the various algorithms of the filter, while keeping the output lossless
  8660. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8661. or brightness/contrast adjustments can help.
  8662. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8663. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8664. which @code{fieldmatch} is based on. While the semantic and usage are very
  8665. close, some behaviour and options names can differ.
  8666. The @ref{decimate} filter currently only works for constant frame rate input.
  8667. If your input has mixed telecined (30fps) and progressive content with a lower
  8668. framerate like 24fps use the following filterchain to produce the necessary cfr
  8669. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8670. The filter accepts the following options:
  8671. @table @option
  8672. @item order
  8673. Specify the assumed field order of the input stream. Available values are:
  8674. @table @samp
  8675. @item auto
  8676. Auto detect parity (use FFmpeg's internal parity value).
  8677. @item bff
  8678. Assume bottom field first.
  8679. @item tff
  8680. Assume top field first.
  8681. @end table
  8682. Note that it is sometimes recommended not to trust the parity announced by the
  8683. stream.
  8684. Default value is @var{auto}.
  8685. @item mode
  8686. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8687. sense that it won't risk creating jerkiness due to duplicate frames when
  8688. possible, but if there are bad edits or blended fields it will end up
  8689. outputting combed frames when a good match might actually exist. On the other
  8690. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8691. but will almost always find a good frame if there is one. The other values are
  8692. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8693. jerkiness and creating duplicate frames versus finding good matches in sections
  8694. with bad edits, orphaned fields, blended fields, etc.
  8695. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8696. Available values are:
  8697. @table @samp
  8698. @item pc
  8699. 2-way matching (p/c)
  8700. @item pc_n
  8701. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8702. @item pc_u
  8703. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8704. @item pc_n_ub
  8705. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8706. still combed (p/c + n + u/b)
  8707. @item pcn
  8708. 3-way matching (p/c/n)
  8709. @item pcn_ub
  8710. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8711. detected as combed (p/c/n + u/b)
  8712. @end table
  8713. The parenthesis at the end indicate the matches that would be used for that
  8714. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8715. @var{top}).
  8716. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8717. the slowest.
  8718. Default value is @var{pc_n}.
  8719. @item ppsrc
  8720. Mark the main input stream as a pre-processed input, and enable the secondary
  8721. input stream as the clean source to pick the fields from. See the filter
  8722. introduction for more details. It is similar to the @option{clip2} feature from
  8723. VFM/TFM.
  8724. Default value is @code{0} (disabled).
  8725. @item field
  8726. Set the field to match from. It is recommended to set this to the same value as
  8727. @option{order} unless you experience matching failures with that setting. In
  8728. certain circumstances changing the field that is used to match from can have a
  8729. large impact on matching performance. Available values are:
  8730. @table @samp
  8731. @item auto
  8732. Automatic (same value as @option{order}).
  8733. @item bottom
  8734. Match from the bottom field.
  8735. @item top
  8736. Match from the top field.
  8737. @end table
  8738. Default value is @var{auto}.
  8739. @item mchroma
  8740. Set whether or not chroma is included during the match comparisons. In most
  8741. cases it is recommended to leave this enabled. You should set this to @code{0}
  8742. only if your clip has bad chroma problems such as heavy rainbowing or other
  8743. artifacts. Setting this to @code{0} could also be used to speed things up at
  8744. the cost of some accuracy.
  8745. Default value is @code{1}.
  8746. @item y0
  8747. @item y1
  8748. These define an exclusion band which excludes the lines between @option{y0} and
  8749. @option{y1} from being included in the field matching decision. An exclusion
  8750. band can be used to ignore subtitles, a logo, or other things that may
  8751. interfere with the matching. @option{y0} sets the starting scan line and
  8752. @option{y1} sets the ending line; all lines in between @option{y0} and
  8753. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8754. @option{y0} and @option{y1} to the same value will disable the feature.
  8755. @option{y0} and @option{y1} defaults to @code{0}.
  8756. @item scthresh
  8757. Set the scene change detection threshold as a percentage of maximum change on
  8758. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8759. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8760. @option{scthresh} is @code{[0.0, 100.0]}.
  8761. Default value is @code{12.0}.
  8762. @item combmatch
  8763. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8764. account the combed scores of matches when deciding what match to use as the
  8765. final match. Available values are:
  8766. @table @samp
  8767. @item none
  8768. No final matching based on combed scores.
  8769. @item sc
  8770. Combed scores are only used when a scene change is detected.
  8771. @item full
  8772. Use combed scores all the time.
  8773. @end table
  8774. Default is @var{sc}.
  8775. @item combdbg
  8776. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8777. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8778. Available values are:
  8779. @table @samp
  8780. @item none
  8781. No forced calculation.
  8782. @item pcn
  8783. Force p/c/n calculations.
  8784. @item pcnub
  8785. Force p/c/n/u/b calculations.
  8786. @end table
  8787. Default value is @var{none}.
  8788. @item cthresh
  8789. This is the area combing threshold used for combed frame detection. This
  8790. essentially controls how "strong" or "visible" combing must be to be detected.
  8791. Larger values mean combing must be more visible and smaller values mean combing
  8792. can be less visible or strong and still be detected. Valid settings are from
  8793. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8794. be detected as combed). This is basically a pixel difference value. A good
  8795. range is @code{[8, 12]}.
  8796. Default value is @code{9}.
  8797. @item chroma
  8798. Sets whether or not chroma is considered in the combed frame decision. Only
  8799. disable this if your source has chroma problems (rainbowing, etc.) that are
  8800. causing problems for the combed frame detection with chroma enabled. Actually,
  8801. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8802. where there is chroma only combing in the source.
  8803. Default value is @code{0}.
  8804. @item blockx
  8805. @item blocky
  8806. Respectively set the x-axis and y-axis size of the window used during combed
  8807. frame detection. This has to do with the size of the area in which
  8808. @option{combpel} pixels are required to be detected as combed for a frame to be
  8809. declared combed. See the @option{combpel} parameter description for more info.
  8810. Possible values are any number that is a power of 2 starting at 4 and going up
  8811. to 512.
  8812. Default value is @code{16}.
  8813. @item combpel
  8814. The number of combed pixels inside any of the @option{blocky} by
  8815. @option{blockx} size blocks on the frame for the frame to be detected as
  8816. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8817. setting controls "how much" combing there must be in any localized area (a
  8818. window defined by the @option{blockx} and @option{blocky} settings) on the
  8819. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8820. which point no frames will ever be detected as combed). This setting is known
  8821. as @option{MI} in TFM/VFM vocabulary.
  8822. Default value is @code{80}.
  8823. @end table
  8824. @anchor{p/c/n/u/b meaning}
  8825. @subsection p/c/n/u/b meaning
  8826. @subsubsection p/c/n
  8827. We assume the following telecined stream:
  8828. @example
  8829. Top fields: 1 2 2 3 4
  8830. Bottom fields: 1 2 3 4 4
  8831. @end example
  8832. The numbers correspond to the progressive frame the fields relate to. Here, the
  8833. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8834. When @code{fieldmatch} is configured to run a matching from bottom
  8835. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8836. @example
  8837. Input stream:
  8838. T 1 2 2 3 4
  8839. B 1 2 3 4 4 <-- matching reference
  8840. Matches: c c n n c
  8841. Output stream:
  8842. T 1 2 3 4 4
  8843. B 1 2 3 4 4
  8844. @end example
  8845. As a result of the field matching, we can see that some frames get duplicated.
  8846. To perform a complete inverse telecine, you need to rely on a decimation filter
  8847. after this operation. See for instance the @ref{decimate} filter.
  8848. The same operation now matching from top fields (@option{field}=@var{top})
  8849. looks like this:
  8850. @example
  8851. Input stream:
  8852. T 1 2 2 3 4 <-- matching reference
  8853. B 1 2 3 4 4
  8854. Matches: c c p p c
  8855. Output stream:
  8856. T 1 2 2 3 4
  8857. B 1 2 2 3 4
  8858. @end example
  8859. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8860. basically, they refer to the frame and field of the opposite parity:
  8861. @itemize
  8862. @item @var{p} matches the field of the opposite parity in the previous frame
  8863. @item @var{c} matches the field of the opposite parity in the current frame
  8864. @item @var{n} matches the field of the opposite parity in the next frame
  8865. @end itemize
  8866. @subsubsection u/b
  8867. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8868. from the opposite parity flag. In the following examples, we assume that we are
  8869. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8870. 'x' is placed above and below each matched fields.
  8871. With bottom matching (@option{field}=@var{bottom}):
  8872. @example
  8873. Match: c p n b u
  8874. x x x x x
  8875. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8876. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8877. x x x x x
  8878. Output frames:
  8879. 2 1 2 2 2
  8880. 2 2 2 1 3
  8881. @end example
  8882. With top matching (@option{field}=@var{top}):
  8883. @example
  8884. Match: c p n b u
  8885. x x x x x
  8886. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8887. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8888. x x x x x
  8889. Output frames:
  8890. 2 2 2 1 2
  8891. 2 1 3 2 2
  8892. @end example
  8893. @subsection Examples
  8894. Simple IVTC of a top field first telecined stream:
  8895. @example
  8896. fieldmatch=order=tff:combmatch=none, decimate
  8897. @end example
  8898. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8899. @example
  8900. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8901. @end example
  8902. @section fieldorder
  8903. Transform the field order of the input video.
  8904. It accepts the following parameters:
  8905. @table @option
  8906. @item order
  8907. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8908. for bottom field first.
  8909. @end table
  8910. The default value is @samp{tff}.
  8911. The transformation is done by shifting the picture content up or down
  8912. by one line, and filling the remaining line with appropriate picture content.
  8913. This method is consistent with most broadcast field order converters.
  8914. If the input video is not flagged as being interlaced, or it is already
  8915. flagged as being of the required output field order, then this filter does
  8916. not alter the incoming video.
  8917. It is very useful when converting to or from PAL DV material,
  8918. which is bottom field first.
  8919. For example:
  8920. @example
  8921. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8922. @end example
  8923. @section fifo, afifo
  8924. Buffer input images and send them when they are requested.
  8925. It is mainly useful when auto-inserted by the libavfilter
  8926. framework.
  8927. It does not take parameters.
  8928. @section fillborders
  8929. Fill borders of the input video, without changing video stream dimensions.
  8930. Sometimes video can have garbage at the four edges and you may not want to
  8931. crop video input to keep size multiple of some number.
  8932. This filter accepts the following options:
  8933. @table @option
  8934. @item left
  8935. Number of pixels to fill from left border.
  8936. @item right
  8937. Number of pixels to fill from right border.
  8938. @item top
  8939. Number of pixels to fill from top border.
  8940. @item bottom
  8941. Number of pixels to fill from bottom border.
  8942. @item mode
  8943. Set fill mode.
  8944. It accepts the following values:
  8945. @table @samp
  8946. @item smear
  8947. fill pixels using outermost pixels
  8948. @item mirror
  8949. fill pixels using mirroring
  8950. @item fixed
  8951. fill pixels with constant value
  8952. @end table
  8953. Default is @var{smear}.
  8954. @item color
  8955. Set color for pixels in fixed mode. Default is @var{black}.
  8956. @end table
  8957. @subsection Commands
  8958. This filter supports same @ref{commands} as options.
  8959. The command accepts the same syntax of the corresponding option.
  8960. If the specified expression is not valid, it is kept at its current
  8961. value.
  8962. @section find_rect
  8963. Find a rectangular object
  8964. It accepts the following options:
  8965. @table @option
  8966. @item object
  8967. Filepath of the object image, needs to be in gray8.
  8968. @item threshold
  8969. Detection threshold, default is 0.5.
  8970. @item mipmaps
  8971. Number of mipmaps, default is 3.
  8972. @item xmin, ymin, xmax, ymax
  8973. Specifies the rectangle in which to search.
  8974. @end table
  8975. @subsection Examples
  8976. @itemize
  8977. @item
  8978. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8979. @example
  8980. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8981. @end example
  8982. @end itemize
  8983. @section floodfill
  8984. Flood area with values of same pixel components with another values.
  8985. It accepts the following options:
  8986. @table @option
  8987. @item x
  8988. Set pixel x coordinate.
  8989. @item y
  8990. Set pixel y coordinate.
  8991. @item s0
  8992. Set source #0 component value.
  8993. @item s1
  8994. Set source #1 component value.
  8995. @item s2
  8996. Set source #2 component value.
  8997. @item s3
  8998. Set source #3 component value.
  8999. @item d0
  9000. Set destination #0 component value.
  9001. @item d1
  9002. Set destination #1 component value.
  9003. @item d2
  9004. Set destination #2 component value.
  9005. @item d3
  9006. Set destination #3 component value.
  9007. @end table
  9008. @anchor{format}
  9009. @section format
  9010. Convert the input video to one of the specified pixel formats.
  9011. Libavfilter will try to pick one that is suitable as input to
  9012. the next filter.
  9013. It accepts the following parameters:
  9014. @table @option
  9015. @item pix_fmts
  9016. A '|'-separated list of pixel format names, such as
  9017. "pix_fmts=yuv420p|monow|rgb24".
  9018. @end table
  9019. @subsection Examples
  9020. @itemize
  9021. @item
  9022. Convert the input video to the @var{yuv420p} format
  9023. @example
  9024. format=pix_fmts=yuv420p
  9025. @end example
  9026. Convert the input video to any of the formats in the list
  9027. @example
  9028. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9029. @end example
  9030. @end itemize
  9031. @anchor{fps}
  9032. @section fps
  9033. Convert the video to specified constant frame rate by duplicating or dropping
  9034. frames as necessary.
  9035. It accepts the following parameters:
  9036. @table @option
  9037. @item fps
  9038. The desired output frame rate. The default is @code{25}.
  9039. @item start_time
  9040. Assume the first PTS should be the given value, in seconds. This allows for
  9041. padding/trimming at the start of stream. By default, no assumption is made
  9042. about the first frame's expected PTS, so no padding or trimming is done.
  9043. For example, this could be set to 0 to pad the beginning with duplicates of
  9044. the first frame if a video stream starts after the audio stream or to trim any
  9045. frames with a negative PTS.
  9046. @item round
  9047. Timestamp (PTS) rounding method.
  9048. Possible values are:
  9049. @table @option
  9050. @item zero
  9051. round towards 0
  9052. @item inf
  9053. round away from 0
  9054. @item down
  9055. round towards -infinity
  9056. @item up
  9057. round towards +infinity
  9058. @item near
  9059. round to nearest
  9060. @end table
  9061. The default is @code{near}.
  9062. @item eof_action
  9063. Action performed when reading the last frame.
  9064. Possible values are:
  9065. @table @option
  9066. @item round
  9067. Use same timestamp rounding method as used for other frames.
  9068. @item pass
  9069. Pass through last frame if input duration has not been reached yet.
  9070. @end table
  9071. The default is @code{round}.
  9072. @end table
  9073. Alternatively, the options can be specified as a flat string:
  9074. @var{fps}[:@var{start_time}[:@var{round}]].
  9075. See also the @ref{setpts} filter.
  9076. @subsection Examples
  9077. @itemize
  9078. @item
  9079. A typical usage in order to set the fps to 25:
  9080. @example
  9081. fps=fps=25
  9082. @end example
  9083. @item
  9084. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9085. @example
  9086. fps=fps=film:round=near
  9087. @end example
  9088. @end itemize
  9089. @section framepack
  9090. Pack two different video streams into a stereoscopic video, setting proper
  9091. metadata on supported codecs. The two views should have the same size and
  9092. framerate and processing will stop when the shorter video ends. Please note
  9093. that you may conveniently adjust view properties with the @ref{scale} and
  9094. @ref{fps} filters.
  9095. It accepts the following parameters:
  9096. @table @option
  9097. @item format
  9098. The desired packing format. Supported values are:
  9099. @table @option
  9100. @item sbs
  9101. The views are next to each other (default).
  9102. @item tab
  9103. The views are on top of each other.
  9104. @item lines
  9105. The views are packed by line.
  9106. @item columns
  9107. The views are packed by column.
  9108. @item frameseq
  9109. The views are temporally interleaved.
  9110. @end table
  9111. @end table
  9112. Some examples:
  9113. @example
  9114. # Convert left and right views into a frame-sequential video
  9115. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9116. # Convert views into a side-by-side video with the same output resolution as the input
  9117. 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
  9118. @end example
  9119. @section framerate
  9120. Change the frame rate by interpolating new video output frames from the source
  9121. frames.
  9122. This filter is not designed to function correctly with interlaced media. If
  9123. you wish to change the frame rate of interlaced media then you are required
  9124. to deinterlace before this filter and re-interlace after this filter.
  9125. A description of the accepted options follows.
  9126. @table @option
  9127. @item fps
  9128. Specify the output frames per second. This option can also be specified
  9129. as a value alone. The default is @code{50}.
  9130. @item interp_start
  9131. Specify the start of a range where the output frame will be created as a
  9132. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9133. the default is @code{15}.
  9134. @item interp_end
  9135. Specify the end of a range where the output frame will be created as a
  9136. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9137. the default is @code{240}.
  9138. @item scene
  9139. Specify the level at which a scene change is detected as a value between
  9140. 0 and 100 to indicate a new scene; a low value reflects a low
  9141. probability for the current frame to introduce a new scene, while a higher
  9142. value means the current frame is more likely to be one.
  9143. The default is @code{8.2}.
  9144. @item flags
  9145. Specify flags influencing the filter process.
  9146. Available value for @var{flags} is:
  9147. @table @option
  9148. @item scene_change_detect, scd
  9149. Enable scene change detection using the value of the option @var{scene}.
  9150. This flag is enabled by default.
  9151. @end table
  9152. @end table
  9153. @section framestep
  9154. Select one frame every N-th frame.
  9155. This filter accepts the following option:
  9156. @table @option
  9157. @item step
  9158. Select frame after every @code{step} frames.
  9159. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9160. @end table
  9161. @section freezedetect
  9162. Detect frozen video.
  9163. This filter logs a message and sets frame metadata when it detects that the
  9164. input video has no significant change in content during a specified duration.
  9165. Video freeze detection calculates the mean average absolute difference of all
  9166. the components of video frames and compares it to a noise floor.
  9167. The printed times and duration are expressed in seconds. The
  9168. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9169. whose timestamp equals or exceeds the detection duration and it contains the
  9170. timestamp of the first frame of the freeze. The
  9171. @code{lavfi.freezedetect.freeze_duration} and
  9172. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9173. after the freeze.
  9174. The filter accepts the following options:
  9175. @table @option
  9176. @item noise, n
  9177. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9178. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9179. 0.001.
  9180. @item duration, d
  9181. Set freeze duration until notification (default is 2 seconds).
  9182. @end table
  9183. @section freezeframes
  9184. Freeze video frames.
  9185. This filter freezes video frames using frame from 2nd input.
  9186. The filter accepts the following options:
  9187. @table @option
  9188. @item first
  9189. Set number of first frame from which to start freeze.
  9190. @item last
  9191. Set number of last frame from which to end freeze.
  9192. @item replace
  9193. Set number of frame from 2nd input which will be used instead of replaced frames.
  9194. @end table
  9195. @anchor{frei0r}
  9196. @section frei0r
  9197. Apply a frei0r effect to the input video.
  9198. To enable the compilation of this filter, you need to install the frei0r
  9199. header and configure FFmpeg with @code{--enable-frei0r}.
  9200. It accepts the following parameters:
  9201. @table @option
  9202. @item filter_name
  9203. The name of the frei0r effect to load. If the environment variable
  9204. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9205. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9206. Otherwise, the standard frei0r paths are searched, in this order:
  9207. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9208. @file{/usr/lib/frei0r-1/}.
  9209. @item filter_params
  9210. A '|'-separated list of parameters to pass to the frei0r effect.
  9211. @end table
  9212. A frei0r effect parameter can be a boolean (its value is either
  9213. "y" or "n"), a double, a color (specified as
  9214. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9215. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9216. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9217. a position (specified as @var{X}/@var{Y}, where
  9218. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9219. The number and types of parameters depend on the loaded effect. If an
  9220. effect parameter is not specified, the default value is set.
  9221. @subsection Examples
  9222. @itemize
  9223. @item
  9224. Apply the distort0r effect, setting the first two double parameters:
  9225. @example
  9226. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9227. @end example
  9228. @item
  9229. Apply the colordistance effect, taking a color as the first parameter:
  9230. @example
  9231. frei0r=colordistance:0.2/0.3/0.4
  9232. frei0r=colordistance:violet
  9233. frei0r=colordistance:0x112233
  9234. @end example
  9235. @item
  9236. Apply the perspective effect, specifying the top left and top right image
  9237. positions:
  9238. @example
  9239. frei0r=perspective:0.2/0.2|0.8/0.2
  9240. @end example
  9241. @end itemize
  9242. For more information, see
  9243. @url{http://frei0r.dyne.org}
  9244. @subsection Commands
  9245. This filter supports the @option{filter_params} option as @ref{commands}.
  9246. @section fspp
  9247. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9248. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9249. processing filter, one of them is performed once per block, not per pixel.
  9250. This allows for much higher speed.
  9251. The filter accepts the following options:
  9252. @table @option
  9253. @item quality
  9254. Set quality. This option defines the number of levels for averaging. It accepts
  9255. an integer in the range 4-5. Default value is @code{4}.
  9256. @item qp
  9257. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9258. If not set, the filter will use the QP from the video stream (if available).
  9259. @item strength
  9260. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9261. more details but also more artifacts, while higher values make the image smoother
  9262. but also blurrier. Default value is @code{0} − PSNR optimal.
  9263. @item use_bframe_qp
  9264. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9265. option may cause flicker since the B-Frames have often larger QP. Default is
  9266. @code{0} (not enabled).
  9267. @end table
  9268. @section gblur
  9269. Apply Gaussian blur filter.
  9270. The filter accepts the following options:
  9271. @table @option
  9272. @item sigma
  9273. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9274. @item steps
  9275. Set number of steps for Gaussian approximation. Default is @code{1}.
  9276. @item planes
  9277. Set which planes to filter. By default all planes are filtered.
  9278. @item sigmaV
  9279. Set vertical sigma, if negative it will be same as @code{sigma}.
  9280. Default is @code{-1}.
  9281. @end table
  9282. @subsection Commands
  9283. This filter supports same commands as options.
  9284. The command accepts the same syntax of the corresponding option.
  9285. If the specified expression is not valid, it is kept at its current
  9286. value.
  9287. @section geq
  9288. Apply generic equation to each pixel.
  9289. The filter accepts the following options:
  9290. @table @option
  9291. @item lum_expr, lum
  9292. Set the luminance expression.
  9293. @item cb_expr, cb
  9294. Set the chrominance blue expression.
  9295. @item cr_expr, cr
  9296. Set the chrominance red expression.
  9297. @item alpha_expr, a
  9298. Set the alpha expression.
  9299. @item red_expr, r
  9300. Set the red expression.
  9301. @item green_expr, g
  9302. Set the green expression.
  9303. @item blue_expr, b
  9304. Set the blue expression.
  9305. @end table
  9306. The colorspace is selected according to the specified options. If one
  9307. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9308. options is specified, the filter will automatically select a YCbCr
  9309. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9310. @option{blue_expr} options is specified, it will select an RGB
  9311. colorspace.
  9312. If one of the chrominance expression is not defined, it falls back on the other
  9313. one. If no alpha expression is specified it will evaluate to opaque value.
  9314. If none of chrominance expressions are specified, they will evaluate
  9315. to the luminance expression.
  9316. The expressions can use the following variables and functions:
  9317. @table @option
  9318. @item N
  9319. The sequential number of the filtered frame, starting from @code{0}.
  9320. @item X
  9321. @item Y
  9322. The coordinates of the current sample.
  9323. @item W
  9324. @item H
  9325. The width and height of the image.
  9326. @item SW
  9327. @item SH
  9328. Width and height scale depending on the currently filtered plane. It is the
  9329. ratio between the corresponding luma plane number of pixels and the current
  9330. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9331. @code{0.5,0.5} for chroma planes.
  9332. @item T
  9333. Time of the current frame, expressed in seconds.
  9334. @item p(x, y)
  9335. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9336. plane.
  9337. @item lum(x, y)
  9338. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9339. plane.
  9340. @item cb(x, y)
  9341. Return the value of the pixel at location (@var{x},@var{y}) of the
  9342. blue-difference chroma plane. Return 0 if there is no such plane.
  9343. @item cr(x, y)
  9344. Return the value of the pixel at location (@var{x},@var{y}) of the
  9345. red-difference chroma plane. Return 0 if there is no such plane.
  9346. @item r(x, y)
  9347. @item g(x, y)
  9348. @item b(x, y)
  9349. Return the value of the pixel at location (@var{x},@var{y}) of the
  9350. red/green/blue component. Return 0 if there is no such component.
  9351. @item alpha(x, y)
  9352. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9353. plane. Return 0 if there is no such plane.
  9354. @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)
  9355. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9356. sums of samples within a rectangle. See the functions without the sum postfix.
  9357. @item interpolation
  9358. Set one of interpolation methods:
  9359. @table @option
  9360. @item nearest, n
  9361. @item bilinear, b
  9362. @end table
  9363. Default is bilinear.
  9364. @end table
  9365. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9366. automatically clipped to the closer edge.
  9367. Please note that this filter can use multiple threads in which case each slice
  9368. will have its own expression state. If you want to use only a single expression
  9369. state because your expressions depend on previous state then you should limit
  9370. the number of filter threads to 1.
  9371. @subsection Examples
  9372. @itemize
  9373. @item
  9374. Flip the image horizontally:
  9375. @example
  9376. geq=p(W-X\,Y)
  9377. @end example
  9378. @item
  9379. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9380. wavelength of 100 pixels:
  9381. @example
  9382. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9383. @end example
  9384. @item
  9385. Generate a fancy enigmatic moving light:
  9386. @example
  9387. 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
  9388. @end example
  9389. @item
  9390. Generate a quick emboss effect:
  9391. @example
  9392. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9393. @end example
  9394. @item
  9395. Modify RGB components depending on pixel position:
  9396. @example
  9397. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9398. @end example
  9399. @item
  9400. Create a radial gradient that is the same size as the input (also see
  9401. the @ref{vignette} filter):
  9402. @example
  9403. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9404. @end example
  9405. @end itemize
  9406. @section gradfun
  9407. Fix the banding artifacts that are sometimes introduced into nearly flat
  9408. regions by truncation to 8-bit color depth.
  9409. Interpolate the gradients that should go where the bands are, and
  9410. dither them.
  9411. It is designed for playback only. Do not use it prior to
  9412. lossy compression, because compression tends to lose the dither and
  9413. bring back the bands.
  9414. It accepts the following parameters:
  9415. @table @option
  9416. @item strength
  9417. The maximum amount by which the filter will change any one pixel. This is also
  9418. the threshold for detecting nearly flat regions. Acceptable values range from
  9419. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9420. valid range.
  9421. @item radius
  9422. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9423. gradients, but also prevents the filter from modifying the pixels near detailed
  9424. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9425. values will be clipped to the valid range.
  9426. @end table
  9427. Alternatively, the options can be specified as a flat string:
  9428. @var{strength}[:@var{radius}]
  9429. @subsection Examples
  9430. @itemize
  9431. @item
  9432. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9433. @example
  9434. gradfun=3.5:8
  9435. @end example
  9436. @item
  9437. Specify radius, omitting the strength (which will fall-back to the default
  9438. value):
  9439. @example
  9440. gradfun=radius=8
  9441. @end example
  9442. @end itemize
  9443. @anchor{graphmonitor}
  9444. @section graphmonitor
  9445. Show various filtergraph stats.
  9446. With this filter one can debug complete filtergraph.
  9447. Especially issues with links filling with queued frames.
  9448. The filter accepts the following options:
  9449. @table @option
  9450. @item size, s
  9451. Set video output size. Default is @var{hd720}.
  9452. @item opacity, o
  9453. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9454. @item mode, m
  9455. Set output mode, can be @var{fulll} or @var{compact}.
  9456. In @var{compact} mode only filters with some queued frames have displayed stats.
  9457. @item flags, f
  9458. Set flags which enable which stats are shown in video.
  9459. Available values for flags are:
  9460. @table @samp
  9461. @item queue
  9462. Display number of queued frames in each link.
  9463. @item frame_count_in
  9464. Display number of frames taken from filter.
  9465. @item frame_count_out
  9466. Display number of frames given out from filter.
  9467. @item pts
  9468. Display current filtered frame pts.
  9469. @item time
  9470. Display current filtered frame time.
  9471. @item timebase
  9472. Display time base for filter link.
  9473. @item format
  9474. Display used format for filter link.
  9475. @item size
  9476. Display video size or number of audio channels in case of audio used by filter link.
  9477. @item rate
  9478. Display video frame rate or sample rate in case of audio used by filter link.
  9479. @item eof
  9480. Display link output status.
  9481. @end table
  9482. @item rate, r
  9483. Set upper limit for video rate of output stream, Default value is @var{25}.
  9484. This guarantee that output video frame rate will not be higher than this value.
  9485. @end table
  9486. @section greyedge
  9487. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9488. and corrects the scene colors accordingly.
  9489. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9490. The filter accepts the following options:
  9491. @table @option
  9492. @item difford
  9493. The order of differentiation to be applied on the scene. Must be chosen in the range
  9494. [0,2] and default value is 1.
  9495. @item minknorm
  9496. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9497. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9498. max value instead of calculating Minkowski distance.
  9499. @item sigma
  9500. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9501. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9502. can't be equal to 0 if @var{difford} is greater than 0.
  9503. @end table
  9504. @subsection Examples
  9505. @itemize
  9506. @item
  9507. Grey Edge:
  9508. @example
  9509. greyedge=difford=1:minknorm=5:sigma=2
  9510. @end example
  9511. @item
  9512. Max Edge:
  9513. @example
  9514. greyedge=difford=1:minknorm=0:sigma=2
  9515. @end example
  9516. @end itemize
  9517. @anchor{haldclut}
  9518. @section haldclut
  9519. Apply a Hald CLUT to a video stream.
  9520. First input is the video stream to process, and second one is the Hald CLUT.
  9521. The Hald CLUT input can be a simple picture or a complete video stream.
  9522. The filter accepts the following options:
  9523. @table @option
  9524. @item shortest
  9525. Force termination when the shortest input terminates. Default is @code{0}.
  9526. @item repeatlast
  9527. Continue applying the last CLUT after the end of the stream. A value of
  9528. @code{0} disable the filter after the last frame of the CLUT is reached.
  9529. Default is @code{1}.
  9530. @end table
  9531. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9532. filters share the same internals).
  9533. This filter also supports the @ref{framesync} options.
  9534. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9535. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9536. @subsection Workflow examples
  9537. @subsubsection Hald CLUT video stream
  9538. Generate an identity Hald CLUT stream altered with various effects:
  9539. @example
  9540. 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
  9541. @end example
  9542. Note: make sure you use a lossless codec.
  9543. Then use it with @code{haldclut} to apply it on some random stream:
  9544. @example
  9545. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9546. @end example
  9547. The Hald CLUT will be applied to the 10 first seconds (duration of
  9548. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9549. to the remaining frames of the @code{mandelbrot} stream.
  9550. @subsubsection Hald CLUT with preview
  9551. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9552. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9553. biggest possible square starting at the top left of the picture. The remaining
  9554. padding pixels (bottom or right) will be ignored. This area can be used to add
  9555. a preview of the Hald CLUT.
  9556. Typically, the following generated Hald CLUT will be supported by the
  9557. @code{haldclut} filter:
  9558. @example
  9559. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9560. pad=iw+320 [padded_clut];
  9561. smptebars=s=320x256, split [a][b];
  9562. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9563. [main][b] overlay=W-320" -frames:v 1 clut.png
  9564. @end example
  9565. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9566. bars are displayed on the right-top, and below the same color bars processed by
  9567. the color changes.
  9568. Then, the effect of this Hald CLUT can be visualized with:
  9569. @example
  9570. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9571. @end example
  9572. @section hflip
  9573. Flip the input video horizontally.
  9574. For example, to horizontally flip the input video with @command{ffmpeg}:
  9575. @example
  9576. ffmpeg -i in.avi -vf "hflip" out.avi
  9577. @end example
  9578. @section histeq
  9579. This filter applies a global color histogram equalization on a
  9580. per-frame basis.
  9581. It can be used to correct video that has a compressed range of pixel
  9582. intensities. The filter redistributes the pixel intensities to
  9583. equalize their distribution across the intensity range. It may be
  9584. viewed as an "automatically adjusting contrast filter". This filter is
  9585. useful only for correcting degraded or poorly captured source
  9586. video.
  9587. The filter accepts the following options:
  9588. @table @option
  9589. @item strength
  9590. Determine the amount of equalization to be applied. As the strength
  9591. is reduced, the distribution of pixel intensities more-and-more
  9592. approaches that of the input frame. The value must be a float number
  9593. in the range [0,1] and defaults to 0.200.
  9594. @item intensity
  9595. Set the maximum intensity that can generated and scale the output
  9596. values appropriately. The strength should be set as desired and then
  9597. the intensity can be limited if needed to avoid washing-out. The value
  9598. must be a float number in the range [0,1] and defaults to 0.210.
  9599. @item antibanding
  9600. Set the antibanding level. If enabled the filter will randomly vary
  9601. the luminance of output pixels by a small amount to avoid banding of
  9602. the histogram. Possible values are @code{none}, @code{weak} or
  9603. @code{strong}. It defaults to @code{none}.
  9604. @end table
  9605. @anchor{histogram}
  9606. @section histogram
  9607. Compute and draw a color distribution histogram for the input video.
  9608. The computed histogram is a representation of the color component
  9609. distribution in an image.
  9610. Standard histogram displays the color components distribution in an image.
  9611. Displays color graph for each color component. Shows distribution of
  9612. the Y, U, V, A or R, G, B components, depending on input format, in the
  9613. current frame. Below each graph a color component scale meter is shown.
  9614. The filter accepts the following options:
  9615. @table @option
  9616. @item level_height
  9617. Set height of level. Default value is @code{200}.
  9618. Allowed range is [50, 2048].
  9619. @item scale_height
  9620. Set height of color scale. Default value is @code{12}.
  9621. Allowed range is [0, 40].
  9622. @item display_mode
  9623. Set display mode.
  9624. It accepts the following values:
  9625. @table @samp
  9626. @item stack
  9627. Per color component graphs are placed below each other.
  9628. @item parade
  9629. Per color component graphs are placed side by side.
  9630. @item overlay
  9631. Presents information identical to that in the @code{parade}, except
  9632. that the graphs representing color components are superimposed directly
  9633. over one another.
  9634. @end table
  9635. Default is @code{stack}.
  9636. @item levels_mode
  9637. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9638. Default is @code{linear}.
  9639. @item components
  9640. Set what color components to display.
  9641. Default is @code{7}.
  9642. @item fgopacity
  9643. Set foreground opacity. Default is @code{0.7}.
  9644. @item bgopacity
  9645. Set background opacity. Default is @code{0.5}.
  9646. @end table
  9647. @subsection Examples
  9648. @itemize
  9649. @item
  9650. Calculate and draw histogram:
  9651. @example
  9652. ffplay -i input -vf histogram
  9653. @end example
  9654. @end itemize
  9655. @anchor{hqdn3d}
  9656. @section hqdn3d
  9657. This is a high precision/quality 3d denoise filter. It aims to reduce
  9658. image noise, producing smooth images and making still images really
  9659. still. It should enhance compressibility.
  9660. It accepts the following optional parameters:
  9661. @table @option
  9662. @item luma_spatial
  9663. A non-negative floating point number which specifies spatial luma strength.
  9664. It defaults to 4.0.
  9665. @item chroma_spatial
  9666. A non-negative floating point number which specifies spatial chroma strength.
  9667. It defaults to 3.0*@var{luma_spatial}/4.0.
  9668. @item luma_tmp
  9669. A floating point number which specifies luma temporal strength. It defaults to
  9670. 6.0*@var{luma_spatial}/4.0.
  9671. @item chroma_tmp
  9672. A floating point number which specifies chroma temporal strength. It defaults to
  9673. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9674. @end table
  9675. @subsection Commands
  9676. This filter supports same @ref{commands} as options.
  9677. The command accepts the same syntax of the corresponding option.
  9678. If the specified expression is not valid, it is kept at its current
  9679. value.
  9680. @anchor{hwdownload}
  9681. @section hwdownload
  9682. Download hardware frames to system memory.
  9683. The input must be in hardware frames, and the output a non-hardware format.
  9684. Not all formats will be supported on the output - it may be necessary to insert
  9685. an additional @option{format} filter immediately following in the graph to get
  9686. the output in a supported format.
  9687. @section hwmap
  9688. Map hardware frames to system memory or to another device.
  9689. This filter has several different modes of operation; which one is used depends
  9690. on the input and output formats:
  9691. @itemize
  9692. @item
  9693. Hardware frame input, normal frame output
  9694. Map the input frames to system memory and pass them to the output. If the
  9695. original hardware frame is later required (for example, after overlaying
  9696. something else on part of it), the @option{hwmap} filter can be used again
  9697. in the next mode to retrieve it.
  9698. @item
  9699. Normal frame input, hardware frame output
  9700. If the input is actually a software-mapped hardware frame, then unmap it -
  9701. that is, return the original hardware frame.
  9702. Otherwise, a device must be provided. Create new hardware surfaces on that
  9703. device for the output, then map them back to the software format at the input
  9704. and give those frames to the preceding filter. This will then act like the
  9705. @option{hwupload} filter, but may be able to avoid an additional copy when
  9706. the input is already in a compatible format.
  9707. @item
  9708. Hardware frame input and output
  9709. A device must be supplied for the output, either directly or with the
  9710. @option{derive_device} option. The input and output devices must be of
  9711. different types and compatible - the exact meaning of this is
  9712. system-dependent, but typically it means that they must refer to the same
  9713. underlying hardware context (for example, refer to the same graphics card).
  9714. If the input frames were originally created on the output device, then unmap
  9715. to retrieve the original frames.
  9716. Otherwise, map the frames to the output device - create new hardware frames
  9717. on the output corresponding to the frames on the input.
  9718. @end itemize
  9719. The following additional parameters are accepted:
  9720. @table @option
  9721. @item mode
  9722. Set the frame mapping mode. Some combination of:
  9723. @table @var
  9724. @item read
  9725. The mapped frame should be readable.
  9726. @item write
  9727. The mapped frame should be writeable.
  9728. @item overwrite
  9729. The mapping will always overwrite the entire frame.
  9730. This may improve performance in some cases, as the original contents of the
  9731. frame need not be loaded.
  9732. @item direct
  9733. The mapping must not involve any copying.
  9734. Indirect mappings to copies of frames are created in some cases where either
  9735. direct mapping is not possible or it would have unexpected properties.
  9736. Setting this flag ensures that the mapping is direct and will fail if that is
  9737. not possible.
  9738. @end table
  9739. Defaults to @var{read+write} if not specified.
  9740. @item derive_device @var{type}
  9741. Rather than using the device supplied at initialisation, instead derive a new
  9742. device of type @var{type} from the device the input frames exist on.
  9743. @item reverse
  9744. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9745. and map them back to the source. This may be necessary in some cases where
  9746. a mapping in one direction is required but only the opposite direction is
  9747. supported by the devices being used.
  9748. This option is dangerous - it may break the preceding filter in undefined
  9749. ways if there are any additional constraints on that filter's output.
  9750. Do not use it without fully understanding the implications of its use.
  9751. @end table
  9752. @anchor{hwupload}
  9753. @section hwupload
  9754. Upload system memory frames to hardware surfaces.
  9755. The device to upload to must be supplied when the filter is initialised. If
  9756. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9757. option or with the @option{derive_device} option. The input and output devices
  9758. must be of different types and compatible - the exact meaning of this is
  9759. system-dependent, but typically it means that they must refer to the same
  9760. underlying hardware context (for example, refer to the same graphics card).
  9761. The following additional parameters are accepted:
  9762. @table @option
  9763. @item derive_device @var{type}
  9764. Rather than using the device supplied at initialisation, instead derive a new
  9765. device of type @var{type} from the device the input frames exist on.
  9766. @end table
  9767. @anchor{hwupload_cuda}
  9768. @section hwupload_cuda
  9769. Upload system memory frames to a CUDA device.
  9770. It accepts the following optional parameters:
  9771. @table @option
  9772. @item device
  9773. The number of the CUDA device to use
  9774. @end table
  9775. @section hqx
  9776. Apply a high-quality magnification filter designed for pixel art. This filter
  9777. was originally created by Maxim Stepin.
  9778. It accepts the following option:
  9779. @table @option
  9780. @item n
  9781. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9782. @code{hq3x} and @code{4} for @code{hq4x}.
  9783. Default is @code{3}.
  9784. @end table
  9785. @section hstack
  9786. Stack input videos horizontally.
  9787. All streams must be of same pixel format and of same height.
  9788. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9789. to create same output.
  9790. The filter accepts the following option:
  9791. @table @option
  9792. @item inputs
  9793. Set number of input streams. Default is 2.
  9794. @item shortest
  9795. If set to 1, force the output to terminate when the shortest input
  9796. terminates. Default value is 0.
  9797. @end table
  9798. @section hue
  9799. Modify the hue and/or the saturation of the input.
  9800. It accepts the following parameters:
  9801. @table @option
  9802. @item h
  9803. Specify the hue angle as a number of degrees. It accepts an expression,
  9804. and defaults to "0".
  9805. @item s
  9806. Specify the saturation in the [-10,10] range. It accepts an expression and
  9807. defaults to "1".
  9808. @item H
  9809. Specify the hue angle as a number of radians. It accepts an
  9810. expression, and defaults to "0".
  9811. @item b
  9812. Specify the brightness in the [-10,10] range. It accepts an expression and
  9813. defaults to "0".
  9814. @end table
  9815. @option{h} and @option{H} are mutually exclusive, and can't be
  9816. specified at the same time.
  9817. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9818. expressions containing the following constants:
  9819. @table @option
  9820. @item n
  9821. frame count of the input frame starting from 0
  9822. @item pts
  9823. presentation timestamp of the input frame expressed in time base units
  9824. @item r
  9825. frame rate of the input video, NAN if the input frame rate is unknown
  9826. @item t
  9827. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9828. @item tb
  9829. time base of the input video
  9830. @end table
  9831. @subsection Examples
  9832. @itemize
  9833. @item
  9834. Set the hue to 90 degrees and the saturation to 1.0:
  9835. @example
  9836. hue=h=90:s=1
  9837. @end example
  9838. @item
  9839. Same command but expressing the hue in radians:
  9840. @example
  9841. hue=H=PI/2:s=1
  9842. @end example
  9843. @item
  9844. Rotate hue and make the saturation swing between 0
  9845. and 2 over a period of 1 second:
  9846. @example
  9847. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9848. @end example
  9849. @item
  9850. Apply a 3 seconds saturation fade-in effect starting at 0:
  9851. @example
  9852. hue="s=min(t/3\,1)"
  9853. @end example
  9854. The general fade-in expression can be written as:
  9855. @example
  9856. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9857. @end example
  9858. @item
  9859. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9860. @example
  9861. hue="s=max(0\, min(1\, (8-t)/3))"
  9862. @end example
  9863. The general fade-out expression can be written as:
  9864. @example
  9865. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9866. @end example
  9867. @end itemize
  9868. @subsection Commands
  9869. This filter supports the following commands:
  9870. @table @option
  9871. @item b
  9872. @item s
  9873. @item h
  9874. @item H
  9875. Modify the hue and/or the saturation and/or brightness of the input video.
  9876. The command accepts the same syntax of the corresponding option.
  9877. If the specified expression is not valid, it is kept at its current
  9878. value.
  9879. @end table
  9880. @section hysteresis
  9881. Grow first stream into second stream by connecting components.
  9882. This makes it possible to build more robust edge masks.
  9883. This filter accepts the following options:
  9884. @table @option
  9885. @item planes
  9886. Set which planes will be processed as bitmap, unprocessed planes will be
  9887. copied from first stream.
  9888. By default value 0xf, all planes will be processed.
  9889. @item threshold
  9890. Set threshold which is used in filtering. If pixel component value is higher than
  9891. this value filter algorithm for connecting components is activated.
  9892. By default value is 0.
  9893. @end table
  9894. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9895. @section idet
  9896. Detect video interlacing type.
  9897. This filter tries to detect if the input frames are interlaced, progressive,
  9898. top or bottom field first. It will also try to detect fields that are
  9899. repeated between adjacent frames (a sign of telecine).
  9900. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9901. Multiple frame detection incorporates the classification history of previous frames.
  9902. The filter will log these metadata values:
  9903. @table @option
  9904. @item single.current_frame
  9905. Detected type of current frame using single-frame detection. One of:
  9906. ``tff'' (top field first), ``bff'' (bottom field first),
  9907. ``progressive'', or ``undetermined''
  9908. @item single.tff
  9909. Cumulative number of frames detected as top field first using single-frame detection.
  9910. @item multiple.tff
  9911. Cumulative number of frames detected as top field first using multiple-frame detection.
  9912. @item single.bff
  9913. Cumulative number of frames detected as bottom field first using single-frame detection.
  9914. @item multiple.current_frame
  9915. Detected type of current frame using multiple-frame detection. One of:
  9916. ``tff'' (top field first), ``bff'' (bottom field first),
  9917. ``progressive'', or ``undetermined''
  9918. @item multiple.bff
  9919. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9920. @item single.progressive
  9921. Cumulative number of frames detected as progressive using single-frame detection.
  9922. @item multiple.progressive
  9923. Cumulative number of frames detected as progressive using multiple-frame detection.
  9924. @item single.undetermined
  9925. Cumulative number of frames that could not be classified using single-frame detection.
  9926. @item multiple.undetermined
  9927. Cumulative number of frames that could not be classified using multiple-frame detection.
  9928. @item repeated.current_frame
  9929. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9930. @item repeated.neither
  9931. Cumulative number of frames with no repeated field.
  9932. @item repeated.top
  9933. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9934. @item repeated.bottom
  9935. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9936. @end table
  9937. The filter accepts the following options:
  9938. @table @option
  9939. @item intl_thres
  9940. Set interlacing threshold.
  9941. @item prog_thres
  9942. Set progressive threshold.
  9943. @item rep_thres
  9944. Threshold for repeated field detection.
  9945. @item half_life
  9946. Number of frames after which a given frame's contribution to the
  9947. statistics is halved (i.e., it contributes only 0.5 to its
  9948. classification). The default of 0 means that all frames seen are given
  9949. full weight of 1.0 forever.
  9950. @item analyze_interlaced_flag
  9951. When this is not 0 then idet will use the specified number of frames to determine
  9952. if the interlaced flag is accurate, it will not count undetermined frames.
  9953. If the flag is found to be accurate it will be used without any further
  9954. computations, if it is found to be inaccurate it will be cleared without any
  9955. further computations. This allows inserting the idet filter as a low computational
  9956. method to clean up the interlaced flag
  9957. @end table
  9958. @section il
  9959. Deinterleave or interleave fields.
  9960. This filter allows one to process interlaced images fields without
  9961. deinterlacing them. Deinterleaving splits the input frame into 2
  9962. fields (so called half pictures). Odd lines are moved to the top
  9963. half of the output image, even lines to the bottom half.
  9964. You can process (filter) them independently and then re-interleave them.
  9965. The filter accepts the following options:
  9966. @table @option
  9967. @item luma_mode, l
  9968. @item chroma_mode, c
  9969. @item alpha_mode, a
  9970. Available values for @var{luma_mode}, @var{chroma_mode} and
  9971. @var{alpha_mode} are:
  9972. @table @samp
  9973. @item none
  9974. Do nothing.
  9975. @item deinterleave, d
  9976. Deinterleave fields, placing one above the other.
  9977. @item interleave, i
  9978. Interleave fields. Reverse the effect of deinterleaving.
  9979. @end table
  9980. Default value is @code{none}.
  9981. @item luma_swap, ls
  9982. @item chroma_swap, cs
  9983. @item alpha_swap, as
  9984. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9985. @end table
  9986. @subsection Commands
  9987. This filter supports the all above options as @ref{commands}.
  9988. @section inflate
  9989. Apply inflate effect to the video.
  9990. This filter replaces the pixel by the local(3x3) average by taking into account
  9991. only values higher than the pixel.
  9992. It accepts the following options:
  9993. @table @option
  9994. @item threshold0
  9995. @item threshold1
  9996. @item threshold2
  9997. @item threshold3
  9998. Limit the maximum change for each plane, default is 65535.
  9999. If 0, plane will remain unchanged.
  10000. @end table
  10001. @subsection Commands
  10002. This filter supports the all above options as @ref{commands}.
  10003. @section interlace
  10004. Simple interlacing filter from progressive contents. This interleaves upper (or
  10005. lower) lines from odd frames with lower (or upper) lines from even frames,
  10006. halving the frame rate and preserving image height.
  10007. @example
  10008. Original Original New Frame
  10009. Frame 'j' Frame 'j+1' (tff)
  10010. ========== =========== ==================
  10011. Line 0 --------------------> Frame 'j' Line 0
  10012. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10013. Line 2 ---------------------> Frame 'j' Line 2
  10014. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10015. ... ... ...
  10016. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10017. @end example
  10018. It accepts the following optional parameters:
  10019. @table @option
  10020. @item scan
  10021. This determines whether the interlaced frame is taken from the even
  10022. (tff - default) or odd (bff) lines of the progressive frame.
  10023. @item lowpass
  10024. Vertical lowpass filter to avoid twitter interlacing and
  10025. reduce moire patterns.
  10026. @table @samp
  10027. @item 0, off
  10028. Disable vertical lowpass filter
  10029. @item 1, linear
  10030. Enable linear filter (default)
  10031. @item 2, complex
  10032. Enable complex filter. This will slightly less reduce twitter and moire
  10033. but better retain detail and subjective sharpness impression.
  10034. @end table
  10035. @end table
  10036. @section kerndeint
  10037. Deinterlace input video by applying Donald Graft's adaptive kernel
  10038. deinterling. Work on interlaced parts of a video to produce
  10039. progressive frames.
  10040. The description of the accepted parameters follows.
  10041. @table @option
  10042. @item thresh
  10043. Set the threshold which affects the filter's tolerance when
  10044. determining if a pixel line must be processed. It must be an integer
  10045. in the range [0,255] and defaults to 10. A value of 0 will result in
  10046. applying the process on every pixels.
  10047. @item map
  10048. Paint pixels exceeding the threshold value to white if set to 1.
  10049. Default is 0.
  10050. @item order
  10051. Set the fields order. Swap fields if set to 1, leave fields alone if
  10052. 0. Default is 0.
  10053. @item sharp
  10054. Enable additional sharpening if set to 1. Default is 0.
  10055. @item twoway
  10056. Enable twoway sharpening if set to 1. Default is 0.
  10057. @end table
  10058. @subsection Examples
  10059. @itemize
  10060. @item
  10061. Apply default values:
  10062. @example
  10063. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10064. @end example
  10065. @item
  10066. Enable additional sharpening:
  10067. @example
  10068. kerndeint=sharp=1
  10069. @end example
  10070. @item
  10071. Paint processed pixels in white:
  10072. @example
  10073. kerndeint=map=1
  10074. @end example
  10075. @end itemize
  10076. @section lagfun
  10077. Slowly update darker pixels.
  10078. This filter makes short flashes of light appear longer.
  10079. This filter accepts the following options:
  10080. @table @option
  10081. @item decay
  10082. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10083. @item planes
  10084. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10085. @end table
  10086. @section lenscorrection
  10087. Correct radial lens distortion
  10088. This filter can be used to correct for radial distortion as can result from the use
  10089. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10090. one can use tools available for example as part of opencv or simply trial-and-error.
  10091. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10092. and extract the k1 and k2 coefficients from the resulting matrix.
  10093. Note that effectively the same filter is available in the open-source tools Krita and
  10094. Digikam from the KDE project.
  10095. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10096. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10097. brightness distribution, so you may want to use both filters together in certain
  10098. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10099. be applied before or after lens correction.
  10100. @subsection Options
  10101. The filter accepts the following options:
  10102. @table @option
  10103. @item cx
  10104. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10105. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10106. width. Default is 0.5.
  10107. @item cy
  10108. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10109. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10110. height. Default is 0.5.
  10111. @item k1
  10112. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10113. no correction. Default is 0.
  10114. @item k2
  10115. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10116. 0 means no correction. Default is 0.
  10117. @end table
  10118. The formula that generates the correction is:
  10119. @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)
  10120. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10121. distances from the focal point in the source and target images, respectively.
  10122. @section lensfun
  10123. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10124. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10125. to apply the lens correction. The filter will load the lensfun database and
  10126. query it to find the corresponding camera and lens entries in the database. As
  10127. long as these entries can be found with the given options, the filter can
  10128. perform corrections on frames. Note that incomplete strings will result in the
  10129. filter choosing the best match with the given options, and the filter will
  10130. output the chosen camera and lens models (logged with level "info"). You must
  10131. provide the make, camera model, and lens model as they are required.
  10132. The filter accepts the following options:
  10133. @table @option
  10134. @item make
  10135. The make of the camera (for example, "Canon"). This option is required.
  10136. @item model
  10137. The model of the camera (for example, "Canon EOS 100D"). This option is
  10138. required.
  10139. @item lens_model
  10140. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10141. option is required.
  10142. @item mode
  10143. The type of correction to apply. The following values are valid options:
  10144. @table @samp
  10145. @item vignetting
  10146. Enables fixing lens vignetting.
  10147. @item geometry
  10148. Enables fixing lens geometry. This is the default.
  10149. @item subpixel
  10150. Enables fixing chromatic aberrations.
  10151. @item vig_geo
  10152. Enables fixing lens vignetting and lens geometry.
  10153. @item vig_subpixel
  10154. Enables fixing lens vignetting and chromatic aberrations.
  10155. @item distortion
  10156. Enables fixing both lens geometry and chromatic aberrations.
  10157. @item all
  10158. Enables all possible corrections.
  10159. @end table
  10160. @item focal_length
  10161. The focal length of the image/video (zoom; expected constant for video). For
  10162. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10163. range should be chosen when using that lens. Default 18.
  10164. @item aperture
  10165. The aperture of the image/video (expected constant for video). Note that
  10166. aperture is only used for vignetting correction. Default 3.5.
  10167. @item focus_distance
  10168. The focus distance of the image/video (expected constant for video). Note that
  10169. focus distance is only used for vignetting and only slightly affects the
  10170. vignetting correction process. If unknown, leave it at the default value (which
  10171. is 1000).
  10172. @item scale
  10173. The scale factor which is applied after transformation. After correction the
  10174. video is no longer necessarily rectangular. This parameter controls how much of
  10175. the resulting image is visible. The value 0 means that a value will be chosen
  10176. automatically such that there is little or no unmapped area in the output
  10177. image. 1.0 means that no additional scaling is done. Lower values may result
  10178. in more of the corrected image being visible, while higher values may avoid
  10179. unmapped areas in the output.
  10180. @item target_geometry
  10181. The target geometry of the output image/video. The following values are valid
  10182. options:
  10183. @table @samp
  10184. @item rectilinear (default)
  10185. @item fisheye
  10186. @item panoramic
  10187. @item equirectangular
  10188. @item fisheye_orthographic
  10189. @item fisheye_stereographic
  10190. @item fisheye_equisolid
  10191. @item fisheye_thoby
  10192. @end table
  10193. @item reverse
  10194. Apply the reverse of image correction (instead of correcting distortion, apply
  10195. it).
  10196. @item interpolation
  10197. The type of interpolation used when correcting distortion. The following values
  10198. are valid options:
  10199. @table @samp
  10200. @item nearest
  10201. @item linear (default)
  10202. @item lanczos
  10203. @end table
  10204. @end table
  10205. @subsection Examples
  10206. @itemize
  10207. @item
  10208. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10209. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10210. aperture of "8.0".
  10211. @example
  10212. 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
  10213. @end example
  10214. @item
  10215. Apply the same as before, but only for the first 5 seconds of video.
  10216. @example
  10217. 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
  10218. @end example
  10219. @end itemize
  10220. @section libvmaf
  10221. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10222. score between two input videos.
  10223. The obtained VMAF score is printed through the logging system.
  10224. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10225. After installing the library it can be enabled using:
  10226. @code{./configure --enable-libvmaf}.
  10227. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10228. The filter has following options:
  10229. @table @option
  10230. @item model_path
  10231. Set the model path which is to be used for SVM.
  10232. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10233. @item log_path
  10234. Set the file path to be used to store logs.
  10235. @item log_fmt
  10236. Set the format of the log file (csv, json or xml).
  10237. @item enable_transform
  10238. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10239. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10240. Default value: @code{false}
  10241. @item phone_model
  10242. Invokes the phone model which will generate VMAF scores higher than in the
  10243. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10244. Default value: @code{false}
  10245. @item psnr
  10246. Enables computing psnr along with vmaf.
  10247. Default value: @code{false}
  10248. @item ssim
  10249. Enables computing ssim along with vmaf.
  10250. Default value: @code{false}
  10251. @item ms_ssim
  10252. Enables computing ms_ssim along with vmaf.
  10253. Default value: @code{false}
  10254. @item pool
  10255. Set the pool method to be used for computing vmaf.
  10256. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10257. @item n_threads
  10258. Set number of threads to be used when computing vmaf.
  10259. Default value: @code{0}, which makes use of all available logical processors.
  10260. @item n_subsample
  10261. Set interval for frame subsampling used when computing vmaf.
  10262. Default value: @code{1}
  10263. @item enable_conf_interval
  10264. Enables confidence interval.
  10265. Default value: @code{false}
  10266. @end table
  10267. This filter also supports the @ref{framesync} options.
  10268. @subsection Examples
  10269. @itemize
  10270. @item
  10271. On the below examples the input file @file{main.mpg} being processed is
  10272. compared with the reference file @file{ref.mpg}.
  10273. @example
  10274. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10275. @end example
  10276. @item
  10277. Example with options:
  10278. @example
  10279. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10280. @end example
  10281. @item
  10282. Example with options and different containers:
  10283. @example
  10284. 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 -
  10285. @end example
  10286. @end itemize
  10287. @section limiter
  10288. Limits the pixel components values to the specified range [min, max].
  10289. The filter accepts the following options:
  10290. @table @option
  10291. @item min
  10292. Lower bound. Defaults to the lowest allowed value for the input.
  10293. @item max
  10294. Upper bound. Defaults to the highest allowed value for the input.
  10295. @item planes
  10296. Specify which planes will be processed. Defaults to all available.
  10297. @end table
  10298. @section loop
  10299. Loop video frames.
  10300. The filter accepts the following options:
  10301. @table @option
  10302. @item loop
  10303. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10304. Default is 0.
  10305. @item size
  10306. Set maximal size in number of frames. Default is 0.
  10307. @item start
  10308. Set first frame of loop. Default is 0.
  10309. @end table
  10310. @subsection Examples
  10311. @itemize
  10312. @item
  10313. Loop single first frame infinitely:
  10314. @example
  10315. loop=loop=-1:size=1:start=0
  10316. @end example
  10317. @item
  10318. Loop single first frame 10 times:
  10319. @example
  10320. loop=loop=10:size=1:start=0
  10321. @end example
  10322. @item
  10323. Loop 10 first frames 5 times:
  10324. @example
  10325. loop=loop=5:size=10:start=0
  10326. @end example
  10327. @end itemize
  10328. @section lut1d
  10329. Apply a 1D LUT to an input video.
  10330. The filter accepts the following options:
  10331. @table @option
  10332. @item file
  10333. Set the 1D LUT file name.
  10334. Currently supported formats:
  10335. @table @samp
  10336. @item cube
  10337. Iridas
  10338. @item csp
  10339. cineSpace
  10340. @end table
  10341. @item interp
  10342. Select interpolation mode.
  10343. Available values are:
  10344. @table @samp
  10345. @item nearest
  10346. Use values from the nearest defined point.
  10347. @item linear
  10348. Interpolate values using the linear interpolation.
  10349. @item cosine
  10350. Interpolate values using the cosine interpolation.
  10351. @item cubic
  10352. Interpolate values using the cubic interpolation.
  10353. @item spline
  10354. Interpolate values using the spline interpolation.
  10355. @end table
  10356. @end table
  10357. @anchor{lut3d}
  10358. @section lut3d
  10359. Apply a 3D LUT to an input video.
  10360. The filter accepts the following options:
  10361. @table @option
  10362. @item file
  10363. Set the 3D LUT file name.
  10364. Currently supported formats:
  10365. @table @samp
  10366. @item 3dl
  10367. AfterEffects
  10368. @item cube
  10369. Iridas
  10370. @item dat
  10371. DaVinci
  10372. @item m3d
  10373. Pandora
  10374. @item csp
  10375. cineSpace
  10376. @end table
  10377. @item interp
  10378. Select interpolation mode.
  10379. Available values are:
  10380. @table @samp
  10381. @item nearest
  10382. Use values from the nearest defined point.
  10383. @item trilinear
  10384. Interpolate values using the 8 points defining a cube.
  10385. @item tetrahedral
  10386. Interpolate values using a tetrahedron.
  10387. @end table
  10388. @end table
  10389. @section lumakey
  10390. Turn certain luma values into transparency.
  10391. The filter accepts the following options:
  10392. @table @option
  10393. @item threshold
  10394. Set the luma which will be used as base for transparency.
  10395. Default value is @code{0}.
  10396. @item tolerance
  10397. Set the range of luma values to be keyed out.
  10398. Default value is @code{0.01}.
  10399. @item softness
  10400. Set the range of softness. Default value is @code{0}.
  10401. Use this to control gradual transition from zero to full transparency.
  10402. @end table
  10403. @subsection Commands
  10404. This filter supports same @ref{commands} as options.
  10405. The command accepts the same syntax of the corresponding option.
  10406. If the specified expression is not valid, it is kept at its current
  10407. value.
  10408. @section lut, lutrgb, lutyuv
  10409. Compute a look-up table for binding each pixel component input value
  10410. to an output value, and apply it to the input video.
  10411. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10412. to an RGB input video.
  10413. These filters accept the following parameters:
  10414. @table @option
  10415. @item c0
  10416. set first pixel component expression
  10417. @item c1
  10418. set second pixel component expression
  10419. @item c2
  10420. set third pixel component expression
  10421. @item c3
  10422. set fourth pixel component expression, corresponds to the alpha component
  10423. @item r
  10424. set red component expression
  10425. @item g
  10426. set green component expression
  10427. @item b
  10428. set blue component expression
  10429. @item a
  10430. alpha component expression
  10431. @item y
  10432. set Y/luminance component expression
  10433. @item u
  10434. set U/Cb component expression
  10435. @item v
  10436. set V/Cr component expression
  10437. @end table
  10438. Each of them specifies the expression to use for computing the lookup table for
  10439. the corresponding pixel component values.
  10440. The exact component associated to each of the @var{c*} options depends on the
  10441. format in input.
  10442. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10443. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10444. The expressions can contain the following constants and functions:
  10445. @table @option
  10446. @item w
  10447. @item h
  10448. The input width and height.
  10449. @item val
  10450. The input value for the pixel component.
  10451. @item clipval
  10452. The input value, clipped to the @var{minval}-@var{maxval} range.
  10453. @item maxval
  10454. The maximum value for the pixel component.
  10455. @item minval
  10456. The minimum value for the pixel component.
  10457. @item negval
  10458. The negated value for the pixel component value, clipped to the
  10459. @var{minval}-@var{maxval} range; it corresponds to the expression
  10460. "maxval-clipval+minval".
  10461. @item clip(val)
  10462. The computed value in @var{val}, clipped to the
  10463. @var{minval}-@var{maxval} range.
  10464. @item gammaval(gamma)
  10465. The computed gamma correction value of the pixel component value,
  10466. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10467. expression
  10468. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10469. @end table
  10470. All expressions default to "val".
  10471. @subsection Examples
  10472. @itemize
  10473. @item
  10474. Negate input video:
  10475. @example
  10476. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10477. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10478. @end example
  10479. The above is the same as:
  10480. @example
  10481. lutrgb="r=negval:g=negval:b=negval"
  10482. lutyuv="y=negval:u=negval:v=negval"
  10483. @end example
  10484. @item
  10485. Negate luminance:
  10486. @example
  10487. lutyuv=y=negval
  10488. @end example
  10489. @item
  10490. Remove chroma components, turning the video into a graytone image:
  10491. @example
  10492. lutyuv="u=128:v=128"
  10493. @end example
  10494. @item
  10495. Apply a luma burning effect:
  10496. @example
  10497. lutyuv="y=2*val"
  10498. @end example
  10499. @item
  10500. Remove green and blue components:
  10501. @example
  10502. lutrgb="g=0:b=0"
  10503. @end example
  10504. @item
  10505. Set a constant alpha channel value on input:
  10506. @example
  10507. format=rgba,lutrgb=a="maxval-minval/2"
  10508. @end example
  10509. @item
  10510. Correct luminance gamma by a factor of 0.5:
  10511. @example
  10512. lutyuv=y=gammaval(0.5)
  10513. @end example
  10514. @item
  10515. Discard least significant bits of luma:
  10516. @example
  10517. lutyuv=y='bitand(val, 128+64+32)'
  10518. @end example
  10519. @item
  10520. Technicolor like effect:
  10521. @example
  10522. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10523. @end example
  10524. @end itemize
  10525. @section lut2, tlut2
  10526. The @code{lut2} filter takes two input streams and outputs one
  10527. stream.
  10528. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10529. from one single stream.
  10530. This filter accepts the following parameters:
  10531. @table @option
  10532. @item c0
  10533. set first pixel component expression
  10534. @item c1
  10535. set second pixel component expression
  10536. @item c2
  10537. set third pixel component expression
  10538. @item c3
  10539. set fourth pixel component expression, corresponds to the alpha component
  10540. @item d
  10541. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10542. which means bit depth is automatically picked from first input format.
  10543. @end table
  10544. The @code{lut2} filter also supports the @ref{framesync} options.
  10545. Each of them specifies the expression to use for computing the lookup table for
  10546. the corresponding pixel component values.
  10547. The exact component associated to each of the @var{c*} options depends on the
  10548. format in inputs.
  10549. The expressions can contain the following constants:
  10550. @table @option
  10551. @item w
  10552. @item h
  10553. The input width and height.
  10554. @item x
  10555. The first input value for the pixel component.
  10556. @item y
  10557. The second input value for the pixel component.
  10558. @item bdx
  10559. The first input video bit depth.
  10560. @item bdy
  10561. The second input video bit depth.
  10562. @end table
  10563. All expressions default to "x".
  10564. @subsection Examples
  10565. @itemize
  10566. @item
  10567. Highlight differences between two RGB video streams:
  10568. @example
  10569. 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)'
  10570. @end example
  10571. @item
  10572. Highlight differences between two YUV video streams:
  10573. @example
  10574. 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)'
  10575. @end example
  10576. @item
  10577. Show max difference between two video streams:
  10578. @example
  10579. 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)))'
  10580. @end example
  10581. @end itemize
  10582. @section maskedclamp
  10583. Clamp the first input stream with the second input and third input stream.
  10584. Returns the value of first stream to be between second input
  10585. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10586. This filter accepts the following options:
  10587. @table @option
  10588. @item undershoot
  10589. Default value is @code{0}.
  10590. @item overshoot
  10591. Default value is @code{0}.
  10592. @item planes
  10593. Set which planes will be processed as bitmap, unprocessed planes will be
  10594. copied from first stream.
  10595. By default value 0xf, all planes will be processed.
  10596. @end table
  10597. @section maskedmax
  10598. Merge the second and third input stream into output stream using absolute differences
  10599. between second input stream and first input stream and absolute difference between
  10600. third input stream and first input stream. The picked value will be from second input
  10601. stream if second absolute difference is greater than first one or from third input stream
  10602. otherwise.
  10603. This filter accepts the following options:
  10604. @table @option
  10605. @item planes
  10606. Set which planes will be processed as bitmap, unprocessed planes will be
  10607. copied from first stream.
  10608. By default value 0xf, all planes will be processed.
  10609. @end table
  10610. @section maskedmerge
  10611. Merge the first input stream with the second input stream using per pixel
  10612. weights in the third input stream.
  10613. A value of 0 in the third stream pixel component means that pixel component
  10614. from first stream is returned unchanged, while maximum value (eg. 255 for
  10615. 8-bit videos) means that pixel component from second stream is returned
  10616. unchanged. Intermediate values define the amount of merging between both
  10617. input stream's pixel components.
  10618. This filter accepts the following options:
  10619. @table @option
  10620. @item planes
  10621. Set which planes will be processed as bitmap, unprocessed planes will be
  10622. copied from first stream.
  10623. By default value 0xf, all planes will be processed.
  10624. @end table
  10625. @section maskedmin
  10626. Merge the second and third input stream into output stream using absolute differences
  10627. between second input stream and first input stream and absolute difference between
  10628. third input stream and first input stream. The picked value will be from second input
  10629. stream if second absolute difference is less than first one or from third input stream
  10630. otherwise.
  10631. This filter accepts the following options:
  10632. @table @option
  10633. @item planes
  10634. Set which planes will be processed as bitmap, unprocessed planes will be
  10635. copied from first stream.
  10636. By default value 0xf, all planes will be processed.
  10637. @end table
  10638. @section maskedthreshold
  10639. Pick pixels comparing absolute difference of two video streams with fixed
  10640. threshold.
  10641. If absolute difference between pixel component of first and second video
  10642. stream is equal or lower than user supplied threshold than pixel component
  10643. from first video stream is picked, otherwise pixel component from second
  10644. video stream is picked.
  10645. This filter accepts the following options:
  10646. @table @option
  10647. @item threshold
  10648. Set threshold used when picking pixels from absolute difference from two input
  10649. video streams.
  10650. @item planes
  10651. Set which planes will be processed as bitmap, unprocessed planes will be
  10652. copied from second stream.
  10653. By default value 0xf, all planes will be processed.
  10654. @end table
  10655. @section maskfun
  10656. Create mask from input video.
  10657. For example it is useful to create motion masks after @code{tblend} filter.
  10658. This filter accepts the following options:
  10659. @table @option
  10660. @item low
  10661. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10662. @item high
  10663. Set high threshold. Any pixel component higher than this value will be set to max value
  10664. allowed for current pixel format.
  10665. @item planes
  10666. Set planes to filter, by default all available planes are filtered.
  10667. @item fill
  10668. Fill all frame pixels with this value.
  10669. @item sum
  10670. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10671. average, output frame will be completely filled with value set by @var{fill} option.
  10672. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10673. @end table
  10674. @section mcdeint
  10675. Apply motion-compensation deinterlacing.
  10676. It needs one field per frame as input and must thus be used together
  10677. with yadif=1/3 or equivalent.
  10678. This filter accepts the following options:
  10679. @table @option
  10680. @item mode
  10681. Set the deinterlacing mode.
  10682. It accepts one of the following values:
  10683. @table @samp
  10684. @item fast
  10685. @item medium
  10686. @item slow
  10687. use iterative motion estimation
  10688. @item extra_slow
  10689. like @samp{slow}, but use multiple reference frames.
  10690. @end table
  10691. Default value is @samp{fast}.
  10692. @item parity
  10693. Set the picture field parity assumed for the input video. It must be
  10694. one of the following values:
  10695. @table @samp
  10696. @item 0, tff
  10697. assume top field first
  10698. @item 1, bff
  10699. assume bottom field first
  10700. @end table
  10701. Default value is @samp{bff}.
  10702. @item qp
  10703. Set per-block quantization parameter (QP) used by the internal
  10704. encoder.
  10705. Higher values should result in a smoother motion vector field but less
  10706. optimal individual vectors. Default value is 1.
  10707. @end table
  10708. @section median
  10709. Pick median pixel from certain rectangle defined by radius.
  10710. This filter accepts the following options:
  10711. @table @option
  10712. @item radius
  10713. Set horizontal radius size. Default value is @code{1}.
  10714. Allowed range is integer from 1 to 127.
  10715. @item planes
  10716. Set which planes to process. Default is @code{15}, which is all available planes.
  10717. @item radiusV
  10718. Set vertical radius size. Default value is @code{0}.
  10719. Allowed range is integer from 0 to 127.
  10720. If it is 0, value will be picked from horizontal @code{radius} option.
  10721. @item percentile
  10722. Set median percentile. Default value is @code{0.5}.
  10723. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10724. minimum values, and @code{1} maximum values.
  10725. @end table
  10726. @subsection Commands
  10727. This filter supports same @ref{commands} as options.
  10728. The command accepts the same syntax of the corresponding option.
  10729. If the specified expression is not valid, it is kept at its current
  10730. value.
  10731. @section mergeplanes
  10732. Merge color channel components from several video streams.
  10733. The filter accepts up to 4 input streams, and merge selected input
  10734. planes to the output video.
  10735. This filter accepts the following options:
  10736. @table @option
  10737. @item mapping
  10738. Set input to output plane mapping. Default is @code{0}.
  10739. The mappings is specified as a bitmap. It should be specified as a
  10740. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10741. mapping for the first plane of the output stream. 'A' sets the number of
  10742. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10743. corresponding input to use (from 0 to 3). The rest of the mappings is
  10744. similar, 'Bb' describes the mapping for the output stream second
  10745. plane, 'Cc' describes the mapping for the output stream third plane and
  10746. 'Dd' describes the mapping for the output stream fourth plane.
  10747. @item format
  10748. Set output pixel format. Default is @code{yuva444p}.
  10749. @end table
  10750. @subsection Examples
  10751. @itemize
  10752. @item
  10753. Merge three gray video streams of same width and height into single video stream:
  10754. @example
  10755. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10756. @end example
  10757. @item
  10758. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10759. @example
  10760. [a0][a1]mergeplanes=0x00010210:yuva444p
  10761. @end example
  10762. @item
  10763. Swap Y and A plane in yuva444p stream:
  10764. @example
  10765. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10766. @end example
  10767. @item
  10768. Swap U and V plane in yuv420p stream:
  10769. @example
  10770. format=yuv420p,mergeplanes=0x000201:yuv420p
  10771. @end example
  10772. @item
  10773. Cast a rgb24 clip to yuv444p:
  10774. @example
  10775. format=rgb24,mergeplanes=0x000102:yuv444p
  10776. @end example
  10777. @end itemize
  10778. @section mestimate
  10779. Estimate and export motion vectors using block matching algorithms.
  10780. Motion vectors are stored in frame side data to be used by other filters.
  10781. This filter accepts the following options:
  10782. @table @option
  10783. @item method
  10784. Specify the motion estimation method. Accepts one of the following values:
  10785. @table @samp
  10786. @item esa
  10787. Exhaustive search algorithm.
  10788. @item tss
  10789. Three step search algorithm.
  10790. @item tdls
  10791. Two dimensional logarithmic search algorithm.
  10792. @item ntss
  10793. New three step search algorithm.
  10794. @item fss
  10795. Four step search algorithm.
  10796. @item ds
  10797. Diamond search algorithm.
  10798. @item hexbs
  10799. Hexagon-based search algorithm.
  10800. @item epzs
  10801. Enhanced predictive zonal search algorithm.
  10802. @item umh
  10803. Uneven multi-hexagon search algorithm.
  10804. @end table
  10805. Default value is @samp{esa}.
  10806. @item mb_size
  10807. Macroblock size. Default @code{16}.
  10808. @item search_param
  10809. Search parameter. Default @code{7}.
  10810. @end table
  10811. @section midequalizer
  10812. Apply Midway Image Equalization effect using two video streams.
  10813. Midway Image Equalization adjusts a pair of images to have the same
  10814. histogram, while maintaining their dynamics as much as possible. It's
  10815. useful for e.g. matching exposures from a pair of stereo cameras.
  10816. This filter has two inputs and one output, which must be of same pixel format, but
  10817. may be of different sizes. The output of filter is first input adjusted with
  10818. midway histogram of both inputs.
  10819. This filter accepts the following option:
  10820. @table @option
  10821. @item planes
  10822. Set which planes to process. Default is @code{15}, which is all available planes.
  10823. @end table
  10824. @section minterpolate
  10825. Convert the video to specified frame rate using motion interpolation.
  10826. This filter accepts the following options:
  10827. @table @option
  10828. @item fps
  10829. 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}.
  10830. @item mi_mode
  10831. Motion interpolation mode. Following values are accepted:
  10832. @table @samp
  10833. @item dup
  10834. Duplicate previous or next frame for interpolating new ones.
  10835. @item blend
  10836. Blend source frames. Interpolated frame is mean of previous and next frames.
  10837. @item mci
  10838. Motion compensated interpolation. Following options are effective when this mode is selected:
  10839. @table @samp
  10840. @item mc_mode
  10841. Motion compensation mode. Following values are accepted:
  10842. @table @samp
  10843. @item obmc
  10844. Overlapped block motion compensation.
  10845. @item aobmc
  10846. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10847. @end table
  10848. Default mode is @samp{obmc}.
  10849. @item me_mode
  10850. Motion estimation mode. Following values are accepted:
  10851. @table @samp
  10852. @item bidir
  10853. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10854. @item bilat
  10855. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10856. @end table
  10857. Default mode is @samp{bilat}.
  10858. @item me
  10859. The algorithm to be used for motion estimation. Following values are accepted:
  10860. @table @samp
  10861. @item esa
  10862. Exhaustive search algorithm.
  10863. @item tss
  10864. Three step search algorithm.
  10865. @item tdls
  10866. Two dimensional logarithmic search algorithm.
  10867. @item ntss
  10868. New three step search algorithm.
  10869. @item fss
  10870. Four step search algorithm.
  10871. @item ds
  10872. Diamond search algorithm.
  10873. @item hexbs
  10874. Hexagon-based search algorithm.
  10875. @item epzs
  10876. Enhanced predictive zonal search algorithm.
  10877. @item umh
  10878. Uneven multi-hexagon search algorithm.
  10879. @end table
  10880. Default algorithm is @samp{epzs}.
  10881. @item mb_size
  10882. Macroblock size. Default @code{16}.
  10883. @item search_param
  10884. Motion estimation search parameter. Default @code{32}.
  10885. @item vsbmc
  10886. 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).
  10887. @end table
  10888. @end table
  10889. @item scd
  10890. 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:
  10891. @table @samp
  10892. @item none
  10893. Disable scene change detection.
  10894. @item fdiff
  10895. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10896. @end table
  10897. Default method is @samp{fdiff}.
  10898. @item scd_threshold
  10899. Scene change detection threshold. Default is @code{10.}.
  10900. @end table
  10901. @section mix
  10902. Mix several video input streams into one video stream.
  10903. A description of the accepted options follows.
  10904. @table @option
  10905. @item nb_inputs
  10906. The number of inputs. If unspecified, it defaults to 2.
  10907. @item weights
  10908. Specify weight of each input video stream as sequence.
  10909. Each weight is separated by space. If number of weights
  10910. is smaller than number of @var{frames} last specified
  10911. weight will be used for all remaining unset weights.
  10912. @item scale
  10913. Specify scale, if it is set it will be multiplied with sum
  10914. of each weight multiplied with pixel values to give final destination
  10915. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10916. @item duration
  10917. Specify how end of stream is determined.
  10918. @table @samp
  10919. @item longest
  10920. The duration of the longest input. (default)
  10921. @item shortest
  10922. The duration of the shortest input.
  10923. @item first
  10924. The duration of the first input.
  10925. @end table
  10926. @end table
  10927. @section mpdecimate
  10928. Drop frames that do not differ greatly from the previous frame in
  10929. order to reduce frame rate.
  10930. The main use of this filter is for very-low-bitrate encoding
  10931. (e.g. streaming over dialup modem), but it could in theory be used for
  10932. fixing movies that were inverse-telecined incorrectly.
  10933. A description of the accepted options follows.
  10934. @table @option
  10935. @item max
  10936. Set the maximum number of consecutive frames which can be dropped (if
  10937. positive), or the minimum interval between dropped frames (if
  10938. negative). If the value is 0, the frame is dropped disregarding the
  10939. number of previous sequentially dropped frames.
  10940. Default value is 0.
  10941. @item hi
  10942. @item lo
  10943. @item frac
  10944. Set the dropping threshold values.
  10945. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10946. represent actual pixel value differences, so a threshold of 64
  10947. corresponds to 1 unit of difference for each pixel, or the same spread
  10948. out differently over the block.
  10949. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10950. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10951. meaning the whole image) differ by more than a threshold of @option{lo}.
  10952. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10953. 64*5, and default value for @option{frac} is 0.33.
  10954. @end table
  10955. @section negate
  10956. Negate (invert) the input video.
  10957. It accepts the following option:
  10958. @table @option
  10959. @item negate_alpha
  10960. With value 1, it negates the alpha component, if present. Default value is 0.
  10961. @end table
  10962. @anchor{nlmeans}
  10963. @section nlmeans
  10964. Denoise frames using Non-Local Means algorithm.
  10965. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10966. context similarity is defined by comparing their surrounding patches of size
  10967. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10968. around the pixel.
  10969. Note that the research area defines centers for patches, which means some
  10970. patches will be made of pixels outside that research area.
  10971. The filter accepts the following options.
  10972. @table @option
  10973. @item s
  10974. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10975. @item p
  10976. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10977. @item pc
  10978. Same as @option{p} but for chroma planes.
  10979. The default value is @var{0} and means automatic.
  10980. @item r
  10981. Set research size. Default is 15. Must be odd number in range [0, 99].
  10982. @item rc
  10983. Same as @option{r} but for chroma planes.
  10984. The default value is @var{0} and means automatic.
  10985. @end table
  10986. @section nnedi
  10987. Deinterlace video using neural network edge directed interpolation.
  10988. This filter accepts the following options:
  10989. @table @option
  10990. @item weights
  10991. Mandatory option, without binary file filter can not work.
  10992. Currently file can be found here:
  10993. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10994. @item deint
  10995. Set which frames to deinterlace, by default it is @code{all}.
  10996. Can be @code{all} or @code{interlaced}.
  10997. @item field
  10998. Set mode of operation.
  10999. Can be one of the following:
  11000. @table @samp
  11001. @item af
  11002. Use frame flags, both fields.
  11003. @item a
  11004. Use frame flags, single field.
  11005. @item t
  11006. Use top field only.
  11007. @item b
  11008. Use bottom field only.
  11009. @item tf
  11010. Use both fields, top first.
  11011. @item bf
  11012. Use both fields, bottom first.
  11013. @end table
  11014. @item planes
  11015. Set which planes to process, by default filter process all frames.
  11016. @item nsize
  11017. Set size of local neighborhood around each pixel, used by the predictor neural
  11018. network.
  11019. Can be one of the following:
  11020. @table @samp
  11021. @item s8x6
  11022. @item s16x6
  11023. @item s32x6
  11024. @item s48x6
  11025. @item s8x4
  11026. @item s16x4
  11027. @item s32x4
  11028. @end table
  11029. @item nns
  11030. Set the number of neurons in predictor neural network.
  11031. Can be one of the following:
  11032. @table @samp
  11033. @item n16
  11034. @item n32
  11035. @item n64
  11036. @item n128
  11037. @item n256
  11038. @end table
  11039. @item qual
  11040. Controls the number of different neural network predictions that are blended
  11041. together to compute the final output value. Can be @code{fast}, default or
  11042. @code{slow}.
  11043. @item etype
  11044. Set which set of weights to use in the predictor.
  11045. Can be one of the following:
  11046. @table @samp
  11047. @item a
  11048. weights trained to minimize absolute error
  11049. @item s
  11050. weights trained to minimize squared error
  11051. @end table
  11052. @item pscrn
  11053. Controls whether or not the prescreener neural network is used to decide
  11054. which pixels should be processed by the predictor neural network and which
  11055. can be handled by simple cubic interpolation.
  11056. The prescreener is trained to know whether cubic interpolation will be
  11057. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11058. The computational complexity of the prescreener nn is much less than that of
  11059. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11060. using the prescreener generally results in much faster processing.
  11061. The prescreener is pretty accurate, so the difference between using it and not
  11062. using it is almost always unnoticeable.
  11063. Can be one of the following:
  11064. @table @samp
  11065. @item none
  11066. @item original
  11067. @item new
  11068. @end table
  11069. Default is @code{new}.
  11070. @item fapprox
  11071. Set various debugging flags.
  11072. @end table
  11073. @section noformat
  11074. Force libavfilter not to use any of the specified pixel formats for the
  11075. input to the next filter.
  11076. It accepts the following parameters:
  11077. @table @option
  11078. @item pix_fmts
  11079. A '|'-separated list of pixel format names, such as
  11080. pix_fmts=yuv420p|monow|rgb24".
  11081. @end table
  11082. @subsection Examples
  11083. @itemize
  11084. @item
  11085. Force libavfilter to use a format different from @var{yuv420p} for the
  11086. input to the vflip filter:
  11087. @example
  11088. noformat=pix_fmts=yuv420p,vflip
  11089. @end example
  11090. @item
  11091. Convert the input video to any of the formats not contained in the list:
  11092. @example
  11093. noformat=yuv420p|yuv444p|yuv410p
  11094. @end example
  11095. @end itemize
  11096. @section noise
  11097. Add noise on video input frame.
  11098. The filter accepts the following options:
  11099. @table @option
  11100. @item all_seed
  11101. @item c0_seed
  11102. @item c1_seed
  11103. @item c2_seed
  11104. @item c3_seed
  11105. Set noise seed for specific pixel component or all pixel components in case
  11106. of @var{all_seed}. Default value is @code{123457}.
  11107. @item all_strength, alls
  11108. @item c0_strength, c0s
  11109. @item c1_strength, c1s
  11110. @item c2_strength, c2s
  11111. @item c3_strength, c3s
  11112. Set noise strength for specific pixel component or all pixel components in case
  11113. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11114. @item all_flags, allf
  11115. @item c0_flags, c0f
  11116. @item c1_flags, c1f
  11117. @item c2_flags, c2f
  11118. @item c3_flags, c3f
  11119. Set pixel component flags or set flags for all components if @var{all_flags}.
  11120. Available values for component flags are:
  11121. @table @samp
  11122. @item a
  11123. averaged temporal noise (smoother)
  11124. @item p
  11125. mix random noise with a (semi)regular pattern
  11126. @item t
  11127. temporal noise (noise pattern changes between frames)
  11128. @item u
  11129. uniform noise (gaussian otherwise)
  11130. @end table
  11131. @end table
  11132. @subsection Examples
  11133. Add temporal and uniform noise to input video:
  11134. @example
  11135. noise=alls=20:allf=t+u
  11136. @end example
  11137. @section normalize
  11138. Normalize RGB video (aka histogram stretching, contrast stretching).
  11139. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11140. For each channel of each frame, the filter computes the input range and maps
  11141. it linearly to the user-specified output range. The output range defaults
  11142. to the full dynamic range from pure black to pure white.
  11143. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11144. changes in brightness) caused when small dark or bright objects enter or leave
  11145. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11146. video camera, and, like a video camera, it may cause a period of over- or
  11147. under-exposure of the video.
  11148. The R,G,B channels can be normalized independently, which may cause some
  11149. color shifting, or linked together as a single channel, which prevents
  11150. color shifting. Linked normalization preserves hue. Independent normalization
  11151. does not, so it can be used to remove some color casts. Independent and linked
  11152. normalization can be combined in any ratio.
  11153. The normalize filter accepts the following options:
  11154. @table @option
  11155. @item blackpt
  11156. @item whitept
  11157. Colors which define the output range. The minimum input value is mapped to
  11158. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11159. The defaults are black and white respectively. Specifying white for
  11160. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11161. normalized video. Shades of grey can be used to reduce the dynamic range
  11162. (contrast). Specifying saturated colors here can create some interesting
  11163. effects.
  11164. @item smoothing
  11165. The number of previous frames to use for temporal smoothing. The input range
  11166. of each channel is smoothed using a rolling average over the current frame
  11167. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11168. smoothing).
  11169. @item independence
  11170. Controls the ratio of independent (color shifting) channel normalization to
  11171. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11172. independent. Defaults to 1.0 (fully independent).
  11173. @item strength
  11174. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11175. expensive no-op. Defaults to 1.0 (full strength).
  11176. @end table
  11177. @subsection Commands
  11178. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11179. The command accepts the same syntax of the corresponding option.
  11180. If the specified expression is not valid, it is kept at its current
  11181. value.
  11182. @subsection Examples
  11183. Stretch video contrast to use the full dynamic range, with no temporal
  11184. smoothing; may flicker depending on the source content:
  11185. @example
  11186. normalize=blackpt=black:whitept=white:smoothing=0
  11187. @end example
  11188. As above, but with 50 frames of temporal smoothing; flicker should be
  11189. reduced, depending on the source content:
  11190. @example
  11191. normalize=blackpt=black:whitept=white:smoothing=50
  11192. @end example
  11193. As above, but with hue-preserving linked channel normalization:
  11194. @example
  11195. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11196. @end example
  11197. As above, but with half strength:
  11198. @example
  11199. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11200. @end example
  11201. Map the darkest input color to red, the brightest input color to cyan:
  11202. @example
  11203. normalize=blackpt=red:whitept=cyan
  11204. @end example
  11205. @section null
  11206. Pass the video source unchanged to the output.
  11207. @section ocr
  11208. Optical Character Recognition
  11209. This filter uses Tesseract for optical character recognition. To enable
  11210. compilation of this filter, you need to configure FFmpeg with
  11211. @code{--enable-libtesseract}.
  11212. It accepts the following options:
  11213. @table @option
  11214. @item datapath
  11215. Set datapath to tesseract data. Default is to use whatever was
  11216. set at installation.
  11217. @item language
  11218. Set language, default is "eng".
  11219. @item whitelist
  11220. Set character whitelist.
  11221. @item blacklist
  11222. Set character blacklist.
  11223. @end table
  11224. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11225. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11226. @section ocv
  11227. Apply a video transform using libopencv.
  11228. To enable this filter, install the libopencv library and headers and
  11229. configure FFmpeg with @code{--enable-libopencv}.
  11230. It accepts the following parameters:
  11231. @table @option
  11232. @item filter_name
  11233. The name of the libopencv filter to apply.
  11234. @item filter_params
  11235. The parameters to pass to the libopencv filter. If not specified, the default
  11236. values are assumed.
  11237. @end table
  11238. Refer to the official libopencv documentation for more precise
  11239. information:
  11240. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11241. Several libopencv filters are supported; see the following subsections.
  11242. @anchor{dilate}
  11243. @subsection dilate
  11244. Dilate an image by using a specific structuring element.
  11245. It corresponds to the libopencv function @code{cvDilate}.
  11246. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11247. @var{struct_el} represents a structuring element, and has the syntax:
  11248. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11249. @var{cols} and @var{rows} represent the number of columns and rows of
  11250. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11251. point, and @var{shape} the shape for the structuring element. @var{shape}
  11252. must be "rect", "cross", "ellipse", or "custom".
  11253. If the value for @var{shape} is "custom", it must be followed by a
  11254. string of the form "=@var{filename}". The file with name
  11255. @var{filename} is assumed to represent a binary image, with each
  11256. printable character corresponding to a bright pixel. When a custom
  11257. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11258. or columns and rows of the read file are assumed instead.
  11259. The default value for @var{struct_el} is "3x3+0x0/rect".
  11260. @var{nb_iterations} specifies the number of times the transform is
  11261. applied to the image, and defaults to 1.
  11262. Some examples:
  11263. @example
  11264. # Use the default values
  11265. ocv=dilate
  11266. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11267. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11268. # Read the shape from the file diamond.shape, iterating two times.
  11269. # The file diamond.shape may contain a pattern of characters like this
  11270. # *
  11271. # ***
  11272. # *****
  11273. # ***
  11274. # *
  11275. # The specified columns and rows are ignored
  11276. # but the anchor point coordinates are not
  11277. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11278. @end example
  11279. @subsection erode
  11280. Erode an image by using a specific structuring element.
  11281. It corresponds to the libopencv function @code{cvErode}.
  11282. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11283. with the same syntax and semantics as the @ref{dilate} filter.
  11284. @subsection smooth
  11285. Smooth the input video.
  11286. The filter takes the following parameters:
  11287. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11288. @var{type} is the type of smooth filter to apply, and must be one of
  11289. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11290. or "bilateral". The default value is "gaussian".
  11291. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11292. depends on the smooth type. @var{param1} and
  11293. @var{param2} accept integer positive values or 0. @var{param3} and
  11294. @var{param4} accept floating point values.
  11295. The default value for @var{param1} is 3. The default value for the
  11296. other parameters is 0.
  11297. These parameters correspond to the parameters assigned to the
  11298. libopencv function @code{cvSmooth}.
  11299. @section oscilloscope
  11300. 2D Video Oscilloscope.
  11301. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11302. It accepts the following parameters:
  11303. @table @option
  11304. @item x
  11305. Set scope center x position.
  11306. @item y
  11307. Set scope center y position.
  11308. @item s
  11309. Set scope size, relative to frame diagonal.
  11310. @item t
  11311. Set scope tilt/rotation.
  11312. @item o
  11313. Set trace opacity.
  11314. @item tx
  11315. Set trace center x position.
  11316. @item ty
  11317. Set trace center y position.
  11318. @item tw
  11319. Set trace width, relative to width of frame.
  11320. @item th
  11321. Set trace height, relative to height of frame.
  11322. @item c
  11323. Set which components to trace. By default it traces first three components.
  11324. @item g
  11325. Draw trace grid. By default is enabled.
  11326. @item st
  11327. Draw some statistics. By default is enabled.
  11328. @item sc
  11329. Draw scope. By default is enabled.
  11330. @end table
  11331. @subsection Commands
  11332. This filter supports same @ref{commands} as options.
  11333. The command accepts the same syntax of the corresponding option.
  11334. If the specified expression is not valid, it is kept at its current
  11335. value.
  11336. @subsection Examples
  11337. @itemize
  11338. @item
  11339. Inspect full first row of video frame.
  11340. @example
  11341. oscilloscope=x=0.5:y=0:s=1
  11342. @end example
  11343. @item
  11344. Inspect full last row of video frame.
  11345. @example
  11346. oscilloscope=x=0.5:y=1:s=1
  11347. @end example
  11348. @item
  11349. Inspect full 5th line of video frame of height 1080.
  11350. @example
  11351. oscilloscope=x=0.5:y=5/1080:s=1
  11352. @end example
  11353. @item
  11354. Inspect full last column of video frame.
  11355. @example
  11356. oscilloscope=x=1:y=0.5:s=1:t=1
  11357. @end example
  11358. @end itemize
  11359. @anchor{overlay}
  11360. @section overlay
  11361. Overlay one video on top of another.
  11362. It takes two inputs and has one output. The first input is the "main"
  11363. video on which the second input is overlaid.
  11364. It accepts the following parameters:
  11365. A description of the accepted options follows.
  11366. @table @option
  11367. @item x
  11368. @item y
  11369. Set the expression for the x and y coordinates of the overlaid video
  11370. on the main video. Default value is "0" for both expressions. In case
  11371. the expression is invalid, it is set to a huge value (meaning that the
  11372. overlay will not be displayed within the output visible area).
  11373. @item eof_action
  11374. See @ref{framesync}.
  11375. @item eval
  11376. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11377. It accepts the following values:
  11378. @table @samp
  11379. @item init
  11380. only evaluate expressions once during the filter initialization or
  11381. when a command is processed
  11382. @item frame
  11383. evaluate expressions for each incoming frame
  11384. @end table
  11385. Default value is @samp{frame}.
  11386. @item shortest
  11387. See @ref{framesync}.
  11388. @item format
  11389. Set the format for the output video.
  11390. It accepts the following values:
  11391. @table @samp
  11392. @item yuv420
  11393. force YUV420 output
  11394. @item yuv420p10
  11395. force YUV420p10 output
  11396. @item yuv422
  11397. force YUV422 output
  11398. @item yuv422p10
  11399. force YUV422p10 output
  11400. @item yuv444
  11401. force YUV444 output
  11402. @item rgb
  11403. force packed RGB output
  11404. @item gbrp
  11405. force planar RGB output
  11406. @item auto
  11407. automatically pick format
  11408. @end table
  11409. Default value is @samp{yuv420}.
  11410. @item repeatlast
  11411. See @ref{framesync}.
  11412. @item alpha
  11413. Set format of alpha of the overlaid video, it can be @var{straight} or
  11414. @var{premultiplied}. Default is @var{straight}.
  11415. @end table
  11416. The @option{x}, and @option{y} expressions can contain the following
  11417. parameters.
  11418. @table @option
  11419. @item main_w, W
  11420. @item main_h, H
  11421. The main input width and height.
  11422. @item overlay_w, w
  11423. @item overlay_h, h
  11424. The overlay input width and height.
  11425. @item x
  11426. @item y
  11427. The computed values for @var{x} and @var{y}. They are evaluated for
  11428. each new frame.
  11429. @item hsub
  11430. @item vsub
  11431. horizontal and vertical chroma subsample values of the output
  11432. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11433. @var{vsub} is 1.
  11434. @item n
  11435. the number of input frame, starting from 0
  11436. @item pos
  11437. the position in the file of the input frame, NAN if unknown
  11438. @item t
  11439. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11440. @end table
  11441. This filter also supports the @ref{framesync} options.
  11442. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11443. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11444. when @option{eval} is set to @samp{init}.
  11445. Be aware that frames are taken from each input video in timestamp
  11446. order, hence, if their initial timestamps differ, it is a good idea
  11447. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11448. have them begin in the same zero timestamp, as the example for
  11449. the @var{movie} filter does.
  11450. You can chain together more overlays but you should test the
  11451. efficiency of such approach.
  11452. @subsection Commands
  11453. This filter supports the following commands:
  11454. @table @option
  11455. @item x
  11456. @item y
  11457. Modify the x and y of the overlay input.
  11458. The command accepts the same syntax of the corresponding option.
  11459. If the specified expression is not valid, it is kept at its current
  11460. value.
  11461. @end table
  11462. @subsection Examples
  11463. @itemize
  11464. @item
  11465. Draw the overlay at 10 pixels from the bottom right corner of the main
  11466. video:
  11467. @example
  11468. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11469. @end example
  11470. Using named options the example above becomes:
  11471. @example
  11472. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11473. @end example
  11474. @item
  11475. Insert a transparent PNG logo in the bottom left corner of the input,
  11476. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11477. @example
  11478. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11479. @end example
  11480. @item
  11481. Insert 2 different transparent PNG logos (second logo on bottom
  11482. right corner) using the @command{ffmpeg} tool:
  11483. @example
  11484. 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
  11485. @end example
  11486. @item
  11487. Add a transparent color layer on top of the main video; @code{WxH}
  11488. must specify the size of the main input to the overlay filter:
  11489. @example
  11490. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11491. @end example
  11492. @item
  11493. Play an original video and a filtered version (here with the deshake
  11494. filter) side by side using the @command{ffplay} tool:
  11495. @example
  11496. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11497. @end example
  11498. The above command is the same as:
  11499. @example
  11500. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11501. @end example
  11502. @item
  11503. Make a sliding overlay appearing from the left to the right top part of the
  11504. screen starting since time 2:
  11505. @example
  11506. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11507. @end example
  11508. @item
  11509. Compose output by putting two input videos side to side:
  11510. @example
  11511. ffmpeg -i left.avi -i right.avi -filter_complex "
  11512. nullsrc=size=200x100 [background];
  11513. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11514. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11515. [background][left] overlay=shortest=1 [background+left];
  11516. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11517. "
  11518. @end example
  11519. @item
  11520. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11521. @example
  11522. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11523. -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]'
  11524. masked.avi
  11525. @end example
  11526. @item
  11527. Chain several overlays in cascade:
  11528. @example
  11529. nullsrc=s=200x200 [bg];
  11530. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11531. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11532. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11533. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11534. [in3] null, [mid2] overlay=100:100 [out0]
  11535. @end example
  11536. @end itemize
  11537. @anchor{overlay_cuda}
  11538. @section overlay_cuda
  11539. Overlay one video on top of another.
  11540. This is the CUDA variant of the @ref{overlay} filter.
  11541. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11542. It takes two inputs and has one output. The first input is the "main"
  11543. video on which the second input is overlaid.
  11544. It accepts the following parameters:
  11545. @table @option
  11546. @item x
  11547. @item y
  11548. Set the x and y coordinates of the overlaid video on the main video.
  11549. Default value is "0" for both expressions.
  11550. @item eof_action
  11551. See @ref{framesync}.
  11552. @item shortest
  11553. See @ref{framesync}.
  11554. @item repeatlast
  11555. See @ref{framesync}.
  11556. @end table
  11557. This filter also supports the @ref{framesync} options.
  11558. @section owdenoise
  11559. Apply Overcomplete Wavelet denoiser.
  11560. The filter accepts the following options:
  11561. @table @option
  11562. @item depth
  11563. Set depth.
  11564. Larger depth values will denoise lower frequency components more, but
  11565. slow down filtering.
  11566. Must be an int in the range 8-16, default is @code{8}.
  11567. @item luma_strength, ls
  11568. Set luma strength.
  11569. Must be a double value in the range 0-1000, default is @code{1.0}.
  11570. @item chroma_strength, cs
  11571. Set chroma strength.
  11572. Must be a double value in the range 0-1000, default is @code{1.0}.
  11573. @end table
  11574. @anchor{pad}
  11575. @section pad
  11576. Add paddings to the input image, and place the original input at the
  11577. provided @var{x}, @var{y} coordinates.
  11578. It accepts the following parameters:
  11579. @table @option
  11580. @item width, w
  11581. @item height, h
  11582. Specify an expression for the size of the output image with the
  11583. paddings added. If the value for @var{width} or @var{height} is 0, the
  11584. corresponding input size is used for the output.
  11585. The @var{width} expression can reference the value set by the
  11586. @var{height} expression, and vice versa.
  11587. The default value of @var{width} and @var{height} is 0.
  11588. @item x
  11589. @item y
  11590. Specify the offsets to place the input image at within the padded area,
  11591. with respect to the top/left border of the output image.
  11592. The @var{x} expression can reference the value set by the @var{y}
  11593. expression, and vice versa.
  11594. The default value of @var{x} and @var{y} is 0.
  11595. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11596. so the input image is centered on the padded area.
  11597. @item color
  11598. Specify the color of the padded area. For the syntax of this option,
  11599. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11600. manual,ffmpeg-utils}.
  11601. The default value of @var{color} is "black".
  11602. @item eval
  11603. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11604. It accepts the following values:
  11605. @table @samp
  11606. @item init
  11607. Only evaluate expressions once during the filter initialization or when
  11608. a command is processed.
  11609. @item frame
  11610. Evaluate expressions for each incoming frame.
  11611. @end table
  11612. Default value is @samp{init}.
  11613. @item aspect
  11614. Pad to aspect instead to a resolution.
  11615. @end table
  11616. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11617. options are expressions containing the following constants:
  11618. @table @option
  11619. @item in_w
  11620. @item in_h
  11621. The input video width and height.
  11622. @item iw
  11623. @item ih
  11624. These are the same as @var{in_w} and @var{in_h}.
  11625. @item out_w
  11626. @item out_h
  11627. The output width and height (the size of the padded area), as
  11628. specified by the @var{width} and @var{height} expressions.
  11629. @item ow
  11630. @item oh
  11631. These are the same as @var{out_w} and @var{out_h}.
  11632. @item x
  11633. @item y
  11634. The x and y offsets as specified by the @var{x} and @var{y}
  11635. expressions, or NAN if not yet specified.
  11636. @item a
  11637. same as @var{iw} / @var{ih}
  11638. @item sar
  11639. input sample aspect ratio
  11640. @item dar
  11641. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11642. @item hsub
  11643. @item vsub
  11644. The horizontal and vertical chroma subsample values. For example for the
  11645. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11646. @end table
  11647. @subsection Examples
  11648. @itemize
  11649. @item
  11650. Add paddings with the color "violet" to the input video. The output video
  11651. size is 640x480, and the top-left corner of the input video is placed at
  11652. column 0, row 40
  11653. @example
  11654. pad=640:480:0:40:violet
  11655. @end example
  11656. The example above is equivalent to the following command:
  11657. @example
  11658. pad=width=640:height=480:x=0:y=40:color=violet
  11659. @end example
  11660. @item
  11661. Pad the input to get an output with dimensions increased by 3/2,
  11662. and put the input video at the center of the padded area:
  11663. @example
  11664. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11665. @end example
  11666. @item
  11667. Pad the input to get a squared output with size equal to the maximum
  11668. value between the input width and height, and put the input video at
  11669. the center of the padded area:
  11670. @example
  11671. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11672. @end example
  11673. @item
  11674. Pad the input to get a final w/h ratio of 16:9:
  11675. @example
  11676. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11677. @end example
  11678. @item
  11679. In case of anamorphic video, in order to set the output display aspect
  11680. correctly, it is necessary to use @var{sar} in the expression,
  11681. according to the relation:
  11682. @example
  11683. (ih * X / ih) * sar = output_dar
  11684. X = output_dar / sar
  11685. @end example
  11686. Thus the previous example needs to be modified to:
  11687. @example
  11688. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11689. @end example
  11690. @item
  11691. Double the output size and put the input video in the bottom-right
  11692. corner of the output padded area:
  11693. @example
  11694. pad="2*iw:2*ih:ow-iw:oh-ih"
  11695. @end example
  11696. @end itemize
  11697. @anchor{palettegen}
  11698. @section palettegen
  11699. Generate one palette for a whole video stream.
  11700. It accepts the following options:
  11701. @table @option
  11702. @item max_colors
  11703. Set the maximum number of colors to quantize in the palette.
  11704. Note: the palette will still contain 256 colors; the unused palette entries
  11705. will be black.
  11706. @item reserve_transparent
  11707. Create a palette of 255 colors maximum and reserve the last one for
  11708. transparency. Reserving the transparency color is useful for GIF optimization.
  11709. If not set, the maximum of colors in the palette will be 256. You probably want
  11710. to disable this option for a standalone image.
  11711. Set by default.
  11712. @item transparency_color
  11713. Set the color that will be used as background for transparency.
  11714. @item stats_mode
  11715. Set statistics mode.
  11716. It accepts the following values:
  11717. @table @samp
  11718. @item full
  11719. Compute full frame histograms.
  11720. @item diff
  11721. Compute histograms only for the part that differs from previous frame. This
  11722. might be relevant to give more importance to the moving part of your input if
  11723. the background is static.
  11724. @item single
  11725. Compute new histogram for each frame.
  11726. @end table
  11727. Default value is @var{full}.
  11728. @end table
  11729. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11730. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11731. color quantization of the palette. This information is also visible at
  11732. @var{info} logging level.
  11733. @subsection Examples
  11734. @itemize
  11735. @item
  11736. Generate a representative palette of a given video using @command{ffmpeg}:
  11737. @example
  11738. ffmpeg -i input.mkv -vf palettegen palette.png
  11739. @end example
  11740. @end itemize
  11741. @section paletteuse
  11742. Use a palette to downsample an input video stream.
  11743. The filter takes two inputs: one video stream and a palette. The palette must
  11744. be a 256 pixels image.
  11745. It accepts the following options:
  11746. @table @option
  11747. @item dither
  11748. Select dithering mode. Available algorithms are:
  11749. @table @samp
  11750. @item bayer
  11751. Ordered 8x8 bayer dithering (deterministic)
  11752. @item heckbert
  11753. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11754. Note: this dithering is sometimes considered "wrong" and is included as a
  11755. reference.
  11756. @item floyd_steinberg
  11757. Floyd and Steingberg dithering (error diffusion)
  11758. @item sierra2
  11759. Frankie Sierra dithering v2 (error diffusion)
  11760. @item sierra2_4a
  11761. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11762. @end table
  11763. Default is @var{sierra2_4a}.
  11764. @item bayer_scale
  11765. When @var{bayer} dithering is selected, this option defines the scale of the
  11766. pattern (how much the crosshatch pattern is visible). A low value means more
  11767. visible pattern for less banding, and higher value means less visible pattern
  11768. at the cost of more banding.
  11769. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11770. @item diff_mode
  11771. If set, define the zone to process
  11772. @table @samp
  11773. @item rectangle
  11774. Only the changing rectangle will be reprocessed. This is similar to GIF
  11775. cropping/offsetting compression mechanism. This option can be useful for speed
  11776. if only a part of the image is changing, and has use cases such as limiting the
  11777. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11778. moving scene (it leads to more deterministic output if the scene doesn't change
  11779. much, and as a result less moving noise and better GIF compression).
  11780. @end table
  11781. Default is @var{none}.
  11782. @item new
  11783. Take new palette for each output frame.
  11784. @item alpha_threshold
  11785. Sets the alpha threshold for transparency. Alpha values above this threshold
  11786. will be treated as completely opaque, and values below this threshold will be
  11787. treated as completely transparent.
  11788. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11789. @end table
  11790. @subsection Examples
  11791. @itemize
  11792. @item
  11793. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11794. using @command{ffmpeg}:
  11795. @example
  11796. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11797. @end example
  11798. @end itemize
  11799. @section perspective
  11800. Correct perspective of video not recorded perpendicular to the screen.
  11801. A description of the accepted parameters follows.
  11802. @table @option
  11803. @item x0
  11804. @item y0
  11805. @item x1
  11806. @item y1
  11807. @item x2
  11808. @item y2
  11809. @item x3
  11810. @item y3
  11811. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11812. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11813. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11814. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11815. then the corners of the source will be sent to the specified coordinates.
  11816. The expressions can use the following variables:
  11817. @table @option
  11818. @item W
  11819. @item H
  11820. the width and height of video frame.
  11821. @item in
  11822. Input frame count.
  11823. @item on
  11824. Output frame count.
  11825. @end table
  11826. @item interpolation
  11827. Set interpolation for perspective correction.
  11828. It accepts the following values:
  11829. @table @samp
  11830. @item linear
  11831. @item cubic
  11832. @end table
  11833. Default value is @samp{linear}.
  11834. @item sense
  11835. Set interpretation of coordinate options.
  11836. It accepts the following values:
  11837. @table @samp
  11838. @item 0, source
  11839. Send point in the source specified by the given coordinates to
  11840. the corners of the destination.
  11841. @item 1, destination
  11842. Send the corners of the source to the point in the destination specified
  11843. by the given coordinates.
  11844. Default value is @samp{source}.
  11845. @end table
  11846. @item eval
  11847. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11848. It accepts the following values:
  11849. @table @samp
  11850. @item init
  11851. only evaluate expressions once during the filter initialization or
  11852. when a command is processed
  11853. @item frame
  11854. evaluate expressions for each incoming frame
  11855. @end table
  11856. Default value is @samp{init}.
  11857. @end table
  11858. @section phase
  11859. Delay interlaced video by one field time so that the field order changes.
  11860. The intended use is to fix PAL movies that have been captured with the
  11861. opposite field order to the film-to-video transfer.
  11862. A description of the accepted parameters follows.
  11863. @table @option
  11864. @item mode
  11865. Set phase mode.
  11866. It accepts the following values:
  11867. @table @samp
  11868. @item t
  11869. Capture field order top-first, transfer bottom-first.
  11870. Filter will delay the bottom field.
  11871. @item b
  11872. Capture field order bottom-first, transfer top-first.
  11873. Filter will delay the top field.
  11874. @item p
  11875. Capture and transfer with the same field order. This mode only exists
  11876. for the documentation of the other options to refer to, but if you
  11877. actually select it, the filter will faithfully do nothing.
  11878. @item a
  11879. Capture field order determined automatically by field flags, transfer
  11880. opposite.
  11881. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11882. basis using field flags. If no field information is available,
  11883. then this works just like @samp{u}.
  11884. @item u
  11885. Capture unknown or varying, transfer opposite.
  11886. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11887. analyzing the images and selecting the alternative that produces best
  11888. match between the fields.
  11889. @item T
  11890. Capture top-first, transfer unknown or varying.
  11891. Filter selects among @samp{t} and @samp{p} using image analysis.
  11892. @item B
  11893. Capture bottom-first, transfer unknown or varying.
  11894. Filter selects among @samp{b} and @samp{p} using image analysis.
  11895. @item A
  11896. Capture determined by field flags, transfer unknown or varying.
  11897. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11898. image analysis. If no field information is available, then this works just
  11899. like @samp{U}. This is the default mode.
  11900. @item U
  11901. Both capture and transfer unknown or varying.
  11902. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11903. @end table
  11904. @end table
  11905. @section photosensitivity
  11906. Reduce various flashes in video, so to help users with epilepsy.
  11907. It accepts the following options:
  11908. @table @option
  11909. @item frames, f
  11910. Set how many frames to use when filtering. Default is 30.
  11911. @item threshold, t
  11912. Set detection threshold factor. Default is 1.
  11913. Lower is stricter.
  11914. @item skip
  11915. Set how many pixels to skip when sampling frames. Default is 1.
  11916. Allowed range is from 1 to 1024.
  11917. @item bypass
  11918. Leave frames unchanged. Default is disabled.
  11919. @end table
  11920. @section pixdesctest
  11921. Pixel format descriptor test filter, mainly useful for internal
  11922. testing. The output video should be equal to the input video.
  11923. For example:
  11924. @example
  11925. format=monow, pixdesctest
  11926. @end example
  11927. can be used to test the monowhite pixel format descriptor definition.
  11928. @section pixscope
  11929. Display sample values of color channels. Mainly useful for checking color
  11930. and levels. Minimum supported resolution is 640x480.
  11931. The filters accept the following options:
  11932. @table @option
  11933. @item x
  11934. Set scope X position, relative offset on X axis.
  11935. @item y
  11936. Set scope Y position, relative offset on Y axis.
  11937. @item w
  11938. Set scope width.
  11939. @item h
  11940. Set scope height.
  11941. @item o
  11942. Set window opacity. This window also holds statistics about pixel area.
  11943. @item wx
  11944. Set window X position, relative offset on X axis.
  11945. @item wy
  11946. Set window Y position, relative offset on Y axis.
  11947. @end table
  11948. @section pp
  11949. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11950. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11951. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11952. Each subfilter and some options have a short and a long name that can be used
  11953. interchangeably, i.e. dr/dering are the same.
  11954. The filters accept the following options:
  11955. @table @option
  11956. @item subfilters
  11957. Set postprocessing subfilters string.
  11958. @end table
  11959. All subfilters share common options to determine their scope:
  11960. @table @option
  11961. @item a/autoq
  11962. Honor the quality commands for this subfilter.
  11963. @item c/chrom
  11964. Do chrominance filtering, too (default).
  11965. @item y/nochrom
  11966. Do luminance filtering only (no chrominance).
  11967. @item n/noluma
  11968. Do chrominance filtering only (no luminance).
  11969. @end table
  11970. These options can be appended after the subfilter name, separated by a '|'.
  11971. Available subfilters are:
  11972. @table @option
  11973. @item hb/hdeblock[|difference[|flatness]]
  11974. Horizontal deblocking filter
  11975. @table @option
  11976. @item difference
  11977. Difference factor where higher values mean more deblocking (default: @code{32}).
  11978. @item flatness
  11979. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11980. @end table
  11981. @item vb/vdeblock[|difference[|flatness]]
  11982. Vertical deblocking filter
  11983. @table @option
  11984. @item difference
  11985. Difference factor where higher values mean more deblocking (default: @code{32}).
  11986. @item flatness
  11987. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11988. @end table
  11989. @item ha/hadeblock[|difference[|flatness]]
  11990. Accurate horizontal deblocking filter
  11991. @table @option
  11992. @item difference
  11993. Difference factor where higher values mean more deblocking (default: @code{32}).
  11994. @item flatness
  11995. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11996. @end table
  11997. @item va/vadeblock[|difference[|flatness]]
  11998. Accurate vertical deblocking filter
  11999. @table @option
  12000. @item difference
  12001. Difference factor where higher values mean more deblocking (default: @code{32}).
  12002. @item flatness
  12003. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12004. @end table
  12005. @end table
  12006. The horizontal and vertical deblocking filters share the difference and
  12007. flatness values so you cannot set different horizontal and vertical
  12008. thresholds.
  12009. @table @option
  12010. @item h1/x1hdeblock
  12011. Experimental horizontal deblocking filter
  12012. @item v1/x1vdeblock
  12013. Experimental vertical deblocking filter
  12014. @item dr/dering
  12015. Deringing filter
  12016. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12017. @table @option
  12018. @item threshold1
  12019. larger -> stronger filtering
  12020. @item threshold2
  12021. larger -> stronger filtering
  12022. @item threshold3
  12023. larger -> stronger filtering
  12024. @end table
  12025. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12026. @table @option
  12027. @item f/fullyrange
  12028. Stretch luminance to @code{0-255}.
  12029. @end table
  12030. @item lb/linblenddeint
  12031. Linear blend deinterlacing filter that deinterlaces the given block by
  12032. filtering all lines with a @code{(1 2 1)} filter.
  12033. @item li/linipoldeint
  12034. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12035. linearly interpolating every second line.
  12036. @item ci/cubicipoldeint
  12037. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12038. cubically interpolating every second line.
  12039. @item md/mediandeint
  12040. Median deinterlacing filter that deinterlaces the given block by applying a
  12041. median filter to every second line.
  12042. @item fd/ffmpegdeint
  12043. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12044. second line with a @code{(-1 4 2 4 -1)} filter.
  12045. @item l5/lowpass5
  12046. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12047. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12048. @item fq/forceQuant[|quantizer]
  12049. Overrides the quantizer table from the input with the constant quantizer you
  12050. specify.
  12051. @table @option
  12052. @item quantizer
  12053. Quantizer to use
  12054. @end table
  12055. @item de/default
  12056. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12057. @item fa/fast
  12058. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12059. @item ac
  12060. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12061. @end table
  12062. @subsection Examples
  12063. @itemize
  12064. @item
  12065. Apply horizontal and vertical deblocking, deringing and automatic
  12066. brightness/contrast:
  12067. @example
  12068. pp=hb/vb/dr/al
  12069. @end example
  12070. @item
  12071. Apply default filters without brightness/contrast correction:
  12072. @example
  12073. pp=de/-al
  12074. @end example
  12075. @item
  12076. Apply default filters and temporal denoiser:
  12077. @example
  12078. pp=default/tmpnoise|1|2|3
  12079. @end example
  12080. @item
  12081. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12082. automatically depending on available CPU time:
  12083. @example
  12084. pp=hb|y/vb|a
  12085. @end example
  12086. @end itemize
  12087. @section pp7
  12088. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12089. similar to spp = 6 with 7 point DCT, where only the center sample is
  12090. used after IDCT.
  12091. The filter accepts the following options:
  12092. @table @option
  12093. @item qp
  12094. Force a constant quantization parameter. It accepts an integer in range
  12095. 0 to 63. If not set, the filter will use the QP from the video stream
  12096. (if available).
  12097. @item mode
  12098. Set thresholding mode. Available modes are:
  12099. @table @samp
  12100. @item hard
  12101. Set hard thresholding.
  12102. @item soft
  12103. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12104. @item medium
  12105. Set medium thresholding (good results, default).
  12106. @end table
  12107. @end table
  12108. @section premultiply
  12109. Apply alpha premultiply effect to input video stream using first plane
  12110. of second stream as alpha.
  12111. Both streams must have same dimensions and same pixel format.
  12112. The filter accepts the following option:
  12113. @table @option
  12114. @item planes
  12115. Set which planes will be processed, unprocessed planes will be copied.
  12116. By default value 0xf, all planes will be processed.
  12117. @item inplace
  12118. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12119. @end table
  12120. @section prewitt
  12121. Apply prewitt operator to input video stream.
  12122. The filter accepts the following option:
  12123. @table @option
  12124. @item planes
  12125. Set which planes will be processed, unprocessed planes will be copied.
  12126. By default value 0xf, all planes will be processed.
  12127. @item scale
  12128. Set value which will be multiplied with filtered result.
  12129. @item delta
  12130. Set value which will be added to filtered result.
  12131. @end table
  12132. @section pseudocolor
  12133. Alter frame colors in video with pseudocolors.
  12134. This filter accepts the following options:
  12135. @table @option
  12136. @item c0
  12137. set pixel first component expression
  12138. @item c1
  12139. set pixel second component expression
  12140. @item c2
  12141. set pixel third component expression
  12142. @item c3
  12143. set pixel fourth component expression, corresponds to the alpha component
  12144. @item i
  12145. set component to use as base for altering colors
  12146. @end table
  12147. Each of them specifies the expression to use for computing the lookup table for
  12148. the corresponding pixel component values.
  12149. The expressions can contain the following constants and functions:
  12150. @table @option
  12151. @item w
  12152. @item h
  12153. The input width and height.
  12154. @item val
  12155. The input value for the pixel component.
  12156. @item ymin, umin, vmin, amin
  12157. The minimum allowed component value.
  12158. @item ymax, umax, vmax, amax
  12159. The maximum allowed component value.
  12160. @end table
  12161. All expressions default to "val".
  12162. @subsection Examples
  12163. @itemize
  12164. @item
  12165. Change too high luma values to gradient:
  12166. @example
  12167. 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'"
  12168. @end example
  12169. @end itemize
  12170. @section psnr
  12171. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12172. Ratio) between two input videos.
  12173. This filter takes in input two input videos, the first input is
  12174. considered the "main" source and is passed unchanged to the
  12175. output. The second input is used as a "reference" video for computing
  12176. the PSNR.
  12177. Both video inputs must have the same resolution and pixel format for
  12178. this filter to work correctly. Also it assumes that both inputs
  12179. have the same number of frames, which are compared one by one.
  12180. The obtained average PSNR is printed through the logging system.
  12181. The filter stores the accumulated MSE (mean squared error) of each
  12182. frame, and at the end of the processing it is averaged across all frames
  12183. equally, and the following formula is applied to obtain the PSNR:
  12184. @example
  12185. PSNR = 10*log10(MAX^2/MSE)
  12186. @end example
  12187. Where MAX is the average of the maximum values of each component of the
  12188. image.
  12189. The description of the accepted parameters follows.
  12190. @table @option
  12191. @item stats_file, f
  12192. If specified the filter will use the named file to save the PSNR of
  12193. each individual frame. When filename equals "-" the data is sent to
  12194. standard output.
  12195. @item stats_version
  12196. Specifies which version of the stats file format to use. Details of
  12197. each format are written below.
  12198. Default value is 1.
  12199. @item stats_add_max
  12200. Determines whether the max value is output to the stats log.
  12201. Default value is 0.
  12202. Requires stats_version >= 2. If this is set and stats_version < 2,
  12203. the filter will return an error.
  12204. @end table
  12205. This filter also supports the @ref{framesync} options.
  12206. The file printed if @var{stats_file} is selected, contains a sequence of
  12207. key/value pairs of the form @var{key}:@var{value} for each compared
  12208. couple of frames.
  12209. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12210. the list of per-frame-pair stats, with key value pairs following the frame
  12211. format with the following parameters:
  12212. @table @option
  12213. @item psnr_log_version
  12214. The version of the log file format. Will match @var{stats_version}.
  12215. @item fields
  12216. A comma separated list of the per-frame-pair parameters included in
  12217. the log.
  12218. @end table
  12219. A description of each shown per-frame-pair parameter follows:
  12220. @table @option
  12221. @item n
  12222. sequential number of the input frame, starting from 1
  12223. @item mse_avg
  12224. Mean Square Error pixel-by-pixel average difference of the compared
  12225. frames, averaged over all the image components.
  12226. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12227. Mean Square Error pixel-by-pixel average difference of the compared
  12228. frames for the component specified by the suffix.
  12229. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12230. Peak Signal to Noise ratio of the compared frames for the component
  12231. specified by the suffix.
  12232. @item max_avg, max_y, max_u, max_v
  12233. Maximum allowed value for each channel, and average over all
  12234. channels.
  12235. @end table
  12236. @subsection Examples
  12237. @itemize
  12238. @item
  12239. For example:
  12240. @example
  12241. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12242. [main][ref] psnr="stats_file=stats.log" [out]
  12243. @end example
  12244. On this example the input file being processed is compared with the
  12245. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12246. is stored in @file{stats.log}.
  12247. @item
  12248. Another example with different containers:
  12249. @example
  12250. 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 -
  12251. @end example
  12252. @end itemize
  12253. @anchor{pullup}
  12254. @section pullup
  12255. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12256. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12257. content.
  12258. The pullup filter is designed to take advantage of future context in making
  12259. its decisions. This filter is stateless in the sense that it does not lock
  12260. onto a pattern to follow, but it instead looks forward to the following
  12261. fields in order to identify matches and rebuild progressive frames.
  12262. To produce content with an even framerate, insert the fps filter after
  12263. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12264. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12265. The filter accepts the following options:
  12266. @table @option
  12267. @item jl
  12268. @item jr
  12269. @item jt
  12270. @item jb
  12271. These options set the amount of "junk" to ignore at the left, right, top, and
  12272. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12273. while top and bottom are in units of 2 lines.
  12274. The default is 8 pixels on each side.
  12275. @item sb
  12276. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12277. filter generating an occasional mismatched frame, but it may also cause an
  12278. excessive number of frames to be dropped during high motion sequences.
  12279. Conversely, setting it to -1 will make filter match fields more easily.
  12280. This may help processing of video where there is slight blurring between
  12281. the fields, but may also cause there to be interlaced frames in the output.
  12282. Default value is @code{0}.
  12283. @item mp
  12284. Set the metric plane to use. It accepts the following values:
  12285. @table @samp
  12286. @item l
  12287. Use luma plane.
  12288. @item u
  12289. Use chroma blue plane.
  12290. @item v
  12291. Use chroma red plane.
  12292. @end table
  12293. This option may be set to use chroma plane instead of the default luma plane
  12294. for doing filter's computations. This may improve accuracy on very clean
  12295. source material, but more likely will decrease accuracy, especially if there
  12296. is chroma noise (rainbow effect) or any grayscale video.
  12297. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12298. load and make pullup usable in realtime on slow machines.
  12299. @end table
  12300. For best results (without duplicated frames in the output file) it is
  12301. necessary to change the output frame rate. For example, to inverse
  12302. telecine NTSC input:
  12303. @example
  12304. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12305. @end example
  12306. @section qp
  12307. Change video quantization parameters (QP).
  12308. The filter accepts the following option:
  12309. @table @option
  12310. @item qp
  12311. Set expression for quantization parameter.
  12312. @end table
  12313. The expression is evaluated through the eval API and can contain, among others,
  12314. the following constants:
  12315. @table @var
  12316. @item known
  12317. 1 if index is not 129, 0 otherwise.
  12318. @item qp
  12319. Sequential index starting from -129 to 128.
  12320. @end table
  12321. @subsection Examples
  12322. @itemize
  12323. @item
  12324. Some equation like:
  12325. @example
  12326. qp=2+2*sin(PI*qp)
  12327. @end example
  12328. @end itemize
  12329. @section random
  12330. Flush video frames from internal cache of frames into a random order.
  12331. No frame is discarded.
  12332. Inspired by @ref{frei0r} nervous filter.
  12333. @table @option
  12334. @item frames
  12335. Set size in number of frames of internal cache, in range from @code{2} to
  12336. @code{512}. Default is @code{30}.
  12337. @item seed
  12338. Set seed for random number generator, must be an integer included between
  12339. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12340. less than @code{0}, the filter will try to use a good random seed on a
  12341. best effort basis.
  12342. @end table
  12343. @section readeia608
  12344. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12345. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12346. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12347. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12348. @table @option
  12349. @item lavfi.readeia608.X.cc
  12350. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12351. @item lavfi.readeia608.X.line
  12352. The number of the line on which the EIA-608 data was identified and read.
  12353. @end table
  12354. This filter accepts the following options:
  12355. @table @option
  12356. @item scan_min
  12357. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12358. @item scan_max
  12359. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12360. @item spw
  12361. Set the ratio of width reserved for sync code detection.
  12362. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12363. @item chp
  12364. Enable checking the parity bit. In the event of a parity error, the filter will output
  12365. @code{0x00} for that character. Default is false.
  12366. @item lp
  12367. Lowpass lines prior to further processing. Default is enabled.
  12368. @end table
  12369. @subsection Commands
  12370. This filter supports the all above options as @ref{commands}.
  12371. @subsection Examples
  12372. @itemize
  12373. @item
  12374. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12375. @example
  12376. 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
  12377. @end example
  12378. @end itemize
  12379. @section readvitc
  12380. Read vertical interval timecode (VITC) information from the top lines of a
  12381. video frame.
  12382. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12383. timecode value, if a valid timecode has been detected. Further metadata key
  12384. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12385. timecode data has been found or not.
  12386. This filter accepts the following options:
  12387. @table @option
  12388. @item scan_max
  12389. Set the maximum number of lines to scan for VITC data. If the value is set to
  12390. @code{-1} the full video frame is scanned. Default is @code{45}.
  12391. @item thr_b
  12392. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12393. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12394. @item thr_w
  12395. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12396. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12397. @end table
  12398. @subsection Examples
  12399. @itemize
  12400. @item
  12401. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12402. draw @code{--:--:--:--} as a placeholder:
  12403. @example
  12404. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12405. @end example
  12406. @end itemize
  12407. @section remap
  12408. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12409. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12410. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12411. value for pixel will be used for destination pixel.
  12412. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12413. will have Xmap/Ymap video stream dimensions.
  12414. Xmap and Ymap input video streams are 16bit depth, single channel.
  12415. @table @option
  12416. @item format
  12417. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12418. Default is @code{color}.
  12419. @item fill
  12420. Specify the color of the unmapped pixels. For the syntax of this option,
  12421. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12422. manual,ffmpeg-utils}. Default color is @code{black}.
  12423. @end table
  12424. @section removegrain
  12425. The removegrain filter is a spatial denoiser for progressive video.
  12426. @table @option
  12427. @item m0
  12428. Set mode for the first plane.
  12429. @item m1
  12430. Set mode for the second plane.
  12431. @item m2
  12432. Set mode for the third plane.
  12433. @item m3
  12434. Set mode for the fourth plane.
  12435. @end table
  12436. Range of mode is from 0 to 24. Description of each mode follows:
  12437. @table @var
  12438. @item 0
  12439. Leave input plane unchanged. Default.
  12440. @item 1
  12441. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12442. @item 2
  12443. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12444. @item 3
  12445. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12446. @item 4
  12447. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12448. This is equivalent to a median filter.
  12449. @item 5
  12450. Line-sensitive clipping giving the minimal change.
  12451. @item 6
  12452. Line-sensitive clipping, intermediate.
  12453. @item 7
  12454. Line-sensitive clipping, intermediate.
  12455. @item 8
  12456. Line-sensitive clipping, intermediate.
  12457. @item 9
  12458. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12459. @item 10
  12460. Replaces the target pixel with the closest neighbour.
  12461. @item 11
  12462. [1 2 1] horizontal and vertical kernel blur.
  12463. @item 12
  12464. Same as mode 11.
  12465. @item 13
  12466. Bob mode, interpolates top field from the line where the neighbours
  12467. pixels are the closest.
  12468. @item 14
  12469. Bob mode, interpolates bottom field from the line where the neighbours
  12470. pixels are the closest.
  12471. @item 15
  12472. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12473. interpolation formula.
  12474. @item 16
  12475. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12476. interpolation formula.
  12477. @item 17
  12478. Clips the pixel with the minimum and maximum of respectively the maximum and
  12479. minimum of each pair of opposite neighbour pixels.
  12480. @item 18
  12481. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12482. the current pixel is minimal.
  12483. @item 19
  12484. Replaces the pixel with the average of its 8 neighbours.
  12485. @item 20
  12486. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12487. @item 21
  12488. Clips pixels using the averages of opposite neighbour.
  12489. @item 22
  12490. Same as mode 21 but simpler and faster.
  12491. @item 23
  12492. Small edge and halo removal, but reputed useless.
  12493. @item 24
  12494. Similar as 23.
  12495. @end table
  12496. @section removelogo
  12497. Suppress a TV station logo, using an image file to determine which
  12498. pixels comprise the logo. It works by filling in the pixels that
  12499. comprise the logo with neighboring pixels.
  12500. The filter accepts the following options:
  12501. @table @option
  12502. @item filename, f
  12503. Set the filter bitmap file, which can be any image format supported by
  12504. libavformat. The width and height of the image file must match those of the
  12505. video stream being processed.
  12506. @end table
  12507. Pixels in the provided bitmap image with a value of zero are not
  12508. considered part of the logo, non-zero pixels are considered part of
  12509. the logo. If you use white (255) for the logo and black (0) for the
  12510. rest, you will be safe. For making the filter bitmap, it is
  12511. recommended to take a screen capture of a black frame with the logo
  12512. visible, and then using a threshold filter followed by the erode
  12513. filter once or twice.
  12514. If needed, little splotches can be fixed manually. Remember that if
  12515. logo pixels are not covered, the filter quality will be much
  12516. reduced. Marking too many pixels as part of the logo does not hurt as
  12517. much, but it will increase the amount of blurring needed to cover over
  12518. the image and will destroy more information than necessary, and extra
  12519. pixels will slow things down on a large logo.
  12520. @section repeatfields
  12521. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12522. fields based on its value.
  12523. @section reverse
  12524. Reverse a video clip.
  12525. Warning: This filter requires memory to buffer the entire clip, so trimming
  12526. is suggested.
  12527. @subsection Examples
  12528. @itemize
  12529. @item
  12530. Take the first 5 seconds of a clip, and reverse it.
  12531. @example
  12532. trim=end=5,reverse
  12533. @end example
  12534. @end itemize
  12535. @section rgbashift
  12536. Shift R/G/B/A pixels horizontally and/or vertically.
  12537. The filter accepts the following options:
  12538. @table @option
  12539. @item rh
  12540. Set amount to shift red horizontally.
  12541. @item rv
  12542. Set amount to shift red vertically.
  12543. @item gh
  12544. Set amount to shift green horizontally.
  12545. @item gv
  12546. Set amount to shift green vertically.
  12547. @item bh
  12548. Set amount to shift blue horizontally.
  12549. @item bv
  12550. Set amount to shift blue vertically.
  12551. @item ah
  12552. Set amount to shift alpha horizontally.
  12553. @item av
  12554. Set amount to shift alpha vertically.
  12555. @item edge
  12556. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12557. @end table
  12558. @subsection Commands
  12559. This filter supports the all above options as @ref{commands}.
  12560. @section roberts
  12561. Apply roberts cross operator to input video stream.
  12562. The filter accepts the following option:
  12563. @table @option
  12564. @item planes
  12565. Set which planes will be processed, unprocessed planes will be copied.
  12566. By default value 0xf, all planes will be processed.
  12567. @item scale
  12568. Set value which will be multiplied with filtered result.
  12569. @item delta
  12570. Set value which will be added to filtered result.
  12571. @end table
  12572. @section rotate
  12573. Rotate video by an arbitrary angle expressed in radians.
  12574. The filter accepts the following options:
  12575. A description of the optional parameters follows.
  12576. @table @option
  12577. @item angle, a
  12578. Set an expression for the angle by which to rotate the input video
  12579. clockwise, expressed as a number of radians. A negative value will
  12580. result in a counter-clockwise rotation. By default it is set to "0".
  12581. This expression is evaluated for each frame.
  12582. @item out_w, ow
  12583. Set the output width expression, default value is "iw".
  12584. This expression is evaluated just once during configuration.
  12585. @item out_h, oh
  12586. Set the output height expression, default value is "ih".
  12587. This expression is evaluated just once during configuration.
  12588. @item bilinear
  12589. Enable bilinear interpolation if set to 1, a value of 0 disables
  12590. it. Default value is 1.
  12591. @item fillcolor, c
  12592. Set the color used to fill the output area not covered by the rotated
  12593. image. For the general syntax of this option, check the
  12594. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12595. If the special value "none" is selected then no
  12596. background is printed (useful for example if the background is never shown).
  12597. Default value is "black".
  12598. @end table
  12599. The expressions for the angle and the output size can contain the
  12600. following constants and functions:
  12601. @table @option
  12602. @item n
  12603. sequential number of the input frame, starting from 0. It is always NAN
  12604. before the first frame is filtered.
  12605. @item t
  12606. time in seconds of the input frame, it is set to 0 when the filter is
  12607. configured. It is always NAN before the first frame is filtered.
  12608. @item hsub
  12609. @item vsub
  12610. horizontal and vertical chroma subsample values. For example for the
  12611. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12612. @item in_w, iw
  12613. @item in_h, ih
  12614. the input video width and height
  12615. @item out_w, ow
  12616. @item out_h, oh
  12617. the output width and height, that is the size of the padded area as
  12618. specified by the @var{width} and @var{height} expressions
  12619. @item rotw(a)
  12620. @item roth(a)
  12621. the minimal width/height required for completely containing the input
  12622. video rotated by @var{a} radians.
  12623. These are only available when computing the @option{out_w} and
  12624. @option{out_h} expressions.
  12625. @end table
  12626. @subsection Examples
  12627. @itemize
  12628. @item
  12629. Rotate the input by PI/6 radians clockwise:
  12630. @example
  12631. rotate=PI/6
  12632. @end example
  12633. @item
  12634. Rotate the input by PI/6 radians counter-clockwise:
  12635. @example
  12636. rotate=-PI/6
  12637. @end example
  12638. @item
  12639. Rotate the input by 45 degrees clockwise:
  12640. @example
  12641. rotate=45*PI/180
  12642. @end example
  12643. @item
  12644. Apply a constant rotation with period T, starting from an angle of PI/3:
  12645. @example
  12646. rotate=PI/3+2*PI*t/T
  12647. @end example
  12648. @item
  12649. Make the input video rotation oscillating with a period of T
  12650. seconds and an amplitude of A radians:
  12651. @example
  12652. rotate=A*sin(2*PI/T*t)
  12653. @end example
  12654. @item
  12655. Rotate the video, output size is chosen so that the whole rotating
  12656. input video is always completely contained in the output:
  12657. @example
  12658. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12659. @end example
  12660. @item
  12661. Rotate the video, reduce the output size so that no background is ever
  12662. shown:
  12663. @example
  12664. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12665. @end example
  12666. @end itemize
  12667. @subsection Commands
  12668. The filter supports the following commands:
  12669. @table @option
  12670. @item a, angle
  12671. Set the angle expression.
  12672. The command accepts the same syntax of the corresponding option.
  12673. If the specified expression is not valid, it is kept at its current
  12674. value.
  12675. @end table
  12676. @section sab
  12677. Apply Shape Adaptive Blur.
  12678. The filter accepts the following options:
  12679. @table @option
  12680. @item luma_radius, lr
  12681. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12682. value is 1.0. A greater value will result in a more blurred image, and
  12683. in slower processing.
  12684. @item luma_pre_filter_radius, lpfr
  12685. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12686. value is 1.0.
  12687. @item luma_strength, ls
  12688. Set luma maximum difference between pixels to still be considered, must
  12689. be a value in the 0.1-100.0 range, default value is 1.0.
  12690. @item chroma_radius, cr
  12691. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12692. greater value will result in a more blurred image, and in slower
  12693. processing.
  12694. @item chroma_pre_filter_radius, cpfr
  12695. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12696. @item chroma_strength, cs
  12697. Set chroma maximum difference between pixels to still be considered,
  12698. must be a value in the -0.9-100.0 range.
  12699. @end table
  12700. Each chroma option value, if not explicitly specified, is set to the
  12701. corresponding luma option value.
  12702. @anchor{scale}
  12703. @section scale
  12704. Scale (resize) the input video, using the libswscale library.
  12705. The scale filter forces the output display aspect ratio to be the same
  12706. of the input, by changing the output sample aspect ratio.
  12707. If the input image format is different from the format requested by
  12708. the next filter, the scale filter will convert the input to the
  12709. requested format.
  12710. @subsection Options
  12711. The filter accepts the following options, or any of the options
  12712. supported by the libswscale scaler.
  12713. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12714. the complete list of scaler options.
  12715. @table @option
  12716. @item width, w
  12717. @item height, h
  12718. Set the output video dimension expression. Default value is the input
  12719. dimension.
  12720. If the @var{width} or @var{w} value is 0, the input width is used for
  12721. the output. If the @var{height} or @var{h} value is 0, the input height
  12722. is used for the output.
  12723. If one and only one of the values is -n with n >= 1, the scale filter
  12724. will use a value that maintains the aspect ratio of the input image,
  12725. calculated from the other specified dimension. After that it will,
  12726. however, make sure that the calculated dimension is divisible by n and
  12727. adjust the value if necessary.
  12728. If both values are -n with n >= 1, the behavior will be identical to
  12729. both values being set to 0 as previously detailed.
  12730. See below for the list of accepted constants for use in the dimension
  12731. expression.
  12732. @item eval
  12733. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12734. @table @samp
  12735. @item init
  12736. Only evaluate expressions once during the filter initialization or when a command is processed.
  12737. @item frame
  12738. Evaluate expressions for each incoming frame.
  12739. @end table
  12740. Default value is @samp{init}.
  12741. @item interl
  12742. Set the interlacing mode. It accepts the following values:
  12743. @table @samp
  12744. @item 1
  12745. Force interlaced aware scaling.
  12746. @item 0
  12747. Do not apply interlaced scaling.
  12748. @item -1
  12749. Select interlaced aware scaling depending on whether the source frames
  12750. are flagged as interlaced or not.
  12751. @end table
  12752. Default value is @samp{0}.
  12753. @item flags
  12754. Set libswscale scaling flags. See
  12755. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12756. complete list of values. If not explicitly specified the filter applies
  12757. the default flags.
  12758. @item param0, param1
  12759. Set libswscale input parameters for scaling algorithms that need them. See
  12760. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12761. complete documentation. If not explicitly specified the filter applies
  12762. empty parameters.
  12763. @item size, s
  12764. Set the video size. For the syntax of this option, check the
  12765. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12766. @item in_color_matrix
  12767. @item out_color_matrix
  12768. Set in/output YCbCr color space type.
  12769. This allows the autodetected value to be overridden as well as allows forcing
  12770. a specific value used for the output and encoder.
  12771. If not specified, the color space type depends on the pixel format.
  12772. Possible values:
  12773. @table @samp
  12774. @item auto
  12775. Choose automatically.
  12776. @item bt709
  12777. Format conforming to International Telecommunication Union (ITU)
  12778. Recommendation BT.709.
  12779. @item fcc
  12780. Set color space conforming to the United States Federal Communications
  12781. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12782. @item bt601
  12783. @item bt470
  12784. @item smpte170m
  12785. Set color space conforming to:
  12786. @itemize
  12787. @item
  12788. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12789. @item
  12790. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12791. @item
  12792. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12793. @end itemize
  12794. @item smpte240m
  12795. Set color space conforming to SMPTE ST 240:1999.
  12796. @item bt2020
  12797. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12798. @end table
  12799. @item in_range
  12800. @item out_range
  12801. Set in/output YCbCr sample range.
  12802. This allows the autodetected value to be overridden as well as allows forcing
  12803. a specific value used for the output and encoder. If not specified, the
  12804. range depends on the pixel format. Possible values:
  12805. @table @samp
  12806. @item auto/unknown
  12807. Choose automatically.
  12808. @item jpeg/full/pc
  12809. Set full range (0-255 in case of 8-bit luma).
  12810. @item mpeg/limited/tv
  12811. Set "MPEG" range (16-235 in case of 8-bit luma).
  12812. @end table
  12813. @item force_original_aspect_ratio
  12814. Enable decreasing or increasing output video width or height if necessary to
  12815. keep the original aspect ratio. Possible values:
  12816. @table @samp
  12817. @item disable
  12818. Scale the video as specified and disable this feature.
  12819. @item decrease
  12820. The output video dimensions will automatically be decreased if needed.
  12821. @item increase
  12822. The output video dimensions will automatically be increased if needed.
  12823. @end table
  12824. One useful instance of this option is that when you know a specific device's
  12825. maximum allowed resolution, you can use this to limit the output video to
  12826. that, while retaining the aspect ratio. For example, device A allows
  12827. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12828. decrease) and specifying 1280x720 to the command line makes the output
  12829. 1280x533.
  12830. Please note that this is a different thing than specifying -1 for @option{w}
  12831. or @option{h}, you still need to specify the output resolution for this option
  12832. to work.
  12833. @item force_divisible_by
  12834. Ensures that both the output dimensions, width and height, are divisible by the
  12835. given integer when used together with @option{force_original_aspect_ratio}. This
  12836. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12837. This option respects the value set for @option{force_original_aspect_ratio},
  12838. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12839. may be slightly modified.
  12840. This option can be handy if you need to have a video fit within or exceed
  12841. a defined resolution using @option{force_original_aspect_ratio} but also have
  12842. encoder restrictions on width or height divisibility.
  12843. @end table
  12844. The values of the @option{w} and @option{h} options are expressions
  12845. containing the following constants:
  12846. @table @var
  12847. @item in_w
  12848. @item in_h
  12849. The input width and height
  12850. @item iw
  12851. @item ih
  12852. These are the same as @var{in_w} and @var{in_h}.
  12853. @item out_w
  12854. @item out_h
  12855. The output (scaled) width and height
  12856. @item ow
  12857. @item oh
  12858. These are the same as @var{out_w} and @var{out_h}
  12859. @item a
  12860. The same as @var{iw} / @var{ih}
  12861. @item sar
  12862. input sample aspect ratio
  12863. @item dar
  12864. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12865. @item hsub
  12866. @item vsub
  12867. horizontal and vertical input chroma subsample values. For example for the
  12868. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12869. @item ohsub
  12870. @item ovsub
  12871. horizontal and vertical output chroma subsample values. For example for the
  12872. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12873. @item n
  12874. The (sequential) number of the input frame, starting from 0.
  12875. Only available with @code{eval=frame}.
  12876. @item t
  12877. The presentation timestamp of the input frame, expressed as a number of
  12878. seconds. Only available with @code{eval=frame}.
  12879. @item pos
  12880. The position (byte offset) of the frame in the input stream, or NaN if
  12881. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12882. Only available with @code{eval=frame}.
  12883. @end table
  12884. @subsection Examples
  12885. @itemize
  12886. @item
  12887. Scale the input video to a size of 200x100
  12888. @example
  12889. scale=w=200:h=100
  12890. @end example
  12891. This is equivalent to:
  12892. @example
  12893. scale=200:100
  12894. @end example
  12895. or:
  12896. @example
  12897. scale=200x100
  12898. @end example
  12899. @item
  12900. Specify a size abbreviation for the output size:
  12901. @example
  12902. scale=qcif
  12903. @end example
  12904. which can also be written as:
  12905. @example
  12906. scale=size=qcif
  12907. @end example
  12908. @item
  12909. Scale the input to 2x:
  12910. @example
  12911. scale=w=2*iw:h=2*ih
  12912. @end example
  12913. @item
  12914. The above is the same as:
  12915. @example
  12916. scale=2*in_w:2*in_h
  12917. @end example
  12918. @item
  12919. Scale the input to 2x with forced interlaced scaling:
  12920. @example
  12921. scale=2*iw:2*ih:interl=1
  12922. @end example
  12923. @item
  12924. Scale the input to half size:
  12925. @example
  12926. scale=w=iw/2:h=ih/2
  12927. @end example
  12928. @item
  12929. Increase the width, and set the height to the same size:
  12930. @example
  12931. scale=3/2*iw:ow
  12932. @end example
  12933. @item
  12934. Seek Greek harmony:
  12935. @example
  12936. scale=iw:1/PHI*iw
  12937. scale=ih*PHI:ih
  12938. @end example
  12939. @item
  12940. Increase the height, and set the width to 3/2 of the height:
  12941. @example
  12942. scale=w=3/2*oh:h=3/5*ih
  12943. @end example
  12944. @item
  12945. Increase the size, making the size a multiple of the chroma
  12946. subsample values:
  12947. @example
  12948. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12949. @end example
  12950. @item
  12951. Increase the width to a maximum of 500 pixels,
  12952. keeping the same aspect ratio as the input:
  12953. @example
  12954. scale=w='min(500\, iw*3/2):h=-1'
  12955. @end example
  12956. @item
  12957. Make pixels square by combining scale and setsar:
  12958. @example
  12959. scale='trunc(ih*dar):ih',setsar=1/1
  12960. @end example
  12961. @item
  12962. Make pixels square by combining scale and setsar,
  12963. making sure the resulting resolution is even (required by some codecs):
  12964. @example
  12965. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12966. @end example
  12967. @end itemize
  12968. @subsection Commands
  12969. This filter supports the following commands:
  12970. @table @option
  12971. @item width, w
  12972. @item height, h
  12973. Set the output video dimension expression.
  12974. The command accepts the same syntax of the corresponding option.
  12975. If the specified expression is not valid, it is kept at its current
  12976. value.
  12977. @end table
  12978. @section scale_npp
  12979. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12980. format conversion on CUDA video frames. Setting the output width and height
  12981. works in the same way as for the @var{scale} filter.
  12982. The following additional options are accepted:
  12983. @table @option
  12984. @item format
  12985. The pixel format of the output CUDA frames. If set to the string "same" (the
  12986. default), the input format will be kept. Note that automatic format negotiation
  12987. and conversion is not yet supported for hardware frames
  12988. @item interp_algo
  12989. The interpolation algorithm used for resizing. One of the following:
  12990. @table @option
  12991. @item nn
  12992. Nearest neighbour.
  12993. @item linear
  12994. @item cubic
  12995. @item cubic2p_bspline
  12996. 2-parameter cubic (B=1, C=0)
  12997. @item cubic2p_catmullrom
  12998. 2-parameter cubic (B=0, C=1/2)
  12999. @item cubic2p_b05c03
  13000. 2-parameter cubic (B=1/2, C=3/10)
  13001. @item super
  13002. Supersampling
  13003. @item lanczos
  13004. @end table
  13005. @item force_original_aspect_ratio
  13006. Enable decreasing or increasing output video width or height if necessary to
  13007. keep the original aspect ratio. Possible values:
  13008. @table @samp
  13009. @item disable
  13010. Scale the video as specified and disable this feature.
  13011. @item decrease
  13012. The output video dimensions will automatically be decreased if needed.
  13013. @item increase
  13014. The output video dimensions will automatically be increased if needed.
  13015. @end table
  13016. One useful instance of this option is that when you know a specific device's
  13017. maximum allowed resolution, you can use this to limit the output video to
  13018. that, while retaining the aspect ratio. For example, device A allows
  13019. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13020. decrease) and specifying 1280x720 to the command line makes the output
  13021. 1280x533.
  13022. Please note that this is a different thing than specifying -1 for @option{w}
  13023. or @option{h}, you still need to specify the output resolution for this option
  13024. to work.
  13025. @item force_divisible_by
  13026. Ensures that both the output dimensions, width and height, are divisible by the
  13027. given integer when used together with @option{force_original_aspect_ratio}. This
  13028. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13029. This option respects the value set for @option{force_original_aspect_ratio},
  13030. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13031. may be slightly modified.
  13032. This option can be handy if you need to have a video fit within or exceed
  13033. a defined resolution using @option{force_original_aspect_ratio} but also have
  13034. encoder restrictions on width or height divisibility.
  13035. @end table
  13036. @section scale2ref
  13037. Scale (resize) the input video, based on a reference video.
  13038. See the scale filter for available options, scale2ref supports the same but
  13039. uses the reference video instead of the main input as basis. scale2ref also
  13040. supports the following additional constants for the @option{w} and
  13041. @option{h} options:
  13042. @table @var
  13043. @item main_w
  13044. @item main_h
  13045. The main input video's width and height
  13046. @item main_a
  13047. The same as @var{main_w} / @var{main_h}
  13048. @item main_sar
  13049. The main input video's sample aspect ratio
  13050. @item main_dar, mdar
  13051. The main input video's display aspect ratio. Calculated from
  13052. @code{(main_w / main_h) * main_sar}.
  13053. @item main_hsub
  13054. @item main_vsub
  13055. The main input video's horizontal and vertical chroma subsample values.
  13056. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13057. is 1.
  13058. @item main_n
  13059. The (sequential) number of the main input frame, starting from 0.
  13060. Only available with @code{eval=frame}.
  13061. @item main_t
  13062. The presentation timestamp of the main input frame, expressed as a number of
  13063. seconds. Only available with @code{eval=frame}.
  13064. @item main_pos
  13065. The position (byte offset) of the frame in the main input stream, or NaN if
  13066. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13067. Only available with @code{eval=frame}.
  13068. @end table
  13069. @subsection Examples
  13070. @itemize
  13071. @item
  13072. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13073. @example
  13074. 'scale2ref[b][a];[a][b]overlay'
  13075. @end example
  13076. @item
  13077. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13078. @example
  13079. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13080. @end example
  13081. @end itemize
  13082. @subsection Commands
  13083. This filter supports the following commands:
  13084. @table @option
  13085. @item width, w
  13086. @item height, h
  13087. Set the output video dimension expression.
  13088. The command accepts the same syntax of the corresponding option.
  13089. If the specified expression is not valid, it is kept at its current
  13090. value.
  13091. @end table
  13092. @section scroll
  13093. Scroll input video horizontally and/or vertically by constant speed.
  13094. The filter accepts the following options:
  13095. @table @option
  13096. @item horizontal, h
  13097. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13098. Negative values changes scrolling direction.
  13099. @item vertical, v
  13100. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13101. Negative values changes scrolling direction.
  13102. @item hpos
  13103. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13104. @item vpos
  13105. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13106. @end table
  13107. @subsection Commands
  13108. This filter supports the following @ref{commands}:
  13109. @table @option
  13110. @item horizontal, h
  13111. Set the horizontal scrolling speed.
  13112. @item vertical, v
  13113. Set the vertical scrolling speed.
  13114. @end table
  13115. @anchor{scdet}
  13116. @section scdet
  13117. Detect video scene change.
  13118. This filter sets frame metadata with mafd between frame, the scene score, and
  13119. forward the frame to the next filter, so they can use these metadata to detect
  13120. scene change or others.
  13121. In addition, this filter logs a message and sets frame metadata when it detects
  13122. a scene change by @option{threshold}.
  13123. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13124. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13125. to detect scene change.
  13126. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13127. detect scene change with @option{threshold}.
  13128. The filter accepts the following options:
  13129. @table @option
  13130. @item threshold, t
  13131. Set the scene change detection threshold as a percentage of maximum change. Good
  13132. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13133. @code{[0., 100.]}.
  13134. Default value is @code{10.}.
  13135. @item sc_pass, s
  13136. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13137. You can enable it if you want to get snapshot of scene change frames only.
  13138. @end table
  13139. @anchor{selectivecolor}
  13140. @section selectivecolor
  13141. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13142. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13143. by the "purity" of the color (that is, how saturated it already is).
  13144. This filter is similar to the Adobe Photoshop Selective Color tool.
  13145. The filter accepts the following options:
  13146. @table @option
  13147. @item correction_method
  13148. Select color correction method.
  13149. Available values are:
  13150. @table @samp
  13151. @item absolute
  13152. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13153. component value).
  13154. @item relative
  13155. Specified adjustments are relative to the original component value.
  13156. @end table
  13157. Default is @code{absolute}.
  13158. @item reds
  13159. Adjustments for red pixels (pixels where the red component is the maximum)
  13160. @item yellows
  13161. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13162. @item greens
  13163. Adjustments for green pixels (pixels where the green component is the maximum)
  13164. @item cyans
  13165. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13166. @item blues
  13167. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13168. @item magentas
  13169. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13170. @item whites
  13171. Adjustments for white pixels (pixels where all components are greater than 128)
  13172. @item neutrals
  13173. Adjustments for all pixels except pure black and pure white
  13174. @item blacks
  13175. Adjustments for black pixels (pixels where all components are lesser than 128)
  13176. @item psfile
  13177. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13178. @end table
  13179. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13180. 4 space separated floating point adjustment values in the [-1,1] range,
  13181. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13182. pixels of its range.
  13183. @subsection Examples
  13184. @itemize
  13185. @item
  13186. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13187. increase magenta by 27% in blue areas:
  13188. @example
  13189. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13190. @end example
  13191. @item
  13192. Use a Photoshop selective color preset:
  13193. @example
  13194. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13195. @end example
  13196. @end itemize
  13197. @anchor{separatefields}
  13198. @section separatefields
  13199. The @code{separatefields} takes a frame-based video input and splits
  13200. each frame into its components fields, producing a new half height clip
  13201. with twice the frame rate and twice the frame count.
  13202. This filter use field-dominance information in frame to decide which
  13203. of each pair of fields to place first in the output.
  13204. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13205. @section setdar, setsar
  13206. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13207. output video.
  13208. This is done by changing the specified Sample (aka Pixel) Aspect
  13209. Ratio, according to the following equation:
  13210. @example
  13211. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13212. @end example
  13213. Keep in mind that the @code{setdar} filter does not modify the pixel
  13214. dimensions of the video frame. Also, the display aspect ratio set by
  13215. this filter may be changed by later filters in the filterchain,
  13216. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13217. applied.
  13218. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13219. the filter output video.
  13220. Note that as a consequence of the application of this filter, the
  13221. output display aspect ratio will change according to the equation
  13222. above.
  13223. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13224. filter may be changed by later filters in the filterchain, e.g. if
  13225. another "setsar" or a "setdar" filter is applied.
  13226. It accepts the following parameters:
  13227. @table @option
  13228. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13229. Set the aspect ratio used by the filter.
  13230. The parameter can be a floating point number string, an expression, or
  13231. a string of the form @var{num}:@var{den}, where @var{num} and
  13232. @var{den} are the numerator and denominator of the aspect ratio. If
  13233. the parameter is not specified, it is assumed the value "0".
  13234. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13235. should be escaped.
  13236. @item max
  13237. Set the maximum integer value to use for expressing numerator and
  13238. denominator when reducing the expressed aspect ratio to a rational.
  13239. Default value is @code{100}.
  13240. @end table
  13241. The parameter @var{sar} is an expression containing
  13242. the following constants:
  13243. @table @option
  13244. @item E, PI, PHI
  13245. These are approximated values for the mathematical constants e
  13246. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13247. @item w, h
  13248. The input width and height.
  13249. @item a
  13250. These are the same as @var{w} / @var{h}.
  13251. @item sar
  13252. The input sample aspect ratio.
  13253. @item dar
  13254. The input display aspect ratio. It is the same as
  13255. (@var{w} / @var{h}) * @var{sar}.
  13256. @item hsub, vsub
  13257. Horizontal and vertical chroma subsample values. For example, for the
  13258. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13259. @end table
  13260. @subsection Examples
  13261. @itemize
  13262. @item
  13263. To change the display aspect ratio to 16:9, specify one of the following:
  13264. @example
  13265. setdar=dar=1.77777
  13266. setdar=dar=16/9
  13267. @end example
  13268. @item
  13269. To change the sample aspect ratio to 10:11, specify:
  13270. @example
  13271. setsar=sar=10/11
  13272. @end example
  13273. @item
  13274. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13275. 1000 in the aspect ratio reduction, use the command:
  13276. @example
  13277. setdar=ratio=16/9:max=1000
  13278. @end example
  13279. @end itemize
  13280. @anchor{setfield}
  13281. @section setfield
  13282. Force field for the output video frame.
  13283. The @code{setfield} filter marks the interlace type field for the
  13284. output frames. It does not change the input frame, but only sets the
  13285. corresponding property, which affects how the frame is treated by
  13286. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13287. The filter accepts the following options:
  13288. @table @option
  13289. @item mode
  13290. Available values are:
  13291. @table @samp
  13292. @item auto
  13293. Keep the same field property.
  13294. @item bff
  13295. Mark the frame as bottom-field-first.
  13296. @item tff
  13297. Mark the frame as top-field-first.
  13298. @item prog
  13299. Mark the frame as progressive.
  13300. @end table
  13301. @end table
  13302. @anchor{setparams}
  13303. @section setparams
  13304. Force frame parameter for the output video frame.
  13305. The @code{setparams} filter marks interlace and color range for the
  13306. output frames. It does not change the input frame, but only sets the
  13307. corresponding property, which affects how the frame is treated by
  13308. filters/encoders.
  13309. @table @option
  13310. @item field_mode
  13311. Available values are:
  13312. @table @samp
  13313. @item auto
  13314. Keep the same field property (default).
  13315. @item bff
  13316. Mark the frame as bottom-field-first.
  13317. @item tff
  13318. Mark the frame as top-field-first.
  13319. @item prog
  13320. Mark the frame as progressive.
  13321. @end table
  13322. @item range
  13323. Available values are:
  13324. @table @samp
  13325. @item auto
  13326. Keep the same color range property (default).
  13327. @item unspecified, unknown
  13328. Mark the frame as unspecified color range.
  13329. @item limited, tv, mpeg
  13330. Mark the frame as limited range.
  13331. @item full, pc, jpeg
  13332. Mark the frame as full range.
  13333. @end table
  13334. @item color_primaries
  13335. Set the color primaries.
  13336. Available values are:
  13337. @table @samp
  13338. @item auto
  13339. Keep the same color primaries property (default).
  13340. @item bt709
  13341. @item unknown
  13342. @item bt470m
  13343. @item bt470bg
  13344. @item smpte170m
  13345. @item smpte240m
  13346. @item film
  13347. @item bt2020
  13348. @item smpte428
  13349. @item smpte431
  13350. @item smpte432
  13351. @item jedec-p22
  13352. @end table
  13353. @item color_trc
  13354. Set the color transfer.
  13355. Available values are:
  13356. @table @samp
  13357. @item auto
  13358. Keep the same color trc property (default).
  13359. @item bt709
  13360. @item unknown
  13361. @item bt470m
  13362. @item bt470bg
  13363. @item smpte170m
  13364. @item smpte240m
  13365. @item linear
  13366. @item log100
  13367. @item log316
  13368. @item iec61966-2-4
  13369. @item bt1361e
  13370. @item iec61966-2-1
  13371. @item bt2020-10
  13372. @item bt2020-12
  13373. @item smpte2084
  13374. @item smpte428
  13375. @item arib-std-b67
  13376. @end table
  13377. @item colorspace
  13378. Set the colorspace.
  13379. Available values are:
  13380. @table @samp
  13381. @item auto
  13382. Keep the same colorspace property (default).
  13383. @item gbr
  13384. @item bt709
  13385. @item unknown
  13386. @item fcc
  13387. @item bt470bg
  13388. @item smpte170m
  13389. @item smpte240m
  13390. @item ycgco
  13391. @item bt2020nc
  13392. @item bt2020c
  13393. @item smpte2085
  13394. @item chroma-derived-nc
  13395. @item chroma-derived-c
  13396. @item ictcp
  13397. @end table
  13398. @end table
  13399. @section showinfo
  13400. Show a line containing various information for each input video frame.
  13401. The input video is not modified.
  13402. This filter supports the following options:
  13403. @table @option
  13404. @item checksum
  13405. Calculate checksums of each plane. By default enabled.
  13406. @end table
  13407. The shown line contains a sequence of key/value pairs of the form
  13408. @var{key}:@var{value}.
  13409. The following values are shown in the output:
  13410. @table @option
  13411. @item n
  13412. The (sequential) number of the input frame, starting from 0.
  13413. @item pts
  13414. The Presentation TimeStamp of the input frame, expressed as a number of
  13415. time base units. The time base unit depends on the filter input pad.
  13416. @item pts_time
  13417. The Presentation TimeStamp of the input frame, expressed as a number of
  13418. seconds.
  13419. @item pos
  13420. The position of the frame in the input stream, or -1 if this information is
  13421. unavailable and/or meaningless (for example in case of synthetic video).
  13422. @item fmt
  13423. The pixel format name.
  13424. @item sar
  13425. The sample aspect ratio of the input frame, expressed in the form
  13426. @var{num}/@var{den}.
  13427. @item s
  13428. The size of the input frame. For the syntax of this option, check the
  13429. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13430. @item i
  13431. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13432. for bottom field first).
  13433. @item iskey
  13434. This is 1 if the frame is a key frame, 0 otherwise.
  13435. @item type
  13436. The picture type of the input frame ("I" for an I-frame, "P" for a
  13437. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13438. Also refer to the documentation of the @code{AVPictureType} enum and of
  13439. the @code{av_get_picture_type_char} function defined in
  13440. @file{libavutil/avutil.h}.
  13441. @item checksum
  13442. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13443. @item plane_checksum
  13444. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13445. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13446. @item mean
  13447. The mean value of pixels in each plane of the input frame, expressed in the form
  13448. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13449. @item stdev
  13450. The standard deviation of pixel values in each plane of the input frame, expressed
  13451. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13452. @end table
  13453. @section showpalette
  13454. Displays the 256 colors palette of each frame. This filter is only relevant for
  13455. @var{pal8} pixel format frames.
  13456. It accepts the following option:
  13457. @table @option
  13458. @item s
  13459. Set the size of the box used to represent one palette color entry. Default is
  13460. @code{30} (for a @code{30x30} pixel box).
  13461. @end table
  13462. @section shuffleframes
  13463. Reorder and/or duplicate and/or drop video frames.
  13464. It accepts the following parameters:
  13465. @table @option
  13466. @item mapping
  13467. Set the destination indexes of input frames.
  13468. This is space or '|' separated list of indexes that maps input frames to output
  13469. frames. Number of indexes also sets maximal value that each index may have.
  13470. '-1' index have special meaning and that is to drop frame.
  13471. @end table
  13472. The first frame has the index 0. The default is to keep the input unchanged.
  13473. @subsection Examples
  13474. @itemize
  13475. @item
  13476. Swap second and third frame of every three frames of the input:
  13477. @example
  13478. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13479. @end example
  13480. @item
  13481. Swap 10th and 1st frame of every ten frames of the input:
  13482. @example
  13483. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13484. @end example
  13485. @end itemize
  13486. @section shuffleplanes
  13487. Reorder and/or duplicate video planes.
  13488. It accepts the following parameters:
  13489. @table @option
  13490. @item map0
  13491. The index of the input plane to be used as the first output plane.
  13492. @item map1
  13493. The index of the input plane to be used as the second output plane.
  13494. @item map2
  13495. The index of the input plane to be used as the third output plane.
  13496. @item map3
  13497. The index of the input plane to be used as the fourth output plane.
  13498. @end table
  13499. The first plane has the index 0. The default is to keep the input unchanged.
  13500. @subsection Examples
  13501. @itemize
  13502. @item
  13503. Swap the second and third planes of the input:
  13504. @example
  13505. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13506. @end example
  13507. @end itemize
  13508. @anchor{signalstats}
  13509. @section signalstats
  13510. Evaluate various visual metrics that assist in determining issues associated
  13511. with the digitization of analog video media.
  13512. By default the filter will log these metadata values:
  13513. @table @option
  13514. @item YMIN
  13515. Display the minimal Y value contained within the input frame. Expressed in
  13516. range of [0-255].
  13517. @item YLOW
  13518. Display the Y value at the 10% percentile within the input frame. Expressed in
  13519. range of [0-255].
  13520. @item YAVG
  13521. Display the average Y value within the input frame. Expressed in range of
  13522. [0-255].
  13523. @item YHIGH
  13524. Display the Y value at the 90% percentile within the input frame. Expressed in
  13525. range of [0-255].
  13526. @item YMAX
  13527. Display the maximum Y value contained within the input frame. Expressed in
  13528. range of [0-255].
  13529. @item UMIN
  13530. Display the minimal U value contained within the input frame. Expressed in
  13531. range of [0-255].
  13532. @item ULOW
  13533. Display the U value at the 10% percentile within the input frame. Expressed in
  13534. range of [0-255].
  13535. @item UAVG
  13536. Display the average U value within the input frame. Expressed in range of
  13537. [0-255].
  13538. @item UHIGH
  13539. Display the U value at the 90% percentile within the input frame. Expressed in
  13540. range of [0-255].
  13541. @item UMAX
  13542. Display the maximum U value contained within the input frame. Expressed in
  13543. range of [0-255].
  13544. @item VMIN
  13545. Display the minimal V value contained within the input frame. Expressed in
  13546. range of [0-255].
  13547. @item VLOW
  13548. Display the V value at the 10% percentile within the input frame. Expressed in
  13549. range of [0-255].
  13550. @item VAVG
  13551. Display the average V value within the input frame. Expressed in range of
  13552. [0-255].
  13553. @item VHIGH
  13554. Display the V value at the 90% percentile within the input frame. Expressed in
  13555. range of [0-255].
  13556. @item VMAX
  13557. Display the maximum V value contained within the input frame. Expressed in
  13558. range of [0-255].
  13559. @item SATMIN
  13560. Display the minimal saturation value contained within the input frame.
  13561. Expressed in range of [0-~181.02].
  13562. @item SATLOW
  13563. Display the saturation value at the 10% percentile within the input frame.
  13564. Expressed in range of [0-~181.02].
  13565. @item SATAVG
  13566. Display the average saturation value within the input frame. Expressed in range
  13567. of [0-~181.02].
  13568. @item SATHIGH
  13569. Display the saturation value at the 90% percentile within the input frame.
  13570. Expressed in range of [0-~181.02].
  13571. @item SATMAX
  13572. Display the maximum saturation value contained within the input frame.
  13573. Expressed in range of [0-~181.02].
  13574. @item HUEMED
  13575. Display the median value for hue within the input frame. Expressed in range of
  13576. [0-360].
  13577. @item HUEAVG
  13578. Display the average value for hue within the input frame. Expressed in range of
  13579. [0-360].
  13580. @item YDIF
  13581. Display the average of sample value difference between all values of the Y
  13582. plane in the current frame and corresponding values of the previous input frame.
  13583. Expressed in range of [0-255].
  13584. @item UDIF
  13585. Display the average of sample value difference between all values of the U
  13586. plane in the current frame and corresponding values of the previous input frame.
  13587. Expressed in range of [0-255].
  13588. @item VDIF
  13589. Display the average of sample value difference between all values of the V
  13590. plane in the current frame and corresponding values of the previous input frame.
  13591. Expressed in range of [0-255].
  13592. @item YBITDEPTH
  13593. Display bit depth of Y plane in current frame.
  13594. Expressed in range of [0-16].
  13595. @item UBITDEPTH
  13596. Display bit depth of U plane in current frame.
  13597. Expressed in range of [0-16].
  13598. @item VBITDEPTH
  13599. Display bit depth of V plane in current frame.
  13600. Expressed in range of [0-16].
  13601. @end table
  13602. The filter accepts the following options:
  13603. @table @option
  13604. @item stat
  13605. @item out
  13606. @option{stat} specify an additional form of image analysis.
  13607. @option{out} output video with the specified type of pixel highlighted.
  13608. Both options accept the following values:
  13609. @table @samp
  13610. @item tout
  13611. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13612. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13613. include the results of video dropouts, head clogs, or tape tracking issues.
  13614. @item vrep
  13615. Identify @var{vertical line repetition}. Vertical line repetition includes
  13616. similar rows of pixels within a frame. In born-digital video vertical line
  13617. repetition is common, but this pattern is uncommon in video digitized from an
  13618. analog source. When it occurs in video that results from the digitization of an
  13619. analog source it can indicate concealment from a dropout compensator.
  13620. @item brng
  13621. Identify pixels that fall outside of legal broadcast range.
  13622. @end table
  13623. @item color, c
  13624. Set the highlight color for the @option{out} option. The default color is
  13625. yellow.
  13626. @end table
  13627. @subsection Examples
  13628. @itemize
  13629. @item
  13630. Output data of various video metrics:
  13631. @example
  13632. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13633. @end example
  13634. @item
  13635. Output specific data about the minimum and maximum values of the Y plane per frame:
  13636. @example
  13637. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13638. @end example
  13639. @item
  13640. Playback video while highlighting pixels that are outside of broadcast range in red.
  13641. @example
  13642. ffplay example.mov -vf signalstats="out=brng:color=red"
  13643. @end example
  13644. @item
  13645. Playback video with signalstats metadata drawn over the frame.
  13646. @example
  13647. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13648. @end example
  13649. The contents of signalstat_drawtext.txt used in the command are:
  13650. @example
  13651. time %@{pts:hms@}
  13652. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13653. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13654. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13655. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13656. @end example
  13657. @end itemize
  13658. @anchor{signature}
  13659. @section signature
  13660. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13661. input. In this case the matching between the inputs can be calculated additionally.
  13662. The filter always passes through the first input. The signature of each stream can
  13663. be written into a file.
  13664. It accepts the following options:
  13665. @table @option
  13666. @item detectmode
  13667. Enable or disable the matching process.
  13668. Available values are:
  13669. @table @samp
  13670. @item off
  13671. Disable the calculation of a matching (default).
  13672. @item full
  13673. Calculate the matching for the whole video and output whether the whole video
  13674. matches or only parts.
  13675. @item fast
  13676. Calculate only until a matching is found or the video ends. Should be faster in
  13677. some cases.
  13678. @end table
  13679. @item nb_inputs
  13680. Set the number of inputs. The option value must be a non negative integer.
  13681. Default value is 1.
  13682. @item filename
  13683. Set the path to which the output is written. If there is more than one input,
  13684. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13685. integer), that will be replaced with the input number. If no filename is
  13686. specified, no output will be written. This is the default.
  13687. @item format
  13688. Choose the output format.
  13689. Available values are:
  13690. @table @samp
  13691. @item binary
  13692. Use the specified binary representation (default).
  13693. @item xml
  13694. Use the specified xml representation.
  13695. @end table
  13696. @item th_d
  13697. Set threshold to detect one word as similar. The option value must be an integer
  13698. greater than zero. The default value is 9000.
  13699. @item th_dc
  13700. Set threshold to detect all words as similar. The option value must be an integer
  13701. greater than zero. The default value is 60000.
  13702. @item th_xh
  13703. Set threshold to detect frames as similar. The option value must be an integer
  13704. greater than zero. The default value is 116.
  13705. @item th_di
  13706. Set the minimum length of a sequence in frames to recognize it as matching
  13707. sequence. The option value must be a non negative integer value.
  13708. The default value is 0.
  13709. @item th_it
  13710. Set the minimum relation, that matching frames to all frames must have.
  13711. The option value must be a double value between 0 and 1. The default value is 0.5.
  13712. @end table
  13713. @subsection Examples
  13714. @itemize
  13715. @item
  13716. To calculate the signature of an input video and store it in signature.bin:
  13717. @example
  13718. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13719. @end example
  13720. @item
  13721. To detect whether two videos match and store the signatures in XML format in
  13722. signature0.xml and signature1.xml:
  13723. @example
  13724. 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 -
  13725. @end example
  13726. @end itemize
  13727. @anchor{smartblur}
  13728. @section smartblur
  13729. Blur the input video without impacting the outlines.
  13730. It accepts the following options:
  13731. @table @option
  13732. @item luma_radius, lr
  13733. Set the luma radius. The option value must be a float number in
  13734. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13735. used to blur the image (slower if larger). Default value is 1.0.
  13736. @item luma_strength, ls
  13737. Set the luma strength. The option value must be a float number
  13738. in the range [-1.0,1.0] that configures the blurring. A value included
  13739. in [0.0,1.0] will blur the image whereas a value included in
  13740. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13741. @item luma_threshold, lt
  13742. Set the luma threshold used as a coefficient to determine
  13743. whether a pixel should be blurred or not. The option value must be an
  13744. integer in the range [-30,30]. A value of 0 will filter all the image,
  13745. a value included in [0,30] will filter flat areas and a value included
  13746. in [-30,0] will filter edges. Default value is 0.
  13747. @item chroma_radius, cr
  13748. Set the chroma radius. The option value must be a float number in
  13749. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13750. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13751. @item chroma_strength, cs
  13752. Set the chroma strength. The option value must be a float number
  13753. in the range [-1.0,1.0] that configures the blurring. A value included
  13754. in [0.0,1.0] will blur the image whereas a value included in
  13755. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13756. @item chroma_threshold, ct
  13757. Set the chroma threshold used as a coefficient to determine
  13758. whether a pixel should be blurred or not. The option value must be an
  13759. integer in the range [-30,30]. A value of 0 will filter all the image,
  13760. a value included in [0,30] will filter flat areas and a value included
  13761. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13762. @end table
  13763. If a chroma option is not explicitly set, the corresponding luma value
  13764. is set.
  13765. @section sobel
  13766. Apply sobel operator to input video stream.
  13767. The filter accepts the following option:
  13768. @table @option
  13769. @item planes
  13770. Set which planes will be processed, unprocessed planes will be copied.
  13771. By default value 0xf, all planes will be processed.
  13772. @item scale
  13773. Set value which will be multiplied with filtered result.
  13774. @item delta
  13775. Set value which will be added to filtered result.
  13776. @end table
  13777. @anchor{spp}
  13778. @section spp
  13779. Apply a simple postprocessing filter that compresses and decompresses the image
  13780. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13781. and average the results.
  13782. The filter accepts the following options:
  13783. @table @option
  13784. @item quality
  13785. Set quality. This option defines the number of levels for averaging. It accepts
  13786. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13787. effect. A value of @code{6} means the higher quality. For each increment of
  13788. that value the speed drops by a factor of approximately 2. Default value is
  13789. @code{3}.
  13790. @item qp
  13791. Force a constant quantization parameter. If not set, the filter will use the QP
  13792. from the video stream (if available).
  13793. @item mode
  13794. Set thresholding mode. Available modes are:
  13795. @table @samp
  13796. @item hard
  13797. Set hard thresholding (default).
  13798. @item soft
  13799. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13800. @end table
  13801. @item use_bframe_qp
  13802. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13803. option may cause flicker since the B-Frames have often larger QP. Default is
  13804. @code{0} (not enabled).
  13805. @end table
  13806. @subsection Commands
  13807. This filter supports the following commands:
  13808. @table @option
  13809. @item quality, level
  13810. Set quality level. The value @code{max} can be used to set the maximum level,
  13811. currently @code{6}.
  13812. @end table
  13813. @anchor{sr}
  13814. @section sr
  13815. Scale the input by applying one of the super-resolution methods based on
  13816. convolutional neural networks. Supported models:
  13817. @itemize
  13818. @item
  13819. Super-Resolution Convolutional Neural Network model (SRCNN).
  13820. See @url{https://arxiv.org/abs/1501.00092}.
  13821. @item
  13822. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13823. See @url{https://arxiv.org/abs/1609.05158}.
  13824. @end itemize
  13825. Training scripts as well as scripts for model file (.pb) saving can be found at
  13826. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13827. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13828. Native model files (.model) can be generated from TensorFlow model
  13829. files (.pb) by using tools/python/convert.py
  13830. The filter accepts the following options:
  13831. @table @option
  13832. @item dnn_backend
  13833. Specify which DNN backend to use for model loading and execution. This option accepts
  13834. the following values:
  13835. @table @samp
  13836. @item native
  13837. Native implementation of DNN loading and execution.
  13838. @item tensorflow
  13839. TensorFlow backend. To enable this backend you
  13840. need to install the TensorFlow for C library (see
  13841. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13842. @code{--enable-libtensorflow}
  13843. @end table
  13844. Default value is @samp{native}.
  13845. @item model
  13846. Set path to model file specifying network architecture and its parameters.
  13847. Note that different backends use different file formats. TensorFlow backend
  13848. can load files for both formats, while native backend can load files for only
  13849. its format.
  13850. @item scale_factor
  13851. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13852. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13853. input upscaled using bicubic upscaling with proper scale factor.
  13854. @end table
  13855. This feature can also be finished with @ref{dnn_processing} filter.
  13856. @section ssim
  13857. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13858. This filter takes in input two input videos, the first input is
  13859. considered the "main" source and is passed unchanged to the
  13860. output. The second input is used as a "reference" video for computing
  13861. the SSIM.
  13862. Both video inputs must have the same resolution and pixel format for
  13863. this filter to work correctly. Also it assumes that both inputs
  13864. have the same number of frames, which are compared one by one.
  13865. The filter stores the calculated SSIM of each frame.
  13866. The description of the accepted parameters follows.
  13867. @table @option
  13868. @item stats_file, f
  13869. If specified the filter will use the named file to save the SSIM of
  13870. each individual frame. When filename equals "-" the data is sent to
  13871. standard output.
  13872. @end table
  13873. The file printed if @var{stats_file} is selected, contains a sequence of
  13874. key/value pairs of the form @var{key}:@var{value} for each compared
  13875. couple of frames.
  13876. A description of each shown parameter follows:
  13877. @table @option
  13878. @item n
  13879. sequential number of the input frame, starting from 1
  13880. @item Y, U, V, R, G, B
  13881. SSIM of the compared frames for the component specified by the suffix.
  13882. @item All
  13883. SSIM of the compared frames for the whole frame.
  13884. @item dB
  13885. Same as above but in dB representation.
  13886. @end table
  13887. This filter also supports the @ref{framesync} options.
  13888. @subsection Examples
  13889. @itemize
  13890. @item
  13891. For example:
  13892. @example
  13893. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13894. [main][ref] ssim="stats_file=stats.log" [out]
  13895. @end example
  13896. On this example the input file being processed is compared with the
  13897. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13898. is stored in @file{stats.log}.
  13899. @item
  13900. Another example with both psnr and ssim at same time:
  13901. @example
  13902. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13903. @end example
  13904. @item
  13905. Another example with different containers:
  13906. @example
  13907. 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 -
  13908. @end example
  13909. @end itemize
  13910. @section stereo3d
  13911. Convert between different stereoscopic image formats.
  13912. The filters accept the following options:
  13913. @table @option
  13914. @item in
  13915. Set stereoscopic image format of input.
  13916. Available values for input image formats are:
  13917. @table @samp
  13918. @item sbsl
  13919. side by side parallel (left eye left, right eye right)
  13920. @item sbsr
  13921. side by side crosseye (right eye left, left eye right)
  13922. @item sbs2l
  13923. side by side parallel with half width resolution
  13924. (left eye left, right eye right)
  13925. @item sbs2r
  13926. side by side crosseye with half width resolution
  13927. (right eye left, left eye right)
  13928. @item abl
  13929. @item tbl
  13930. above-below (left eye above, right eye below)
  13931. @item abr
  13932. @item tbr
  13933. above-below (right eye above, left eye below)
  13934. @item ab2l
  13935. @item tb2l
  13936. above-below with half height resolution
  13937. (left eye above, right eye below)
  13938. @item ab2r
  13939. @item tb2r
  13940. above-below with half height resolution
  13941. (right eye above, left eye below)
  13942. @item al
  13943. alternating frames (left eye first, right eye second)
  13944. @item ar
  13945. alternating frames (right eye first, left eye second)
  13946. @item irl
  13947. interleaved rows (left eye has top row, right eye starts on next row)
  13948. @item irr
  13949. interleaved rows (right eye has top row, left eye starts on next row)
  13950. @item icl
  13951. interleaved columns, left eye first
  13952. @item icr
  13953. interleaved columns, right eye first
  13954. Default value is @samp{sbsl}.
  13955. @end table
  13956. @item out
  13957. Set stereoscopic image format of output.
  13958. @table @samp
  13959. @item sbsl
  13960. side by side parallel (left eye left, right eye right)
  13961. @item sbsr
  13962. side by side crosseye (right eye left, left eye right)
  13963. @item sbs2l
  13964. side by side parallel with half width resolution
  13965. (left eye left, right eye right)
  13966. @item sbs2r
  13967. side by side crosseye with half width resolution
  13968. (right eye left, left eye right)
  13969. @item abl
  13970. @item tbl
  13971. above-below (left eye above, right eye below)
  13972. @item abr
  13973. @item tbr
  13974. above-below (right eye above, left eye below)
  13975. @item ab2l
  13976. @item tb2l
  13977. above-below with half height resolution
  13978. (left eye above, right eye below)
  13979. @item ab2r
  13980. @item tb2r
  13981. above-below with half height resolution
  13982. (right eye above, left eye below)
  13983. @item al
  13984. alternating frames (left eye first, right eye second)
  13985. @item ar
  13986. alternating frames (right eye first, left eye second)
  13987. @item irl
  13988. interleaved rows (left eye has top row, right eye starts on next row)
  13989. @item irr
  13990. interleaved rows (right eye has top row, left eye starts on next row)
  13991. @item arbg
  13992. anaglyph red/blue gray
  13993. (red filter on left eye, blue filter on right eye)
  13994. @item argg
  13995. anaglyph red/green gray
  13996. (red filter on left eye, green filter on right eye)
  13997. @item arcg
  13998. anaglyph red/cyan gray
  13999. (red filter on left eye, cyan filter on right eye)
  14000. @item arch
  14001. anaglyph red/cyan half colored
  14002. (red filter on left eye, cyan filter on right eye)
  14003. @item arcc
  14004. anaglyph red/cyan color
  14005. (red filter on left eye, cyan filter on right eye)
  14006. @item arcd
  14007. anaglyph red/cyan color optimized with the least squares projection of dubois
  14008. (red filter on left eye, cyan filter on right eye)
  14009. @item agmg
  14010. anaglyph green/magenta gray
  14011. (green filter on left eye, magenta filter on right eye)
  14012. @item agmh
  14013. anaglyph green/magenta half colored
  14014. (green filter on left eye, magenta filter on right eye)
  14015. @item agmc
  14016. anaglyph green/magenta colored
  14017. (green filter on left eye, magenta filter on right eye)
  14018. @item agmd
  14019. anaglyph green/magenta color optimized with the least squares projection of dubois
  14020. (green filter on left eye, magenta filter on right eye)
  14021. @item aybg
  14022. anaglyph yellow/blue gray
  14023. (yellow filter on left eye, blue filter on right eye)
  14024. @item aybh
  14025. anaglyph yellow/blue half colored
  14026. (yellow filter on left eye, blue filter on right eye)
  14027. @item aybc
  14028. anaglyph yellow/blue colored
  14029. (yellow filter on left eye, blue filter on right eye)
  14030. @item aybd
  14031. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14032. (yellow filter on left eye, blue filter on right eye)
  14033. @item ml
  14034. mono output (left eye only)
  14035. @item mr
  14036. mono output (right eye only)
  14037. @item chl
  14038. checkerboard, left eye first
  14039. @item chr
  14040. checkerboard, right eye first
  14041. @item icl
  14042. interleaved columns, left eye first
  14043. @item icr
  14044. interleaved columns, right eye first
  14045. @item hdmi
  14046. HDMI frame pack
  14047. @end table
  14048. Default value is @samp{arcd}.
  14049. @end table
  14050. @subsection Examples
  14051. @itemize
  14052. @item
  14053. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14054. @example
  14055. stereo3d=sbsl:aybd
  14056. @end example
  14057. @item
  14058. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14059. @example
  14060. stereo3d=abl:sbsr
  14061. @end example
  14062. @end itemize
  14063. @section streamselect, astreamselect
  14064. Select video or audio streams.
  14065. The filter accepts the following options:
  14066. @table @option
  14067. @item inputs
  14068. Set number of inputs. Default is 2.
  14069. @item map
  14070. Set input indexes to remap to outputs.
  14071. @end table
  14072. @subsection Commands
  14073. The @code{streamselect} and @code{astreamselect} filter supports the following
  14074. commands:
  14075. @table @option
  14076. @item map
  14077. Set input indexes to remap to outputs.
  14078. @end table
  14079. @subsection Examples
  14080. @itemize
  14081. @item
  14082. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14083. @example
  14084. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14085. @end example
  14086. @item
  14087. Same as above, but for audio:
  14088. @example
  14089. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14090. @end example
  14091. @end itemize
  14092. @anchor{subtitles}
  14093. @section subtitles
  14094. Draw subtitles on top of input video using the libass library.
  14095. To enable compilation of this filter you need to configure FFmpeg with
  14096. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14097. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14098. Alpha) subtitles format.
  14099. The filter accepts the following options:
  14100. @table @option
  14101. @item filename, f
  14102. Set the filename of the subtitle file to read. It must be specified.
  14103. @item original_size
  14104. Specify the size of the original video, the video for which the ASS file
  14105. was composed. For the syntax of this option, check the
  14106. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14107. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14108. correctly scale the fonts if the aspect ratio has been changed.
  14109. @item fontsdir
  14110. Set a directory path containing fonts that can be used by the filter.
  14111. These fonts will be used in addition to whatever the font provider uses.
  14112. @item alpha
  14113. Process alpha channel, by default alpha channel is untouched.
  14114. @item charenc
  14115. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14116. useful if not UTF-8.
  14117. @item stream_index, si
  14118. Set subtitles stream index. @code{subtitles} filter only.
  14119. @item force_style
  14120. Override default style or script info parameters of the subtitles. It accepts a
  14121. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14122. @end table
  14123. If the first key is not specified, it is assumed that the first value
  14124. specifies the @option{filename}.
  14125. For example, to render the file @file{sub.srt} on top of the input
  14126. video, use the command:
  14127. @example
  14128. subtitles=sub.srt
  14129. @end example
  14130. which is equivalent to:
  14131. @example
  14132. subtitles=filename=sub.srt
  14133. @end example
  14134. To render the default subtitles stream from file @file{video.mkv}, use:
  14135. @example
  14136. subtitles=video.mkv
  14137. @end example
  14138. To render the second subtitles stream from that file, use:
  14139. @example
  14140. subtitles=video.mkv:si=1
  14141. @end example
  14142. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14143. @code{DejaVu Serif}, use:
  14144. @example
  14145. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14146. @end example
  14147. @section super2xsai
  14148. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14149. Interpolate) pixel art scaling algorithm.
  14150. Useful for enlarging pixel art images without reducing sharpness.
  14151. @section swaprect
  14152. Swap two rectangular objects in video.
  14153. This filter accepts the following options:
  14154. @table @option
  14155. @item w
  14156. Set object width.
  14157. @item h
  14158. Set object height.
  14159. @item x1
  14160. Set 1st rect x coordinate.
  14161. @item y1
  14162. Set 1st rect y coordinate.
  14163. @item x2
  14164. Set 2nd rect x coordinate.
  14165. @item y2
  14166. Set 2nd rect y coordinate.
  14167. All expressions are evaluated once for each frame.
  14168. @end table
  14169. The all options are expressions containing the following constants:
  14170. @table @option
  14171. @item w
  14172. @item h
  14173. The input width and height.
  14174. @item a
  14175. same as @var{w} / @var{h}
  14176. @item sar
  14177. input sample aspect ratio
  14178. @item dar
  14179. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14180. @item n
  14181. The number of the input frame, starting from 0.
  14182. @item t
  14183. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14184. @item pos
  14185. the position in the file of the input frame, NAN if unknown
  14186. @end table
  14187. @section swapuv
  14188. Swap U & V plane.
  14189. @section tblend
  14190. Blend successive video frames.
  14191. See @ref{blend}
  14192. @section telecine
  14193. Apply telecine process to the video.
  14194. This filter accepts the following options:
  14195. @table @option
  14196. @item first_field
  14197. @table @samp
  14198. @item top, t
  14199. top field first
  14200. @item bottom, b
  14201. bottom field first
  14202. The default value is @code{top}.
  14203. @end table
  14204. @item pattern
  14205. A string of numbers representing the pulldown pattern you wish to apply.
  14206. The default value is @code{23}.
  14207. @end table
  14208. @example
  14209. Some typical patterns:
  14210. NTSC output (30i):
  14211. 27.5p: 32222
  14212. 24p: 23 (classic)
  14213. 24p: 2332 (preferred)
  14214. 20p: 33
  14215. 18p: 334
  14216. 16p: 3444
  14217. PAL output (25i):
  14218. 27.5p: 12222
  14219. 24p: 222222222223 ("Euro pulldown")
  14220. 16.67p: 33
  14221. 16p: 33333334
  14222. @end example
  14223. @section thistogram
  14224. Compute and draw a color distribution histogram for the input video across time.
  14225. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14226. at certain time, this filter shows also past histograms of number of frames defined
  14227. by @code{width} option.
  14228. The computed histogram is a representation of the color component
  14229. distribution in an image.
  14230. The filter accepts the following options:
  14231. @table @option
  14232. @item width, w
  14233. Set width of single color component output. Default value is @code{0}.
  14234. Value of @code{0} means width will be picked from input video.
  14235. This also set number of passed histograms to keep.
  14236. Allowed range is [0, 8192].
  14237. @item display_mode, d
  14238. Set display mode.
  14239. It accepts the following values:
  14240. @table @samp
  14241. @item stack
  14242. Per color component graphs are placed below each other.
  14243. @item parade
  14244. Per color component graphs are placed side by side.
  14245. @item overlay
  14246. Presents information identical to that in the @code{parade}, except
  14247. that the graphs representing color components are superimposed directly
  14248. over one another.
  14249. @end table
  14250. Default is @code{stack}.
  14251. @item levels_mode, m
  14252. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14253. Default is @code{linear}.
  14254. @item components, c
  14255. Set what color components to display.
  14256. Default is @code{7}.
  14257. @item bgopacity, b
  14258. Set background opacity. Default is @code{0.9}.
  14259. @item envelope, e
  14260. Show envelope. Default is disabled.
  14261. @item ecolor, ec
  14262. Set envelope color. Default is @code{gold}.
  14263. @item slide
  14264. Set slide mode.
  14265. Available values for slide is:
  14266. @table @samp
  14267. @item frame
  14268. Draw new frame when right border is reached.
  14269. @item replace
  14270. Replace old columns with new ones.
  14271. @item scroll
  14272. Scroll from right to left.
  14273. @item rscroll
  14274. Scroll from left to right.
  14275. @item picture
  14276. Draw single picture.
  14277. @end table
  14278. Default is @code{replace}.
  14279. @end table
  14280. @section threshold
  14281. Apply threshold effect to video stream.
  14282. This filter needs four video streams to perform thresholding.
  14283. First stream is stream we are filtering.
  14284. Second stream is holding threshold values, third stream is holding min values,
  14285. and last, fourth stream is holding max values.
  14286. The filter accepts the following option:
  14287. @table @option
  14288. @item planes
  14289. Set which planes will be processed, unprocessed planes will be copied.
  14290. By default value 0xf, all planes will be processed.
  14291. @end table
  14292. For example if first stream pixel's component value is less then threshold value
  14293. of pixel component from 2nd threshold stream, third stream value will picked,
  14294. otherwise fourth stream pixel component value will be picked.
  14295. Using color source filter one can perform various types of thresholding:
  14296. @subsection Examples
  14297. @itemize
  14298. @item
  14299. Binary threshold, using gray color as threshold:
  14300. @example
  14301. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14302. @end example
  14303. @item
  14304. Inverted binary threshold, using gray color as threshold:
  14305. @example
  14306. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14307. @end example
  14308. @item
  14309. Truncate binary threshold, using gray color as threshold:
  14310. @example
  14311. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14312. @end example
  14313. @item
  14314. Threshold to zero, using gray color as threshold:
  14315. @example
  14316. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14317. @end example
  14318. @item
  14319. Inverted threshold to zero, using gray color as threshold:
  14320. @example
  14321. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14322. @end example
  14323. @end itemize
  14324. @section thumbnail
  14325. Select the most representative frame in a given sequence of consecutive frames.
  14326. The filter accepts the following options:
  14327. @table @option
  14328. @item n
  14329. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14330. will pick one of them, and then handle the next batch of @var{n} frames until
  14331. the end. Default is @code{100}.
  14332. @end table
  14333. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14334. value will result in a higher memory usage, so a high value is not recommended.
  14335. @subsection Examples
  14336. @itemize
  14337. @item
  14338. Extract one picture each 50 frames:
  14339. @example
  14340. thumbnail=50
  14341. @end example
  14342. @item
  14343. Complete example of a thumbnail creation with @command{ffmpeg}:
  14344. @example
  14345. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14346. @end example
  14347. @end itemize
  14348. @anchor{tile}
  14349. @section tile
  14350. Tile several successive frames together.
  14351. The @ref{untile} filter can do the reverse.
  14352. The filter accepts the following options:
  14353. @table @option
  14354. @item layout
  14355. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14356. this option, check the
  14357. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14358. @item nb_frames
  14359. Set the maximum number of frames to render in the given area. It must be less
  14360. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14361. the area will be used.
  14362. @item margin
  14363. Set the outer border margin in pixels.
  14364. @item padding
  14365. Set the inner border thickness (i.e. the number of pixels between frames). For
  14366. more advanced padding options (such as having different values for the edges),
  14367. refer to the pad video filter.
  14368. @item color
  14369. Specify the color of the unused area. For the syntax of this option, check the
  14370. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14371. The default value of @var{color} is "black".
  14372. @item overlap
  14373. Set the number of frames to overlap when tiling several successive frames together.
  14374. The value must be between @code{0} and @var{nb_frames - 1}.
  14375. @item init_padding
  14376. Set the number of frames to initially be empty before displaying first output frame.
  14377. This controls how soon will one get first output frame.
  14378. The value must be between @code{0} and @var{nb_frames - 1}.
  14379. @end table
  14380. @subsection Examples
  14381. @itemize
  14382. @item
  14383. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14384. @example
  14385. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14386. @end example
  14387. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14388. duplicating each output frame to accommodate the originally detected frame
  14389. rate.
  14390. @item
  14391. Display @code{5} pictures in an area of @code{3x2} frames,
  14392. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14393. mixed flat and named options:
  14394. @example
  14395. tile=3x2:nb_frames=5:padding=7:margin=2
  14396. @end example
  14397. @end itemize
  14398. @section tinterlace
  14399. Perform various types of temporal field interlacing.
  14400. Frames are counted starting from 1, so the first input frame is
  14401. considered odd.
  14402. The filter accepts the following options:
  14403. @table @option
  14404. @item mode
  14405. Specify the mode of the interlacing. This option can also be specified
  14406. as a value alone. See below for a list of values for this option.
  14407. Available values are:
  14408. @table @samp
  14409. @item merge, 0
  14410. Move odd frames into the upper field, even into the lower field,
  14411. generating a double height frame at half frame rate.
  14412. @example
  14413. ------> time
  14414. Input:
  14415. Frame 1 Frame 2 Frame 3 Frame 4
  14416. 11111 22222 33333 44444
  14417. 11111 22222 33333 44444
  14418. 11111 22222 33333 44444
  14419. 11111 22222 33333 44444
  14420. Output:
  14421. 11111 33333
  14422. 22222 44444
  14423. 11111 33333
  14424. 22222 44444
  14425. 11111 33333
  14426. 22222 44444
  14427. 11111 33333
  14428. 22222 44444
  14429. @end example
  14430. @item drop_even, 1
  14431. Only output odd frames, even frames are dropped, generating a frame with
  14432. unchanged height at half frame rate.
  14433. @example
  14434. ------> time
  14435. Input:
  14436. Frame 1 Frame 2 Frame 3 Frame 4
  14437. 11111 22222 33333 44444
  14438. 11111 22222 33333 44444
  14439. 11111 22222 33333 44444
  14440. 11111 22222 33333 44444
  14441. Output:
  14442. 11111 33333
  14443. 11111 33333
  14444. 11111 33333
  14445. 11111 33333
  14446. @end example
  14447. @item drop_odd, 2
  14448. Only output even frames, odd frames are dropped, generating a frame with
  14449. unchanged height at half frame rate.
  14450. @example
  14451. ------> time
  14452. Input:
  14453. Frame 1 Frame 2 Frame 3 Frame 4
  14454. 11111 22222 33333 44444
  14455. 11111 22222 33333 44444
  14456. 11111 22222 33333 44444
  14457. 11111 22222 33333 44444
  14458. Output:
  14459. 22222 44444
  14460. 22222 44444
  14461. 22222 44444
  14462. 22222 44444
  14463. @end example
  14464. @item pad, 3
  14465. Expand each frame to full height, but pad alternate lines with black,
  14466. generating a frame with double height at the same input frame rate.
  14467. @example
  14468. ------> time
  14469. Input:
  14470. Frame 1 Frame 2 Frame 3 Frame 4
  14471. 11111 22222 33333 44444
  14472. 11111 22222 33333 44444
  14473. 11111 22222 33333 44444
  14474. 11111 22222 33333 44444
  14475. Output:
  14476. 11111 ..... 33333 .....
  14477. ..... 22222 ..... 44444
  14478. 11111 ..... 33333 .....
  14479. ..... 22222 ..... 44444
  14480. 11111 ..... 33333 .....
  14481. ..... 22222 ..... 44444
  14482. 11111 ..... 33333 .....
  14483. ..... 22222 ..... 44444
  14484. @end example
  14485. @item interleave_top, 4
  14486. Interleave the upper field from odd frames with the lower field from
  14487. even frames, generating a frame with unchanged height at half frame rate.
  14488. @example
  14489. ------> time
  14490. Input:
  14491. Frame 1 Frame 2 Frame 3 Frame 4
  14492. 11111<- 22222 33333<- 44444
  14493. 11111 22222<- 33333 44444<-
  14494. 11111<- 22222 33333<- 44444
  14495. 11111 22222<- 33333 44444<-
  14496. Output:
  14497. 11111 33333
  14498. 22222 44444
  14499. 11111 33333
  14500. 22222 44444
  14501. @end example
  14502. @item interleave_bottom, 5
  14503. Interleave the lower field from odd frames with the upper field from
  14504. even frames, generating a frame with unchanged height at half frame rate.
  14505. @example
  14506. ------> time
  14507. Input:
  14508. Frame 1 Frame 2 Frame 3 Frame 4
  14509. 11111 22222<- 33333 44444<-
  14510. 11111<- 22222 33333<- 44444
  14511. 11111 22222<- 33333 44444<-
  14512. 11111<- 22222 33333<- 44444
  14513. Output:
  14514. 22222 44444
  14515. 11111 33333
  14516. 22222 44444
  14517. 11111 33333
  14518. @end example
  14519. @item interlacex2, 6
  14520. Double frame rate with unchanged height. Frames are inserted each
  14521. containing the second temporal field from the previous input frame and
  14522. the first temporal field from the next input frame. This mode relies on
  14523. the top_field_first flag. Useful for interlaced video displays with no
  14524. field synchronisation.
  14525. @example
  14526. ------> time
  14527. Input:
  14528. Frame 1 Frame 2 Frame 3 Frame 4
  14529. 11111 22222 33333 44444
  14530. 11111 22222 33333 44444
  14531. 11111 22222 33333 44444
  14532. 11111 22222 33333 44444
  14533. Output:
  14534. 11111 22222 22222 33333 33333 44444 44444
  14535. 11111 11111 22222 22222 33333 33333 44444
  14536. 11111 22222 22222 33333 33333 44444 44444
  14537. 11111 11111 22222 22222 33333 33333 44444
  14538. @end example
  14539. @item mergex2, 7
  14540. Move odd frames into the upper field, even into the lower field,
  14541. generating a double height frame at same frame rate.
  14542. @example
  14543. ------> time
  14544. Input:
  14545. Frame 1 Frame 2 Frame 3 Frame 4
  14546. 11111 22222 33333 44444
  14547. 11111 22222 33333 44444
  14548. 11111 22222 33333 44444
  14549. 11111 22222 33333 44444
  14550. Output:
  14551. 11111 33333 33333 55555
  14552. 22222 22222 44444 44444
  14553. 11111 33333 33333 55555
  14554. 22222 22222 44444 44444
  14555. 11111 33333 33333 55555
  14556. 22222 22222 44444 44444
  14557. 11111 33333 33333 55555
  14558. 22222 22222 44444 44444
  14559. @end example
  14560. @end table
  14561. Numeric values are deprecated but are accepted for backward
  14562. compatibility reasons.
  14563. Default mode is @code{merge}.
  14564. @item flags
  14565. Specify flags influencing the filter process.
  14566. Available value for @var{flags} is:
  14567. @table @option
  14568. @item low_pass_filter, vlpf
  14569. Enable linear vertical low-pass filtering in the filter.
  14570. Vertical low-pass filtering is required when creating an interlaced
  14571. destination from a progressive source which contains high-frequency
  14572. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14573. patterning.
  14574. @item complex_filter, cvlpf
  14575. Enable complex vertical low-pass filtering.
  14576. This will slightly less reduce interlace 'twitter' and Moire
  14577. patterning but better retain detail and subjective sharpness impression.
  14578. @item bypass_il
  14579. Bypass already interlaced frames, only adjust the frame rate.
  14580. @end table
  14581. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14582. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14583. @end table
  14584. @section tmedian
  14585. Pick median pixels from several successive input video frames.
  14586. The filter accepts the following options:
  14587. @table @option
  14588. @item radius
  14589. Set radius of median filter.
  14590. Default is 1. Allowed range is from 1 to 127.
  14591. @item planes
  14592. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14593. @item percentile
  14594. Set median percentile. Default value is @code{0.5}.
  14595. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14596. minimum values, and @code{1} maximum values.
  14597. @end table
  14598. @section tmix
  14599. Mix successive video frames.
  14600. A description of the accepted options follows.
  14601. @table @option
  14602. @item frames
  14603. The number of successive frames to mix. If unspecified, it defaults to 3.
  14604. @item weights
  14605. Specify weight of each input video frame.
  14606. Each weight is separated by space. If number of weights is smaller than
  14607. number of @var{frames} last specified weight will be used for all remaining
  14608. unset weights.
  14609. @item scale
  14610. Specify scale, if it is set it will be multiplied with sum
  14611. of each weight multiplied with pixel values to give final destination
  14612. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14613. @end table
  14614. @subsection Examples
  14615. @itemize
  14616. @item
  14617. Average 7 successive frames:
  14618. @example
  14619. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14620. @end example
  14621. @item
  14622. Apply simple temporal convolution:
  14623. @example
  14624. tmix=frames=3:weights="-1 3 -1"
  14625. @end example
  14626. @item
  14627. Similar as above but only showing temporal differences:
  14628. @example
  14629. tmix=frames=3:weights="-1 2 -1":scale=1
  14630. @end example
  14631. @end itemize
  14632. @anchor{tonemap}
  14633. @section tonemap
  14634. Tone map colors from different dynamic ranges.
  14635. This filter expects data in single precision floating point, as it needs to
  14636. operate on (and can output) out-of-range values. Another filter, such as
  14637. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14638. The tonemapping algorithms implemented only work on linear light, so input
  14639. data should be linearized beforehand (and possibly correctly tagged).
  14640. @example
  14641. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14642. @end example
  14643. @subsection Options
  14644. The filter accepts the following options.
  14645. @table @option
  14646. @item tonemap
  14647. Set the tone map algorithm to use.
  14648. Possible values are:
  14649. @table @var
  14650. @item none
  14651. Do not apply any tone map, only desaturate overbright pixels.
  14652. @item clip
  14653. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14654. in-range values, while distorting out-of-range values.
  14655. @item linear
  14656. Stretch the entire reference gamut to a linear multiple of the display.
  14657. @item gamma
  14658. Fit a logarithmic transfer between the tone curves.
  14659. @item reinhard
  14660. Preserve overall image brightness with a simple curve, using nonlinear
  14661. contrast, which results in flattening details and degrading color accuracy.
  14662. @item hable
  14663. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14664. of slightly darkening everything. Use it when detail preservation is more
  14665. important than color and brightness accuracy.
  14666. @item mobius
  14667. Smoothly map out-of-range values, while retaining contrast and colors for
  14668. in-range material as much as possible. Use it when color accuracy is more
  14669. important than detail preservation.
  14670. @end table
  14671. Default is none.
  14672. @item param
  14673. Tune the tone mapping algorithm.
  14674. This affects the following algorithms:
  14675. @table @var
  14676. @item none
  14677. Ignored.
  14678. @item linear
  14679. Specifies the scale factor to use while stretching.
  14680. Default to 1.0.
  14681. @item gamma
  14682. Specifies the exponent of the function.
  14683. Default to 1.8.
  14684. @item clip
  14685. Specify an extra linear coefficient to multiply into the signal before clipping.
  14686. Default to 1.0.
  14687. @item reinhard
  14688. Specify the local contrast coefficient at the display peak.
  14689. Default to 0.5, which means that in-gamut values will be about half as bright
  14690. as when clipping.
  14691. @item hable
  14692. Ignored.
  14693. @item mobius
  14694. Specify the transition point from linear to mobius transform. Every value
  14695. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14696. more accurate the result will be, at the cost of losing bright details.
  14697. Default to 0.3, which due to the steep initial slope still preserves in-range
  14698. colors fairly accurately.
  14699. @end table
  14700. @item desat
  14701. Apply desaturation for highlights that exceed this level of brightness. The
  14702. higher the parameter, the more color information will be preserved. This
  14703. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14704. (smoothly) turning into white instead. This makes images feel more natural,
  14705. at the cost of reducing information about out-of-range colors.
  14706. The default of 2.0 is somewhat conservative and will mostly just apply to
  14707. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14708. This option works only if the input frame has a supported color tag.
  14709. @item peak
  14710. Override signal/nominal/reference peak with this value. Useful when the
  14711. embedded peak information in display metadata is not reliable or when tone
  14712. mapping from a lower range to a higher range.
  14713. @end table
  14714. @section tpad
  14715. Temporarily pad video frames.
  14716. The filter accepts the following options:
  14717. @table @option
  14718. @item start
  14719. Specify number of delay frames before input video stream. Default is 0.
  14720. @item stop
  14721. Specify number of padding frames after input video stream.
  14722. Set to -1 to pad indefinitely. Default is 0.
  14723. @item start_mode
  14724. Set kind of frames added to beginning of stream.
  14725. Can be either @var{add} or @var{clone}.
  14726. With @var{add} frames of solid-color are added.
  14727. With @var{clone} frames are clones of first frame.
  14728. Default is @var{add}.
  14729. @item stop_mode
  14730. Set kind of frames added to end of stream.
  14731. Can be either @var{add} or @var{clone}.
  14732. With @var{add} frames of solid-color are added.
  14733. With @var{clone} frames are clones of last frame.
  14734. Default is @var{add}.
  14735. @item start_duration, stop_duration
  14736. Specify the duration of the start/stop delay. See
  14737. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14738. for the accepted syntax.
  14739. These options override @var{start} and @var{stop}. Default is 0.
  14740. @item color
  14741. Specify the color of the padded area. For the syntax of this option,
  14742. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14743. manual,ffmpeg-utils}.
  14744. The default value of @var{color} is "black".
  14745. @end table
  14746. @anchor{transpose}
  14747. @section transpose
  14748. Transpose rows with columns in the input video and optionally flip it.
  14749. It accepts the following parameters:
  14750. @table @option
  14751. @item dir
  14752. Specify the transposition direction.
  14753. Can assume the following values:
  14754. @table @samp
  14755. @item 0, 4, cclock_flip
  14756. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14757. @example
  14758. L.R L.l
  14759. . . -> . .
  14760. l.r R.r
  14761. @end example
  14762. @item 1, 5, clock
  14763. Rotate by 90 degrees clockwise, that is:
  14764. @example
  14765. L.R l.L
  14766. . . -> . .
  14767. l.r r.R
  14768. @end example
  14769. @item 2, 6, cclock
  14770. Rotate by 90 degrees counterclockwise, that is:
  14771. @example
  14772. L.R R.r
  14773. . . -> . .
  14774. l.r L.l
  14775. @end example
  14776. @item 3, 7, clock_flip
  14777. Rotate by 90 degrees clockwise and vertically flip, that is:
  14778. @example
  14779. L.R r.R
  14780. . . -> . .
  14781. l.r l.L
  14782. @end example
  14783. @end table
  14784. For values between 4-7, the transposition is only done if the input
  14785. video geometry is portrait and not landscape. These values are
  14786. deprecated, the @code{passthrough} option should be used instead.
  14787. Numerical values are deprecated, and should be dropped in favor of
  14788. symbolic constants.
  14789. @item passthrough
  14790. Do not apply the transposition if the input geometry matches the one
  14791. specified by the specified value. It accepts the following values:
  14792. @table @samp
  14793. @item none
  14794. Always apply transposition.
  14795. @item portrait
  14796. Preserve portrait geometry (when @var{height} >= @var{width}).
  14797. @item landscape
  14798. Preserve landscape geometry (when @var{width} >= @var{height}).
  14799. @end table
  14800. Default value is @code{none}.
  14801. @end table
  14802. For example to rotate by 90 degrees clockwise and preserve portrait
  14803. layout:
  14804. @example
  14805. transpose=dir=1:passthrough=portrait
  14806. @end example
  14807. The command above can also be specified as:
  14808. @example
  14809. transpose=1:portrait
  14810. @end example
  14811. @section transpose_npp
  14812. Transpose rows with columns in the input video and optionally flip it.
  14813. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14814. It accepts the following parameters:
  14815. @table @option
  14816. @item dir
  14817. Specify the transposition direction.
  14818. Can assume the following values:
  14819. @table @samp
  14820. @item cclock_flip
  14821. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14822. @item clock
  14823. Rotate by 90 degrees clockwise.
  14824. @item cclock
  14825. Rotate by 90 degrees counterclockwise.
  14826. @item clock_flip
  14827. Rotate by 90 degrees clockwise and vertically flip.
  14828. @end table
  14829. @item passthrough
  14830. Do not apply the transposition if the input geometry matches the one
  14831. specified by the specified value. It accepts the following values:
  14832. @table @samp
  14833. @item none
  14834. Always apply transposition. (default)
  14835. @item portrait
  14836. Preserve portrait geometry (when @var{height} >= @var{width}).
  14837. @item landscape
  14838. Preserve landscape geometry (when @var{width} >= @var{height}).
  14839. @end table
  14840. @end table
  14841. @section trim
  14842. Trim the input so that the output contains one continuous subpart of the input.
  14843. It accepts the following parameters:
  14844. @table @option
  14845. @item start
  14846. Specify the time of the start of the kept section, i.e. the frame with the
  14847. timestamp @var{start} will be the first frame in the output.
  14848. @item end
  14849. Specify the time of the first frame that will be dropped, i.e. the frame
  14850. immediately preceding the one with the timestamp @var{end} will be the last
  14851. frame in the output.
  14852. @item start_pts
  14853. This is the same as @var{start}, except this option sets the start timestamp
  14854. in timebase units instead of seconds.
  14855. @item end_pts
  14856. This is the same as @var{end}, except this option sets the end timestamp
  14857. in timebase units instead of seconds.
  14858. @item duration
  14859. The maximum duration of the output in seconds.
  14860. @item start_frame
  14861. The number of the first frame that should be passed to the output.
  14862. @item end_frame
  14863. The number of the first frame that should be dropped.
  14864. @end table
  14865. @option{start}, @option{end}, and @option{duration} are expressed as time
  14866. duration specifications; see
  14867. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14868. for the accepted syntax.
  14869. Note that the first two sets of the start/end options and the @option{duration}
  14870. option look at the frame timestamp, while the _frame variants simply count the
  14871. frames that pass through the filter. Also note that this filter does not modify
  14872. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14873. setpts filter after the trim filter.
  14874. If multiple start or end options are set, this filter tries to be greedy and
  14875. keep all the frames that match at least one of the specified constraints. To keep
  14876. only the part that matches all the constraints at once, chain multiple trim
  14877. filters.
  14878. The defaults are such that all the input is kept. So it is possible to set e.g.
  14879. just the end values to keep everything before the specified time.
  14880. Examples:
  14881. @itemize
  14882. @item
  14883. Drop everything except the second minute of input:
  14884. @example
  14885. ffmpeg -i INPUT -vf trim=60:120
  14886. @end example
  14887. @item
  14888. Keep only the first second:
  14889. @example
  14890. ffmpeg -i INPUT -vf trim=duration=1
  14891. @end example
  14892. @end itemize
  14893. @section unpremultiply
  14894. Apply alpha unpremultiply effect to input video stream using first plane
  14895. of second stream as alpha.
  14896. Both streams must have same dimensions and same pixel format.
  14897. The filter accepts the following option:
  14898. @table @option
  14899. @item planes
  14900. Set which planes will be processed, unprocessed planes will be copied.
  14901. By default value 0xf, all planes will be processed.
  14902. If the format has 1 or 2 components, then luma is bit 0.
  14903. If the format has 3 or 4 components:
  14904. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14905. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14906. If present, the alpha channel is always the last bit.
  14907. @item inplace
  14908. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14909. @end table
  14910. @anchor{unsharp}
  14911. @section unsharp
  14912. Sharpen or blur the input video.
  14913. It accepts the following parameters:
  14914. @table @option
  14915. @item luma_msize_x, lx
  14916. Set the luma matrix horizontal size. It must be an odd integer between
  14917. 3 and 23. The default value is 5.
  14918. @item luma_msize_y, ly
  14919. Set the luma matrix vertical size. It must be an odd integer between 3
  14920. and 23. The default value is 5.
  14921. @item luma_amount, la
  14922. Set the luma effect strength. It must be a floating point number, reasonable
  14923. values lay between -1.5 and 1.5.
  14924. Negative values will blur the input video, while positive values will
  14925. sharpen it, a value of zero will disable the effect.
  14926. Default value is 1.0.
  14927. @item chroma_msize_x, cx
  14928. Set the chroma matrix horizontal size. It must be an odd integer
  14929. between 3 and 23. The default value is 5.
  14930. @item chroma_msize_y, cy
  14931. Set the chroma matrix vertical size. It must be an odd integer
  14932. between 3 and 23. The default value is 5.
  14933. @item chroma_amount, ca
  14934. Set the chroma effect strength. It must be a floating point number, reasonable
  14935. values lay between -1.5 and 1.5.
  14936. Negative values will blur the input video, while positive values will
  14937. sharpen it, a value of zero will disable the effect.
  14938. Default value is 0.0.
  14939. @end table
  14940. All parameters are optional and default to the equivalent of the
  14941. string '5:5:1.0:5:5:0.0'.
  14942. @subsection Examples
  14943. @itemize
  14944. @item
  14945. Apply strong luma sharpen effect:
  14946. @example
  14947. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14948. @end example
  14949. @item
  14950. Apply a strong blur of both luma and chroma parameters:
  14951. @example
  14952. unsharp=7:7:-2:7:7:-2
  14953. @end example
  14954. @end itemize
  14955. @anchor{untile}
  14956. @section untile
  14957. Decompose a video made of tiled images into the individual images.
  14958. The frame rate of the output video is the frame rate of the input video
  14959. multiplied by the number of tiles.
  14960. This filter does the reverse of @ref{tile}.
  14961. The filter accepts the following options:
  14962. @table @option
  14963. @item layout
  14964. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14965. this option, check the
  14966. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14967. @end table
  14968. @subsection Examples
  14969. @itemize
  14970. @item
  14971. Produce a 1-second video from a still image file made of 25 frames stacked
  14972. vertically, like an analogic film reel:
  14973. @example
  14974. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14975. @end example
  14976. @end itemize
  14977. @section uspp
  14978. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14979. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14980. shifts and average the results.
  14981. The way this differs from the behavior of spp is that uspp actually encodes &
  14982. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14983. DCT similar to MJPEG.
  14984. The filter accepts the following options:
  14985. @table @option
  14986. @item quality
  14987. Set quality. This option defines the number of levels for averaging. It accepts
  14988. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14989. effect. A value of @code{8} means the higher quality. For each increment of
  14990. that value the speed drops by a factor of approximately 2. Default value is
  14991. @code{3}.
  14992. @item qp
  14993. Force a constant quantization parameter. If not set, the filter will use the QP
  14994. from the video stream (if available).
  14995. @end table
  14996. @section v360
  14997. Convert 360 videos between various formats.
  14998. The filter accepts the following options:
  14999. @table @option
  15000. @item input
  15001. @item output
  15002. Set format of the input/output video.
  15003. Available formats:
  15004. @table @samp
  15005. @item e
  15006. @item equirect
  15007. Equirectangular projection.
  15008. @item c3x2
  15009. @item c6x1
  15010. @item c1x6
  15011. Cubemap with 3x2/6x1/1x6 layout.
  15012. Format specific options:
  15013. @table @option
  15014. @item in_pad
  15015. @item out_pad
  15016. Set padding proportion for the input/output cubemap. Values in decimals.
  15017. Example values:
  15018. @table @samp
  15019. @item 0
  15020. No padding.
  15021. @item 0.01
  15022. 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)
  15023. @end table
  15024. Default value is @b{@samp{0}}.
  15025. Maximum value is @b{@samp{0.1}}.
  15026. @item fin_pad
  15027. @item fout_pad
  15028. Set fixed padding for the input/output cubemap. Values in pixels.
  15029. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15030. @item in_forder
  15031. @item out_forder
  15032. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15033. Designation of directions:
  15034. @table @samp
  15035. @item r
  15036. right
  15037. @item l
  15038. left
  15039. @item u
  15040. up
  15041. @item d
  15042. down
  15043. @item f
  15044. forward
  15045. @item b
  15046. back
  15047. @end table
  15048. Default value is @b{@samp{rludfb}}.
  15049. @item in_frot
  15050. @item out_frot
  15051. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15052. Designation of angles:
  15053. @table @samp
  15054. @item 0
  15055. 0 degrees clockwise
  15056. @item 1
  15057. 90 degrees clockwise
  15058. @item 2
  15059. 180 degrees clockwise
  15060. @item 3
  15061. 270 degrees clockwise
  15062. @end table
  15063. Default value is @b{@samp{000000}}.
  15064. @end table
  15065. @item eac
  15066. Equi-Angular Cubemap.
  15067. @item flat
  15068. @item gnomonic
  15069. @item rectilinear
  15070. Regular video.
  15071. Format specific options:
  15072. @table @option
  15073. @item h_fov
  15074. @item v_fov
  15075. @item d_fov
  15076. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15077. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15078. @item ih_fov
  15079. @item iv_fov
  15080. @item id_fov
  15081. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15082. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15083. @end table
  15084. @item dfisheye
  15085. Dual fisheye.
  15086. Format specific options:
  15087. @table @option
  15088. @item h_fov
  15089. @item v_fov
  15090. @item d_fov
  15091. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15092. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15093. @item ih_fov
  15094. @item iv_fov
  15095. @item id_fov
  15096. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15097. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15098. @end table
  15099. @item barrel
  15100. @item fb
  15101. @item barrelsplit
  15102. Facebook's 360 formats.
  15103. @item sg
  15104. Stereographic format.
  15105. Format specific options:
  15106. @table @option
  15107. @item h_fov
  15108. @item v_fov
  15109. @item d_fov
  15110. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15111. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15112. @item ih_fov
  15113. @item iv_fov
  15114. @item id_fov
  15115. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15116. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15117. @end table
  15118. @item mercator
  15119. Mercator format.
  15120. @item ball
  15121. Ball format, gives significant distortion toward the back.
  15122. @item hammer
  15123. Hammer-Aitoff map projection format.
  15124. @item sinusoidal
  15125. Sinusoidal map projection format.
  15126. @item fisheye
  15127. Fisheye projection.
  15128. Format specific options:
  15129. @table @option
  15130. @item h_fov
  15131. @item v_fov
  15132. @item d_fov
  15133. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15134. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15135. @item ih_fov
  15136. @item iv_fov
  15137. @item id_fov
  15138. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15139. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15140. @end table
  15141. @item pannini
  15142. Pannini projection.
  15143. Format specific options:
  15144. @table @option
  15145. @item h_fov
  15146. Set output pannini parameter.
  15147. @item ih_fov
  15148. Set input pannini parameter.
  15149. @end table
  15150. @item cylindrical
  15151. Cylindrical projection.
  15152. Format specific options:
  15153. @table @option
  15154. @item h_fov
  15155. @item v_fov
  15156. @item d_fov
  15157. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15158. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15159. @item ih_fov
  15160. @item iv_fov
  15161. @item id_fov
  15162. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15163. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15164. @end table
  15165. @item perspective
  15166. Perspective projection. @i{(output only)}
  15167. Format specific options:
  15168. @table @option
  15169. @item v_fov
  15170. Set perspective parameter.
  15171. @end table
  15172. @item tetrahedron
  15173. Tetrahedron projection.
  15174. @item tsp
  15175. Truncated square pyramid projection.
  15176. @item he
  15177. @item hequirect
  15178. Half equirectangular projection.
  15179. @item equisolid
  15180. Equisolid format.
  15181. Format specific options:
  15182. @table @option
  15183. @item h_fov
  15184. @item v_fov
  15185. @item d_fov
  15186. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15187. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15188. @item ih_fov
  15189. @item iv_fov
  15190. @item id_fov
  15191. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15192. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15193. @end table
  15194. @item og
  15195. Orthographic format.
  15196. Format specific options:
  15197. @table @option
  15198. @item h_fov
  15199. @item v_fov
  15200. @item d_fov
  15201. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15202. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15203. @item ih_fov
  15204. @item iv_fov
  15205. @item id_fov
  15206. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15207. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15208. @end table
  15209. @item octahedron
  15210. Octahedron projection.
  15211. @end table
  15212. @item interp
  15213. Set interpolation method.@*
  15214. @i{Note: more complex interpolation methods require much more memory to run.}
  15215. Available methods:
  15216. @table @samp
  15217. @item near
  15218. @item nearest
  15219. Nearest neighbour.
  15220. @item line
  15221. @item linear
  15222. Bilinear interpolation.
  15223. @item lagrange9
  15224. Lagrange9 interpolation.
  15225. @item cube
  15226. @item cubic
  15227. Bicubic interpolation.
  15228. @item lanc
  15229. @item lanczos
  15230. Lanczos interpolation.
  15231. @item sp16
  15232. @item spline16
  15233. Spline16 interpolation.
  15234. @item gauss
  15235. @item gaussian
  15236. Gaussian interpolation.
  15237. @item mitchell
  15238. Mitchell interpolation.
  15239. @end table
  15240. Default value is @b{@samp{line}}.
  15241. @item w
  15242. @item h
  15243. Set the output video resolution.
  15244. Default resolution depends on formats.
  15245. @item in_stereo
  15246. @item out_stereo
  15247. Set the input/output stereo format.
  15248. @table @samp
  15249. @item 2d
  15250. 2D mono
  15251. @item sbs
  15252. Side by side
  15253. @item tb
  15254. Top bottom
  15255. @end table
  15256. Default value is @b{@samp{2d}} for input and output format.
  15257. @item yaw
  15258. @item pitch
  15259. @item roll
  15260. Set rotation for the output video. Values in degrees.
  15261. @item rorder
  15262. Set rotation order for the output video. Choose one item for each position.
  15263. @table @samp
  15264. @item y, Y
  15265. yaw
  15266. @item p, P
  15267. pitch
  15268. @item r, R
  15269. roll
  15270. @end table
  15271. Default value is @b{@samp{ypr}}.
  15272. @item h_flip
  15273. @item v_flip
  15274. @item d_flip
  15275. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15276. @item ih_flip
  15277. @item iv_flip
  15278. Set if input video is flipped horizontally/vertically. Boolean values.
  15279. @item in_trans
  15280. Set if input video is transposed. Boolean value, by default disabled.
  15281. @item out_trans
  15282. Set if output video needs to be transposed. Boolean value, by default disabled.
  15283. @item alpha_mask
  15284. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15285. @end table
  15286. @subsection Examples
  15287. @itemize
  15288. @item
  15289. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15290. @example
  15291. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15292. @end example
  15293. @item
  15294. Extract back view of Equi-Angular Cubemap:
  15295. @example
  15296. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15297. @end example
  15298. @item
  15299. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15300. @example
  15301. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15302. @end example
  15303. @end itemize
  15304. @subsection Commands
  15305. This filter supports subset of above options as @ref{commands}.
  15306. @section vaguedenoiser
  15307. Apply a wavelet based denoiser.
  15308. It transforms each frame from the video input into the wavelet domain,
  15309. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15310. the obtained coefficients. It does an inverse wavelet transform after.
  15311. Due to wavelet properties, it should give a nice smoothed result, and
  15312. reduced noise, without blurring picture features.
  15313. This filter accepts the following options:
  15314. @table @option
  15315. @item threshold
  15316. The filtering strength. The higher, the more filtered the video will be.
  15317. Hard thresholding can use a higher threshold than soft thresholding
  15318. before the video looks overfiltered. Default value is 2.
  15319. @item method
  15320. The filtering method the filter will use.
  15321. It accepts the following values:
  15322. @table @samp
  15323. @item hard
  15324. All values under the threshold will be zeroed.
  15325. @item soft
  15326. All values under the threshold will be zeroed. All values above will be
  15327. reduced by the threshold.
  15328. @item garrote
  15329. Scales or nullifies coefficients - intermediary between (more) soft and
  15330. (less) hard thresholding.
  15331. @end table
  15332. Default is garrote.
  15333. @item nsteps
  15334. Number of times, the wavelet will decompose the picture. Picture can't
  15335. be decomposed beyond a particular point (typically, 8 for a 640x480
  15336. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15337. @item percent
  15338. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15339. @item planes
  15340. A list of the planes to process. By default all planes are processed.
  15341. @item type
  15342. The threshold type the filter will use.
  15343. It accepts the following values:
  15344. @table @samp
  15345. @item universal
  15346. Threshold used is same for all decompositions.
  15347. @item bayes
  15348. Threshold used depends also on each decomposition coefficients.
  15349. @end table
  15350. Default is universal.
  15351. @end table
  15352. @section vectorscope
  15353. Display 2 color component values in the two dimensional graph (which is called
  15354. a vectorscope).
  15355. This filter accepts the following options:
  15356. @table @option
  15357. @item mode, m
  15358. Set vectorscope mode.
  15359. It accepts the following values:
  15360. @table @samp
  15361. @item gray
  15362. @item tint
  15363. Gray values are displayed on graph, higher brightness means more pixels have
  15364. same component color value on location in graph. This is the default mode.
  15365. @item color
  15366. Gray values are displayed on graph. Surrounding pixels values which are not
  15367. present in video frame are drawn in gradient of 2 color components which are
  15368. set by option @code{x} and @code{y}. The 3rd color component is static.
  15369. @item color2
  15370. Actual color components values present in video frame are displayed on graph.
  15371. @item color3
  15372. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15373. on graph increases value of another color component, which is luminance by
  15374. default values of @code{x} and @code{y}.
  15375. @item color4
  15376. Actual colors present in video frame are displayed on graph. If two different
  15377. colors map to same position on graph then color with higher value of component
  15378. not present in graph is picked.
  15379. @item color5
  15380. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15381. component picked from radial gradient.
  15382. @end table
  15383. @item x
  15384. Set which color component will be represented on X-axis. Default is @code{1}.
  15385. @item y
  15386. Set which color component will be represented on Y-axis. Default is @code{2}.
  15387. @item intensity, i
  15388. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15389. of color component which represents frequency of (X, Y) location in graph.
  15390. @item envelope, e
  15391. @table @samp
  15392. @item none
  15393. No envelope, this is default.
  15394. @item instant
  15395. Instant envelope, even darkest single pixel will be clearly highlighted.
  15396. @item peak
  15397. Hold maximum and minimum values presented in graph over time. This way you
  15398. can still spot out of range values without constantly looking at vectorscope.
  15399. @item peak+instant
  15400. Peak and instant envelope combined together.
  15401. @end table
  15402. @item graticule, g
  15403. Set what kind of graticule to draw.
  15404. @table @samp
  15405. @item none
  15406. @item green
  15407. @item color
  15408. @item invert
  15409. @end table
  15410. @item opacity, o
  15411. Set graticule opacity.
  15412. @item flags, f
  15413. Set graticule flags.
  15414. @table @samp
  15415. @item white
  15416. Draw graticule for white point.
  15417. @item black
  15418. Draw graticule for black point.
  15419. @item name
  15420. Draw color points short names.
  15421. @end table
  15422. @item bgopacity, b
  15423. Set background opacity.
  15424. @item lthreshold, l
  15425. Set low threshold for color component not represented on X or Y axis.
  15426. Values lower than this value will be ignored. Default is 0.
  15427. Note this value is multiplied with actual max possible value one pixel component
  15428. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15429. is 0.1 * 255 = 25.
  15430. @item hthreshold, h
  15431. Set high threshold for color component not represented on X or Y axis.
  15432. Values higher than this value will be ignored. Default is 1.
  15433. Note this value is multiplied with actual max possible value one pixel component
  15434. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15435. is 0.9 * 255 = 230.
  15436. @item colorspace, c
  15437. Set what kind of colorspace to use when drawing graticule.
  15438. @table @samp
  15439. @item auto
  15440. @item 601
  15441. @item 709
  15442. @end table
  15443. Default is auto.
  15444. @item tint0, t0
  15445. @item tint1, t1
  15446. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15447. This means no tint, and output will remain gray.
  15448. @end table
  15449. @anchor{vidstabdetect}
  15450. @section vidstabdetect
  15451. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15452. @ref{vidstabtransform} for pass 2.
  15453. This filter generates a file with relative translation and rotation
  15454. transform information about subsequent frames, which is then used by
  15455. the @ref{vidstabtransform} filter.
  15456. To enable compilation of this filter you need to configure FFmpeg with
  15457. @code{--enable-libvidstab}.
  15458. This filter accepts the following options:
  15459. @table @option
  15460. @item result
  15461. Set the path to the file used to write the transforms information.
  15462. Default value is @file{transforms.trf}.
  15463. @item shakiness
  15464. Set how shaky the video is and how quick the camera is. It accepts an
  15465. integer in the range 1-10, a value of 1 means little shakiness, a
  15466. value of 10 means strong shakiness. Default value is 5.
  15467. @item accuracy
  15468. Set the accuracy of the detection process. It must be a value in the
  15469. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15470. accuracy. Default value is 15.
  15471. @item stepsize
  15472. Set stepsize of the search process. The region around minimum is
  15473. scanned with 1 pixel resolution. Default value is 6.
  15474. @item mincontrast
  15475. Set minimum contrast. Below this value a local measurement field is
  15476. discarded. Must be a floating point value in the range 0-1. Default
  15477. value is 0.3.
  15478. @item tripod
  15479. Set reference frame number for tripod mode.
  15480. If enabled, the motion of the frames is compared to a reference frame
  15481. in the filtered stream, identified by the specified number. The idea
  15482. is to compensate all movements in a more-or-less static scene and keep
  15483. the camera view absolutely still.
  15484. If set to 0, it is disabled. The frames are counted starting from 1.
  15485. @item show
  15486. Show fields and transforms in the resulting frames. It accepts an
  15487. integer in the range 0-2. Default value is 0, which disables any
  15488. visualization.
  15489. @end table
  15490. @subsection Examples
  15491. @itemize
  15492. @item
  15493. Use default values:
  15494. @example
  15495. vidstabdetect
  15496. @end example
  15497. @item
  15498. Analyze strongly shaky movie and put the results in file
  15499. @file{mytransforms.trf}:
  15500. @example
  15501. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15502. @end example
  15503. @item
  15504. Visualize the result of internal transformations in the resulting
  15505. video:
  15506. @example
  15507. vidstabdetect=show=1
  15508. @end example
  15509. @item
  15510. Analyze a video with medium shakiness using @command{ffmpeg}:
  15511. @example
  15512. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15513. @end example
  15514. @end itemize
  15515. @anchor{vidstabtransform}
  15516. @section vidstabtransform
  15517. Video stabilization/deshaking: pass 2 of 2,
  15518. see @ref{vidstabdetect} for pass 1.
  15519. Read a file with transform information for each frame and
  15520. apply/compensate them. Together with the @ref{vidstabdetect}
  15521. filter this can be used to deshake videos. See also
  15522. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15523. the @ref{unsharp} filter, see below.
  15524. To enable compilation of this filter you need to configure FFmpeg with
  15525. @code{--enable-libvidstab}.
  15526. @subsection Options
  15527. @table @option
  15528. @item input
  15529. Set path to the file used to read the transforms. Default value is
  15530. @file{transforms.trf}.
  15531. @item smoothing
  15532. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15533. camera movements. Default value is 10.
  15534. For example a number of 10 means that 21 frames are used (10 in the
  15535. past and 10 in the future) to smoothen the motion in the video. A
  15536. larger value leads to a smoother video, but limits the acceleration of
  15537. the camera (pan/tilt movements). 0 is a special case where a static
  15538. camera is simulated.
  15539. @item optalgo
  15540. Set the camera path optimization algorithm.
  15541. Accepted values are:
  15542. @table @samp
  15543. @item gauss
  15544. gaussian kernel low-pass filter on camera motion (default)
  15545. @item avg
  15546. averaging on transformations
  15547. @end table
  15548. @item maxshift
  15549. Set maximal number of pixels to translate frames. Default value is -1,
  15550. meaning no limit.
  15551. @item maxangle
  15552. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15553. value is -1, meaning no limit.
  15554. @item crop
  15555. Specify how to deal with borders that may be visible due to movement
  15556. compensation.
  15557. Available values are:
  15558. @table @samp
  15559. @item keep
  15560. keep image information from previous frame (default)
  15561. @item black
  15562. fill the border black
  15563. @end table
  15564. @item invert
  15565. Invert transforms if set to 1. Default value is 0.
  15566. @item relative
  15567. Consider transforms as relative to previous frame if set to 1,
  15568. absolute if set to 0. Default value is 0.
  15569. @item zoom
  15570. Set percentage to zoom. A positive value will result in a zoom-in
  15571. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15572. zoom).
  15573. @item optzoom
  15574. Set optimal zooming to avoid borders.
  15575. Accepted values are:
  15576. @table @samp
  15577. @item 0
  15578. disabled
  15579. @item 1
  15580. optimal static zoom value is determined (only very strong movements
  15581. will lead to visible borders) (default)
  15582. @item 2
  15583. optimal adaptive zoom value is determined (no borders will be
  15584. visible), see @option{zoomspeed}
  15585. @end table
  15586. Note that the value given at zoom is added to the one calculated here.
  15587. @item zoomspeed
  15588. Set percent to zoom maximally each frame (enabled when
  15589. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15590. 0.25.
  15591. @item interpol
  15592. Specify type of interpolation.
  15593. Available values are:
  15594. @table @samp
  15595. @item no
  15596. no interpolation
  15597. @item linear
  15598. linear only horizontal
  15599. @item bilinear
  15600. linear in both directions (default)
  15601. @item bicubic
  15602. cubic in both directions (slow)
  15603. @end table
  15604. @item tripod
  15605. Enable virtual tripod mode if set to 1, which is equivalent to
  15606. @code{relative=0:smoothing=0}. Default value is 0.
  15607. Use also @code{tripod} option of @ref{vidstabdetect}.
  15608. @item debug
  15609. Increase log verbosity if set to 1. Also the detected global motions
  15610. are written to the temporary file @file{global_motions.trf}. Default
  15611. value is 0.
  15612. @end table
  15613. @subsection Examples
  15614. @itemize
  15615. @item
  15616. Use @command{ffmpeg} for a typical stabilization with default values:
  15617. @example
  15618. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15619. @end example
  15620. Note the use of the @ref{unsharp} filter which is always recommended.
  15621. @item
  15622. Zoom in a bit more and load transform data from a given file:
  15623. @example
  15624. vidstabtransform=zoom=5:input="mytransforms.trf"
  15625. @end example
  15626. @item
  15627. Smoothen the video even more:
  15628. @example
  15629. vidstabtransform=smoothing=30
  15630. @end example
  15631. @end itemize
  15632. @section vflip
  15633. Flip the input video vertically.
  15634. For example, to vertically flip a video with @command{ffmpeg}:
  15635. @example
  15636. ffmpeg -i in.avi -vf "vflip" out.avi
  15637. @end example
  15638. @section vfrdet
  15639. Detect variable frame rate video.
  15640. This filter tries to detect if the input is variable or constant frame rate.
  15641. At end it will output number of frames detected as having variable delta pts,
  15642. and ones with constant delta pts.
  15643. If there was frames with variable delta, than it will also show min, max and
  15644. average delta encountered.
  15645. @section vibrance
  15646. Boost or alter saturation.
  15647. The filter accepts the following options:
  15648. @table @option
  15649. @item intensity
  15650. Set strength of boost if positive value or strength of alter if negative value.
  15651. Default is 0. Allowed range is from -2 to 2.
  15652. @item rbal
  15653. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15654. @item gbal
  15655. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15656. @item bbal
  15657. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15658. @item rlum
  15659. Set the red luma coefficient.
  15660. @item glum
  15661. Set the green luma coefficient.
  15662. @item blum
  15663. Set the blue luma coefficient.
  15664. @item alternate
  15665. If @code{intensity} is negative and this is set to 1, colors will change,
  15666. otherwise colors will be less saturated, more towards gray.
  15667. @end table
  15668. @subsection Commands
  15669. This filter supports the all above options as @ref{commands}.
  15670. @anchor{vignette}
  15671. @section vignette
  15672. Make or reverse a natural vignetting effect.
  15673. The filter accepts the following options:
  15674. @table @option
  15675. @item angle, a
  15676. Set lens angle expression as a number of radians.
  15677. The value is clipped in the @code{[0,PI/2]} range.
  15678. Default value: @code{"PI/5"}
  15679. @item x0
  15680. @item y0
  15681. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15682. by default.
  15683. @item mode
  15684. Set forward/backward mode.
  15685. Available modes are:
  15686. @table @samp
  15687. @item forward
  15688. The larger the distance from the central point, the darker the image becomes.
  15689. @item backward
  15690. The larger the distance from the central point, the brighter the image becomes.
  15691. This can be used to reverse a vignette effect, though there is no automatic
  15692. detection to extract the lens @option{angle} and other settings (yet). It can
  15693. also be used to create a burning effect.
  15694. @end table
  15695. Default value is @samp{forward}.
  15696. @item eval
  15697. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15698. It accepts the following values:
  15699. @table @samp
  15700. @item init
  15701. Evaluate expressions only once during the filter initialization.
  15702. @item frame
  15703. Evaluate expressions for each incoming frame. This is way slower than the
  15704. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15705. allows advanced dynamic expressions.
  15706. @end table
  15707. Default value is @samp{init}.
  15708. @item dither
  15709. Set dithering to reduce the circular banding effects. Default is @code{1}
  15710. (enabled).
  15711. @item aspect
  15712. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15713. Setting this value to the SAR of the input will make a rectangular vignetting
  15714. following the dimensions of the video.
  15715. Default is @code{1/1}.
  15716. @end table
  15717. @subsection Expressions
  15718. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15719. following parameters.
  15720. @table @option
  15721. @item w
  15722. @item h
  15723. input width and height
  15724. @item n
  15725. the number of input frame, starting from 0
  15726. @item pts
  15727. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15728. @var{TB} units, NAN if undefined
  15729. @item r
  15730. frame rate of the input video, NAN if the input frame rate is unknown
  15731. @item t
  15732. the PTS (Presentation TimeStamp) of the filtered video frame,
  15733. expressed in seconds, NAN if undefined
  15734. @item tb
  15735. time base of the input video
  15736. @end table
  15737. @subsection Examples
  15738. @itemize
  15739. @item
  15740. Apply simple strong vignetting effect:
  15741. @example
  15742. vignette=PI/4
  15743. @end example
  15744. @item
  15745. Make a flickering vignetting:
  15746. @example
  15747. vignette='PI/4+random(1)*PI/50':eval=frame
  15748. @end example
  15749. @end itemize
  15750. @section vmafmotion
  15751. Obtain the average VMAF motion score of a video.
  15752. It is one of the component metrics of VMAF.
  15753. The obtained average motion score is printed through the logging system.
  15754. The filter accepts the following options:
  15755. @table @option
  15756. @item stats_file
  15757. If specified, the filter will use the named file to save the motion score of
  15758. each frame with respect to the previous frame.
  15759. When filename equals "-" the data is sent to standard output.
  15760. @end table
  15761. Example:
  15762. @example
  15763. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15764. @end example
  15765. @section vstack
  15766. Stack input videos vertically.
  15767. All streams must be of same pixel format and of same width.
  15768. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15769. to create same output.
  15770. The filter accepts the following options:
  15771. @table @option
  15772. @item inputs
  15773. Set number of input streams. Default is 2.
  15774. @item shortest
  15775. If set to 1, force the output to terminate when the shortest input
  15776. terminates. Default value is 0.
  15777. @end table
  15778. @section w3fdif
  15779. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15780. Deinterlacing Filter").
  15781. Based on the process described by Martin Weston for BBC R&D, and
  15782. implemented based on the de-interlace algorithm written by Jim
  15783. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15784. uses filter coefficients calculated by BBC R&D.
  15785. This filter uses field-dominance information in frame to decide which
  15786. of each pair of fields to place first in the output.
  15787. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15788. There are two sets of filter coefficients, so called "simple"
  15789. and "complex". Which set of filter coefficients is used can
  15790. be set by passing an optional parameter:
  15791. @table @option
  15792. @item filter
  15793. Set the interlacing filter coefficients. Accepts one of the following values:
  15794. @table @samp
  15795. @item simple
  15796. Simple filter coefficient set.
  15797. @item complex
  15798. More-complex filter coefficient set.
  15799. @end table
  15800. Default value is @samp{complex}.
  15801. @item deint
  15802. Specify which frames to deinterlace. Accepts one of the following values:
  15803. @table @samp
  15804. @item all
  15805. Deinterlace all frames,
  15806. @item interlaced
  15807. Only deinterlace frames marked as interlaced.
  15808. @end table
  15809. Default value is @samp{all}.
  15810. @end table
  15811. @section waveform
  15812. Video waveform monitor.
  15813. The waveform monitor plots color component intensity. By default luminance
  15814. only. Each column of the waveform corresponds to a column of pixels in the
  15815. source video.
  15816. It accepts the following options:
  15817. @table @option
  15818. @item mode, m
  15819. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15820. In row mode, the graph on the left side represents color component value 0 and
  15821. the right side represents value = 255. In column mode, the top side represents
  15822. color component value = 0 and bottom side represents value = 255.
  15823. @item intensity, i
  15824. Set intensity. Smaller values are useful to find out how many values of the same
  15825. luminance are distributed across input rows/columns.
  15826. Default value is @code{0.04}. Allowed range is [0, 1].
  15827. @item mirror, r
  15828. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15829. In mirrored mode, higher values will be represented on the left
  15830. side for @code{row} mode and at the top for @code{column} mode. Default is
  15831. @code{1} (mirrored).
  15832. @item display, d
  15833. Set display mode.
  15834. It accepts the following values:
  15835. @table @samp
  15836. @item overlay
  15837. Presents information identical to that in the @code{parade}, except
  15838. that the graphs representing color components are superimposed directly
  15839. over one another.
  15840. This display mode makes it easier to spot relative differences or similarities
  15841. in overlapping areas of the color components that are supposed to be identical,
  15842. such as neutral whites, grays, or blacks.
  15843. @item stack
  15844. Display separate graph for the color components side by side in
  15845. @code{row} mode or one below the other in @code{column} mode.
  15846. @item parade
  15847. Display separate graph for the color components side by side in
  15848. @code{column} mode or one below the other in @code{row} mode.
  15849. Using this display mode makes it easy to spot color casts in the highlights
  15850. and shadows of an image, by comparing the contours of the top and the bottom
  15851. graphs of each waveform. Since whites, grays, and blacks are characterized
  15852. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15853. should display three waveforms of roughly equal width/height. If not, the
  15854. correction is easy to perform by making level adjustments the three waveforms.
  15855. @end table
  15856. Default is @code{stack}.
  15857. @item components, c
  15858. Set which color components to display. Default is 1, which means only luminance
  15859. or red color component if input is in RGB colorspace. If is set for example to
  15860. 7 it will display all 3 (if) available color components.
  15861. @item envelope, e
  15862. @table @samp
  15863. @item none
  15864. No envelope, this is default.
  15865. @item instant
  15866. Instant envelope, minimum and maximum values presented in graph will be easily
  15867. visible even with small @code{step} value.
  15868. @item peak
  15869. Hold minimum and maximum values presented in graph across time. This way you
  15870. can still spot out of range values without constantly looking at waveforms.
  15871. @item peak+instant
  15872. Peak and instant envelope combined together.
  15873. @end table
  15874. @item filter, f
  15875. @table @samp
  15876. @item lowpass
  15877. No filtering, this is default.
  15878. @item flat
  15879. Luma and chroma combined together.
  15880. @item aflat
  15881. Similar as above, but shows difference between blue and red chroma.
  15882. @item xflat
  15883. Similar as above, but use different colors.
  15884. @item yflat
  15885. Similar as above, but again with different colors.
  15886. @item chroma
  15887. Displays only chroma.
  15888. @item color
  15889. Displays actual color value on waveform.
  15890. @item acolor
  15891. Similar as above, but with luma showing frequency of chroma values.
  15892. @end table
  15893. @item graticule, g
  15894. Set which graticule to display.
  15895. @table @samp
  15896. @item none
  15897. Do not display graticule.
  15898. @item green
  15899. Display green graticule showing legal broadcast ranges.
  15900. @item orange
  15901. Display orange graticule showing legal broadcast ranges.
  15902. @item invert
  15903. Display invert graticule showing legal broadcast ranges.
  15904. @end table
  15905. @item opacity, o
  15906. Set graticule opacity.
  15907. @item flags, fl
  15908. Set graticule flags.
  15909. @table @samp
  15910. @item numbers
  15911. Draw numbers above lines. By default enabled.
  15912. @item dots
  15913. Draw dots instead of lines.
  15914. @end table
  15915. @item scale, s
  15916. Set scale used for displaying graticule.
  15917. @table @samp
  15918. @item digital
  15919. @item millivolts
  15920. @item ire
  15921. @end table
  15922. Default is digital.
  15923. @item bgopacity, b
  15924. Set background opacity.
  15925. @item tint0, t0
  15926. @item tint1, t1
  15927. Set tint for output.
  15928. Only used with lowpass filter and when display is not overlay and input
  15929. pixel formats are not RGB.
  15930. @end table
  15931. @section weave, doubleweave
  15932. The @code{weave} takes a field-based video input and join
  15933. each two sequential fields into single frame, producing a new double
  15934. height clip with half the frame rate and half the frame count.
  15935. The @code{doubleweave} works same as @code{weave} but without
  15936. halving frame rate and frame count.
  15937. It accepts the following option:
  15938. @table @option
  15939. @item first_field
  15940. Set first field. Available values are:
  15941. @table @samp
  15942. @item top, t
  15943. Set the frame as top-field-first.
  15944. @item bottom, b
  15945. Set the frame as bottom-field-first.
  15946. @end table
  15947. @end table
  15948. @subsection Examples
  15949. @itemize
  15950. @item
  15951. Interlace video using @ref{select} and @ref{separatefields} filter:
  15952. @example
  15953. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15954. @end example
  15955. @end itemize
  15956. @section xbr
  15957. Apply the xBR high-quality magnification filter which is designed for pixel
  15958. art. It follows a set of edge-detection rules, see
  15959. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15960. It accepts the following option:
  15961. @table @option
  15962. @item n
  15963. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15964. @code{3xBR} and @code{4} for @code{4xBR}.
  15965. Default is @code{3}.
  15966. @end table
  15967. @section xfade
  15968. Apply cross fade from one input video stream to another input video stream.
  15969. The cross fade is applied for specified duration.
  15970. The filter accepts the following options:
  15971. @table @option
  15972. @item transition
  15973. Set one of available transition effects:
  15974. @table @samp
  15975. @item custom
  15976. @item fade
  15977. @item wipeleft
  15978. @item wiperight
  15979. @item wipeup
  15980. @item wipedown
  15981. @item slideleft
  15982. @item slideright
  15983. @item slideup
  15984. @item slidedown
  15985. @item circlecrop
  15986. @item rectcrop
  15987. @item distance
  15988. @item fadeblack
  15989. @item fadewhite
  15990. @item radial
  15991. @item smoothleft
  15992. @item smoothright
  15993. @item smoothup
  15994. @item smoothdown
  15995. @item circleopen
  15996. @item circleclose
  15997. @item vertopen
  15998. @item vertclose
  15999. @item horzopen
  16000. @item horzclose
  16001. @item dissolve
  16002. @item pixelize
  16003. @item diagtl
  16004. @item diagtr
  16005. @item diagbl
  16006. @item diagbr
  16007. @item hlslice
  16008. @item hrslice
  16009. @item vuslice
  16010. @item vdslice
  16011. @item hblur
  16012. @item fadegrays
  16013. @item wipetl
  16014. @item wipetr
  16015. @item wipebl
  16016. @item wipebr
  16017. @item squeezeh
  16018. @item squeezev
  16019. @end table
  16020. Default transition effect is fade.
  16021. @item duration
  16022. Set cross fade duration in seconds.
  16023. Default duration is 1 second.
  16024. @item offset
  16025. Set cross fade start relative to first input stream in seconds.
  16026. Default offset is 0.
  16027. @item expr
  16028. Set expression for custom transition effect.
  16029. The expressions can use the following variables and functions:
  16030. @table @option
  16031. @item X
  16032. @item Y
  16033. The coordinates of the current sample.
  16034. @item W
  16035. @item H
  16036. The width and height of the image.
  16037. @item P
  16038. Progress of transition effect.
  16039. @item PLANE
  16040. Currently processed plane.
  16041. @item A
  16042. Return value of first input at current location and plane.
  16043. @item B
  16044. Return value of second input at current location and plane.
  16045. @item a0(x, y)
  16046. @item a1(x, y)
  16047. @item a2(x, y)
  16048. @item a3(x, y)
  16049. Return the value of the pixel at location (@var{x},@var{y}) of the
  16050. first/second/third/fourth component of first input.
  16051. @item b0(x, y)
  16052. @item b1(x, y)
  16053. @item b2(x, y)
  16054. @item b3(x, y)
  16055. Return the value of the pixel at location (@var{x},@var{y}) of the
  16056. first/second/third/fourth component of second input.
  16057. @end table
  16058. @end table
  16059. @subsection Examples
  16060. @itemize
  16061. @item
  16062. Cross fade from one input video to another input video, with fade transition and duration of transition
  16063. of 2 seconds starting at offset of 5 seconds:
  16064. @example
  16065. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16066. @end example
  16067. @end itemize
  16068. @section xmedian
  16069. Pick median pixels from several input videos.
  16070. The filter accepts the following options:
  16071. @table @option
  16072. @item inputs
  16073. Set number of inputs.
  16074. Default is 3. Allowed range is from 3 to 255.
  16075. If number of inputs is even number, than result will be mean value between two median values.
  16076. @item planes
  16077. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16078. @item percentile
  16079. Set median percentile. Default value is @code{0.5}.
  16080. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16081. minimum values, and @code{1} maximum values.
  16082. @end table
  16083. @section xstack
  16084. Stack video inputs into custom layout.
  16085. All streams must be of same pixel format.
  16086. The filter accepts the following options:
  16087. @table @option
  16088. @item inputs
  16089. Set number of input streams. Default is 2.
  16090. @item layout
  16091. Specify layout of inputs.
  16092. This option requires the desired layout configuration to be explicitly set by the user.
  16093. This sets position of each video input in output. Each input
  16094. is separated by '|'.
  16095. The first number represents the column, and the second number represents the row.
  16096. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16097. where X is video input from which to take width or height.
  16098. Multiple values can be used when separated by '+'. In such
  16099. case values are summed together.
  16100. Note that if inputs are of different sizes gaps may appear, as not all of
  16101. the output video frame will be filled. Similarly, videos can overlap each
  16102. other if their position doesn't leave enough space for the full frame of
  16103. adjoining videos.
  16104. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16105. a layout must be set by the user.
  16106. @item shortest
  16107. If set to 1, force the output to terminate when the shortest input
  16108. terminates. Default value is 0.
  16109. @item fill
  16110. If set to valid color, all unused pixels will be filled with that color.
  16111. By default fill is set to none, so it is disabled.
  16112. @end table
  16113. @subsection Examples
  16114. @itemize
  16115. @item
  16116. Display 4 inputs into 2x2 grid.
  16117. Layout:
  16118. @example
  16119. input1(0, 0) | input3(w0, 0)
  16120. input2(0, h0) | input4(w0, h0)
  16121. @end example
  16122. @example
  16123. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16124. @end example
  16125. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16126. @item
  16127. Display 4 inputs into 1x4 grid.
  16128. Layout:
  16129. @example
  16130. input1(0, 0)
  16131. input2(0, h0)
  16132. input3(0, h0+h1)
  16133. input4(0, h0+h1+h2)
  16134. @end example
  16135. @example
  16136. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16137. @end example
  16138. Note that if inputs are of different widths, unused space will appear.
  16139. @item
  16140. Display 9 inputs into 3x3 grid.
  16141. Layout:
  16142. @example
  16143. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16144. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16145. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16146. @end example
  16147. @example
  16148. 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
  16149. @end example
  16150. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16151. @item
  16152. Display 16 inputs into 4x4 grid.
  16153. Layout:
  16154. @example
  16155. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16156. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16157. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16158. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16159. @end example
  16160. @example
  16161. 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|
  16162. 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
  16163. @end example
  16164. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16165. @end itemize
  16166. @anchor{yadif}
  16167. @section yadif
  16168. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16169. filter").
  16170. It accepts the following parameters:
  16171. @table @option
  16172. @item mode
  16173. The interlacing mode to adopt. It accepts one of the following values:
  16174. @table @option
  16175. @item 0, send_frame
  16176. Output one frame for each frame.
  16177. @item 1, send_field
  16178. Output one frame for each field.
  16179. @item 2, send_frame_nospatial
  16180. Like @code{send_frame}, but it skips the spatial interlacing check.
  16181. @item 3, send_field_nospatial
  16182. Like @code{send_field}, but it skips the spatial interlacing check.
  16183. @end table
  16184. The default value is @code{send_frame}.
  16185. @item parity
  16186. The picture field parity assumed for the input interlaced video. It accepts one
  16187. of the following values:
  16188. @table @option
  16189. @item 0, tff
  16190. Assume the top field is first.
  16191. @item 1, bff
  16192. Assume the bottom field is first.
  16193. @item -1, auto
  16194. Enable automatic detection of field parity.
  16195. @end table
  16196. The default value is @code{auto}.
  16197. If the interlacing is unknown or the decoder does not export this information,
  16198. top field first will be assumed.
  16199. @item deint
  16200. Specify which frames to deinterlace. Accepts one of the following
  16201. values:
  16202. @table @option
  16203. @item 0, all
  16204. Deinterlace all frames.
  16205. @item 1, interlaced
  16206. Only deinterlace frames marked as interlaced.
  16207. @end table
  16208. The default value is @code{all}.
  16209. @end table
  16210. @section yadif_cuda
  16211. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16212. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16213. and/or nvenc.
  16214. It accepts the following parameters:
  16215. @table @option
  16216. @item mode
  16217. The interlacing mode to adopt. It accepts one of the following values:
  16218. @table @option
  16219. @item 0, send_frame
  16220. Output one frame for each frame.
  16221. @item 1, send_field
  16222. Output one frame for each field.
  16223. @item 2, send_frame_nospatial
  16224. Like @code{send_frame}, but it skips the spatial interlacing check.
  16225. @item 3, send_field_nospatial
  16226. Like @code{send_field}, but it skips the spatial interlacing check.
  16227. @end table
  16228. The default value is @code{send_frame}.
  16229. @item parity
  16230. The picture field parity assumed for the input interlaced video. It accepts one
  16231. of the following values:
  16232. @table @option
  16233. @item 0, tff
  16234. Assume the top field is first.
  16235. @item 1, bff
  16236. Assume the bottom field is first.
  16237. @item -1, auto
  16238. Enable automatic detection of field parity.
  16239. @end table
  16240. The default value is @code{auto}.
  16241. If the interlacing is unknown or the decoder does not export this information,
  16242. top field first will be assumed.
  16243. @item deint
  16244. Specify which frames to deinterlace. Accepts one of the following
  16245. values:
  16246. @table @option
  16247. @item 0, all
  16248. Deinterlace all frames.
  16249. @item 1, interlaced
  16250. Only deinterlace frames marked as interlaced.
  16251. @end table
  16252. The default value is @code{all}.
  16253. @end table
  16254. @section yaepblur
  16255. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16256. The algorithm is described in
  16257. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16258. It accepts the following parameters:
  16259. @table @option
  16260. @item radius, r
  16261. Set the window radius. Default value is 3.
  16262. @item planes, p
  16263. Set which planes to filter. Default is only the first plane.
  16264. @item sigma, s
  16265. Set blur strength. Default value is 128.
  16266. @end table
  16267. @subsection Commands
  16268. This filter supports same @ref{commands} as options.
  16269. @section zoompan
  16270. Apply Zoom & Pan effect.
  16271. This filter accepts the following options:
  16272. @table @option
  16273. @item zoom, z
  16274. Set the zoom expression. Range is 1-10. Default is 1.
  16275. @item x
  16276. @item y
  16277. Set the x and y expression. Default is 0.
  16278. @item d
  16279. Set the duration expression in number of frames.
  16280. This sets for how many number of frames effect will last for
  16281. single input image.
  16282. @item s
  16283. Set the output image size, default is 'hd720'.
  16284. @item fps
  16285. Set the output frame rate, default is '25'.
  16286. @end table
  16287. Each expression can contain the following constants:
  16288. @table @option
  16289. @item in_w, iw
  16290. Input width.
  16291. @item in_h, ih
  16292. Input height.
  16293. @item out_w, ow
  16294. Output width.
  16295. @item out_h, oh
  16296. Output height.
  16297. @item in
  16298. Input frame count.
  16299. @item on
  16300. Output frame count.
  16301. @item in_time, it
  16302. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16303. @item out_time, time, ot
  16304. The output timestamp expressed in seconds.
  16305. @item x
  16306. @item y
  16307. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16308. for current input frame.
  16309. @item px
  16310. @item py
  16311. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16312. not yet such frame (first input frame).
  16313. @item zoom
  16314. Last calculated zoom from 'z' expression for current input frame.
  16315. @item pzoom
  16316. Last calculated zoom of last output frame of previous input frame.
  16317. @item duration
  16318. Number of output frames for current input frame. Calculated from 'd' expression
  16319. for each input frame.
  16320. @item pduration
  16321. number of output frames created for previous input frame
  16322. @item a
  16323. Rational number: input width / input height
  16324. @item sar
  16325. sample aspect ratio
  16326. @item dar
  16327. display aspect ratio
  16328. @end table
  16329. @subsection Examples
  16330. @itemize
  16331. @item
  16332. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16333. @example
  16334. 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
  16335. @end example
  16336. @item
  16337. Zoom in up to 1.5x and pan always at center of picture:
  16338. @example
  16339. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16340. @end example
  16341. @item
  16342. Same as above but without pausing:
  16343. @example
  16344. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16345. @end example
  16346. @item
  16347. Zoom in 2x into center of picture only for the first second of the input video:
  16348. @example
  16349. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16350. @end example
  16351. @end itemize
  16352. @anchor{zscale}
  16353. @section zscale
  16354. Scale (resize) the input video, using the z.lib library:
  16355. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16356. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16357. The zscale filter forces the output display aspect ratio to be the same
  16358. as the input, by changing the output sample aspect ratio.
  16359. If the input image format is different from the format requested by
  16360. the next filter, the zscale filter will convert the input to the
  16361. requested format.
  16362. @subsection Options
  16363. The filter accepts the following options.
  16364. @table @option
  16365. @item width, w
  16366. @item height, h
  16367. Set the output video dimension expression. Default value is the input
  16368. dimension.
  16369. If the @var{width} or @var{w} value is 0, the input width is used for
  16370. the output. If the @var{height} or @var{h} value is 0, the input height
  16371. is used for the output.
  16372. If one and only one of the values is -n with n >= 1, the zscale filter
  16373. will use a value that maintains the aspect ratio of the input image,
  16374. calculated from the other specified dimension. After that it will,
  16375. however, make sure that the calculated dimension is divisible by n and
  16376. adjust the value if necessary.
  16377. If both values are -n with n >= 1, the behavior will be identical to
  16378. both values being set to 0 as previously detailed.
  16379. See below for the list of accepted constants for use in the dimension
  16380. expression.
  16381. @item size, s
  16382. Set the video size. For the syntax of this option, check the
  16383. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16384. @item dither, d
  16385. Set the dither type.
  16386. Possible values are:
  16387. @table @var
  16388. @item none
  16389. @item ordered
  16390. @item random
  16391. @item error_diffusion
  16392. @end table
  16393. Default is none.
  16394. @item filter, f
  16395. Set the resize filter type.
  16396. Possible values are:
  16397. @table @var
  16398. @item point
  16399. @item bilinear
  16400. @item bicubic
  16401. @item spline16
  16402. @item spline36
  16403. @item lanczos
  16404. @end table
  16405. Default is bilinear.
  16406. @item range, r
  16407. Set the color range.
  16408. Possible values are:
  16409. @table @var
  16410. @item input
  16411. @item limited
  16412. @item full
  16413. @end table
  16414. Default is same as input.
  16415. @item primaries, p
  16416. Set the color primaries.
  16417. Possible values are:
  16418. @table @var
  16419. @item input
  16420. @item 709
  16421. @item unspecified
  16422. @item 170m
  16423. @item 240m
  16424. @item 2020
  16425. @end table
  16426. Default is same as input.
  16427. @item transfer, t
  16428. Set the transfer characteristics.
  16429. Possible values are:
  16430. @table @var
  16431. @item input
  16432. @item 709
  16433. @item unspecified
  16434. @item 601
  16435. @item linear
  16436. @item 2020_10
  16437. @item 2020_12
  16438. @item smpte2084
  16439. @item iec61966-2-1
  16440. @item arib-std-b67
  16441. @end table
  16442. Default is same as input.
  16443. @item matrix, m
  16444. Set the colorspace matrix.
  16445. Possible value are:
  16446. @table @var
  16447. @item input
  16448. @item 709
  16449. @item unspecified
  16450. @item 470bg
  16451. @item 170m
  16452. @item 2020_ncl
  16453. @item 2020_cl
  16454. @end table
  16455. Default is same as input.
  16456. @item rangein, rin
  16457. Set the input color range.
  16458. Possible values are:
  16459. @table @var
  16460. @item input
  16461. @item limited
  16462. @item full
  16463. @end table
  16464. Default is same as input.
  16465. @item primariesin, pin
  16466. Set the input color primaries.
  16467. Possible values are:
  16468. @table @var
  16469. @item input
  16470. @item 709
  16471. @item unspecified
  16472. @item 170m
  16473. @item 240m
  16474. @item 2020
  16475. @end table
  16476. Default is same as input.
  16477. @item transferin, tin
  16478. Set the input transfer characteristics.
  16479. Possible values are:
  16480. @table @var
  16481. @item input
  16482. @item 709
  16483. @item unspecified
  16484. @item 601
  16485. @item linear
  16486. @item 2020_10
  16487. @item 2020_12
  16488. @end table
  16489. Default is same as input.
  16490. @item matrixin, min
  16491. Set the input colorspace matrix.
  16492. Possible value are:
  16493. @table @var
  16494. @item input
  16495. @item 709
  16496. @item unspecified
  16497. @item 470bg
  16498. @item 170m
  16499. @item 2020_ncl
  16500. @item 2020_cl
  16501. @end table
  16502. @item chromal, c
  16503. Set the output chroma location.
  16504. Possible values are:
  16505. @table @var
  16506. @item input
  16507. @item left
  16508. @item center
  16509. @item topleft
  16510. @item top
  16511. @item bottomleft
  16512. @item bottom
  16513. @end table
  16514. @item chromalin, cin
  16515. Set the input chroma location.
  16516. Possible values are:
  16517. @table @var
  16518. @item input
  16519. @item left
  16520. @item center
  16521. @item topleft
  16522. @item top
  16523. @item bottomleft
  16524. @item bottom
  16525. @end table
  16526. @item npl
  16527. Set the nominal peak luminance.
  16528. @end table
  16529. The values of the @option{w} and @option{h} options are expressions
  16530. containing the following constants:
  16531. @table @var
  16532. @item in_w
  16533. @item in_h
  16534. The input width and height
  16535. @item iw
  16536. @item ih
  16537. These are the same as @var{in_w} and @var{in_h}.
  16538. @item out_w
  16539. @item out_h
  16540. The output (scaled) width and height
  16541. @item ow
  16542. @item oh
  16543. These are the same as @var{out_w} and @var{out_h}
  16544. @item a
  16545. The same as @var{iw} / @var{ih}
  16546. @item sar
  16547. input sample aspect ratio
  16548. @item dar
  16549. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16550. @item hsub
  16551. @item vsub
  16552. horizontal and vertical input chroma subsample values. For example for the
  16553. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16554. @item ohsub
  16555. @item ovsub
  16556. horizontal and vertical output chroma subsample values. For example for the
  16557. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16558. @end table
  16559. @subsection Commands
  16560. This filter supports the following commands:
  16561. @table @option
  16562. @item width, w
  16563. @item height, h
  16564. Set the output video dimension expression.
  16565. The command accepts the same syntax of the corresponding option.
  16566. If the specified expression is not valid, it is kept at its current
  16567. value.
  16568. @end table
  16569. @c man end VIDEO FILTERS
  16570. @chapter OpenCL Video Filters
  16571. @c man begin OPENCL VIDEO FILTERS
  16572. Below is a description of the currently available OpenCL video filters.
  16573. To enable compilation of these filters you need to configure FFmpeg with
  16574. @code{--enable-opencl}.
  16575. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16576. @table @option
  16577. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16578. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16579. given device parameters.
  16580. @item -filter_hw_device @var{name}
  16581. Pass the hardware device called @var{name} to all filters in any filter graph.
  16582. @end table
  16583. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16584. @itemize
  16585. @item
  16586. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16587. @example
  16588. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16589. @end example
  16590. @end itemize
  16591. 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.
  16592. @section avgblur_opencl
  16593. Apply average blur filter.
  16594. The filter accepts the following options:
  16595. @table @option
  16596. @item sizeX
  16597. Set horizontal radius size.
  16598. Range is @code{[1, 1024]} and default value is @code{1}.
  16599. @item planes
  16600. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16601. @item sizeY
  16602. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16603. @end table
  16604. @subsection Example
  16605. @itemize
  16606. @item
  16607. 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.
  16608. @example
  16609. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16610. @end example
  16611. @end itemize
  16612. @section boxblur_opencl
  16613. Apply a boxblur algorithm to the input video.
  16614. It accepts the following parameters:
  16615. @table @option
  16616. @item luma_radius, lr
  16617. @item luma_power, lp
  16618. @item chroma_radius, cr
  16619. @item chroma_power, cp
  16620. @item alpha_radius, ar
  16621. @item alpha_power, ap
  16622. @end table
  16623. A description of the accepted options follows.
  16624. @table @option
  16625. @item luma_radius, lr
  16626. @item chroma_radius, cr
  16627. @item alpha_radius, ar
  16628. Set an expression for the box radius in pixels used for blurring the
  16629. corresponding input plane.
  16630. The radius value must be a non-negative number, and must not be
  16631. greater than the value of the expression @code{min(w,h)/2} for the
  16632. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16633. planes.
  16634. Default value for @option{luma_radius} is "2". If not specified,
  16635. @option{chroma_radius} and @option{alpha_radius} default to the
  16636. corresponding value set for @option{luma_radius}.
  16637. The expressions can contain the following constants:
  16638. @table @option
  16639. @item w
  16640. @item h
  16641. The input width and height in pixels.
  16642. @item cw
  16643. @item ch
  16644. The input chroma image width and height in pixels.
  16645. @item hsub
  16646. @item vsub
  16647. The horizontal and vertical chroma subsample values. For example, for the
  16648. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16649. @end table
  16650. @item luma_power, lp
  16651. @item chroma_power, cp
  16652. @item alpha_power, ap
  16653. Specify how many times the boxblur filter is applied to the
  16654. corresponding plane.
  16655. Default value for @option{luma_power} is 2. If not specified,
  16656. @option{chroma_power} and @option{alpha_power} default to the
  16657. corresponding value set for @option{luma_power}.
  16658. A value of 0 will disable the effect.
  16659. @end table
  16660. @subsection Examples
  16661. 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.
  16662. @itemize
  16663. @item
  16664. Apply a boxblur filter with the luma, chroma, and alpha radius
  16665. 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.
  16666. @example
  16667. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16668. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16669. @end example
  16670. @item
  16671. 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.
  16672. For the luma plane, a 2x2 box radius will be run once.
  16673. For the chroma plane, a 4x4 box radius will be run 5 times.
  16674. For the alpha plane, a 3x3 box radius will be run 7 times.
  16675. @example
  16676. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16677. @end example
  16678. @end itemize
  16679. @section colorkey_opencl
  16680. RGB colorspace color keying.
  16681. The filter accepts the following options:
  16682. @table @option
  16683. @item color
  16684. The color which will be replaced with transparency.
  16685. @item similarity
  16686. Similarity percentage with the key color.
  16687. 0.01 matches only the exact key color, while 1.0 matches everything.
  16688. @item blend
  16689. Blend percentage.
  16690. 0.0 makes pixels either fully transparent, or not transparent at all.
  16691. Higher values result in semi-transparent pixels, with a higher transparency
  16692. the more similar the pixels color is to the key color.
  16693. @end table
  16694. @subsection Examples
  16695. @itemize
  16696. @item
  16697. Make every semi-green pixel in the input transparent with some slight blending:
  16698. @example
  16699. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16700. @end example
  16701. @end itemize
  16702. @section convolution_opencl
  16703. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16704. The filter accepts the following options:
  16705. @table @option
  16706. @item 0m
  16707. @item 1m
  16708. @item 2m
  16709. @item 3m
  16710. Set matrix for each plane.
  16711. Matrix is sequence of 9, 25 or 49 signed numbers.
  16712. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16713. @item 0rdiv
  16714. @item 1rdiv
  16715. @item 2rdiv
  16716. @item 3rdiv
  16717. Set multiplier for calculated value for each plane.
  16718. If unset or 0, it will be sum of all matrix elements.
  16719. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16720. @item 0bias
  16721. @item 1bias
  16722. @item 2bias
  16723. @item 3bias
  16724. Set bias for each plane. This value is added to the result of the multiplication.
  16725. Useful for making the overall image brighter or darker.
  16726. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16727. @end table
  16728. @subsection Examples
  16729. @itemize
  16730. @item
  16731. Apply sharpen:
  16732. @example
  16733. -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
  16734. @end example
  16735. @item
  16736. Apply blur:
  16737. @example
  16738. -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
  16739. @end example
  16740. @item
  16741. Apply edge enhance:
  16742. @example
  16743. -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
  16744. @end example
  16745. @item
  16746. Apply edge detect:
  16747. @example
  16748. -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
  16749. @end example
  16750. @item
  16751. Apply laplacian edge detector which includes diagonals:
  16752. @example
  16753. -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
  16754. @end example
  16755. @item
  16756. Apply emboss:
  16757. @example
  16758. -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
  16759. @end example
  16760. @end itemize
  16761. @section erosion_opencl
  16762. Apply erosion effect to the video.
  16763. This filter replaces the pixel by the local(3x3) minimum.
  16764. It accepts the following options:
  16765. @table @option
  16766. @item threshold0
  16767. @item threshold1
  16768. @item threshold2
  16769. @item threshold3
  16770. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16771. If @code{0}, plane will remain unchanged.
  16772. @item coordinates
  16773. Flag which specifies the pixel to refer to.
  16774. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16775. Flags to local 3x3 coordinates region centered on @code{x}:
  16776. 1 2 3
  16777. 4 x 5
  16778. 6 7 8
  16779. @end table
  16780. @subsection Example
  16781. @itemize
  16782. @item
  16783. 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.
  16784. @example
  16785. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16786. @end example
  16787. @end itemize
  16788. @section deshake_opencl
  16789. Feature-point based video stabilization filter.
  16790. The filter accepts the following options:
  16791. @table @option
  16792. @item tripod
  16793. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16794. @item debug
  16795. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16796. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16797. Viewing point matches in the output video is only supported for RGB input.
  16798. Defaults to @code{0}.
  16799. @item adaptive_crop
  16800. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16801. Defaults to @code{1}.
  16802. @item refine_features
  16803. Whether or not feature points should be refined at a sub-pixel level.
  16804. This can be turned off for a slight performance gain at the cost of precision.
  16805. Defaults to @code{1}.
  16806. @item smooth_strength
  16807. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16808. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16809. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16810. Defaults to @code{0.0}.
  16811. @item smooth_window_multiplier
  16812. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16813. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16814. Acceptable values range from @code{0.1} to @code{10.0}.
  16815. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16816. potentially improving smoothness, but also increase latency and memory usage.
  16817. Defaults to @code{2.0}.
  16818. @end table
  16819. @subsection Examples
  16820. @itemize
  16821. @item
  16822. Stabilize a video with a fixed, medium smoothing strength:
  16823. @example
  16824. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16825. @end example
  16826. @item
  16827. Stabilize a video with debugging (both in console and in rendered video):
  16828. @example
  16829. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16830. @end example
  16831. @end itemize
  16832. @section dilation_opencl
  16833. Apply dilation effect to the video.
  16834. This filter replaces the pixel by the local(3x3) maximum.
  16835. It accepts the following options:
  16836. @table @option
  16837. @item threshold0
  16838. @item threshold1
  16839. @item threshold2
  16840. @item threshold3
  16841. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16842. If @code{0}, plane will remain unchanged.
  16843. @item coordinates
  16844. Flag which specifies the pixel to refer to.
  16845. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16846. Flags to local 3x3 coordinates region centered on @code{x}:
  16847. 1 2 3
  16848. 4 x 5
  16849. 6 7 8
  16850. @end table
  16851. @subsection Example
  16852. @itemize
  16853. @item
  16854. 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.
  16855. @example
  16856. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16857. @end example
  16858. @end itemize
  16859. @section nlmeans_opencl
  16860. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16861. @section overlay_opencl
  16862. Overlay one video on top of another.
  16863. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16864. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16865. The filter accepts the following options:
  16866. @table @option
  16867. @item x
  16868. Set the x coordinate of the overlaid video on the main video.
  16869. Default value is @code{0}.
  16870. @item y
  16871. Set the y coordinate of the overlaid video on the main video.
  16872. Default value is @code{0}.
  16873. @end table
  16874. @subsection Examples
  16875. @itemize
  16876. @item
  16877. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16878. @example
  16879. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16880. @end example
  16881. @item
  16882. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16883. @example
  16884. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16885. @end example
  16886. @end itemize
  16887. @section pad_opencl
  16888. Add paddings to the input image, and place the original input at the
  16889. provided @var{x}, @var{y} coordinates.
  16890. It accepts the following options:
  16891. @table @option
  16892. @item width, w
  16893. @item height, h
  16894. Specify an expression for the size of the output image with the
  16895. paddings added. If the value for @var{width} or @var{height} is 0, the
  16896. corresponding input size is used for the output.
  16897. The @var{width} expression can reference the value set by the
  16898. @var{height} expression, and vice versa.
  16899. The default value of @var{width} and @var{height} is 0.
  16900. @item x
  16901. @item y
  16902. Specify the offsets to place the input image at within the padded area,
  16903. with respect to the top/left border of the output image.
  16904. The @var{x} expression can reference the value set by the @var{y}
  16905. expression, and vice versa.
  16906. The default value of @var{x} and @var{y} is 0.
  16907. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16908. so the input image is centered on the padded area.
  16909. @item color
  16910. Specify the color of the padded area. For the syntax of this option,
  16911. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16912. manual,ffmpeg-utils}.
  16913. @item aspect
  16914. Pad to an aspect instead to a resolution.
  16915. @end table
  16916. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16917. options are expressions containing the following constants:
  16918. @table @option
  16919. @item in_w
  16920. @item in_h
  16921. The input video width and height.
  16922. @item iw
  16923. @item ih
  16924. These are the same as @var{in_w} and @var{in_h}.
  16925. @item out_w
  16926. @item out_h
  16927. The output width and height (the size of the padded area), as
  16928. specified by the @var{width} and @var{height} expressions.
  16929. @item ow
  16930. @item oh
  16931. These are the same as @var{out_w} and @var{out_h}.
  16932. @item x
  16933. @item y
  16934. The x and y offsets as specified by the @var{x} and @var{y}
  16935. expressions, or NAN if not yet specified.
  16936. @item a
  16937. same as @var{iw} / @var{ih}
  16938. @item sar
  16939. input sample aspect ratio
  16940. @item dar
  16941. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16942. @end table
  16943. @section prewitt_opencl
  16944. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16945. The filter accepts the following option:
  16946. @table @option
  16947. @item planes
  16948. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16949. @item scale
  16950. Set value which will be multiplied with filtered result.
  16951. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16952. @item delta
  16953. Set value which will be added to filtered result.
  16954. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16955. @end table
  16956. @subsection Example
  16957. @itemize
  16958. @item
  16959. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16960. @example
  16961. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16962. @end example
  16963. @end itemize
  16964. @anchor{program_opencl}
  16965. @section program_opencl
  16966. Filter video using an OpenCL program.
  16967. @table @option
  16968. @item source
  16969. OpenCL program source file.
  16970. @item kernel
  16971. Kernel name in program.
  16972. @item inputs
  16973. Number of inputs to the filter. Defaults to 1.
  16974. @item size, s
  16975. Size of output frames. Defaults to the same as the first input.
  16976. @end table
  16977. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16978. The program source file must contain a kernel function with the given name,
  16979. which will be run once for each plane of the output. Each run on a plane
  16980. gets enqueued as a separate 2D global NDRange with one work-item for each
  16981. pixel to be generated. The global ID offset for each work-item is therefore
  16982. the coordinates of a pixel in the destination image.
  16983. The kernel function needs to take the following arguments:
  16984. @itemize
  16985. @item
  16986. Destination image, @var{__write_only image2d_t}.
  16987. This image will become the output; the kernel should write all of it.
  16988. @item
  16989. Frame index, @var{unsigned int}.
  16990. This is a counter starting from zero and increasing by one for each frame.
  16991. @item
  16992. Source images, @var{__read_only image2d_t}.
  16993. These are the most recent images on each input. The kernel may read from
  16994. them to generate the output, but they can't be written to.
  16995. @end itemize
  16996. Example programs:
  16997. @itemize
  16998. @item
  16999. Copy the input to the output (output must be the same size as the input).
  17000. @verbatim
  17001. __kernel void copy(__write_only image2d_t destination,
  17002. unsigned int index,
  17003. __read_only image2d_t source)
  17004. {
  17005. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17006. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17007. float4 value = read_imagef(source, sampler, location);
  17008. write_imagef(destination, location, value);
  17009. }
  17010. @end verbatim
  17011. @item
  17012. Apply a simple transformation, rotating the input by an amount increasing
  17013. with the index counter. Pixel values are linearly interpolated by the
  17014. sampler, and the output need not have the same dimensions as the input.
  17015. @verbatim
  17016. __kernel void rotate_image(__write_only image2d_t dst,
  17017. unsigned int index,
  17018. __read_only image2d_t src)
  17019. {
  17020. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17021. CLK_FILTER_LINEAR);
  17022. float angle = (float)index / 100.0f;
  17023. float2 dst_dim = convert_float2(get_image_dim(dst));
  17024. float2 src_dim = convert_float2(get_image_dim(src));
  17025. float2 dst_cen = dst_dim / 2.0f;
  17026. float2 src_cen = src_dim / 2.0f;
  17027. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17028. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17029. float2 src_pos = {
  17030. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17031. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17032. };
  17033. src_pos = src_pos * src_dim / dst_dim;
  17034. float2 src_loc = src_pos + src_cen;
  17035. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17036. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17037. write_imagef(dst, dst_loc, 0.5f);
  17038. else
  17039. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17040. }
  17041. @end verbatim
  17042. @item
  17043. Blend two inputs together, with the amount of each input used varying
  17044. with the index counter.
  17045. @verbatim
  17046. __kernel void blend_images(__write_only image2d_t dst,
  17047. unsigned int index,
  17048. __read_only image2d_t src1,
  17049. __read_only image2d_t src2)
  17050. {
  17051. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17052. CLK_FILTER_LINEAR);
  17053. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17054. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17055. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17056. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17057. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17058. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17059. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17060. }
  17061. @end verbatim
  17062. @end itemize
  17063. @section roberts_opencl
  17064. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17065. The filter accepts the following option:
  17066. @table @option
  17067. @item planes
  17068. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17069. @item scale
  17070. Set value which will be multiplied with filtered result.
  17071. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17072. @item delta
  17073. Set value which will be added to filtered result.
  17074. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17075. @end table
  17076. @subsection Example
  17077. @itemize
  17078. @item
  17079. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17080. @example
  17081. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17082. @end example
  17083. @end itemize
  17084. @section sobel_opencl
  17085. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17086. The filter accepts the following option:
  17087. @table @option
  17088. @item planes
  17089. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17090. @item scale
  17091. Set value which will be multiplied with filtered result.
  17092. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17093. @item delta
  17094. Set value which will be added to filtered result.
  17095. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17096. @end table
  17097. @subsection Example
  17098. @itemize
  17099. @item
  17100. Apply sobel operator with scale set to 2 and delta set to 10
  17101. @example
  17102. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17103. @end example
  17104. @end itemize
  17105. @section tonemap_opencl
  17106. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17107. It accepts the following parameters:
  17108. @table @option
  17109. @item tonemap
  17110. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17111. @item param
  17112. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17113. @item desat
  17114. Apply desaturation for highlights that exceed this level of brightness. The
  17115. higher the parameter, the more color information will be preserved. This
  17116. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17117. (smoothly) turning into white instead. This makes images feel more natural,
  17118. at the cost of reducing information about out-of-range colors.
  17119. The default value is 0.5, and the algorithm here is a little different from
  17120. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17121. @item threshold
  17122. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17123. is used to detect whether the scene has changed or not. If the distance between
  17124. the current frame average brightness and the current running average exceeds
  17125. a threshold value, we would re-calculate scene average and peak brightness.
  17126. The default value is 0.2.
  17127. @item format
  17128. Specify the output pixel format.
  17129. Currently supported formats are:
  17130. @table @var
  17131. @item p010
  17132. @item nv12
  17133. @end table
  17134. @item range, r
  17135. Set the output color range.
  17136. Possible values are:
  17137. @table @var
  17138. @item tv/mpeg
  17139. @item pc/jpeg
  17140. @end table
  17141. Default is same as input.
  17142. @item primaries, p
  17143. Set the output color primaries.
  17144. Possible values are:
  17145. @table @var
  17146. @item bt709
  17147. @item bt2020
  17148. @end table
  17149. Default is same as input.
  17150. @item transfer, t
  17151. Set the output transfer characteristics.
  17152. Possible values are:
  17153. @table @var
  17154. @item bt709
  17155. @item bt2020
  17156. @end table
  17157. Default is bt709.
  17158. @item matrix, m
  17159. Set the output colorspace matrix.
  17160. Possible value are:
  17161. @table @var
  17162. @item bt709
  17163. @item bt2020
  17164. @end table
  17165. Default is same as input.
  17166. @end table
  17167. @subsection Example
  17168. @itemize
  17169. @item
  17170. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17171. @example
  17172. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17173. @end example
  17174. @end itemize
  17175. @section unsharp_opencl
  17176. Sharpen or blur the input video.
  17177. It accepts the following parameters:
  17178. @table @option
  17179. @item luma_msize_x, lx
  17180. Set the luma matrix horizontal size.
  17181. Range is @code{[1, 23]} and default value is @code{5}.
  17182. @item luma_msize_y, ly
  17183. Set the luma matrix vertical size.
  17184. Range is @code{[1, 23]} and default value is @code{5}.
  17185. @item luma_amount, la
  17186. Set the luma effect strength.
  17187. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17188. Negative values will blur the input video, while positive values will
  17189. sharpen it, a value of zero will disable the effect.
  17190. @item chroma_msize_x, cx
  17191. Set the chroma matrix horizontal size.
  17192. Range is @code{[1, 23]} and default value is @code{5}.
  17193. @item chroma_msize_y, cy
  17194. Set the chroma matrix vertical size.
  17195. Range is @code{[1, 23]} and default value is @code{5}.
  17196. @item chroma_amount, ca
  17197. Set the chroma effect strength.
  17198. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17199. Negative values will blur the input video, while positive values will
  17200. sharpen it, a value of zero will disable the effect.
  17201. @end table
  17202. All parameters are optional and default to the equivalent of the
  17203. string '5:5:1.0:5:5:0.0'.
  17204. @subsection Examples
  17205. @itemize
  17206. @item
  17207. Apply strong luma sharpen effect:
  17208. @example
  17209. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17210. @end example
  17211. @item
  17212. Apply a strong blur of both luma and chroma parameters:
  17213. @example
  17214. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17215. @end example
  17216. @end itemize
  17217. @section xfade_opencl
  17218. Cross fade two videos with custom transition effect by using OpenCL.
  17219. It accepts the following options:
  17220. @table @option
  17221. @item transition
  17222. Set one of possible transition effects.
  17223. @table @option
  17224. @item custom
  17225. Select custom transition effect, the actual transition description
  17226. will be picked from source and kernel options.
  17227. @item fade
  17228. @item wipeleft
  17229. @item wiperight
  17230. @item wipeup
  17231. @item wipedown
  17232. @item slideleft
  17233. @item slideright
  17234. @item slideup
  17235. @item slidedown
  17236. Default transition is fade.
  17237. @end table
  17238. @item source
  17239. OpenCL program source file for custom transition.
  17240. @item kernel
  17241. Set name of kernel to use for custom transition from program source file.
  17242. @item duration
  17243. Set duration of video transition.
  17244. @item offset
  17245. Set time of start of transition relative to first video.
  17246. @end table
  17247. The program source file must contain a kernel function with the given name,
  17248. which will be run once for each plane of the output. Each run on a plane
  17249. gets enqueued as a separate 2D global NDRange with one work-item for each
  17250. pixel to be generated. The global ID offset for each work-item is therefore
  17251. the coordinates of a pixel in the destination image.
  17252. The kernel function needs to take the following arguments:
  17253. @itemize
  17254. @item
  17255. Destination image, @var{__write_only image2d_t}.
  17256. This image will become the output; the kernel should write all of it.
  17257. @item
  17258. First Source image, @var{__read_only image2d_t}.
  17259. Second Source image, @var{__read_only image2d_t}.
  17260. These are the most recent images on each input. The kernel may read from
  17261. them to generate the output, but they can't be written to.
  17262. @item
  17263. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17264. @end itemize
  17265. Example programs:
  17266. @itemize
  17267. @item
  17268. Apply dots curtain transition effect:
  17269. @verbatim
  17270. __kernel void blend_images(__write_only image2d_t dst,
  17271. __read_only image2d_t src1,
  17272. __read_only image2d_t src2,
  17273. float progress)
  17274. {
  17275. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17276. CLK_FILTER_LINEAR);
  17277. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17278. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17279. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17280. rp = rp / dim;
  17281. float2 dots = (float2)(20.0, 20.0);
  17282. float2 center = (float2)(0,0);
  17283. float2 unused;
  17284. float4 val1 = read_imagef(src1, sampler, p);
  17285. float4 val2 = read_imagef(src2, sampler, p);
  17286. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17287. write_imagef(dst, p, next ? val1 : val2);
  17288. }
  17289. @end verbatim
  17290. @end itemize
  17291. @c man end OPENCL VIDEO FILTERS
  17292. @chapter VAAPI Video Filters
  17293. @c man begin VAAPI VIDEO FILTERS
  17294. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17295. To enable compilation of these filters you need to configure FFmpeg with
  17296. @code{--enable-vaapi}.
  17297. 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}
  17298. @section tonemap_vaapi
  17299. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17300. It maps the dynamic range of HDR10 content to the SDR content.
  17301. It currently only accepts HDR10 as input.
  17302. It accepts the following parameters:
  17303. @table @option
  17304. @item format
  17305. Specify the output pixel format.
  17306. Currently supported formats are:
  17307. @table @var
  17308. @item p010
  17309. @item nv12
  17310. @end table
  17311. Default is nv12.
  17312. @item primaries, p
  17313. Set the output color primaries.
  17314. Default is same as input.
  17315. @item transfer, t
  17316. Set the output transfer characteristics.
  17317. Default is bt709.
  17318. @item matrix, m
  17319. Set the output colorspace matrix.
  17320. Default is same as input.
  17321. @end table
  17322. @subsection Example
  17323. @itemize
  17324. @item
  17325. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17326. @example
  17327. tonemap_vaapi=format=p010:t=bt2020-10
  17328. @end example
  17329. @end itemize
  17330. @c man end VAAPI VIDEO FILTERS
  17331. @chapter Video Sources
  17332. @c man begin VIDEO SOURCES
  17333. Below is a description of the currently available video sources.
  17334. @section buffer
  17335. Buffer video frames, and make them available to the filter chain.
  17336. This source is mainly intended for a programmatic use, in particular
  17337. through the interface defined in @file{libavfilter/buffersrc.h}.
  17338. It accepts the following parameters:
  17339. @table @option
  17340. @item video_size
  17341. Specify the size (width and height) of the buffered video frames. For the
  17342. syntax of this option, check the
  17343. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17344. @item width
  17345. The input video width.
  17346. @item height
  17347. The input video height.
  17348. @item pix_fmt
  17349. A string representing the pixel format of the buffered video frames.
  17350. It may be a number corresponding to a pixel format, or a pixel format
  17351. name.
  17352. @item time_base
  17353. Specify the timebase assumed by the timestamps of the buffered frames.
  17354. @item frame_rate
  17355. Specify the frame rate expected for the video stream.
  17356. @item pixel_aspect, sar
  17357. The sample (pixel) aspect ratio of the input video.
  17358. @item sws_param
  17359. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17360. to the filtergraph description to specify swscale flags for automatically
  17361. inserted scalers. See @ref{Filtergraph syntax}.
  17362. @item hw_frames_ctx
  17363. When using a hardware pixel format, this should be a reference to an
  17364. AVHWFramesContext describing input frames.
  17365. @end table
  17366. For example:
  17367. @example
  17368. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17369. @end example
  17370. will instruct the source to accept video frames with size 320x240 and
  17371. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17372. square pixels (1:1 sample aspect ratio).
  17373. Since the pixel format with name "yuv410p" corresponds to the number 6
  17374. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17375. this example corresponds to:
  17376. @example
  17377. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17378. @end example
  17379. Alternatively, the options can be specified as a flat string, but this
  17380. syntax is deprecated:
  17381. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17382. @section cellauto
  17383. Create a pattern generated by an elementary cellular automaton.
  17384. The initial state of the cellular automaton can be defined through the
  17385. @option{filename} and @option{pattern} options. If such options are
  17386. not specified an initial state is created randomly.
  17387. At each new frame a new row in the video is filled with the result of
  17388. the cellular automaton next generation. The behavior when the whole
  17389. frame is filled is defined by the @option{scroll} option.
  17390. This source accepts the following options:
  17391. @table @option
  17392. @item filename, f
  17393. Read the initial cellular automaton state, i.e. the starting row, from
  17394. the specified file.
  17395. In the file, each non-whitespace character is considered an alive
  17396. cell, a newline will terminate the row, and further characters in the
  17397. file will be ignored.
  17398. @item pattern, p
  17399. Read the initial cellular automaton state, i.e. the starting row, from
  17400. the specified string.
  17401. Each non-whitespace character in the string is considered an alive
  17402. cell, a newline will terminate the row, and further characters in the
  17403. string will be ignored.
  17404. @item rate, r
  17405. Set the video rate, that is the number of frames generated per second.
  17406. Default is 25.
  17407. @item random_fill_ratio, ratio
  17408. Set the random fill ratio for the initial cellular automaton row. It
  17409. is a floating point number value ranging from 0 to 1, defaults to
  17410. 1/PHI.
  17411. This option is ignored when a file or a pattern is specified.
  17412. @item random_seed, seed
  17413. Set the seed for filling randomly the initial row, must be an integer
  17414. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17415. set to -1, the filter will try to use a good random seed on a best
  17416. effort basis.
  17417. @item rule
  17418. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17419. Default value is 110.
  17420. @item size, s
  17421. Set the size of the output video. For the syntax of this option, check the
  17422. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17423. If @option{filename} or @option{pattern} is specified, the size is set
  17424. by default to the width of the specified initial state row, and the
  17425. height is set to @var{width} * PHI.
  17426. If @option{size} is set, it must contain the width of the specified
  17427. pattern string, and the specified pattern will be centered in the
  17428. larger row.
  17429. If a filename or a pattern string is not specified, the size value
  17430. defaults to "320x518" (used for a randomly generated initial state).
  17431. @item scroll
  17432. If set to 1, scroll the output upward when all the rows in the output
  17433. have been already filled. If set to 0, the new generated row will be
  17434. written over the top row just after the bottom row is filled.
  17435. Defaults to 1.
  17436. @item start_full, full
  17437. If set to 1, completely fill the output with generated rows before
  17438. outputting the first frame.
  17439. This is the default behavior, for disabling set the value to 0.
  17440. @item stitch
  17441. If set to 1, stitch the left and right row edges together.
  17442. This is the default behavior, for disabling set the value to 0.
  17443. @end table
  17444. @subsection Examples
  17445. @itemize
  17446. @item
  17447. Read the initial state from @file{pattern}, and specify an output of
  17448. size 200x400.
  17449. @example
  17450. cellauto=f=pattern:s=200x400
  17451. @end example
  17452. @item
  17453. Generate a random initial row with a width of 200 cells, with a fill
  17454. ratio of 2/3:
  17455. @example
  17456. cellauto=ratio=2/3:s=200x200
  17457. @end example
  17458. @item
  17459. Create a pattern generated by rule 18 starting by a single alive cell
  17460. centered on an initial row with width 100:
  17461. @example
  17462. cellauto=p=@@:s=100x400:full=0:rule=18
  17463. @end example
  17464. @item
  17465. Specify a more elaborated initial pattern:
  17466. @example
  17467. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17468. @end example
  17469. @end itemize
  17470. @anchor{coreimagesrc}
  17471. @section coreimagesrc
  17472. Video source generated on GPU using Apple's CoreImage API on OSX.
  17473. This video source is a specialized version of the @ref{coreimage} video filter.
  17474. Use a core image generator at the beginning of the applied filterchain to
  17475. generate the content.
  17476. The coreimagesrc video source accepts the following options:
  17477. @table @option
  17478. @item list_generators
  17479. List all available generators along with all their respective options as well as
  17480. possible minimum and maximum values along with the default values.
  17481. @example
  17482. list_generators=true
  17483. @end example
  17484. @item size, s
  17485. Specify the size of the sourced video. For the syntax of this option, check the
  17486. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17487. The default value is @code{320x240}.
  17488. @item rate, r
  17489. Specify the frame rate of the sourced video, as the number of frames
  17490. generated per second. It has to be a string in the format
  17491. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17492. number or a valid video frame rate abbreviation. The default value is
  17493. "25".
  17494. @item sar
  17495. Set the sample aspect ratio of the sourced video.
  17496. @item duration, d
  17497. Set the duration of the sourced video. See
  17498. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17499. for the accepted syntax.
  17500. If not specified, or the expressed duration is negative, the video is
  17501. supposed to be generated forever.
  17502. @end table
  17503. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17504. A complete filterchain can be used for further processing of the
  17505. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17506. and examples for details.
  17507. @subsection Examples
  17508. @itemize
  17509. @item
  17510. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17511. given as complete and escaped command-line for Apple's standard bash shell:
  17512. @example
  17513. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17514. @end example
  17515. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17516. need for a nullsrc video source.
  17517. @end itemize
  17518. @section gradients
  17519. Generate several gradients.
  17520. @table @option
  17521. @item size, s
  17522. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17523. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17524. @item rate, r
  17525. Set frame rate, expressed as number of frames per second. Default
  17526. value is "25".
  17527. @item c0, c1, c2, c3, c4, c5, c6, c7
  17528. Set 8 colors. Default values for colors is to pick random one.
  17529. @item x0, y0, y0, y1
  17530. Set gradient line source and destination points. If negative or out of range, random ones
  17531. are picked.
  17532. @item nb_colors, n
  17533. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17534. @item seed
  17535. Set seed for picking gradient line points.
  17536. @item duration, d
  17537. Set the duration of the sourced video. See
  17538. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17539. for the accepted syntax.
  17540. If not specified, or the expressed duration is negative, the video is
  17541. supposed to be generated forever.
  17542. @item speed
  17543. Set speed of gradients rotation.
  17544. @end table
  17545. @section mandelbrot
  17546. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17547. point specified with @var{start_x} and @var{start_y}.
  17548. This source accepts the following options:
  17549. @table @option
  17550. @item end_pts
  17551. Set the terminal pts value. Default value is 400.
  17552. @item end_scale
  17553. Set the terminal scale value.
  17554. Must be a floating point value. Default value is 0.3.
  17555. @item inner
  17556. Set the inner coloring mode, that is the algorithm used to draw the
  17557. Mandelbrot fractal internal region.
  17558. It shall assume one of the following values:
  17559. @table @option
  17560. @item black
  17561. Set black mode.
  17562. @item convergence
  17563. Show time until convergence.
  17564. @item mincol
  17565. Set color based on point closest to the origin of the iterations.
  17566. @item period
  17567. Set period mode.
  17568. @end table
  17569. Default value is @var{mincol}.
  17570. @item bailout
  17571. Set the bailout value. Default value is 10.0.
  17572. @item maxiter
  17573. Set the maximum of iterations performed by the rendering
  17574. algorithm. Default value is 7189.
  17575. @item outer
  17576. Set outer coloring mode.
  17577. It shall assume one of following values:
  17578. @table @option
  17579. @item iteration_count
  17580. Set iteration count mode.
  17581. @item normalized_iteration_count
  17582. set normalized iteration count mode.
  17583. @end table
  17584. Default value is @var{normalized_iteration_count}.
  17585. @item rate, r
  17586. Set frame rate, expressed as number of frames per second. Default
  17587. value is "25".
  17588. @item size, s
  17589. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17590. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17591. @item start_scale
  17592. Set the initial scale value. Default value is 3.0.
  17593. @item start_x
  17594. Set the initial x position. Must be a floating point value between
  17595. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17596. @item start_y
  17597. Set the initial y position. Must be a floating point value between
  17598. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17599. @end table
  17600. @section mptestsrc
  17601. Generate various test patterns, as generated by the MPlayer test filter.
  17602. The size of the generated video is fixed, and is 256x256.
  17603. This source is useful in particular for testing encoding features.
  17604. This source accepts the following options:
  17605. @table @option
  17606. @item rate, r
  17607. Specify the frame rate of the sourced video, as the number of frames
  17608. generated per second. It has to be a string in the format
  17609. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17610. number or a valid video frame rate abbreviation. The default value is
  17611. "25".
  17612. @item duration, d
  17613. Set the duration of the sourced video. See
  17614. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17615. for the accepted syntax.
  17616. If not specified, or the expressed duration is negative, the video is
  17617. supposed to be generated forever.
  17618. @item test, t
  17619. Set the number or the name of the test to perform. Supported tests are:
  17620. @table @option
  17621. @item dc_luma
  17622. @item dc_chroma
  17623. @item freq_luma
  17624. @item freq_chroma
  17625. @item amp_luma
  17626. @item amp_chroma
  17627. @item cbp
  17628. @item mv
  17629. @item ring1
  17630. @item ring2
  17631. @item all
  17632. @item max_frames, m
  17633. Set the maximum number of frames generated for each test, default value is 30.
  17634. @end table
  17635. Default value is "all", which will cycle through the list of all tests.
  17636. @end table
  17637. Some examples:
  17638. @example
  17639. mptestsrc=t=dc_luma
  17640. @end example
  17641. will generate a "dc_luma" test pattern.
  17642. @section frei0r_src
  17643. Provide a frei0r source.
  17644. To enable compilation of this filter you need to install the frei0r
  17645. header and configure FFmpeg with @code{--enable-frei0r}.
  17646. This source accepts the following parameters:
  17647. @table @option
  17648. @item size
  17649. The size of the video to generate. For the syntax of this option, check the
  17650. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17651. @item framerate
  17652. The framerate of the generated video. It may be a string of the form
  17653. @var{num}/@var{den} or a frame rate abbreviation.
  17654. @item filter_name
  17655. The name to the frei0r source to load. For more information regarding frei0r and
  17656. how to set the parameters, read the @ref{frei0r} section in the video filters
  17657. documentation.
  17658. @item filter_params
  17659. A '|'-separated list of parameters to pass to the frei0r source.
  17660. @end table
  17661. For example, to generate a frei0r partik0l source with size 200x200
  17662. and frame rate 10 which is overlaid on the overlay filter main input:
  17663. @example
  17664. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17665. @end example
  17666. @section life
  17667. Generate a life pattern.
  17668. This source is based on a generalization of John Conway's life game.
  17669. The sourced input represents a life grid, each pixel represents a cell
  17670. which can be in one of two possible states, alive or dead. Every cell
  17671. interacts with its eight neighbours, which are the cells that are
  17672. horizontally, vertically, or diagonally adjacent.
  17673. At each interaction the grid evolves according to the adopted rule,
  17674. which specifies the number of neighbor alive cells which will make a
  17675. cell stay alive or born. The @option{rule} option allows one to specify
  17676. the rule to adopt.
  17677. This source accepts the following options:
  17678. @table @option
  17679. @item filename, f
  17680. Set the file from which to read the initial grid state. In the file,
  17681. each non-whitespace character is considered an alive cell, and newline
  17682. is used to delimit the end of each row.
  17683. If this option is not specified, the initial grid is generated
  17684. randomly.
  17685. @item rate, r
  17686. Set the video rate, that is the number of frames generated per second.
  17687. Default is 25.
  17688. @item random_fill_ratio, ratio
  17689. Set the random fill ratio for the initial random grid. It is a
  17690. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17691. It is ignored when a file is specified.
  17692. @item random_seed, seed
  17693. Set the seed for filling the initial random grid, must be an integer
  17694. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17695. set to -1, the filter will try to use a good random seed on a best
  17696. effort basis.
  17697. @item rule
  17698. Set the life rule.
  17699. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17700. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17701. @var{NS} specifies the number of alive neighbor cells which make a
  17702. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17703. which make a dead cell to become alive (i.e. to "born").
  17704. "s" and "b" can be used in place of "S" and "B", respectively.
  17705. Alternatively a rule can be specified by an 18-bits integer. The 9
  17706. high order bits are used to encode the next cell state if it is alive
  17707. for each number of neighbor alive cells, the low order bits specify
  17708. the rule for "borning" new cells. Higher order bits encode for an
  17709. higher number of neighbor cells.
  17710. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17711. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17712. Default value is "S23/B3", which is the original Conway's game of life
  17713. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17714. cells, and will born a new cell if there are three alive cells around
  17715. a dead cell.
  17716. @item size, s
  17717. Set the size of the output video. For the syntax of this option, check the
  17718. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17719. If @option{filename} is specified, the size is set by default to the
  17720. same size of the input file. If @option{size} is set, it must contain
  17721. the size specified in the input file, and the initial grid defined in
  17722. that file is centered in the larger resulting area.
  17723. If a filename is not specified, the size value defaults to "320x240"
  17724. (used for a randomly generated initial grid).
  17725. @item stitch
  17726. If set to 1, stitch the left and right grid edges together, and the
  17727. top and bottom edges also. Defaults to 1.
  17728. @item mold
  17729. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17730. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17731. value from 0 to 255.
  17732. @item life_color
  17733. Set the color of living (or new born) cells.
  17734. @item death_color
  17735. Set the color of dead cells. If @option{mold} is set, this is the first color
  17736. used to represent a dead cell.
  17737. @item mold_color
  17738. Set mold color, for definitely dead and moldy cells.
  17739. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17740. ffmpeg-utils manual,ffmpeg-utils}.
  17741. @end table
  17742. @subsection Examples
  17743. @itemize
  17744. @item
  17745. Read a grid from @file{pattern}, and center it on a grid of size
  17746. 300x300 pixels:
  17747. @example
  17748. life=f=pattern:s=300x300
  17749. @end example
  17750. @item
  17751. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17752. @example
  17753. life=ratio=2/3:s=200x200
  17754. @end example
  17755. @item
  17756. Specify a custom rule for evolving a randomly generated grid:
  17757. @example
  17758. life=rule=S14/B34
  17759. @end example
  17760. @item
  17761. Full example with slow death effect (mold) using @command{ffplay}:
  17762. @example
  17763. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17764. @end example
  17765. @end itemize
  17766. @anchor{allrgb}
  17767. @anchor{allyuv}
  17768. @anchor{color}
  17769. @anchor{haldclutsrc}
  17770. @anchor{nullsrc}
  17771. @anchor{pal75bars}
  17772. @anchor{pal100bars}
  17773. @anchor{rgbtestsrc}
  17774. @anchor{smptebars}
  17775. @anchor{smptehdbars}
  17776. @anchor{testsrc}
  17777. @anchor{testsrc2}
  17778. @anchor{yuvtestsrc}
  17779. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17780. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17781. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17782. The @code{color} source provides an uniformly colored input.
  17783. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17784. @ref{haldclut} filter.
  17785. The @code{nullsrc} source returns unprocessed video frames. It is
  17786. mainly useful to be employed in analysis / debugging tools, or as the
  17787. source for filters which ignore the input data.
  17788. The @code{pal75bars} source generates a color bars pattern, based on
  17789. EBU PAL recommendations with 75% color levels.
  17790. The @code{pal100bars} source generates a color bars pattern, based on
  17791. EBU PAL recommendations with 100% color levels.
  17792. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17793. detecting RGB vs BGR issues. You should see a red, green and blue
  17794. stripe from top to bottom.
  17795. The @code{smptebars} source generates a color bars pattern, based on
  17796. the SMPTE Engineering Guideline EG 1-1990.
  17797. The @code{smptehdbars} source generates a color bars pattern, based on
  17798. the SMPTE RP 219-2002.
  17799. The @code{testsrc} source generates a test video pattern, showing a
  17800. color pattern, a scrolling gradient and a timestamp. This is mainly
  17801. intended for testing purposes.
  17802. The @code{testsrc2} source is similar to testsrc, but supports more
  17803. pixel formats instead of just @code{rgb24}. This allows using it as an
  17804. input for other tests without requiring a format conversion.
  17805. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17806. see a y, cb and cr stripe from top to bottom.
  17807. The sources accept the following parameters:
  17808. @table @option
  17809. @item level
  17810. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17811. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17812. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17813. coded on a @code{1/(N*N)} scale.
  17814. @item color, c
  17815. Specify the color of the source, only available in the @code{color}
  17816. source. For the syntax of this option, check the
  17817. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17818. @item size, s
  17819. Specify the size of the sourced video. For the syntax of this option, check the
  17820. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17821. The default value is @code{320x240}.
  17822. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17823. @code{haldclutsrc} filters.
  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. Since the frame rate is used as time base, all frames including the last one
  17837. will have their full duration. If the specified duration is not a multiple
  17838. of the frame duration, it will be rounded up.
  17839. @item sar
  17840. Set the sample aspect ratio of the sourced video.
  17841. @item alpha
  17842. Specify the alpha (opacity) of the background, only available in the
  17843. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17844. 255 (fully opaque, the default).
  17845. @item decimals, n
  17846. Set the number of decimals to show in the timestamp, only available in the
  17847. @code{testsrc} source.
  17848. The displayed timestamp value will correspond to the original
  17849. timestamp value multiplied by the power of 10 of the specified
  17850. value. Default value is 0.
  17851. @end table
  17852. @subsection Examples
  17853. @itemize
  17854. @item
  17855. Generate a video with a duration of 5.3 seconds, with size
  17856. 176x144 and a frame rate of 10 frames per second:
  17857. @example
  17858. testsrc=duration=5.3:size=qcif:rate=10
  17859. @end example
  17860. @item
  17861. The following graph description will generate a red source
  17862. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17863. frames per second:
  17864. @example
  17865. color=c=red@@0.2:s=qcif:r=10
  17866. @end example
  17867. @item
  17868. If the input content is to be ignored, @code{nullsrc} can be used. The
  17869. following command generates noise in the luminance plane by employing
  17870. the @code{geq} filter:
  17871. @example
  17872. nullsrc=s=256x256, geq=random(1)*255:128:128
  17873. @end example
  17874. @end itemize
  17875. @subsection Commands
  17876. The @code{color} source supports the following commands:
  17877. @table @option
  17878. @item c, color
  17879. Set the color of the created image. Accepts the same syntax of the
  17880. corresponding @option{color} option.
  17881. @end table
  17882. @section openclsrc
  17883. Generate video using an OpenCL program.
  17884. @table @option
  17885. @item source
  17886. OpenCL program source file.
  17887. @item kernel
  17888. Kernel name in program.
  17889. @item size, s
  17890. Size of frames to generate. This must be set.
  17891. @item format
  17892. Pixel format to use for the generated frames. This must be set.
  17893. @item rate, r
  17894. Number of frames generated every second. Default value is '25'.
  17895. @end table
  17896. For details of how the program loading works, see the @ref{program_opencl}
  17897. filter.
  17898. Example programs:
  17899. @itemize
  17900. @item
  17901. Generate a colour ramp by setting pixel values from the position of the pixel
  17902. in the output image. (Note that this will work with all pixel formats, but
  17903. the generated output will not be the same.)
  17904. @verbatim
  17905. __kernel void ramp(__write_only image2d_t dst,
  17906. unsigned int index)
  17907. {
  17908. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17909. float4 val;
  17910. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17911. write_imagef(dst, loc, val);
  17912. }
  17913. @end verbatim
  17914. @item
  17915. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17916. @verbatim
  17917. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17918. unsigned int index)
  17919. {
  17920. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17921. float4 value = 0.0f;
  17922. int x = loc.x + index;
  17923. int y = loc.y + index;
  17924. while (x > 0 || y > 0) {
  17925. if (x % 3 == 1 && y % 3 == 1) {
  17926. value = 1.0f;
  17927. break;
  17928. }
  17929. x /= 3;
  17930. y /= 3;
  17931. }
  17932. write_imagef(dst, loc, value);
  17933. }
  17934. @end verbatim
  17935. @end itemize
  17936. @section sierpinski
  17937. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17938. This source accepts the following options:
  17939. @table @option
  17940. @item size, s
  17941. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17942. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17943. @item rate, r
  17944. Set frame rate, expressed as number of frames per second. Default
  17945. value is "25".
  17946. @item seed
  17947. Set seed which is used for random panning.
  17948. @item jump
  17949. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17950. @item type
  17951. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17952. @end table
  17953. @c man end VIDEO SOURCES
  17954. @chapter Video Sinks
  17955. @c man begin VIDEO SINKS
  17956. Below is a description of the currently available video sinks.
  17957. @section buffersink
  17958. Buffer video frames, and make them available to the end of the filter
  17959. graph.
  17960. This sink is mainly intended for programmatic use, in particular
  17961. through the interface defined in @file{libavfilter/buffersink.h}
  17962. or the options system.
  17963. It accepts a pointer to an AVBufferSinkContext structure, which
  17964. defines the incoming buffers' formats, to be passed as the opaque
  17965. parameter to @code{avfilter_init_filter} for initialization.
  17966. @section nullsink
  17967. Null video sink: do absolutely nothing with the input video. It is
  17968. mainly useful as a template and for use in analysis / debugging
  17969. tools.
  17970. @c man end VIDEO SINKS
  17971. @chapter Multimedia Filters
  17972. @c man begin MULTIMEDIA FILTERS
  17973. Below is a description of the currently available multimedia filters.
  17974. @section abitscope
  17975. Convert input audio to a video output, displaying the audio bit scope.
  17976. The filter accepts the following options:
  17977. @table @option
  17978. @item rate, r
  17979. Set frame rate, expressed as number of frames per second. Default
  17980. value is "25".
  17981. @item size, s
  17982. Specify the video size for the output. For the syntax of this option, check the
  17983. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17984. Default value is @code{1024x256}.
  17985. @item colors
  17986. Specify list of colors separated by space or by '|' which will be used to
  17987. draw channels. Unrecognized or missing colors will be replaced
  17988. by white color.
  17989. @end table
  17990. @section adrawgraph
  17991. Draw a graph using input audio metadata.
  17992. See @ref{drawgraph}
  17993. @section agraphmonitor
  17994. See @ref{graphmonitor}.
  17995. @section ahistogram
  17996. Convert input audio to a video output, displaying the volume histogram.
  17997. The filter accepts the following options:
  17998. @table @option
  17999. @item dmode
  18000. Specify how histogram is calculated.
  18001. It accepts the following values:
  18002. @table @samp
  18003. @item single
  18004. Use single histogram for all channels.
  18005. @item separate
  18006. Use separate histogram for each channel.
  18007. @end table
  18008. Default is @code{single}.
  18009. @item rate, r
  18010. Set frame rate, expressed as number of frames per second. Default
  18011. value is "25".
  18012. @item size, s
  18013. Specify the video size for the output. For the syntax of this option, check the
  18014. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18015. Default value is @code{hd720}.
  18016. @item scale
  18017. Set display scale.
  18018. It accepts the following values:
  18019. @table @samp
  18020. @item log
  18021. logarithmic
  18022. @item sqrt
  18023. square root
  18024. @item cbrt
  18025. cubic root
  18026. @item lin
  18027. linear
  18028. @item rlog
  18029. reverse logarithmic
  18030. @end table
  18031. Default is @code{log}.
  18032. @item ascale
  18033. Set amplitude scale.
  18034. It accepts the following values:
  18035. @table @samp
  18036. @item log
  18037. logarithmic
  18038. @item lin
  18039. linear
  18040. @end table
  18041. Default is @code{log}.
  18042. @item acount
  18043. Set how much frames to accumulate in histogram.
  18044. Default is 1. Setting this to -1 accumulates all frames.
  18045. @item rheight
  18046. Set histogram ratio of window height.
  18047. @item slide
  18048. Set sonogram sliding.
  18049. It accepts the following values:
  18050. @table @samp
  18051. @item replace
  18052. replace old rows with new ones.
  18053. @item scroll
  18054. scroll from top to bottom.
  18055. @end table
  18056. Default is @code{replace}.
  18057. @end table
  18058. @section aphasemeter
  18059. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18060. representing mean phase of current audio frame. A video output can also be produced and is
  18061. enabled by default. The audio is passed through as first output.
  18062. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18063. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18064. and @code{1} means channels are in phase.
  18065. The filter accepts the following options, all related to its video output:
  18066. @table @option
  18067. @item rate, r
  18068. Set the output frame rate. Default value is @code{25}.
  18069. @item size, s
  18070. Set the video size for the output. For the syntax of this option, check the
  18071. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18072. Default value is @code{800x400}.
  18073. @item rc
  18074. @item gc
  18075. @item bc
  18076. Specify the red, green, blue contrast. Default values are @code{2},
  18077. @code{7} and @code{1}.
  18078. Allowed range is @code{[0, 255]}.
  18079. @item mpc
  18080. Set color which will be used for drawing median phase. If color is
  18081. @code{none} which is default, no median phase value will be drawn.
  18082. @item video
  18083. Enable video output. Default is enabled.
  18084. @end table
  18085. @subsection phasing detection
  18086. The filter also detects out of phase and mono sequences in stereo streams.
  18087. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18088. The filter accepts the following options for this detection:
  18089. @table @option
  18090. @item phasing
  18091. Enable mono and out of phase detection. Default is disabled.
  18092. @item tolerance, t
  18093. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18094. Allowed range is @code{[0, 1]}.
  18095. @item angle, a
  18096. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18097. Allowed range is @code{[90, 180]}.
  18098. @item duration, d
  18099. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18100. @end table
  18101. @subsection Examples
  18102. @itemize
  18103. @item
  18104. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18105. @example
  18106. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18107. @end example
  18108. @end itemize
  18109. @section avectorscope
  18110. Convert input audio to a video output, representing the audio vector
  18111. scope.
  18112. The filter is used to measure the difference between channels of stereo
  18113. audio stream. A monaural signal, consisting of identical left and right
  18114. signal, results in straight vertical line. Any stereo separation is visible
  18115. as a deviation from this line, creating a Lissajous figure.
  18116. If the straight (or deviation from it) but horizontal line appears this
  18117. indicates that the left and right channels are out of phase.
  18118. The filter accepts the following options:
  18119. @table @option
  18120. @item mode, m
  18121. Set the vectorscope mode.
  18122. Available values are:
  18123. @table @samp
  18124. @item lissajous
  18125. Lissajous rotated by 45 degrees.
  18126. @item lissajous_xy
  18127. Same as above but not rotated.
  18128. @item polar
  18129. Shape resembling half of circle.
  18130. @end table
  18131. Default value is @samp{lissajous}.
  18132. @item size, s
  18133. Set the video size for the output. For the syntax of this option, check the
  18134. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18135. Default value is @code{400x400}.
  18136. @item rate, r
  18137. Set the output frame rate. Default value is @code{25}.
  18138. @item rc
  18139. @item gc
  18140. @item bc
  18141. @item ac
  18142. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18143. @code{160}, @code{80} and @code{255}.
  18144. Allowed range is @code{[0, 255]}.
  18145. @item rf
  18146. @item gf
  18147. @item bf
  18148. @item af
  18149. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18150. @code{10}, @code{5} and @code{5}.
  18151. Allowed range is @code{[0, 255]}.
  18152. @item zoom
  18153. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18154. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18155. @item draw
  18156. Set the vectorscope drawing mode.
  18157. Available values are:
  18158. @table @samp
  18159. @item dot
  18160. Draw dot for each sample.
  18161. @item line
  18162. Draw line between previous and current sample.
  18163. @end table
  18164. Default value is @samp{dot}.
  18165. @item scale
  18166. Specify amplitude scale of audio samples.
  18167. Available values are:
  18168. @table @samp
  18169. @item lin
  18170. Linear.
  18171. @item sqrt
  18172. Square root.
  18173. @item cbrt
  18174. Cubic root.
  18175. @item log
  18176. Logarithmic.
  18177. @end table
  18178. @item swap
  18179. Swap left channel axis with right channel axis.
  18180. @item mirror
  18181. Mirror axis.
  18182. @table @samp
  18183. @item none
  18184. No mirror.
  18185. @item x
  18186. Mirror only x axis.
  18187. @item y
  18188. Mirror only y axis.
  18189. @item xy
  18190. Mirror both axis.
  18191. @end table
  18192. @end table
  18193. @subsection Examples
  18194. @itemize
  18195. @item
  18196. Complete example using @command{ffplay}:
  18197. @example
  18198. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18199. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18200. @end example
  18201. @end itemize
  18202. @section bench, abench
  18203. Benchmark part of a filtergraph.
  18204. The filter accepts the following options:
  18205. @table @option
  18206. @item action
  18207. Start or stop a timer.
  18208. Available values are:
  18209. @table @samp
  18210. @item start
  18211. Get the current time, set it as frame metadata (using the key
  18212. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18213. @item stop
  18214. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18215. the input frame metadata to get the time difference. Time difference, average,
  18216. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18217. @code{min}) are then printed. The timestamps are expressed in seconds.
  18218. @end table
  18219. @end table
  18220. @subsection Examples
  18221. @itemize
  18222. @item
  18223. Benchmark @ref{selectivecolor} filter:
  18224. @example
  18225. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18226. @end example
  18227. @end itemize
  18228. @section concat
  18229. Concatenate audio and video streams, joining them together one after the
  18230. other.
  18231. The filter works on segments of synchronized video and audio streams. All
  18232. segments must have the same number of streams of each type, and that will
  18233. also be the number of streams at output.
  18234. The filter accepts the following options:
  18235. @table @option
  18236. @item n
  18237. Set the number of segments. Default is 2.
  18238. @item v
  18239. Set the number of output video streams, that is also the number of video
  18240. streams in each segment. Default is 1.
  18241. @item a
  18242. Set the number of output audio streams, that is also the number of audio
  18243. streams in each segment. Default is 0.
  18244. @item unsafe
  18245. Activate unsafe mode: do not fail if segments have a different format.
  18246. @end table
  18247. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18248. @var{a} audio outputs.
  18249. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18250. segment, in the same order as the outputs, then the inputs for the second
  18251. segment, etc.
  18252. Related streams do not always have exactly the same duration, for various
  18253. reasons including codec frame size or sloppy authoring. For that reason,
  18254. related synchronized streams (e.g. a video and its audio track) should be
  18255. concatenated at once. The concat filter will use the duration of the longest
  18256. stream in each segment (except the last one), and if necessary pad shorter
  18257. audio streams with silence.
  18258. For this filter to work correctly, all segments must start at timestamp 0.
  18259. All corresponding streams must have the same parameters in all segments; the
  18260. filtering system will automatically select a common pixel format for video
  18261. streams, and a common sample format, sample rate and channel layout for
  18262. audio streams, but other settings, such as resolution, must be converted
  18263. explicitly by the user.
  18264. Different frame rates are acceptable but will result in variable frame rate
  18265. at output; be sure to configure the output file to handle it.
  18266. @subsection Examples
  18267. @itemize
  18268. @item
  18269. Concatenate an opening, an episode and an ending, all in bilingual version
  18270. (video in stream 0, audio in streams 1 and 2):
  18271. @example
  18272. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18273. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18274. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18275. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18276. @end example
  18277. @item
  18278. Concatenate two parts, handling audio and video separately, using the
  18279. (a)movie sources, and adjusting the resolution:
  18280. @example
  18281. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18282. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18283. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18284. @end example
  18285. Note that a desync will happen at the stitch if the audio and video streams
  18286. do not have exactly the same duration in the first file.
  18287. @end itemize
  18288. @subsection Commands
  18289. This filter supports the following commands:
  18290. @table @option
  18291. @item next
  18292. Close the current segment and step to the next one
  18293. @end table
  18294. @anchor{ebur128}
  18295. @section ebur128
  18296. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18297. level. By default, it logs a message at a frequency of 10Hz with the
  18298. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18299. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18300. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18301. sample format is double-precision floating point. The input stream will be converted to
  18302. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18303. after this filter to obtain the original parameters.
  18304. The filter also has a video output (see the @var{video} option) with a real
  18305. time graph to observe the loudness evolution. The graphic contains the logged
  18306. message mentioned above, so it is not printed anymore when this option is set,
  18307. unless the verbose logging is set. The main graphing area contains the
  18308. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18309. the momentary loudness (400 milliseconds), but can optionally be configured
  18310. to instead display short-term loudness (see @var{gauge}).
  18311. The green area marks a +/- 1LU target range around the target loudness
  18312. (-23LUFS by default, unless modified through @var{target}).
  18313. More information about the Loudness Recommendation EBU R128 on
  18314. @url{http://tech.ebu.ch/loudness}.
  18315. The filter accepts the following options:
  18316. @table @option
  18317. @item video
  18318. Activate the video output. The audio stream is passed unchanged whether this
  18319. option is set or no. The video stream will be the first output stream if
  18320. activated. Default is @code{0}.
  18321. @item size
  18322. Set the video size. This option is for video only. For the syntax of this
  18323. option, check the
  18324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18325. Default and minimum resolution is @code{640x480}.
  18326. @item meter
  18327. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18328. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18329. other integer value between this range is allowed.
  18330. @item metadata
  18331. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18332. into 100ms output frames, each of them containing various loudness information
  18333. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18334. Default is @code{0}.
  18335. @item framelog
  18336. Force the frame logging level.
  18337. Available values are:
  18338. @table @samp
  18339. @item info
  18340. information logging level
  18341. @item verbose
  18342. verbose logging level
  18343. @end table
  18344. By default, the logging level is set to @var{info}. If the @option{video} or
  18345. the @option{metadata} options are set, it switches to @var{verbose}.
  18346. @item peak
  18347. Set peak mode(s).
  18348. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18349. values are:
  18350. @table @samp
  18351. @item none
  18352. Disable any peak mode (default).
  18353. @item sample
  18354. Enable sample-peak mode.
  18355. Simple peak mode looking for the higher sample value. It logs a message
  18356. for sample-peak (identified by @code{SPK}).
  18357. @item true
  18358. Enable true-peak mode.
  18359. If enabled, the peak lookup is done on an over-sampled version of the input
  18360. stream for better peak accuracy. It logs a message for true-peak.
  18361. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18362. This mode requires a build with @code{libswresample}.
  18363. @end table
  18364. @item dualmono
  18365. Treat mono input files as "dual mono". If a mono file is intended for playback
  18366. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18367. If set to @code{true}, this option will compensate for this effect.
  18368. Multi-channel input files are not affected by this option.
  18369. @item panlaw
  18370. Set a specific pan law to be used for the measurement of dual mono files.
  18371. This parameter is optional, and has a default value of -3.01dB.
  18372. @item target
  18373. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18374. This parameter is optional and has a default value of -23LUFS as specified
  18375. by EBU R128. However, material published online may prefer a level of -16LUFS
  18376. (e.g. for use with podcasts or video platforms).
  18377. @item gauge
  18378. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18379. @code{shortterm}. By default the momentary value will be used, but in certain
  18380. scenarios it may be more useful to observe the short term value instead (e.g.
  18381. live mixing).
  18382. @item scale
  18383. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18384. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18385. video output, not the summary or continuous log output.
  18386. @end table
  18387. @subsection Examples
  18388. @itemize
  18389. @item
  18390. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18391. @example
  18392. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18393. @end example
  18394. @item
  18395. Run an analysis with @command{ffmpeg}:
  18396. @example
  18397. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18398. @end example
  18399. @end itemize
  18400. @section interleave, ainterleave
  18401. Temporally interleave frames from several inputs.
  18402. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18403. These filters read frames from several inputs and send the oldest
  18404. queued frame to the output.
  18405. Input streams must have well defined, monotonically increasing frame
  18406. timestamp values.
  18407. In order to submit one frame to output, these filters need to enqueue
  18408. at least one frame for each input, so they cannot work in case one
  18409. input is not yet terminated and will not receive incoming frames.
  18410. For example consider the case when one input is a @code{select} filter
  18411. which always drops input frames. The @code{interleave} filter will keep
  18412. reading from that input, but it will never be able to send new frames
  18413. to output until the input sends an end-of-stream signal.
  18414. Also, depending on inputs synchronization, the filters will drop
  18415. frames in case one input receives more frames than the other ones, and
  18416. the queue is already filled.
  18417. These filters accept the following options:
  18418. @table @option
  18419. @item nb_inputs, n
  18420. Set the number of different inputs, it is 2 by default.
  18421. @item duration
  18422. How to determine the end-of-stream.
  18423. @table @option
  18424. @item longest
  18425. The duration of the longest input. (default)
  18426. @item shortest
  18427. The duration of the shortest input.
  18428. @item first
  18429. The duration of the first input.
  18430. @end table
  18431. @end table
  18432. @subsection Examples
  18433. @itemize
  18434. @item
  18435. Interleave frames belonging to different streams using @command{ffmpeg}:
  18436. @example
  18437. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18438. @end example
  18439. @item
  18440. Add flickering blur effect:
  18441. @example
  18442. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18443. @end example
  18444. @end itemize
  18445. @section metadata, ametadata
  18446. Manipulate frame metadata.
  18447. This filter accepts the following options:
  18448. @table @option
  18449. @item mode
  18450. Set mode of operation of the filter.
  18451. Can be one of the following:
  18452. @table @samp
  18453. @item select
  18454. If both @code{value} and @code{key} is set, select frames
  18455. which have such metadata. If only @code{key} is set, select
  18456. every frame that has such key in metadata.
  18457. @item add
  18458. Add new metadata @code{key} and @code{value}. If key is already available
  18459. do nothing.
  18460. @item modify
  18461. Modify value of already present key.
  18462. @item delete
  18463. If @code{value} is set, delete only keys that have such value.
  18464. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18465. the frame.
  18466. @item print
  18467. Print key and its value if metadata was found. If @code{key} is not set print all
  18468. metadata values available in frame.
  18469. @end table
  18470. @item key
  18471. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18472. @item value
  18473. Set metadata value which will be used. This option is mandatory for
  18474. @code{modify} and @code{add} mode.
  18475. @item function
  18476. Which function to use when comparing metadata value and @code{value}.
  18477. Can be one of following:
  18478. @table @samp
  18479. @item same_str
  18480. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18481. @item starts_with
  18482. Values are interpreted as strings, returns true if metadata value starts with
  18483. the @code{value} option string.
  18484. @item less
  18485. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18486. @item equal
  18487. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18488. @item greater
  18489. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18490. @item expr
  18491. Values are interpreted as floats, returns true if expression from option @code{expr}
  18492. evaluates to true.
  18493. @item ends_with
  18494. Values are interpreted as strings, returns true if metadata value ends with
  18495. the @code{value} option string.
  18496. @end table
  18497. @item expr
  18498. Set expression which is used when @code{function} is set to @code{expr}.
  18499. The expression is evaluated through the eval API and can contain the following
  18500. constants:
  18501. @table @option
  18502. @item VALUE1
  18503. Float representation of @code{value} from metadata key.
  18504. @item VALUE2
  18505. Float representation of @code{value} as supplied by user in @code{value} option.
  18506. @end table
  18507. @item file
  18508. If specified in @code{print} mode, output is written to the named file. Instead of
  18509. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18510. for standard output. If @code{file} option is not set, output is written to the log
  18511. with AV_LOG_INFO loglevel.
  18512. @item direct
  18513. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18514. @end table
  18515. @subsection Examples
  18516. @itemize
  18517. @item
  18518. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18519. between 0 and 1.
  18520. @example
  18521. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18522. @end example
  18523. @item
  18524. Print silencedetect output to file @file{metadata.txt}.
  18525. @example
  18526. silencedetect,ametadata=mode=print:file=metadata.txt
  18527. @end example
  18528. @item
  18529. Direct all metadata to a pipe with file descriptor 4.
  18530. @example
  18531. metadata=mode=print:file='pipe\:4'
  18532. @end example
  18533. @end itemize
  18534. @section perms, aperms
  18535. Set read/write permissions for the output frames.
  18536. These filters are mainly aimed at developers to test direct path in the
  18537. following filter in the filtergraph.
  18538. The filters accept the following options:
  18539. @table @option
  18540. @item mode
  18541. Select the permissions mode.
  18542. It accepts the following values:
  18543. @table @samp
  18544. @item none
  18545. Do nothing. This is the default.
  18546. @item ro
  18547. Set all the output frames read-only.
  18548. @item rw
  18549. Set all the output frames directly writable.
  18550. @item toggle
  18551. Make the frame read-only if writable, and writable if read-only.
  18552. @item random
  18553. Set each output frame read-only or writable randomly.
  18554. @end table
  18555. @item seed
  18556. Set the seed for the @var{random} mode, must be an integer included between
  18557. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18558. @code{-1}, the filter will try to use a good random seed on a best effort
  18559. basis.
  18560. @end table
  18561. Note: in case of auto-inserted filter between the permission filter and the
  18562. following one, the permission might not be received as expected in that
  18563. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18564. perms/aperms filter can avoid this problem.
  18565. @section realtime, arealtime
  18566. Slow down filtering to match real time approximately.
  18567. These filters will pause the filtering for a variable amount of time to
  18568. match the output rate with the input timestamps.
  18569. They are similar to the @option{re} option to @code{ffmpeg}.
  18570. They accept the following options:
  18571. @table @option
  18572. @item limit
  18573. Time limit for the pauses. Any pause longer than that will be considered
  18574. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18575. @item speed
  18576. Speed factor for processing. The value must be a float larger than zero.
  18577. Values larger than 1.0 will result in faster than realtime processing,
  18578. smaller will slow processing down. The @var{limit} is automatically adapted
  18579. accordingly. Default is 1.0.
  18580. A processing speed faster than what is possible without these filters cannot
  18581. be achieved.
  18582. @end table
  18583. @anchor{select}
  18584. @section select, aselect
  18585. Select frames to pass in output.
  18586. This filter accepts the following options:
  18587. @table @option
  18588. @item expr, e
  18589. Set expression, which is evaluated for each input frame.
  18590. If the expression is evaluated to zero, the frame is discarded.
  18591. If the evaluation result is negative or NaN, the frame is sent to the
  18592. first output; otherwise it is sent to the output with index
  18593. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18594. For example a value of @code{1.2} corresponds to the output with index
  18595. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18596. @item outputs, n
  18597. Set the number of outputs. The output to which to send the selected
  18598. frame is based on the result of the evaluation. Default value is 1.
  18599. @end table
  18600. The expression can contain the following constants:
  18601. @table @option
  18602. @item n
  18603. The (sequential) number of the filtered frame, starting from 0.
  18604. @item selected_n
  18605. The (sequential) number of the selected frame, starting from 0.
  18606. @item prev_selected_n
  18607. The sequential number of the last selected frame. It's NAN if undefined.
  18608. @item TB
  18609. The timebase of the input timestamps.
  18610. @item pts
  18611. The PTS (Presentation TimeStamp) of the filtered video frame,
  18612. expressed in @var{TB} units. It's NAN if undefined.
  18613. @item t
  18614. The PTS of the filtered video frame,
  18615. expressed in seconds. It's NAN if undefined.
  18616. @item prev_pts
  18617. The PTS of the previously filtered video frame. It's NAN if undefined.
  18618. @item prev_selected_pts
  18619. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18620. @item prev_selected_t
  18621. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18622. @item start_pts
  18623. The PTS of the first video frame in the video. It's NAN if undefined.
  18624. @item start_t
  18625. The time of the first video frame in the video. It's NAN if undefined.
  18626. @item pict_type @emph{(video only)}
  18627. The type of the filtered frame. It can assume one of the following
  18628. values:
  18629. @table @option
  18630. @item I
  18631. @item P
  18632. @item B
  18633. @item S
  18634. @item SI
  18635. @item SP
  18636. @item BI
  18637. @end table
  18638. @item interlace_type @emph{(video only)}
  18639. The frame interlace type. It can assume one of the following values:
  18640. @table @option
  18641. @item PROGRESSIVE
  18642. The frame is progressive (not interlaced).
  18643. @item TOPFIRST
  18644. The frame is top-field-first.
  18645. @item BOTTOMFIRST
  18646. The frame is bottom-field-first.
  18647. @end table
  18648. @item consumed_sample_n @emph{(audio only)}
  18649. the number of selected samples before the current frame
  18650. @item samples_n @emph{(audio only)}
  18651. the number of samples in the current frame
  18652. @item sample_rate @emph{(audio only)}
  18653. the input sample rate
  18654. @item key
  18655. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18656. @item pos
  18657. the position in the file of the filtered frame, -1 if the information
  18658. is not available (e.g. for synthetic video)
  18659. @item scene @emph{(video only)}
  18660. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18661. probability for the current frame to introduce a new scene, while a higher
  18662. value means the current frame is more likely to be one (see the example below)
  18663. @item concatdec_select
  18664. The concat demuxer can select only part of a concat input file by setting an
  18665. inpoint and an outpoint, but the output packets may not be entirely contained
  18666. in the selected interval. By using this variable, it is possible to skip frames
  18667. generated by the concat demuxer which are not exactly contained in the selected
  18668. interval.
  18669. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18670. and the @var{lavf.concat.duration} packet metadata values which are also
  18671. present in the decoded frames.
  18672. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18673. start_time and either the duration metadata is missing or the frame pts is less
  18674. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18675. missing.
  18676. That basically means that an input frame is selected if its pts is within the
  18677. interval set by the concat demuxer.
  18678. @end table
  18679. The default value of the select expression is "1".
  18680. @subsection Examples
  18681. @itemize
  18682. @item
  18683. Select all frames in input:
  18684. @example
  18685. select
  18686. @end example
  18687. The example above is the same as:
  18688. @example
  18689. select=1
  18690. @end example
  18691. @item
  18692. Skip all frames:
  18693. @example
  18694. select=0
  18695. @end example
  18696. @item
  18697. Select only I-frames:
  18698. @example
  18699. select='eq(pict_type\,I)'
  18700. @end example
  18701. @item
  18702. Select one frame every 100:
  18703. @example
  18704. select='not(mod(n\,100))'
  18705. @end example
  18706. @item
  18707. Select only frames contained in the 10-20 time interval:
  18708. @example
  18709. select=between(t\,10\,20)
  18710. @end example
  18711. @item
  18712. Select only I-frames contained in the 10-20 time interval:
  18713. @example
  18714. select=between(t\,10\,20)*eq(pict_type\,I)
  18715. @end example
  18716. @item
  18717. Select frames with a minimum distance of 10 seconds:
  18718. @example
  18719. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18720. @end example
  18721. @item
  18722. Use aselect to select only audio frames with samples number > 100:
  18723. @example
  18724. aselect='gt(samples_n\,100)'
  18725. @end example
  18726. @item
  18727. Create a mosaic of the first scenes:
  18728. @example
  18729. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18730. @end example
  18731. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18732. choice.
  18733. @item
  18734. Send even and odd frames to separate outputs, and compose them:
  18735. @example
  18736. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18737. @end example
  18738. @item
  18739. Select useful frames from an ffconcat file which is using inpoints and
  18740. outpoints but where the source files are not intra frame only.
  18741. @example
  18742. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18743. @end example
  18744. @end itemize
  18745. @section sendcmd, asendcmd
  18746. Send commands to filters in the filtergraph.
  18747. These filters read commands to be sent to other filters in the
  18748. filtergraph.
  18749. @code{sendcmd} must be inserted between two video filters,
  18750. @code{asendcmd} must be inserted between two audio filters, but apart
  18751. from that they act the same way.
  18752. The specification of commands can be provided in the filter arguments
  18753. with the @var{commands} option, or in a file specified by the
  18754. @var{filename} option.
  18755. These filters accept the following options:
  18756. @table @option
  18757. @item commands, c
  18758. Set the commands to be read and sent to the other filters.
  18759. @item filename, f
  18760. Set the filename of the commands to be read and sent to the other
  18761. filters.
  18762. @end table
  18763. @subsection Commands syntax
  18764. A commands description consists of a sequence of interval
  18765. specifications, comprising a list of commands to be executed when a
  18766. particular event related to that interval occurs. The occurring event
  18767. is typically the current frame time entering or leaving a given time
  18768. interval.
  18769. An interval is specified by the following syntax:
  18770. @example
  18771. @var{START}[-@var{END}] @var{COMMANDS};
  18772. @end example
  18773. The time interval is specified by the @var{START} and @var{END} times.
  18774. @var{END} is optional and defaults to the maximum time.
  18775. The current frame time is considered within the specified interval if
  18776. it is included in the interval [@var{START}, @var{END}), that is when
  18777. the time is greater or equal to @var{START} and is lesser than
  18778. @var{END}.
  18779. @var{COMMANDS} consists of a sequence of one or more command
  18780. specifications, separated by ",", relating to that interval. The
  18781. syntax of a command specification is given by:
  18782. @example
  18783. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18784. @end example
  18785. @var{FLAGS} is optional and specifies the type of events relating to
  18786. the time interval which enable sending the specified command, and must
  18787. be a non-null sequence of identifier flags separated by "+" or "|" and
  18788. enclosed between "[" and "]".
  18789. The following flags are recognized:
  18790. @table @option
  18791. @item enter
  18792. The command is sent when the current frame timestamp enters the
  18793. specified interval. In other words, the command is sent when the
  18794. previous frame timestamp was not in the given interval, and the
  18795. current is.
  18796. @item leave
  18797. The command is sent when the current frame timestamp leaves the
  18798. specified interval. In other words, the command is sent when the
  18799. previous frame timestamp was in the given interval, and the
  18800. current is not.
  18801. @item expr
  18802. The command @var{ARG} is interpreted as expression and result of
  18803. expression is passed as @var{ARG}.
  18804. The expression is evaluated through the eval API and can contain the following
  18805. constants:
  18806. @table @option
  18807. @item POS
  18808. Original position in the file of the frame, or undefined if undefined
  18809. for the current frame.
  18810. @item PTS
  18811. The presentation timestamp in input.
  18812. @item N
  18813. The count of the input frame for video or audio, starting from 0.
  18814. @item T
  18815. The time in seconds of the current frame.
  18816. @item TS
  18817. The start time in seconds of the current command interval.
  18818. @item TE
  18819. The end time in seconds of the current command interval.
  18820. @item TI
  18821. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18822. @end table
  18823. @end table
  18824. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18825. assumed.
  18826. @var{TARGET} specifies the target of the command, usually the name of
  18827. the filter class or a specific filter instance name.
  18828. @var{COMMAND} specifies the name of the command for the target filter.
  18829. @var{ARG} is optional and specifies the optional list of argument for
  18830. the given @var{COMMAND}.
  18831. Between one interval specification and another, whitespaces, or
  18832. sequences of characters starting with @code{#} until the end of line,
  18833. are ignored and can be used to annotate comments.
  18834. A simplified BNF description of the commands specification syntax
  18835. follows:
  18836. @example
  18837. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18838. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18839. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18840. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18841. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18842. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18843. @end example
  18844. @subsection Examples
  18845. @itemize
  18846. @item
  18847. Specify audio tempo change at second 4:
  18848. @example
  18849. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18850. @end example
  18851. @item
  18852. Target a specific filter instance:
  18853. @example
  18854. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18855. @end example
  18856. @item
  18857. Specify a list of drawtext and hue commands in a file.
  18858. @example
  18859. # show text in the interval 5-10
  18860. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18861. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18862. # desaturate the image in the interval 15-20
  18863. 15.0-20.0 [enter] hue s 0,
  18864. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18865. [leave] hue s 1,
  18866. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18867. # apply an exponential saturation fade-out effect, starting from time 25
  18868. 25 [enter] hue s exp(25-t)
  18869. @end example
  18870. A filtergraph allowing to read and process the above command list
  18871. stored in a file @file{test.cmd}, can be specified with:
  18872. @example
  18873. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18874. @end example
  18875. @end itemize
  18876. @anchor{setpts}
  18877. @section setpts, asetpts
  18878. Change the PTS (presentation timestamp) of the input frames.
  18879. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18880. This filter accepts the following options:
  18881. @table @option
  18882. @item expr
  18883. The expression which is evaluated for each frame to construct its timestamp.
  18884. @end table
  18885. The expression is evaluated through the eval API and can contain the following
  18886. constants:
  18887. @table @option
  18888. @item FRAME_RATE, FR
  18889. frame rate, only defined for constant frame-rate video
  18890. @item PTS
  18891. The presentation timestamp in input
  18892. @item N
  18893. The count of the input frame for video or the number of consumed samples,
  18894. not including the current frame for audio, starting from 0.
  18895. @item NB_CONSUMED_SAMPLES
  18896. The number of consumed samples, not including the current frame (only
  18897. audio)
  18898. @item NB_SAMPLES, S
  18899. The number of samples in the current frame (only audio)
  18900. @item SAMPLE_RATE, SR
  18901. The audio sample rate.
  18902. @item STARTPTS
  18903. The PTS of the first frame.
  18904. @item STARTT
  18905. the time in seconds of the first frame
  18906. @item INTERLACED
  18907. State whether the current frame is interlaced.
  18908. @item T
  18909. the time in seconds of the current frame
  18910. @item POS
  18911. original position in the file of the frame, or undefined if undefined
  18912. for the current frame
  18913. @item PREV_INPTS
  18914. The previous input PTS.
  18915. @item PREV_INT
  18916. previous input time in seconds
  18917. @item PREV_OUTPTS
  18918. The previous output PTS.
  18919. @item PREV_OUTT
  18920. previous output time in seconds
  18921. @item RTCTIME
  18922. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18923. instead.
  18924. @item RTCSTART
  18925. The wallclock (RTC) time at the start of the movie in microseconds.
  18926. @item TB
  18927. The timebase of the input timestamps.
  18928. @end table
  18929. @subsection Examples
  18930. @itemize
  18931. @item
  18932. Start counting PTS from zero
  18933. @example
  18934. setpts=PTS-STARTPTS
  18935. @end example
  18936. @item
  18937. Apply fast motion effect:
  18938. @example
  18939. setpts=0.5*PTS
  18940. @end example
  18941. @item
  18942. Apply slow motion effect:
  18943. @example
  18944. setpts=2.0*PTS
  18945. @end example
  18946. @item
  18947. Set fixed rate of 25 frames per second:
  18948. @example
  18949. setpts=N/(25*TB)
  18950. @end example
  18951. @item
  18952. Set fixed rate 25 fps with some jitter:
  18953. @example
  18954. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18955. @end example
  18956. @item
  18957. Apply an offset of 10 seconds to the input PTS:
  18958. @example
  18959. setpts=PTS+10/TB
  18960. @end example
  18961. @item
  18962. Generate timestamps from a "live source" and rebase onto the current timebase:
  18963. @example
  18964. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18965. @end example
  18966. @item
  18967. Generate timestamps by counting samples:
  18968. @example
  18969. asetpts=N/SR/TB
  18970. @end example
  18971. @end itemize
  18972. @section setrange
  18973. Force color range for the output video frame.
  18974. The @code{setrange} filter marks the color range property for the
  18975. output frames. It does not change the input frame, but only sets the
  18976. corresponding property, which affects how the frame is treated by
  18977. following filters.
  18978. The filter accepts the following options:
  18979. @table @option
  18980. @item range
  18981. Available values are:
  18982. @table @samp
  18983. @item auto
  18984. Keep the same color range property.
  18985. @item unspecified, unknown
  18986. Set the color range as unspecified.
  18987. @item limited, tv, mpeg
  18988. Set the color range as limited.
  18989. @item full, pc, jpeg
  18990. Set the color range as full.
  18991. @end table
  18992. @end table
  18993. @section settb, asettb
  18994. Set the timebase to use for the output frames timestamps.
  18995. It is mainly useful for testing timebase configuration.
  18996. It accepts the following parameters:
  18997. @table @option
  18998. @item expr, tb
  18999. The expression which is evaluated into the output timebase.
  19000. @end table
  19001. The value for @option{tb} is an arithmetic expression representing a
  19002. rational. The expression can contain the constants "AVTB" (the default
  19003. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19004. audio only). Default value is "intb".
  19005. @subsection Examples
  19006. @itemize
  19007. @item
  19008. Set the timebase to 1/25:
  19009. @example
  19010. settb=expr=1/25
  19011. @end example
  19012. @item
  19013. Set the timebase to 1/10:
  19014. @example
  19015. settb=expr=0.1
  19016. @end example
  19017. @item
  19018. Set the timebase to 1001/1000:
  19019. @example
  19020. settb=1+0.001
  19021. @end example
  19022. @item
  19023. Set the timebase to 2*intb:
  19024. @example
  19025. settb=2*intb
  19026. @end example
  19027. @item
  19028. Set the default timebase value:
  19029. @example
  19030. settb=AVTB
  19031. @end example
  19032. @end itemize
  19033. @section showcqt
  19034. Convert input audio to a video output representing frequency spectrum
  19035. logarithmically using Brown-Puckette constant Q transform algorithm with
  19036. direct frequency domain coefficient calculation (but the transform itself
  19037. is not really constant Q, instead the Q factor is actually variable/clamped),
  19038. with musical tone scale, from E0 to D#10.
  19039. The filter accepts the following options:
  19040. @table @option
  19041. @item size, s
  19042. Specify the video size for the output. It must be even. For the syntax of this option,
  19043. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19044. Default value is @code{1920x1080}.
  19045. @item fps, rate, r
  19046. Set the output frame rate. Default value is @code{25}.
  19047. @item bar_h
  19048. Set the bargraph height. It must be even. Default value is @code{-1} which
  19049. computes the bargraph height automatically.
  19050. @item axis_h
  19051. Set the axis height. It must be even. Default value is @code{-1} which computes
  19052. the axis height automatically.
  19053. @item sono_h
  19054. Set the sonogram height. It must be even. Default value is @code{-1} which
  19055. computes the sonogram height automatically.
  19056. @item fullhd
  19057. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19058. instead. Default value is @code{1}.
  19059. @item sono_v, volume
  19060. Specify the sonogram volume expression. It can contain variables:
  19061. @table @option
  19062. @item bar_v
  19063. the @var{bar_v} evaluated expression
  19064. @item frequency, freq, f
  19065. the frequency where it is evaluated
  19066. @item timeclamp, tc
  19067. the value of @var{timeclamp} option
  19068. @end table
  19069. and functions:
  19070. @table @option
  19071. @item a_weighting(f)
  19072. A-weighting of equal loudness
  19073. @item b_weighting(f)
  19074. B-weighting of equal loudness
  19075. @item c_weighting(f)
  19076. C-weighting of equal loudness.
  19077. @end table
  19078. Default value is @code{16}.
  19079. @item bar_v, volume2
  19080. Specify the bargraph volume expression. It can contain variables:
  19081. @table @option
  19082. @item sono_v
  19083. the @var{sono_v} evaluated expression
  19084. @item frequency, freq, f
  19085. the frequency where it is evaluated
  19086. @item timeclamp, tc
  19087. the value of @var{timeclamp} option
  19088. @end table
  19089. and functions:
  19090. @table @option
  19091. @item a_weighting(f)
  19092. A-weighting of equal loudness
  19093. @item b_weighting(f)
  19094. B-weighting of equal loudness
  19095. @item c_weighting(f)
  19096. C-weighting of equal loudness.
  19097. @end table
  19098. Default value is @code{sono_v}.
  19099. @item sono_g, gamma
  19100. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19101. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19102. Acceptable range is @code{[1, 7]}.
  19103. @item bar_g, gamma2
  19104. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19105. @code{[1, 7]}.
  19106. @item bar_t
  19107. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19108. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19109. @item timeclamp, tc
  19110. Specify the transform timeclamp. At low frequency, there is trade-off between
  19111. accuracy in time domain and frequency domain. If timeclamp is lower,
  19112. event in time domain is represented more accurately (such as fast bass drum),
  19113. otherwise event in frequency domain is represented more accurately
  19114. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19115. @item attack
  19116. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19117. limits future samples by applying asymmetric windowing in time domain, useful
  19118. when low latency is required. Accepted range is @code{[0, 1]}.
  19119. @item basefreq
  19120. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19121. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19122. @item endfreq
  19123. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19124. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19125. @item coeffclamp
  19126. This option is deprecated and ignored.
  19127. @item tlength
  19128. Specify the transform length in time domain. Use this option to control accuracy
  19129. trade-off between time domain and frequency domain at every frequency sample.
  19130. It can contain variables:
  19131. @table @option
  19132. @item frequency, freq, f
  19133. the frequency where it is evaluated
  19134. @item timeclamp, tc
  19135. the value of @var{timeclamp} option.
  19136. @end table
  19137. Default value is @code{384*tc/(384+tc*f)}.
  19138. @item count
  19139. Specify the transform count for every video frame. Default value is @code{6}.
  19140. Acceptable range is @code{[1, 30]}.
  19141. @item fcount
  19142. Specify the transform count for every single pixel. Default value is @code{0},
  19143. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19144. @item fontfile
  19145. Specify font file for use with freetype to draw the axis. If not specified,
  19146. use embedded font. Note that drawing with font file or embedded font is not
  19147. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19148. option instead.
  19149. @item font
  19150. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19151. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19152. escaping.
  19153. @item fontcolor
  19154. Specify font color expression. This is arithmetic expression that should return
  19155. integer value 0xRRGGBB. It can contain variables:
  19156. @table @option
  19157. @item frequency, freq, f
  19158. the frequency where it is evaluated
  19159. @item timeclamp, tc
  19160. the value of @var{timeclamp} option
  19161. @end table
  19162. and functions:
  19163. @table @option
  19164. @item midi(f)
  19165. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19166. @item r(x), g(x), b(x)
  19167. red, green, and blue value of intensity x.
  19168. @end table
  19169. Default value is @code{st(0, (midi(f)-59.5)/12);
  19170. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19171. r(1-ld(1)) + b(ld(1))}.
  19172. @item axisfile
  19173. Specify image file to draw the axis. This option override @var{fontfile} and
  19174. @var{fontcolor} option.
  19175. @item axis, text
  19176. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19177. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19178. Default value is @code{1}.
  19179. @item csp
  19180. Set colorspace. The accepted values are:
  19181. @table @samp
  19182. @item unspecified
  19183. Unspecified (default)
  19184. @item bt709
  19185. BT.709
  19186. @item fcc
  19187. FCC
  19188. @item bt470bg
  19189. BT.470BG or BT.601-6 625
  19190. @item smpte170m
  19191. SMPTE-170M or BT.601-6 525
  19192. @item smpte240m
  19193. SMPTE-240M
  19194. @item bt2020ncl
  19195. BT.2020 with non-constant luminance
  19196. @end table
  19197. @item cscheme
  19198. Set spectrogram color scheme. This is list of floating point values with format
  19199. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19200. The default is @code{1|0.5|0|0|0.5|1}.
  19201. @end table
  19202. @subsection Examples
  19203. @itemize
  19204. @item
  19205. Playing audio while showing the spectrum:
  19206. @example
  19207. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19208. @end example
  19209. @item
  19210. Same as above, but with frame rate 30 fps:
  19211. @example
  19212. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19213. @end example
  19214. @item
  19215. Playing at 1280x720:
  19216. @example
  19217. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19218. @end example
  19219. @item
  19220. Disable sonogram display:
  19221. @example
  19222. sono_h=0
  19223. @end example
  19224. @item
  19225. A1 and its harmonics: A1, A2, (near)E3, A3:
  19226. @example
  19227. 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),
  19228. asplit[a][out1]; [a] showcqt [out0]'
  19229. @end example
  19230. @item
  19231. Same as above, but with more accuracy in frequency domain:
  19232. @example
  19233. 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),
  19234. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19235. @end example
  19236. @item
  19237. Custom volume:
  19238. @example
  19239. bar_v=10:sono_v=bar_v*a_weighting(f)
  19240. @end example
  19241. @item
  19242. Custom gamma, now spectrum is linear to the amplitude.
  19243. @example
  19244. bar_g=2:sono_g=2
  19245. @end example
  19246. @item
  19247. Custom tlength equation:
  19248. @example
  19249. 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)))'
  19250. @end example
  19251. @item
  19252. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19253. @example
  19254. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19255. @end example
  19256. @item
  19257. Custom font using fontconfig:
  19258. @example
  19259. font='Courier New,Monospace,mono|bold'
  19260. @end example
  19261. @item
  19262. Custom frequency range with custom axis using image file:
  19263. @example
  19264. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19265. @end example
  19266. @end itemize
  19267. @section showfreqs
  19268. Convert input audio to video output representing the audio power spectrum.
  19269. Audio amplitude is on Y-axis while frequency is on X-axis.
  19270. The filter accepts the following options:
  19271. @table @option
  19272. @item size, s
  19273. Specify size of video. For the syntax of this option, check the
  19274. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19275. Default is @code{1024x512}.
  19276. @item mode
  19277. Set display mode.
  19278. This set how each frequency bin will be represented.
  19279. It accepts the following values:
  19280. @table @samp
  19281. @item line
  19282. @item bar
  19283. @item dot
  19284. @end table
  19285. Default is @code{bar}.
  19286. @item ascale
  19287. Set amplitude scale.
  19288. It accepts the following values:
  19289. @table @samp
  19290. @item lin
  19291. Linear scale.
  19292. @item sqrt
  19293. Square root scale.
  19294. @item cbrt
  19295. Cubic root scale.
  19296. @item log
  19297. Logarithmic scale.
  19298. @end table
  19299. Default is @code{log}.
  19300. @item fscale
  19301. Set frequency scale.
  19302. It accepts the following values:
  19303. @table @samp
  19304. @item lin
  19305. Linear scale.
  19306. @item log
  19307. Logarithmic scale.
  19308. @item rlog
  19309. Reverse logarithmic scale.
  19310. @end table
  19311. Default is @code{lin}.
  19312. @item win_size
  19313. Set window size. Allowed range is from 16 to 65536.
  19314. Default is @code{2048}
  19315. @item win_func
  19316. Set windowing function.
  19317. It accepts the following values:
  19318. @table @samp
  19319. @item rect
  19320. @item bartlett
  19321. @item hanning
  19322. @item hamming
  19323. @item blackman
  19324. @item welch
  19325. @item flattop
  19326. @item bharris
  19327. @item bnuttall
  19328. @item bhann
  19329. @item sine
  19330. @item nuttall
  19331. @item lanczos
  19332. @item gauss
  19333. @item tukey
  19334. @item dolph
  19335. @item cauchy
  19336. @item parzen
  19337. @item poisson
  19338. @item bohman
  19339. @end table
  19340. Default is @code{hanning}.
  19341. @item overlap
  19342. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19343. which means optimal overlap for selected window function will be picked.
  19344. @item averaging
  19345. Set time averaging. Setting this to 0 will display current maximal peaks.
  19346. Default is @code{1}, which means time averaging is disabled.
  19347. @item colors
  19348. Specify list of colors separated by space or by '|' which will be used to
  19349. draw channel frequencies. Unrecognized or missing colors will be replaced
  19350. by white color.
  19351. @item cmode
  19352. Set channel display mode.
  19353. It accepts the following values:
  19354. @table @samp
  19355. @item combined
  19356. @item separate
  19357. @end table
  19358. Default is @code{combined}.
  19359. @item minamp
  19360. Set minimum amplitude used in @code{log} amplitude scaler.
  19361. @item data
  19362. Set data display mode.
  19363. It accepts the following values:
  19364. @table @samp
  19365. @item magnitude
  19366. @item phase
  19367. @item delay
  19368. @end table
  19369. Default is @code{magnitude}.
  19370. @end table
  19371. @section showspatial
  19372. Convert stereo input audio to a video output, representing the spatial relationship
  19373. between two channels.
  19374. The filter accepts the following options:
  19375. @table @option
  19376. @item size, s
  19377. Specify the video size for the output. For the syntax of this option, check the
  19378. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19379. Default value is @code{512x512}.
  19380. @item win_size
  19381. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19382. @item win_func
  19383. Set window function.
  19384. It accepts the following values:
  19385. @table @samp
  19386. @item rect
  19387. @item bartlett
  19388. @item hann
  19389. @item hanning
  19390. @item hamming
  19391. @item blackman
  19392. @item welch
  19393. @item flattop
  19394. @item bharris
  19395. @item bnuttall
  19396. @item bhann
  19397. @item sine
  19398. @item nuttall
  19399. @item lanczos
  19400. @item gauss
  19401. @item tukey
  19402. @item dolph
  19403. @item cauchy
  19404. @item parzen
  19405. @item poisson
  19406. @item bohman
  19407. @end table
  19408. Default value is @code{hann}.
  19409. @item overlap
  19410. Set ratio of overlap window. Default value is @code{0.5}.
  19411. When value is @code{1} overlap is set to recommended size for specific
  19412. window function currently used.
  19413. @end table
  19414. @anchor{showspectrum}
  19415. @section showspectrum
  19416. Convert input audio to a video output, representing the audio frequency
  19417. spectrum.
  19418. The filter accepts the following options:
  19419. @table @option
  19420. @item size, s
  19421. Specify the video size for the output. For the syntax of this option, check the
  19422. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19423. Default value is @code{640x512}.
  19424. @item slide
  19425. Specify how the spectrum should slide along the window.
  19426. It accepts the following values:
  19427. @table @samp
  19428. @item replace
  19429. the samples start again on the left when they reach the right
  19430. @item scroll
  19431. the samples scroll from right to left
  19432. @item fullframe
  19433. frames are only produced when the samples reach the right
  19434. @item rscroll
  19435. the samples scroll from left to right
  19436. @end table
  19437. Default value is @code{replace}.
  19438. @item mode
  19439. Specify display mode.
  19440. It accepts the following values:
  19441. @table @samp
  19442. @item combined
  19443. all channels are displayed in the same row
  19444. @item separate
  19445. all channels are displayed in separate rows
  19446. @end table
  19447. Default value is @samp{combined}.
  19448. @item color
  19449. Specify display color mode.
  19450. It accepts the following values:
  19451. @table @samp
  19452. @item channel
  19453. each channel is displayed in a separate color
  19454. @item intensity
  19455. each channel is displayed using the same color scheme
  19456. @item rainbow
  19457. each channel is displayed using the rainbow color scheme
  19458. @item moreland
  19459. each channel is displayed using the moreland color scheme
  19460. @item nebulae
  19461. each channel is displayed using the nebulae color scheme
  19462. @item fire
  19463. each channel is displayed using the fire color scheme
  19464. @item fiery
  19465. each channel is displayed using the fiery color scheme
  19466. @item fruit
  19467. each channel is displayed using the fruit color scheme
  19468. @item cool
  19469. each channel is displayed using the cool color scheme
  19470. @item magma
  19471. each channel is displayed using the magma color scheme
  19472. @item green
  19473. each channel is displayed using the green color scheme
  19474. @item viridis
  19475. each channel is displayed using the viridis color scheme
  19476. @item plasma
  19477. each channel is displayed using the plasma color scheme
  19478. @item cividis
  19479. each channel is displayed using the cividis color scheme
  19480. @item terrain
  19481. each channel is displayed using the terrain color scheme
  19482. @end table
  19483. Default value is @samp{channel}.
  19484. @item scale
  19485. Specify scale used for calculating intensity color values.
  19486. It accepts the following values:
  19487. @table @samp
  19488. @item lin
  19489. linear
  19490. @item sqrt
  19491. square root, default
  19492. @item cbrt
  19493. cubic root
  19494. @item log
  19495. logarithmic
  19496. @item 4thrt
  19497. 4th root
  19498. @item 5thrt
  19499. 5th root
  19500. @end table
  19501. Default value is @samp{sqrt}.
  19502. @item fscale
  19503. Specify frequency scale.
  19504. It accepts the following values:
  19505. @table @samp
  19506. @item lin
  19507. linear
  19508. @item log
  19509. logarithmic
  19510. @end table
  19511. Default value is @samp{lin}.
  19512. @item saturation
  19513. Set saturation modifier for displayed colors. Negative values provide
  19514. alternative color scheme. @code{0} is no saturation at all.
  19515. Saturation must be in [-10.0, 10.0] range.
  19516. Default value is @code{1}.
  19517. @item win_func
  19518. Set window function.
  19519. It accepts the following values:
  19520. @table @samp
  19521. @item rect
  19522. @item bartlett
  19523. @item hann
  19524. @item hanning
  19525. @item hamming
  19526. @item blackman
  19527. @item welch
  19528. @item flattop
  19529. @item bharris
  19530. @item bnuttall
  19531. @item bhann
  19532. @item sine
  19533. @item nuttall
  19534. @item lanczos
  19535. @item gauss
  19536. @item tukey
  19537. @item dolph
  19538. @item cauchy
  19539. @item parzen
  19540. @item poisson
  19541. @item bohman
  19542. @end table
  19543. Default value is @code{hann}.
  19544. @item orientation
  19545. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19546. @code{horizontal}. Default is @code{vertical}.
  19547. @item overlap
  19548. Set ratio of overlap window. Default value is @code{0}.
  19549. When value is @code{1} overlap is set to recommended size for specific
  19550. window function currently used.
  19551. @item gain
  19552. Set scale gain for calculating intensity color values.
  19553. Default value is @code{1}.
  19554. @item data
  19555. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19556. @item rotation
  19557. Set color rotation, must be in [-1.0, 1.0] range.
  19558. Default value is @code{0}.
  19559. @item start
  19560. Set start frequency from which to display spectrogram. Default is @code{0}.
  19561. @item stop
  19562. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19563. @item fps
  19564. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19565. @item legend
  19566. Draw time and frequency axes and legends. Default is disabled.
  19567. @end table
  19568. The usage is very similar to the showwaves filter; see the examples in that
  19569. section.
  19570. @subsection Examples
  19571. @itemize
  19572. @item
  19573. Large window with logarithmic color scaling:
  19574. @example
  19575. showspectrum=s=1280x480:scale=log
  19576. @end example
  19577. @item
  19578. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19579. @example
  19580. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19581. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19582. @end example
  19583. @end itemize
  19584. @section showspectrumpic
  19585. Convert input audio to a single video frame, representing the audio frequency
  19586. spectrum.
  19587. The filter accepts the following options:
  19588. @table @option
  19589. @item size, s
  19590. Specify the video size for the output. For the syntax of this option, check the
  19591. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19592. Default value is @code{4096x2048}.
  19593. @item mode
  19594. Specify display mode.
  19595. It accepts the following values:
  19596. @table @samp
  19597. @item combined
  19598. all channels are displayed in the same row
  19599. @item separate
  19600. all channels are displayed in separate rows
  19601. @end table
  19602. Default value is @samp{combined}.
  19603. @item color
  19604. Specify display color mode.
  19605. It accepts the following values:
  19606. @table @samp
  19607. @item channel
  19608. each channel is displayed in a separate color
  19609. @item intensity
  19610. each channel is displayed using the same color scheme
  19611. @item rainbow
  19612. each channel is displayed using the rainbow color scheme
  19613. @item moreland
  19614. each channel is displayed using the moreland color scheme
  19615. @item nebulae
  19616. each channel is displayed using the nebulae color scheme
  19617. @item fire
  19618. each channel is displayed using the fire color scheme
  19619. @item fiery
  19620. each channel is displayed using the fiery color scheme
  19621. @item fruit
  19622. each channel is displayed using the fruit color scheme
  19623. @item cool
  19624. each channel is displayed using the cool color scheme
  19625. @item magma
  19626. each channel is displayed using the magma color scheme
  19627. @item green
  19628. each channel is displayed using the green color scheme
  19629. @item viridis
  19630. each channel is displayed using the viridis color scheme
  19631. @item plasma
  19632. each channel is displayed using the plasma color scheme
  19633. @item cividis
  19634. each channel is displayed using the cividis color scheme
  19635. @item terrain
  19636. each channel is displayed using the terrain color scheme
  19637. @end table
  19638. Default value is @samp{intensity}.
  19639. @item scale
  19640. Specify scale used for calculating intensity color values.
  19641. It accepts the following values:
  19642. @table @samp
  19643. @item lin
  19644. linear
  19645. @item sqrt
  19646. square root, default
  19647. @item cbrt
  19648. cubic root
  19649. @item log
  19650. logarithmic
  19651. @item 4thrt
  19652. 4th root
  19653. @item 5thrt
  19654. 5th root
  19655. @end table
  19656. Default value is @samp{log}.
  19657. @item fscale
  19658. Specify frequency scale.
  19659. It accepts the following values:
  19660. @table @samp
  19661. @item lin
  19662. linear
  19663. @item log
  19664. logarithmic
  19665. @end table
  19666. Default value is @samp{lin}.
  19667. @item saturation
  19668. Set saturation modifier for displayed colors. Negative values provide
  19669. alternative color scheme. @code{0} is no saturation at all.
  19670. Saturation must be in [-10.0, 10.0] range.
  19671. Default value is @code{1}.
  19672. @item win_func
  19673. Set window function.
  19674. It accepts the following values:
  19675. @table @samp
  19676. @item rect
  19677. @item bartlett
  19678. @item hann
  19679. @item hanning
  19680. @item hamming
  19681. @item blackman
  19682. @item welch
  19683. @item flattop
  19684. @item bharris
  19685. @item bnuttall
  19686. @item bhann
  19687. @item sine
  19688. @item nuttall
  19689. @item lanczos
  19690. @item gauss
  19691. @item tukey
  19692. @item dolph
  19693. @item cauchy
  19694. @item parzen
  19695. @item poisson
  19696. @item bohman
  19697. @end table
  19698. Default value is @code{hann}.
  19699. @item orientation
  19700. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19701. @code{horizontal}. Default is @code{vertical}.
  19702. @item gain
  19703. Set scale gain for calculating intensity color values.
  19704. Default value is @code{1}.
  19705. @item legend
  19706. Draw time and frequency axes and legends. Default is enabled.
  19707. @item rotation
  19708. Set color rotation, must be in [-1.0, 1.0] range.
  19709. Default value is @code{0}.
  19710. @item start
  19711. Set start frequency from which to display spectrogram. Default is @code{0}.
  19712. @item stop
  19713. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19714. @end table
  19715. @subsection Examples
  19716. @itemize
  19717. @item
  19718. Extract an audio spectrogram of a whole audio track
  19719. in a 1024x1024 picture using @command{ffmpeg}:
  19720. @example
  19721. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19722. @end example
  19723. @end itemize
  19724. @section showvolume
  19725. Convert input audio volume to a video output.
  19726. The filter accepts the following options:
  19727. @table @option
  19728. @item rate, r
  19729. Set video rate.
  19730. @item b
  19731. Set border width, allowed range is [0, 5]. Default is 1.
  19732. @item w
  19733. Set channel width, allowed range is [80, 8192]. Default is 400.
  19734. @item h
  19735. Set channel height, allowed range is [1, 900]. Default is 20.
  19736. @item f
  19737. Set fade, allowed range is [0, 1]. Default is 0.95.
  19738. @item c
  19739. Set volume color expression.
  19740. The expression can use the following variables:
  19741. @table @option
  19742. @item VOLUME
  19743. Current max volume of channel in dB.
  19744. @item PEAK
  19745. Current peak.
  19746. @item CHANNEL
  19747. Current channel number, starting from 0.
  19748. @end table
  19749. @item t
  19750. If set, displays channel names. Default is enabled.
  19751. @item v
  19752. If set, displays volume values. Default is enabled.
  19753. @item o
  19754. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19755. default is @code{h}.
  19756. @item s
  19757. Set step size, allowed range is [0, 5]. Default is 0, which means
  19758. step is disabled.
  19759. @item p
  19760. Set background opacity, allowed range is [0, 1]. Default is 0.
  19761. @item m
  19762. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19763. default is @code{p}.
  19764. @item ds
  19765. Set display scale, can be linear: @code{lin} or log: @code{log},
  19766. default is @code{lin}.
  19767. @item dm
  19768. In second.
  19769. If set to > 0., display a line for the max level
  19770. in the previous seconds.
  19771. default is disabled: @code{0.}
  19772. @item dmc
  19773. The color of the max line. Use when @code{dm} option is set to > 0.
  19774. default is: @code{orange}
  19775. @end table
  19776. @section showwaves
  19777. Convert input audio to a video output, representing the samples waves.
  19778. The filter accepts the following options:
  19779. @table @option
  19780. @item size, s
  19781. Specify the video size for the output. For the syntax of this option, check the
  19782. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19783. Default value is @code{600x240}.
  19784. @item mode
  19785. Set display mode.
  19786. Available values are:
  19787. @table @samp
  19788. @item point
  19789. Draw a point for each sample.
  19790. @item line
  19791. Draw a vertical line for each sample.
  19792. @item p2p
  19793. Draw a point for each sample and a line between them.
  19794. @item cline
  19795. Draw a centered vertical line for each sample.
  19796. @end table
  19797. Default value is @code{point}.
  19798. @item n
  19799. Set the number of samples which are printed on the same column. A
  19800. larger value will decrease the frame rate. Must be a positive
  19801. integer. This option can be set only if the value for @var{rate}
  19802. is not explicitly specified.
  19803. @item rate, r
  19804. Set the (approximate) output frame rate. This is done by setting the
  19805. option @var{n}. Default value is "25".
  19806. @item split_channels
  19807. Set if channels should be drawn separately or overlap. Default value is 0.
  19808. @item colors
  19809. Set colors separated by '|' which are going to be used for drawing of each channel.
  19810. @item scale
  19811. Set amplitude scale.
  19812. Available values are:
  19813. @table @samp
  19814. @item lin
  19815. Linear.
  19816. @item log
  19817. Logarithmic.
  19818. @item sqrt
  19819. Square root.
  19820. @item cbrt
  19821. Cubic root.
  19822. @end table
  19823. Default is linear.
  19824. @item draw
  19825. Set the draw mode. This is mostly useful to set for high @var{n}.
  19826. Available values are:
  19827. @table @samp
  19828. @item scale
  19829. Scale pixel values for each drawn sample.
  19830. @item full
  19831. Draw every sample directly.
  19832. @end table
  19833. Default value is @code{scale}.
  19834. @end table
  19835. @subsection Examples
  19836. @itemize
  19837. @item
  19838. Output the input file audio and the corresponding video representation
  19839. at the same time:
  19840. @example
  19841. amovie=a.mp3,asplit[out0],showwaves[out1]
  19842. @end example
  19843. @item
  19844. Create a synthetic signal and show it with showwaves, forcing a
  19845. frame rate of 30 frames per second:
  19846. @example
  19847. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19848. @end example
  19849. @end itemize
  19850. @section showwavespic
  19851. Convert input audio to a single video frame, representing the samples waves.
  19852. The filter accepts the following options:
  19853. @table @option
  19854. @item size, s
  19855. Specify the video size for the output. For the syntax of this option, check the
  19856. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19857. Default value is @code{600x240}.
  19858. @item split_channels
  19859. Set if channels should be drawn separately or overlap. Default value is 0.
  19860. @item colors
  19861. Set colors separated by '|' which are going to be used for drawing of each channel.
  19862. @item scale
  19863. Set amplitude scale.
  19864. Available values are:
  19865. @table @samp
  19866. @item lin
  19867. Linear.
  19868. @item log
  19869. Logarithmic.
  19870. @item sqrt
  19871. Square root.
  19872. @item cbrt
  19873. Cubic root.
  19874. @end table
  19875. Default is linear.
  19876. @item draw
  19877. Set the draw mode.
  19878. Available values are:
  19879. @table @samp
  19880. @item scale
  19881. Scale pixel values for each drawn sample.
  19882. @item full
  19883. Draw every sample directly.
  19884. @end table
  19885. Default value is @code{scale}.
  19886. @item filter
  19887. Set the filter mode.
  19888. Available values are:
  19889. @table @samp
  19890. @item average
  19891. Use average samples values for each drawn sample.
  19892. @item peak
  19893. Use peak samples values for each drawn sample.
  19894. @end table
  19895. Default value is @code{average}.
  19896. @end table
  19897. @subsection Examples
  19898. @itemize
  19899. @item
  19900. Extract a channel split representation of the wave form of a whole audio track
  19901. in a 1024x800 picture using @command{ffmpeg}:
  19902. @example
  19903. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19904. @end example
  19905. @end itemize
  19906. @section sidedata, asidedata
  19907. Delete frame side data, or select frames based on it.
  19908. This filter accepts the following options:
  19909. @table @option
  19910. @item mode
  19911. Set mode of operation of the filter.
  19912. Can be one of the following:
  19913. @table @samp
  19914. @item select
  19915. Select every frame with side data of @code{type}.
  19916. @item delete
  19917. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19918. data in the frame.
  19919. @end table
  19920. @item type
  19921. Set side data type used with all modes. Must be set for @code{select} mode. For
  19922. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19923. in @file{libavutil/frame.h}. For example, to choose
  19924. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19925. @end table
  19926. @section spectrumsynth
  19927. Synthesize audio from 2 input video spectrums, first input stream represents
  19928. magnitude across time and second represents phase across time.
  19929. The filter will transform from frequency domain as displayed in videos back
  19930. to time domain as presented in audio output.
  19931. This filter is primarily created for reversing processed @ref{showspectrum}
  19932. filter outputs, but can synthesize sound from other spectrograms too.
  19933. But in such case results are going to be poor if the phase data is not
  19934. available, because in such cases phase data need to be recreated, usually
  19935. it's just recreated from random noise.
  19936. For best results use gray only output (@code{channel} color mode in
  19937. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19938. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19939. @code{data} option. Inputs videos should generally use @code{fullframe}
  19940. slide mode as that saves resources needed for decoding video.
  19941. The filter accepts the following options:
  19942. @table @option
  19943. @item sample_rate
  19944. Specify sample rate of output audio, the sample rate of audio from which
  19945. spectrum was generated may differ.
  19946. @item channels
  19947. Set number of channels represented in input video spectrums.
  19948. @item scale
  19949. Set scale which was used when generating magnitude input spectrum.
  19950. Can be @code{lin} or @code{log}. Default is @code{log}.
  19951. @item slide
  19952. Set slide which was used when generating inputs spectrums.
  19953. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19954. Default is @code{fullframe}.
  19955. @item win_func
  19956. Set window function used for resynthesis.
  19957. @item overlap
  19958. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19959. which means optimal overlap for selected window function will be picked.
  19960. @item orientation
  19961. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19962. Default is @code{vertical}.
  19963. @end table
  19964. @subsection Examples
  19965. @itemize
  19966. @item
  19967. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19968. then resynthesize videos back to audio with spectrumsynth:
  19969. @example
  19970. 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
  19971. 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
  19972. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19973. @end example
  19974. @end itemize
  19975. @section split, asplit
  19976. Split input into several identical outputs.
  19977. @code{asplit} works with audio input, @code{split} with video.
  19978. The filter accepts a single parameter which specifies the number of outputs. If
  19979. unspecified, it defaults to 2.
  19980. @subsection Examples
  19981. @itemize
  19982. @item
  19983. Create two separate outputs from the same input:
  19984. @example
  19985. [in] split [out0][out1]
  19986. @end example
  19987. @item
  19988. To create 3 or more outputs, you need to specify the number of
  19989. outputs, like in:
  19990. @example
  19991. [in] asplit=3 [out0][out1][out2]
  19992. @end example
  19993. @item
  19994. Create two separate outputs from the same input, one cropped and
  19995. one padded:
  19996. @example
  19997. [in] split [splitout1][splitout2];
  19998. [splitout1] crop=100:100:0:0 [cropout];
  19999. [splitout2] pad=200:200:100:100 [padout];
  20000. @end example
  20001. @item
  20002. Create 5 copies of the input audio with @command{ffmpeg}:
  20003. @example
  20004. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20005. @end example
  20006. @end itemize
  20007. @section zmq, azmq
  20008. Receive commands sent through a libzmq client, and forward them to
  20009. filters in the filtergraph.
  20010. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20011. must be inserted between two video filters, @code{azmq} between two
  20012. audio filters. Both are capable to send messages to any filter type.
  20013. To enable these filters you need to install the libzmq library and
  20014. headers and configure FFmpeg with @code{--enable-libzmq}.
  20015. For more information about libzmq see:
  20016. @url{http://www.zeromq.org/}
  20017. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20018. receives messages sent through a network interface defined by the
  20019. @option{bind_address} (or the abbreviation "@option{b}") option.
  20020. Default value of this option is @file{tcp://localhost:5555}. You may
  20021. want to alter this value to your needs, but do not forget to escape any
  20022. ':' signs (see @ref{filtergraph escaping}).
  20023. The received message must be in the form:
  20024. @example
  20025. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20026. @end example
  20027. @var{TARGET} specifies the target of the command, usually the name of
  20028. the filter class or a specific filter instance name. The default
  20029. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20030. but you can override this by using the @samp{filter_name@@id} syntax
  20031. (see @ref{Filtergraph syntax}).
  20032. @var{COMMAND} specifies the name of the command for the target filter.
  20033. @var{ARG} is optional and specifies the optional argument list for the
  20034. given @var{COMMAND}.
  20035. Upon reception, the message is processed and the corresponding command
  20036. is injected into the filtergraph. Depending on the result, the filter
  20037. will send a reply to the client, adopting the format:
  20038. @example
  20039. @var{ERROR_CODE} @var{ERROR_REASON}
  20040. @var{MESSAGE}
  20041. @end example
  20042. @var{MESSAGE} is optional.
  20043. @subsection Examples
  20044. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20045. be used to send commands processed by these filters.
  20046. Consider the following filtergraph generated by @command{ffplay}.
  20047. In this example the last overlay filter has an instance name. All other
  20048. filters will have default instance names.
  20049. @example
  20050. ffplay -dumpgraph 1 -f lavfi "
  20051. color=s=100x100:c=red [l];
  20052. color=s=100x100:c=blue [r];
  20053. nullsrc=s=200x100, zmq [bg];
  20054. [bg][l] overlay [bg+l];
  20055. [bg+l][r] overlay@@my=x=100 "
  20056. @end example
  20057. To change the color of the left side of the video, the following
  20058. command can be used:
  20059. @example
  20060. echo Parsed_color_0 c yellow | tools/zmqsend
  20061. @end example
  20062. To change the right side:
  20063. @example
  20064. echo Parsed_color_1 c pink | tools/zmqsend
  20065. @end example
  20066. To change the position of the right side:
  20067. @example
  20068. echo overlay@@my x 150 | tools/zmqsend
  20069. @end example
  20070. @c man end MULTIMEDIA FILTERS
  20071. @chapter Multimedia Sources
  20072. @c man begin MULTIMEDIA SOURCES
  20073. Below is a description of the currently available multimedia sources.
  20074. @section amovie
  20075. This is the same as @ref{movie} source, except it selects an audio
  20076. stream by default.
  20077. @anchor{movie}
  20078. @section movie
  20079. Read audio and/or video stream(s) from a movie container.
  20080. It accepts the following parameters:
  20081. @table @option
  20082. @item filename
  20083. The name of the resource to read (not necessarily a file; it can also be a
  20084. device or a stream accessed through some protocol).
  20085. @item format_name, f
  20086. Specifies the format assumed for the movie to read, and can be either
  20087. the name of a container or an input device. If not specified, the
  20088. format is guessed from @var{movie_name} or by probing.
  20089. @item seek_point, sp
  20090. Specifies the seek point in seconds. The frames will be output
  20091. starting from this seek point. The parameter is evaluated with
  20092. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20093. postfix. The default value is "0".
  20094. @item streams, s
  20095. Specifies the streams to read. Several streams can be specified,
  20096. separated by "+". The source will then have as many outputs, in the
  20097. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20098. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20099. respectively the default (best suited) video and audio stream. Default
  20100. is "dv", or "da" if the filter is called as "amovie".
  20101. @item stream_index, si
  20102. Specifies the index of the video stream to read. If the value is -1,
  20103. the most suitable video stream will be automatically selected. The default
  20104. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20105. audio instead of video.
  20106. @item loop
  20107. Specifies how many times to read the stream in sequence.
  20108. If the value is 0, the stream will be looped infinitely.
  20109. Default value is "1".
  20110. Note that when the movie is looped the source timestamps are not
  20111. changed, so it will generate non monotonically increasing timestamps.
  20112. @item discontinuity
  20113. Specifies the time difference between frames above which the point is
  20114. considered a timestamp discontinuity which is removed by adjusting the later
  20115. timestamps.
  20116. @end table
  20117. It allows overlaying a second video on top of the main input of
  20118. a filtergraph, as shown in this graph:
  20119. @example
  20120. input -----------> deltapts0 --> overlay --> output
  20121. ^
  20122. |
  20123. movie --> scale--> deltapts1 -------+
  20124. @end example
  20125. @subsection Examples
  20126. @itemize
  20127. @item
  20128. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20129. on top of the input labelled "in":
  20130. @example
  20131. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20132. [in] setpts=PTS-STARTPTS [main];
  20133. [main][over] overlay=16:16 [out]
  20134. @end example
  20135. @item
  20136. Read from a video4linux2 device, and overlay it on top of the input
  20137. labelled "in":
  20138. @example
  20139. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20140. [in] setpts=PTS-STARTPTS [main];
  20141. [main][over] overlay=16:16 [out]
  20142. @end example
  20143. @item
  20144. Read the first video stream and the audio stream with id 0x81 from
  20145. dvd.vob; the video is connected to the pad named "video" and the audio is
  20146. connected to the pad named "audio":
  20147. @example
  20148. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20149. @end example
  20150. @end itemize
  20151. @subsection Commands
  20152. Both movie and amovie support the following commands:
  20153. @table @option
  20154. @item seek
  20155. Perform seek using "av_seek_frame".
  20156. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20157. @itemize
  20158. @item
  20159. @var{stream_index}: If stream_index is -1, a default
  20160. stream is selected, and @var{timestamp} is automatically converted
  20161. from AV_TIME_BASE units to the stream specific time_base.
  20162. @item
  20163. @var{timestamp}: Timestamp in AVStream.time_base units
  20164. or, if no stream is specified, in AV_TIME_BASE units.
  20165. @item
  20166. @var{flags}: Flags which select direction and seeking mode.
  20167. @end itemize
  20168. @item get_duration
  20169. Get movie duration in AV_TIME_BASE units.
  20170. @end table
  20171. @c man end MULTIMEDIA SOURCES