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.

26475 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 skip
  6863. Set the number of initial frames for which evaluation is skipped.
  6864. Default is 2. Range is 0 to INT_MAX.
  6865. @item reset_count, reset
  6866. Set the counter that determines after how many frames cropdetect will
  6867. reset the previously detected largest video area and start over to
  6868. detect the current optimal crop area. Default value is 0.
  6869. This can be useful when channel logos distort the video area. 0
  6870. indicates 'never reset', and returns the largest area encountered during
  6871. playback.
  6872. @end table
  6873. @anchor{cue}
  6874. @section cue
  6875. Delay video filtering until a given wallclock timestamp. The filter first
  6876. passes on @option{preroll} amount of frames, then it buffers at most
  6877. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6878. it forwards the buffered frames and also any subsequent frames coming in its
  6879. input.
  6880. The filter can be used synchronize the output of multiple ffmpeg processes for
  6881. realtime output devices like decklink. By putting the delay in the filtering
  6882. chain and pre-buffering frames the process can pass on data to output almost
  6883. immediately after the target wallclock timestamp is reached.
  6884. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6885. some use cases.
  6886. @table @option
  6887. @item cue
  6888. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6889. @item preroll
  6890. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6891. @item buffer
  6892. The maximum duration of content to buffer before waiting for the cue expressed
  6893. in seconds. Default is 0.
  6894. @end table
  6895. @anchor{curves}
  6896. @section curves
  6897. Apply color adjustments using curves.
  6898. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6899. component (red, green and blue) has its values defined by @var{N} key points
  6900. tied from each other using a smooth curve. The x-axis represents the pixel
  6901. values from the input frame, and the y-axis the new pixel values to be set for
  6902. the output frame.
  6903. By default, a component curve is defined by the two points @var{(0;0)} and
  6904. @var{(1;1)}. This creates a straight line where each original pixel value is
  6905. "adjusted" to its own value, which means no change to the image.
  6906. The filter allows you to redefine these two points and add some more. A new
  6907. curve (using a natural cubic spline interpolation) will be define to pass
  6908. smoothly through all these new coordinates. The new defined points needs to be
  6909. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6910. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6911. the vector spaces, the values will be clipped accordingly.
  6912. The filter accepts the following options:
  6913. @table @option
  6914. @item preset
  6915. Select one of the available color presets. This option can be used in addition
  6916. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6917. options takes priority on the preset values.
  6918. Available presets are:
  6919. @table @samp
  6920. @item none
  6921. @item color_negative
  6922. @item cross_process
  6923. @item darker
  6924. @item increase_contrast
  6925. @item lighter
  6926. @item linear_contrast
  6927. @item medium_contrast
  6928. @item negative
  6929. @item strong_contrast
  6930. @item vintage
  6931. @end table
  6932. Default is @code{none}.
  6933. @item master, m
  6934. Set the master key points. These points will define a second pass mapping. It
  6935. is sometimes called a "luminance" or "value" mapping. It can be used with
  6936. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6937. post-processing LUT.
  6938. @item red, r
  6939. Set the key points for the red component.
  6940. @item green, g
  6941. Set the key points for the green component.
  6942. @item blue, b
  6943. Set the key points for the blue component.
  6944. @item all
  6945. Set the key points for all components (not including master).
  6946. Can be used in addition to the other key points component
  6947. options. In this case, the unset component(s) will fallback on this
  6948. @option{all} setting.
  6949. @item psfile
  6950. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6951. @item plot
  6952. Save Gnuplot script of the curves in specified file.
  6953. @end table
  6954. To avoid some filtergraph syntax conflicts, each key points list need to be
  6955. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6956. @subsection Examples
  6957. @itemize
  6958. @item
  6959. Increase slightly the middle level of blue:
  6960. @example
  6961. curves=blue='0/0 0.5/0.58 1/1'
  6962. @end example
  6963. @item
  6964. Vintage effect:
  6965. @example
  6966. 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'
  6967. @end example
  6968. Here we obtain the following coordinates for each components:
  6969. @table @var
  6970. @item red
  6971. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6972. @item green
  6973. @code{(0;0) (0.50;0.48) (1;1)}
  6974. @item blue
  6975. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6976. @end table
  6977. @item
  6978. The previous example can also be achieved with the associated built-in preset:
  6979. @example
  6980. curves=preset=vintage
  6981. @end example
  6982. @item
  6983. Or simply:
  6984. @example
  6985. curves=vintage
  6986. @end example
  6987. @item
  6988. Use a Photoshop preset and redefine the points of the green component:
  6989. @example
  6990. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6991. @end example
  6992. @item
  6993. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6994. and @command{gnuplot}:
  6995. @example
  6996. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6997. gnuplot -p /tmp/curves.plt
  6998. @end example
  6999. @end itemize
  7000. @section datascope
  7001. Video data analysis filter.
  7002. This filter shows hexadecimal pixel values of part of video.
  7003. The filter accepts the following options:
  7004. @table @option
  7005. @item size, s
  7006. Set output video size.
  7007. @item x
  7008. Set x offset from where to pick pixels.
  7009. @item y
  7010. Set y offset from where to pick pixels.
  7011. @item mode
  7012. Set scope mode, can be one of the following:
  7013. @table @samp
  7014. @item mono
  7015. Draw hexadecimal pixel values with white color on black background.
  7016. @item color
  7017. Draw hexadecimal pixel values with input video pixel color on black
  7018. background.
  7019. @item color2
  7020. Draw hexadecimal pixel values on color background picked from input video,
  7021. the text color is picked in such way so its always visible.
  7022. @end table
  7023. @item axis
  7024. Draw rows and columns numbers on left and top of video.
  7025. @item opacity
  7026. Set background opacity.
  7027. @item format
  7028. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7029. @end table
  7030. @section dblur
  7031. Apply Directional blur filter.
  7032. The filter accepts the following options:
  7033. @table @option
  7034. @item angle
  7035. Set angle of directional blur. Default is @code{45}.
  7036. @item radius
  7037. Set radius of directional blur. Default is @code{5}.
  7038. @item planes
  7039. Set which planes to filter. By default all planes are filtered.
  7040. @end table
  7041. @subsection Commands
  7042. This filter supports same @ref{commands} as options.
  7043. The command accepts the same syntax of the corresponding option.
  7044. If the specified expression is not valid, it is kept at its current
  7045. value.
  7046. @section dctdnoiz
  7047. Denoise frames using 2D DCT (frequency domain filtering).
  7048. This filter is not designed for real time.
  7049. The filter accepts the following options:
  7050. @table @option
  7051. @item sigma, s
  7052. Set the noise sigma constant.
  7053. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7054. coefficient (absolute value) below this threshold with be dropped.
  7055. If you need a more advanced filtering, see @option{expr}.
  7056. Default is @code{0}.
  7057. @item overlap
  7058. Set number overlapping pixels for each block. Since the filter can be slow, you
  7059. may want to reduce this value, at the cost of a less effective filter and the
  7060. risk of various artefacts.
  7061. If the overlapping value doesn't permit processing the whole input width or
  7062. height, a warning will be displayed and according borders won't be denoised.
  7063. Default value is @var{blocksize}-1, which is the best possible setting.
  7064. @item expr, e
  7065. Set the coefficient factor expression.
  7066. For each coefficient of a DCT block, this expression will be evaluated as a
  7067. multiplier value for the coefficient.
  7068. If this is option is set, the @option{sigma} option will be ignored.
  7069. The absolute value of the coefficient can be accessed through the @var{c}
  7070. variable.
  7071. @item n
  7072. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7073. @var{blocksize}, which is the width and height of the processed blocks.
  7074. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7075. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7076. on the speed processing. Also, a larger block size does not necessarily means a
  7077. better de-noising.
  7078. @end table
  7079. @subsection Examples
  7080. Apply a denoise with a @option{sigma} of @code{4.5}:
  7081. @example
  7082. dctdnoiz=4.5
  7083. @end example
  7084. The same operation can be achieved using the expression system:
  7085. @example
  7086. dctdnoiz=e='gte(c, 4.5*3)'
  7087. @end example
  7088. Violent denoise using a block size of @code{16x16}:
  7089. @example
  7090. dctdnoiz=15:n=4
  7091. @end example
  7092. @section deband
  7093. Remove banding artifacts from input video.
  7094. It works by replacing banded pixels with average value of referenced pixels.
  7095. The filter accepts the following options:
  7096. @table @option
  7097. @item 1thr
  7098. @item 2thr
  7099. @item 3thr
  7100. @item 4thr
  7101. Set banding detection threshold for each plane. Default is 0.02.
  7102. Valid range is 0.00003 to 0.5.
  7103. If difference between current pixel and reference pixel is less than threshold,
  7104. it will be considered as banded.
  7105. @item range, r
  7106. Banding detection range in pixels. Default is 16. If positive, random number
  7107. in range 0 to set value will be used. If negative, exact absolute value
  7108. will be used.
  7109. The range defines square of four pixels around current pixel.
  7110. @item direction, d
  7111. Set direction in radians from which four pixel will be compared. If positive,
  7112. random direction from 0 to set direction will be picked. If negative, exact of
  7113. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7114. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7115. column.
  7116. @item blur, b
  7117. If enabled, current pixel is compared with average value of all four
  7118. surrounding pixels. The default is enabled. If disabled current pixel is
  7119. compared with all four surrounding pixels. The pixel is considered banded
  7120. if only all four differences with surrounding pixels are less than threshold.
  7121. @item coupling, c
  7122. If enabled, current pixel is changed if and only if all pixel components are banded,
  7123. e.g. banding detection threshold is triggered for all color components.
  7124. The default is disabled.
  7125. @end table
  7126. @section deblock
  7127. Remove blocking artifacts from input video.
  7128. The filter accepts the following options:
  7129. @table @option
  7130. @item filter
  7131. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7132. This controls what kind of deblocking is applied.
  7133. @item block
  7134. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7135. @item alpha
  7136. @item beta
  7137. @item gamma
  7138. @item delta
  7139. Set blocking detection thresholds. Allowed range is 0 to 1.
  7140. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7141. Using higher threshold gives more deblocking strength.
  7142. Setting @var{alpha} controls threshold detection at exact edge of block.
  7143. Remaining options controls threshold detection near the edge. Each one for
  7144. below/above or left/right. Setting any of those to @var{0} disables
  7145. deblocking.
  7146. @item planes
  7147. Set planes to filter. Default is to filter all available planes.
  7148. @end table
  7149. @subsection Examples
  7150. @itemize
  7151. @item
  7152. Deblock using weak filter and block size of 4 pixels.
  7153. @example
  7154. deblock=filter=weak:block=4
  7155. @end example
  7156. @item
  7157. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7158. deblocking more edges.
  7159. @example
  7160. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7161. @end example
  7162. @item
  7163. Similar as above, but filter only first plane.
  7164. @example
  7165. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7166. @end example
  7167. @item
  7168. Similar as above, but filter only second and third plane.
  7169. @example
  7170. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7171. @end example
  7172. @end itemize
  7173. @anchor{decimate}
  7174. @section decimate
  7175. Drop duplicated frames at regular intervals.
  7176. The filter accepts the following options:
  7177. @table @option
  7178. @item cycle
  7179. Set the number of frames from which one will be dropped. Setting this to
  7180. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7181. Default is @code{5}.
  7182. @item dupthresh
  7183. Set the threshold for duplicate detection. If the difference metric for a frame
  7184. is less than or equal to this value, then it is declared as duplicate. Default
  7185. is @code{1.1}
  7186. @item scthresh
  7187. Set scene change threshold. Default is @code{15}.
  7188. @item blockx
  7189. @item blocky
  7190. Set the size of the x and y-axis blocks used during metric calculations.
  7191. Larger blocks give better noise suppression, but also give worse detection of
  7192. small movements. Must be a power of two. Default is @code{32}.
  7193. @item ppsrc
  7194. Mark main input as a pre-processed input and activate clean source input
  7195. stream. This allows the input to be pre-processed with various filters to help
  7196. the metrics calculation while keeping the frame selection lossless. When set to
  7197. @code{1}, the first stream is for the pre-processed input, and the second
  7198. stream is the clean source from where the kept frames are chosen. Default is
  7199. @code{0}.
  7200. @item chroma
  7201. Set whether or not chroma is considered in the metric calculations. Default is
  7202. @code{1}.
  7203. @end table
  7204. @section deconvolve
  7205. Apply 2D deconvolution of video stream in frequency domain using second stream
  7206. as impulse.
  7207. The filter accepts the following options:
  7208. @table @option
  7209. @item planes
  7210. Set which planes to process.
  7211. @item impulse
  7212. Set which impulse video frames will be processed, can be @var{first}
  7213. or @var{all}. Default is @var{all}.
  7214. @item noise
  7215. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7216. and height are not same and not power of 2 or if stream prior to convolving
  7217. had noise.
  7218. @end table
  7219. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7220. @section dedot
  7221. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7222. It accepts the following options:
  7223. @table @option
  7224. @item m
  7225. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7226. @var{rainbows} for cross-color reduction.
  7227. @item lt
  7228. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7229. @item tl
  7230. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7231. @item tc
  7232. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7233. @item ct
  7234. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7235. @end table
  7236. @section deflate
  7237. Apply deflate effect to the video.
  7238. This filter replaces the pixel by the local(3x3) average by taking into account
  7239. only values lower than the pixel.
  7240. It accepts the following options:
  7241. @table @option
  7242. @item threshold0
  7243. @item threshold1
  7244. @item threshold2
  7245. @item threshold3
  7246. Limit the maximum change for each plane, default is 65535.
  7247. If 0, plane will remain unchanged.
  7248. @end table
  7249. @subsection Commands
  7250. This filter supports the all above options as @ref{commands}.
  7251. @section deflicker
  7252. Remove temporal frame luminance variations.
  7253. It accepts the following options:
  7254. @table @option
  7255. @item size, s
  7256. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7257. @item mode, m
  7258. Set averaging mode to smooth temporal luminance variations.
  7259. Available values are:
  7260. @table @samp
  7261. @item am
  7262. Arithmetic mean
  7263. @item gm
  7264. Geometric mean
  7265. @item hm
  7266. Harmonic mean
  7267. @item qm
  7268. Quadratic mean
  7269. @item cm
  7270. Cubic mean
  7271. @item pm
  7272. Power mean
  7273. @item median
  7274. Median
  7275. @end table
  7276. @item bypass
  7277. Do not actually modify frame. Useful when one only wants metadata.
  7278. @end table
  7279. @section dejudder
  7280. Remove judder produced by partially interlaced telecined content.
  7281. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7282. source was partially telecined content then the output of @code{pullup,dejudder}
  7283. will have a variable frame rate. May change the recorded frame rate of the
  7284. container. Aside from that change, this filter will not affect constant frame
  7285. rate video.
  7286. The option available in this filter is:
  7287. @table @option
  7288. @item cycle
  7289. Specify the length of the window over which the judder repeats.
  7290. Accepts any integer greater than 1. Useful values are:
  7291. @table @samp
  7292. @item 4
  7293. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7294. @item 5
  7295. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7296. @item 20
  7297. If a mixture of the two.
  7298. @end table
  7299. The default is @samp{4}.
  7300. @end table
  7301. @section delogo
  7302. Suppress a TV station logo by a simple interpolation of the surrounding
  7303. pixels. Just set a rectangle covering the logo and watch it disappear
  7304. (and sometimes something even uglier appear - your mileage may vary).
  7305. It accepts the following parameters:
  7306. @table @option
  7307. @item x
  7308. @item y
  7309. Specify the top left corner coordinates of the logo. They must be
  7310. specified.
  7311. @item w
  7312. @item h
  7313. Specify the width and height of the logo to clear. They must be
  7314. specified.
  7315. @item band, t
  7316. Specify the thickness of the fuzzy edge of the rectangle (added to
  7317. @var{w} and @var{h}). The default value is 1. This option is
  7318. deprecated, setting higher values should no longer be necessary and
  7319. is not recommended.
  7320. @item show
  7321. When set to 1, a green rectangle is drawn on the screen to simplify
  7322. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7323. The default value is 0.
  7324. The rectangle is drawn on the outermost pixels which will be (partly)
  7325. replaced with interpolated values. The values of the next pixels
  7326. immediately outside this rectangle in each direction will be used to
  7327. compute the interpolated pixel values inside the rectangle.
  7328. @end table
  7329. @subsection Examples
  7330. @itemize
  7331. @item
  7332. Set a rectangle covering the area with top left corner coordinates 0,0
  7333. and size 100x77, and a band of size 10:
  7334. @example
  7335. delogo=x=0:y=0:w=100:h=77:band=10
  7336. @end example
  7337. @end itemize
  7338. @anchor{derain}
  7339. @section derain
  7340. Remove the rain in the input image/video by applying the derain methods based on
  7341. convolutional neural networks. Supported models:
  7342. @itemize
  7343. @item
  7344. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7345. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7346. @end itemize
  7347. Training as well as model generation scripts are provided in
  7348. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7349. Native model files (.model) can be generated from TensorFlow model
  7350. files (.pb) by using tools/python/convert.py
  7351. The filter accepts the following options:
  7352. @table @option
  7353. @item filter_type
  7354. Specify which filter to use. This option accepts the following values:
  7355. @table @samp
  7356. @item derain
  7357. Derain filter. To conduct derain filter, you need to use a derain model.
  7358. @item dehaze
  7359. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7360. @end table
  7361. Default value is @samp{derain}.
  7362. @item dnn_backend
  7363. Specify which DNN backend to use for model loading and execution. This option accepts
  7364. the following values:
  7365. @table @samp
  7366. @item native
  7367. Native implementation of DNN loading and execution.
  7368. @item tensorflow
  7369. TensorFlow backend. To enable this backend you
  7370. need to install the TensorFlow for C library (see
  7371. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7372. @code{--enable-libtensorflow}
  7373. @end table
  7374. Default value is @samp{native}.
  7375. @item model
  7376. Set path to model file specifying network architecture and its parameters.
  7377. Note that different backends use different file formats. TensorFlow and native
  7378. backend can load files for only its format.
  7379. @end table
  7380. It can also be finished with @ref{dnn_processing} filter.
  7381. @section deshake
  7382. Attempt to fix small changes in horizontal and/or vertical shift. This
  7383. filter helps remove camera shake from hand-holding a camera, bumping a
  7384. tripod, moving on a vehicle, etc.
  7385. The filter accepts the following options:
  7386. @table @option
  7387. @item x
  7388. @item y
  7389. @item w
  7390. @item h
  7391. Specify a rectangular area where to limit the search for motion
  7392. vectors.
  7393. If desired the search for motion vectors can be limited to a
  7394. rectangular area of the frame defined by its top left corner, width
  7395. and height. These parameters have the same meaning as the drawbox
  7396. filter which can be used to visualise the position of the bounding
  7397. box.
  7398. This is useful when simultaneous movement of subjects within the frame
  7399. might be confused for camera motion by the motion vector search.
  7400. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7401. then the full frame is used. This allows later options to be set
  7402. without specifying the bounding box for the motion vector search.
  7403. Default - search the whole frame.
  7404. @item rx
  7405. @item ry
  7406. Specify the maximum extent of movement in x and y directions in the
  7407. range 0-64 pixels. Default 16.
  7408. @item edge
  7409. Specify how to generate pixels to fill blanks at the edge of the
  7410. frame. Available values are:
  7411. @table @samp
  7412. @item blank, 0
  7413. Fill zeroes at blank locations
  7414. @item original, 1
  7415. Original image at blank locations
  7416. @item clamp, 2
  7417. Extruded edge value at blank locations
  7418. @item mirror, 3
  7419. Mirrored edge at blank locations
  7420. @end table
  7421. Default value is @samp{mirror}.
  7422. @item blocksize
  7423. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7424. default 8.
  7425. @item contrast
  7426. Specify the contrast threshold for blocks. Only blocks with more than
  7427. the specified contrast (difference between darkest and lightest
  7428. pixels) will be considered. Range 1-255, default 125.
  7429. @item search
  7430. Specify the search strategy. Available values are:
  7431. @table @samp
  7432. @item exhaustive, 0
  7433. Set exhaustive search
  7434. @item less, 1
  7435. Set less exhaustive search.
  7436. @end table
  7437. Default value is @samp{exhaustive}.
  7438. @item filename
  7439. If set then a detailed log of the motion search is written to the
  7440. specified file.
  7441. @end table
  7442. @section despill
  7443. Remove unwanted contamination of foreground colors, caused by reflected color of
  7444. greenscreen or bluescreen.
  7445. This filter accepts the following options:
  7446. @table @option
  7447. @item type
  7448. Set what type of despill to use.
  7449. @item mix
  7450. Set how spillmap will be generated.
  7451. @item expand
  7452. Set how much to get rid of still remaining spill.
  7453. @item red
  7454. Controls amount of red in spill area.
  7455. @item green
  7456. Controls amount of green in spill area.
  7457. Should be -1 for greenscreen.
  7458. @item blue
  7459. Controls amount of blue in spill area.
  7460. Should be -1 for bluescreen.
  7461. @item brightness
  7462. Controls brightness of spill area, preserving colors.
  7463. @item alpha
  7464. Modify alpha from generated spillmap.
  7465. @end table
  7466. @subsection Commands
  7467. This filter supports the all above options as @ref{commands}.
  7468. @section detelecine
  7469. Apply an exact inverse of the telecine operation. It requires a predefined
  7470. pattern specified using the pattern option which must be the same as that passed
  7471. to the telecine filter.
  7472. This filter accepts the following options:
  7473. @table @option
  7474. @item first_field
  7475. @table @samp
  7476. @item top, t
  7477. top field first
  7478. @item bottom, b
  7479. bottom field first
  7480. The default value is @code{top}.
  7481. @end table
  7482. @item pattern
  7483. A string of numbers representing the pulldown pattern you wish to apply.
  7484. The default value is @code{23}.
  7485. @item start_frame
  7486. A number representing position of the first frame with respect to the telecine
  7487. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  7488. @end table
  7489. @section dilation
  7490. Apply dilation effect to the video.
  7491. This filter replaces the pixel by the local(3x3) maximum.
  7492. It accepts the following options:
  7493. @table @option
  7494. @item threshold0
  7495. @item threshold1
  7496. @item threshold2
  7497. @item threshold3
  7498. Limit the maximum change for each plane, default is 65535.
  7499. If 0, plane will remain unchanged.
  7500. @item coordinates
  7501. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7502. pixels are used.
  7503. Flags to local 3x3 coordinates maps like this:
  7504. 1 2 3
  7505. 4 5
  7506. 6 7 8
  7507. @end table
  7508. @subsection Commands
  7509. This filter supports the all above options as @ref{commands}.
  7510. @section displace
  7511. Displace pixels as indicated by second and third input stream.
  7512. It takes three input streams and outputs one stream, the first input is the
  7513. source, and second and third input are displacement maps.
  7514. The second input specifies how much to displace pixels along the
  7515. x-axis, while the third input specifies how much to displace pixels
  7516. along the y-axis.
  7517. If one of displacement map streams terminates, last frame from that
  7518. displacement map will be used.
  7519. Note that once generated, displacements maps can be reused over and over again.
  7520. A description of the accepted options follows.
  7521. @table @option
  7522. @item edge
  7523. Set displace behavior for pixels that are out of range.
  7524. Available values are:
  7525. @table @samp
  7526. @item blank
  7527. Missing pixels are replaced by black pixels.
  7528. @item smear
  7529. Adjacent pixels will spread out to replace missing pixels.
  7530. @item wrap
  7531. Out of range pixels are wrapped so they point to pixels of other side.
  7532. @item mirror
  7533. Out of range pixels will be replaced with mirrored pixels.
  7534. @end table
  7535. Default is @samp{smear}.
  7536. @end table
  7537. @subsection Examples
  7538. @itemize
  7539. @item
  7540. Add ripple effect to rgb input of video size hd720:
  7541. @example
  7542. 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
  7543. @end example
  7544. @item
  7545. Add wave effect to rgb input of video size hd720:
  7546. @example
  7547. 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
  7548. @end example
  7549. @end itemize
  7550. @anchor{dnn_processing}
  7551. @section dnn_processing
  7552. Do image processing with deep neural networks. It works together with another filter
  7553. which converts the pixel format of the Frame to what the dnn network requires.
  7554. The filter accepts the following options:
  7555. @table @option
  7556. @item dnn_backend
  7557. Specify which DNN backend to use for model loading and execution. This option accepts
  7558. the following values:
  7559. @table @samp
  7560. @item native
  7561. Native implementation of DNN loading and execution.
  7562. @item tensorflow
  7563. TensorFlow backend. To enable this backend you
  7564. need to install the TensorFlow for C library (see
  7565. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  7566. @code{--enable-libtensorflow}
  7567. @item openvino
  7568. OpenVINO backend. To enable this backend you
  7569. need to build and install the OpenVINO for C library (see
  7570. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  7571. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  7572. be needed if the header files and libraries are not installed into system path)
  7573. @end table
  7574. Default value is @samp{native}.
  7575. @item model
  7576. Set path to model file specifying network architecture and its parameters.
  7577. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  7578. backend can load files for only its format.
  7579. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  7580. @item input
  7581. Set the input name of the dnn network.
  7582. @item output
  7583. Set the output name of the dnn network.
  7584. @end table
  7585. @subsection Examples
  7586. @itemize
  7587. @item
  7588. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  7589. @example
  7590. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  7591. @end example
  7592. @item
  7593. Halve the pixel value of the frame with format gray32f:
  7594. @example
  7595. 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
  7596. @end example
  7597. @item
  7598. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  7599. @example
  7600. ./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
  7601. @end example
  7602. @item
  7603. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported):
  7604. @example
  7605. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg
  7606. @end example
  7607. @end itemize
  7608. @section drawbox
  7609. Draw a colored box on the input image.
  7610. It accepts the following parameters:
  7611. @table @option
  7612. @item x
  7613. @item y
  7614. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  7615. @item width, w
  7616. @item height, h
  7617. The expressions which specify the width and height of the box; if 0 they are interpreted as
  7618. the input width and height. It defaults to 0.
  7619. @item color, c
  7620. Specify the color of the box to write. For the general syntax of this option,
  7621. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7622. value @code{invert} is used, the box edge color is the same as the
  7623. video with inverted luma.
  7624. @item thickness, t
  7625. The expression which sets the thickness of the box edge.
  7626. A value of @code{fill} will create a filled box. Default value is @code{3}.
  7627. See below for the list of accepted constants.
  7628. @item replace
  7629. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  7630. will overwrite the video's color and alpha pixels.
  7631. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  7632. @end table
  7633. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7634. following constants:
  7635. @table @option
  7636. @item dar
  7637. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7638. @item hsub
  7639. @item vsub
  7640. horizontal and vertical chroma subsample values. For example for the
  7641. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7642. @item in_h, ih
  7643. @item in_w, iw
  7644. The input width and height.
  7645. @item sar
  7646. The input sample aspect ratio.
  7647. @item x
  7648. @item y
  7649. The x and y offset coordinates where the box is drawn.
  7650. @item w
  7651. @item h
  7652. The width and height of the drawn box.
  7653. @item t
  7654. The thickness of the drawn box.
  7655. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7656. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7657. @end table
  7658. @subsection Examples
  7659. @itemize
  7660. @item
  7661. Draw a black box around the edge of the input image:
  7662. @example
  7663. drawbox
  7664. @end example
  7665. @item
  7666. Draw a box with color red and an opacity of 50%:
  7667. @example
  7668. drawbox=10:20:200:60:red@@0.5
  7669. @end example
  7670. The previous example can be specified as:
  7671. @example
  7672. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  7673. @end example
  7674. @item
  7675. Fill the box with pink color:
  7676. @example
  7677. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  7678. @end example
  7679. @item
  7680. Draw a 2-pixel red 2.40:1 mask:
  7681. @example
  7682. 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
  7683. @end example
  7684. @end itemize
  7685. @subsection Commands
  7686. This filter supports same commands as options.
  7687. The command accepts the same syntax of the corresponding option.
  7688. If the specified expression is not valid, it is kept at its current
  7689. value.
  7690. @anchor{drawgraph}
  7691. @section drawgraph
  7692. Draw a graph using input video metadata.
  7693. It accepts the following parameters:
  7694. @table @option
  7695. @item m1
  7696. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  7697. @item fg1
  7698. Set 1st foreground color expression.
  7699. @item m2
  7700. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  7701. @item fg2
  7702. Set 2nd foreground color expression.
  7703. @item m3
  7704. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  7705. @item fg3
  7706. Set 3rd foreground color expression.
  7707. @item m4
  7708. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  7709. @item fg4
  7710. Set 4th foreground color expression.
  7711. @item min
  7712. Set minimal value of metadata value.
  7713. @item max
  7714. Set maximal value of metadata value.
  7715. @item bg
  7716. Set graph background color. Default is white.
  7717. @item mode
  7718. Set graph mode.
  7719. Available values for mode is:
  7720. @table @samp
  7721. @item bar
  7722. @item dot
  7723. @item line
  7724. @end table
  7725. Default is @code{line}.
  7726. @item slide
  7727. Set slide mode.
  7728. Available values for slide is:
  7729. @table @samp
  7730. @item frame
  7731. Draw new frame when right border is reached.
  7732. @item replace
  7733. Replace old columns with new ones.
  7734. @item scroll
  7735. Scroll from right to left.
  7736. @item rscroll
  7737. Scroll from left to right.
  7738. @item picture
  7739. Draw single picture.
  7740. @end table
  7741. Default is @code{frame}.
  7742. @item size
  7743. Set size of graph video. For the syntax of this option, check the
  7744. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7745. The default value is @code{900x256}.
  7746. @item rate, r
  7747. Set the output frame rate. Default value is @code{25}.
  7748. The foreground color expressions can use the following variables:
  7749. @table @option
  7750. @item MIN
  7751. Minimal value of metadata value.
  7752. @item MAX
  7753. Maximal value of metadata value.
  7754. @item VAL
  7755. Current metadata key value.
  7756. @end table
  7757. The color is defined as 0xAABBGGRR.
  7758. @end table
  7759. Example using metadata from @ref{signalstats} filter:
  7760. @example
  7761. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  7762. @end example
  7763. Example using metadata from @ref{ebur128} filter:
  7764. @example
  7765. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  7766. @end example
  7767. @section drawgrid
  7768. Draw a grid on the input image.
  7769. It accepts the following parameters:
  7770. @table @option
  7771. @item x
  7772. @item y
  7773. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  7774. @item width, w
  7775. @item height, h
  7776. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  7777. input width and height, respectively, minus @code{thickness}, so image gets
  7778. framed. Default to 0.
  7779. @item color, c
  7780. Specify the color of the grid. For the general syntax of this option,
  7781. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  7782. value @code{invert} is used, the grid color is the same as the
  7783. video with inverted luma.
  7784. @item thickness, t
  7785. The expression which sets the thickness of the grid line. Default value is @code{1}.
  7786. See below for the list of accepted constants.
  7787. @item replace
  7788. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  7789. will overwrite the video's color and alpha pixels.
  7790. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  7791. @end table
  7792. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  7793. following constants:
  7794. @table @option
  7795. @item dar
  7796. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  7797. @item hsub
  7798. @item vsub
  7799. horizontal and vertical chroma subsample values. For example for the
  7800. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7801. @item in_h, ih
  7802. @item in_w, iw
  7803. The input grid cell width and height.
  7804. @item sar
  7805. The input sample aspect ratio.
  7806. @item x
  7807. @item y
  7808. The x and y coordinates of some point of grid intersection (meant to configure offset).
  7809. @item w
  7810. @item h
  7811. The width and height of the drawn cell.
  7812. @item t
  7813. The thickness of the drawn cell.
  7814. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  7815. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  7816. @end table
  7817. @subsection Examples
  7818. @itemize
  7819. @item
  7820. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  7821. @example
  7822. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  7823. @end example
  7824. @item
  7825. Draw a white 3x3 grid with an opacity of 50%:
  7826. @example
  7827. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  7828. @end example
  7829. @end itemize
  7830. @subsection Commands
  7831. This filter supports same commands as options.
  7832. The command accepts the same syntax of the corresponding option.
  7833. If the specified expression is not valid, it is kept at its current
  7834. value.
  7835. @anchor{drawtext}
  7836. @section drawtext
  7837. Draw a text string or text from a specified file on top of a video, using the
  7838. libfreetype library.
  7839. To enable compilation of this filter, you need to configure FFmpeg with
  7840. @code{--enable-libfreetype}.
  7841. To enable default font fallback and the @var{font} option you need to
  7842. configure FFmpeg with @code{--enable-libfontconfig}.
  7843. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  7844. @code{--enable-libfribidi}.
  7845. @subsection Syntax
  7846. It accepts the following parameters:
  7847. @table @option
  7848. @item box
  7849. Used to draw a box around text using the background color.
  7850. The value must be either 1 (enable) or 0 (disable).
  7851. The default value of @var{box} is 0.
  7852. @item boxborderw
  7853. Set the width of the border to be drawn around the box using @var{boxcolor}.
  7854. The default value of @var{boxborderw} is 0.
  7855. @item boxcolor
  7856. The color to be used for drawing box around text. For the syntax of this
  7857. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7858. The default value of @var{boxcolor} is "white".
  7859. @item line_spacing
  7860. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  7861. The default value of @var{line_spacing} is 0.
  7862. @item borderw
  7863. Set the width of the border to be drawn around the text using @var{bordercolor}.
  7864. The default value of @var{borderw} is 0.
  7865. @item bordercolor
  7866. Set the color to be used for drawing border around text. For the syntax of this
  7867. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7868. The default value of @var{bordercolor} is "black".
  7869. @item expansion
  7870. Select how the @var{text} is expanded. Can be either @code{none},
  7871. @code{strftime} (deprecated) or
  7872. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7873. below for details.
  7874. @item basetime
  7875. Set a start time for the count. Value is in microseconds. Only applied
  7876. in the deprecated strftime expansion mode. To emulate in normal expansion
  7877. mode use the @code{pts} function, supplying the start time (in seconds)
  7878. as the second argument.
  7879. @item fix_bounds
  7880. If true, check and fix text coords to avoid clipping.
  7881. @item fontcolor
  7882. The color to be used for drawing fonts. For the syntax of this option, check
  7883. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7884. The default value of @var{fontcolor} is "black".
  7885. @item fontcolor_expr
  7886. String which is expanded the same way as @var{text} to obtain dynamic
  7887. @var{fontcolor} value. By default this option has empty value and is not
  7888. processed. When this option is set, it overrides @var{fontcolor} option.
  7889. @item font
  7890. The font family to be used for drawing text. By default Sans.
  7891. @item fontfile
  7892. The font file to be used for drawing text. The path must be included.
  7893. This parameter is mandatory if the fontconfig support is disabled.
  7894. @item alpha
  7895. Draw the text applying alpha blending. The value can
  7896. be a number between 0.0 and 1.0.
  7897. The expression accepts the same variables @var{x, y} as well.
  7898. The default value is 1.
  7899. Please see @var{fontcolor_expr}.
  7900. @item fontsize
  7901. The font size to be used for drawing text.
  7902. The default value of @var{fontsize} is 16.
  7903. @item text_shaping
  7904. If set to 1, attempt to shape the text (for example, reverse the order of
  7905. right-to-left text and join Arabic characters) before drawing it.
  7906. Otherwise, just draw the text exactly as given.
  7907. By default 1 (if supported).
  7908. @item ft_load_flags
  7909. The flags to be used for loading the fonts.
  7910. The flags map the corresponding flags supported by libfreetype, and are
  7911. a combination of the following values:
  7912. @table @var
  7913. @item default
  7914. @item no_scale
  7915. @item no_hinting
  7916. @item render
  7917. @item no_bitmap
  7918. @item vertical_layout
  7919. @item force_autohint
  7920. @item crop_bitmap
  7921. @item pedantic
  7922. @item ignore_global_advance_width
  7923. @item no_recurse
  7924. @item ignore_transform
  7925. @item monochrome
  7926. @item linear_design
  7927. @item no_autohint
  7928. @end table
  7929. Default value is "default".
  7930. For more information consult the documentation for the FT_LOAD_*
  7931. libfreetype flags.
  7932. @item shadowcolor
  7933. The color to be used for drawing a shadow behind the drawn text. For the
  7934. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7935. ffmpeg-utils manual,ffmpeg-utils}.
  7936. The default value of @var{shadowcolor} is "black".
  7937. @item shadowx
  7938. @item shadowy
  7939. The x and y offsets for the text shadow position with respect to the
  7940. position of the text. They can be either positive or negative
  7941. values. The default value for both is "0".
  7942. @item start_number
  7943. The starting frame number for the n/frame_num variable. The default value
  7944. is "0".
  7945. @item tabsize
  7946. The size in number of spaces to use for rendering the tab.
  7947. Default value is 4.
  7948. @item timecode
  7949. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7950. format. It can be used with or without text parameter. @var{timecode_rate}
  7951. option must be specified.
  7952. @item timecode_rate, rate, r
  7953. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7954. integer. Minimum value is "1".
  7955. Drop-frame timecode is supported for frame rates 30 & 60.
  7956. @item tc24hmax
  7957. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7958. Default is 0 (disabled).
  7959. @item text
  7960. The text string to be drawn. The text must be a sequence of UTF-8
  7961. encoded characters.
  7962. This parameter is mandatory if no file is specified with the parameter
  7963. @var{textfile}.
  7964. @item textfile
  7965. A text file containing text to be drawn. The text must be a sequence
  7966. of UTF-8 encoded characters.
  7967. This parameter is mandatory if no text string is specified with the
  7968. parameter @var{text}.
  7969. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7970. @item reload
  7971. If set to 1, the @var{textfile} will be reloaded before each frame.
  7972. Be sure to update it atomically, or it may be read partially, or even fail.
  7973. @item x
  7974. @item y
  7975. The expressions which specify the offsets where text will be drawn
  7976. within the video frame. They are relative to the top/left border of the
  7977. output image.
  7978. The default value of @var{x} and @var{y} is "0".
  7979. See below for the list of accepted constants and functions.
  7980. @end table
  7981. The parameters for @var{x} and @var{y} are expressions containing the
  7982. following constants and functions:
  7983. @table @option
  7984. @item dar
  7985. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7986. @item hsub
  7987. @item vsub
  7988. horizontal and vertical chroma subsample values. For example for the
  7989. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7990. @item line_h, lh
  7991. the height of each text line
  7992. @item main_h, h, H
  7993. the input height
  7994. @item main_w, w, W
  7995. the input width
  7996. @item max_glyph_a, ascent
  7997. the maximum distance from the baseline to the highest/upper grid
  7998. coordinate used to place a glyph outline point, for all the rendered
  7999. glyphs.
  8000. It is a positive value, due to the grid's orientation with the Y axis
  8001. upwards.
  8002. @item max_glyph_d, descent
  8003. the maximum distance from the baseline to the lowest grid coordinate
  8004. used to place a glyph outline point, for all the rendered glyphs.
  8005. This is a negative value, due to the grid's orientation, with the Y axis
  8006. upwards.
  8007. @item max_glyph_h
  8008. maximum glyph height, that is the maximum height for all the glyphs
  8009. contained in the rendered text, it is equivalent to @var{ascent} -
  8010. @var{descent}.
  8011. @item max_glyph_w
  8012. maximum glyph width, that is the maximum width for all the glyphs
  8013. contained in the rendered text
  8014. @item n
  8015. the number of input frame, starting from 0
  8016. @item rand(min, max)
  8017. return a random number included between @var{min} and @var{max}
  8018. @item sar
  8019. The input sample aspect ratio.
  8020. @item t
  8021. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8022. @item text_h, th
  8023. the height of the rendered text
  8024. @item text_w, tw
  8025. the width of the rendered text
  8026. @item x
  8027. @item y
  8028. the x and y offset coordinates where the text is drawn.
  8029. These parameters allow the @var{x} and @var{y} expressions to refer
  8030. to each other, so you can for example specify @code{y=x/dar}.
  8031. @item pict_type
  8032. A one character description of the current frame's picture type.
  8033. @item pkt_pos
  8034. The current packet's position in the input file or stream
  8035. (in bytes, from the start of the input). A value of -1 indicates
  8036. this info is not available.
  8037. @item pkt_duration
  8038. The current packet's duration, in seconds.
  8039. @item pkt_size
  8040. The current packet's size (in bytes).
  8041. @end table
  8042. @anchor{drawtext_expansion}
  8043. @subsection Text expansion
  8044. If @option{expansion} is set to @code{strftime},
  8045. the filter recognizes strftime() sequences in the provided text and
  8046. expands them accordingly. Check the documentation of strftime(). This
  8047. feature is deprecated.
  8048. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8049. If @option{expansion} is set to @code{normal} (which is the default),
  8050. the following expansion mechanism is used.
  8051. The backslash character @samp{\}, followed by any character, always expands to
  8052. the second character.
  8053. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8054. braces is a function name, possibly followed by arguments separated by ':'.
  8055. If the arguments contain special characters or delimiters (':' or '@}'),
  8056. they should be escaped.
  8057. Note that they probably must also be escaped as the value for the
  8058. @option{text} option in the filter argument string and as the filter
  8059. argument in the filtergraph description, and possibly also for the shell,
  8060. that makes up to four levels of escaping; using a text file avoids these
  8061. problems.
  8062. The following functions are available:
  8063. @table @command
  8064. @item expr, e
  8065. The expression evaluation result.
  8066. It must take one argument specifying the expression to be evaluated,
  8067. which accepts the same constants and functions as the @var{x} and
  8068. @var{y} values. Note that not all constants should be used, for
  8069. example the text size is not known when evaluating the expression, so
  8070. the constants @var{text_w} and @var{text_h} will have an undefined
  8071. value.
  8072. @item expr_int_format, eif
  8073. Evaluate the expression's value and output as formatted integer.
  8074. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8075. The second argument specifies the output format. Allowed values are @samp{x},
  8076. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8077. @code{printf} function.
  8078. The third parameter is optional and sets the number of positions taken by the output.
  8079. It can be used to add padding with zeros from the left.
  8080. @item gmtime
  8081. The time at which the filter is running, expressed in UTC.
  8082. It can accept an argument: a strftime() format string.
  8083. @item localtime
  8084. The time at which the filter is running, expressed in the local time zone.
  8085. It can accept an argument: a strftime() format string.
  8086. @item metadata
  8087. Frame metadata. Takes one or two arguments.
  8088. The first argument is mandatory and specifies the metadata key.
  8089. The second argument is optional and specifies a default value, used when the
  8090. metadata key is not found or empty.
  8091. Available metadata can be identified by inspecting entries
  8092. starting with TAG included within each frame section
  8093. printed by running @code{ffprobe -show_frames}.
  8094. String metadata generated in filters leading to
  8095. the drawtext filter are also available.
  8096. @item n, frame_num
  8097. The frame number, starting from 0.
  8098. @item pict_type
  8099. A one character description of the current picture type.
  8100. @item pts
  8101. The timestamp of the current frame.
  8102. It can take up to three arguments.
  8103. The first argument is the format of the timestamp; it defaults to @code{flt}
  8104. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8105. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8106. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8107. @code{localtime} stands for the timestamp of the frame formatted as
  8108. local time zone time.
  8109. The second argument is an offset added to the timestamp.
  8110. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8111. supplied to present the hour part of the formatted timestamp in 24h format
  8112. (00-23).
  8113. If the format is set to @code{localtime} or @code{gmtime},
  8114. a third argument may be supplied: a strftime() format string.
  8115. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8116. @end table
  8117. @subsection Commands
  8118. This filter supports altering parameters via commands:
  8119. @table @option
  8120. @item reinit
  8121. Alter existing filter parameters.
  8122. Syntax for the argument is the same as for filter invocation, e.g.
  8123. @example
  8124. fontsize=56:fontcolor=green:text='Hello World'
  8125. @end example
  8126. Full filter invocation with sendcmd would look like this:
  8127. @example
  8128. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8129. @end example
  8130. @end table
  8131. If the entire argument can't be parsed or applied as valid values then the filter will
  8132. continue with its existing parameters.
  8133. @subsection Examples
  8134. @itemize
  8135. @item
  8136. Draw "Test Text" with font FreeSerif, using the default values for the
  8137. optional parameters.
  8138. @example
  8139. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8140. @end example
  8141. @item
  8142. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8143. and y=50 (counting from the top-left corner of the screen), text is
  8144. yellow with a red box around it. Both the text and the box have an
  8145. opacity of 20%.
  8146. @example
  8147. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8148. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8149. @end example
  8150. Note that the double quotes are not necessary if spaces are not used
  8151. within the parameter list.
  8152. @item
  8153. Show the text at the center of the video frame:
  8154. @example
  8155. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8156. @end example
  8157. @item
  8158. Show the text at a random position, switching to a new position every 30 seconds:
  8159. @example
  8160. 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)"
  8161. @end example
  8162. @item
  8163. Show a text line sliding from right to left in the last row of the video
  8164. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8165. with no newlines.
  8166. @example
  8167. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8168. @end example
  8169. @item
  8170. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8171. @example
  8172. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8173. @end example
  8174. @item
  8175. Draw a single green letter "g", at the center of the input video.
  8176. The glyph baseline is placed at half screen height.
  8177. @example
  8178. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8179. @end example
  8180. @item
  8181. Show text for 1 second every 3 seconds:
  8182. @example
  8183. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8184. @end example
  8185. @item
  8186. Use fontconfig to set the font. Note that the colons need to be escaped.
  8187. @example
  8188. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8189. @end example
  8190. @item
  8191. Draw "Test Text" with font size dependent on height of the video.
  8192. @example
  8193. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8194. @end example
  8195. @item
  8196. Print the date of a real-time encoding (see strftime(3)):
  8197. @example
  8198. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8199. @end example
  8200. @item
  8201. Show text fading in and out (appearing/disappearing):
  8202. @example
  8203. #!/bin/sh
  8204. DS=1.0 # display start
  8205. DE=10.0 # display end
  8206. FID=1.5 # fade in duration
  8207. FOD=5 # fade out duration
  8208. 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 @}"
  8209. @end example
  8210. @item
  8211. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8212. and the @option{fontsize} value are included in the @option{y} offset.
  8213. @example
  8214. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8215. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8216. @end example
  8217. @item
  8218. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8219. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8220. must have option @option{-export_path_metadata 1} for the special metadata fields
  8221. to be available for filters.
  8222. @example
  8223. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8224. @end example
  8225. @end itemize
  8226. For more information about libfreetype, check:
  8227. @url{http://www.freetype.org/}.
  8228. For more information about fontconfig, check:
  8229. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8230. For more information about libfribidi, check:
  8231. @url{http://fribidi.org/}.
  8232. @section edgedetect
  8233. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8234. The filter accepts the following options:
  8235. @table @option
  8236. @item low
  8237. @item high
  8238. Set low and high threshold values used by the Canny thresholding
  8239. algorithm.
  8240. The high threshold selects the "strong" edge pixels, which are then
  8241. connected through 8-connectivity with the "weak" edge pixels selected
  8242. by the low threshold.
  8243. @var{low} and @var{high} threshold values must be chosen in the range
  8244. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8245. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8246. is @code{50/255}.
  8247. @item mode
  8248. Define the drawing mode.
  8249. @table @samp
  8250. @item wires
  8251. Draw white/gray wires on black background.
  8252. @item colormix
  8253. Mix the colors to create a paint/cartoon effect.
  8254. @item canny
  8255. Apply Canny edge detector on all selected planes.
  8256. @end table
  8257. Default value is @var{wires}.
  8258. @item planes
  8259. Select planes for filtering. By default all available planes are filtered.
  8260. @end table
  8261. @subsection Examples
  8262. @itemize
  8263. @item
  8264. Standard edge detection with custom values for the hysteresis thresholding:
  8265. @example
  8266. edgedetect=low=0.1:high=0.4
  8267. @end example
  8268. @item
  8269. Painting effect without thresholding:
  8270. @example
  8271. edgedetect=mode=colormix:high=0
  8272. @end example
  8273. @end itemize
  8274. @section elbg
  8275. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8276. For each input image, the filter will compute the optimal mapping from
  8277. the input to the output given the codebook length, that is the number
  8278. of distinct output colors.
  8279. This filter accepts the following options.
  8280. @table @option
  8281. @item codebook_length, l
  8282. Set codebook length. The value must be a positive integer, and
  8283. represents the number of distinct output colors. Default value is 256.
  8284. @item nb_steps, n
  8285. Set the maximum number of iterations to apply for computing the optimal
  8286. mapping. The higher the value the better the result and the higher the
  8287. computation time. Default value is 1.
  8288. @item seed, s
  8289. Set a random seed, must be an integer included between 0 and
  8290. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8291. will try to use a good random seed on a best effort basis.
  8292. @item pal8
  8293. Set pal8 output pixel format. This option does not work with codebook
  8294. length greater than 256.
  8295. @end table
  8296. @section entropy
  8297. Measure graylevel entropy in histogram of color channels of video frames.
  8298. It accepts the following parameters:
  8299. @table @option
  8300. @item mode
  8301. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8302. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8303. between neighbour histogram values.
  8304. @end table
  8305. @section eq
  8306. Set brightness, contrast, saturation and approximate gamma adjustment.
  8307. The filter accepts the following options:
  8308. @table @option
  8309. @item contrast
  8310. Set the contrast expression. The value must be a float value in range
  8311. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8312. @item brightness
  8313. Set the brightness expression. The value must be a float value in
  8314. range @code{-1.0} to @code{1.0}. The default value is "0".
  8315. @item saturation
  8316. Set the saturation expression. The value must be a float in
  8317. range @code{0.0} to @code{3.0}. The default value is "1".
  8318. @item gamma
  8319. Set the gamma expression. The value must be a float in range
  8320. @code{0.1} to @code{10.0}. The default value is "1".
  8321. @item gamma_r
  8322. Set the gamma expression for red. The value must be a float in
  8323. range @code{0.1} to @code{10.0}. The default value is "1".
  8324. @item gamma_g
  8325. Set the gamma expression for green. The value must be a float in range
  8326. @code{0.1} to @code{10.0}. The default value is "1".
  8327. @item gamma_b
  8328. Set the gamma expression for blue. The value must be a float in range
  8329. @code{0.1} to @code{10.0}. The default value is "1".
  8330. @item gamma_weight
  8331. Set the gamma weight expression. It can be used to reduce the effect
  8332. of a high gamma value on bright image areas, e.g. keep them from
  8333. getting overamplified and just plain white. The value must be a float
  8334. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8335. gamma correction all the way down while @code{1.0} leaves it at its
  8336. full strength. Default is "1".
  8337. @item eval
  8338. Set when the expressions for brightness, contrast, saturation and
  8339. gamma expressions are evaluated.
  8340. It accepts the following values:
  8341. @table @samp
  8342. @item init
  8343. only evaluate expressions once during the filter initialization or
  8344. when a command is processed
  8345. @item frame
  8346. evaluate expressions for each incoming frame
  8347. @end table
  8348. Default value is @samp{init}.
  8349. @end table
  8350. The expressions accept the following parameters:
  8351. @table @option
  8352. @item n
  8353. frame count of the input frame starting from 0
  8354. @item pos
  8355. byte position of the corresponding packet in the input file, NAN if
  8356. unspecified
  8357. @item r
  8358. frame rate of the input video, NAN if the input frame rate is unknown
  8359. @item t
  8360. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8361. @end table
  8362. @subsection Commands
  8363. The filter supports the following commands:
  8364. @table @option
  8365. @item contrast
  8366. Set the contrast expression.
  8367. @item brightness
  8368. Set the brightness expression.
  8369. @item saturation
  8370. Set the saturation expression.
  8371. @item gamma
  8372. Set the gamma expression.
  8373. @item gamma_r
  8374. Set the gamma_r expression.
  8375. @item gamma_g
  8376. Set gamma_g expression.
  8377. @item gamma_b
  8378. Set gamma_b expression.
  8379. @item gamma_weight
  8380. Set gamma_weight expression.
  8381. The command accepts the same syntax of the corresponding option.
  8382. If the specified expression is not valid, it is kept at its current
  8383. value.
  8384. @end table
  8385. @section erosion
  8386. Apply erosion effect to the video.
  8387. This filter replaces the pixel by the local(3x3) minimum.
  8388. It accepts the following options:
  8389. @table @option
  8390. @item threshold0
  8391. @item threshold1
  8392. @item threshold2
  8393. @item threshold3
  8394. Limit the maximum change for each plane, default is 65535.
  8395. If 0, plane will remain unchanged.
  8396. @item coordinates
  8397. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8398. pixels are used.
  8399. Flags to local 3x3 coordinates maps like this:
  8400. 1 2 3
  8401. 4 5
  8402. 6 7 8
  8403. @end table
  8404. @subsection Commands
  8405. This filter supports the all above options as @ref{commands}.
  8406. @section extractplanes
  8407. Extract color channel components from input video stream into
  8408. separate grayscale video streams.
  8409. The filter accepts the following option:
  8410. @table @option
  8411. @item planes
  8412. Set plane(s) to extract.
  8413. Available values for planes are:
  8414. @table @samp
  8415. @item y
  8416. @item u
  8417. @item v
  8418. @item a
  8419. @item r
  8420. @item g
  8421. @item b
  8422. @end table
  8423. Choosing planes not available in the input will result in an error.
  8424. That means you cannot select @code{r}, @code{g}, @code{b} planes
  8425. with @code{y}, @code{u}, @code{v} planes at same time.
  8426. @end table
  8427. @subsection Examples
  8428. @itemize
  8429. @item
  8430. Extract luma, u and v color channel component from input video frame
  8431. into 3 grayscale outputs:
  8432. @example
  8433. 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
  8434. @end example
  8435. @end itemize
  8436. @section fade
  8437. Apply a fade-in/out effect to the input video.
  8438. It accepts the following parameters:
  8439. @table @option
  8440. @item type, t
  8441. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  8442. effect.
  8443. Default is @code{in}.
  8444. @item start_frame, s
  8445. Specify the number of the frame to start applying the fade
  8446. effect at. Default is 0.
  8447. @item nb_frames, n
  8448. The number of frames that the fade effect lasts. At the end of the
  8449. fade-in effect, the output video will have the same intensity as the input video.
  8450. At the end of the fade-out transition, the output video will be filled with the
  8451. selected @option{color}.
  8452. Default is 25.
  8453. @item alpha
  8454. If set to 1, fade only alpha channel, if one exists on the input.
  8455. Default value is 0.
  8456. @item start_time, st
  8457. Specify the timestamp (in seconds) of the frame to start to apply the fade
  8458. effect. If both start_frame and start_time are specified, the fade will start at
  8459. whichever comes last. Default is 0.
  8460. @item duration, d
  8461. The number of seconds for which the fade effect has to last. At the end of the
  8462. fade-in effect the output video will have the same intensity as the input video,
  8463. at the end of the fade-out transition the output video will be filled with the
  8464. selected @option{color}.
  8465. If both duration and nb_frames are specified, duration is used. Default is 0
  8466. (nb_frames is used by default).
  8467. @item color, c
  8468. Specify the color of the fade. Default is "black".
  8469. @end table
  8470. @subsection Examples
  8471. @itemize
  8472. @item
  8473. Fade in the first 30 frames of video:
  8474. @example
  8475. fade=in:0:30
  8476. @end example
  8477. The command above is equivalent to:
  8478. @example
  8479. fade=t=in:s=0:n=30
  8480. @end example
  8481. @item
  8482. Fade out the last 45 frames of a 200-frame video:
  8483. @example
  8484. fade=out:155:45
  8485. fade=type=out:start_frame=155:nb_frames=45
  8486. @end example
  8487. @item
  8488. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  8489. @example
  8490. fade=in:0:25, fade=out:975:25
  8491. @end example
  8492. @item
  8493. Make the first 5 frames yellow, then fade in from frame 5-24:
  8494. @example
  8495. fade=in:5:20:color=yellow
  8496. @end example
  8497. @item
  8498. Fade in alpha over first 25 frames of video:
  8499. @example
  8500. fade=in:0:25:alpha=1
  8501. @end example
  8502. @item
  8503. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  8504. @example
  8505. fade=t=in:st=5.5:d=0.5
  8506. @end example
  8507. @end itemize
  8508. @section fftdnoiz
  8509. Denoise frames using 3D FFT (frequency domain filtering).
  8510. The filter accepts the following options:
  8511. @table @option
  8512. @item sigma
  8513. Set the noise sigma constant. This sets denoising strength.
  8514. Default value is 1. Allowed range is from 0 to 30.
  8515. Using very high sigma with low overlap may give blocking artifacts.
  8516. @item amount
  8517. Set amount of denoising. By default all detected noise is reduced.
  8518. Default value is 1. Allowed range is from 0 to 1.
  8519. @item block
  8520. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  8521. Actual size of block in pixels is 2 to power of @var{block}, so by default
  8522. block size in pixels is 2^4 which is 16.
  8523. @item overlap
  8524. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  8525. @item prev
  8526. Set number of previous frames to use for denoising. By default is set to 0.
  8527. @item next
  8528. Set number of next frames to to use for denoising. By default is set to 0.
  8529. @item planes
  8530. Set planes which will be filtered, by default are all available filtered
  8531. except alpha.
  8532. @end table
  8533. @section fftfilt
  8534. Apply arbitrary expressions to samples in frequency domain
  8535. @table @option
  8536. @item dc_Y
  8537. Adjust the dc value (gain) of the luma plane of the image. The filter
  8538. accepts an integer value in range @code{0} to @code{1000}. The default
  8539. value is set to @code{0}.
  8540. @item dc_U
  8541. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  8542. filter accepts an integer value in range @code{0} to @code{1000}. The
  8543. default value is set to @code{0}.
  8544. @item dc_V
  8545. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  8546. filter accepts an integer value in range @code{0} to @code{1000}. The
  8547. default value is set to @code{0}.
  8548. @item weight_Y
  8549. Set the frequency domain weight expression for the luma plane.
  8550. @item weight_U
  8551. Set the frequency domain weight expression for the 1st chroma plane.
  8552. @item weight_V
  8553. Set the frequency domain weight expression for the 2nd chroma plane.
  8554. @item eval
  8555. Set when the expressions are evaluated.
  8556. It accepts the following values:
  8557. @table @samp
  8558. @item init
  8559. Only evaluate expressions once during the filter initialization.
  8560. @item frame
  8561. Evaluate expressions for each incoming frame.
  8562. @end table
  8563. Default value is @samp{init}.
  8564. The filter accepts the following variables:
  8565. @item X
  8566. @item Y
  8567. The coordinates of the current sample.
  8568. @item W
  8569. @item H
  8570. The width and height of the image.
  8571. @item N
  8572. The number of input frame, starting from 0.
  8573. @end table
  8574. @subsection Examples
  8575. @itemize
  8576. @item
  8577. High-pass:
  8578. @example
  8579. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  8580. @end example
  8581. @item
  8582. Low-pass:
  8583. @example
  8584. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  8585. @end example
  8586. @item
  8587. Sharpen:
  8588. @example
  8589. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  8590. @end example
  8591. @item
  8592. Blur:
  8593. @example
  8594. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  8595. @end example
  8596. @end itemize
  8597. @section field
  8598. Extract a single field from an interlaced image using stride
  8599. arithmetic to avoid wasting CPU time. The output frames are marked as
  8600. non-interlaced.
  8601. The filter accepts the following options:
  8602. @table @option
  8603. @item type
  8604. Specify whether to extract the top (if the value is @code{0} or
  8605. @code{top}) or the bottom field (if the value is @code{1} or
  8606. @code{bottom}).
  8607. @end table
  8608. @section fieldhint
  8609. Create new frames by copying the top and bottom fields from surrounding frames
  8610. supplied as numbers by the hint file.
  8611. @table @option
  8612. @item hint
  8613. Set file containing hints: absolute/relative frame numbers.
  8614. There must be one line for each frame in a clip. Each line must contain two
  8615. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  8616. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  8617. is current frame number for @code{absolute} mode or out of [-1, 1] range
  8618. for @code{relative} mode. First number tells from which frame to pick up top
  8619. field and second number tells from which frame to pick up bottom field.
  8620. If optionally followed by @code{+} output frame will be marked as interlaced,
  8621. else if followed by @code{-} output frame will be marked as progressive, else
  8622. it will be marked same as input frame.
  8623. If optionally followed by @code{t} output frame will use only top field, or in
  8624. case of @code{b} it will use only bottom field.
  8625. If line starts with @code{#} or @code{;} that line is skipped.
  8626. @item mode
  8627. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  8628. @end table
  8629. Example of first several lines of @code{hint} file for @code{relative} mode:
  8630. @example
  8631. 0,0 - # first frame
  8632. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  8633. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  8634. 1,0 -
  8635. 0,0 -
  8636. 0,0 -
  8637. 1,0 -
  8638. 1,0 -
  8639. 1,0 -
  8640. 0,0 -
  8641. 0,0 -
  8642. 1,0 -
  8643. 1,0 -
  8644. 1,0 -
  8645. 0,0 -
  8646. @end example
  8647. @section fieldmatch
  8648. Field matching filter for inverse telecine. It is meant to reconstruct the
  8649. progressive frames from a telecined stream. The filter does not drop duplicated
  8650. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  8651. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  8652. The separation of the field matching and the decimation is notably motivated by
  8653. the possibility of inserting a de-interlacing filter fallback between the two.
  8654. If the source has mixed telecined and real interlaced content,
  8655. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  8656. But these remaining combed frames will be marked as interlaced, and thus can be
  8657. de-interlaced by a later filter such as @ref{yadif} before decimation.
  8658. In addition to the various configuration options, @code{fieldmatch} can take an
  8659. optional second stream, activated through the @option{ppsrc} option. If
  8660. enabled, the frames reconstruction will be based on the fields and frames from
  8661. this second stream. This allows the first input to be pre-processed in order to
  8662. help the various algorithms of the filter, while keeping the output lossless
  8663. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  8664. or brightness/contrast adjustments can help.
  8665. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  8666. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  8667. which @code{fieldmatch} is based on. While the semantic and usage are very
  8668. close, some behaviour and options names can differ.
  8669. The @ref{decimate} filter currently only works for constant frame rate input.
  8670. If your input has mixed telecined (30fps) and progressive content with a lower
  8671. framerate like 24fps use the following filterchain to produce the necessary cfr
  8672. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  8673. The filter accepts the following options:
  8674. @table @option
  8675. @item order
  8676. Specify the assumed field order of the input stream. Available values are:
  8677. @table @samp
  8678. @item auto
  8679. Auto detect parity (use FFmpeg's internal parity value).
  8680. @item bff
  8681. Assume bottom field first.
  8682. @item tff
  8683. Assume top field first.
  8684. @end table
  8685. Note that it is sometimes recommended not to trust the parity announced by the
  8686. stream.
  8687. Default value is @var{auto}.
  8688. @item mode
  8689. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  8690. sense that it won't risk creating jerkiness due to duplicate frames when
  8691. possible, but if there are bad edits or blended fields it will end up
  8692. outputting combed frames when a good match might actually exist. On the other
  8693. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  8694. but will almost always find a good frame if there is one. The other values are
  8695. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  8696. jerkiness and creating duplicate frames versus finding good matches in sections
  8697. with bad edits, orphaned fields, blended fields, etc.
  8698. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  8699. Available values are:
  8700. @table @samp
  8701. @item pc
  8702. 2-way matching (p/c)
  8703. @item pc_n
  8704. 2-way matching, and trying 3rd match if still combed (p/c + n)
  8705. @item pc_u
  8706. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  8707. @item pc_n_ub
  8708. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  8709. still combed (p/c + n + u/b)
  8710. @item pcn
  8711. 3-way matching (p/c/n)
  8712. @item pcn_ub
  8713. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  8714. detected as combed (p/c/n + u/b)
  8715. @end table
  8716. The parenthesis at the end indicate the matches that would be used for that
  8717. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  8718. @var{top}).
  8719. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  8720. the slowest.
  8721. Default value is @var{pc_n}.
  8722. @item ppsrc
  8723. Mark the main input stream as a pre-processed input, and enable the secondary
  8724. input stream as the clean source to pick the fields from. See the filter
  8725. introduction for more details. It is similar to the @option{clip2} feature from
  8726. VFM/TFM.
  8727. Default value is @code{0} (disabled).
  8728. @item field
  8729. Set the field to match from. It is recommended to set this to the same value as
  8730. @option{order} unless you experience matching failures with that setting. In
  8731. certain circumstances changing the field that is used to match from can have a
  8732. large impact on matching performance. Available values are:
  8733. @table @samp
  8734. @item auto
  8735. Automatic (same value as @option{order}).
  8736. @item bottom
  8737. Match from the bottom field.
  8738. @item top
  8739. Match from the top field.
  8740. @end table
  8741. Default value is @var{auto}.
  8742. @item mchroma
  8743. Set whether or not chroma is included during the match comparisons. In most
  8744. cases it is recommended to leave this enabled. You should set this to @code{0}
  8745. only if your clip has bad chroma problems such as heavy rainbowing or other
  8746. artifacts. Setting this to @code{0} could also be used to speed things up at
  8747. the cost of some accuracy.
  8748. Default value is @code{1}.
  8749. @item y0
  8750. @item y1
  8751. These define an exclusion band which excludes the lines between @option{y0} and
  8752. @option{y1} from being included in the field matching decision. An exclusion
  8753. band can be used to ignore subtitles, a logo, or other things that may
  8754. interfere with the matching. @option{y0} sets the starting scan line and
  8755. @option{y1} sets the ending line; all lines in between @option{y0} and
  8756. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  8757. @option{y0} and @option{y1} to the same value will disable the feature.
  8758. @option{y0} and @option{y1} defaults to @code{0}.
  8759. @item scthresh
  8760. Set the scene change detection threshold as a percentage of maximum change on
  8761. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  8762. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  8763. @option{scthresh} is @code{[0.0, 100.0]}.
  8764. Default value is @code{12.0}.
  8765. @item combmatch
  8766. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  8767. account the combed scores of matches when deciding what match to use as the
  8768. final match. Available values are:
  8769. @table @samp
  8770. @item none
  8771. No final matching based on combed scores.
  8772. @item sc
  8773. Combed scores are only used when a scene change is detected.
  8774. @item full
  8775. Use combed scores all the time.
  8776. @end table
  8777. Default is @var{sc}.
  8778. @item combdbg
  8779. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  8780. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  8781. Available values are:
  8782. @table @samp
  8783. @item none
  8784. No forced calculation.
  8785. @item pcn
  8786. Force p/c/n calculations.
  8787. @item pcnub
  8788. Force p/c/n/u/b calculations.
  8789. @end table
  8790. Default value is @var{none}.
  8791. @item cthresh
  8792. This is the area combing threshold used for combed frame detection. This
  8793. essentially controls how "strong" or "visible" combing must be to be detected.
  8794. Larger values mean combing must be more visible and smaller values mean combing
  8795. can be less visible or strong and still be detected. Valid settings are from
  8796. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  8797. be detected as combed). This is basically a pixel difference value. A good
  8798. range is @code{[8, 12]}.
  8799. Default value is @code{9}.
  8800. @item chroma
  8801. Sets whether or not chroma is considered in the combed frame decision. Only
  8802. disable this if your source has chroma problems (rainbowing, etc.) that are
  8803. causing problems for the combed frame detection with chroma enabled. Actually,
  8804. using @option{chroma}=@var{0} is usually more reliable, except for the case
  8805. where there is chroma only combing in the source.
  8806. Default value is @code{0}.
  8807. @item blockx
  8808. @item blocky
  8809. Respectively set the x-axis and y-axis size of the window used during combed
  8810. frame detection. This has to do with the size of the area in which
  8811. @option{combpel} pixels are required to be detected as combed for a frame to be
  8812. declared combed. See the @option{combpel} parameter description for more info.
  8813. Possible values are any number that is a power of 2 starting at 4 and going up
  8814. to 512.
  8815. Default value is @code{16}.
  8816. @item combpel
  8817. The number of combed pixels inside any of the @option{blocky} by
  8818. @option{blockx} size blocks on the frame for the frame to be detected as
  8819. combed. While @option{cthresh} controls how "visible" the combing must be, this
  8820. setting controls "how much" combing there must be in any localized area (a
  8821. window defined by the @option{blockx} and @option{blocky} settings) on the
  8822. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  8823. which point no frames will ever be detected as combed). This setting is known
  8824. as @option{MI} in TFM/VFM vocabulary.
  8825. Default value is @code{80}.
  8826. @end table
  8827. @anchor{p/c/n/u/b meaning}
  8828. @subsection p/c/n/u/b meaning
  8829. @subsubsection p/c/n
  8830. We assume the following telecined stream:
  8831. @example
  8832. Top fields: 1 2 2 3 4
  8833. Bottom fields: 1 2 3 4 4
  8834. @end example
  8835. The numbers correspond to the progressive frame the fields relate to. Here, the
  8836. first two frames are progressive, the 3rd and 4th are combed, and so on.
  8837. When @code{fieldmatch} is configured to run a matching from bottom
  8838. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  8839. @example
  8840. Input stream:
  8841. T 1 2 2 3 4
  8842. B 1 2 3 4 4 <-- matching reference
  8843. Matches: c c n n c
  8844. Output stream:
  8845. T 1 2 3 4 4
  8846. B 1 2 3 4 4
  8847. @end example
  8848. As a result of the field matching, we can see that some frames get duplicated.
  8849. To perform a complete inverse telecine, you need to rely on a decimation filter
  8850. after this operation. See for instance the @ref{decimate} filter.
  8851. The same operation now matching from top fields (@option{field}=@var{top})
  8852. looks like this:
  8853. @example
  8854. Input stream:
  8855. T 1 2 2 3 4 <-- matching reference
  8856. B 1 2 3 4 4
  8857. Matches: c c p p c
  8858. Output stream:
  8859. T 1 2 2 3 4
  8860. B 1 2 2 3 4
  8861. @end example
  8862. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  8863. basically, they refer to the frame and field of the opposite parity:
  8864. @itemize
  8865. @item @var{p} matches the field of the opposite parity in the previous frame
  8866. @item @var{c} matches the field of the opposite parity in the current frame
  8867. @item @var{n} matches the field of the opposite parity in the next frame
  8868. @end itemize
  8869. @subsubsection u/b
  8870. The @var{u} and @var{b} matching are a bit special in the sense that they match
  8871. from the opposite parity flag. In the following examples, we assume that we are
  8872. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  8873. 'x' is placed above and below each matched fields.
  8874. With bottom matching (@option{field}=@var{bottom}):
  8875. @example
  8876. Match: c p n b u
  8877. x x x x x
  8878. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8879. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8880. x x x x x
  8881. Output frames:
  8882. 2 1 2 2 2
  8883. 2 2 2 1 3
  8884. @end example
  8885. With top matching (@option{field}=@var{top}):
  8886. @example
  8887. Match: c p n b u
  8888. x x x x x
  8889. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8890. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8891. x x x x x
  8892. Output frames:
  8893. 2 2 2 1 2
  8894. 2 1 3 2 2
  8895. @end example
  8896. @subsection Examples
  8897. Simple IVTC of a top field first telecined stream:
  8898. @example
  8899. fieldmatch=order=tff:combmatch=none, decimate
  8900. @end example
  8901. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8902. @example
  8903. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8904. @end example
  8905. @section fieldorder
  8906. Transform the field order of the input video.
  8907. It accepts the following parameters:
  8908. @table @option
  8909. @item order
  8910. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8911. for bottom field first.
  8912. @end table
  8913. The default value is @samp{tff}.
  8914. The transformation is done by shifting the picture content up or down
  8915. by one line, and filling the remaining line with appropriate picture content.
  8916. This method is consistent with most broadcast field order converters.
  8917. If the input video is not flagged as being interlaced, or it is already
  8918. flagged as being of the required output field order, then this filter does
  8919. not alter the incoming video.
  8920. It is very useful when converting to or from PAL DV material,
  8921. which is bottom field first.
  8922. For example:
  8923. @example
  8924. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8925. @end example
  8926. @section fifo, afifo
  8927. Buffer input images and send them when they are requested.
  8928. It is mainly useful when auto-inserted by the libavfilter
  8929. framework.
  8930. It does not take parameters.
  8931. @section fillborders
  8932. Fill borders of the input video, without changing video stream dimensions.
  8933. Sometimes video can have garbage at the four edges and you may not want to
  8934. crop video input to keep size multiple of some number.
  8935. This filter accepts the following options:
  8936. @table @option
  8937. @item left
  8938. Number of pixels to fill from left border.
  8939. @item right
  8940. Number of pixels to fill from right border.
  8941. @item top
  8942. Number of pixels to fill from top border.
  8943. @item bottom
  8944. Number of pixels to fill from bottom border.
  8945. @item mode
  8946. Set fill mode.
  8947. It accepts the following values:
  8948. @table @samp
  8949. @item smear
  8950. fill pixels using outermost pixels
  8951. @item mirror
  8952. fill pixels using mirroring
  8953. @item fixed
  8954. fill pixels with constant value
  8955. @end table
  8956. Default is @var{smear}.
  8957. @item color
  8958. Set color for pixels in fixed mode. Default is @var{black}.
  8959. @end table
  8960. @subsection Commands
  8961. This filter supports same @ref{commands} as options.
  8962. The command accepts the same syntax of the corresponding option.
  8963. If the specified expression is not valid, it is kept at its current
  8964. value.
  8965. @section find_rect
  8966. Find a rectangular object
  8967. It accepts the following options:
  8968. @table @option
  8969. @item object
  8970. Filepath of the object image, needs to be in gray8.
  8971. @item threshold
  8972. Detection threshold, default is 0.5.
  8973. @item mipmaps
  8974. Number of mipmaps, default is 3.
  8975. @item xmin, ymin, xmax, ymax
  8976. Specifies the rectangle in which to search.
  8977. @end table
  8978. @subsection Examples
  8979. @itemize
  8980. @item
  8981. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8982. @example
  8983. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8984. @end example
  8985. @end itemize
  8986. @section floodfill
  8987. Flood area with values of same pixel components with another values.
  8988. It accepts the following options:
  8989. @table @option
  8990. @item x
  8991. Set pixel x coordinate.
  8992. @item y
  8993. Set pixel y coordinate.
  8994. @item s0
  8995. Set source #0 component value.
  8996. @item s1
  8997. Set source #1 component value.
  8998. @item s2
  8999. Set source #2 component value.
  9000. @item s3
  9001. Set source #3 component value.
  9002. @item d0
  9003. Set destination #0 component value.
  9004. @item d1
  9005. Set destination #1 component value.
  9006. @item d2
  9007. Set destination #2 component value.
  9008. @item d3
  9009. Set destination #3 component value.
  9010. @end table
  9011. @anchor{format}
  9012. @section format
  9013. Convert the input video to one of the specified pixel formats.
  9014. Libavfilter will try to pick one that is suitable as input to
  9015. the next filter.
  9016. It accepts the following parameters:
  9017. @table @option
  9018. @item pix_fmts
  9019. A '|'-separated list of pixel format names, such as
  9020. "pix_fmts=yuv420p|monow|rgb24".
  9021. @end table
  9022. @subsection Examples
  9023. @itemize
  9024. @item
  9025. Convert the input video to the @var{yuv420p} format
  9026. @example
  9027. format=pix_fmts=yuv420p
  9028. @end example
  9029. Convert the input video to any of the formats in the list
  9030. @example
  9031. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9032. @end example
  9033. @end itemize
  9034. @anchor{fps}
  9035. @section fps
  9036. Convert the video to specified constant frame rate by duplicating or dropping
  9037. frames as necessary.
  9038. It accepts the following parameters:
  9039. @table @option
  9040. @item fps
  9041. The desired output frame rate. The default is @code{25}.
  9042. @item start_time
  9043. Assume the first PTS should be the given value, in seconds. This allows for
  9044. padding/trimming at the start of stream. By default, no assumption is made
  9045. about the first frame's expected PTS, so no padding or trimming is done.
  9046. For example, this could be set to 0 to pad the beginning with duplicates of
  9047. the first frame if a video stream starts after the audio stream or to trim any
  9048. frames with a negative PTS.
  9049. @item round
  9050. Timestamp (PTS) rounding method.
  9051. Possible values are:
  9052. @table @option
  9053. @item zero
  9054. round towards 0
  9055. @item inf
  9056. round away from 0
  9057. @item down
  9058. round towards -infinity
  9059. @item up
  9060. round towards +infinity
  9061. @item near
  9062. round to nearest
  9063. @end table
  9064. The default is @code{near}.
  9065. @item eof_action
  9066. Action performed when reading the last frame.
  9067. Possible values are:
  9068. @table @option
  9069. @item round
  9070. Use same timestamp rounding method as used for other frames.
  9071. @item pass
  9072. Pass through last frame if input duration has not been reached yet.
  9073. @end table
  9074. The default is @code{round}.
  9075. @end table
  9076. Alternatively, the options can be specified as a flat string:
  9077. @var{fps}[:@var{start_time}[:@var{round}]].
  9078. See also the @ref{setpts} filter.
  9079. @subsection Examples
  9080. @itemize
  9081. @item
  9082. A typical usage in order to set the fps to 25:
  9083. @example
  9084. fps=fps=25
  9085. @end example
  9086. @item
  9087. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9088. @example
  9089. fps=fps=film:round=near
  9090. @end example
  9091. @end itemize
  9092. @section framepack
  9093. Pack two different video streams into a stereoscopic video, setting proper
  9094. metadata on supported codecs. The two views should have the same size and
  9095. framerate and processing will stop when the shorter video ends. Please note
  9096. that you may conveniently adjust view properties with the @ref{scale} and
  9097. @ref{fps} filters.
  9098. It accepts the following parameters:
  9099. @table @option
  9100. @item format
  9101. The desired packing format. Supported values are:
  9102. @table @option
  9103. @item sbs
  9104. The views are next to each other (default).
  9105. @item tab
  9106. The views are on top of each other.
  9107. @item lines
  9108. The views are packed by line.
  9109. @item columns
  9110. The views are packed by column.
  9111. @item frameseq
  9112. The views are temporally interleaved.
  9113. @end table
  9114. @end table
  9115. Some examples:
  9116. @example
  9117. # Convert left and right views into a frame-sequential video
  9118. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9119. # Convert views into a side-by-side video with the same output resolution as the input
  9120. 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
  9121. @end example
  9122. @section framerate
  9123. Change the frame rate by interpolating new video output frames from the source
  9124. frames.
  9125. This filter is not designed to function correctly with interlaced media. If
  9126. you wish to change the frame rate of interlaced media then you are required
  9127. to deinterlace before this filter and re-interlace after this filter.
  9128. A description of the accepted options follows.
  9129. @table @option
  9130. @item fps
  9131. Specify the output frames per second. This option can also be specified
  9132. as a value alone. The default is @code{50}.
  9133. @item interp_start
  9134. Specify the start of a range where the output frame will be created as a
  9135. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9136. the default is @code{15}.
  9137. @item interp_end
  9138. Specify the end of a range where the output frame will be created as a
  9139. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9140. the default is @code{240}.
  9141. @item scene
  9142. Specify the level at which a scene change is detected as a value between
  9143. 0 and 100 to indicate a new scene; a low value reflects a low
  9144. probability for the current frame to introduce a new scene, while a higher
  9145. value means the current frame is more likely to be one.
  9146. The default is @code{8.2}.
  9147. @item flags
  9148. Specify flags influencing the filter process.
  9149. Available value for @var{flags} is:
  9150. @table @option
  9151. @item scene_change_detect, scd
  9152. Enable scene change detection using the value of the option @var{scene}.
  9153. This flag is enabled by default.
  9154. @end table
  9155. @end table
  9156. @section framestep
  9157. Select one frame every N-th frame.
  9158. This filter accepts the following option:
  9159. @table @option
  9160. @item step
  9161. Select frame after every @code{step} frames.
  9162. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9163. @end table
  9164. @section freezedetect
  9165. Detect frozen video.
  9166. This filter logs a message and sets frame metadata when it detects that the
  9167. input video has no significant change in content during a specified duration.
  9168. Video freeze detection calculates the mean average absolute difference of all
  9169. the components of video frames and compares it to a noise floor.
  9170. The printed times and duration are expressed in seconds. The
  9171. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9172. whose timestamp equals or exceeds the detection duration and it contains the
  9173. timestamp of the first frame of the freeze. The
  9174. @code{lavfi.freezedetect.freeze_duration} and
  9175. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9176. after the freeze.
  9177. The filter accepts the following options:
  9178. @table @option
  9179. @item noise, n
  9180. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9181. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9182. 0.001.
  9183. @item duration, d
  9184. Set freeze duration until notification (default is 2 seconds).
  9185. @end table
  9186. @section freezeframes
  9187. Freeze video frames.
  9188. This filter freezes video frames using frame from 2nd input.
  9189. The filter accepts the following options:
  9190. @table @option
  9191. @item first
  9192. Set number of first frame from which to start freeze.
  9193. @item last
  9194. Set number of last frame from which to end freeze.
  9195. @item replace
  9196. Set number of frame from 2nd input which will be used instead of replaced frames.
  9197. @end table
  9198. @anchor{frei0r}
  9199. @section frei0r
  9200. Apply a frei0r effect to the input video.
  9201. To enable the compilation of this filter, you need to install the frei0r
  9202. header and configure FFmpeg with @code{--enable-frei0r}.
  9203. It accepts the following parameters:
  9204. @table @option
  9205. @item filter_name
  9206. The name of the frei0r effect to load. If the environment variable
  9207. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9208. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9209. Otherwise, the standard frei0r paths are searched, in this order:
  9210. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9211. @file{/usr/lib/frei0r-1/}.
  9212. @item filter_params
  9213. A '|'-separated list of parameters to pass to the frei0r effect.
  9214. @end table
  9215. A frei0r effect parameter can be a boolean (its value is either
  9216. "y" or "n"), a double, a color (specified as
  9217. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9218. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9219. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9220. a position (specified as @var{X}/@var{Y}, where
  9221. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9222. The number and types of parameters depend on the loaded effect. If an
  9223. effect parameter is not specified, the default value is set.
  9224. @subsection Examples
  9225. @itemize
  9226. @item
  9227. Apply the distort0r effect, setting the first two double parameters:
  9228. @example
  9229. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9230. @end example
  9231. @item
  9232. Apply the colordistance effect, taking a color as the first parameter:
  9233. @example
  9234. frei0r=colordistance:0.2/0.3/0.4
  9235. frei0r=colordistance:violet
  9236. frei0r=colordistance:0x112233
  9237. @end example
  9238. @item
  9239. Apply the perspective effect, specifying the top left and top right image
  9240. positions:
  9241. @example
  9242. frei0r=perspective:0.2/0.2|0.8/0.2
  9243. @end example
  9244. @end itemize
  9245. For more information, see
  9246. @url{http://frei0r.dyne.org}
  9247. @subsection Commands
  9248. This filter supports the @option{filter_params} option as @ref{commands}.
  9249. @section fspp
  9250. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  9251. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  9252. processing filter, one of them is performed once per block, not per pixel.
  9253. This allows for much higher speed.
  9254. The filter accepts the following options:
  9255. @table @option
  9256. @item quality
  9257. Set quality. This option defines the number of levels for averaging. It accepts
  9258. an integer in the range 4-5. Default value is @code{4}.
  9259. @item qp
  9260. Force a constant quantization parameter. It accepts an integer in range 0-63.
  9261. If not set, the filter will use the QP from the video stream (if available).
  9262. @item strength
  9263. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  9264. more details but also more artifacts, while higher values make the image smoother
  9265. but also blurrier. Default value is @code{0} − PSNR optimal.
  9266. @item use_bframe_qp
  9267. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9268. option may cause flicker since the B-Frames have often larger QP. Default is
  9269. @code{0} (not enabled).
  9270. @end table
  9271. @section gblur
  9272. Apply Gaussian blur filter.
  9273. The filter accepts the following options:
  9274. @table @option
  9275. @item sigma
  9276. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  9277. @item steps
  9278. Set number of steps for Gaussian approximation. Default is @code{1}.
  9279. @item planes
  9280. Set which planes to filter. By default all planes are filtered.
  9281. @item sigmaV
  9282. Set vertical sigma, if negative it will be same as @code{sigma}.
  9283. Default is @code{-1}.
  9284. @end table
  9285. @subsection Commands
  9286. This filter supports same commands as options.
  9287. The command accepts the same syntax of the corresponding option.
  9288. If the specified expression is not valid, it is kept at its current
  9289. value.
  9290. @section geq
  9291. Apply generic equation to each pixel.
  9292. The filter accepts the following options:
  9293. @table @option
  9294. @item lum_expr, lum
  9295. Set the luminance expression.
  9296. @item cb_expr, cb
  9297. Set the chrominance blue expression.
  9298. @item cr_expr, cr
  9299. Set the chrominance red expression.
  9300. @item alpha_expr, a
  9301. Set the alpha expression.
  9302. @item red_expr, r
  9303. Set the red expression.
  9304. @item green_expr, g
  9305. Set the green expression.
  9306. @item blue_expr, b
  9307. Set the blue expression.
  9308. @end table
  9309. The colorspace is selected according to the specified options. If one
  9310. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  9311. options is specified, the filter will automatically select a YCbCr
  9312. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  9313. @option{blue_expr} options is specified, it will select an RGB
  9314. colorspace.
  9315. If one of the chrominance expression is not defined, it falls back on the other
  9316. one. If no alpha expression is specified it will evaluate to opaque value.
  9317. If none of chrominance expressions are specified, they will evaluate
  9318. to the luminance expression.
  9319. The expressions can use the following variables and functions:
  9320. @table @option
  9321. @item N
  9322. The sequential number of the filtered frame, starting from @code{0}.
  9323. @item X
  9324. @item Y
  9325. The coordinates of the current sample.
  9326. @item W
  9327. @item H
  9328. The width and height of the image.
  9329. @item SW
  9330. @item SH
  9331. Width and height scale depending on the currently filtered plane. It is the
  9332. ratio between the corresponding luma plane number of pixels and the current
  9333. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  9334. @code{0.5,0.5} for chroma planes.
  9335. @item T
  9336. Time of the current frame, expressed in seconds.
  9337. @item p(x, y)
  9338. Return the value of the pixel at location (@var{x},@var{y}) of the current
  9339. plane.
  9340. @item lum(x, y)
  9341. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  9342. plane.
  9343. @item cb(x, y)
  9344. Return the value of the pixel at location (@var{x},@var{y}) of the
  9345. blue-difference chroma plane. Return 0 if there is no such plane.
  9346. @item cr(x, y)
  9347. Return the value of the pixel at location (@var{x},@var{y}) of the
  9348. red-difference chroma plane. Return 0 if there is no such plane.
  9349. @item r(x, y)
  9350. @item g(x, y)
  9351. @item b(x, y)
  9352. Return the value of the pixel at location (@var{x},@var{y}) of the
  9353. red/green/blue component. Return 0 if there is no such component.
  9354. @item alpha(x, y)
  9355. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  9356. plane. Return 0 if there is no such plane.
  9357. @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)
  9358. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  9359. sums of samples within a rectangle. See the functions without the sum postfix.
  9360. @item interpolation
  9361. Set one of interpolation methods:
  9362. @table @option
  9363. @item nearest, n
  9364. @item bilinear, b
  9365. @end table
  9366. Default is bilinear.
  9367. @end table
  9368. For functions, if @var{x} and @var{y} are outside the area, the value will be
  9369. automatically clipped to the closer edge.
  9370. Please note that this filter can use multiple threads in which case each slice
  9371. will have its own expression state. If you want to use only a single expression
  9372. state because your expressions depend on previous state then you should limit
  9373. the number of filter threads to 1.
  9374. @subsection Examples
  9375. @itemize
  9376. @item
  9377. Flip the image horizontally:
  9378. @example
  9379. geq=p(W-X\,Y)
  9380. @end example
  9381. @item
  9382. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  9383. wavelength of 100 pixels:
  9384. @example
  9385. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  9386. @end example
  9387. @item
  9388. Generate a fancy enigmatic moving light:
  9389. @example
  9390. 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
  9391. @end example
  9392. @item
  9393. Generate a quick emboss effect:
  9394. @example
  9395. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  9396. @end example
  9397. @item
  9398. Modify RGB components depending on pixel position:
  9399. @example
  9400. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  9401. @end example
  9402. @item
  9403. Create a radial gradient that is the same size as the input (also see
  9404. the @ref{vignette} filter):
  9405. @example
  9406. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  9407. @end example
  9408. @end itemize
  9409. @section gradfun
  9410. Fix the banding artifacts that are sometimes introduced into nearly flat
  9411. regions by truncation to 8-bit color depth.
  9412. Interpolate the gradients that should go where the bands are, and
  9413. dither them.
  9414. It is designed for playback only. Do not use it prior to
  9415. lossy compression, because compression tends to lose the dither and
  9416. bring back the bands.
  9417. It accepts the following parameters:
  9418. @table @option
  9419. @item strength
  9420. The maximum amount by which the filter will change any one pixel. This is also
  9421. the threshold for detecting nearly flat regions. Acceptable values range from
  9422. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  9423. valid range.
  9424. @item radius
  9425. The neighborhood to fit the gradient to. A larger radius makes for smoother
  9426. gradients, but also prevents the filter from modifying the pixels near detailed
  9427. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  9428. values will be clipped to the valid range.
  9429. @end table
  9430. Alternatively, the options can be specified as a flat string:
  9431. @var{strength}[:@var{radius}]
  9432. @subsection Examples
  9433. @itemize
  9434. @item
  9435. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  9436. @example
  9437. gradfun=3.5:8
  9438. @end example
  9439. @item
  9440. Specify radius, omitting the strength (which will fall-back to the default
  9441. value):
  9442. @example
  9443. gradfun=radius=8
  9444. @end example
  9445. @end itemize
  9446. @anchor{graphmonitor}
  9447. @section graphmonitor
  9448. Show various filtergraph stats.
  9449. With this filter one can debug complete filtergraph.
  9450. Especially issues with links filling with queued frames.
  9451. The filter accepts the following options:
  9452. @table @option
  9453. @item size, s
  9454. Set video output size. Default is @var{hd720}.
  9455. @item opacity, o
  9456. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  9457. @item mode, m
  9458. Set output mode, can be @var{fulll} or @var{compact}.
  9459. In @var{compact} mode only filters with some queued frames have displayed stats.
  9460. @item flags, f
  9461. Set flags which enable which stats are shown in video.
  9462. Available values for flags are:
  9463. @table @samp
  9464. @item queue
  9465. Display number of queued frames in each link.
  9466. @item frame_count_in
  9467. Display number of frames taken from filter.
  9468. @item frame_count_out
  9469. Display number of frames given out from filter.
  9470. @item pts
  9471. Display current filtered frame pts.
  9472. @item time
  9473. Display current filtered frame time.
  9474. @item timebase
  9475. Display time base for filter link.
  9476. @item format
  9477. Display used format for filter link.
  9478. @item size
  9479. Display video size or number of audio channels in case of audio used by filter link.
  9480. @item rate
  9481. Display video frame rate or sample rate in case of audio used by filter link.
  9482. @item eof
  9483. Display link output status.
  9484. @end table
  9485. @item rate, r
  9486. Set upper limit for video rate of output stream, Default value is @var{25}.
  9487. This guarantee that output video frame rate will not be higher than this value.
  9488. @end table
  9489. @section greyedge
  9490. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  9491. and corrects the scene colors accordingly.
  9492. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  9493. The filter accepts the following options:
  9494. @table @option
  9495. @item difford
  9496. The order of differentiation to be applied on the scene. Must be chosen in the range
  9497. [0,2] and default value is 1.
  9498. @item minknorm
  9499. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  9500. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  9501. max value instead of calculating Minkowski distance.
  9502. @item sigma
  9503. The standard deviation of Gaussian blur to be applied on the scene. Must be
  9504. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  9505. can't be equal to 0 if @var{difford} is greater than 0.
  9506. @end table
  9507. @subsection Examples
  9508. @itemize
  9509. @item
  9510. Grey Edge:
  9511. @example
  9512. greyedge=difford=1:minknorm=5:sigma=2
  9513. @end example
  9514. @item
  9515. Max Edge:
  9516. @example
  9517. greyedge=difford=1:minknorm=0:sigma=2
  9518. @end example
  9519. @end itemize
  9520. @anchor{haldclut}
  9521. @section haldclut
  9522. Apply a Hald CLUT to a video stream.
  9523. First input is the video stream to process, and second one is the Hald CLUT.
  9524. The Hald CLUT input can be a simple picture or a complete video stream.
  9525. The filter accepts the following options:
  9526. @table @option
  9527. @item shortest
  9528. Force termination when the shortest input terminates. Default is @code{0}.
  9529. @item repeatlast
  9530. Continue applying the last CLUT after the end of the stream. A value of
  9531. @code{0} disable the filter after the last frame of the CLUT is reached.
  9532. Default is @code{1}.
  9533. @end table
  9534. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  9535. filters share the same internals).
  9536. This filter also supports the @ref{framesync} options.
  9537. More information about the Hald CLUT can be found on Eskil Steenberg's website
  9538. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  9539. @subsection Workflow examples
  9540. @subsubsection Hald CLUT video stream
  9541. Generate an identity Hald CLUT stream altered with various effects:
  9542. @example
  9543. 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
  9544. @end example
  9545. Note: make sure you use a lossless codec.
  9546. Then use it with @code{haldclut} to apply it on some random stream:
  9547. @example
  9548. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  9549. @end example
  9550. The Hald CLUT will be applied to the 10 first seconds (duration of
  9551. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  9552. to the remaining frames of the @code{mandelbrot} stream.
  9553. @subsubsection Hald CLUT with preview
  9554. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  9555. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  9556. biggest possible square starting at the top left of the picture. The remaining
  9557. padding pixels (bottom or right) will be ignored. This area can be used to add
  9558. a preview of the Hald CLUT.
  9559. Typically, the following generated Hald CLUT will be supported by the
  9560. @code{haldclut} filter:
  9561. @example
  9562. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  9563. pad=iw+320 [padded_clut];
  9564. smptebars=s=320x256, split [a][b];
  9565. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  9566. [main][b] overlay=W-320" -frames:v 1 clut.png
  9567. @end example
  9568. It contains the original and a preview of the effect of the CLUT: SMPTE color
  9569. bars are displayed on the right-top, and below the same color bars processed by
  9570. the color changes.
  9571. Then, the effect of this Hald CLUT can be visualized with:
  9572. @example
  9573. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  9574. @end example
  9575. @section hflip
  9576. Flip the input video horizontally.
  9577. For example, to horizontally flip the input video with @command{ffmpeg}:
  9578. @example
  9579. ffmpeg -i in.avi -vf "hflip" out.avi
  9580. @end example
  9581. @section histeq
  9582. This filter applies a global color histogram equalization on a
  9583. per-frame basis.
  9584. It can be used to correct video that has a compressed range of pixel
  9585. intensities. The filter redistributes the pixel intensities to
  9586. equalize their distribution across the intensity range. It may be
  9587. viewed as an "automatically adjusting contrast filter". This filter is
  9588. useful only for correcting degraded or poorly captured source
  9589. video.
  9590. The filter accepts the following options:
  9591. @table @option
  9592. @item strength
  9593. Determine the amount of equalization to be applied. As the strength
  9594. is reduced, the distribution of pixel intensities more-and-more
  9595. approaches that of the input frame. The value must be a float number
  9596. in the range [0,1] and defaults to 0.200.
  9597. @item intensity
  9598. Set the maximum intensity that can generated and scale the output
  9599. values appropriately. The strength should be set as desired and then
  9600. the intensity can be limited if needed to avoid washing-out. The value
  9601. must be a float number in the range [0,1] and defaults to 0.210.
  9602. @item antibanding
  9603. Set the antibanding level. If enabled the filter will randomly vary
  9604. the luminance of output pixels by a small amount to avoid banding of
  9605. the histogram. Possible values are @code{none}, @code{weak} or
  9606. @code{strong}. It defaults to @code{none}.
  9607. @end table
  9608. @anchor{histogram}
  9609. @section histogram
  9610. Compute and draw a color distribution histogram for the input video.
  9611. The computed histogram is a representation of the color component
  9612. distribution in an image.
  9613. Standard histogram displays the color components distribution in an image.
  9614. Displays color graph for each color component. Shows distribution of
  9615. the Y, U, V, A or R, G, B components, depending on input format, in the
  9616. current frame. Below each graph a color component scale meter is shown.
  9617. The filter accepts the following options:
  9618. @table @option
  9619. @item level_height
  9620. Set height of level. Default value is @code{200}.
  9621. Allowed range is [50, 2048].
  9622. @item scale_height
  9623. Set height of color scale. Default value is @code{12}.
  9624. Allowed range is [0, 40].
  9625. @item display_mode
  9626. Set display mode.
  9627. It accepts the following values:
  9628. @table @samp
  9629. @item stack
  9630. Per color component graphs are placed below each other.
  9631. @item parade
  9632. Per color component graphs are placed side by side.
  9633. @item overlay
  9634. Presents information identical to that in the @code{parade}, except
  9635. that the graphs representing color components are superimposed directly
  9636. over one another.
  9637. @end table
  9638. Default is @code{stack}.
  9639. @item levels_mode
  9640. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  9641. Default is @code{linear}.
  9642. @item components
  9643. Set what color components to display.
  9644. Default is @code{7}.
  9645. @item fgopacity
  9646. Set foreground opacity. Default is @code{0.7}.
  9647. @item bgopacity
  9648. Set background opacity. Default is @code{0.5}.
  9649. @end table
  9650. @subsection Examples
  9651. @itemize
  9652. @item
  9653. Calculate and draw histogram:
  9654. @example
  9655. ffplay -i input -vf histogram
  9656. @end example
  9657. @end itemize
  9658. @anchor{hqdn3d}
  9659. @section hqdn3d
  9660. This is a high precision/quality 3d denoise filter. It aims to reduce
  9661. image noise, producing smooth images and making still images really
  9662. still. It should enhance compressibility.
  9663. It accepts the following optional parameters:
  9664. @table @option
  9665. @item luma_spatial
  9666. A non-negative floating point number which specifies spatial luma strength.
  9667. It defaults to 4.0.
  9668. @item chroma_spatial
  9669. A non-negative floating point number which specifies spatial chroma strength.
  9670. It defaults to 3.0*@var{luma_spatial}/4.0.
  9671. @item luma_tmp
  9672. A floating point number which specifies luma temporal strength. It defaults to
  9673. 6.0*@var{luma_spatial}/4.0.
  9674. @item chroma_tmp
  9675. A floating point number which specifies chroma temporal strength. It defaults to
  9676. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  9677. @end table
  9678. @subsection Commands
  9679. This filter supports same @ref{commands} as options.
  9680. The command accepts the same syntax of the corresponding option.
  9681. If the specified expression is not valid, it is kept at its current
  9682. value.
  9683. @anchor{hwdownload}
  9684. @section hwdownload
  9685. Download hardware frames to system memory.
  9686. The input must be in hardware frames, and the output a non-hardware format.
  9687. Not all formats will be supported on the output - it may be necessary to insert
  9688. an additional @option{format} filter immediately following in the graph to get
  9689. the output in a supported format.
  9690. @section hwmap
  9691. Map hardware frames to system memory or to another device.
  9692. This filter has several different modes of operation; which one is used depends
  9693. on the input and output formats:
  9694. @itemize
  9695. @item
  9696. Hardware frame input, normal frame output
  9697. Map the input frames to system memory and pass them to the output. If the
  9698. original hardware frame is later required (for example, after overlaying
  9699. something else on part of it), the @option{hwmap} filter can be used again
  9700. in the next mode to retrieve it.
  9701. @item
  9702. Normal frame input, hardware frame output
  9703. If the input is actually a software-mapped hardware frame, then unmap it -
  9704. that is, return the original hardware frame.
  9705. Otherwise, a device must be provided. Create new hardware surfaces on that
  9706. device for the output, then map them back to the software format at the input
  9707. and give those frames to the preceding filter. This will then act like the
  9708. @option{hwupload} filter, but may be able to avoid an additional copy when
  9709. the input is already in a compatible format.
  9710. @item
  9711. Hardware frame input and output
  9712. A device must be supplied for the output, either directly or with the
  9713. @option{derive_device} option. The input and output devices must be of
  9714. different types and compatible - the exact meaning of this is
  9715. system-dependent, but typically it means that they must refer to the same
  9716. underlying hardware context (for example, refer to the same graphics card).
  9717. If the input frames were originally created on the output device, then unmap
  9718. to retrieve the original frames.
  9719. Otherwise, map the frames to the output device - create new hardware frames
  9720. on the output corresponding to the frames on the input.
  9721. @end itemize
  9722. The following additional parameters are accepted:
  9723. @table @option
  9724. @item mode
  9725. Set the frame mapping mode. Some combination of:
  9726. @table @var
  9727. @item read
  9728. The mapped frame should be readable.
  9729. @item write
  9730. The mapped frame should be writeable.
  9731. @item overwrite
  9732. The mapping will always overwrite the entire frame.
  9733. This may improve performance in some cases, as the original contents of the
  9734. frame need not be loaded.
  9735. @item direct
  9736. The mapping must not involve any copying.
  9737. Indirect mappings to copies of frames are created in some cases where either
  9738. direct mapping is not possible or it would have unexpected properties.
  9739. Setting this flag ensures that the mapping is direct and will fail if that is
  9740. not possible.
  9741. @end table
  9742. Defaults to @var{read+write} if not specified.
  9743. @item derive_device @var{type}
  9744. Rather than using the device supplied at initialisation, instead derive a new
  9745. device of type @var{type} from the device the input frames exist on.
  9746. @item reverse
  9747. In a hardware to hardware mapping, map in reverse - create frames in the sink
  9748. and map them back to the source. This may be necessary in some cases where
  9749. a mapping in one direction is required but only the opposite direction is
  9750. supported by the devices being used.
  9751. This option is dangerous - it may break the preceding filter in undefined
  9752. ways if there are any additional constraints on that filter's output.
  9753. Do not use it without fully understanding the implications of its use.
  9754. @end table
  9755. @anchor{hwupload}
  9756. @section hwupload
  9757. Upload system memory frames to hardware surfaces.
  9758. The device to upload to must be supplied when the filter is initialised. If
  9759. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  9760. option or with the @option{derive_device} option. The input and output devices
  9761. must be of different types and compatible - the exact meaning of this is
  9762. system-dependent, but typically it means that they must refer to the same
  9763. underlying hardware context (for example, refer to the same graphics card).
  9764. The following additional parameters are accepted:
  9765. @table @option
  9766. @item derive_device @var{type}
  9767. Rather than using the device supplied at initialisation, instead derive a new
  9768. device of type @var{type} from the device the input frames exist on.
  9769. @end table
  9770. @anchor{hwupload_cuda}
  9771. @section hwupload_cuda
  9772. Upload system memory frames to a CUDA device.
  9773. It accepts the following optional parameters:
  9774. @table @option
  9775. @item device
  9776. The number of the CUDA device to use
  9777. @end table
  9778. @section hqx
  9779. Apply a high-quality magnification filter designed for pixel art. This filter
  9780. was originally created by Maxim Stepin.
  9781. It accepts the following option:
  9782. @table @option
  9783. @item n
  9784. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  9785. @code{hq3x} and @code{4} for @code{hq4x}.
  9786. Default is @code{3}.
  9787. @end table
  9788. @section hstack
  9789. Stack input videos horizontally.
  9790. All streams must be of same pixel format and of same height.
  9791. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9792. to create same output.
  9793. The filter accepts the following option:
  9794. @table @option
  9795. @item inputs
  9796. Set number of input streams. Default is 2.
  9797. @item shortest
  9798. If set to 1, force the output to terminate when the shortest input
  9799. terminates. Default value is 0.
  9800. @end table
  9801. @section hue
  9802. Modify the hue and/or the saturation of the input.
  9803. It accepts the following parameters:
  9804. @table @option
  9805. @item h
  9806. Specify the hue angle as a number of degrees. It accepts an expression,
  9807. and defaults to "0".
  9808. @item s
  9809. Specify the saturation in the [-10,10] range. It accepts an expression and
  9810. defaults to "1".
  9811. @item H
  9812. Specify the hue angle as a number of radians. It accepts an
  9813. expression, and defaults to "0".
  9814. @item b
  9815. Specify the brightness in the [-10,10] range. It accepts an expression and
  9816. defaults to "0".
  9817. @end table
  9818. @option{h} and @option{H} are mutually exclusive, and can't be
  9819. specified at the same time.
  9820. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  9821. expressions containing the following constants:
  9822. @table @option
  9823. @item n
  9824. frame count of the input frame starting from 0
  9825. @item pts
  9826. presentation timestamp of the input frame expressed in time base units
  9827. @item r
  9828. frame rate of the input video, NAN if the input frame rate is unknown
  9829. @item t
  9830. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9831. @item tb
  9832. time base of the input video
  9833. @end table
  9834. @subsection Examples
  9835. @itemize
  9836. @item
  9837. Set the hue to 90 degrees and the saturation to 1.0:
  9838. @example
  9839. hue=h=90:s=1
  9840. @end example
  9841. @item
  9842. Same command but expressing the hue in radians:
  9843. @example
  9844. hue=H=PI/2:s=1
  9845. @end example
  9846. @item
  9847. Rotate hue and make the saturation swing between 0
  9848. and 2 over a period of 1 second:
  9849. @example
  9850. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  9851. @end example
  9852. @item
  9853. Apply a 3 seconds saturation fade-in effect starting at 0:
  9854. @example
  9855. hue="s=min(t/3\,1)"
  9856. @end example
  9857. The general fade-in expression can be written as:
  9858. @example
  9859. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  9860. @end example
  9861. @item
  9862. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  9863. @example
  9864. hue="s=max(0\, min(1\, (8-t)/3))"
  9865. @end example
  9866. The general fade-out expression can be written as:
  9867. @example
  9868. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  9869. @end example
  9870. @end itemize
  9871. @subsection Commands
  9872. This filter supports the following commands:
  9873. @table @option
  9874. @item b
  9875. @item s
  9876. @item h
  9877. @item H
  9878. Modify the hue and/or the saturation and/or brightness of the input video.
  9879. The command accepts the same syntax of the corresponding option.
  9880. If the specified expression is not valid, it is kept at its current
  9881. value.
  9882. @end table
  9883. @section hysteresis
  9884. Grow first stream into second stream by connecting components.
  9885. This makes it possible to build more robust edge masks.
  9886. This filter accepts the following options:
  9887. @table @option
  9888. @item planes
  9889. Set which planes will be processed as bitmap, unprocessed planes will be
  9890. copied from first stream.
  9891. By default value 0xf, all planes will be processed.
  9892. @item threshold
  9893. Set threshold which is used in filtering. If pixel component value is higher than
  9894. this value filter algorithm for connecting components is activated.
  9895. By default value is 0.
  9896. @end table
  9897. The @code{hysteresis} filter also supports the @ref{framesync} options.
  9898. @section idet
  9899. Detect video interlacing type.
  9900. This filter tries to detect if the input frames are interlaced, progressive,
  9901. top or bottom field first. It will also try to detect fields that are
  9902. repeated between adjacent frames (a sign of telecine).
  9903. Single frame detection considers only immediately adjacent frames when classifying each frame.
  9904. Multiple frame detection incorporates the classification history of previous frames.
  9905. The filter will log these metadata values:
  9906. @table @option
  9907. @item single.current_frame
  9908. Detected type of current frame using single-frame detection. One of:
  9909. ``tff'' (top field first), ``bff'' (bottom field first),
  9910. ``progressive'', or ``undetermined''
  9911. @item single.tff
  9912. Cumulative number of frames detected as top field first using single-frame detection.
  9913. @item multiple.tff
  9914. Cumulative number of frames detected as top field first using multiple-frame detection.
  9915. @item single.bff
  9916. Cumulative number of frames detected as bottom field first using single-frame detection.
  9917. @item multiple.current_frame
  9918. Detected type of current frame using multiple-frame detection. One of:
  9919. ``tff'' (top field first), ``bff'' (bottom field first),
  9920. ``progressive'', or ``undetermined''
  9921. @item multiple.bff
  9922. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  9923. @item single.progressive
  9924. Cumulative number of frames detected as progressive using single-frame detection.
  9925. @item multiple.progressive
  9926. Cumulative number of frames detected as progressive using multiple-frame detection.
  9927. @item single.undetermined
  9928. Cumulative number of frames that could not be classified using single-frame detection.
  9929. @item multiple.undetermined
  9930. Cumulative number of frames that could not be classified using multiple-frame detection.
  9931. @item repeated.current_frame
  9932. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  9933. @item repeated.neither
  9934. Cumulative number of frames with no repeated field.
  9935. @item repeated.top
  9936. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9937. @item repeated.bottom
  9938. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9939. @end table
  9940. The filter accepts the following options:
  9941. @table @option
  9942. @item intl_thres
  9943. Set interlacing threshold.
  9944. @item prog_thres
  9945. Set progressive threshold.
  9946. @item rep_thres
  9947. Threshold for repeated field detection.
  9948. @item half_life
  9949. Number of frames after which a given frame's contribution to the
  9950. statistics is halved (i.e., it contributes only 0.5 to its
  9951. classification). The default of 0 means that all frames seen are given
  9952. full weight of 1.0 forever.
  9953. @item analyze_interlaced_flag
  9954. When this is not 0 then idet will use the specified number of frames to determine
  9955. if the interlaced flag is accurate, it will not count undetermined frames.
  9956. If the flag is found to be accurate it will be used without any further
  9957. computations, if it is found to be inaccurate it will be cleared without any
  9958. further computations. This allows inserting the idet filter as a low computational
  9959. method to clean up the interlaced flag
  9960. @end table
  9961. @section il
  9962. Deinterleave or interleave fields.
  9963. This filter allows one to process interlaced images fields without
  9964. deinterlacing them. Deinterleaving splits the input frame into 2
  9965. fields (so called half pictures). Odd lines are moved to the top
  9966. half of the output image, even lines to the bottom half.
  9967. You can process (filter) them independently and then re-interleave them.
  9968. The filter accepts the following options:
  9969. @table @option
  9970. @item luma_mode, l
  9971. @item chroma_mode, c
  9972. @item alpha_mode, a
  9973. Available values for @var{luma_mode}, @var{chroma_mode} and
  9974. @var{alpha_mode} are:
  9975. @table @samp
  9976. @item none
  9977. Do nothing.
  9978. @item deinterleave, d
  9979. Deinterleave fields, placing one above the other.
  9980. @item interleave, i
  9981. Interleave fields. Reverse the effect of deinterleaving.
  9982. @end table
  9983. Default value is @code{none}.
  9984. @item luma_swap, ls
  9985. @item chroma_swap, cs
  9986. @item alpha_swap, as
  9987. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9988. @end table
  9989. @subsection Commands
  9990. This filter supports the all above options as @ref{commands}.
  9991. @section inflate
  9992. Apply inflate effect to the video.
  9993. This filter replaces the pixel by the local(3x3) average by taking into account
  9994. only values higher than the pixel.
  9995. It accepts the following options:
  9996. @table @option
  9997. @item threshold0
  9998. @item threshold1
  9999. @item threshold2
  10000. @item threshold3
  10001. Limit the maximum change for each plane, default is 65535.
  10002. If 0, plane will remain unchanged.
  10003. @end table
  10004. @subsection Commands
  10005. This filter supports the all above options as @ref{commands}.
  10006. @section interlace
  10007. Simple interlacing filter from progressive contents. This interleaves upper (or
  10008. lower) lines from odd frames with lower (or upper) lines from even frames,
  10009. halving the frame rate and preserving image height.
  10010. @example
  10011. Original Original New Frame
  10012. Frame 'j' Frame 'j+1' (tff)
  10013. ========== =========== ==================
  10014. Line 0 --------------------> Frame 'j' Line 0
  10015. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10016. Line 2 ---------------------> Frame 'j' Line 2
  10017. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10018. ... ... ...
  10019. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10020. @end example
  10021. It accepts the following optional parameters:
  10022. @table @option
  10023. @item scan
  10024. This determines whether the interlaced frame is taken from the even
  10025. (tff - default) or odd (bff) lines of the progressive frame.
  10026. @item lowpass
  10027. Vertical lowpass filter to avoid twitter interlacing and
  10028. reduce moire patterns.
  10029. @table @samp
  10030. @item 0, off
  10031. Disable vertical lowpass filter
  10032. @item 1, linear
  10033. Enable linear filter (default)
  10034. @item 2, complex
  10035. Enable complex filter. This will slightly less reduce twitter and moire
  10036. but better retain detail and subjective sharpness impression.
  10037. @end table
  10038. @end table
  10039. @section kerndeint
  10040. Deinterlace input video by applying Donald Graft's adaptive kernel
  10041. deinterling. Work on interlaced parts of a video to produce
  10042. progressive frames.
  10043. The description of the accepted parameters follows.
  10044. @table @option
  10045. @item thresh
  10046. Set the threshold which affects the filter's tolerance when
  10047. determining if a pixel line must be processed. It must be an integer
  10048. in the range [0,255] and defaults to 10. A value of 0 will result in
  10049. applying the process on every pixels.
  10050. @item map
  10051. Paint pixels exceeding the threshold value to white if set to 1.
  10052. Default is 0.
  10053. @item order
  10054. Set the fields order. Swap fields if set to 1, leave fields alone if
  10055. 0. Default is 0.
  10056. @item sharp
  10057. Enable additional sharpening if set to 1. Default is 0.
  10058. @item twoway
  10059. Enable twoway sharpening if set to 1. Default is 0.
  10060. @end table
  10061. @subsection Examples
  10062. @itemize
  10063. @item
  10064. Apply default values:
  10065. @example
  10066. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  10067. @end example
  10068. @item
  10069. Enable additional sharpening:
  10070. @example
  10071. kerndeint=sharp=1
  10072. @end example
  10073. @item
  10074. Paint processed pixels in white:
  10075. @example
  10076. kerndeint=map=1
  10077. @end example
  10078. @end itemize
  10079. @section lagfun
  10080. Slowly update darker pixels.
  10081. This filter makes short flashes of light appear longer.
  10082. This filter accepts the following options:
  10083. @table @option
  10084. @item decay
  10085. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  10086. @item planes
  10087. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  10088. @end table
  10089. @section lenscorrection
  10090. Correct radial lens distortion
  10091. This filter can be used to correct for radial distortion as can result from the use
  10092. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  10093. one can use tools available for example as part of opencv or simply trial-and-error.
  10094. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  10095. and extract the k1 and k2 coefficients from the resulting matrix.
  10096. Note that effectively the same filter is available in the open-source tools Krita and
  10097. Digikam from the KDE project.
  10098. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  10099. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  10100. brightness distribution, so you may want to use both filters together in certain
  10101. cases, though you will have to take care of ordering, i.e. whether vignetting should
  10102. be applied before or after lens correction.
  10103. @subsection Options
  10104. The filter accepts the following options:
  10105. @table @option
  10106. @item cx
  10107. Relative x-coordinate of the focal point of the image, and thereby the center of the
  10108. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10109. width. Default is 0.5.
  10110. @item cy
  10111. Relative y-coordinate of the focal point of the image, and thereby the center of the
  10112. distortion. This value has a range [0,1] and is expressed as fractions of the image
  10113. height. Default is 0.5.
  10114. @item k1
  10115. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  10116. no correction. Default is 0.
  10117. @item k2
  10118. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  10119. 0 means no correction. Default is 0.
  10120. @end table
  10121. The formula that generates the correction is:
  10122. @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)
  10123. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  10124. distances from the focal point in the source and target images, respectively.
  10125. @section lensfun
  10126. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  10127. The @code{lensfun} filter requires the camera make, camera model, and lens model
  10128. to apply the lens correction. The filter will load the lensfun database and
  10129. query it to find the corresponding camera and lens entries in the database. As
  10130. long as these entries can be found with the given options, the filter can
  10131. perform corrections on frames. Note that incomplete strings will result in the
  10132. filter choosing the best match with the given options, and the filter will
  10133. output the chosen camera and lens models (logged with level "info"). You must
  10134. provide the make, camera model, and lens model as they are required.
  10135. The filter accepts the following options:
  10136. @table @option
  10137. @item make
  10138. The make of the camera (for example, "Canon"). This option is required.
  10139. @item model
  10140. The model of the camera (for example, "Canon EOS 100D"). This option is
  10141. required.
  10142. @item lens_model
  10143. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  10144. option is required.
  10145. @item mode
  10146. The type of correction to apply. The following values are valid options:
  10147. @table @samp
  10148. @item vignetting
  10149. Enables fixing lens vignetting.
  10150. @item geometry
  10151. Enables fixing lens geometry. This is the default.
  10152. @item subpixel
  10153. Enables fixing chromatic aberrations.
  10154. @item vig_geo
  10155. Enables fixing lens vignetting and lens geometry.
  10156. @item vig_subpixel
  10157. Enables fixing lens vignetting and chromatic aberrations.
  10158. @item distortion
  10159. Enables fixing both lens geometry and chromatic aberrations.
  10160. @item all
  10161. Enables all possible corrections.
  10162. @end table
  10163. @item focal_length
  10164. The focal length of the image/video (zoom; expected constant for video). For
  10165. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  10166. range should be chosen when using that lens. Default 18.
  10167. @item aperture
  10168. The aperture of the image/video (expected constant for video). Note that
  10169. aperture is only used for vignetting correction. Default 3.5.
  10170. @item focus_distance
  10171. The focus distance of the image/video (expected constant for video). Note that
  10172. focus distance is only used for vignetting and only slightly affects the
  10173. vignetting correction process. If unknown, leave it at the default value (which
  10174. is 1000).
  10175. @item scale
  10176. The scale factor which is applied after transformation. After correction the
  10177. video is no longer necessarily rectangular. This parameter controls how much of
  10178. the resulting image is visible. The value 0 means that a value will be chosen
  10179. automatically such that there is little or no unmapped area in the output
  10180. image. 1.0 means that no additional scaling is done. Lower values may result
  10181. in more of the corrected image being visible, while higher values may avoid
  10182. unmapped areas in the output.
  10183. @item target_geometry
  10184. The target geometry of the output image/video. The following values are valid
  10185. options:
  10186. @table @samp
  10187. @item rectilinear (default)
  10188. @item fisheye
  10189. @item panoramic
  10190. @item equirectangular
  10191. @item fisheye_orthographic
  10192. @item fisheye_stereographic
  10193. @item fisheye_equisolid
  10194. @item fisheye_thoby
  10195. @end table
  10196. @item reverse
  10197. Apply the reverse of image correction (instead of correcting distortion, apply
  10198. it).
  10199. @item interpolation
  10200. The type of interpolation used when correcting distortion. The following values
  10201. are valid options:
  10202. @table @samp
  10203. @item nearest
  10204. @item linear (default)
  10205. @item lanczos
  10206. @end table
  10207. @end table
  10208. @subsection Examples
  10209. @itemize
  10210. @item
  10211. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  10212. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  10213. aperture of "8.0".
  10214. @example
  10215. 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
  10216. @end example
  10217. @item
  10218. Apply the same as before, but only for the first 5 seconds of video.
  10219. @example
  10220. 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
  10221. @end example
  10222. @end itemize
  10223. @section libvmaf
  10224. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  10225. score between two input videos.
  10226. The obtained VMAF score is printed through the logging system.
  10227. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  10228. After installing the library it can be enabled using:
  10229. @code{./configure --enable-libvmaf}.
  10230. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  10231. The filter has following options:
  10232. @table @option
  10233. @item model_path
  10234. Set the model path which is to be used for SVM.
  10235. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  10236. @item log_path
  10237. Set the file path to be used to store logs.
  10238. @item log_fmt
  10239. Set the format of the log file (csv, json or xml).
  10240. @item enable_transform
  10241. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  10242. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  10243. Default value: @code{false}
  10244. @item phone_model
  10245. Invokes the phone model which will generate VMAF scores higher than in the
  10246. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  10247. Default value: @code{false}
  10248. @item psnr
  10249. Enables computing psnr along with vmaf.
  10250. Default value: @code{false}
  10251. @item ssim
  10252. Enables computing ssim along with vmaf.
  10253. Default value: @code{false}
  10254. @item ms_ssim
  10255. Enables computing ms_ssim along with vmaf.
  10256. Default value: @code{false}
  10257. @item pool
  10258. Set the pool method to be used for computing vmaf.
  10259. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  10260. @item n_threads
  10261. Set number of threads to be used when computing vmaf.
  10262. Default value: @code{0}, which makes use of all available logical processors.
  10263. @item n_subsample
  10264. Set interval for frame subsampling used when computing vmaf.
  10265. Default value: @code{1}
  10266. @item enable_conf_interval
  10267. Enables confidence interval.
  10268. Default value: @code{false}
  10269. @end table
  10270. This filter also supports the @ref{framesync} options.
  10271. @subsection Examples
  10272. @itemize
  10273. @item
  10274. On the below examples the input file @file{main.mpg} being processed is
  10275. compared with the reference file @file{ref.mpg}.
  10276. @example
  10277. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  10278. @end example
  10279. @item
  10280. Example with options:
  10281. @example
  10282. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  10283. @end example
  10284. @item
  10285. Example with options and different containers:
  10286. @example
  10287. 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 -
  10288. @end example
  10289. @end itemize
  10290. @section limiter
  10291. Limits the pixel components values to the specified range [min, max].
  10292. The filter accepts the following options:
  10293. @table @option
  10294. @item min
  10295. Lower bound. Defaults to the lowest allowed value for the input.
  10296. @item max
  10297. Upper bound. Defaults to the highest allowed value for the input.
  10298. @item planes
  10299. Specify which planes will be processed. Defaults to all available.
  10300. @end table
  10301. @section loop
  10302. Loop video frames.
  10303. The filter accepts the following options:
  10304. @table @option
  10305. @item loop
  10306. Set the number of loops. Setting this value to -1 will result in infinite loops.
  10307. Default is 0.
  10308. @item size
  10309. Set maximal size in number of frames. Default is 0.
  10310. @item start
  10311. Set first frame of loop. Default is 0.
  10312. @end table
  10313. @subsection Examples
  10314. @itemize
  10315. @item
  10316. Loop single first frame infinitely:
  10317. @example
  10318. loop=loop=-1:size=1:start=0
  10319. @end example
  10320. @item
  10321. Loop single first frame 10 times:
  10322. @example
  10323. loop=loop=10:size=1:start=0
  10324. @end example
  10325. @item
  10326. Loop 10 first frames 5 times:
  10327. @example
  10328. loop=loop=5:size=10:start=0
  10329. @end example
  10330. @end itemize
  10331. @section lut1d
  10332. Apply a 1D LUT to an input video.
  10333. The filter accepts the following options:
  10334. @table @option
  10335. @item file
  10336. Set the 1D LUT file name.
  10337. Currently supported formats:
  10338. @table @samp
  10339. @item cube
  10340. Iridas
  10341. @item csp
  10342. cineSpace
  10343. @end table
  10344. @item interp
  10345. Select interpolation mode.
  10346. Available values are:
  10347. @table @samp
  10348. @item nearest
  10349. Use values from the nearest defined point.
  10350. @item linear
  10351. Interpolate values using the linear interpolation.
  10352. @item cosine
  10353. Interpolate values using the cosine interpolation.
  10354. @item cubic
  10355. Interpolate values using the cubic interpolation.
  10356. @item spline
  10357. Interpolate values using the spline interpolation.
  10358. @end table
  10359. @end table
  10360. @anchor{lut3d}
  10361. @section lut3d
  10362. Apply a 3D LUT to an input video.
  10363. The filter accepts the following options:
  10364. @table @option
  10365. @item file
  10366. Set the 3D LUT file name.
  10367. Currently supported formats:
  10368. @table @samp
  10369. @item 3dl
  10370. AfterEffects
  10371. @item cube
  10372. Iridas
  10373. @item dat
  10374. DaVinci
  10375. @item m3d
  10376. Pandora
  10377. @item csp
  10378. cineSpace
  10379. @end table
  10380. @item interp
  10381. Select interpolation mode.
  10382. Available values are:
  10383. @table @samp
  10384. @item nearest
  10385. Use values from the nearest defined point.
  10386. @item trilinear
  10387. Interpolate values using the 8 points defining a cube.
  10388. @item tetrahedral
  10389. Interpolate values using a tetrahedron.
  10390. @end table
  10391. @end table
  10392. @section lumakey
  10393. Turn certain luma values into transparency.
  10394. The filter accepts the following options:
  10395. @table @option
  10396. @item threshold
  10397. Set the luma which will be used as base for transparency.
  10398. Default value is @code{0}.
  10399. @item tolerance
  10400. Set the range of luma values to be keyed out.
  10401. Default value is @code{0.01}.
  10402. @item softness
  10403. Set the range of softness. Default value is @code{0}.
  10404. Use this to control gradual transition from zero to full transparency.
  10405. @end table
  10406. @subsection Commands
  10407. This filter supports same @ref{commands} as options.
  10408. The command accepts the same syntax of the corresponding option.
  10409. If the specified expression is not valid, it is kept at its current
  10410. value.
  10411. @section lut, lutrgb, lutyuv
  10412. Compute a look-up table for binding each pixel component input value
  10413. to an output value, and apply it to the input video.
  10414. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  10415. to an RGB input video.
  10416. These filters accept the following parameters:
  10417. @table @option
  10418. @item c0
  10419. set first pixel component expression
  10420. @item c1
  10421. set second pixel component expression
  10422. @item c2
  10423. set third pixel component expression
  10424. @item c3
  10425. set fourth pixel component expression, corresponds to the alpha component
  10426. @item r
  10427. set red component expression
  10428. @item g
  10429. set green component expression
  10430. @item b
  10431. set blue component expression
  10432. @item a
  10433. alpha component expression
  10434. @item y
  10435. set Y/luminance component expression
  10436. @item u
  10437. set U/Cb component expression
  10438. @item v
  10439. set V/Cr component expression
  10440. @end table
  10441. Each of them specifies the expression to use for computing the lookup table for
  10442. the corresponding pixel component values.
  10443. The exact component associated to each of the @var{c*} options depends on the
  10444. format in input.
  10445. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  10446. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  10447. The expressions can contain the following constants and functions:
  10448. @table @option
  10449. @item w
  10450. @item h
  10451. The input width and height.
  10452. @item val
  10453. The input value for the pixel component.
  10454. @item clipval
  10455. The input value, clipped to the @var{minval}-@var{maxval} range.
  10456. @item maxval
  10457. The maximum value for the pixel component.
  10458. @item minval
  10459. The minimum value for the pixel component.
  10460. @item negval
  10461. The negated value for the pixel component value, clipped to the
  10462. @var{minval}-@var{maxval} range; it corresponds to the expression
  10463. "maxval-clipval+minval".
  10464. @item clip(val)
  10465. The computed value in @var{val}, clipped to the
  10466. @var{minval}-@var{maxval} range.
  10467. @item gammaval(gamma)
  10468. The computed gamma correction value of the pixel component value,
  10469. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  10470. expression
  10471. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  10472. @end table
  10473. All expressions default to "val".
  10474. @subsection Examples
  10475. @itemize
  10476. @item
  10477. Negate input video:
  10478. @example
  10479. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  10480. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  10481. @end example
  10482. The above is the same as:
  10483. @example
  10484. lutrgb="r=negval:g=negval:b=negval"
  10485. lutyuv="y=negval:u=negval:v=negval"
  10486. @end example
  10487. @item
  10488. Negate luminance:
  10489. @example
  10490. lutyuv=y=negval
  10491. @end example
  10492. @item
  10493. Remove chroma components, turning the video into a graytone image:
  10494. @example
  10495. lutyuv="u=128:v=128"
  10496. @end example
  10497. @item
  10498. Apply a luma burning effect:
  10499. @example
  10500. lutyuv="y=2*val"
  10501. @end example
  10502. @item
  10503. Remove green and blue components:
  10504. @example
  10505. lutrgb="g=0:b=0"
  10506. @end example
  10507. @item
  10508. Set a constant alpha channel value on input:
  10509. @example
  10510. format=rgba,lutrgb=a="maxval-minval/2"
  10511. @end example
  10512. @item
  10513. Correct luminance gamma by a factor of 0.5:
  10514. @example
  10515. lutyuv=y=gammaval(0.5)
  10516. @end example
  10517. @item
  10518. Discard least significant bits of luma:
  10519. @example
  10520. lutyuv=y='bitand(val, 128+64+32)'
  10521. @end example
  10522. @item
  10523. Technicolor like effect:
  10524. @example
  10525. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  10526. @end example
  10527. @end itemize
  10528. @section lut2, tlut2
  10529. The @code{lut2} filter takes two input streams and outputs one
  10530. stream.
  10531. The @code{tlut2} (time lut2) filter takes two consecutive frames
  10532. from one single stream.
  10533. This filter accepts the following parameters:
  10534. @table @option
  10535. @item c0
  10536. set first pixel component expression
  10537. @item c1
  10538. set second pixel component expression
  10539. @item c2
  10540. set third pixel component expression
  10541. @item c3
  10542. set fourth pixel component expression, corresponds to the alpha component
  10543. @item d
  10544. set output bit depth, only available for @code{lut2} filter. By default is 0,
  10545. which means bit depth is automatically picked from first input format.
  10546. @end table
  10547. The @code{lut2} filter also supports the @ref{framesync} options.
  10548. Each of them specifies the expression to use for computing the lookup table for
  10549. the corresponding pixel component values.
  10550. The exact component associated to each of the @var{c*} options depends on the
  10551. format in inputs.
  10552. The expressions can contain the following constants:
  10553. @table @option
  10554. @item w
  10555. @item h
  10556. The input width and height.
  10557. @item x
  10558. The first input value for the pixel component.
  10559. @item y
  10560. The second input value for the pixel component.
  10561. @item bdx
  10562. The first input video bit depth.
  10563. @item bdy
  10564. The second input video bit depth.
  10565. @end table
  10566. All expressions default to "x".
  10567. @subsection Examples
  10568. @itemize
  10569. @item
  10570. Highlight differences between two RGB video streams:
  10571. @example
  10572. 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)'
  10573. @end example
  10574. @item
  10575. Highlight differences between two YUV video streams:
  10576. @example
  10577. 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)'
  10578. @end example
  10579. @item
  10580. Show max difference between two video streams:
  10581. @example
  10582. 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)))'
  10583. @end example
  10584. @end itemize
  10585. @section maskedclamp
  10586. Clamp the first input stream with the second input and third input stream.
  10587. Returns the value of first stream to be between second input
  10588. stream - @code{undershoot} and third input stream + @code{overshoot}.
  10589. This filter accepts the following options:
  10590. @table @option
  10591. @item undershoot
  10592. Default value is @code{0}.
  10593. @item overshoot
  10594. Default value is @code{0}.
  10595. @item planes
  10596. Set which planes will be processed as bitmap, unprocessed planes will be
  10597. copied from first stream.
  10598. By default value 0xf, all planes will be processed.
  10599. @end table
  10600. @section maskedmax
  10601. Merge the second and third input stream into output stream using absolute differences
  10602. between second input stream and first input stream and absolute difference between
  10603. third input stream and first input stream. The picked value will be from second input
  10604. stream if second absolute difference is greater than first one or from third input stream
  10605. otherwise.
  10606. This filter accepts the following options:
  10607. @table @option
  10608. @item planes
  10609. Set which planes will be processed as bitmap, unprocessed planes will be
  10610. copied from first stream.
  10611. By default value 0xf, all planes will be processed.
  10612. @end table
  10613. @section maskedmerge
  10614. Merge the first input stream with the second input stream using per pixel
  10615. weights in the third input stream.
  10616. A value of 0 in the third stream pixel component means that pixel component
  10617. from first stream is returned unchanged, while maximum value (eg. 255 for
  10618. 8-bit videos) means that pixel component from second stream is returned
  10619. unchanged. Intermediate values define the amount of merging between both
  10620. input stream's pixel components.
  10621. This filter accepts the following options:
  10622. @table @option
  10623. @item planes
  10624. Set which planes will be processed as bitmap, unprocessed planes will be
  10625. copied from first stream.
  10626. By default value 0xf, all planes will be processed.
  10627. @end table
  10628. @section maskedmin
  10629. Merge the second and third input stream into output stream using absolute differences
  10630. between second input stream and first input stream and absolute difference between
  10631. third input stream and first input stream. The picked value will be from second input
  10632. stream if second absolute difference is less than first one or from third input stream
  10633. otherwise.
  10634. This filter accepts the following options:
  10635. @table @option
  10636. @item planes
  10637. Set which planes will be processed as bitmap, unprocessed planes will be
  10638. copied from first stream.
  10639. By default value 0xf, all planes will be processed.
  10640. @end table
  10641. @section maskedthreshold
  10642. Pick pixels comparing absolute difference of two video streams with fixed
  10643. threshold.
  10644. If absolute difference between pixel component of first and second video
  10645. stream is equal or lower than user supplied threshold than pixel component
  10646. from first video stream is picked, otherwise pixel component from second
  10647. video stream is picked.
  10648. This filter accepts the following options:
  10649. @table @option
  10650. @item threshold
  10651. Set threshold used when picking pixels from absolute difference from two input
  10652. video streams.
  10653. @item planes
  10654. Set which planes will be processed as bitmap, unprocessed planes will be
  10655. copied from second stream.
  10656. By default value 0xf, all planes will be processed.
  10657. @end table
  10658. @section maskfun
  10659. Create mask from input video.
  10660. For example it is useful to create motion masks after @code{tblend} filter.
  10661. This filter accepts the following options:
  10662. @table @option
  10663. @item low
  10664. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  10665. @item high
  10666. Set high threshold. Any pixel component higher than this value will be set to max value
  10667. allowed for current pixel format.
  10668. @item planes
  10669. Set planes to filter, by default all available planes are filtered.
  10670. @item fill
  10671. Fill all frame pixels with this value.
  10672. @item sum
  10673. Set max average pixel value for frame. If sum of all pixel components is higher that this
  10674. average, output frame will be completely filled with value set by @var{fill} option.
  10675. Typically useful for scene changes when used in combination with @code{tblend} filter.
  10676. @end table
  10677. @section mcdeint
  10678. Apply motion-compensation deinterlacing.
  10679. It needs one field per frame as input and must thus be used together
  10680. with yadif=1/3 or equivalent.
  10681. This filter accepts the following options:
  10682. @table @option
  10683. @item mode
  10684. Set the deinterlacing mode.
  10685. It accepts one of the following values:
  10686. @table @samp
  10687. @item fast
  10688. @item medium
  10689. @item slow
  10690. use iterative motion estimation
  10691. @item extra_slow
  10692. like @samp{slow}, but use multiple reference frames.
  10693. @end table
  10694. Default value is @samp{fast}.
  10695. @item parity
  10696. Set the picture field parity assumed for the input video. It must be
  10697. one of the following values:
  10698. @table @samp
  10699. @item 0, tff
  10700. assume top field first
  10701. @item 1, bff
  10702. assume bottom field first
  10703. @end table
  10704. Default value is @samp{bff}.
  10705. @item qp
  10706. Set per-block quantization parameter (QP) used by the internal
  10707. encoder.
  10708. Higher values should result in a smoother motion vector field but less
  10709. optimal individual vectors. Default value is 1.
  10710. @end table
  10711. @section median
  10712. Pick median pixel from certain rectangle defined by radius.
  10713. This filter accepts the following options:
  10714. @table @option
  10715. @item radius
  10716. Set horizontal radius size. Default value is @code{1}.
  10717. Allowed range is integer from 1 to 127.
  10718. @item planes
  10719. Set which planes to process. Default is @code{15}, which is all available planes.
  10720. @item radiusV
  10721. Set vertical radius size. Default value is @code{0}.
  10722. Allowed range is integer from 0 to 127.
  10723. If it is 0, value will be picked from horizontal @code{radius} option.
  10724. @item percentile
  10725. Set median percentile. Default value is @code{0.5}.
  10726. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  10727. minimum values, and @code{1} maximum values.
  10728. @end table
  10729. @subsection Commands
  10730. This filter supports same @ref{commands} as options.
  10731. The command accepts the same syntax of the corresponding option.
  10732. If the specified expression is not valid, it is kept at its current
  10733. value.
  10734. @section mergeplanes
  10735. Merge color channel components from several video streams.
  10736. The filter accepts up to 4 input streams, and merge selected input
  10737. planes to the output video.
  10738. This filter accepts the following options:
  10739. @table @option
  10740. @item mapping
  10741. Set input to output plane mapping. Default is @code{0}.
  10742. The mappings is specified as a bitmap. It should be specified as a
  10743. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  10744. mapping for the first plane of the output stream. 'A' sets the number of
  10745. the input stream to use (from 0 to 3), and 'a' the plane number of the
  10746. corresponding input to use (from 0 to 3). The rest of the mappings is
  10747. similar, 'Bb' describes the mapping for the output stream second
  10748. plane, 'Cc' describes the mapping for the output stream third plane and
  10749. 'Dd' describes the mapping for the output stream fourth plane.
  10750. @item format
  10751. Set output pixel format. Default is @code{yuva444p}.
  10752. @end table
  10753. @subsection Examples
  10754. @itemize
  10755. @item
  10756. Merge three gray video streams of same width and height into single video stream:
  10757. @example
  10758. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  10759. @end example
  10760. @item
  10761. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  10762. @example
  10763. [a0][a1]mergeplanes=0x00010210:yuva444p
  10764. @end example
  10765. @item
  10766. Swap Y and A plane in yuva444p stream:
  10767. @example
  10768. format=yuva444p,mergeplanes=0x03010200:yuva444p
  10769. @end example
  10770. @item
  10771. Swap U and V plane in yuv420p stream:
  10772. @example
  10773. format=yuv420p,mergeplanes=0x000201:yuv420p
  10774. @end example
  10775. @item
  10776. Cast a rgb24 clip to yuv444p:
  10777. @example
  10778. format=rgb24,mergeplanes=0x000102:yuv444p
  10779. @end example
  10780. @end itemize
  10781. @section mestimate
  10782. Estimate and export motion vectors using block matching algorithms.
  10783. Motion vectors are stored in frame side data to be used by other filters.
  10784. This filter accepts the following options:
  10785. @table @option
  10786. @item method
  10787. Specify the motion estimation method. Accepts one of the following values:
  10788. @table @samp
  10789. @item esa
  10790. Exhaustive search algorithm.
  10791. @item tss
  10792. Three step search algorithm.
  10793. @item tdls
  10794. Two dimensional logarithmic search algorithm.
  10795. @item ntss
  10796. New three step search algorithm.
  10797. @item fss
  10798. Four step search algorithm.
  10799. @item ds
  10800. Diamond search algorithm.
  10801. @item hexbs
  10802. Hexagon-based search algorithm.
  10803. @item epzs
  10804. Enhanced predictive zonal search algorithm.
  10805. @item umh
  10806. Uneven multi-hexagon search algorithm.
  10807. @end table
  10808. Default value is @samp{esa}.
  10809. @item mb_size
  10810. Macroblock size. Default @code{16}.
  10811. @item search_param
  10812. Search parameter. Default @code{7}.
  10813. @end table
  10814. @section midequalizer
  10815. Apply Midway Image Equalization effect using two video streams.
  10816. Midway Image Equalization adjusts a pair of images to have the same
  10817. histogram, while maintaining their dynamics as much as possible. It's
  10818. useful for e.g. matching exposures from a pair of stereo cameras.
  10819. This filter has two inputs and one output, which must be of same pixel format, but
  10820. may be of different sizes. The output of filter is first input adjusted with
  10821. midway histogram of both inputs.
  10822. This filter accepts the following option:
  10823. @table @option
  10824. @item planes
  10825. Set which planes to process. Default is @code{15}, which is all available planes.
  10826. @end table
  10827. @section minterpolate
  10828. Convert the video to specified frame rate using motion interpolation.
  10829. This filter accepts the following options:
  10830. @table @option
  10831. @item fps
  10832. 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}.
  10833. @item mi_mode
  10834. Motion interpolation mode. Following values are accepted:
  10835. @table @samp
  10836. @item dup
  10837. Duplicate previous or next frame for interpolating new ones.
  10838. @item blend
  10839. Blend source frames. Interpolated frame is mean of previous and next frames.
  10840. @item mci
  10841. Motion compensated interpolation. Following options are effective when this mode is selected:
  10842. @table @samp
  10843. @item mc_mode
  10844. Motion compensation mode. Following values are accepted:
  10845. @table @samp
  10846. @item obmc
  10847. Overlapped block motion compensation.
  10848. @item aobmc
  10849. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  10850. @end table
  10851. Default mode is @samp{obmc}.
  10852. @item me_mode
  10853. Motion estimation mode. Following values are accepted:
  10854. @table @samp
  10855. @item bidir
  10856. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  10857. @item bilat
  10858. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  10859. @end table
  10860. Default mode is @samp{bilat}.
  10861. @item me
  10862. The algorithm to be used for motion estimation. Following values are accepted:
  10863. @table @samp
  10864. @item esa
  10865. Exhaustive search algorithm.
  10866. @item tss
  10867. Three step search algorithm.
  10868. @item tdls
  10869. Two dimensional logarithmic search algorithm.
  10870. @item ntss
  10871. New three step search algorithm.
  10872. @item fss
  10873. Four step search algorithm.
  10874. @item ds
  10875. Diamond search algorithm.
  10876. @item hexbs
  10877. Hexagon-based search algorithm.
  10878. @item epzs
  10879. Enhanced predictive zonal search algorithm.
  10880. @item umh
  10881. Uneven multi-hexagon search algorithm.
  10882. @end table
  10883. Default algorithm is @samp{epzs}.
  10884. @item mb_size
  10885. Macroblock size. Default @code{16}.
  10886. @item search_param
  10887. Motion estimation search parameter. Default @code{32}.
  10888. @item vsbmc
  10889. 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).
  10890. @end table
  10891. @end table
  10892. @item scd
  10893. 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:
  10894. @table @samp
  10895. @item none
  10896. Disable scene change detection.
  10897. @item fdiff
  10898. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  10899. @end table
  10900. Default method is @samp{fdiff}.
  10901. @item scd_threshold
  10902. Scene change detection threshold. Default is @code{10.}.
  10903. @end table
  10904. @section mix
  10905. Mix several video input streams into one video stream.
  10906. A description of the accepted options follows.
  10907. @table @option
  10908. @item nb_inputs
  10909. The number of inputs. If unspecified, it defaults to 2.
  10910. @item weights
  10911. Specify weight of each input video stream as sequence.
  10912. Each weight is separated by space. If number of weights
  10913. is smaller than number of @var{frames} last specified
  10914. weight will be used for all remaining unset weights.
  10915. @item scale
  10916. Specify scale, if it is set it will be multiplied with sum
  10917. of each weight multiplied with pixel values to give final destination
  10918. pixel value. By default @var{scale} is auto scaled to sum of weights.
  10919. @item duration
  10920. Specify how end of stream is determined.
  10921. @table @samp
  10922. @item longest
  10923. The duration of the longest input. (default)
  10924. @item shortest
  10925. The duration of the shortest input.
  10926. @item first
  10927. The duration of the first input.
  10928. @end table
  10929. @end table
  10930. @section mpdecimate
  10931. Drop frames that do not differ greatly from the previous frame in
  10932. order to reduce frame rate.
  10933. The main use of this filter is for very-low-bitrate encoding
  10934. (e.g. streaming over dialup modem), but it could in theory be used for
  10935. fixing movies that were inverse-telecined incorrectly.
  10936. A description of the accepted options follows.
  10937. @table @option
  10938. @item max
  10939. Set the maximum number of consecutive frames which can be dropped (if
  10940. positive), or the minimum interval between dropped frames (if
  10941. negative). If the value is 0, the frame is dropped disregarding the
  10942. number of previous sequentially dropped frames.
  10943. Default value is 0.
  10944. @item hi
  10945. @item lo
  10946. @item frac
  10947. Set the dropping threshold values.
  10948. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  10949. represent actual pixel value differences, so a threshold of 64
  10950. corresponds to 1 unit of difference for each pixel, or the same spread
  10951. out differently over the block.
  10952. A frame is a candidate for dropping if no 8x8 blocks differ by more
  10953. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  10954. meaning the whole image) differ by more than a threshold of @option{lo}.
  10955. Default value for @option{hi} is 64*12, default value for @option{lo} is
  10956. 64*5, and default value for @option{frac} is 0.33.
  10957. @end table
  10958. @section negate
  10959. Negate (invert) the input video.
  10960. It accepts the following option:
  10961. @table @option
  10962. @item negate_alpha
  10963. With value 1, it negates the alpha component, if present. Default value is 0.
  10964. @end table
  10965. @anchor{nlmeans}
  10966. @section nlmeans
  10967. Denoise frames using Non-Local Means algorithm.
  10968. Each pixel is adjusted by looking for other pixels with similar contexts. This
  10969. context similarity is defined by comparing their surrounding patches of size
  10970. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  10971. around the pixel.
  10972. Note that the research area defines centers for patches, which means some
  10973. patches will be made of pixels outside that research area.
  10974. The filter accepts the following options.
  10975. @table @option
  10976. @item s
  10977. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  10978. @item p
  10979. Set patch size. Default is 7. Must be odd number in range [0, 99].
  10980. @item pc
  10981. Same as @option{p} but for chroma planes.
  10982. The default value is @var{0} and means automatic.
  10983. @item r
  10984. Set research size. Default is 15. Must be odd number in range [0, 99].
  10985. @item rc
  10986. Same as @option{r} but for chroma planes.
  10987. The default value is @var{0} and means automatic.
  10988. @end table
  10989. @section nnedi
  10990. Deinterlace video using neural network edge directed interpolation.
  10991. This filter accepts the following options:
  10992. @table @option
  10993. @item weights
  10994. Mandatory option, without binary file filter can not work.
  10995. Currently file can be found here:
  10996. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  10997. @item deint
  10998. Set which frames to deinterlace, by default it is @code{all}.
  10999. Can be @code{all} or @code{interlaced}.
  11000. @item field
  11001. Set mode of operation.
  11002. Can be one of the following:
  11003. @table @samp
  11004. @item af
  11005. Use frame flags, both fields.
  11006. @item a
  11007. Use frame flags, single field.
  11008. @item t
  11009. Use top field only.
  11010. @item b
  11011. Use bottom field only.
  11012. @item tf
  11013. Use both fields, top first.
  11014. @item bf
  11015. Use both fields, bottom first.
  11016. @end table
  11017. @item planes
  11018. Set which planes to process, by default filter process all frames.
  11019. @item nsize
  11020. Set size of local neighborhood around each pixel, used by the predictor neural
  11021. network.
  11022. Can be one of the following:
  11023. @table @samp
  11024. @item s8x6
  11025. @item s16x6
  11026. @item s32x6
  11027. @item s48x6
  11028. @item s8x4
  11029. @item s16x4
  11030. @item s32x4
  11031. @end table
  11032. @item nns
  11033. Set the number of neurons in predictor neural network.
  11034. Can be one of the following:
  11035. @table @samp
  11036. @item n16
  11037. @item n32
  11038. @item n64
  11039. @item n128
  11040. @item n256
  11041. @end table
  11042. @item qual
  11043. Controls the number of different neural network predictions that are blended
  11044. together to compute the final output value. Can be @code{fast}, default or
  11045. @code{slow}.
  11046. @item etype
  11047. Set which set of weights to use in the predictor.
  11048. Can be one of the following:
  11049. @table @samp
  11050. @item a
  11051. weights trained to minimize absolute error
  11052. @item s
  11053. weights trained to minimize squared error
  11054. @end table
  11055. @item pscrn
  11056. Controls whether or not the prescreener neural network is used to decide
  11057. which pixels should be processed by the predictor neural network and which
  11058. can be handled by simple cubic interpolation.
  11059. The prescreener is trained to know whether cubic interpolation will be
  11060. sufficient for a pixel or whether it should be predicted by the predictor nn.
  11061. The computational complexity of the prescreener nn is much less than that of
  11062. the predictor nn. Since most pixels can be handled by cubic interpolation,
  11063. using the prescreener generally results in much faster processing.
  11064. The prescreener is pretty accurate, so the difference between using it and not
  11065. using it is almost always unnoticeable.
  11066. Can be one of the following:
  11067. @table @samp
  11068. @item none
  11069. @item original
  11070. @item new
  11071. @end table
  11072. Default is @code{new}.
  11073. @item fapprox
  11074. Set various debugging flags.
  11075. @end table
  11076. @section noformat
  11077. Force libavfilter not to use any of the specified pixel formats for the
  11078. input to the next filter.
  11079. It accepts the following parameters:
  11080. @table @option
  11081. @item pix_fmts
  11082. A '|'-separated list of pixel format names, such as
  11083. pix_fmts=yuv420p|monow|rgb24".
  11084. @end table
  11085. @subsection Examples
  11086. @itemize
  11087. @item
  11088. Force libavfilter to use a format different from @var{yuv420p} for the
  11089. input to the vflip filter:
  11090. @example
  11091. noformat=pix_fmts=yuv420p,vflip
  11092. @end example
  11093. @item
  11094. Convert the input video to any of the formats not contained in the list:
  11095. @example
  11096. noformat=yuv420p|yuv444p|yuv410p
  11097. @end example
  11098. @end itemize
  11099. @section noise
  11100. Add noise on video input frame.
  11101. The filter accepts the following options:
  11102. @table @option
  11103. @item all_seed
  11104. @item c0_seed
  11105. @item c1_seed
  11106. @item c2_seed
  11107. @item c3_seed
  11108. Set noise seed for specific pixel component or all pixel components in case
  11109. of @var{all_seed}. Default value is @code{123457}.
  11110. @item all_strength, alls
  11111. @item c0_strength, c0s
  11112. @item c1_strength, c1s
  11113. @item c2_strength, c2s
  11114. @item c3_strength, c3s
  11115. Set noise strength for specific pixel component or all pixel components in case
  11116. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  11117. @item all_flags, allf
  11118. @item c0_flags, c0f
  11119. @item c1_flags, c1f
  11120. @item c2_flags, c2f
  11121. @item c3_flags, c3f
  11122. Set pixel component flags or set flags for all components if @var{all_flags}.
  11123. Available values for component flags are:
  11124. @table @samp
  11125. @item a
  11126. averaged temporal noise (smoother)
  11127. @item p
  11128. mix random noise with a (semi)regular pattern
  11129. @item t
  11130. temporal noise (noise pattern changes between frames)
  11131. @item u
  11132. uniform noise (gaussian otherwise)
  11133. @end table
  11134. @end table
  11135. @subsection Examples
  11136. Add temporal and uniform noise to input video:
  11137. @example
  11138. noise=alls=20:allf=t+u
  11139. @end example
  11140. @section normalize
  11141. Normalize RGB video (aka histogram stretching, contrast stretching).
  11142. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  11143. For each channel of each frame, the filter computes the input range and maps
  11144. it linearly to the user-specified output range. The output range defaults
  11145. to the full dynamic range from pure black to pure white.
  11146. Temporal smoothing can be used on the input range to reduce flickering (rapid
  11147. changes in brightness) caused when small dark or bright objects enter or leave
  11148. the scene. This is similar to the auto-exposure (automatic gain control) on a
  11149. video camera, and, like a video camera, it may cause a period of over- or
  11150. under-exposure of the video.
  11151. The R,G,B channels can be normalized independently, which may cause some
  11152. color shifting, or linked together as a single channel, which prevents
  11153. color shifting. Linked normalization preserves hue. Independent normalization
  11154. does not, so it can be used to remove some color casts. Independent and linked
  11155. normalization can be combined in any ratio.
  11156. The normalize filter accepts the following options:
  11157. @table @option
  11158. @item blackpt
  11159. @item whitept
  11160. Colors which define the output range. The minimum input value is mapped to
  11161. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  11162. The defaults are black and white respectively. Specifying white for
  11163. @var{blackpt} and black for @var{whitept} will give color-inverted,
  11164. normalized video. Shades of grey can be used to reduce the dynamic range
  11165. (contrast). Specifying saturated colors here can create some interesting
  11166. effects.
  11167. @item smoothing
  11168. The number of previous frames to use for temporal smoothing. The input range
  11169. of each channel is smoothed using a rolling average over the current frame
  11170. and the @var{smoothing} previous frames. The default is 0 (no temporal
  11171. smoothing).
  11172. @item independence
  11173. Controls the ratio of independent (color shifting) channel normalization to
  11174. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  11175. independent. Defaults to 1.0 (fully independent).
  11176. @item strength
  11177. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  11178. expensive no-op. Defaults to 1.0 (full strength).
  11179. @end table
  11180. @subsection Commands
  11181. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  11182. The command accepts the same syntax of the corresponding option.
  11183. If the specified expression is not valid, it is kept at its current
  11184. value.
  11185. @subsection Examples
  11186. Stretch video contrast to use the full dynamic range, with no temporal
  11187. smoothing; may flicker depending on the source content:
  11188. @example
  11189. normalize=blackpt=black:whitept=white:smoothing=0
  11190. @end example
  11191. As above, but with 50 frames of temporal smoothing; flicker should be
  11192. reduced, depending on the source content:
  11193. @example
  11194. normalize=blackpt=black:whitept=white:smoothing=50
  11195. @end example
  11196. As above, but with hue-preserving linked channel normalization:
  11197. @example
  11198. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  11199. @end example
  11200. As above, but with half strength:
  11201. @example
  11202. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  11203. @end example
  11204. Map the darkest input color to red, the brightest input color to cyan:
  11205. @example
  11206. normalize=blackpt=red:whitept=cyan
  11207. @end example
  11208. @section null
  11209. Pass the video source unchanged to the output.
  11210. @section ocr
  11211. Optical Character Recognition
  11212. This filter uses Tesseract for optical character recognition. To enable
  11213. compilation of this filter, you need to configure FFmpeg with
  11214. @code{--enable-libtesseract}.
  11215. It accepts the following options:
  11216. @table @option
  11217. @item datapath
  11218. Set datapath to tesseract data. Default is to use whatever was
  11219. set at installation.
  11220. @item language
  11221. Set language, default is "eng".
  11222. @item whitelist
  11223. Set character whitelist.
  11224. @item blacklist
  11225. Set character blacklist.
  11226. @end table
  11227. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  11228. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  11229. @section ocv
  11230. Apply a video transform using libopencv.
  11231. To enable this filter, install the libopencv library and headers and
  11232. configure FFmpeg with @code{--enable-libopencv}.
  11233. It accepts the following parameters:
  11234. @table @option
  11235. @item filter_name
  11236. The name of the libopencv filter to apply.
  11237. @item filter_params
  11238. The parameters to pass to the libopencv filter. If not specified, the default
  11239. values are assumed.
  11240. @end table
  11241. Refer to the official libopencv documentation for more precise
  11242. information:
  11243. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  11244. Several libopencv filters are supported; see the following subsections.
  11245. @anchor{dilate}
  11246. @subsection dilate
  11247. Dilate an image by using a specific structuring element.
  11248. It corresponds to the libopencv function @code{cvDilate}.
  11249. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  11250. @var{struct_el} represents a structuring element, and has the syntax:
  11251. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  11252. @var{cols} and @var{rows} represent the number of columns and rows of
  11253. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  11254. point, and @var{shape} the shape for the structuring element. @var{shape}
  11255. must be "rect", "cross", "ellipse", or "custom".
  11256. If the value for @var{shape} is "custom", it must be followed by a
  11257. string of the form "=@var{filename}". The file with name
  11258. @var{filename} is assumed to represent a binary image, with each
  11259. printable character corresponding to a bright pixel. When a custom
  11260. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  11261. or columns and rows of the read file are assumed instead.
  11262. The default value for @var{struct_el} is "3x3+0x0/rect".
  11263. @var{nb_iterations} specifies the number of times the transform is
  11264. applied to the image, and defaults to 1.
  11265. Some examples:
  11266. @example
  11267. # Use the default values
  11268. ocv=dilate
  11269. # Dilate using a structuring element with a 5x5 cross, iterating two times
  11270. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  11271. # Read the shape from the file diamond.shape, iterating two times.
  11272. # The file diamond.shape may contain a pattern of characters like this
  11273. # *
  11274. # ***
  11275. # *****
  11276. # ***
  11277. # *
  11278. # The specified columns and rows are ignored
  11279. # but the anchor point coordinates are not
  11280. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  11281. @end example
  11282. @subsection erode
  11283. Erode an image by using a specific structuring element.
  11284. It corresponds to the libopencv function @code{cvErode}.
  11285. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  11286. with the same syntax and semantics as the @ref{dilate} filter.
  11287. @subsection smooth
  11288. Smooth the input video.
  11289. The filter takes the following parameters:
  11290. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  11291. @var{type} is the type of smooth filter to apply, and must be one of
  11292. the following values: "blur", "blur_no_scale", "median", "gaussian",
  11293. or "bilateral". The default value is "gaussian".
  11294. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  11295. depends on the smooth type. @var{param1} and
  11296. @var{param2} accept integer positive values or 0. @var{param3} and
  11297. @var{param4} accept floating point values.
  11298. The default value for @var{param1} is 3. The default value for the
  11299. other parameters is 0.
  11300. These parameters correspond to the parameters assigned to the
  11301. libopencv function @code{cvSmooth}.
  11302. @section oscilloscope
  11303. 2D Video Oscilloscope.
  11304. Useful to measure spatial impulse, step responses, chroma delays, etc.
  11305. It accepts the following parameters:
  11306. @table @option
  11307. @item x
  11308. Set scope center x position.
  11309. @item y
  11310. Set scope center y position.
  11311. @item s
  11312. Set scope size, relative to frame diagonal.
  11313. @item t
  11314. Set scope tilt/rotation.
  11315. @item o
  11316. Set trace opacity.
  11317. @item tx
  11318. Set trace center x position.
  11319. @item ty
  11320. Set trace center y position.
  11321. @item tw
  11322. Set trace width, relative to width of frame.
  11323. @item th
  11324. Set trace height, relative to height of frame.
  11325. @item c
  11326. Set which components to trace. By default it traces first three components.
  11327. @item g
  11328. Draw trace grid. By default is enabled.
  11329. @item st
  11330. Draw some statistics. By default is enabled.
  11331. @item sc
  11332. Draw scope. By default is enabled.
  11333. @end table
  11334. @subsection Commands
  11335. This filter supports same @ref{commands} as options.
  11336. The command accepts the same syntax of the corresponding option.
  11337. If the specified expression is not valid, it is kept at its current
  11338. value.
  11339. @subsection Examples
  11340. @itemize
  11341. @item
  11342. Inspect full first row of video frame.
  11343. @example
  11344. oscilloscope=x=0.5:y=0:s=1
  11345. @end example
  11346. @item
  11347. Inspect full last row of video frame.
  11348. @example
  11349. oscilloscope=x=0.5:y=1:s=1
  11350. @end example
  11351. @item
  11352. Inspect full 5th line of video frame of height 1080.
  11353. @example
  11354. oscilloscope=x=0.5:y=5/1080:s=1
  11355. @end example
  11356. @item
  11357. Inspect full last column of video frame.
  11358. @example
  11359. oscilloscope=x=1:y=0.5:s=1:t=1
  11360. @end example
  11361. @end itemize
  11362. @anchor{overlay}
  11363. @section overlay
  11364. Overlay one video on top of another.
  11365. It takes two inputs and has one output. The first input is the "main"
  11366. video on which the second input is overlaid.
  11367. It accepts the following parameters:
  11368. A description of the accepted options follows.
  11369. @table @option
  11370. @item x
  11371. @item y
  11372. Set the expression for the x and y coordinates of the overlaid video
  11373. on the main video. Default value is "0" for both expressions. In case
  11374. the expression is invalid, it is set to a huge value (meaning that the
  11375. overlay will not be displayed within the output visible area).
  11376. @item eof_action
  11377. See @ref{framesync}.
  11378. @item eval
  11379. Set when the expressions for @option{x}, and @option{y} are evaluated.
  11380. It accepts the following values:
  11381. @table @samp
  11382. @item init
  11383. only evaluate expressions once during the filter initialization or
  11384. when a command is processed
  11385. @item frame
  11386. evaluate expressions for each incoming frame
  11387. @end table
  11388. Default value is @samp{frame}.
  11389. @item shortest
  11390. See @ref{framesync}.
  11391. @item format
  11392. Set the format for the output video.
  11393. It accepts the following values:
  11394. @table @samp
  11395. @item yuv420
  11396. force YUV420 output
  11397. @item yuv420p10
  11398. force YUV420p10 output
  11399. @item yuv422
  11400. force YUV422 output
  11401. @item yuv422p10
  11402. force YUV422p10 output
  11403. @item yuv444
  11404. force YUV444 output
  11405. @item rgb
  11406. force packed RGB output
  11407. @item gbrp
  11408. force planar RGB output
  11409. @item auto
  11410. automatically pick format
  11411. @end table
  11412. Default value is @samp{yuv420}.
  11413. @item repeatlast
  11414. See @ref{framesync}.
  11415. @item alpha
  11416. Set format of alpha of the overlaid video, it can be @var{straight} or
  11417. @var{premultiplied}. Default is @var{straight}.
  11418. @end table
  11419. The @option{x}, and @option{y} expressions can contain the following
  11420. parameters.
  11421. @table @option
  11422. @item main_w, W
  11423. @item main_h, H
  11424. The main input width and height.
  11425. @item overlay_w, w
  11426. @item overlay_h, h
  11427. The overlay input width and height.
  11428. @item x
  11429. @item y
  11430. The computed values for @var{x} and @var{y}. They are evaluated for
  11431. each new frame.
  11432. @item hsub
  11433. @item vsub
  11434. horizontal and vertical chroma subsample values of the output
  11435. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  11436. @var{vsub} is 1.
  11437. @item n
  11438. the number of input frame, starting from 0
  11439. @item pos
  11440. the position in the file of the input frame, NAN if unknown
  11441. @item t
  11442. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  11443. @end table
  11444. This filter also supports the @ref{framesync} options.
  11445. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  11446. when evaluation is done @emph{per frame}, and will evaluate to NAN
  11447. when @option{eval} is set to @samp{init}.
  11448. Be aware that frames are taken from each input video in timestamp
  11449. order, hence, if their initial timestamps differ, it is a good idea
  11450. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  11451. have them begin in the same zero timestamp, as the example for
  11452. the @var{movie} filter does.
  11453. You can chain together more overlays but you should test the
  11454. efficiency of such approach.
  11455. @subsection Commands
  11456. This filter supports the following commands:
  11457. @table @option
  11458. @item x
  11459. @item y
  11460. Modify the x and y of the overlay input.
  11461. The command accepts the same syntax of the corresponding option.
  11462. If the specified expression is not valid, it is kept at its current
  11463. value.
  11464. @end table
  11465. @subsection Examples
  11466. @itemize
  11467. @item
  11468. Draw the overlay at 10 pixels from the bottom right corner of the main
  11469. video:
  11470. @example
  11471. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  11472. @end example
  11473. Using named options the example above becomes:
  11474. @example
  11475. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  11476. @end example
  11477. @item
  11478. Insert a transparent PNG logo in the bottom left corner of the input,
  11479. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  11480. @example
  11481. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  11482. @end example
  11483. @item
  11484. Insert 2 different transparent PNG logos (second logo on bottom
  11485. right corner) using the @command{ffmpeg} tool:
  11486. @example
  11487. 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
  11488. @end example
  11489. @item
  11490. Add a transparent color layer on top of the main video; @code{WxH}
  11491. must specify the size of the main input to the overlay filter:
  11492. @example
  11493. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  11494. @end example
  11495. @item
  11496. Play an original video and a filtered version (here with the deshake
  11497. filter) side by side using the @command{ffplay} tool:
  11498. @example
  11499. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  11500. @end example
  11501. The above command is the same as:
  11502. @example
  11503. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  11504. @end example
  11505. @item
  11506. Make a sliding overlay appearing from the left to the right top part of the
  11507. screen starting since time 2:
  11508. @example
  11509. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  11510. @end example
  11511. @item
  11512. Compose output by putting two input videos side to side:
  11513. @example
  11514. ffmpeg -i left.avi -i right.avi -filter_complex "
  11515. nullsrc=size=200x100 [background];
  11516. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  11517. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  11518. [background][left] overlay=shortest=1 [background+left];
  11519. [background+left][right] overlay=shortest=1:x=100 [left+right]
  11520. "
  11521. @end example
  11522. @item
  11523. Mask 10-20 seconds of a video by applying the delogo filter to a section
  11524. @example
  11525. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  11526. -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]'
  11527. masked.avi
  11528. @end example
  11529. @item
  11530. Chain several overlays in cascade:
  11531. @example
  11532. nullsrc=s=200x200 [bg];
  11533. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  11534. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  11535. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  11536. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  11537. [in3] null, [mid2] overlay=100:100 [out0]
  11538. @end example
  11539. @end itemize
  11540. @anchor{overlay_cuda}
  11541. @section overlay_cuda
  11542. Overlay one video on top of another.
  11543. This is the CUDA variant of the @ref{overlay} filter.
  11544. It only accepts CUDA frames. The underlying input pixel formats have to match.
  11545. It takes two inputs and has one output. The first input is the "main"
  11546. video on which the second input is overlaid.
  11547. It accepts the following parameters:
  11548. @table @option
  11549. @item x
  11550. @item y
  11551. Set the x and y coordinates of the overlaid video on the main video.
  11552. Default value is "0" for both expressions.
  11553. @item eof_action
  11554. See @ref{framesync}.
  11555. @item shortest
  11556. See @ref{framesync}.
  11557. @item repeatlast
  11558. See @ref{framesync}.
  11559. @end table
  11560. This filter also supports the @ref{framesync} options.
  11561. @section owdenoise
  11562. Apply Overcomplete Wavelet denoiser.
  11563. The filter accepts the following options:
  11564. @table @option
  11565. @item depth
  11566. Set depth.
  11567. Larger depth values will denoise lower frequency components more, but
  11568. slow down filtering.
  11569. Must be an int in the range 8-16, default is @code{8}.
  11570. @item luma_strength, ls
  11571. Set luma strength.
  11572. Must be a double value in the range 0-1000, default is @code{1.0}.
  11573. @item chroma_strength, cs
  11574. Set chroma strength.
  11575. Must be a double value in the range 0-1000, default is @code{1.0}.
  11576. @end table
  11577. @anchor{pad}
  11578. @section pad
  11579. Add paddings to the input image, and place the original input at the
  11580. provided @var{x}, @var{y} coordinates.
  11581. It accepts the following parameters:
  11582. @table @option
  11583. @item width, w
  11584. @item height, h
  11585. Specify an expression for the size of the output image with the
  11586. paddings added. If the value for @var{width} or @var{height} is 0, the
  11587. corresponding input size is used for the output.
  11588. The @var{width} expression can reference the value set by the
  11589. @var{height} expression, and vice versa.
  11590. The default value of @var{width} and @var{height} is 0.
  11591. @item x
  11592. @item y
  11593. Specify the offsets to place the input image at within the padded area,
  11594. with respect to the top/left border of the output image.
  11595. The @var{x} expression can reference the value set by the @var{y}
  11596. expression, and vice versa.
  11597. The default value of @var{x} and @var{y} is 0.
  11598. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  11599. so the input image is centered on the padded area.
  11600. @item color
  11601. Specify the color of the padded area. For the syntax of this option,
  11602. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11603. manual,ffmpeg-utils}.
  11604. The default value of @var{color} is "black".
  11605. @item eval
  11606. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  11607. It accepts the following values:
  11608. @table @samp
  11609. @item init
  11610. Only evaluate expressions once during the filter initialization or when
  11611. a command is processed.
  11612. @item frame
  11613. Evaluate expressions for each incoming frame.
  11614. @end table
  11615. Default value is @samp{init}.
  11616. @item aspect
  11617. Pad to aspect instead to a resolution.
  11618. @end table
  11619. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  11620. options are expressions containing the following constants:
  11621. @table @option
  11622. @item in_w
  11623. @item in_h
  11624. The input video width and height.
  11625. @item iw
  11626. @item ih
  11627. These are the same as @var{in_w} and @var{in_h}.
  11628. @item out_w
  11629. @item out_h
  11630. The output width and height (the size of the padded area), as
  11631. specified by the @var{width} and @var{height} expressions.
  11632. @item ow
  11633. @item oh
  11634. These are the same as @var{out_w} and @var{out_h}.
  11635. @item x
  11636. @item y
  11637. The x and y offsets as specified by the @var{x} and @var{y}
  11638. expressions, or NAN if not yet specified.
  11639. @item a
  11640. same as @var{iw} / @var{ih}
  11641. @item sar
  11642. input sample aspect ratio
  11643. @item dar
  11644. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  11645. @item hsub
  11646. @item vsub
  11647. The horizontal and vertical chroma subsample values. For example for the
  11648. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11649. @end table
  11650. @subsection Examples
  11651. @itemize
  11652. @item
  11653. Add paddings with the color "violet" to the input video. The output video
  11654. size is 640x480, and the top-left corner of the input video is placed at
  11655. column 0, row 40
  11656. @example
  11657. pad=640:480:0:40:violet
  11658. @end example
  11659. The example above is equivalent to the following command:
  11660. @example
  11661. pad=width=640:height=480:x=0:y=40:color=violet
  11662. @end example
  11663. @item
  11664. Pad the input to get an output with dimensions increased by 3/2,
  11665. and put the input video at the center of the padded area:
  11666. @example
  11667. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  11668. @end example
  11669. @item
  11670. Pad the input to get a squared output with size equal to the maximum
  11671. value between the input width and height, and put the input video at
  11672. the center of the padded area:
  11673. @example
  11674. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  11675. @end example
  11676. @item
  11677. Pad the input to get a final w/h ratio of 16:9:
  11678. @example
  11679. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  11680. @end example
  11681. @item
  11682. In case of anamorphic video, in order to set the output display aspect
  11683. correctly, it is necessary to use @var{sar} in the expression,
  11684. according to the relation:
  11685. @example
  11686. (ih * X / ih) * sar = output_dar
  11687. X = output_dar / sar
  11688. @end example
  11689. Thus the previous example needs to be modified to:
  11690. @example
  11691. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  11692. @end example
  11693. @item
  11694. Double the output size and put the input video in the bottom-right
  11695. corner of the output padded area:
  11696. @example
  11697. pad="2*iw:2*ih:ow-iw:oh-ih"
  11698. @end example
  11699. @end itemize
  11700. @anchor{palettegen}
  11701. @section palettegen
  11702. Generate one palette for a whole video stream.
  11703. It accepts the following options:
  11704. @table @option
  11705. @item max_colors
  11706. Set the maximum number of colors to quantize in the palette.
  11707. Note: the palette will still contain 256 colors; the unused palette entries
  11708. will be black.
  11709. @item reserve_transparent
  11710. Create a palette of 255 colors maximum and reserve the last one for
  11711. transparency. Reserving the transparency color is useful for GIF optimization.
  11712. If not set, the maximum of colors in the palette will be 256. You probably want
  11713. to disable this option for a standalone image.
  11714. Set by default.
  11715. @item transparency_color
  11716. Set the color that will be used as background for transparency.
  11717. @item stats_mode
  11718. Set statistics mode.
  11719. It accepts the following values:
  11720. @table @samp
  11721. @item full
  11722. Compute full frame histograms.
  11723. @item diff
  11724. Compute histograms only for the part that differs from previous frame. This
  11725. might be relevant to give more importance to the moving part of your input if
  11726. the background is static.
  11727. @item single
  11728. Compute new histogram for each frame.
  11729. @end table
  11730. Default value is @var{full}.
  11731. @end table
  11732. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  11733. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  11734. color quantization of the palette. This information is also visible at
  11735. @var{info} logging level.
  11736. @subsection Examples
  11737. @itemize
  11738. @item
  11739. Generate a representative palette of a given video using @command{ffmpeg}:
  11740. @example
  11741. ffmpeg -i input.mkv -vf palettegen palette.png
  11742. @end example
  11743. @end itemize
  11744. @section paletteuse
  11745. Use a palette to downsample an input video stream.
  11746. The filter takes two inputs: one video stream and a palette. The palette must
  11747. be a 256 pixels image.
  11748. It accepts the following options:
  11749. @table @option
  11750. @item dither
  11751. Select dithering mode. Available algorithms are:
  11752. @table @samp
  11753. @item bayer
  11754. Ordered 8x8 bayer dithering (deterministic)
  11755. @item heckbert
  11756. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  11757. Note: this dithering is sometimes considered "wrong" and is included as a
  11758. reference.
  11759. @item floyd_steinberg
  11760. Floyd and Steingberg dithering (error diffusion)
  11761. @item sierra2
  11762. Frankie Sierra dithering v2 (error diffusion)
  11763. @item sierra2_4a
  11764. Frankie Sierra dithering v2 "Lite" (error diffusion)
  11765. @end table
  11766. Default is @var{sierra2_4a}.
  11767. @item bayer_scale
  11768. When @var{bayer} dithering is selected, this option defines the scale of the
  11769. pattern (how much the crosshatch pattern is visible). A low value means more
  11770. visible pattern for less banding, and higher value means less visible pattern
  11771. at the cost of more banding.
  11772. The option must be an integer value in the range [0,5]. Default is @var{2}.
  11773. @item diff_mode
  11774. If set, define the zone to process
  11775. @table @samp
  11776. @item rectangle
  11777. Only the changing rectangle will be reprocessed. This is similar to GIF
  11778. cropping/offsetting compression mechanism. This option can be useful for speed
  11779. if only a part of the image is changing, and has use cases such as limiting the
  11780. scope of the error diffusal @option{dither} to the rectangle that bounds the
  11781. moving scene (it leads to more deterministic output if the scene doesn't change
  11782. much, and as a result less moving noise and better GIF compression).
  11783. @end table
  11784. Default is @var{none}.
  11785. @item new
  11786. Take new palette for each output frame.
  11787. @item alpha_threshold
  11788. Sets the alpha threshold for transparency. Alpha values above this threshold
  11789. will be treated as completely opaque, and values below this threshold will be
  11790. treated as completely transparent.
  11791. The option must be an integer value in the range [0,255]. Default is @var{128}.
  11792. @end table
  11793. @subsection Examples
  11794. @itemize
  11795. @item
  11796. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  11797. using @command{ffmpeg}:
  11798. @example
  11799. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  11800. @end example
  11801. @end itemize
  11802. @section perspective
  11803. Correct perspective of video not recorded perpendicular to the screen.
  11804. A description of the accepted parameters follows.
  11805. @table @option
  11806. @item x0
  11807. @item y0
  11808. @item x1
  11809. @item y1
  11810. @item x2
  11811. @item y2
  11812. @item x3
  11813. @item y3
  11814. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  11815. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  11816. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  11817. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  11818. then the corners of the source will be sent to the specified coordinates.
  11819. The expressions can use the following variables:
  11820. @table @option
  11821. @item W
  11822. @item H
  11823. the width and height of video frame.
  11824. @item in
  11825. Input frame count.
  11826. @item on
  11827. Output frame count.
  11828. @end table
  11829. @item interpolation
  11830. Set interpolation for perspective correction.
  11831. It accepts the following values:
  11832. @table @samp
  11833. @item linear
  11834. @item cubic
  11835. @end table
  11836. Default value is @samp{linear}.
  11837. @item sense
  11838. Set interpretation of coordinate options.
  11839. It accepts the following values:
  11840. @table @samp
  11841. @item 0, source
  11842. Send point in the source specified by the given coordinates to
  11843. the corners of the destination.
  11844. @item 1, destination
  11845. Send the corners of the source to the point in the destination specified
  11846. by the given coordinates.
  11847. Default value is @samp{source}.
  11848. @end table
  11849. @item eval
  11850. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  11851. It accepts the following values:
  11852. @table @samp
  11853. @item init
  11854. only evaluate expressions once during the filter initialization or
  11855. when a command is processed
  11856. @item frame
  11857. evaluate expressions for each incoming frame
  11858. @end table
  11859. Default value is @samp{init}.
  11860. @end table
  11861. @section phase
  11862. Delay interlaced video by one field time so that the field order changes.
  11863. The intended use is to fix PAL movies that have been captured with the
  11864. opposite field order to the film-to-video transfer.
  11865. A description of the accepted parameters follows.
  11866. @table @option
  11867. @item mode
  11868. Set phase mode.
  11869. It accepts the following values:
  11870. @table @samp
  11871. @item t
  11872. Capture field order top-first, transfer bottom-first.
  11873. Filter will delay the bottom field.
  11874. @item b
  11875. Capture field order bottom-first, transfer top-first.
  11876. Filter will delay the top field.
  11877. @item p
  11878. Capture and transfer with the same field order. This mode only exists
  11879. for the documentation of the other options to refer to, but if you
  11880. actually select it, the filter will faithfully do nothing.
  11881. @item a
  11882. Capture field order determined automatically by field flags, transfer
  11883. opposite.
  11884. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  11885. basis using field flags. If no field information is available,
  11886. then this works just like @samp{u}.
  11887. @item u
  11888. Capture unknown or varying, transfer opposite.
  11889. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  11890. analyzing the images and selecting the alternative that produces best
  11891. match between the fields.
  11892. @item T
  11893. Capture top-first, transfer unknown or varying.
  11894. Filter selects among @samp{t} and @samp{p} using image analysis.
  11895. @item B
  11896. Capture bottom-first, transfer unknown or varying.
  11897. Filter selects among @samp{b} and @samp{p} using image analysis.
  11898. @item A
  11899. Capture determined by field flags, transfer unknown or varying.
  11900. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  11901. image analysis. If no field information is available, then this works just
  11902. like @samp{U}. This is the default mode.
  11903. @item U
  11904. Both capture and transfer unknown or varying.
  11905. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  11906. @end table
  11907. @end table
  11908. @section photosensitivity
  11909. Reduce various flashes in video, so to help users with epilepsy.
  11910. It accepts the following options:
  11911. @table @option
  11912. @item frames, f
  11913. Set how many frames to use when filtering. Default is 30.
  11914. @item threshold, t
  11915. Set detection threshold factor. Default is 1.
  11916. Lower is stricter.
  11917. @item skip
  11918. Set how many pixels to skip when sampling frames. Default is 1.
  11919. Allowed range is from 1 to 1024.
  11920. @item bypass
  11921. Leave frames unchanged. Default is disabled.
  11922. @end table
  11923. @section pixdesctest
  11924. Pixel format descriptor test filter, mainly useful for internal
  11925. testing. The output video should be equal to the input video.
  11926. For example:
  11927. @example
  11928. format=monow, pixdesctest
  11929. @end example
  11930. can be used to test the monowhite pixel format descriptor definition.
  11931. @section pixscope
  11932. Display sample values of color channels. Mainly useful for checking color
  11933. and levels. Minimum supported resolution is 640x480.
  11934. The filters accept the following options:
  11935. @table @option
  11936. @item x
  11937. Set scope X position, relative offset on X axis.
  11938. @item y
  11939. Set scope Y position, relative offset on Y axis.
  11940. @item w
  11941. Set scope width.
  11942. @item h
  11943. Set scope height.
  11944. @item o
  11945. Set window opacity. This window also holds statistics about pixel area.
  11946. @item wx
  11947. Set window X position, relative offset on X axis.
  11948. @item wy
  11949. Set window Y position, relative offset on Y axis.
  11950. @end table
  11951. @section pp
  11952. Enable the specified chain of postprocessing subfilters using libpostproc. This
  11953. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  11954. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  11955. Each subfilter and some options have a short and a long name that can be used
  11956. interchangeably, i.e. dr/dering are the same.
  11957. The filters accept the following options:
  11958. @table @option
  11959. @item subfilters
  11960. Set postprocessing subfilters string.
  11961. @end table
  11962. All subfilters share common options to determine their scope:
  11963. @table @option
  11964. @item a/autoq
  11965. Honor the quality commands for this subfilter.
  11966. @item c/chrom
  11967. Do chrominance filtering, too (default).
  11968. @item y/nochrom
  11969. Do luminance filtering only (no chrominance).
  11970. @item n/noluma
  11971. Do chrominance filtering only (no luminance).
  11972. @end table
  11973. These options can be appended after the subfilter name, separated by a '|'.
  11974. Available subfilters are:
  11975. @table @option
  11976. @item hb/hdeblock[|difference[|flatness]]
  11977. Horizontal deblocking filter
  11978. @table @option
  11979. @item difference
  11980. Difference factor where higher values mean more deblocking (default: @code{32}).
  11981. @item flatness
  11982. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11983. @end table
  11984. @item vb/vdeblock[|difference[|flatness]]
  11985. Vertical deblocking filter
  11986. @table @option
  11987. @item difference
  11988. Difference factor where higher values mean more deblocking (default: @code{32}).
  11989. @item flatness
  11990. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11991. @end table
  11992. @item ha/hadeblock[|difference[|flatness]]
  11993. Accurate horizontal deblocking filter
  11994. @table @option
  11995. @item difference
  11996. Difference factor where higher values mean more deblocking (default: @code{32}).
  11997. @item flatness
  11998. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  11999. @end table
  12000. @item va/vadeblock[|difference[|flatness]]
  12001. Accurate vertical deblocking filter
  12002. @table @option
  12003. @item difference
  12004. Difference factor where higher values mean more deblocking (default: @code{32}).
  12005. @item flatness
  12006. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  12007. @end table
  12008. @end table
  12009. The horizontal and vertical deblocking filters share the difference and
  12010. flatness values so you cannot set different horizontal and vertical
  12011. thresholds.
  12012. @table @option
  12013. @item h1/x1hdeblock
  12014. Experimental horizontal deblocking filter
  12015. @item v1/x1vdeblock
  12016. Experimental vertical deblocking filter
  12017. @item dr/dering
  12018. Deringing filter
  12019. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  12020. @table @option
  12021. @item threshold1
  12022. larger -> stronger filtering
  12023. @item threshold2
  12024. larger -> stronger filtering
  12025. @item threshold3
  12026. larger -> stronger filtering
  12027. @end table
  12028. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  12029. @table @option
  12030. @item f/fullyrange
  12031. Stretch luminance to @code{0-255}.
  12032. @end table
  12033. @item lb/linblenddeint
  12034. Linear blend deinterlacing filter that deinterlaces the given block by
  12035. filtering all lines with a @code{(1 2 1)} filter.
  12036. @item li/linipoldeint
  12037. Linear interpolating deinterlacing filter that deinterlaces the given block by
  12038. linearly interpolating every second line.
  12039. @item ci/cubicipoldeint
  12040. Cubic interpolating deinterlacing filter deinterlaces the given block by
  12041. cubically interpolating every second line.
  12042. @item md/mediandeint
  12043. Median deinterlacing filter that deinterlaces the given block by applying a
  12044. median filter to every second line.
  12045. @item fd/ffmpegdeint
  12046. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  12047. second line with a @code{(-1 4 2 4 -1)} filter.
  12048. @item l5/lowpass5
  12049. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  12050. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  12051. @item fq/forceQuant[|quantizer]
  12052. Overrides the quantizer table from the input with the constant quantizer you
  12053. specify.
  12054. @table @option
  12055. @item quantizer
  12056. Quantizer to use
  12057. @end table
  12058. @item de/default
  12059. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  12060. @item fa/fast
  12061. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  12062. @item ac
  12063. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  12064. @end table
  12065. @subsection Examples
  12066. @itemize
  12067. @item
  12068. Apply horizontal and vertical deblocking, deringing and automatic
  12069. brightness/contrast:
  12070. @example
  12071. pp=hb/vb/dr/al
  12072. @end example
  12073. @item
  12074. Apply default filters without brightness/contrast correction:
  12075. @example
  12076. pp=de/-al
  12077. @end example
  12078. @item
  12079. Apply default filters and temporal denoiser:
  12080. @example
  12081. pp=default/tmpnoise|1|2|3
  12082. @end example
  12083. @item
  12084. Apply deblocking on luminance only, and switch vertical deblocking on or off
  12085. automatically depending on available CPU time:
  12086. @example
  12087. pp=hb|y/vb|a
  12088. @end example
  12089. @end itemize
  12090. @section pp7
  12091. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  12092. similar to spp = 6 with 7 point DCT, where only the center sample is
  12093. used after IDCT.
  12094. The filter accepts the following options:
  12095. @table @option
  12096. @item qp
  12097. Force a constant quantization parameter. It accepts an integer in range
  12098. 0 to 63. If not set, the filter will use the QP from the video stream
  12099. (if available).
  12100. @item mode
  12101. Set thresholding mode. Available modes are:
  12102. @table @samp
  12103. @item hard
  12104. Set hard thresholding.
  12105. @item soft
  12106. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12107. @item medium
  12108. Set medium thresholding (good results, default).
  12109. @end table
  12110. @end table
  12111. @section premultiply
  12112. Apply alpha premultiply effect to input video stream using first plane
  12113. of second stream as alpha.
  12114. Both streams must have same dimensions and same pixel format.
  12115. The filter accepts the following option:
  12116. @table @option
  12117. @item planes
  12118. Set which planes will be processed, unprocessed planes will be copied.
  12119. By default value 0xf, all planes will be processed.
  12120. @item inplace
  12121. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12122. @end table
  12123. @section prewitt
  12124. Apply prewitt operator to input video stream.
  12125. The filter accepts the following option:
  12126. @table @option
  12127. @item planes
  12128. Set which planes will be processed, unprocessed planes will be copied.
  12129. By default value 0xf, all planes will be processed.
  12130. @item scale
  12131. Set value which will be multiplied with filtered result.
  12132. @item delta
  12133. Set value which will be added to filtered result.
  12134. @end table
  12135. @section pseudocolor
  12136. Alter frame colors in video with pseudocolors.
  12137. This filter accepts the following options:
  12138. @table @option
  12139. @item c0
  12140. set pixel first component expression
  12141. @item c1
  12142. set pixel second component expression
  12143. @item c2
  12144. set pixel third component expression
  12145. @item c3
  12146. set pixel fourth component expression, corresponds to the alpha component
  12147. @item i
  12148. set component to use as base for altering colors
  12149. @end table
  12150. Each of them specifies the expression to use for computing the lookup table for
  12151. the corresponding pixel component values.
  12152. The expressions can contain the following constants and functions:
  12153. @table @option
  12154. @item w
  12155. @item h
  12156. The input width and height.
  12157. @item val
  12158. The input value for the pixel component.
  12159. @item ymin, umin, vmin, amin
  12160. The minimum allowed component value.
  12161. @item ymax, umax, vmax, amax
  12162. The maximum allowed component value.
  12163. @end table
  12164. All expressions default to "val".
  12165. @subsection Examples
  12166. @itemize
  12167. @item
  12168. Change too high luma values to gradient:
  12169. @example
  12170. 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'"
  12171. @end example
  12172. @end itemize
  12173. @section psnr
  12174. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  12175. Ratio) between two input videos.
  12176. This filter takes in input two input videos, the first input is
  12177. considered the "main" source and is passed unchanged to the
  12178. output. The second input is used as a "reference" video for computing
  12179. the PSNR.
  12180. Both video inputs must have the same resolution and pixel format for
  12181. this filter to work correctly. Also it assumes that both inputs
  12182. have the same number of frames, which are compared one by one.
  12183. The obtained average PSNR is printed through the logging system.
  12184. The filter stores the accumulated MSE (mean squared error) of each
  12185. frame, and at the end of the processing it is averaged across all frames
  12186. equally, and the following formula is applied to obtain the PSNR:
  12187. @example
  12188. PSNR = 10*log10(MAX^2/MSE)
  12189. @end example
  12190. Where MAX is the average of the maximum values of each component of the
  12191. image.
  12192. The description of the accepted parameters follows.
  12193. @table @option
  12194. @item stats_file, f
  12195. If specified the filter will use the named file to save the PSNR of
  12196. each individual frame. When filename equals "-" the data is sent to
  12197. standard output.
  12198. @item stats_version
  12199. Specifies which version of the stats file format to use. Details of
  12200. each format are written below.
  12201. Default value is 1.
  12202. @item stats_add_max
  12203. Determines whether the max value is output to the stats log.
  12204. Default value is 0.
  12205. Requires stats_version >= 2. If this is set and stats_version < 2,
  12206. the filter will return an error.
  12207. @end table
  12208. This filter also supports the @ref{framesync} options.
  12209. The file printed if @var{stats_file} is selected, contains a sequence of
  12210. key/value pairs of the form @var{key}:@var{value} for each compared
  12211. couple of frames.
  12212. If a @var{stats_version} greater than 1 is specified, a header line precedes
  12213. the list of per-frame-pair stats, with key value pairs following the frame
  12214. format with the following parameters:
  12215. @table @option
  12216. @item psnr_log_version
  12217. The version of the log file format. Will match @var{stats_version}.
  12218. @item fields
  12219. A comma separated list of the per-frame-pair parameters included in
  12220. the log.
  12221. @end table
  12222. A description of each shown per-frame-pair parameter follows:
  12223. @table @option
  12224. @item n
  12225. sequential number of the input frame, starting from 1
  12226. @item mse_avg
  12227. Mean Square Error pixel-by-pixel average difference of the compared
  12228. frames, averaged over all the image components.
  12229. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  12230. Mean Square Error pixel-by-pixel average difference of the compared
  12231. frames for the component specified by the suffix.
  12232. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  12233. Peak Signal to Noise ratio of the compared frames for the component
  12234. specified by the suffix.
  12235. @item max_avg, max_y, max_u, max_v
  12236. Maximum allowed value for each channel, and average over all
  12237. channels.
  12238. @end table
  12239. @subsection Examples
  12240. @itemize
  12241. @item
  12242. For example:
  12243. @example
  12244. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12245. [main][ref] psnr="stats_file=stats.log" [out]
  12246. @end example
  12247. On this example the input file being processed is compared with the
  12248. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  12249. is stored in @file{stats.log}.
  12250. @item
  12251. Another example with different containers:
  12252. @example
  12253. 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 -
  12254. @end example
  12255. @end itemize
  12256. @anchor{pullup}
  12257. @section pullup
  12258. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  12259. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  12260. content.
  12261. The pullup filter is designed to take advantage of future context in making
  12262. its decisions. This filter is stateless in the sense that it does not lock
  12263. onto a pattern to follow, but it instead looks forward to the following
  12264. fields in order to identify matches and rebuild progressive frames.
  12265. To produce content with an even framerate, insert the fps filter after
  12266. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  12267. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  12268. The filter accepts the following options:
  12269. @table @option
  12270. @item jl
  12271. @item jr
  12272. @item jt
  12273. @item jb
  12274. These options set the amount of "junk" to ignore at the left, right, top, and
  12275. bottom of the image, respectively. Left and right are in units of 8 pixels,
  12276. while top and bottom are in units of 2 lines.
  12277. The default is 8 pixels on each side.
  12278. @item sb
  12279. Set the strict breaks. Setting this option to 1 will reduce the chances of
  12280. filter generating an occasional mismatched frame, but it may also cause an
  12281. excessive number of frames to be dropped during high motion sequences.
  12282. Conversely, setting it to -1 will make filter match fields more easily.
  12283. This may help processing of video where there is slight blurring between
  12284. the fields, but may also cause there to be interlaced frames in the output.
  12285. Default value is @code{0}.
  12286. @item mp
  12287. Set the metric plane to use. It accepts the following values:
  12288. @table @samp
  12289. @item l
  12290. Use luma plane.
  12291. @item u
  12292. Use chroma blue plane.
  12293. @item v
  12294. Use chroma red plane.
  12295. @end table
  12296. This option may be set to use chroma plane instead of the default luma plane
  12297. for doing filter's computations. This may improve accuracy on very clean
  12298. source material, but more likely will decrease accuracy, especially if there
  12299. is chroma noise (rainbow effect) or any grayscale video.
  12300. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  12301. load and make pullup usable in realtime on slow machines.
  12302. @end table
  12303. For best results (without duplicated frames in the output file) it is
  12304. necessary to change the output frame rate. For example, to inverse
  12305. telecine NTSC input:
  12306. @example
  12307. ffmpeg -i input -vf pullup -r 24000/1001 ...
  12308. @end example
  12309. @section qp
  12310. Change video quantization parameters (QP).
  12311. The filter accepts the following option:
  12312. @table @option
  12313. @item qp
  12314. Set expression for quantization parameter.
  12315. @end table
  12316. The expression is evaluated through the eval API and can contain, among others,
  12317. the following constants:
  12318. @table @var
  12319. @item known
  12320. 1 if index is not 129, 0 otherwise.
  12321. @item qp
  12322. Sequential index starting from -129 to 128.
  12323. @end table
  12324. @subsection Examples
  12325. @itemize
  12326. @item
  12327. Some equation like:
  12328. @example
  12329. qp=2+2*sin(PI*qp)
  12330. @end example
  12331. @end itemize
  12332. @section random
  12333. Flush video frames from internal cache of frames into a random order.
  12334. No frame is discarded.
  12335. Inspired by @ref{frei0r} nervous filter.
  12336. @table @option
  12337. @item frames
  12338. Set size in number of frames of internal cache, in range from @code{2} to
  12339. @code{512}. Default is @code{30}.
  12340. @item seed
  12341. Set seed for random number generator, must be an integer included between
  12342. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12343. less than @code{0}, the filter will try to use a good random seed on a
  12344. best effort basis.
  12345. @end table
  12346. @section readeia608
  12347. Read closed captioning (EIA-608) information from the top lines of a video frame.
  12348. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  12349. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  12350. with EIA-608 data (starting from 0). A description of each metadata value follows:
  12351. @table @option
  12352. @item lavfi.readeia608.X.cc
  12353. The two bytes stored as EIA-608 data (printed in hexadecimal).
  12354. @item lavfi.readeia608.X.line
  12355. The number of the line on which the EIA-608 data was identified and read.
  12356. @end table
  12357. This filter accepts the following options:
  12358. @table @option
  12359. @item scan_min
  12360. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  12361. @item scan_max
  12362. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  12363. @item spw
  12364. Set the ratio of width reserved for sync code detection.
  12365. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  12366. @item chp
  12367. Enable checking the parity bit. In the event of a parity error, the filter will output
  12368. @code{0x00} for that character. Default is false.
  12369. @item lp
  12370. Lowpass lines prior to further processing. Default is enabled.
  12371. @end table
  12372. @subsection Commands
  12373. This filter supports the all above options as @ref{commands}.
  12374. @subsection Examples
  12375. @itemize
  12376. @item
  12377. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  12378. @example
  12379. 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
  12380. @end example
  12381. @end itemize
  12382. @section readvitc
  12383. Read vertical interval timecode (VITC) information from the top lines of a
  12384. video frame.
  12385. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  12386. timecode value, if a valid timecode has been detected. Further metadata key
  12387. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  12388. timecode data has been found or not.
  12389. This filter accepts the following options:
  12390. @table @option
  12391. @item scan_max
  12392. Set the maximum number of lines to scan for VITC data. If the value is set to
  12393. @code{-1} the full video frame is scanned. Default is @code{45}.
  12394. @item thr_b
  12395. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  12396. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  12397. @item thr_w
  12398. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  12399. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  12400. @end table
  12401. @subsection Examples
  12402. @itemize
  12403. @item
  12404. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  12405. draw @code{--:--:--:--} as a placeholder:
  12406. @example
  12407. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  12408. @end example
  12409. @end itemize
  12410. @section remap
  12411. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  12412. Destination pixel at position (X, Y) will be picked from source (x, y) position
  12413. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  12414. value for pixel will be used for destination pixel.
  12415. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  12416. will have Xmap/Ymap video stream dimensions.
  12417. Xmap and Ymap input video streams are 16bit depth, single channel.
  12418. @table @option
  12419. @item format
  12420. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  12421. Default is @code{color}.
  12422. @item fill
  12423. Specify the color of the unmapped pixels. For the syntax of this option,
  12424. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12425. manual,ffmpeg-utils}. Default color is @code{black}.
  12426. @end table
  12427. @section removegrain
  12428. The removegrain filter is a spatial denoiser for progressive video.
  12429. @table @option
  12430. @item m0
  12431. Set mode for the first plane.
  12432. @item m1
  12433. Set mode for the second plane.
  12434. @item m2
  12435. Set mode for the third plane.
  12436. @item m3
  12437. Set mode for the fourth plane.
  12438. @end table
  12439. Range of mode is from 0 to 24. Description of each mode follows:
  12440. @table @var
  12441. @item 0
  12442. Leave input plane unchanged. Default.
  12443. @item 1
  12444. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  12445. @item 2
  12446. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  12447. @item 3
  12448. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  12449. @item 4
  12450. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  12451. This is equivalent to a median filter.
  12452. @item 5
  12453. Line-sensitive clipping giving the minimal change.
  12454. @item 6
  12455. Line-sensitive clipping, intermediate.
  12456. @item 7
  12457. Line-sensitive clipping, intermediate.
  12458. @item 8
  12459. Line-sensitive clipping, intermediate.
  12460. @item 9
  12461. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  12462. @item 10
  12463. Replaces the target pixel with the closest neighbour.
  12464. @item 11
  12465. [1 2 1] horizontal and vertical kernel blur.
  12466. @item 12
  12467. Same as mode 11.
  12468. @item 13
  12469. Bob mode, interpolates top field from the line where the neighbours
  12470. pixels are the closest.
  12471. @item 14
  12472. Bob mode, interpolates bottom field from the line where the neighbours
  12473. pixels are the closest.
  12474. @item 15
  12475. Bob mode, interpolates top field. Same as 13 but with a more complicated
  12476. interpolation formula.
  12477. @item 16
  12478. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  12479. interpolation formula.
  12480. @item 17
  12481. Clips the pixel with the minimum and maximum of respectively the maximum and
  12482. minimum of each pair of opposite neighbour pixels.
  12483. @item 18
  12484. Line-sensitive clipping using opposite neighbours whose greatest distance from
  12485. the current pixel is minimal.
  12486. @item 19
  12487. Replaces the pixel with the average of its 8 neighbours.
  12488. @item 20
  12489. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  12490. @item 21
  12491. Clips pixels using the averages of opposite neighbour.
  12492. @item 22
  12493. Same as mode 21 but simpler and faster.
  12494. @item 23
  12495. Small edge and halo removal, but reputed useless.
  12496. @item 24
  12497. Similar as 23.
  12498. @end table
  12499. @section removelogo
  12500. Suppress a TV station logo, using an image file to determine which
  12501. pixels comprise the logo. It works by filling in the pixels that
  12502. comprise the logo with neighboring pixels.
  12503. The filter accepts the following options:
  12504. @table @option
  12505. @item filename, f
  12506. Set the filter bitmap file, which can be any image format supported by
  12507. libavformat. The width and height of the image file must match those of the
  12508. video stream being processed.
  12509. @end table
  12510. Pixels in the provided bitmap image with a value of zero are not
  12511. considered part of the logo, non-zero pixels are considered part of
  12512. the logo. If you use white (255) for the logo and black (0) for the
  12513. rest, you will be safe. For making the filter bitmap, it is
  12514. recommended to take a screen capture of a black frame with the logo
  12515. visible, and then using a threshold filter followed by the erode
  12516. filter once or twice.
  12517. If needed, little splotches can be fixed manually. Remember that if
  12518. logo pixels are not covered, the filter quality will be much
  12519. reduced. Marking too many pixels as part of the logo does not hurt as
  12520. much, but it will increase the amount of blurring needed to cover over
  12521. the image and will destroy more information than necessary, and extra
  12522. pixels will slow things down on a large logo.
  12523. @section repeatfields
  12524. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  12525. fields based on its value.
  12526. @section reverse
  12527. Reverse a video clip.
  12528. Warning: This filter requires memory to buffer the entire clip, so trimming
  12529. is suggested.
  12530. @subsection Examples
  12531. @itemize
  12532. @item
  12533. Take the first 5 seconds of a clip, and reverse it.
  12534. @example
  12535. trim=end=5,reverse
  12536. @end example
  12537. @end itemize
  12538. @section rgbashift
  12539. Shift R/G/B/A pixels horizontally and/or vertically.
  12540. The filter accepts the following options:
  12541. @table @option
  12542. @item rh
  12543. Set amount to shift red horizontally.
  12544. @item rv
  12545. Set amount to shift red vertically.
  12546. @item gh
  12547. Set amount to shift green horizontally.
  12548. @item gv
  12549. Set amount to shift green vertically.
  12550. @item bh
  12551. Set amount to shift blue horizontally.
  12552. @item bv
  12553. Set amount to shift blue vertically.
  12554. @item ah
  12555. Set amount to shift alpha horizontally.
  12556. @item av
  12557. Set amount to shift alpha vertically.
  12558. @item edge
  12559. Set edge mode, can be @var{smear}, default, or @var{warp}.
  12560. @end table
  12561. @subsection Commands
  12562. This filter supports the all above options as @ref{commands}.
  12563. @section roberts
  12564. Apply roberts cross operator to input video stream.
  12565. The filter accepts the following option:
  12566. @table @option
  12567. @item planes
  12568. Set which planes will be processed, unprocessed planes will be copied.
  12569. By default value 0xf, all planes will be processed.
  12570. @item scale
  12571. Set value which will be multiplied with filtered result.
  12572. @item delta
  12573. Set value which will be added to filtered result.
  12574. @end table
  12575. @section rotate
  12576. Rotate video by an arbitrary angle expressed in radians.
  12577. The filter accepts the following options:
  12578. A description of the optional parameters follows.
  12579. @table @option
  12580. @item angle, a
  12581. Set an expression for the angle by which to rotate the input video
  12582. clockwise, expressed as a number of radians. A negative value will
  12583. result in a counter-clockwise rotation. By default it is set to "0".
  12584. This expression is evaluated for each frame.
  12585. @item out_w, ow
  12586. Set the output width expression, default value is "iw".
  12587. This expression is evaluated just once during configuration.
  12588. @item out_h, oh
  12589. Set the output height expression, default value is "ih".
  12590. This expression is evaluated just once during configuration.
  12591. @item bilinear
  12592. Enable bilinear interpolation if set to 1, a value of 0 disables
  12593. it. Default value is 1.
  12594. @item fillcolor, c
  12595. Set the color used to fill the output area not covered by the rotated
  12596. image. For the general syntax of this option, check the
  12597. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12598. If the special value "none" is selected then no
  12599. background is printed (useful for example if the background is never shown).
  12600. Default value is "black".
  12601. @end table
  12602. The expressions for the angle and the output size can contain the
  12603. following constants and functions:
  12604. @table @option
  12605. @item n
  12606. sequential number of the input frame, starting from 0. It is always NAN
  12607. before the first frame is filtered.
  12608. @item t
  12609. time in seconds of the input frame, it is set to 0 when the filter is
  12610. configured. It is always NAN before the first frame is filtered.
  12611. @item hsub
  12612. @item vsub
  12613. horizontal and vertical chroma subsample values. For example for the
  12614. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12615. @item in_w, iw
  12616. @item in_h, ih
  12617. the input video width and height
  12618. @item out_w, ow
  12619. @item out_h, oh
  12620. the output width and height, that is the size of the padded area as
  12621. specified by the @var{width} and @var{height} expressions
  12622. @item rotw(a)
  12623. @item roth(a)
  12624. the minimal width/height required for completely containing the input
  12625. video rotated by @var{a} radians.
  12626. These are only available when computing the @option{out_w} and
  12627. @option{out_h} expressions.
  12628. @end table
  12629. @subsection Examples
  12630. @itemize
  12631. @item
  12632. Rotate the input by PI/6 radians clockwise:
  12633. @example
  12634. rotate=PI/6
  12635. @end example
  12636. @item
  12637. Rotate the input by PI/6 radians counter-clockwise:
  12638. @example
  12639. rotate=-PI/6
  12640. @end example
  12641. @item
  12642. Rotate the input by 45 degrees clockwise:
  12643. @example
  12644. rotate=45*PI/180
  12645. @end example
  12646. @item
  12647. Apply a constant rotation with period T, starting from an angle of PI/3:
  12648. @example
  12649. rotate=PI/3+2*PI*t/T
  12650. @end example
  12651. @item
  12652. Make the input video rotation oscillating with a period of T
  12653. seconds and an amplitude of A radians:
  12654. @example
  12655. rotate=A*sin(2*PI/T*t)
  12656. @end example
  12657. @item
  12658. Rotate the video, output size is chosen so that the whole rotating
  12659. input video is always completely contained in the output:
  12660. @example
  12661. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  12662. @end example
  12663. @item
  12664. Rotate the video, reduce the output size so that no background is ever
  12665. shown:
  12666. @example
  12667. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  12668. @end example
  12669. @end itemize
  12670. @subsection Commands
  12671. The filter supports the following commands:
  12672. @table @option
  12673. @item a, angle
  12674. Set the angle expression.
  12675. The command accepts the same syntax of the corresponding option.
  12676. If the specified expression is not valid, it is kept at its current
  12677. value.
  12678. @end table
  12679. @section sab
  12680. Apply Shape Adaptive Blur.
  12681. The filter accepts the following options:
  12682. @table @option
  12683. @item luma_radius, lr
  12684. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  12685. value is 1.0. A greater value will result in a more blurred image, and
  12686. in slower processing.
  12687. @item luma_pre_filter_radius, lpfr
  12688. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  12689. value is 1.0.
  12690. @item luma_strength, ls
  12691. Set luma maximum difference between pixels to still be considered, must
  12692. be a value in the 0.1-100.0 range, default value is 1.0.
  12693. @item chroma_radius, cr
  12694. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  12695. greater value will result in a more blurred image, and in slower
  12696. processing.
  12697. @item chroma_pre_filter_radius, cpfr
  12698. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  12699. @item chroma_strength, cs
  12700. Set chroma maximum difference between pixels to still be considered,
  12701. must be a value in the -0.9-100.0 range.
  12702. @end table
  12703. Each chroma option value, if not explicitly specified, is set to the
  12704. corresponding luma option value.
  12705. @anchor{scale}
  12706. @section scale
  12707. Scale (resize) the input video, using the libswscale library.
  12708. The scale filter forces the output display aspect ratio to be the same
  12709. of the input, by changing the output sample aspect ratio.
  12710. If the input image format is different from the format requested by
  12711. the next filter, the scale filter will convert the input to the
  12712. requested format.
  12713. @subsection Options
  12714. The filter accepts the following options, or any of the options
  12715. supported by the libswscale scaler.
  12716. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  12717. the complete list of scaler options.
  12718. @table @option
  12719. @item width, w
  12720. @item height, h
  12721. Set the output video dimension expression. Default value is the input
  12722. dimension.
  12723. If the @var{width} or @var{w} value is 0, the input width is used for
  12724. the output. If the @var{height} or @var{h} value is 0, the input height
  12725. is used for the output.
  12726. If one and only one of the values is -n with n >= 1, the scale filter
  12727. will use a value that maintains the aspect ratio of the input image,
  12728. calculated from the other specified dimension. After that it will,
  12729. however, make sure that the calculated dimension is divisible by n and
  12730. adjust the value if necessary.
  12731. If both values are -n with n >= 1, the behavior will be identical to
  12732. both values being set to 0 as previously detailed.
  12733. See below for the list of accepted constants for use in the dimension
  12734. expression.
  12735. @item eval
  12736. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  12737. @table @samp
  12738. @item init
  12739. Only evaluate expressions once during the filter initialization or when a command is processed.
  12740. @item frame
  12741. Evaluate expressions for each incoming frame.
  12742. @end table
  12743. Default value is @samp{init}.
  12744. @item interl
  12745. Set the interlacing mode. It accepts the following values:
  12746. @table @samp
  12747. @item 1
  12748. Force interlaced aware scaling.
  12749. @item 0
  12750. Do not apply interlaced scaling.
  12751. @item -1
  12752. Select interlaced aware scaling depending on whether the source frames
  12753. are flagged as interlaced or not.
  12754. @end table
  12755. Default value is @samp{0}.
  12756. @item flags
  12757. Set libswscale scaling flags. See
  12758. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12759. complete list of values. If not explicitly specified the filter applies
  12760. the default flags.
  12761. @item param0, param1
  12762. Set libswscale input parameters for scaling algorithms that need them. See
  12763. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  12764. complete documentation. If not explicitly specified the filter applies
  12765. empty parameters.
  12766. @item size, s
  12767. Set the video size. For the syntax of this option, check the
  12768. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12769. @item in_color_matrix
  12770. @item out_color_matrix
  12771. Set in/output YCbCr color space type.
  12772. This allows the autodetected value to be overridden as well as allows forcing
  12773. a specific value used for the output and encoder.
  12774. If not specified, the color space type depends on the pixel format.
  12775. Possible values:
  12776. @table @samp
  12777. @item auto
  12778. Choose automatically.
  12779. @item bt709
  12780. Format conforming to International Telecommunication Union (ITU)
  12781. Recommendation BT.709.
  12782. @item fcc
  12783. Set color space conforming to the United States Federal Communications
  12784. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  12785. @item bt601
  12786. @item bt470
  12787. @item smpte170m
  12788. Set color space conforming to:
  12789. @itemize
  12790. @item
  12791. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  12792. @item
  12793. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  12794. @item
  12795. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  12796. @end itemize
  12797. @item smpte240m
  12798. Set color space conforming to SMPTE ST 240:1999.
  12799. @item bt2020
  12800. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  12801. @end table
  12802. @item in_range
  12803. @item out_range
  12804. Set in/output YCbCr sample range.
  12805. This allows the autodetected value to be overridden as well as allows forcing
  12806. a specific value used for the output and encoder. If not specified, the
  12807. range depends on the pixel format. Possible values:
  12808. @table @samp
  12809. @item auto/unknown
  12810. Choose automatically.
  12811. @item jpeg/full/pc
  12812. Set full range (0-255 in case of 8-bit luma).
  12813. @item mpeg/limited/tv
  12814. Set "MPEG" range (16-235 in case of 8-bit luma).
  12815. @end table
  12816. @item force_original_aspect_ratio
  12817. Enable decreasing or increasing output video width or height if necessary to
  12818. keep the original aspect ratio. Possible values:
  12819. @table @samp
  12820. @item disable
  12821. Scale the video as specified and disable this feature.
  12822. @item decrease
  12823. The output video dimensions will automatically be decreased if needed.
  12824. @item increase
  12825. The output video dimensions will automatically be increased if needed.
  12826. @end table
  12827. One useful instance of this option is that when you know a specific device's
  12828. maximum allowed resolution, you can use this to limit the output video to
  12829. that, while retaining the aspect ratio. For example, device A allows
  12830. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  12831. decrease) and specifying 1280x720 to the command line makes the output
  12832. 1280x533.
  12833. Please note that this is a different thing than specifying -1 for @option{w}
  12834. or @option{h}, you still need to specify the output resolution for this option
  12835. to work.
  12836. @item force_divisible_by
  12837. Ensures that both the output dimensions, width and height, are divisible by the
  12838. given integer when used together with @option{force_original_aspect_ratio}. This
  12839. works similar to using @code{-n} in the @option{w} and @option{h} options.
  12840. This option respects the value set for @option{force_original_aspect_ratio},
  12841. increasing or decreasing the resolution accordingly. The video's aspect ratio
  12842. may be slightly modified.
  12843. This option can be handy if you need to have a video fit within or exceed
  12844. a defined resolution using @option{force_original_aspect_ratio} but also have
  12845. encoder restrictions on width or height divisibility.
  12846. @end table
  12847. The values of the @option{w} and @option{h} options are expressions
  12848. containing the following constants:
  12849. @table @var
  12850. @item in_w
  12851. @item in_h
  12852. The input width and height
  12853. @item iw
  12854. @item ih
  12855. These are the same as @var{in_w} and @var{in_h}.
  12856. @item out_w
  12857. @item out_h
  12858. The output (scaled) width and height
  12859. @item ow
  12860. @item oh
  12861. These are the same as @var{out_w} and @var{out_h}
  12862. @item a
  12863. The same as @var{iw} / @var{ih}
  12864. @item sar
  12865. input sample aspect ratio
  12866. @item dar
  12867. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12868. @item hsub
  12869. @item vsub
  12870. horizontal and vertical input chroma subsample values. For example for the
  12871. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12872. @item ohsub
  12873. @item ovsub
  12874. horizontal and vertical output chroma subsample values. For example for the
  12875. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12876. @item n
  12877. The (sequential) number of the input frame, starting from 0.
  12878. Only available with @code{eval=frame}.
  12879. @item t
  12880. The presentation timestamp of the input frame, expressed as a number of
  12881. seconds. Only available with @code{eval=frame}.
  12882. @item pos
  12883. The position (byte offset) of the frame in the input stream, or NaN if
  12884. this information is unavailable and/or meaningless (for example in case of synthetic video).
  12885. Only available with @code{eval=frame}.
  12886. @end table
  12887. @subsection Examples
  12888. @itemize
  12889. @item
  12890. Scale the input video to a size of 200x100
  12891. @example
  12892. scale=w=200:h=100
  12893. @end example
  12894. This is equivalent to:
  12895. @example
  12896. scale=200:100
  12897. @end example
  12898. or:
  12899. @example
  12900. scale=200x100
  12901. @end example
  12902. @item
  12903. Specify a size abbreviation for the output size:
  12904. @example
  12905. scale=qcif
  12906. @end example
  12907. which can also be written as:
  12908. @example
  12909. scale=size=qcif
  12910. @end example
  12911. @item
  12912. Scale the input to 2x:
  12913. @example
  12914. scale=w=2*iw:h=2*ih
  12915. @end example
  12916. @item
  12917. The above is the same as:
  12918. @example
  12919. scale=2*in_w:2*in_h
  12920. @end example
  12921. @item
  12922. Scale the input to 2x with forced interlaced scaling:
  12923. @example
  12924. scale=2*iw:2*ih:interl=1
  12925. @end example
  12926. @item
  12927. Scale the input to half size:
  12928. @example
  12929. scale=w=iw/2:h=ih/2
  12930. @end example
  12931. @item
  12932. Increase the width, and set the height to the same size:
  12933. @example
  12934. scale=3/2*iw:ow
  12935. @end example
  12936. @item
  12937. Seek Greek harmony:
  12938. @example
  12939. scale=iw:1/PHI*iw
  12940. scale=ih*PHI:ih
  12941. @end example
  12942. @item
  12943. Increase the height, and set the width to 3/2 of the height:
  12944. @example
  12945. scale=w=3/2*oh:h=3/5*ih
  12946. @end example
  12947. @item
  12948. Increase the size, making the size a multiple of the chroma
  12949. subsample values:
  12950. @example
  12951. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  12952. @end example
  12953. @item
  12954. Increase the width to a maximum of 500 pixels,
  12955. keeping the same aspect ratio as the input:
  12956. @example
  12957. scale=w='min(500\, iw*3/2):h=-1'
  12958. @end example
  12959. @item
  12960. Make pixels square by combining scale and setsar:
  12961. @example
  12962. scale='trunc(ih*dar):ih',setsar=1/1
  12963. @end example
  12964. @item
  12965. Make pixels square by combining scale and setsar,
  12966. making sure the resulting resolution is even (required by some codecs):
  12967. @example
  12968. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  12969. @end example
  12970. @end itemize
  12971. @subsection Commands
  12972. This filter supports the following commands:
  12973. @table @option
  12974. @item width, w
  12975. @item height, h
  12976. Set the output video dimension expression.
  12977. The command accepts the same syntax of the corresponding option.
  12978. If the specified expression is not valid, it is kept at its current
  12979. value.
  12980. @end table
  12981. @section scale_npp
  12982. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12983. format conversion on CUDA video frames. Setting the output width and height
  12984. works in the same way as for the @var{scale} filter.
  12985. The following additional options are accepted:
  12986. @table @option
  12987. @item format
  12988. The pixel format of the output CUDA frames. If set to the string "same" (the
  12989. default), the input format will be kept. Note that automatic format negotiation
  12990. and conversion is not yet supported for hardware frames
  12991. @item interp_algo
  12992. The interpolation algorithm used for resizing. One of the following:
  12993. @table @option
  12994. @item nn
  12995. Nearest neighbour.
  12996. @item linear
  12997. @item cubic
  12998. @item cubic2p_bspline
  12999. 2-parameter cubic (B=1, C=0)
  13000. @item cubic2p_catmullrom
  13001. 2-parameter cubic (B=0, C=1/2)
  13002. @item cubic2p_b05c03
  13003. 2-parameter cubic (B=1/2, C=3/10)
  13004. @item super
  13005. Supersampling
  13006. @item lanczos
  13007. @end table
  13008. @item force_original_aspect_ratio
  13009. Enable decreasing or increasing output video width or height if necessary to
  13010. keep the original aspect ratio. Possible values:
  13011. @table @samp
  13012. @item disable
  13013. Scale the video as specified and disable this feature.
  13014. @item decrease
  13015. The output video dimensions will automatically be decreased if needed.
  13016. @item increase
  13017. The output video dimensions will automatically be increased if needed.
  13018. @end table
  13019. One useful instance of this option is that when you know a specific device's
  13020. maximum allowed resolution, you can use this to limit the output video to
  13021. that, while retaining the aspect ratio. For example, device A allows
  13022. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  13023. decrease) and specifying 1280x720 to the command line makes the output
  13024. 1280x533.
  13025. Please note that this is a different thing than specifying -1 for @option{w}
  13026. or @option{h}, you still need to specify the output resolution for this option
  13027. to work.
  13028. @item force_divisible_by
  13029. Ensures that both the output dimensions, width and height, are divisible by the
  13030. given integer when used together with @option{force_original_aspect_ratio}. This
  13031. works similar to using @code{-n} in the @option{w} and @option{h} options.
  13032. This option respects the value set for @option{force_original_aspect_ratio},
  13033. increasing or decreasing the resolution accordingly. The video's aspect ratio
  13034. may be slightly modified.
  13035. This option can be handy if you need to have a video fit within or exceed
  13036. a defined resolution using @option{force_original_aspect_ratio} but also have
  13037. encoder restrictions on width or height divisibility.
  13038. @end table
  13039. @section scale2ref
  13040. Scale (resize) the input video, based on a reference video.
  13041. See the scale filter for available options, scale2ref supports the same but
  13042. uses the reference video instead of the main input as basis. scale2ref also
  13043. supports the following additional constants for the @option{w} and
  13044. @option{h} options:
  13045. @table @var
  13046. @item main_w
  13047. @item main_h
  13048. The main input video's width and height
  13049. @item main_a
  13050. The same as @var{main_w} / @var{main_h}
  13051. @item main_sar
  13052. The main input video's sample aspect ratio
  13053. @item main_dar, mdar
  13054. The main input video's display aspect ratio. Calculated from
  13055. @code{(main_w / main_h) * main_sar}.
  13056. @item main_hsub
  13057. @item main_vsub
  13058. The main input video's horizontal and vertical chroma subsample values.
  13059. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  13060. is 1.
  13061. @item main_n
  13062. The (sequential) number of the main input frame, starting from 0.
  13063. Only available with @code{eval=frame}.
  13064. @item main_t
  13065. The presentation timestamp of the main input frame, expressed as a number of
  13066. seconds. Only available with @code{eval=frame}.
  13067. @item main_pos
  13068. The position (byte offset) of the frame in the main input stream, or NaN if
  13069. this information is unavailable and/or meaningless (for example in case of synthetic video).
  13070. Only available with @code{eval=frame}.
  13071. @end table
  13072. @subsection Examples
  13073. @itemize
  13074. @item
  13075. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  13076. @example
  13077. 'scale2ref[b][a];[a][b]overlay'
  13078. @end example
  13079. @item
  13080. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  13081. @example
  13082. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  13083. @end example
  13084. @end itemize
  13085. @subsection Commands
  13086. This filter supports the following commands:
  13087. @table @option
  13088. @item width, w
  13089. @item height, h
  13090. Set the output video dimension expression.
  13091. The command accepts the same syntax of the corresponding option.
  13092. If the specified expression is not valid, it is kept at its current
  13093. value.
  13094. @end table
  13095. @section scroll
  13096. Scroll input video horizontally and/or vertically by constant speed.
  13097. The filter accepts the following options:
  13098. @table @option
  13099. @item horizontal, h
  13100. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13101. Negative values changes scrolling direction.
  13102. @item vertical, v
  13103. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  13104. Negative values changes scrolling direction.
  13105. @item hpos
  13106. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  13107. @item vpos
  13108. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  13109. @end table
  13110. @subsection Commands
  13111. This filter supports the following @ref{commands}:
  13112. @table @option
  13113. @item horizontal, h
  13114. Set the horizontal scrolling speed.
  13115. @item vertical, v
  13116. Set the vertical scrolling speed.
  13117. @end table
  13118. @anchor{scdet}
  13119. @section scdet
  13120. Detect video scene change.
  13121. This filter sets frame metadata with mafd between frame, the scene score, and
  13122. forward the frame to the next filter, so they can use these metadata to detect
  13123. scene change or others.
  13124. In addition, this filter logs a message and sets frame metadata when it detects
  13125. a scene change by @option{threshold}.
  13126. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  13127. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  13128. to detect scene change.
  13129. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  13130. detect scene change with @option{threshold}.
  13131. The filter accepts the following options:
  13132. @table @option
  13133. @item threshold, t
  13134. Set the scene change detection threshold as a percentage of maximum change. Good
  13135. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  13136. @code{[0., 100.]}.
  13137. Default value is @code{10.}.
  13138. @item sc_pass, s
  13139. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  13140. You can enable it if you want to get snapshot of scene change frames only.
  13141. @end table
  13142. @anchor{selectivecolor}
  13143. @section selectivecolor
  13144. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  13145. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  13146. by the "purity" of the color (that is, how saturated it already is).
  13147. This filter is similar to the Adobe Photoshop Selective Color tool.
  13148. The filter accepts the following options:
  13149. @table @option
  13150. @item correction_method
  13151. Select color correction method.
  13152. Available values are:
  13153. @table @samp
  13154. @item absolute
  13155. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  13156. component value).
  13157. @item relative
  13158. Specified adjustments are relative to the original component value.
  13159. @end table
  13160. Default is @code{absolute}.
  13161. @item reds
  13162. Adjustments for red pixels (pixels where the red component is the maximum)
  13163. @item yellows
  13164. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  13165. @item greens
  13166. Adjustments for green pixels (pixels where the green component is the maximum)
  13167. @item cyans
  13168. Adjustments for cyan pixels (pixels where the red component is the minimum)
  13169. @item blues
  13170. Adjustments for blue pixels (pixels where the blue component is the maximum)
  13171. @item magentas
  13172. Adjustments for magenta pixels (pixels where the green component is the minimum)
  13173. @item whites
  13174. Adjustments for white pixels (pixels where all components are greater than 128)
  13175. @item neutrals
  13176. Adjustments for all pixels except pure black and pure white
  13177. @item blacks
  13178. Adjustments for black pixels (pixels where all components are lesser than 128)
  13179. @item psfile
  13180. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  13181. @end table
  13182. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  13183. 4 space separated floating point adjustment values in the [-1,1] range,
  13184. respectively to adjust the amount of cyan, magenta, yellow and black for the
  13185. pixels of its range.
  13186. @subsection Examples
  13187. @itemize
  13188. @item
  13189. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  13190. increase magenta by 27% in blue areas:
  13191. @example
  13192. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  13193. @end example
  13194. @item
  13195. Use a Photoshop selective color preset:
  13196. @example
  13197. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  13198. @end example
  13199. @end itemize
  13200. @anchor{separatefields}
  13201. @section separatefields
  13202. The @code{separatefields} takes a frame-based video input and splits
  13203. each frame into its components fields, producing a new half height clip
  13204. with twice the frame rate and twice the frame count.
  13205. This filter use field-dominance information in frame to decide which
  13206. of each pair of fields to place first in the output.
  13207. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  13208. @section setdar, setsar
  13209. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  13210. output video.
  13211. This is done by changing the specified Sample (aka Pixel) Aspect
  13212. Ratio, according to the following equation:
  13213. @example
  13214. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  13215. @end example
  13216. Keep in mind that the @code{setdar} filter does not modify the pixel
  13217. dimensions of the video frame. Also, the display aspect ratio set by
  13218. this filter may be changed by later filters in the filterchain,
  13219. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  13220. applied.
  13221. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  13222. the filter output video.
  13223. Note that as a consequence of the application of this filter, the
  13224. output display aspect ratio will change according to the equation
  13225. above.
  13226. Keep in mind that the sample aspect ratio set by the @code{setsar}
  13227. filter may be changed by later filters in the filterchain, e.g. if
  13228. another "setsar" or a "setdar" filter is applied.
  13229. It accepts the following parameters:
  13230. @table @option
  13231. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  13232. Set the aspect ratio used by the filter.
  13233. The parameter can be a floating point number string, an expression, or
  13234. a string of the form @var{num}:@var{den}, where @var{num} and
  13235. @var{den} are the numerator and denominator of the aspect ratio. If
  13236. the parameter is not specified, it is assumed the value "0".
  13237. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  13238. should be escaped.
  13239. @item max
  13240. Set the maximum integer value to use for expressing numerator and
  13241. denominator when reducing the expressed aspect ratio to a rational.
  13242. Default value is @code{100}.
  13243. @end table
  13244. The parameter @var{sar} is an expression containing
  13245. the following constants:
  13246. @table @option
  13247. @item E, PI, PHI
  13248. These are approximated values for the mathematical constants e
  13249. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  13250. @item w, h
  13251. The input width and height.
  13252. @item a
  13253. These are the same as @var{w} / @var{h}.
  13254. @item sar
  13255. The input sample aspect ratio.
  13256. @item dar
  13257. The input display aspect ratio. It is the same as
  13258. (@var{w} / @var{h}) * @var{sar}.
  13259. @item hsub, vsub
  13260. Horizontal and vertical chroma subsample values. For example, for the
  13261. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13262. @end table
  13263. @subsection Examples
  13264. @itemize
  13265. @item
  13266. To change the display aspect ratio to 16:9, specify one of the following:
  13267. @example
  13268. setdar=dar=1.77777
  13269. setdar=dar=16/9
  13270. @end example
  13271. @item
  13272. To change the sample aspect ratio to 10:11, specify:
  13273. @example
  13274. setsar=sar=10/11
  13275. @end example
  13276. @item
  13277. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  13278. 1000 in the aspect ratio reduction, use the command:
  13279. @example
  13280. setdar=ratio=16/9:max=1000
  13281. @end example
  13282. @end itemize
  13283. @anchor{setfield}
  13284. @section setfield
  13285. Force field for the output video frame.
  13286. The @code{setfield} filter marks the interlace type field for the
  13287. output frames. It does not change the input frame, but only sets the
  13288. corresponding property, which affects how the frame is treated by
  13289. following filters (e.g. @code{fieldorder} or @code{yadif}).
  13290. The filter accepts the following options:
  13291. @table @option
  13292. @item mode
  13293. Available values are:
  13294. @table @samp
  13295. @item auto
  13296. Keep the same field property.
  13297. @item bff
  13298. Mark the frame as bottom-field-first.
  13299. @item tff
  13300. Mark the frame as top-field-first.
  13301. @item prog
  13302. Mark the frame as progressive.
  13303. @end table
  13304. @end table
  13305. @anchor{setparams}
  13306. @section setparams
  13307. Force frame parameter for the output video frame.
  13308. The @code{setparams} filter marks interlace and color range for the
  13309. output frames. It does not change the input frame, but only sets the
  13310. corresponding property, which affects how the frame is treated by
  13311. filters/encoders.
  13312. @table @option
  13313. @item field_mode
  13314. Available values are:
  13315. @table @samp
  13316. @item auto
  13317. Keep the same field property (default).
  13318. @item bff
  13319. Mark the frame as bottom-field-first.
  13320. @item tff
  13321. Mark the frame as top-field-first.
  13322. @item prog
  13323. Mark the frame as progressive.
  13324. @end table
  13325. @item range
  13326. Available values are:
  13327. @table @samp
  13328. @item auto
  13329. Keep the same color range property (default).
  13330. @item unspecified, unknown
  13331. Mark the frame as unspecified color range.
  13332. @item limited, tv, mpeg
  13333. Mark the frame as limited range.
  13334. @item full, pc, jpeg
  13335. Mark the frame as full range.
  13336. @end table
  13337. @item color_primaries
  13338. Set the color primaries.
  13339. Available values are:
  13340. @table @samp
  13341. @item auto
  13342. Keep the same color primaries property (default).
  13343. @item bt709
  13344. @item unknown
  13345. @item bt470m
  13346. @item bt470bg
  13347. @item smpte170m
  13348. @item smpte240m
  13349. @item film
  13350. @item bt2020
  13351. @item smpte428
  13352. @item smpte431
  13353. @item smpte432
  13354. @item jedec-p22
  13355. @end table
  13356. @item color_trc
  13357. Set the color transfer.
  13358. Available values are:
  13359. @table @samp
  13360. @item auto
  13361. Keep the same color trc property (default).
  13362. @item bt709
  13363. @item unknown
  13364. @item bt470m
  13365. @item bt470bg
  13366. @item smpte170m
  13367. @item smpte240m
  13368. @item linear
  13369. @item log100
  13370. @item log316
  13371. @item iec61966-2-4
  13372. @item bt1361e
  13373. @item iec61966-2-1
  13374. @item bt2020-10
  13375. @item bt2020-12
  13376. @item smpte2084
  13377. @item smpte428
  13378. @item arib-std-b67
  13379. @end table
  13380. @item colorspace
  13381. Set the colorspace.
  13382. Available values are:
  13383. @table @samp
  13384. @item auto
  13385. Keep the same colorspace property (default).
  13386. @item gbr
  13387. @item bt709
  13388. @item unknown
  13389. @item fcc
  13390. @item bt470bg
  13391. @item smpte170m
  13392. @item smpte240m
  13393. @item ycgco
  13394. @item bt2020nc
  13395. @item bt2020c
  13396. @item smpte2085
  13397. @item chroma-derived-nc
  13398. @item chroma-derived-c
  13399. @item ictcp
  13400. @end table
  13401. @end table
  13402. @section showinfo
  13403. Show a line containing various information for each input video frame.
  13404. The input video is not modified.
  13405. This filter supports the following options:
  13406. @table @option
  13407. @item checksum
  13408. Calculate checksums of each plane. By default enabled.
  13409. @end table
  13410. The shown line contains a sequence of key/value pairs of the form
  13411. @var{key}:@var{value}.
  13412. The following values are shown in the output:
  13413. @table @option
  13414. @item n
  13415. The (sequential) number of the input frame, starting from 0.
  13416. @item pts
  13417. The Presentation TimeStamp of the input frame, expressed as a number of
  13418. time base units. The time base unit depends on the filter input pad.
  13419. @item pts_time
  13420. The Presentation TimeStamp of the input frame, expressed as a number of
  13421. seconds.
  13422. @item pos
  13423. The position of the frame in the input stream, or -1 if this information is
  13424. unavailable and/or meaningless (for example in case of synthetic video).
  13425. @item fmt
  13426. The pixel format name.
  13427. @item sar
  13428. The sample aspect ratio of the input frame, expressed in the form
  13429. @var{num}/@var{den}.
  13430. @item s
  13431. The size of the input frame. For the syntax of this option, check the
  13432. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13433. @item i
  13434. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  13435. for bottom field first).
  13436. @item iskey
  13437. This is 1 if the frame is a key frame, 0 otherwise.
  13438. @item type
  13439. The picture type of the input frame ("I" for an I-frame, "P" for a
  13440. P-frame, "B" for a B-frame, or "?" for an unknown type).
  13441. Also refer to the documentation of the @code{AVPictureType} enum and of
  13442. the @code{av_get_picture_type_char} function defined in
  13443. @file{libavutil/avutil.h}.
  13444. @item checksum
  13445. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  13446. @item plane_checksum
  13447. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  13448. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  13449. @item mean
  13450. The mean value of pixels in each plane of the input frame, expressed in the form
  13451. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  13452. @item stdev
  13453. The standard deviation of pixel values in each plane of the input frame, expressed
  13454. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  13455. @end table
  13456. @section showpalette
  13457. Displays the 256 colors palette of each frame. This filter is only relevant for
  13458. @var{pal8} pixel format frames.
  13459. It accepts the following option:
  13460. @table @option
  13461. @item s
  13462. Set the size of the box used to represent one palette color entry. Default is
  13463. @code{30} (for a @code{30x30} pixel box).
  13464. @end table
  13465. @section shuffleframes
  13466. Reorder and/or duplicate and/or drop video frames.
  13467. It accepts the following parameters:
  13468. @table @option
  13469. @item mapping
  13470. Set the destination indexes of input frames.
  13471. This is space or '|' separated list of indexes that maps input frames to output
  13472. frames. Number of indexes also sets maximal value that each index may have.
  13473. '-1' index have special meaning and that is to drop frame.
  13474. @end table
  13475. The first frame has the index 0. The default is to keep the input unchanged.
  13476. @subsection Examples
  13477. @itemize
  13478. @item
  13479. Swap second and third frame of every three frames of the input:
  13480. @example
  13481. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  13482. @end example
  13483. @item
  13484. Swap 10th and 1st frame of every ten frames of the input:
  13485. @example
  13486. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  13487. @end example
  13488. @end itemize
  13489. @section shuffleplanes
  13490. Reorder and/or duplicate video planes.
  13491. It accepts the following parameters:
  13492. @table @option
  13493. @item map0
  13494. The index of the input plane to be used as the first output plane.
  13495. @item map1
  13496. The index of the input plane to be used as the second output plane.
  13497. @item map2
  13498. The index of the input plane to be used as the third output plane.
  13499. @item map3
  13500. The index of the input plane to be used as the fourth output plane.
  13501. @end table
  13502. The first plane has the index 0. The default is to keep the input unchanged.
  13503. @subsection Examples
  13504. @itemize
  13505. @item
  13506. Swap the second and third planes of the input:
  13507. @example
  13508. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  13509. @end example
  13510. @end itemize
  13511. @anchor{signalstats}
  13512. @section signalstats
  13513. Evaluate various visual metrics that assist in determining issues associated
  13514. with the digitization of analog video media.
  13515. By default the filter will log these metadata values:
  13516. @table @option
  13517. @item YMIN
  13518. Display the minimal Y value contained within the input frame. Expressed in
  13519. range of [0-255].
  13520. @item YLOW
  13521. Display the Y value at the 10% percentile within the input frame. Expressed in
  13522. range of [0-255].
  13523. @item YAVG
  13524. Display the average Y value within the input frame. Expressed in range of
  13525. [0-255].
  13526. @item YHIGH
  13527. Display the Y value at the 90% percentile within the input frame. Expressed in
  13528. range of [0-255].
  13529. @item YMAX
  13530. Display the maximum Y value contained within the input frame. Expressed in
  13531. range of [0-255].
  13532. @item UMIN
  13533. Display the minimal U value contained within the input frame. Expressed in
  13534. range of [0-255].
  13535. @item ULOW
  13536. Display the U value at the 10% percentile within the input frame. Expressed in
  13537. range of [0-255].
  13538. @item UAVG
  13539. Display the average U value within the input frame. Expressed in range of
  13540. [0-255].
  13541. @item UHIGH
  13542. Display the U value at the 90% percentile within the input frame. Expressed in
  13543. range of [0-255].
  13544. @item UMAX
  13545. Display the maximum U value contained within the input frame. Expressed in
  13546. range of [0-255].
  13547. @item VMIN
  13548. Display the minimal V value contained within the input frame. Expressed in
  13549. range of [0-255].
  13550. @item VLOW
  13551. Display the V value at the 10% percentile within the input frame. Expressed in
  13552. range of [0-255].
  13553. @item VAVG
  13554. Display the average V value within the input frame. Expressed in range of
  13555. [0-255].
  13556. @item VHIGH
  13557. Display the V value at the 90% percentile within the input frame. Expressed in
  13558. range of [0-255].
  13559. @item VMAX
  13560. Display the maximum V value contained within the input frame. Expressed in
  13561. range of [0-255].
  13562. @item SATMIN
  13563. Display the minimal saturation value contained within the input frame.
  13564. Expressed in range of [0-~181.02].
  13565. @item SATLOW
  13566. Display the saturation value at the 10% percentile within the input frame.
  13567. Expressed in range of [0-~181.02].
  13568. @item SATAVG
  13569. Display the average saturation value within the input frame. Expressed in range
  13570. of [0-~181.02].
  13571. @item SATHIGH
  13572. Display the saturation value at the 90% percentile within the input frame.
  13573. Expressed in range of [0-~181.02].
  13574. @item SATMAX
  13575. Display the maximum saturation value contained within the input frame.
  13576. Expressed in range of [0-~181.02].
  13577. @item HUEMED
  13578. Display the median value for hue within the input frame. Expressed in range of
  13579. [0-360].
  13580. @item HUEAVG
  13581. Display the average value for hue within the input frame. Expressed in range of
  13582. [0-360].
  13583. @item YDIF
  13584. Display the average of sample value difference between all values of the Y
  13585. plane in the current frame and corresponding values of the previous input frame.
  13586. Expressed in range of [0-255].
  13587. @item UDIF
  13588. Display the average of sample value difference between all values of the U
  13589. plane in the current frame and corresponding values of the previous input frame.
  13590. Expressed in range of [0-255].
  13591. @item VDIF
  13592. Display the average of sample value difference between all values of the V
  13593. plane in the current frame and corresponding values of the previous input frame.
  13594. Expressed in range of [0-255].
  13595. @item YBITDEPTH
  13596. Display bit depth of Y plane in current frame.
  13597. Expressed in range of [0-16].
  13598. @item UBITDEPTH
  13599. Display bit depth of U plane in current frame.
  13600. Expressed in range of [0-16].
  13601. @item VBITDEPTH
  13602. Display bit depth of V plane in current frame.
  13603. Expressed in range of [0-16].
  13604. @end table
  13605. The filter accepts the following options:
  13606. @table @option
  13607. @item stat
  13608. @item out
  13609. @option{stat} specify an additional form of image analysis.
  13610. @option{out} output video with the specified type of pixel highlighted.
  13611. Both options accept the following values:
  13612. @table @samp
  13613. @item tout
  13614. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  13615. unlike the neighboring pixels of the same field. Examples of temporal outliers
  13616. include the results of video dropouts, head clogs, or tape tracking issues.
  13617. @item vrep
  13618. Identify @var{vertical line repetition}. Vertical line repetition includes
  13619. similar rows of pixels within a frame. In born-digital video vertical line
  13620. repetition is common, but this pattern is uncommon in video digitized from an
  13621. analog source. When it occurs in video that results from the digitization of an
  13622. analog source it can indicate concealment from a dropout compensator.
  13623. @item brng
  13624. Identify pixels that fall outside of legal broadcast range.
  13625. @end table
  13626. @item color, c
  13627. Set the highlight color for the @option{out} option. The default color is
  13628. yellow.
  13629. @end table
  13630. @subsection Examples
  13631. @itemize
  13632. @item
  13633. Output data of various video metrics:
  13634. @example
  13635. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  13636. @end example
  13637. @item
  13638. Output specific data about the minimum and maximum values of the Y plane per frame:
  13639. @example
  13640. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  13641. @end example
  13642. @item
  13643. Playback video while highlighting pixels that are outside of broadcast range in red.
  13644. @example
  13645. ffplay example.mov -vf signalstats="out=brng:color=red"
  13646. @end example
  13647. @item
  13648. Playback video with signalstats metadata drawn over the frame.
  13649. @example
  13650. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  13651. @end example
  13652. The contents of signalstat_drawtext.txt used in the command are:
  13653. @example
  13654. time %@{pts:hms@}
  13655. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  13656. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  13657. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  13658. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  13659. @end example
  13660. @end itemize
  13661. @anchor{signature}
  13662. @section signature
  13663. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  13664. input. In this case the matching between the inputs can be calculated additionally.
  13665. The filter always passes through the first input. The signature of each stream can
  13666. be written into a file.
  13667. It accepts the following options:
  13668. @table @option
  13669. @item detectmode
  13670. Enable or disable the matching process.
  13671. Available values are:
  13672. @table @samp
  13673. @item off
  13674. Disable the calculation of a matching (default).
  13675. @item full
  13676. Calculate the matching for the whole video and output whether the whole video
  13677. matches or only parts.
  13678. @item fast
  13679. Calculate only until a matching is found or the video ends. Should be faster in
  13680. some cases.
  13681. @end table
  13682. @item nb_inputs
  13683. Set the number of inputs. The option value must be a non negative integer.
  13684. Default value is 1.
  13685. @item filename
  13686. Set the path to which the output is written. If there is more than one input,
  13687. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  13688. integer), that will be replaced with the input number. If no filename is
  13689. specified, no output will be written. This is the default.
  13690. @item format
  13691. Choose the output format.
  13692. Available values are:
  13693. @table @samp
  13694. @item binary
  13695. Use the specified binary representation (default).
  13696. @item xml
  13697. Use the specified xml representation.
  13698. @end table
  13699. @item th_d
  13700. Set threshold to detect one word as similar. The option value must be an integer
  13701. greater than zero. The default value is 9000.
  13702. @item th_dc
  13703. Set threshold to detect all words as similar. The option value must be an integer
  13704. greater than zero. The default value is 60000.
  13705. @item th_xh
  13706. Set threshold to detect frames as similar. The option value must be an integer
  13707. greater than zero. The default value is 116.
  13708. @item th_di
  13709. Set the minimum length of a sequence in frames to recognize it as matching
  13710. sequence. The option value must be a non negative integer value.
  13711. The default value is 0.
  13712. @item th_it
  13713. Set the minimum relation, that matching frames to all frames must have.
  13714. The option value must be a double value between 0 and 1. The default value is 0.5.
  13715. @end table
  13716. @subsection Examples
  13717. @itemize
  13718. @item
  13719. To calculate the signature of an input video and store it in signature.bin:
  13720. @example
  13721. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  13722. @end example
  13723. @item
  13724. To detect whether two videos match and store the signatures in XML format in
  13725. signature0.xml and signature1.xml:
  13726. @example
  13727. 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 -
  13728. @end example
  13729. @end itemize
  13730. @anchor{smartblur}
  13731. @section smartblur
  13732. Blur the input video without impacting the outlines.
  13733. It accepts the following options:
  13734. @table @option
  13735. @item luma_radius, lr
  13736. Set the luma radius. The option value must be a float number in
  13737. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13738. used to blur the image (slower if larger). Default value is 1.0.
  13739. @item luma_strength, ls
  13740. Set the luma strength. The option value must be a float number
  13741. in the range [-1.0,1.0] that configures the blurring. A value included
  13742. in [0.0,1.0] will blur the image whereas a value included in
  13743. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  13744. @item luma_threshold, lt
  13745. Set the luma threshold used as a coefficient to determine
  13746. whether a pixel should be blurred or not. The option value must be an
  13747. integer in the range [-30,30]. A value of 0 will filter all the image,
  13748. a value included in [0,30] will filter flat areas and a value included
  13749. in [-30,0] will filter edges. Default value is 0.
  13750. @item chroma_radius, cr
  13751. Set the chroma radius. The option value must be a float number in
  13752. the range [0.1,5.0] that specifies the variance of the gaussian filter
  13753. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  13754. @item chroma_strength, cs
  13755. Set the chroma strength. The option value must be a float number
  13756. in the range [-1.0,1.0] that configures the blurring. A value included
  13757. in [0.0,1.0] will blur the image whereas a value included in
  13758. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  13759. @item chroma_threshold, ct
  13760. Set the chroma threshold used as a coefficient to determine
  13761. whether a pixel should be blurred or not. The option value must be an
  13762. integer in the range [-30,30]. A value of 0 will filter all the image,
  13763. a value included in [0,30] will filter flat areas and a value included
  13764. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  13765. @end table
  13766. If a chroma option is not explicitly set, the corresponding luma value
  13767. is set.
  13768. @section sobel
  13769. Apply sobel operator to input video stream.
  13770. The filter accepts the following option:
  13771. @table @option
  13772. @item planes
  13773. Set which planes will be processed, unprocessed planes will be copied.
  13774. By default value 0xf, all planes will be processed.
  13775. @item scale
  13776. Set value which will be multiplied with filtered result.
  13777. @item delta
  13778. Set value which will be added to filtered result.
  13779. @end table
  13780. @anchor{spp}
  13781. @section spp
  13782. Apply a simple postprocessing filter that compresses and decompresses the image
  13783. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  13784. and average the results.
  13785. The filter accepts the following options:
  13786. @table @option
  13787. @item quality
  13788. Set quality. This option defines the number of levels for averaging. It accepts
  13789. an integer in the range 0-6. If set to @code{0}, the filter will have no
  13790. effect. A value of @code{6} means the higher quality. For each increment of
  13791. that value the speed drops by a factor of approximately 2. Default value is
  13792. @code{3}.
  13793. @item qp
  13794. Force a constant quantization parameter. If not set, the filter will use the QP
  13795. from the video stream (if available).
  13796. @item mode
  13797. Set thresholding mode. Available modes are:
  13798. @table @samp
  13799. @item hard
  13800. Set hard thresholding (default).
  13801. @item soft
  13802. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13803. @end table
  13804. @item use_bframe_qp
  13805. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  13806. option may cause flicker since the B-Frames have often larger QP. Default is
  13807. @code{0} (not enabled).
  13808. @end table
  13809. @subsection Commands
  13810. This filter supports the following commands:
  13811. @table @option
  13812. @item quality, level
  13813. Set quality level. The value @code{max} can be used to set the maximum level,
  13814. currently @code{6}.
  13815. @end table
  13816. @anchor{sr}
  13817. @section sr
  13818. Scale the input by applying one of the super-resolution methods based on
  13819. convolutional neural networks. Supported models:
  13820. @itemize
  13821. @item
  13822. Super-Resolution Convolutional Neural Network model (SRCNN).
  13823. See @url{https://arxiv.org/abs/1501.00092}.
  13824. @item
  13825. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  13826. See @url{https://arxiv.org/abs/1609.05158}.
  13827. @end itemize
  13828. Training scripts as well as scripts for model file (.pb) saving can be found at
  13829. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  13830. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  13831. Native model files (.model) can be generated from TensorFlow model
  13832. files (.pb) by using tools/python/convert.py
  13833. The filter accepts the following options:
  13834. @table @option
  13835. @item dnn_backend
  13836. Specify which DNN backend to use for model loading and execution. This option accepts
  13837. the following values:
  13838. @table @samp
  13839. @item native
  13840. Native implementation of DNN loading and execution.
  13841. @item tensorflow
  13842. TensorFlow backend. To enable this backend you
  13843. need to install the TensorFlow for C library (see
  13844. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  13845. @code{--enable-libtensorflow}
  13846. @end table
  13847. Default value is @samp{native}.
  13848. @item model
  13849. Set path to model file specifying network architecture and its parameters.
  13850. Note that different backends use different file formats. TensorFlow backend
  13851. can load files for both formats, while native backend can load files for only
  13852. its format.
  13853. @item scale_factor
  13854. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  13855. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  13856. input upscaled using bicubic upscaling with proper scale factor.
  13857. @end table
  13858. This feature can also be finished with @ref{dnn_processing} filter.
  13859. @section ssim
  13860. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  13861. This filter takes in input two input videos, the first input is
  13862. considered the "main" source and is passed unchanged to the
  13863. output. The second input is used as a "reference" video for computing
  13864. the SSIM.
  13865. Both video inputs must have the same resolution and pixel format for
  13866. this filter to work correctly. Also it assumes that both inputs
  13867. have the same number of frames, which are compared one by one.
  13868. The filter stores the calculated SSIM of each frame.
  13869. The description of the accepted parameters follows.
  13870. @table @option
  13871. @item stats_file, f
  13872. If specified the filter will use the named file to save the SSIM of
  13873. each individual frame. When filename equals "-" the data is sent to
  13874. standard output.
  13875. @end table
  13876. The file printed if @var{stats_file} is selected, contains a sequence of
  13877. key/value pairs of the form @var{key}:@var{value} for each compared
  13878. couple of frames.
  13879. A description of each shown parameter follows:
  13880. @table @option
  13881. @item n
  13882. sequential number of the input frame, starting from 1
  13883. @item Y, U, V, R, G, B
  13884. SSIM of the compared frames for the component specified by the suffix.
  13885. @item All
  13886. SSIM of the compared frames for the whole frame.
  13887. @item dB
  13888. Same as above but in dB representation.
  13889. @end table
  13890. This filter also supports the @ref{framesync} options.
  13891. @subsection Examples
  13892. @itemize
  13893. @item
  13894. For example:
  13895. @example
  13896. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13897. [main][ref] ssim="stats_file=stats.log" [out]
  13898. @end example
  13899. On this example the input file being processed is compared with the
  13900. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  13901. is stored in @file{stats.log}.
  13902. @item
  13903. Another example with both psnr and ssim at same time:
  13904. @example
  13905. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  13906. @end example
  13907. @item
  13908. Another example with different containers:
  13909. @example
  13910. 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 -
  13911. @end example
  13912. @end itemize
  13913. @section stereo3d
  13914. Convert between different stereoscopic image formats.
  13915. The filters accept the following options:
  13916. @table @option
  13917. @item in
  13918. Set stereoscopic image format of input.
  13919. Available values for input image formats are:
  13920. @table @samp
  13921. @item sbsl
  13922. side by side parallel (left eye left, right eye right)
  13923. @item sbsr
  13924. side by side crosseye (right eye left, left eye right)
  13925. @item sbs2l
  13926. side by side parallel with half width resolution
  13927. (left eye left, right eye right)
  13928. @item sbs2r
  13929. side by side crosseye with half width resolution
  13930. (right eye left, left eye right)
  13931. @item abl
  13932. @item tbl
  13933. above-below (left eye above, right eye below)
  13934. @item abr
  13935. @item tbr
  13936. above-below (right eye above, left eye below)
  13937. @item ab2l
  13938. @item tb2l
  13939. above-below with half height resolution
  13940. (left eye above, right eye below)
  13941. @item ab2r
  13942. @item tb2r
  13943. above-below with half height resolution
  13944. (right eye above, left eye below)
  13945. @item al
  13946. alternating frames (left eye first, right eye second)
  13947. @item ar
  13948. alternating frames (right eye first, left eye second)
  13949. @item irl
  13950. interleaved rows (left eye has top row, right eye starts on next row)
  13951. @item irr
  13952. interleaved rows (right eye has top row, left eye starts on next row)
  13953. @item icl
  13954. interleaved columns, left eye first
  13955. @item icr
  13956. interleaved columns, right eye first
  13957. Default value is @samp{sbsl}.
  13958. @end table
  13959. @item out
  13960. Set stereoscopic image format of output.
  13961. @table @samp
  13962. @item sbsl
  13963. side by side parallel (left eye left, right eye right)
  13964. @item sbsr
  13965. side by side crosseye (right eye left, left eye right)
  13966. @item sbs2l
  13967. side by side parallel with half width resolution
  13968. (left eye left, right eye right)
  13969. @item sbs2r
  13970. side by side crosseye with half width resolution
  13971. (right eye left, left eye right)
  13972. @item abl
  13973. @item tbl
  13974. above-below (left eye above, right eye below)
  13975. @item abr
  13976. @item tbr
  13977. above-below (right eye above, left eye below)
  13978. @item ab2l
  13979. @item tb2l
  13980. above-below with half height resolution
  13981. (left eye above, right eye below)
  13982. @item ab2r
  13983. @item tb2r
  13984. above-below with half height resolution
  13985. (right eye above, left eye below)
  13986. @item al
  13987. alternating frames (left eye first, right eye second)
  13988. @item ar
  13989. alternating frames (right eye first, left eye second)
  13990. @item irl
  13991. interleaved rows (left eye has top row, right eye starts on next row)
  13992. @item irr
  13993. interleaved rows (right eye has top row, left eye starts on next row)
  13994. @item arbg
  13995. anaglyph red/blue gray
  13996. (red filter on left eye, blue filter on right eye)
  13997. @item argg
  13998. anaglyph red/green gray
  13999. (red filter on left eye, green filter on right eye)
  14000. @item arcg
  14001. anaglyph red/cyan gray
  14002. (red filter on left eye, cyan filter on right eye)
  14003. @item arch
  14004. anaglyph red/cyan half colored
  14005. (red filter on left eye, cyan filter on right eye)
  14006. @item arcc
  14007. anaglyph red/cyan color
  14008. (red filter on left eye, cyan filter on right eye)
  14009. @item arcd
  14010. anaglyph red/cyan color optimized with the least squares projection of dubois
  14011. (red filter on left eye, cyan filter on right eye)
  14012. @item agmg
  14013. anaglyph green/magenta gray
  14014. (green filter on left eye, magenta filter on right eye)
  14015. @item agmh
  14016. anaglyph green/magenta half colored
  14017. (green filter on left eye, magenta filter on right eye)
  14018. @item agmc
  14019. anaglyph green/magenta colored
  14020. (green filter on left eye, magenta filter on right eye)
  14021. @item agmd
  14022. anaglyph green/magenta color optimized with the least squares projection of dubois
  14023. (green filter on left eye, magenta filter on right eye)
  14024. @item aybg
  14025. anaglyph yellow/blue gray
  14026. (yellow filter on left eye, blue filter on right eye)
  14027. @item aybh
  14028. anaglyph yellow/blue half colored
  14029. (yellow filter on left eye, blue filter on right eye)
  14030. @item aybc
  14031. anaglyph yellow/blue colored
  14032. (yellow filter on left eye, blue filter on right eye)
  14033. @item aybd
  14034. anaglyph yellow/blue color optimized with the least squares projection of dubois
  14035. (yellow filter on left eye, blue filter on right eye)
  14036. @item ml
  14037. mono output (left eye only)
  14038. @item mr
  14039. mono output (right eye only)
  14040. @item chl
  14041. checkerboard, left eye first
  14042. @item chr
  14043. checkerboard, right eye first
  14044. @item icl
  14045. interleaved columns, left eye first
  14046. @item icr
  14047. interleaved columns, right eye first
  14048. @item hdmi
  14049. HDMI frame pack
  14050. @end table
  14051. Default value is @samp{arcd}.
  14052. @end table
  14053. @subsection Examples
  14054. @itemize
  14055. @item
  14056. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  14057. @example
  14058. stereo3d=sbsl:aybd
  14059. @end example
  14060. @item
  14061. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  14062. @example
  14063. stereo3d=abl:sbsr
  14064. @end example
  14065. @end itemize
  14066. @section streamselect, astreamselect
  14067. Select video or audio streams.
  14068. The filter accepts the following options:
  14069. @table @option
  14070. @item inputs
  14071. Set number of inputs. Default is 2.
  14072. @item map
  14073. Set input indexes to remap to outputs.
  14074. @end table
  14075. @subsection Commands
  14076. The @code{streamselect} and @code{astreamselect} filter supports the following
  14077. commands:
  14078. @table @option
  14079. @item map
  14080. Set input indexes to remap to outputs.
  14081. @end table
  14082. @subsection Examples
  14083. @itemize
  14084. @item
  14085. Select first 5 seconds 1st stream and rest of time 2nd stream:
  14086. @example
  14087. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  14088. @end example
  14089. @item
  14090. Same as above, but for audio:
  14091. @example
  14092. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  14093. @end example
  14094. @end itemize
  14095. @anchor{subtitles}
  14096. @section subtitles
  14097. Draw subtitles on top of input video using the libass library.
  14098. To enable compilation of this filter you need to configure FFmpeg with
  14099. @code{--enable-libass}. This filter also requires a build with libavcodec and
  14100. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  14101. Alpha) subtitles format.
  14102. The filter accepts the following options:
  14103. @table @option
  14104. @item filename, f
  14105. Set the filename of the subtitle file to read. It must be specified.
  14106. @item original_size
  14107. Specify the size of the original video, the video for which the ASS file
  14108. was composed. For the syntax of this option, check the
  14109. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14110. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  14111. correctly scale the fonts if the aspect ratio has been changed.
  14112. @item fontsdir
  14113. Set a directory path containing fonts that can be used by the filter.
  14114. These fonts will be used in addition to whatever the font provider uses.
  14115. @item alpha
  14116. Process alpha channel, by default alpha channel is untouched.
  14117. @item charenc
  14118. Set subtitles input character encoding. @code{subtitles} filter only. Only
  14119. useful if not UTF-8.
  14120. @item stream_index, si
  14121. Set subtitles stream index. @code{subtitles} filter only.
  14122. @item force_style
  14123. Override default style or script info parameters of the subtitles. It accepts a
  14124. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  14125. @end table
  14126. If the first key is not specified, it is assumed that the first value
  14127. specifies the @option{filename}.
  14128. For example, to render the file @file{sub.srt} on top of the input
  14129. video, use the command:
  14130. @example
  14131. subtitles=sub.srt
  14132. @end example
  14133. which is equivalent to:
  14134. @example
  14135. subtitles=filename=sub.srt
  14136. @end example
  14137. To render the default subtitles stream from file @file{video.mkv}, use:
  14138. @example
  14139. subtitles=video.mkv
  14140. @end example
  14141. To render the second subtitles stream from that file, use:
  14142. @example
  14143. subtitles=video.mkv:si=1
  14144. @end example
  14145. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  14146. @code{DejaVu Serif}, use:
  14147. @example
  14148. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  14149. @end example
  14150. @section super2xsai
  14151. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  14152. Interpolate) pixel art scaling algorithm.
  14153. Useful for enlarging pixel art images without reducing sharpness.
  14154. @section swaprect
  14155. Swap two rectangular objects in video.
  14156. This filter accepts the following options:
  14157. @table @option
  14158. @item w
  14159. Set object width.
  14160. @item h
  14161. Set object height.
  14162. @item x1
  14163. Set 1st rect x coordinate.
  14164. @item y1
  14165. Set 1st rect y coordinate.
  14166. @item x2
  14167. Set 2nd rect x coordinate.
  14168. @item y2
  14169. Set 2nd rect y coordinate.
  14170. All expressions are evaluated once for each frame.
  14171. @end table
  14172. The all options are expressions containing the following constants:
  14173. @table @option
  14174. @item w
  14175. @item h
  14176. The input width and height.
  14177. @item a
  14178. same as @var{w} / @var{h}
  14179. @item sar
  14180. input sample aspect ratio
  14181. @item dar
  14182. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  14183. @item n
  14184. The number of the input frame, starting from 0.
  14185. @item t
  14186. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  14187. @item pos
  14188. the position in the file of the input frame, NAN if unknown
  14189. @end table
  14190. @section swapuv
  14191. Swap U & V plane.
  14192. @section tblend
  14193. Blend successive video frames.
  14194. See @ref{blend}
  14195. @section telecine
  14196. Apply telecine process to the video.
  14197. This filter accepts the following options:
  14198. @table @option
  14199. @item first_field
  14200. @table @samp
  14201. @item top, t
  14202. top field first
  14203. @item bottom, b
  14204. bottom field first
  14205. The default value is @code{top}.
  14206. @end table
  14207. @item pattern
  14208. A string of numbers representing the pulldown pattern you wish to apply.
  14209. The default value is @code{23}.
  14210. @end table
  14211. @example
  14212. Some typical patterns:
  14213. NTSC output (30i):
  14214. 27.5p: 32222
  14215. 24p: 23 (classic)
  14216. 24p: 2332 (preferred)
  14217. 20p: 33
  14218. 18p: 334
  14219. 16p: 3444
  14220. PAL output (25i):
  14221. 27.5p: 12222
  14222. 24p: 222222222223 ("Euro pulldown")
  14223. 16.67p: 33
  14224. 16p: 33333334
  14225. @end example
  14226. @section thistogram
  14227. Compute and draw a color distribution histogram for the input video across time.
  14228. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  14229. at certain time, this filter shows also past histograms of number of frames defined
  14230. by @code{width} option.
  14231. The computed histogram is a representation of the color component
  14232. distribution in an image.
  14233. The filter accepts the following options:
  14234. @table @option
  14235. @item width, w
  14236. Set width of single color component output. Default value is @code{0}.
  14237. Value of @code{0} means width will be picked from input video.
  14238. This also set number of passed histograms to keep.
  14239. Allowed range is [0, 8192].
  14240. @item display_mode, d
  14241. Set display mode.
  14242. It accepts the following values:
  14243. @table @samp
  14244. @item stack
  14245. Per color component graphs are placed below each other.
  14246. @item parade
  14247. Per color component graphs are placed side by side.
  14248. @item overlay
  14249. Presents information identical to that in the @code{parade}, except
  14250. that the graphs representing color components are superimposed directly
  14251. over one another.
  14252. @end table
  14253. Default is @code{stack}.
  14254. @item levels_mode, m
  14255. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  14256. Default is @code{linear}.
  14257. @item components, c
  14258. Set what color components to display.
  14259. Default is @code{7}.
  14260. @item bgopacity, b
  14261. Set background opacity. Default is @code{0.9}.
  14262. @item envelope, e
  14263. Show envelope. Default is disabled.
  14264. @item ecolor, ec
  14265. Set envelope color. Default is @code{gold}.
  14266. @item slide
  14267. Set slide mode.
  14268. Available values for slide is:
  14269. @table @samp
  14270. @item frame
  14271. Draw new frame when right border is reached.
  14272. @item replace
  14273. Replace old columns with new ones.
  14274. @item scroll
  14275. Scroll from right to left.
  14276. @item rscroll
  14277. Scroll from left to right.
  14278. @item picture
  14279. Draw single picture.
  14280. @end table
  14281. Default is @code{replace}.
  14282. @end table
  14283. @section threshold
  14284. Apply threshold effect to video stream.
  14285. This filter needs four video streams to perform thresholding.
  14286. First stream is stream we are filtering.
  14287. Second stream is holding threshold values, third stream is holding min values,
  14288. and last, fourth stream is holding max values.
  14289. The filter accepts the following option:
  14290. @table @option
  14291. @item planes
  14292. Set which planes will be processed, unprocessed planes will be copied.
  14293. By default value 0xf, all planes will be processed.
  14294. @end table
  14295. For example if first stream pixel's component value is less then threshold value
  14296. of pixel component from 2nd threshold stream, third stream value will picked,
  14297. otherwise fourth stream pixel component value will be picked.
  14298. Using color source filter one can perform various types of thresholding:
  14299. @subsection Examples
  14300. @itemize
  14301. @item
  14302. Binary threshold, using gray color as threshold:
  14303. @example
  14304. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  14305. @end example
  14306. @item
  14307. Inverted binary threshold, using gray color as threshold:
  14308. @example
  14309. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  14310. @end example
  14311. @item
  14312. Truncate binary threshold, using gray color as threshold:
  14313. @example
  14314. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  14315. @end example
  14316. @item
  14317. Threshold to zero, using gray color as threshold:
  14318. @example
  14319. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  14320. @end example
  14321. @item
  14322. Inverted threshold to zero, using gray color as threshold:
  14323. @example
  14324. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  14325. @end example
  14326. @end itemize
  14327. @section thumbnail
  14328. Select the most representative frame in a given sequence of consecutive frames.
  14329. The filter accepts the following options:
  14330. @table @option
  14331. @item n
  14332. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  14333. will pick one of them, and then handle the next batch of @var{n} frames until
  14334. the end. Default is @code{100}.
  14335. @end table
  14336. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  14337. value will result in a higher memory usage, so a high value is not recommended.
  14338. @subsection Examples
  14339. @itemize
  14340. @item
  14341. Extract one picture each 50 frames:
  14342. @example
  14343. thumbnail=50
  14344. @end example
  14345. @item
  14346. Complete example of a thumbnail creation with @command{ffmpeg}:
  14347. @example
  14348. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  14349. @end example
  14350. @end itemize
  14351. @anchor{tile}
  14352. @section tile
  14353. Tile several successive frames together.
  14354. The @ref{untile} filter can do the reverse.
  14355. The filter accepts the following options:
  14356. @table @option
  14357. @item layout
  14358. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14359. this option, check the
  14360. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14361. @item nb_frames
  14362. Set the maximum number of frames to render in the given area. It must be less
  14363. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  14364. the area will be used.
  14365. @item margin
  14366. Set the outer border margin in pixels.
  14367. @item padding
  14368. Set the inner border thickness (i.e. the number of pixels between frames). For
  14369. more advanced padding options (such as having different values for the edges),
  14370. refer to the pad video filter.
  14371. @item color
  14372. Specify the color of the unused area. For the syntax of this option, check the
  14373. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14374. The default value of @var{color} is "black".
  14375. @item overlap
  14376. Set the number of frames to overlap when tiling several successive frames together.
  14377. The value must be between @code{0} and @var{nb_frames - 1}.
  14378. @item init_padding
  14379. Set the number of frames to initially be empty before displaying first output frame.
  14380. This controls how soon will one get first output frame.
  14381. The value must be between @code{0} and @var{nb_frames - 1}.
  14382. @end table
  14383. @subsection Examples
  14384. @itemize
  14385. @item
  14386. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  14387. @example
  14388. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  14389. @end example
  14390. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  14391. duplicating each output frame to accommodate the originally detected frame
  14392. rate.
  14393. @item
  14394. Display @code{5} pictures in an area of @code{3x2} frames,
  14395. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  14396. mixed flat and named options:
  14397. @example
  14398. tile=3x2:nb_frames=5:padding=7:margin=2
  14399. @end example
  14400. @end itemize
  14401. @section tinterlace
  14402. Perform various types of temporal field interlacing.
  14403. Frames are counted starting from 1, so the first input frame is
  14404. considered odd.
  14405. The filter accepts the following options:
  14406. @table @option
  14407. @item mode
  14408. Specify the mode of the interlacing. This option can also be specified
  14409. as a value alone. See below for a list of values for this option.
  14410. Available values are:
  14411. @table @samp
  14412. @item merge, 0
  14413. Move odd frames into the upper field, even into the lower field,
  14414. generating a double height frame at half frame rate.
  14415. @example
  14416. ------> time
  14417. Input:
  14418. Frame 1 Frame 2 Frame 3 Frame 4
  14419. 11111 22222 33333 44444
  14420. 11111 22222 33333 44444
  14421. 11111 22222 33333 44444
  14422. 11111 22222 33333 44444
  14423. Output:
  14424. 11111 33333
  14425. 22222 44444
  14426. 11111 33333
  14427. 22222 44444
  14428. 11111 33333
  14429. 22222 44444
  14430. 11111 33333
  14431. 22222 44444
  14432. @end example
  14433. @item drop_even, 1
  14434. Only output odd frames, even frames are dropped, generating a frame with
  14435. unchanged height at half frame rate.
  14436. @example
  14437. ------> time
  14438. Input:
  14439. Frame 1 Frame 2 Frame 3 Frame 4
  14440. 11111 22222 33333 44444
  14441. 11111 22222 33333 44444
  14442. 11111 22222 33333 44444
  14443. 11111 22222 33333 44444
  14444. Output:
  14445. 11111 33333
  14446. 11111 33333
  14447. 11111 33333
  14448. 11111 33333
  14449. @end example
  14450. @item drop_odd, 2
  14451. Only output even frames, odd frames are dropped, generating a frame with
  14452. unchanged height at half frame rate.
  14453. @example
  14454. ------> time
  14455. Input:
  14456. Frame 1 Frame 2 Frame 3 Frame 4
  14457. 11111 22222 33333 44444
  14458. 11111 22222 33333 44444
  14459. 11111 22222 33333 44444
  14460. 11111 22222 33333 44444
  14461. Output:
  14462. 22222 44444
  14463. 22222 44444
  14464. 22222 44444
  14465. 22222 44444
  14466. @end example
  14467. @item pad, 3
  14468. Expand each frame to full height, but pad alternate lines with black,
  14469. generating a frame with double height at the same input frame rate.
  14470. @example
  14471. ------> time
  14472. Input:
  14473. Frame 1 Frame 2 Frame 3 Frame 4
  14474. 11111 22222 33333 44444
  14475. 11111 22222 33333 44444
  14476. 11111 22222 33333 44444
  14477. 11111 22222 33333 44444
  14478. Output:
  14479. 11111 ..... 33333 .....
  14480. ..... 22222 ..... 44444
  14481. 11111 ..... 33333 .....
  14482. ..... 22222 ..... 44444
  14483. 11111 ..... 33333 .....
  14484. ..... 22222 ..... 44444
  14485. 11111 ..... 33333 .....
  14486. ..... 22222 ..... 44444
  14487. @end example
  14488. @item interleave_top, 4
  14489. Interleave the upper field from odd frames with the lower field from
  14490. even frames, generating a frame with unchanged height at half frame rate.
  14491. @example
  14492. ------> time
  14493. Input:
  14494. Frame 1 Frame 2 Frame 3 Frame 4
  14495. 11111<- 22222 33333<- 44444
  14496. 11111 22222<- 33333 44444<-
  14497. 11111<- 22222 33333<- 44444
  14498. 11111 22222<- 33333 44444<-
  14499. Output:
  14500. 11111 33333
  14501. 22222 44444
  14502. 11111 33333
  14503. 22222 44444
  14504. @end example
  14505. @item interleave_bottom, 5
  14506. Interleave the lower field from odd frames with the upper field from
  14507. even frames, generating a frame with unchanged height at half frame rate.
  14508. @example
  14509. ------> time
  14510. Input:
  14511. Frame 1 Frame 2 Frame 3 Frame 4
  14512. 11111 22222<- 33333 44444<-
  14513. 11111<- 22222 33333<- 44444
  14514. 11111 22222<- 33333 44444<-
  14515. 11111<- 22222 33333<- 44444
  14516. Output:
  14517. 22222 44444
  14518. 11111 33333
  14519. 22222 44444
  14520. 11111 33333
  14521. @end example
  14522. @item interlacex2, 6
  14523. Double frame rate with unchanged height. Frames are inserted each
  14524. containing the second temporal field from the previous input frame and
  14525. the first temporal field from the next input frame. This mode relies on
  14526. the top_field_first flag. Useful for interlaced video displays with no
  14527. field synchronisation.
  14528. @example
  14529. ------> time
  14530. Input:
  14531. Frame 1 Frame 2 Frame 3 Frame 4
  14532. 11111 22222 33333 44444
  14533. 11111 22222 33333 44444
  14534. 11111 22222 33333 44444
  14535. 11111 22222 33333 44444
  14536. Output:
  14537. 11111 22222 22222 33333 33333 44444 44444
  14538. 11111 11111 22222 22222 33333 33333 44444
  14539. 11111 22222 22222 33333 33333 44444 44444
  14540. 11111 11111 22222 22222 33333 33333 44444
  14541. @end example
  14542. @item mergex2, 7
  14543. Move odd frames into the upper field, even into the lower field,
  14544. generating a double height frame at same frame rate.
  14545. @example
  14546. ------> time
  14547. Input:
  14548. Frame 1 Frame 2 Frame 3 Frame 4
  14549. 11111 22222 33333 44444
  14550. 11111 22222 33333 44444
  14551. 11111 22222 33333 44444
  14552. 11111 22222 33333 44444
  14553. Output:
  14554. 11111 33333 33333 55555
  14555. 22222 22222 44444 44444
  14556. 11111 33333 33333 55555
  14557. 22222 22222 44444 44444
  14558. 11111 33333 33333 55555
  14559. 22222 22222 44444 44444
  14560. 11111 33333 33333 55555
  14561. 22222 22222 44444 44444
  14562. @end example
  14563. @end table
  14564. Numeric values are deprecated but are accepted for backward
  14565. compatibility reasons.
  14566. Default mode is @code{merge}.
  14567. @item flags
  14568. Specify flags influencing the filter process.
  14569. Available value for @var{flags} is:
  14570. @table @option
  14571. @item low_pass_filter, vlpf
  14572. Enable linear vertical low-pass filtering in the filter.
  14573. Vertical low-pass filtering is required when creating an interlaced
  14574. destination from a progressive source which contains high-frequency
  14575. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  14576. patterning.
  14577. @item complex_filter, cvlpf
  14578. Enable complex vertical low-pass filtering.
  14579. This will slightly less reduce interlace 'twitter' and Moire
  14580. patterning but better retain detail and subjective sharpness impression.
  14581. @item bypass_il
  14582. Bypass already interlaced frames, only adjust the frame rate.
  14583. @end table
  14584. Vertical low-pass filtering and bypassing already interlaced frames can only be
  14585. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  14586. @end table
  14587. @section tmedian
  14588. Pick median pixels from several successive input video frames.
  14589. The filter accepts the following options:
  14590. @table @option
  14591. @item radius
  14592. Set radius of median filter.
  14593. Default is 1. Allowed range is from 1 to 127.
  14594. @item planes
  14595. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14596. @item percentile
  14597. Set median percentile. Default value is @code{0.5}.
  14598. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  14599. minimum values, and @code{1} maximum values.
  14600. @end table
  14601. @section tmix
  14602. Mix successive video frames.
  14603. A description of the accepted options follows.
  14604. @table @option
  14605. @item frames
  14606. The number of successive frames to mix. If unspecified, it defaults to 3.
  14607. @item weights
  14608. Specify weight of each input video frame.
  14609. Each weight is separated by space. If number of weights is smaller than
  14610. number of @var{frames} last specified weight will be used for all remaining
  14611. unset weights.
  14612. @item scale
  14613. Specify scale, if it is set it will be multiplied with sum
  14614. of each weight multiplied with pixel values to give final destination
  14615. pixel value. By default @var{scale} is auto scaled to sum of weights.
  14616. @end table
  14617. @subsection Examples
  14618. @itemize
  14619. @item
  14620. Average 7 successive frames:
  14621. @example
  14622. tmix=frames=7:weights="1 1 1 1 1 1 1"
  14623. @end example
  14624. @item
  14625. Apply simple temporal convolution:
  14626. @example
  14627. tmix=frames=3:weights="-1 3 -1"
  14628. @end example
  14629. @item
  14630. Similar as above but only showing temporal differences:
  14631. @example
  14632. tmix=frames=3:weights="-1 2 -1":scale=1
  14633. @end example
  14634. @end itemize
  14635. @anchor{tonemap}
  14636. @section tonemap
  14637. Tone map colors from different dynamic ranges.
  14638. This filter expects data in single precision floating point, as it needs to
  14639. operate on (and can output) out-of-range values. Another filter, such as
  14640. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  14641. The tonemapping algorithms implemented only work on linear light, so input
  14642. data should be linearized beforehand (and possibly correctly tagged).
  14643. @example
  14644. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  14645. @end example
  14646. @subsection Options
  14647. The filter accepts the following options.
  14648. @table @option
  14649. @item tonemap
  14650. Set the tone map algorithm to use.
  14651. Possible values are:
  14652. @table @var
  14653. @item none
  14654. Do not apply any tone map, only desaturate overbright pixels.
  14655. @item clip
  14656. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  14657. in-range values, while distorting out-of-range values.
  14658. @item linear
  14659. Stretch the entire reference gamut to a linear multiple of the display.
  14660. @item gamma
  14661. Fit a logarithmic transfer between the tone curves.
  14662. @item reinhard
  14663. Preserve overall image brightness with a simple curve, using nonlinear
  14664. contrast, which results in flattening details and degrading color accuracy.
  14665. @item hable
  14666. Preserve both dark and bright details better than @var{reinhard}, at the cost
  14667. of slightly darkening everything. Use it when detail preservation is more
  14668. important than color and brightness accuracy.
  14669. @item mobius
  14670. Smoothly map out-of-range values, while retaining contrast and colors for
  14671. in-range material as much as possible. Use it when color accuracy is more
  14672. important than detail preservation.
  14673. @end table
  14674. Default is none.
  14675. @item param
  14676. Tune the tone mapping algorithm.
  14677. This affects the following algorithms:
  14678. @table @var
  14679. @item none
  14680. Ignored.
  14681. @item linear
  14682. Specifies the scale factor to use while stretching.
  14683. Default to 1.0.
  14684. @item gamma
  14685. Specifies the exponent of the function.
  14686. Default to 1.8.
  14687. @item clip
  14688. Specify an extra linear coefficient to multiply into the signal before clipping.
  14689. Default to 1.0.
  14690. @item reinhard
  14691. Specify the local contrast coefficient at the display peak.
  14692. Default to 0.5, which means that in-gamut values will be about half as bright
  14693. as when clipping.
  14694. @item hable
  14695. Ignored.
  14696. @item mobius
  14697. Specify the transition point from linear to mobius transform. Every value
  14698. below this point is guaranteed to be mapped 1:1. The higher the value, the
  14699. more accurate the result will be, at the cost of losing bright details.
  14700. Default to 0.3, which due to the steep initial slope still preserves in-range
  14701. colors fairly accurately.
  14702. @end table
  14703. @item desat
  14704. Apply desaturation for highlights that exceed this level of brightness. The
  14705. higher the parameter, the more color information will be preserved. This
  14706. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14707. (smoothly) turning into white instead. This makes images feel more natural,
  14708. at the cost of reducing information about out-of-range colors.
  14709. The default of 2.0 is somewhat conservative and will mostly just apply to
  14710. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  14711. This option works only if the input frame has a supported color tag.
  14712. @item peak
  14713. Override signal/nominal/reference peak with this value. Useful when the
  14714. embedded peak information in display metadata is not reliable or when tone
  14715. mapping from a lower range to a higher range.
  14716. @end table
  14717. @section tpad
  14718. Temporarily pad video frames.
  14719. The filter accepts the following options:
  14720. @table @option
  14721. @item start
  14722. Specify number of delay frames before input video stream. Default is 0.
  14723. @item stop
  14724. Specify number of padding frames after input video stream.
  14725. Set to -1 to pad indefinitely. Default is 0.
  14726. @item start_mode
  14727. Set kind of frames added to beginning of stream.
  14728. Can be either @var{add} or @var{clone}.
  14729. With @var{add} frames of solid-color are added.
  14730. With @var{clone} frames are clones of first frame.
  14731. Default is @var{add}.
  14732. @item stop_mode
  14733. Set kind of frames added to end of stream.
  14734. Can be either @var{add} or @var{clone}.
  14735. With @var{add} frames of solid-color are added.
  14736. With @var{clone} frames are clones of last frame.
  14737. Default is @var{add}.
  14738. @item start_duration, stop_duration
  14739. Specify the duration of the start/stop delay. See
  14740. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14741. for the accepted syntax.
  14742. These options override @var{start} and @var{stop}. Default is 0.
  14743. @item color
  14744. Specify the color of the padded area. For the syntax of this option,
  14745. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14746. manual,ffmpeg-utils}.
  14747. The default value of @var{color} is "black".
  14748. @end table
  14749. @anchor{transpose}
  14750. @section transpose
  14751. Transpose rows with columns in the input video and optionally flip it.
  14752. It accepts the following parameters:
  14753. @table @option
  14754. @item dir
  14755. Specify the transposition direction.
  14756. Can assume the following values:
  14757. @table @samp
  14758. @item 0, 4, cclock_flip
  14759. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  14760. @example
  14761. L.R L.l
  14762. . . -> . .
  14763. l.r R.r
  14764. @end example
  14765. @item 1, 5, clock
  14766. Rotate by 90 degrees clockwise, that is:
  14767. @example
  14768. L.R l.L
  14769. . . -> . .
  14770. l.r r.R
  14771. @end example
  14772. @item 2, 6, cclock
  14773. Rotate by 90 degrees counterclockwise, that is:
  14774. @example
  14775. L.R R.r
  14776. . . -> . .
  14777. l.r L.l
  14778. @end example
  14779. @item 3, 7, clock_flip
  14780. Rotate by 90 degrees clockwise and vertically flip, that is:
  14781. @example
  14782. L.R r.R
  14783. . . -> . .
  14784. l.r l.L
  14785. @end example
  14786. @end table
  14787. For values between 4-7, the transposition is only done if the input
  14788. video geometry is portrait and not landscape. These values are
  14789. deprecated, the @code{passthrough} option should be used instead.
  14790. Numerical values are deprecated, and should be dropped in favor of
  14791. symbolic constants.
  14792. @item passthrough
  14793. Do not apply the transposition if the input geometry matches the one
  14794. specified by the specified value. It accepts the following values:
  14795. @table @samp
  14796. @item none
  14797. Always apply transposition.
  14798. @item portrait
  14799. Preserve portrait geometry (when @var{height} >= @var{width}).
  14800. @item landscape
  14801. Preserve landscape geometry (when @var{width} >= @var{height}).
  14802. @end table
  14803. Default value is @code{none}.
  14804. @end table
  14805. For example to rotate by 90 degrees clockwise and preserve portrait
  14806. layout:
  14807. @example
  14808. transpose=dir=1:passthrough=portrait
  14809. @end example
  14810. The command above can also be specified as:
  14811. @example
  14812. transpose=1:portrait
  14813. @end example
  14814. @section transpose_npp
  14815. Transpose rows with columns in the input video and optionally flip it.
  14816. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  14817. It accepts the following parameters:
  14818. @table @option
  14819. @item dir
  14820. Specify the transposition direction.
  14821. Can assume the following values:
  14822. @table @samp
  14823. @item cclock_flip
  14824. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  14825. @item clock
  14826. Rotate by 90 degrees clockwise.
  14827. @item cclock
  14828. Rotate by 90 degrees counterclockwise.
  14829. @item clock_flip
  14830. Rotate by 90 degrees clockwise and vertically flip.
  14831. @end table
  14832. @item passthrough
  14833. Do not apply the transposition if the input geometry matches the one
  14834. specified by the specified value. It accepts the following values:
  14835. @table @samp
  14836. @item none
  14837. Always apply transposition. (default)
  14838. @item portrait
  14839. Preserve portrait geometry (when @var{height} >= @var{width}).
  14840. @item landscape
  14841. Preserve landscape geometry (when @var{width} >= @var{height}).
  14842. @end table
  14843. @end table
  14844. @section trim
  14845. Trim the input so that the output contains one continuous subpart of the input.
  14846. It accepts the following parameters:
  14847. @table @option
  14848. @item start
  14849. Specify the time of the start of the kept section, i.e. the frame with the
  14850. timestamp @var{start} will be the first frame in the output.
  14851. @item end
  14852. Specify the time of the first frame that will be dropped, i.e. the frame
  14853. immediately preceding the one with the timestamp @var{end} will be the last
  14854. frame in the output.
  14855. @item start_pts
  14856. This is the same as @var{start}, except this option sets the start timestamp
  14857. in timebase units instead of seconds.
  14858. @item end_pts
  14859. This is the same as @var{end}, except this option sets the end timestamp
  14860. in timebase units instead of seconds.
  14861. @item duration
  14862. The maximum duration of the output in seconds.
  14863. @item start_frame
  14864. The number of the first frame that should be passed to the output.
  14865. @item end_frame
  14866. The number of the first frame that should be dropped.
  14867. @end table
  14868. @option{start}, @option{end}, and @option{duration} are expressed as time
  14869. duration specifications; see
  14870. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14871. for the accepted syntax.
  14872. Note that the first two sets of the start/end options and the @option{duration}
  14873. option look at the frame timestamp, while the _frame variants simply count the
  14874. frames that pass through the filter. Also note that this filter does not modify
  14875. the timestamps. If you wish for the output timestamps to start at zero, insert a
  14876. setpts filter after the trim filter.
  14877. If multiple start or end options are set, this filter tries to be greedy and
  14878. keep all the frames that match at least one of the specified constraints. To keep
  14879. only the part that matches all the constraints at once, chain multiple trim
  14880. filters.
  14881. The defaults are such that all the input is kept. So it is possible to set e.g.
  14882. just the end values to keep everything before the specified time.
  14883. Examples:
  14884. @itemize
  14885. @item
  14886. Drop everything except the second minute of input:
  14887. @example
  14888. ffmpeg -i INPUT -vf trim=60:120
  14889. @end example
  14890. @item
  14891. Keep only the first second:
  14892. @example
  14893. ffmpeg -i INPUT -vf trim=duration=1
  14894. @end example
  14895. @end itemize
  14896. @section unpremultiply
  14897. Apply alpha unpremultiply effect to input video stream using first plane
  14898. of second stream as alpha.
  14899. Both streams must have same dimensions and same pixel format.
  14900. The filter accepts the following option:
  14901. @table @option
  14902. @item planes
  14903. Set which planes will be processed, unprocessed planes will be copied.
  14904. By default value 0xf, all planes will be processed.
  14905. If the format has 1 or 2 components, then luma is bit 0.
  14906. If the format has 3 or 4 components:
  14907. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  14908. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  14909. If present, the alpha channel is always the last bit.
  14910. @item inplace
  14911. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14912. @end table
  14913. @anchor{unsharp}
  14914. @section unsharp
  14915. Sharpen or blur the input video.
  14916. It accepts the following parameters:
  14917. @table @option
  14918. @item luma_msize_x, lx
  14919. Set the luma matrix horizontal size. It must be an odd integer between
  14920. 3 and 23. The default value is 5.
  14921. @item luma_msize_y, ly
  14922. Set the luma matrix vertical size. It must be an odd integer between 3
  14923. and 23. The default value is 5.
  14924. @item luma_amount, la
  14925. Set the luma effect strength. It must be a floating point number, reasonable
  14926. values lay between -1.5 and 1.5.
  14927. Negative values will blur the input video, while positive values will
  14928. sharpen it, a value of zero will disable the effect.
  14929. Default value is 1.0.
  14930. @item chroma_msize_x, cx
  14931. Set the chroma matrix horizontal size. It must be an odd integer
  14932. between 3 and 23. The default value is 5.
  14933. @item chroma_msize_y, cy
  14934. Set the chroma matrix vertical size. It must be an odd integer
  14935. between 3 and 23. The default value is 5.
  14936. @item chroma_amount, ca
  14937. Set the chroma effect strength. It must be a floating point number, reasonable
  14938. values lay between -1.5 and 1.5.
  14939. Negative values will blur the input video, while positive values will
  14940. sharpen it, a value of zero will disable the effect.
  14941. Default value is 0.0.
  14942. @end table
  14943. All parameters are optional and default to the equivalent of the
  14944. string '5:5:1.0:5:5:0.0'.
  14945. @subsection Examples
  14946. @itemize
  14947. @item
  14948. Apply strong luma sharpen effect:
  14949. @example
  14950. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  14951. @end example
  14952. @item
  14953. Apply a strong blur of both luma and chroma parameters:
  14954. @example
  14955. unsharp=7:7:-2:7:7:-2
  14956. @end example
  14957. @end itemize
  14958. @anchor{untile}
  14959. @section untile
  14960. Decompose a video made of tiled images into the individual images.
  14961. The frame rate of the output video is the frame rate of the input video
  14962. multiplied by the number of tiles.
  14963. This filter does the reverse of @ref{tile}.
  14964. The filter accepts the following options:
  14965. @table @option
  14966. @item layout
  14967. Set the grid size (i.e. the number of lines and columns). For the syntax of
  14968. this option, check the
  14969. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14970. @end table
  14971. @subsection Examples
  14972. @itemize
  14973. @item
  14974. Produce a 1-second video from a still image file made of 25 frames stacked
  14975. vertically, like an analogic film reel:
  14976. @example
  14977. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  14978. @end example
  14979. @end itemize
  14980. @section uspp
  14981. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  14982. the image at several (or - in the case of @option{quality} level @code{8} - all)
  14983. shifts and average the results.
  14984. The way this differs from the behavior of spp is that uspp actually encodes &
  14985. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  14986. DCT similar to MJPEG.
  14987. The filter accepts the following options:
  14988. @table @option
  14989. @item quality
  14990. Set quality. This option defines the number of levels for averaging. It accepts
  14991. an integer in the range 0-8. If set to @code{0}, the filter will have no
  14992. effect. A value of @code{8} means the higher quality. For each increment of
  14993. that value the speed drops by a factor of approximately 2. Default value is
  14994. @code{3}.
  14995. @item qp
  14996. Force a constant quantization parameter. If not set, the filter will use the QP
  14997. from the video stream (if available).
  14998. @end table
  14999. @section v360
  15000. Convert 360 videos between various formats.
  15001. The filter accepts the following options:
  15002. @table @option
  15003. @item input
  15004. @item output
  15005. Set format of the input/output video.
  15006. Available formats:
  15007. @table @samp
  15008. @item e
  15009. @item equirect
  15010. Equirectangular projection.
  15011. @item c3x2
  15012. @item c6x1
  15013. @item c1x6
  15014. Cubemap with 3x2/6x1/1x6 layout.
  15015. Format specific options:
  15016. @table @option
  15017. @item in_pad
  15018. @item out_pad
  15019. Set padding proportion for the input/output cubemap. Values in decimals.
  15020. Example values:
  15021. @table @samp
  15022. @item 0
  15023. No padding.
  15024. @item 0.01
  15025. 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)
  15026. @end table
  15027. Default value is @b{@samp{0}}.
  15028. Maximum value is @b{@samp{0.1}}.
  15029. @item fin_pad
  15030. @item fout_pad
  15031. Set fixed padding for the input/output cubemap. Values in pixels.
  15032. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  15033. @item in_forder
  15034. @item out_forder
  15035. Set order of faces for the input/output cubemap. Choose one direction for each position.
  15036. Designation of directions:
  15037. @table @samp
  15038. @item r
  15039. right
  15040. @item l
  15041. left
  15042. @item u
  15043. up
  15044. @item d
  15045. down
  15046. @item f
  15047. forward
  15048. @item b
  15049. back
  15050. @end table
  15051. Default value is @b{@samp{rludfb}}.
  15052. @item in_frot
  15053. @item out_frot
  15054. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  15055. Designation of angles:
  15056. @table @samp
  15057. @item 0
  15058. 0 degrees clockwise
  15059. @item 1
  15060. 90 degrees clockwise
  15061. @item 2
  15062. 180 degrees clockwise
  15063. @item 3
  15064. 270 degrees clockwise
  15065. @end table
  15066. Default value is @b{@samp{000000}}.
  15067. @end table
  15068. @item eac
  15069. Equi-Angular Cubemap.
  15070. @item flat
  15071. @item gnomonic
  15072. @item rectilinear
  15073. Regular video.
  15074. Format specific options:
  15075. @table @option
  15076. @item h_fov
  15077. @item v_fov
  15078. @item d_fov
  15079. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15080. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15081. @item ih_fov
  15082. @item iv_fov
  15083. @item id_fov
  15084. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15085. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15086. @end table
  15087. @item dfisheye
  15088. Dual fisheye.
  15089. Format specific options:
  15090. @table @option
  15091. @item h_fov
  15092. @item v_fov
  15093. @item d_fov
  15094. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15095. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15096. @item ih_fov
  15097. @item iv_fov
  15098. @item id_fov
  15099. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15100. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15101. @end table
  15102. @item barrel
  15103. @item fb
  15104. @item barrelsplit
  15105. Facebook's 360 formats.
  15106. @item sg
  15107. Stereographic format.
  15108. Format specific options:
  15109. @table @option
  15110. @item h_fov
  15111. @item v_fov
  15112. @item d_fov
  15113. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15114. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15115. @item ih_fov
  15116. @item iv_fov
  15117. @item id_fov
  15118. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15119. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15120. @end table
  15121. @item mercator
  15122. Mercator format.
  15123. @item ball
  15124. Ball format, gives significant distortion toward the back.
  15125. @item hammer
  15126. Hammer-Aitoff map projection format.
  15127. @item sinusoidal
  15128. Sinusoidal map projection format.
  15129. @item fisheye
  15130. Fisheye projection.
  15131. Format specific options:
  15132. @table @option
  15133. @item h_fov
  15134. @item v_fov
  15135. @item d_fov
  15136. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15137. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15138. @item ih_fov
  15139. @item iv_fov
  15140. @item id_fov
  15141. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15142. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15143. @end table
  15144. @item pannini
  15145. Pannini projection.
  15146. Format specific options:
  15147. @table @option
  15148. @item h_fov
  15149. Set output pannini parameter.
  15150. @item ih_fov
  15151. Set input pannini parameter.
  15152. @end table
  15153. @item cylindrical
  15154. Cylindrical projection.
  15155. Format specific options:
  15156. @table @option
  15157. @item h_fov
  15158. @item v_fov
  15159. @item d_fov
  15160. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15161. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15162. @item ih_fov
  15163. @item iv_fov
  15164. @item id_fov
  15165. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15166. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15167. @end table
  15168. @item perspective
  15169. Perspective projection. @i{(output only)}
  15170. Format specific options:
  15171. @table @option
  15172. @item v_fov
  15173. Set perspective parameter.
  15174. @end table
  15175. @item tetrahedron
  15176. Tetrahedron projection.
  15177. @item tsp
  15178. Truncated square pyramid projection.
  15179. @item he
  15180. @item hequirect
  15181. Half equirectangular projection.
  15182. @item equisolid
  15183. Equisolid format.
  15184. Format specific options:
  15185. @table @option
  15186. @item h_fov
  15187. @item v_fov
  15188. @item d_fov
  15189. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15190. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15191. @item ih_fov
  15192. @item iv_fov
  15193. @item id_fov
  15194. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15195. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15196. @end table
  15197. @item og
  15198. Orthographic format.
  15199. Format specific options:
  15200. @table @option
  15201. @item h_fov
  15202. @item v_fov
  15203. @item d_fov
  15204. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  15205. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15206. @item ih_fov
  15207. @item iv_fov
  15208. @item id_fov
  15209. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  15210. If diagonal field of view is set it overrides horizontal and vertical field of view.
  15211. @end table
  15212. @item octahedron
  15213. Octahedron projection.
  15214. @end table
  15215. @item interp
  15216. Set interpolation method.@*
  15217. @i{Note: more complex interpolation methods require much more memory to run.}
  15218. Available methods:
  15219. @table @samp
  15220. @item near
  15221. @item nearest
  15222. Nearest neighbour.
  15223. @item line
  15224. @item linear
  15225. Bilinear interpolation.
  15226. @item lagrange9
  15227. Lagrange9 interpolation.
  15228. @item cube
  15229. @item cubic
  15230. Bicubic interpolation.
  15231. @item lanc
  15232. @item lanczos
  15233. Lanczos interpolation.
  15234. @item sp16
  15235. @item spline16
  15236. Spline16 interpolation.
  15237. @item gauss
  15238. @item gaussian
  15239. Gaussian interpolation.
  15240. @item mitchell
  15241. Mitchell interpolation.
  15242. @end table
  15243. Default value is @b{@samp{line}}.
  15244. @item w
  15245. @item h
  15246. Set the output video resolution.
  15247. Default resolution depends on formats.
  15248. @item in_stereo
  15249. @item out_stereo
  15250. Set the input/output stereo format.
  15251. @table @samp
  15252. @item 2d
  15253. 2D mono
  15254. @item sbs
  15255. Side by side
  15256. @item tb
  15257. Top bottom
  15258. @end table
  15259. Default value is @b{@samp{2d}} for input and output format.
  15260. @item yaw
  15261. @item pitch
  15262. @item roll
  15263. Set rotation for the output video. Values in degrees.
  15264. @item rorder
  15265. Set rotation order for the output video. Choose one item for each position.
  15266. @table @samp
  15267. @item y, Y
  15268. yaw
  15269. @item p, P
  15270. pitch
  15271. @item r, R
  15272. roll
  15273. @end table
  15274. Default value is @b{@samp{ypr}}.
  15275. @item h_flip
  15276. @item v_flip
  15277. @item d_flip
  15278. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  15279. @item ih_flip
  15280. @item iv_flip
  15281. Set if input video is flipped horizontally/vertically. Boolean values.
  15282. @item in_trans
  15283. Set if input video is transposed. Boolean value, by default disabled.
  15284. @item out_trans
  15285. Set if output video needs to be transposed. Boolean value, by default disabled.
  15286. @item alpha_mask
  15287. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  15288. @end table
  15289. @subsection Examples
  15290. @itemize
  15291. @item
  15292. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  15293. @example
  15294. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  15295. @end example
  15296. @item
  15297. Extract back view of Equi-Angular Cubemap:
  15298. @example
  15299. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  15300. @end example
  15301. @item
  15302. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  15303. @example
  15304. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  15305. @end example
  15306. @end itemize
  15307. @subsection Commands
  15308. This filter supports subset of above options as @ref{commands}.
  15309. @section vaguedenoiser
  15310. Apply a wavelet based denoiser.
  15311. It transforms each frame from the video input into the wavelet domain,
  15312. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  15313. the obtained coefficients. It does an inverse wavelet transform after.
  15314. Due to wavelet properties, it should give a nice smoothed result, and
  15315. reduced noise, without blurring picture features.
  15316. This filter accepts the following options:
  15317. @table @option
  15318. @item threshold
  15319. The filtering strength. The higher, the more filtered the video will be.
  15320. Hard thresholding can use a higher threshold than soft thresholding
  15321. before the video looks overfiltered. Default value is 2.
  15322. @item method
  15323. The filtering method the filter will use.
  15324. It accepts the following values:
  15325. @table @samp
  15326. @item hard
  15327. All values under the threshold will be zeroed.
  15328. @item soft
  15329. All values under the threshold will be zeroed. All values above will be
  15330. reduced by the threshold.
  15331. @item garrote
  15332. Scales or nullifies coefficients - intermediary between (more) soft and
  15333. (less) hard thresholding.
  15334. @end table
  15335. Default is garrote.
  15336. @item nsteps
  15337. Number of times, the wavelet will decompose the picture. Picture can't
  15338. be decomposed beyond a particular point (typically, 8 for a 640x480
  15339. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  15340. @item percent
  15341. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  15342. @item planes
  15343. A list of the planes to process. By default all planes are processed.
  15344. @item type
  15345. The threshold type the filter will use.
  15346. It accepts the following values:
  15347. @table @samp
  15348. @item universal
  15349. Threshold used is same for all decompositions.
  15350. @item bayes
  15351. Threshold used depends also on each decomposition coefficients.
  15352. @end table
  15353. Default is universal.
  15354. @end table
  15355. @section vectorscope
  15356. Display 2 color component values in the two dimensional graph (which is called
  15357. a vectorscope).
  15358. This filter accepts the following options:
  15359. @table @option
  15360. @item mode, m
  15361. Set vectorscope mode.
  15362. It accepts the following values:
  15363. @table @samp
  15364. @item gray
  15365. @item tint
  15366. Gray values are displayed on graph, higher brightness means more pixels have
  15367. same component color value on location in graph. This is the default mode.
  15368. @item color
  15369. Gray values are displayed on graph. Surrounding pixels values which are not
  15370. present in video frame are drawn in gradient of 2 color components which are
  15371. set by option @code{x} and @code{y}. The 3rd color component is static.
  15372. @item color2
  15373. Actual color components values present in video frame are displayed on graph.
  15374. @item color3
  15375. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  15376. on graph increases value of another color component, which is luminance by
  15377. default values of @code{x} and @code{y}.
  15378. @item color4
  15379. Actual colors present in video frame are displayed on graph. If two different
  15380. colors map to same position on graph then color with higher value of component
  15381. not present in graph is picked.
  15382. @item color5
  15383. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  15384. component picked from radial gradient.
  15385. @end table
  15386. @item x
  15387. Set which color component will be represented on X-axis. Default is @code{1}.
  15388. @item y
  15389. Set which color component will be represented on Y-axis. Default is @code{2}.
  15390. @item intensity, i
  15391. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  15392. of color component which represents frequency of (X, Y) location in graph.
  15393. @item envelope, e
  15394. @table @samp
  15395. @item none
  15396. No envelope, this is default.
  15397. @item instant
  15398. Instant envelope, even darkest single pixel will be clearly highlighted.
  15399. @item peak
  15400. Hold maximum and minimum values presented in graph over time. This way you
  15401. can still spot out of range values without constantly looking at vectorscope.
  15402. @item peak+instant
  15403. Peak and instant envelope combined together.
  15404. @end table
  15405. @item graticule, g
  15406. Set what kind of graticule to draw.
  15407. @table @samp
  15408. @item none
  15409. @item green
  15410. @item color
  15411. @item invert
  15412. @end table
  15413. @item opacity, o
  15414. Set graticule opacity.
  15415. @item flags, f
  15416. Set graticule flags.
  15417. @table @samp
  15418. @item white
  15419. Draw graticule for white point.
  15420. @item black
  15421. Draw graticule for black point.
  15422. @item name
  15423. Draw color points short names.
  15424. @end table
  15425. @item bgopacity, b
  15426. Set background opacity.
  15427. @item lthreshold, l
  15428. Set low threshold for color component not represented on X or Y axis.
  15429. Values lower than this value will be ignored. Default is 0.
  15430. Note this value is multiplied with actual max possible value one pixel component
  15431. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  15432. is 0.1 * 255 = 25.
  15433. @item hthreshold, h
  15434. Set high threshold for color component not represented on X or Y axis.
  15435. Values higher than this value will be ignored. Default is 1.
  15436. Note this value is multiplied with actual max possible value one pixel component
  15437. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  15438. is 0.9 * 255 = 230.
  15439. @item colorspace, c
  15440. Set what kind of colorspace to use when drawing graticule.
  15441. @table @samp
  15442. @item auto
  15443. @item 601
  15444. @item 709
  15445. @end table
  15446. Default is auto.
  15447. @item tint0, t0
  15448. @item tint1, t1
  15449. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  15450. This means no tint, and output will remain gray.
  15451. @end table
  15452. @anchor{vidstabdetect}
  15453. @section vidstabdetect
  15454. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  15455. @ref{vidstabtransform} for pass 2.
  15456. This filter generates a file with relative translation and rotation
  15457. transform information about subsequent frames, which is then used by
  15458. the @ref{vidstabtransform} filter.
  15459. To enable compilation of this filter you need to configure FFmpeg with
  15460. @code{--enable-libvidstab}.
  15461. This filter accepts the following options:
  15462. @table @option
  15463. @item result
  15464. Set the path to the file used to write the transforms information.
  15465. Default value is @file{transforms.trf}.
  15466. @item shakiness
  15467. Set how shaky the video is and how quick the camera is. It accepts an
  15468. integer in the range 1-10, a value of 1 means little shakiness, a
  15469. value of 10 means strong shakiness. Default value is 5.
  15470. @item accuracy
  15471. Set the accuracy of the detection process. It must be a value in the
  15472. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  15473. accuracy. Default value is 15.
  15474. @item stepsize
  15475. Set stepsize of the search process. The region around minimum is
  15476. scanned with 1 pixel resolution. Default value is 6.
  15477. @item mincontrast
  15478. Set minimum contrast. Below this value a local measurement field is
  15479. discarded. Must be a floating point value in the range 0-1. Default
  15480. value is 0.3.
  15481. @item tripod
  15482. Set reference frame number for tripod mode.
  15483. If enabled, the motion of the frames is compared to a reference frame
  15484. in the filtered stream, identified by the specified number. The idea
  15485. is to compensate all movements in a more-or-less static scene and keep
  15486. the camera view absolutely still.
  15487. If set to 0, it is disabled. The frames are counted starting from 1.
  15488. @item show
  15489. Show fields and transforms in the resulting frames. It accepts an
  15490. integer in the range 0-2. Default value is 0, which disables any
  15491. visualization.
  15492. @end table
  15493. @subsection Examples
  15494. @itemize
  15495. @item
  15496. Use default values:
  15497. @example
  15498. vidstabdetect
  15499. @end example
  15500. @item
  15501. Analyze strongly shaky movie and put the results in file
  15502. @file{mytransforms.trf}:
  15503. @example
  15504. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  15505. @end example
  15506. @item
  15507. Visualize the result of internal transformations in the resulting
  15508. video:
  15509. @example
  15510. vidstabdetect=show=1
  15511. @end example
  15512. @item
  15513. Analyze a video with medium shakiness using @command{ffmpeg}:
  15514. @example
  15515. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  15516. @end example
  15517. @end itemize
  15518. @anchor{vidstabtransform}
  15519. @section vidstabtransform
  15520. Video stabilization/deshaking: pass 2 of 2,
  15521. see @ref{vidstabdetect} for pass 1.
  15522. Read a file with transform information for each frame and
  15523. apply/compensate them. Together with the @ref{vidstabdetect}
  15524. filter this can be used to deshake videos. See also
  15525. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  15526. the @ref{unsharp} filter, see below.
  15527. To enable compilation of this filter you need to configure FFmpeg with
  15528. @code{--enable-libvidstab}.
  15529. @subsection Options
  15530. @table @option
  15531. @item input
  15532. Set path to the file used to read the transforms. Default value is
  15533. @file{transforms.trf}.
  15534. @item smoothing
  15535. Set the number of frames (value*2 + 1) used for lowpass filtering the
  15536. camera movements. Default value is 10.
  15537. For example a number of 10 means that 21 frames are used (10 in the
  15538. past and 10 in the future) to smoothen the motion in the video. A
  15539. larger value leads to a smoother video, but limits the acceleration of
  15540. the camera (pan/tilt movements). 0 is a special case where a static
  15541. camera is simulated.
  15542. @item optalgo
  15543. Set the camera path optimization algorithm.
  15544. Accepted values are:
  15545. @table @samp
  15546. @item gauss
  15547. gaussian kernel low-pass filter on camera motion (default)
  15548. @item avg
  15549. averaging on transformations
  15550. @end table
  15551. @item maxshift
  15552. Set maximal number of pixels to translate frames. Default value is -1,
  15553. meaning no limit.
  15554. @item maxangle
  15555. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  15556. value is -1, meaning no limit.
  15557. @item crop
  15558. Specify how to deal with borders that may be visible due to movement
  15559. compensation.
  15560. Available values are:
  15561. @table @samp
  15562. @item keep
  15563. keep image information from previous frame (default)
  15564. @item black
  15565. fill the border black
  15566. @end table
  15567. @item invert
  15568. Invert transforms if set to 1. Default value is 0.
  15569. @item relative
  15570. Consider transforms as relative to previous frame if set to 1,
  15571. absolute if set to 0. Default value is 0.
  15572. @item zoom
  15573. Set percentage to zoom. A positive value will result in a zoom-in
  15574. effect, a negative value in a zoom-out effect. Default value is 0 (no
  15575. zoom).
  15576. @item optzoom
  15577. Set optimal zooming to avoid borders.
  15578. Accepted values are:
  15579. @table @samp
  15580. @item 0
  15581. disabled
  15582. @item 1
  15583. optimal static zoom value is determined (only very strong movements
  15584. will lead to visible borders) (default)
  15585. @item 2
  15586. optimal adaptive zoom value is determined (no borders will be
  15587. visible), see @option{zoomspeed}
  15588. @end table
  15589. Note that the value given at zoom is added to the one calculated here.
  15590. @item zoomspeed
  15591. Set percent to zoom maximally each frame (enabled when
  15592. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  15593. 0.25.
  15594. @item interpol
  15595. Specify type of interpolation.
  15596. Available values are:
  15597. @table @samp
  15598. @item no
  15599. no interpolation
  15600. @item linear
  15601. linear only horizontal
  15602. @item bilinear
  15603. linear in both directions (default)
  15604. @item bicubic
  15605. cubic in both directions (slow)
  15606. @end table
  15607. @item tripod
  15608. Enable virtual tripod mode if set to 1, which is equivalent to
  15609. @code{relative=0:smoothing=0}. Default value is 0.
  15610. Use also @code{tripod} option of @ref{vidstabdetect}.
  15611. @item debug
  15612. Increase log verbosity if set to 1. Also the detected global motions
  15613. are written to the temporary file @file{global_motions.trf}. Default
  15614. value is 0.
  15615. @end table
  15616. @subsection Examples
  15617. @itemize
  15618. @item
  15619. Use @command{ffmpeg} for a typical stabilization with default values:
  15620. @example
  15621. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  15622. @end example
  15623. Note the use of the @ref{unsharp} filter which is always recommended.
  15624. @item
  15625. Zoom in a bit more and load transform data from a given file:
  15626. @example
  15627. vidstabtransform=zoom=5:input="mytransforms.trf"
  15628. @end example
  15629. @item
  15630. Smoothen the video even more:
  15631. @example
  15632. vidstabtransform=smoothing=30
  15633. @end example
  15634. @end itemize
  15635. @section vflip
  15636. Flip the input video vertically.
  15637. For example, to vertically flip a video with @command{ffmpeg}:
  15638. @example
  15639. ffmpeg -i in.avi -vf "vflip" out.avi
  15640. @end example
  15641. @section vfrdet
  15642. Detect variable frame rate video.
  15643. This filter tries to detect if the input is variable or constant frame rate.
  15644. At end it will output number of frames detected as having variable delta pts,
  15645. and ones with constant delta pts.
  15646. If there was frames with variable delta, than it will also show min, max and
  15647. average delta encountered.
  15648. @section vibrance
  15649. Boost or alter saturation.
  15650. The filter accepts the following options:
  15651. @table @option
  15652. @item intensity
  15653. Set strength of boost if positive value or strength of alter if negative value.
  15654. Default is 0. Allowed range is from -2 to 2.
  15655. @item rbal
  15656. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  15657. @item gbal
  15658. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  15659. @item bbal
  15660. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  15661. @item rlum
  15662. Set the red luma coefficient.
  15663. @item glum
  15664. Set the green luma coefficient.
  15665. @item blum
  15666. Set the blue luma coefficient.
  15667. @item alternate
  15668. If @code{intensity} is negative and this is set to 1, colors will change,
  15669. otherwise colors will be less saturated, more towards gray.
  15670. @end table
  15671. @subsection Commands
  15672. This filter supports the all above options as @ref{commands}.
  15673. @anchor{vignette}
  15674. @section vignette
  15675. Make or reverse a natural vignetting effect.
  15676. The filter accepts the following options:
  15677. @table @option
  15678. @item angle, a
  15679. Set lens angle expression as a number of radians.
  15680. The value is clipped in the @code{[0,PI/2]} range.
  15681. Default value: @code{"PI/5"}
  15682. @item x0
  15683. @item y0
  15684. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  15685. by default.
  15686. @item mode
  15687. Set forward/backward mode.
  15688. Available modes are:
  15689. @table @samp
  15690. @item forward
  15691. The larger the distance from the central point, the darker the image becomes.
  15692. @item backward
  15693. The larger the distance from the central point, the brighter the image becomes.
  15694. This can be used to reverse a vignette effect, though there is no automatic
  15695. detection to extract the lens @option{angle} and other settings (yet). It can
  15696. also be used to create a burning effect.
  15697. @end table
  15698. Default value is @samp{forward}.
  15699. @item eval
  15700. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  15701. It accepts the following values:
  15702. @table @samp
  15703. @item init
  15704. Evaluate expressions only once during the filter initialization.
  15705. @item frame
  15706. Evaluate expressions for each incoming frame. This is way slower than the
  15707. @samp{init} mode since it requires all the scalers to be re-computed, but it
  15708. allows advanced dynamic expressions.
  15709. @end table
  15710. Default value is @samp{init}.
  15711. @item dither
  15712. Set dithering to reduce the circular banding effects. Default is @code{1}
  15713. (enabled).
  15714. @item aspect
  15715. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  15716. Setting this value to the SAR of the input will make a rectangular vignetting
  15717. following the dimensions of the video.
  15718. Default is @code{1/1}.
  15719. @end table
  15720. @subsection Expressions
  15721. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  15722. following parameters.
  15723. @table @option
  15724. @item w
  15725. @item h
  15726. input width and height
  15727. @item n
  15728. the number of input frame, starting from 0
  15729. @item pts
  15730. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  15731. @var{TB} units, NAN if undefined
  15732. @item r
  15733. frame rate of the input video, NAN if the input frame rate is unknown
  15734. @item t
  15735. the PTS (Presentation TimeStamp) of the filtered video frame,
  15736. expressed in seconds, NAN if undefined
  15737. @item tb
  15738. time base of the input video
  15739. @end table
  15740. @subsection Examples
  15741. @itemize
  15742. @item
  15743. Apply simple strong vignetting effect:
  15744. @example
  15745. vignette=PI/4
  15746. @end example
  15747. @item
  15748. Make a flickering vignetting:
  15749. @example
  15750. vignette='PI/4+random(1)*PI/50':eval=frame
  15751. @end example
  15752. @end itemize
  15753. @section vmafmotion
  15754. Obtain the average VMAF motion score of a video.
  15755. It is one of the component metrics of VMAF.
  15756. The obtained average motion score is printed through the logging system.
  15757. The filter accepts the following options:
  15758. @table @option
  15759. @item stats_file
  15760. If specified, the filter will use the named file to save the motion score of
  15761. each frame with respect to the previous frame.
  15762. When filename equals "-" the data is sent to standard output.
  15763. @end table
  15764. Example:
  15765. @example
  15766. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  15767. @end example
  15768. @section vstack
  15769. Stack input videos vertically.
  15770. All streams must be of same pixel format and of same width.
  15771. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  15772. to create same output.
  15773. The filter accepts the following options:
  15774. @table @option
  15775. @item inputs
  15776. Set number of input streams. Default is 2.
  15777. @item shortest
  15778. If set to 1, force the output to terminate when the shortest input
  15779. terminates. Default value is 0.
  15780. @end table
  15781. @section w3fdif
  15782. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  15783. Deinterlacing Filter").
  15784. Based on the process described by Martin Weston for BBC R&D, and
  15785. implemented based on the de-interlace algorithm written by Jim
  15786. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  15787. uses filter coefficients calculated by BBC R&D.
  15788. This filter uses field-dominance information in frame to decide which
  15789. of each pair of fields to place first in the output.
  15790. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  15791. There are two sets of filter coefficients, so called "simple"
  15792. and "complex". Which set of filter coefficients is used can
  15793. be set by passing an optional parameter:
  15794. @table @option
  15795. @item filter
  15796. Set the interlacing filter coefficients. Accepts one of the following values:
  15797. @table @samp
  15798. @item simple
  15799. Simple filter coefficient set.
  15800. @item complex
  15801. More-complex filter coefficient set.
  15802. @end table
  15803. Default value is @samp{complex}.
  15804. @item deint
  15805. Specify which frames to deinterlace. Accepts one of the following values:
  15806. @table @samp
  15807. @item all
  15808. Deinterlace all frames,
  15809. @item interlaced
  15810. Only deinterlace frames marked as interlaced.
  15811. @end table
  15812. Default value is @samp{all}.
  15813. @end table
  15814. @section waveform
  15815. Video waveform monitor.
  15816. The waveform monitor plots color component intensity. By default luminance
  15817. only. Each column of the waveform corresponds to a column of pixels in the
  15818. source video.
  15819. It accepts the following options:
  15820. @table @option
  15821. @item mode, m
  15822. Can be either @code{row}, or @code{column}. Default is @code{column}.
  15823. In row mode, the graph on the left side represents color component value 0 and
  15824. the right side represents value = 255. In column mode, the top side represents
  15825. color component value = 0 and bottom side represents value = 255.
  15826. @item intensity, i
  15827. Set intensity. Smaller values are useful to find out how many values of the same
  15828. luminance are distributed across input rows/columns.
  15829. Default value is @code{0.04}. Allowed range is [0, 1].
  15830. @item mirror, r
  15831. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  15832. In mirrored mode, higher values will be represented on the left
  15833. side for @code{row} mode and at the top for @code{column} mode. Default is
  15834. @code{1} (mirrored).
  15835. @item display, d
  15836. Set display mode.
  15837. It accepts the following values:
  15838. @table @samp
  15839. @item overlay
  15840. Presents information identical to that in the @code{parade}, except
  15841. that the graphs representing color components are superimposed directly
  15842. over one another.
  15843. This display mode makes it easier to spot relative differences or similarities
  15844. in overlapping areas of the color components that are supposed to be identical,
  15845. such as neutral whites, grays, or blacks.
  15846. @item stack
  15847. Display separate graph for the color components side by side in
  15848. @code{row} mode or one below the other in @code{column} mode.
  15849. @item parade
  15850. Display separate graph for the color components side by side in
  15851. @code{column} mode or one below the other in @code{row} mode.
  15852. Using this display mode makes it easy to spot color casts in the highlights
  15853. and shadows of an image, by comparing the contours of the top and the bottom
  15854. graphs of each waveform. Since whites, grays, and blacks are characterized
  15855. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  15856. should display three waveforms of roughly equal width/height. If not, the
  15857. correction is easy to perform by making level adjustments the three waveforms.
  15858. @end table
  15859. Default is @code{stack}.
  15860. @item components, c
  15861. Set which color components to display. Default is 1, which means only luminance
  15862. or red color component if input is in RGB colorspace. If is set for example to
  15863. 7 it will display all 3 (if) available color components.
  15864. @item envelope, e
  15865. @table @samp
  15866. @item none
  15867. No envelope, this is default.
  15868. @item instant
  15869. Instant envelope, minimum and maximum values presented in graph will be easily
  15870. visible even with small @code{step} value.
  15871. @item peak
  15872. Hold minimum and maximum values presented in graph across time. This way you
  15873. can still spot out of range values without constantly looking at waveforms.
  15874. @item peak+instant
  15875. Peak and instant envelope combined together.
  15876. @end table
  15877. @item filter, f
  15878. @table @samp
  15879. @item lowpass
  15880. No filtering, this is default.
  15881. @item flat
  15882. Luma and chroma combined together.
  15883. @item aflat
  15884. Similar as above, but shows difference between blue and red chroma.
  15885. @item xflat
  15886. Similar as above, but use different colors.
  15887. @item yflat
  15888. Similar as above, but again with different colors.
  15889. @item chroma
  15890. Displays only chroma.
  15891. @item color
  15892. Displays actual color value on waveform.
  15893. @item acolor
  15894. Similar as above, but with luma showing frequency of chroma values.
  15895. @end table
  15896. @item graticule, g
  15897. Set which graticule to display.
  15898. @table @samp
  15899. @item none
  15900. Do not display graticule.
  15901. @item green
  15902. Display green graticule showing legal broadcast ranges.
  15903. @item orange
  15904. Display orange graticule showing legal broadcast ranges.
  15905. @item invert
  15906. Display invert graticule showing legal broadcast ranges.
  15907. @end table
  15908. @item opacity, o
  15909. Set graticule opacity.
  15910. @item flags, fl
  15911. Set graticule flags.
  15912. @table @samp
  15913. @item numbers
  15914. Draw numbers above lines. By default enabled.
  15915. @item dots
  15916. Draw dots instead of lines.
  15917. @end table
  15918. @item scale, s
  15919. Set scale used for displaying graticule.
  15920. @table @samp
  15921. @item digital
  15922. @item millivolts
  15923. @item ire
  15924. @end table
  15925. Default is digital.
  15926. @item bgopacity, b
  15927. Set background opacity.
  15928. @item tint0, t0
  15929. @item tint1, t1
  15930. Set tint for output.
  15931. Only used with lowpass filter and when display is not overlay and input
  15932. pixel formats are not RGB.
  15933. @end table
  15934. @section weave, doubleweave
  15935. The @code{weave} takes a field-based video input and join
  15936. each two sequential fields into single frame, producing a new double
  15937. height clip with half the frame rate and half the frame count.
  15938. The @code{doubleweave} works same as @code{weave} but without
  15939. halving frame rate and frame count.
  15940. It accepts the following option:
  15941. @table @option
  15942. @item first_field
  15943. Set first field. Available values are:
  15944. @table @samp
  15945. @item top, t
  15946. Set the frame as top-field-first.
  15947. @item bottom, b
  15948. Set the frame as bottom-field-first.
  15949. @end table
  15950. @end table
  15951. @subsection Examples
  15952. @itemize
  15953. @item
  15954. Interlace video using @ref{select} and @ref{separatefields} filter:
  15955. @example
  15956. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  15957. @end example
  15958. @end itemize
  15959. @section xbr
  15960. Apply the xBR high-quality magnification filter which is designed for pixel
  15961. art. It follows a set of edge-detection rules, see
  15962. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  15963. It accepts the following option:
  15964. @table @option
  15965. @item n
  15966. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  15967. @code{3xBR} and @code{4} for @code{4xBR}.
  15968. Default is @code{3}.
  15969. @end table
  15970. @section xfade
  15971. Apply cross fade from one input video stream to another input video stream.
  15972. The cross fade is applied for specified duration.
  15973. The filter accepts the following options:
  15974. @table @option
  15975. @item transition
  15976. Set one of available transition effects:
  15977. @table @samp
  15978. @item custom
  15979. @item fade
  15980. @item wipeleft
  15981. @item wiperight
  15982. @item wipeup
  15983. @item wipedown
  15984. @item slideleft
  15985. @item slideright
  15986. @item slideup
  15987. @item slidedown
  15988. @item circlecrop
  15989. @item rectcrop
  15990. @item distance
  15991. @item fadeblack
  15992. @item fadewhite
  15993. @item radial
  15994. @item smoothleft
  15995. @item smoothright
  15996. @item smoothup
  15997. @item smoothdown
  15998. @item circleopen
  15999. @item circleclose
  16000. @item vertopen
  16001. @item vertclose
  16002. @item horzopen
  16003. @item horzclose
  16004. @item dissolve
  16005. @item pixelize
  16006. @item diagtl
  16007. @item diagtr
  16008. @item diagbl
  16009. @item diagbr
  16010. @item hlslice
  16011. @item hrslice
  16012. @item vuslice
  16013. @item vdslice
  16014. @item hblur
  16015. @item fadegrays
  16016. @item wipetl
  16017. @item wipetr
  16018. @item wipebl
  16019. @item wipebr
  16020. @item squeezeh
  16021. @item squeezev
  16022. @end table
  16023. Default transition effect is fade.
  16024. @item duration
  16025. Set cross fade duration in seconds.
  16026. Default duration is 1 second.
  16027. @item offset
  16028. Set cross fade start relative to first input stream in seconds.
  16029. Default offset is 0.
  16030. @item expr
  16031. Set expression for custom transition effect.
  16032. The expressions can use the following variables and functions:
  16033. @table @option
  16034. @item X
  16035. @item Y
  16036. The coordinates of the current sample.
  16037. @item W
  16038. @item H
  16039. The width and height of the image.
  16040. @item P
  16041. Progress of transition effect.
  16042. @item PLANE
  16043. Currently processed plane.
  16044. @item A
  16045. Return value of first input at current location and plane.
  16046. @item B
  16047. Return value of second input at current location and plane.
  16048. @item a0(x, y)
  16049. @item a1(x, y)
  16050. @item a2(x, y)
  16051. @item a3(x, y)
  16052. Return the value of the pixel at location (@var{x},@var{y}) of the
  16053. first/second/third/fourth component of first input.
  16054. @item b0(x, y)
  16055. @item b1(x, y)
  16056. @item b2(x, y)
  16057. @item b3(x, y)
  16058. Return the value of the pixel at location (@var{x},@var{y}) of the
  16059. first/second/third/fourth component of second input.
  16060. @end table
  16061. @end table
  16062. @subsection Examples
  16063. @itemize
  16064. @item
  16065. Cross fade from one input video to another input video, with fade transition and duration of transition
  16066. of 2 seconds starting at offset of 5 seconds:
  16067. @example
  16068. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  16069. @end example
  16070. @end itemize
  16071. @section xmedian
  16072. Pick median pixels from several input videos.
  16073. The filter accepts the following options:
  16074. @table @option
  16075. @item inputs
  16076. Set number of inputs.
  16077. Default is 3. Allowed range is from 3 to 255.
  16078. If number of inputs is even number, than result will be mean value between two median values.
  16079. @item planes
  16080. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  16081. @item percentile
  16082. Set median percentile. Default value is @code{0.5}.
  16083. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  16084. minimum values, and @code{1} maximum values.
  16085. @end table
  16086. @section xstack
  16087. Stack video inputs into custom layout.
  16088. All streams must be of same pixel format.
  16089. The filter accepts the following options:
  16090. @table @option
  16091. @item inputs
  16092. Set number of input streams. Default is 2.
  16093. @item layout
  16094. Specify layout of inputs.
  16095. This option requires the desired layout configuration to be explicitly set by the user.
  16096. This sets position of each video input in output. Each input
  16097. is separated by '|'.
  16098. The first number represents the column, and the second number represents the row.
  16099. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  16100. where X is video input from which to take width or height.
  16101. Multiple values can be used when separated by '+'. In such
  16102. case values are summed together.
  16103. Note that if inputs are of different sizes gaps may appear, as not all of
  16104. the output video frame will be filled. Similarly, videos can overlap each
  16105. other if their position doesn't leave enough space for the full frame of
  16106. adjoining videos.
  16107. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  16108. a layout must be set by the user.
  16109. @item shortest
  16110. If set to 1, force the output to terminate when the shortest input
  16111. terminates. Default value is 0.
  16112. @item fill
  16113. If set to valid color, all unused pixels will be filled with that color.
  16114. By default fill is set to none, so it is disabled.
  16115. @end table
  16116. @subsection Examples
  16117. @itemize
  16118. @item
  16119. Display 4 inputs into 2x2 grid.
  16120. Layout:
  16121. @example
  16122. input1(0, 0) | input3(w0, 0)
  16123. input2(0, h0) | input4(w0, h0)
  16124. @end example
  16125. @example
  16126. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  16127. @end example
  16128. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16129. @item
  16130. Display 4 inputs into 1x4 grid.
  16131. Layout:
  16132. @example
  16133. input1(0, 0)
  16134. input2(0, h0)
  16135. input3(0, h0+h1)
  16136. input4(0, h0+h1+h2)
  16137. @end example
  16138. @example
  16139. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  16140. @end example
  16141. Note that if inputs are of different widths, unused space will appear.
  16142. @item
  16143. Display 9 inputs into 3x3 grid.
  16144. Layout:
  16145. @example
  16146. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  16147. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  16148. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  16149. @end example
  16150. @example
  16151. 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
  16152. @end example
  16153. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16154. @item
  16155. Display 16 inputs into 4x4 grid.
  16156. Layout:
  16157. @example
  16158. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  16159. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  16160. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  16161. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  16162. @end example
  16163. @example
  16164. 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|
  16165. 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
  16166. @end example
  16167. Note that if inputs are of different sizes, gaps or overlaps may occur.
  16168. @end itemize
  16169. @anchor{yadif}
  16170. @section yadif
  16171. Deinterlace the input video ("yadif" means "yet another deinterlacing
  16172. filter").
  16173. It accepts the following parameters:
  16174. @table @option
  16175. @item mode
  16176. The interlacing mode to adopt. It accepts one of the following values:
  16177. @table @option
  16178. @item 0, send_frame
  16179. Output one frame for each frame.
  16180. @item 1, send_field
  16181. Output one frame for each field.
  16182. @item 2, send_frame_nospatial
  16183. Like @code{send_frame}, but it skips the spatial interlacing check.
  16184. @item 3, send_field_nospatial
  16185. Like @code{send_field}, but it skips the spatial interlacing check.
  16186. @end table
  16187. The default value is @code{send_frame}.
  16188. @item parity
  16189. The picture field parity assumed for the input interlaced video. It accepts one
  16190. of the following values:
  16191. @table @option
  16192. @item 0, tff
  16193. Assume the top field is first.
  16194. @item 1, bff
  16195. Assume the bottom field is first.
  16196. @item -1, auto
  16197. Enable automatic detection of field parity.
  16198. @end table
  16199. The default value is @code{auto}.
  16200. If the interlacing is unknown or the decoder does not export this information,
  16201. top field first will be assumed.
  16202. @item deint
  16203. Specify which frames to deinterlace. Accepts one of the following
  16204. values:
  16205. @table @option
  16206. @item 0, all
  16207. Deinterlace all frames.
  16208. @item 1, interlaced
  16209. Only deinterlace frames marked as interlaced.
  16210. @end table
  16211. The default value is @code{all}.
  16212. @end table
  16213. @section yadif_cuda
  16214. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  16215. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  16216. and/or nvenc.
  16217. It accepts the following parameters:
  16218. @table @option
  16219. @item mode
  16220. The interlacing mode to adopt. It accepts one of the following values:
  16221. @table @option
  16222. @item 0, send_frame
  16223. Output one frame for each frame.
  16224. @item 1, send_field
  16225. Output one frame for each field.
  16226. @item 2, send_frame_nospatial
  16227. Like @code{send_frame}, but it skips the spatial interlacing check.
  16228. @item 3, send_field_nospatial
  16229. Like @code{send_field}, but it skips the spatial interlacing check.
  16230. @end table
  16231. The default value is @code{send_frame}.
  16232. @item parity
  16233. The picture field parity assumed for the input interlaced video. It accepts one
  16234. of the following values:
  16235. @table @option
  16236. @item 0, tff
  16237. Assume the top field is first.
  16238. @item 1, bff
  16239. Assume the bottom field is first.
  16240. @item -1, auto
  16241. Enable automatic detection of field parity.
  16242. @end table
  16243. The default value is @code{auto}.
  16244. If the interlacing is unknown or the decoder does not export this information,
  16245. top field first will be assumed.
  16246. @item deint
  16247. Specify which frames to deinterlace. Accepts one of the following
  16248. values:
  16249. @table @option
  16250. @item 0, all
  16251. Deinterlace all frames.
  16252. @item 1, interlaced
  16253. Only deinterlace frames marked as interlaced.
  16254. @end table
  16255. The default value is @code{all}.
  16256. @end table
  16257. @section yaepblur
  16258. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  16259. The algorithm is described in
  16260. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  16261. It accepts the following parameters:
  16262. @table @option
  16263. @item radius, r
  16264. Set the window radius. Default value is 3.
  16265. @item planes, p
  16266. Set which planes to filter. Default is only the first plane.
  16267. @item sigma, s
  16268. Set blur strength. Default value is 128.
  16269. @end table
  16270. @subsection Commands
  16271. This filter supports same @ref{commands} as options.
  16272. @section zoompan
  16273. Apply Zoom & Pan effect.
  16274. This filter accepts the following options:
  16275. @table @option
  16276. @item zoom, z
  16277. Set the zoom expression. Range is 1-10. Default is 1.
  16278. @item x
  16279. @item y
  16280. Set the x and y expression. Default is 0.
  16281. @item d
  16282. Set the duration expression in number of frames.
  16283. This sets for how many number of frames effect will last for
  16284. single input image.
  16285. @item s
  16286. Set the output image size, default is 'hd720'.
  16287. @item fps
  16288. Set the output frame rate, default is '25'.
  16289. @end table
  16290. Each expression can contain the following constants:
  16291. @table @option
  16292. @item in_w, iw
  16293. Input width.
  16294. @item in_h, ih
  16295. Input height.
  16296. @item out_w, ow
  16297. Output width.
  16298. @item out_h, oh
  16299. Output height.
  16300. @item in
  16301. Input frame count.
  16302. @item on
  16303. Output frame count.
  16304. @item in_time, it
  16305. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  16306. @item out_time, time, ot
  16307. The output timestamp expressed in seconds.
  16308. @item x
  16309. @item y
  16310. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  16311. for current input frame.
  16312. @item px
  16313. @item py
  16314. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  16315. not yet such frame (first input frame).
  16316. @item zoom
  16317. Last calculated zoom from 'z' expression for current input frame.
  16318. @item pzoom
  16319. Last calculated zoom of last output frame of previous input frame.
  16320. @item duration
  16321. Number of output frames for current input frame. Calculated from 'd' expression
  16322. for each input frame.
  16323. @item pduration
  16324. number of output frames created for previous input frame
  16325. @item a
  16326. Rational number: input width / input height
  16327. @item sar
  16328. sample aspect ratio
  16329. @item dar
  16330. display aspect ratio
  16331. @end table
  16332. @subsection Examples
  16333. @itemize
  16334. @item
  16335. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  16336. @example
  16337. 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
  16338. @end example
  16339. @item
  16340. Zoom in up to 1.5x and pan always at center of picture:
  16341. @example
  16342. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16343. @end example
  16344. @item
  16345. Same as above but without pausing:
  16346. @example
  16347. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16348. @end example
  16349. @item
  16350. Zoom in 2x into center of picture only for the first second of the input video:
  16351. @example
  16352. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  16353. @end example
  16354. @end itemize
  16355. @anchor{zscale}
  16356. @section zscale
  16357. Scale (resize) the input video, using the z.lib library:
  16358. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  16359. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  16360. The zscale filter forces the output display aspect ratio to be the same
  16361. as the input, by changing the output sample aspect ratio.
  16362. If the input image format is different from the format requested by
  16363. the next filter, the zscale filter will convert the input to the
  16364. requested format.
  16365. @subsection Options
  16366. The filter accepts the following options.
  16367. @table @option
  16368. @item width, w
  16369. @item height, h
  16370. Set the output video dimension expression. Default value is the input
  16371. dimension.
  16372. If the @var{width} or @var{w} value is 0, the input width is used for
  16373. the output. If the @var{height} or @var{h} value is 0, the input height
  16374. is used for the output.
  16375. If one and only one of the values is -n with n >= 1, the zscale filter
  16376. will use a value that maintains the aspect ratio of the input image,
  16377. calculated from the other specified dimension. After that it will,
  16378. however, make sure that the calculated dimension is divisible by n and
  16379. adjust the value if necessary.
  16380. If both values are -n with n >= 1, the behavior will be identical to
  16381. both values being set to 0 as previously detailed.
  16382. See below for the list of accepted constants for use in the dimension
  16383. expression.
  16384. @item size, s
  16385. Set the video size. For the syntax of this option, check the
  16386. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16387. @item dither, d
  16388. Set the dither type.
  16389. Possible values are:
  16390. @table @var
  16391. @item none
  16392. @item ordered
  16393. @item random
  16394. @item error_diffusion
  16395. @end table
  16396. Default is none.
  16397. @item filter, f
  16398. Set the resize filter type.
  16399. Possible values are:
  16400. @table @var
  16401. @item point
  16402. @item bilinear
  16403. @item bicubic
  16404. @item spline16
  16405. @item spline36
  16406. @item lanczos
  16407. @end table
  16408. Default is bilinear.
  16409. @item range, r
  16410. Set the color range.
  16411. Possible values are:
  16412. @table @var
  16413. @item input
  16414. @item limited
  16415. @item full
  16416. @end table
  16417. Default is same as input.
  16418. @item primaries, p
  16419. Set the color primaries.
  16420. Possible values are:
  16421. @table @var
  16422. @item input
  16423. @item 709
  16424. @item unspecified
  16425. @item 170m
  16426. @item 240m
  16427. @item 2020
  16428. @end table
  16429. Default is same as input.
  16430. @item transfer, t
  16431. Set the transfer characteristics.
  16432. Possible values are:
  16433. @table @var
  16434. @item input
  16435. @item 709
  16436. @item unspecified
  16437. @item 601
  16438. @item linear
  16439. @item 2020_10
  16440. @item 2020_12
  16441. @item smpte2084
  16442. @item iec61966-2-1
  16443. @item arib-std-b67
  16444. @end table
  16445. Default is same as input.
  16446. @item matrix, m
  16447. Set the colorspace matrix.
  16448. Possible value are:
  16449. @table @var
  16450. @item input
  16451. @item 709
  16452. @item unspecified
  16453. @item 470bg
  16454. @item 170m
  16455. @item 2020_ncl
  16456. @item 2020_cl
  16457. @end table
  16458. Default is same as input.
  16459. @item rangein, rin
  16460. Set the input color range.
  16461. Possible values are:
  16462. @table @var
  16463. @item input
  16464. @item limited
  16465. @item full
  16466. @end table
  16467. Default is same as input.
  16468. @item primariesin, pin
  16469. Set the input color primaries.
  16470. Possible values are:
  16471. @table @var
  16472. @item input
  16473. @item 709
  16474. @item unspecified
  16475. @item 170m
  16476. @item 240m
  16477. @item 2020
  16478. @end table
  16479. Default is same as input.
  16480. @item transferin, tin
  16481. Set the input transfer characteristics.
  16482. Possible values are:
  16483. @table @var
  16484. @item input
  16485. @item 709
  16486. @item unspecified
  16487. @item 601
  16488. @item linear
  16489. @item 2020_10
  16490. @item 2020_12
  16491. @end table
  16492. Default is same as input.
  16493. @item matrixin, min
  16494. Set the input colorspace matrix.
  16495. Possible value are:
  16496. @table @var
  16497. @item input
  16498. @item 709
  16499. @item unspecified
  16500. @item 470bg
  16501. @item 170m
  16502. @item 2020_ncl
  16503. @item 2020_cl
  16504. @end table
  16505. @item chromal, c
  16506. Set the output chroma location.
  16507. Possible values are:
  16508. @table @var
  16509. @item input
  16510. @item left
  16511. @item center
  16512. @item topleft
  16513. @item top
  16514. @item bottomleft
  16515. @item bottom
  16516. @end table
  16517. @item chromalin, cin
  16518. Set the input chroma location.
  16519. Possible values are:
  16520. @table @var
  16521. @item input
  16522. @item left
  16523. @item center
  16524. @item topleft
  16525. @item top
  16526. @item bottomleft
  16527. @item bottom
  16528. @end table
  16529. @item npl
  16530. Set the nominal peak luminance.
  16531. @end table
  16532. The values of the @option{w} and @option{h} options are expressions
  16533. containing the following constants:
  16534. @table @var
  16535. @item in_w
  16536. @item in_h
  16537. The input width and height
  16538. @item iw
  16539. @item ih
  16540. These are the same as @var{in_w} and @var{in_h}.
  16541. @item out_w
  16542. @item out_h
  16543. The output (scaled) width and height
  16544. @item ow
  16545. @item oh
  16546. These are the same as @var{out_w} and @var{out_h}
  16547. @item a
  16548. The same as @var{iw} / @var{ih}
  16549. @item sar
  16550. input sample aspect ratio
  16551. @item dar
  16552. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16553. @item hsub
  16554. @item vsub
  16555. horizontal and vertical input chroma subsample values. For example for the
  16556. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16557. @item ohsub
  16558. @item ovsub
  16559. horizontal and vertical output chroma subsample values. For example for the
  16560. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16561. @end table
  16562. @subsection Commands
  16563. This filter supports the following commands:
  16564. @table @option
  16565. @item width, w
  16566. @item height, h
  16567. Set the output video dimension expression.
  16568. The command accepts the same syntax of the corresponding option.
  16569. If the specified expression is not valid, it is kept at its current
  16570. value.
  16571. @end table
  16572. @c man end VIDEO FILTERS
  16573. @chapter OpenCL Video Filters
  16574. @c man begin OPENCL VIDEO FILTERS
  16575. Below is a description of the currently available OpenCL video filters.
  16576. To enable compilation of these filters you need to configure FFmpeg with
  16577. @code{--enable-opencl}.
  16578. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  16579. @table @option
  16580. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  16581. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  16582. given device parameters.
  16583. @item -filter_hw_device @var{name}
  16584. Pass the hardware device called @var{name} to all filters in any filter graph.
  16585. @end table
  16586. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  16587. @itemize
  16588. @item
  16589. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  16590. @example
  16591. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  16592. @end example
  16593. @end itemize
  16594. 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.
  16595. @section avgblur_opencl
  16596. Apply average blur filter.
  16597. The filter accepts the following options:
  16598. @table @option
  16599. @item sizeX
  16600. Set horizontal radius size.
  16601. Range is @code{[1, 1024]} and default value is @code{1}.
  16602. @item planes
  16603. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16604. @item sizeY
  16605. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  16606. @end table
  16607. @subsection Example
  16608. @itemize
  16609. @item
  16610. 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.
  16611. @example
  16612. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  16613. @end example
  16614. @end itemize
  16615. @section boxblur_opencl
  16616. Apply a boxblur algorithm to the input video.
  16617. It accepts the following parameters:
  16618. @table @option
  16619. @item luma_radius, lr
  16620. @item luma_power, lp
  16621. @item chroma_radius, cr
  16622. @item chroma_power, cp
  16623. @item alpha_radius, ar
  16624. @item alpha_power, ap
  16625. @end table
  16626. A description of the accepted options follows.
  16627. @table @option
  16628. @item luma_radius, lr
  16629. @item chroma_radius, cr
  16630. @item alpha_radius, ar
  16631. Set an expression for the box radius in pixels used for blurring the
  16632. corresponding input plane.
  16633. The radius value must be a non-negative number, and must not be
  16634. greater than the value of the expression @code{min(w,h)/2} for the
  16635. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  16636. planes.
  16637. Default value for @option{luma_radius} is "2". If not specified,
  16638. @option{chroma_radius} and @option{alpha_radius} default to the
  16639. corresponding value set for @option{luma_radius}.
  16640. The expressions can contain the following constants:
  16641. @table @option
  16642. @item w
  16643. @item h
  16644. The input width and height in pixels.
  16645. @item cw
  16646. @item ch
  16647. The input chroma image width and height in pixels.
  16648. @item hsub
  16649. @item vsub
  16650. The horizontal and vertical chroma subsample values. For example, for the
  16651. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  16652. @end table
  16653. @item luma_power, lp
  16654. @item chroma_power, cp
  16655. @item alpha_power, ap
  16656. Specify how many times the boxblur filter is applied to the
  16657. corresponding plane.
  16658. Default value for @option{luma_power} is 2. If not specified,
  16659. @option{chroma_power} and @option{alpha_power} default to the
  16660. corresponding value set for @option{luma_power}.
  16661. A value of 0 will disable the effect.
  16662. @end table
  16663. @subsection Examples
  16664. 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.
  16665. @itemize
  16666. @item
  16667. Apply a boxblur filter with the luma, chroma, and alpha radius
  16668. 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.
  16669. @example
  16670. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  16671. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  16672. @end example
  16673. @item
  16674. 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.
  16675. For the luma plane, a 2x2 box radius will be run once.
  16676. For the chroma plane, a 4x4 box radius will be run 5 times.
  16677. For the alpha plane, a 3x3 box radius will be run 7 times.
  16678. @example
  16679. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  16680. @end example
  16681. @end itemize
  16682. @section colorkey_opencl
  16683. RGB colorspace color keying.
  16684. The filter accepts the following options:
  16685. @table @option
  16686. @item color
  16687. The color which will be replaced with transparency.
  16688. @item similarity
  16689. Similarity percentage with the key color.
  16690. 0.01 matches only the exact key color, while 1.0 matches everything.
  16691. @item blend
  16692. Blend percentage.
  16693. 0.0 makes pixels either fully transparent, or not transparent at all.
  16694. Higher values result in semi-transparent pixels, with a higher transparency
  16695. the more similar the pixels color is to the key color.
  16696. @end table
  16697. @subsection Examples
  16698. @itemize
  16699. @item
  16700. Make every semi-green pixel in the input transparent with some slight blending:
  16701. @example
  16702. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  16703. @end example
  16704. @end itemize
  16705. @section convolution_opencl
  16706. Apply convolution of 3x3, 5x5, 7x7 matrix.
  16707. The filter accepts the following options:
  16708. @table @option
  16709. @item 0m
  16710. @item 1m
  16711. @item 2m
  16712. @item 3m
  16713. Set matrix for each plane.
  16714. Matrix is sequence of 9, 25 or 49 signed numbers.
  16715. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  16716. @item 0rdiv
  16717. @item 1rdiv
  16718. @item 2rdiv
  16719. @item 3rdiv
  16720. Set multiplier for calculated value for each plane.
  16721. If unset or 0, it will be sum of all matrix elements.
  16722. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  16723. @item 0bias
  16724. @item 1bias
  16725. @item 2bias
  16726. @item 3bias
  16727. Set bias for each plane. This value is added to the result of the multiplication.
  16728. Useful for making the overall image brighter or darker.
  16729. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  16730. @end table
  16731. @subsection Examples
  16732. @itemize
  16733. @item
  16734. Apply sharpen:
  16735. @example
  16736. -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
  16737. @end example
  16738. @item
  16739. Apply blur:
  16740. @example
  16741. -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
  16742. @end example
  16743. @item
  16744. Apply edge enhance:
  16745. @example
  16746. -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
  16747. @end example
  16748. @item
  16749. Apply edge detect:
  16750. @example
  16751. -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
  16752. @end example
  16753. @item
  16754. Apply laplacian edge detector which includes diagonals:
  16755. @example
  16756. -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
  16757. @end example
  16758. @item
  16759. Apply emboss:
  16760. @example
  16761. -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
  16762. @end example
  16763. @end itemize
  16764. @section erosion_opencl
  16765. Apply erosion effect to the video.
  16766. This filter replaces the pixel by the local(3x3) minimum.
  16767. It accepts the following options:
  16768. @table @option
  16769. @item threshold0
  16770. @item threshold1
  16771. @item threshold2
  16772. @item threshold3
  16773. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16774. If @code{0}, plane will remain unchanged.
  16775. @item coordinates
  16776. Flag which specifies the pixel to refer to.
  16777. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16778. Flags to local 3x3 coordinates region centered on @code{x}:
  16779. 1 2 3
  16780. 4 x 5
  16781. 6 7 8
  16782. @end table
  16783. @subsection Example
  16784. @itemize
  16785. @item
  16786. 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.
  16787. @example
  16788. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16789. @end example
  16790. @end itemize
  16791. @section deshake_opencl
  16792. Feature-point based video stabilization filter.
  16793. The filter accepts the following options:
  16794. @table @option
  16795. @item tripod
  16796. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  16797. @item debug
  16798. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  16799. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  16800. Viewing point matches in the output video is only supported for RGB input.
  16801. Defaults to @code{0}.
  16802. @item adaptive_crop
  16803. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  16804. Defaults to @code{1}.
  16805. @item refine_features
  16806. Whether or not feature points should be refined at a sub-pixel level.
  16807. This can be turned off for a slight performance gain at the cost of precision.
  16808. Defaults to @code{1}.
  16809. @item smooth_strength
  16810. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  16811. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  16812. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  16813. Defaults to @code{0.0}.
  16814. @item smooth_window_multiplier
  16815. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  16816. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  16817. Acceptable values range from @code{0.1} to @code{10.0}.
  16818. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  16819. potentially improving smoothness, but also increase latency and memory usage.
  16820. Defaults to @code{2.0}.
  16821. @end table
  16822. @subsection Examples
  16823. @itemize
  16824. @item
  16825. Stabilize a video with a fixed, medium smoothing strength:
  16826. @example
  16827. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  16828. @end example
  16829. @item
  16830. Stabilize a video with debugging (both in console and in rendered video):
  16831. @example
  16832. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  16833. @end example
  16834. @end itemize
  16835. @section dilation_opencl
  16836. Apply dilation effect to the video.
  16837. This filter replaces the pixel by the local(3x3) maximum.
  16838. It accepts the following options:
  16839. @table @option
  16840. @item threshold0
  16841. @item threshold1
  16842. @item threshold2
  16843. @item threshold3
  16844. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  16845. If @code{0}, plane will remain unchanged.
  16846. @item coordinates
  16847. Flag which specifies the pixel to refer to.
  16848. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  16849. Flags to local 3x3 coordinates region centered on @code{x}:
  16850. 1 2 3
  16851. 4 x 5
  16852. 6 7 8
  16853. @end table
  16854. @subsection Example
  16855. @itemize
  16856. @item
  16857. 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.
  16858. @example
  16859. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  16860. @end example
  16861. @end itemize
  16862. @section nlmeans_opencl
  16863. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  16864. @section overlay_opencl
  16865. Overlay one video on top of another.
  16866. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  16867. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  16868. The filter accepts the following options:
  16869. @table @option
  16870. @item x
  16871. Set the x coordinate of the overlaid video on the main video.
  16872. Default value is @code{0}.
  16873. @item y
  16874. Set the y coordinate of the overlaid video on the main video.
  16875. Default value is @code{0}.
  16876. @end table
  16877. @subsection Examples
  16878. @itemize
  16879. @item
  16880. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  16881. @example
  16882. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16883. @end example
  16884. @item
  16885. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  16886. @example
  16887. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  16888. @end example
  16889. @end itemize
  16890. @section pad_opencl
  16891. Add paddings to the input image, and place the original input at the
  16892. provided @var{x}, @var{y} coordinates.
  16893. It accepts the following options:
  16894. @table @option
  16895. @item width, w
  16896. @item height, h
  16897. Specify an expression for the size of the output image with the
  16898. paddings added. If the value for @var{width} or @var{height} is 0, the
  16899. corresponding input size is used for the output.
  16900. The @var{width} expression can reference the value set by the
  16901. @var{height} expression, and vice versa.
  16902. The default value of @var{width} and @var{height} is 0.
  16903. @item x
  16904. @item y
  16905. Specify the offsets to place the input image at within the padded area,
  16906. with respect to the top/left border of the output image.
  16907. The @var{x} expression can reference the value set by the @var{y}
  16908. expression, and vice versa.
  16909. The default value of @var{x} and @var{y} is 0.
  16910. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  16911. so the input image is centered on the padded area.
  16912. @item color
  16913. Specify the color of the padded area. For the syntax of this option,
  16914. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16915. manual,ffmpeg-utils}.
  16916. @item aspect
  16917. Pad to an aspect instead to a resolution.
  16918. @end table
  16919. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  16920. options are expressions containing the following constants:
  16921. @table @option
  16922. @item in_w
  16923. @item in_h
  16924. The input video width and height.
  16925. @item iw
  16926. @item ih
  16927. These are the same as @var{in_w} and @var{in_h}.
  16928. @item out_w
  16929. @item out_h
  16930. The output width and height (the size of the padded area), as
  16931. specified by the @var{width} and @var{height} expressions.
  16932. @item ow
  16933. @item oh
  16934. These are the same as @var{out_w} and @var{out_h}.
  16935. @item x
  16936. @item y
  16937. The x and y offsets as specified by the @var{x} and @var{y}
  16938. expressions, or NAN if not yet specified.
  16939. @item a
  16940. same as @var{iw} / @var{ih}
  16941. @item sar
  16942. input sample aspect ratio
  16943. @item dar
  16944. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  16945. @end table
  16946. @section prewitt_opencl
  16947. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  16948. The filter accepts the following option:
  16949. @table @option
  16950. @item planes
  16951. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  16952. @item scale
  16953. Set value which will be multiplied with filtered result.
  16954. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  16955. @item delta
  16956. Set value which will be added to filtered result.
  16957. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  16958. @end table
  16959. @subsection Example
  16960. @itemize
  16961. @item
  16962. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  16963. @example
  16964. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  16965. @end example
  16966. @end itemize
  16967. @anchor{program_opencl}
  16968. @section program_opencl
  16969. Filter video using an OpenCL program.
  16970. @table @option
  16971. @item source
  16972. OpenCL program source file.
  16973. @item kernel
  16974. Kernel name in program.
  16975. @item inputs
  16976. Number of inputs to the filter. Defaults to 1.
  16977. @item size, s
  16978. Size of output frames. Defaults to the same as the first input.
  16979. @end table
  16980. The @code{program_opencl} filter also supports the @ref{framesync} options.
  16981. The program source file must contain a kernel function with the given name,
  16982. which will be run once for each plane of the output. Each run on a plane
  16983. gets enqueued as a separate 2D global NDRange with one work-item for each
  16984. pixel to be generated. The global ID offset for each work-item is therefore
  16985. the coordinates of a pixel in the destination image.
  16986. The kernel function needs to take the following arguments:
  16987. @itemize
  16988. @item
  16989. Destination image, @var{__write_only image2d_t}.
  16990. This image will become the output; the kernel should write all of it.
  16991. @item
  16992. Frame index, @var{unsigned int}.
  16993. This is a counter starting from zero and increasing by one for each frame.
  16994. @item
  16995. Source images, @var{__read_only image2d_t}.
  16996. These are the most recent images on each input. The kernel may read from
  16997. them to generate the output, but they can't be written to.
  16998. @end itemize
  16999. Example programs:
  17000. @itemize
  17001. @item
  17002. Copy the input to the output (output must be the same size as the input).
  17003. @verbatim
  17004. __kernel void copy(__write_only image2d_t destination,
  17005. unsigned int index,
  17006. __read_only image2d_t source)
  17007. {
  17008. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  17009. int2 location = (int2)(get_global_id(0), get_global_id(1));
  17010. float4 value = read_imagef(source, sampler, location);
  17011. write_imagef(destination, location, value);
  17012. }
  17013. @end verbatim
  17014. @item
  17015. Apply a simple transformation, rotating the input by an amount increasing
  17016. with the index counter. Pixel values are linearly interpolated by the
  17017. sampler, and the output need not have the same dimensions as the input.
  17018. @verbatim
  17019. __kernel void rotate_image(__write_only image2d_t dst,
  17020. unsigned int index,
  17021. __read_only image2d_t src)
  17022. {
  17023. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17024. CLK_FILTER_LINEAR);
  17025. float angle = (float)index / 100.0f;
  17026. float2 dst_dim = convert_float2(get_image_dim(dst));
  17027. float2 src_dim = convert_float2(get_image_dim(src));
  17028. float2 dst_cen = dst_dim / 2.0f;
  17029. float2 src_cen = src_dim / 2.0f;
  17030. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17031. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  17032. float2 src_pos = {
  17033. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  17034. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  17035. };
  17036. src_pos = src_pos * src_dim / dst_dim;
  17037. float2 src_loc = src_pos + src_cen;
  17038. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  17039. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  17040. write_imagef(dst, dst_loc, 0.5f);
  17041. else
  17042. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  17043. }
  17044. @end verbatim
  17045. @item
  17046. Blend two inputs together, with the amount of each input used varying
  17047. with the index counter.
  17048. @verbatim
  17049. __kernel void blend_images(__write_only image2d_t dst,
  17050. unsigned int index,
  17051. __read_only image2d_t src1,
  17052. __read_only image2d_t src2)
  17053. {
  17054. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17055. CLK_FILTER_LINEAR);
  17056. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  17057. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  17058. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  17059. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  17060. float4 val1 = read_imagef(src1, sampler, src1_loc);
  17061. float4 val2 = read_imagef(src2, sampler, src2_loc);
  17062. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  17063. }
  17064. @end verbatim
  17065. @end itemize
  17066. @section roberts_opencl
  17067. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  17068. The filter accepts the following option:
  17069. @table @option
  17070. @item planes
  17071. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17072. @item scale
  17073. Set value which will be multiplied with filtered result.
  17074. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17075. @item delta
  17076. Set value which will be added to filtered result.
  17077. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17078. @end table
  17079. @subsection Example
  17080. @itemize
  17081. @item
  17082. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  17083. @example
  17084. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17085. @end example
  17086. @end itemize
  17087. @section sobel_opencl
  17088. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  17089. The filter accepts the following option:
  17090. @table @option
  17091. @item planes
  17092. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  17093. @item scale
  17094. Set value which will be multiplied with filtered result.
  17095. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  17096. @item delta
  17097. Set value which will be added to filtered result.
  17098. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  17099. @end table
  17100. @subsection Example
  17101. @itemize
  17102. @item
  17103. Apply sobel operator with scale set to 2 and delta set to 10
  17104. @example
  17105. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  17106. @end example
  17107. @end itemize
  17108. @section tonemap_opencl
  17109. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  17110. It accepts the following parameters:
  17111. @table @option
  17112. @item tonemap
  17113. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  17114. @item param
  17115. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  17116. @item desat
  17117. Apply desaturation for highlights that exceed this level of brightness. The
  17118. higher the parameter, the more color information will be preserved. This
  17119. setting helps prevent unnaturally blown-out colors for super-highlights, by
  17120. (smoothly) turning into white instead. This makes images feel more natural,
  17121. at the cost of reducing information about out-of-range colors.
  17122. The default value is 0.5, and the algorithm here is a little different from
  17123. the cpu version tonemap currently. A setting of 0.0 disables this option.
  17124. @item threshold
  17125. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  17126. is used to detect whether the scene has changed or not. If the distance between
  17127. the current frame average brightness and the current running average exceeds
  17128. a threshold value, we would re-calculate scene average and peak brightness.
  17129. The default value is 0.2.
  17130. @item format
  17131. Specify the output pixel format.
  17132. Currently supported formats are:
  17133. @table @var
  17134. @item p010
  17135. @item nv12
  17136. @end table
  17137. @item range, r
  17138. Set the output color range.
  17139. Possible values are:
  17140. @table @var
  17141. @item tv/mpeg
  17142. @item pc/jpeg
  17143. @end table
  17144. Default is same as input.
  17145. @item primaries, p
  17146. Set the output color primaries.
  17147. Possible values are:
  17148. @table @var
  17149. @item bt709
  17150. @item bt2020
  17151. @end table
  17152. Default is same as input.
  17153. @item transfer, t
  17154. Set the output transfer characteristics.
  17155. Possible values are:
  17156. @table @var
  17157. @item bt709
  17158. @item bt2020
  17159. @end table
  17160. Default is bt709.
  17161. @item matrix, m
  17162. Set the output colorspace matrix.
  17163. Possible value are:
  17164. @table @var
  17165. @item bt709
  17166. @item bt2020
  17167. @end table
  17168. Default is same as input.
  17169. @end table
  17170. @subsection Example
  17171. @itemize
  17172. @item
  17173. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  17174. @example
  17175. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  17176. @end example
  17177. @end itemize
  17178. @section unsharp_opencl
  17179. Sharpen or blur the input video.
  17180. It accepts the following parameters:
  17181. @table @option
  17182. @item luma_msize_x, lx
  17183. Set the luma matrix horizontal size.
  17184. Range is @code{[1, 23]} and default value is @code{5}.
  17185. @item luma_msize_y, ly
  17186. Set the luma matrix vertical size.
  17187. Range is @code{[1, 23]} and default value is @code{5}.
  17188. @item luma_amount, la
  17189. Set the luma effect strength.
  17190. Range is @code{[-10, 10]} and default value is @code{1.0}.
  17191. Negative values will blur the input video, while positive values will
  17192. sharpen it, a value of zero will disable the effect.
  17193. @item chroma_msize_x, cx
  17194. Set the chroma matrix horizontal size.
  17195. Range is @code{[1, 23]} and default value is @code{5}.
  17196. @item chroma_msize_y, cy
  17197. Set the chroma matrix vertical size.
  17198. Range is @code{[1, 23]} and default value is @code{5}.
  17199. @item chroma_amount, ca
  17200. Set the chroma effect strength.
  17201. Range is @code{[-10, 10]} and default value is @code{0.0}.
  17202. Negative values will blur the input video, while positive values will
  17203. sharpen it, a value of zero will disable the effect.
  17204. @end table
  17205. All parameters are optional and default to the equivalent of the
  17206. string '5:5:1.0:5:5:0.0'.
  17207. @subsection Examples
  17208. @itemize
  17209. @item
  17210. Apply strong luma sharpen effect:
  17211. @example
  17212. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  17213. @end example
  17214. @item
  17215. Apply a strong blur of both luma and chroma parameters:
  17216. @example
  17217. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  17218. @end example
  17219. @end itemize
  17220. @section xfade_opencl
  17221. Cross fade two videos with custom transition effect by using OpenCL.
  17222. It accepts the following options:
  17223. @table @option
  17224. @item transition
  17225. Set one of possible transition effects.
  17226. @table @option
  17227. @item custom
  17228. Select custom transition effect, the actual transition description
  17229. will be picked from source and kernel options.
  17230. @item fade
  17231. @item wipeleft
  17232. @item wiperight
  17233. @item wipeup
  17234. @item wipedown
  17235. @item slideleft
  17236. @item slideright
  17237. @item slideup
  17238. @item slidedown
  17239. Default transition is fade.
  17240. @end table
  17241. @item source
  17242. OpenCL program source file for custom transition.
  17243. @item kernel
  17244. Set name of kernel to use for custom transition from program source file.
  17245. @item duration
  17246. Set duration of video transition.
  17247. @item offset
  17248. Set time of start of transition relative to first video.
  17249. @end table
  17250. The program source file must contain a kernel function with the given name,
  17251. which will be run once for each plane of the output. Each run on a plane
  17252. gets enqueued as a separate 2D global NDRange with one work-item for each
  17253. pixel to be generated. The global ID offset for each work-item is therefore
  17254. the coordinates of a pixel in the destination image.
  17255. The kernel function needs to take the following arguments:
  17256. @itemize
  17257. @item
  17258. Destination image, @var{__write_only image2d_t}.
  17259. This image will become the output; the kernel should write all of it.
  17260. @item
  17261. First Source image, @var{__read_only image2d_t}.
  17262. Second Source image, @var{__read_only image2d_t}.
  17263. These are the most recent images on each input. The kernel may read from
  17264. them to generate the output, but they can't be written to.
  17265. @item
  17266. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  17267. @end itemize
  17268. Example programs:
  17269. @itemize
  17270. @item
  17271. Apply dots curtain transition effect:
  17272. @verbatim
  17273. __kernel void blend_images(__write_only image2d_t dst,
  17274. __read_only image2d_t src1,
  17275. __read_only image2d_t src2,
  17276. float progress)
  17277. {
  17278. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  17279. CLK_FILTER_LINEAR);
  17280. int2 p = (int2)(get_global_id(0), get_global_id(1));
  17281. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  17282. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  17283. rp = rp / dim;
  17284. float2 dots = (float2)(20.0, 20.0);
  17285. float2 center = (float2)(0,0);
  17286. float2 unused;
  17287. float4 val1 = read_imagef(src1, sampler, p);
  17288. float4 val2 = read_imagef(src2, sampler, p);
  17289. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  17290. write_imagef(dst, p, next ? val1 : val2);
  17291. }
  17292. @end verbatim
  17293. @end itemize
  17294. @c man end OPENCL VIDEO FILTERS
  17295. @chapter VAAPI Video Filters
  17296. @c man begin VAAPI VIDEO FILTERS
  17297. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  17298. To enable compilation of these filters you need to configure FFmpeg with
  17299. @code{--enable-vaapi}.
  17300. 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}
  17301. @section tonemap_vaapi
  17302. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  17303. It maps the dynamic range of HDR10 content to the SDR content.
  17304. It currently only accepts HDR10 as input.
  17305. It accepts the following parameters:
  17306. @table @option
  17307. @item format
  17308. Specify the output pixel format.
  17309. Currently supported formats are:
  17310. @table @var
  17311. @item p010
  17312. @item nv12
  17313. @end table
  17314. Default is nv12.
  17315. @item primaries, p
  17316. Set the output color primaries.
  17317. Default is same as input.
  17318. @item transfer, t
  17319. Set the output transfer characteristics.
  17320. Default is bt709.
  17321. @item matrix, m
  17322. Set the output colorspace matrix.
  17323. Default is same as input.
  17324. @end table
  17325. @subsection Example
  17326. @itemize
  17327. @item
  17328. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  17329. @example
  17330. tonemap_vaapi=format=p010:t=bt2020-10
  17331. @end example
  17332. @end itemize
  17333. @c man end VAAPI VIDEO FILTERS
  17334. @chapter Video Sources
  17335. @c man begin VIDEO SOURCES
  17336. Below is a description of the currently available video sources.
  17337. @section buffer
  17338. Buffer video frames, and make them available to the filter chain.
  17339. This source is mainly intended for a programmatic use, in particular
  17340. through the interface defined in @file{libavfilter/buffersrc.h}.
  17341. It accepts the following parameters:
  17342. @table @option
  17343. @item video_size
  17344. Specify the size (width and height) of the buffered video frames. For the
  17345. syntax of this option, check the
  17346. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17347. @item width
  17348. The input video width.
  17349. @item height
  17350. The input video height.
  17351. @item pix_fmt
  17352. A string representing the pixel format of the buffered video frames.
  17353. It may be a number corresponding to a pixel format, or a pixel format
  17354. name.
  17355. @item time_base
  17356. Specify the timebase assumed by the timestamps of the buffered frames.
  17357. @item frame_rate
  17358. Specify the frame rate expected for the video stream.
  17359. @item pixel_aspect, sar
  17360. The sample (pixel) aspect ratio of the input video.
  17361. @item sws_param
  17362. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  17363. to the filtergraph description to specify swscale flags for automatically
  17364. inserted scalers. See @ref{Filtergraph syntax}.
  17365. @item hw_frames_ctx
  17366. When using a hardware pixel format, this should be a reference to an
  17367. AVHWFramesContext describing input frames.
  17368. @end table
  17369. For example:
  17370. @example
  17371. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  17372. @end example
  17373. will instruct the source to accept video frames with size 320x240 and
  17374. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  17375. square pixels (1:1 sample aspect ratio).
  17376. Since the pixel format with name "yuv410p" corresponds to the number 6
  17377. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  17378. this example corresponds to:
  17379. @example
  17380. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  17381. @end example
  17382. Alternatively, the options can be specified as a flat string, but this
  17383. syntax is deprecated:
  17384. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  17385. @section cellauto
  17386. Create a pattern generated by an elementary cellular automaton.
  17387. The initial state of the cellular automaton can be defined through the
  17388. @option{filename} and @option{pattern} options. If such options are
  17389. not specified an initial state is created randomly.
  17390. At each new frame a new row in the video is filled with the result of
  17391. the cellular automaton next generation. The behavior when the whole
  17392. frame is filled is defined by the @option{scroll} option.
  17393. This source accepts the following options:
  17394. @table @option
  17395. @item filename, f
  17396. Read the initial cellular automaton state, i.e. the starting row, from
  17397. the specified file.
  17398. In the file, each non-whitespace character is considered an alive
  17399. cell, a newline will terminate the row, and further characters in the
  17400. file will be ignored.
  17401. @item pattern, p
  17402. Read the initial cellular automaton state, i.e. the starting row, from
  17403. the specified string.
  17404. Each non-whitespace character in the string is considered an alive
  17405. cell, a newline will terminate the row, and further characters in the
  17406. string will be ignored.
  17407. @item rate, r
  17408. Set the video rate, that is the number of frames generated per second.
  17409. Default is 25.
  17410. @item random_fill_ratio, ratio
  17411. Set the random fill ratio for the initial cellular automaton row. It
  17412. is a floating point number value ranging from 0 to 1, defaults to
  17413. 1/PHI.
  17414. This option is ignored when a file or a pattern is specified.
  17415. @item random_seed, seed
  17416. Set the seed for filling randomly the initial row, must be an integer
  17417. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17418. set to -1, the filter will try to use a good random seed on a best
  17419. effort basis.
  17420. @item rule
  17421. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  17422. Default value is 110.
  17423. @item size, s
  17424. Set the size of the output video. For the syntax of this option, check the
  17425. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17426. If @option{filename} or @option{pattern} is specified, the size is set
  17427. by default to the width of the specified initial state row, and the
  17428. height is set to @var{width} * PHI.
  17429. If @option{size} is set, it must contain the width of the specified
  17430. pattern string, and the specified pattern will be centered in the
  17431. larger row.
  17432. If a filename or a pattern string is not specified, the size value
  17433. defaults to "320x518" (used for a randomly generated initial state).
  17434. @item scroll
  17435. If set to 1, scroll the output upward when all the rows in the output
  17436. have been already filled. If set to 0, the new generated row will be
  17437. written over the top row just after the bottom row is filled.
  17438. Defaults to 1.
  17439. @item start_full, full
  17440. If set to 1, completely fill the output with generated rows before
  17441. outputting the first frame.
  17442. This is the default behavior, for disabling set the value to 0.
  17443. @item stitch
  17444. If set to 1, stitch the left and right row edges together.
  17445. This is the default behavior, for disabling set the value to 0.
  17446. @end table
  17447. @subsection Examples
  17448. @itemize
  17449. @item
  17450. Read the initial state from @file{pattern}, and specify an output of
  17451. size 200x400.
  17452. @example
  17453. cellauto=f=pattern:s=200x400
  17454. @end example
  17455. @item
  17456. Generate a random initial row with a width of 200 cells, with a fill
  17457. ratio of 2/3:
  17458. @example
  17459. cellauto=ratio=2/3:s=200x200
  17460. @end example
  17461. @item
  17462. Create a pattern generated by rule 18 starting by a single alive cell
  17463. centered on an initial row with width 100:
  17464. @example
  17465. cellauto=p=@@:s=100x400:full=0:rule=18
  17466. @end example
  17467. @item
  17468. Specify a more elaborated initial pattern:
  17469. @example
  17470. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  17471. @end example
  17472. @end itemize
  17473. @anchor{coreimagesrc}
  17474. @section coreimagesrc
  17475. Video source generated on GPU using Apple's CoreImage API on OSX.
  17476. This video source is a specialized version of the @ref{coreimage} video filter.
  17477. Use a core image generator at the beginning of the applied filterchain to
  17478. generate the content.
  17479. The coreimagesrc video source accepts the following options:
  17480. @table @option
  17481. @item list_generators
  17482. List all available generators along with all their respective options as well as
  17483. possible minimum and maximum values along with the default values.
  17484. @example
  17485. list_generators=true
  17486. @end example
  17487. @item size, s
  17488. Specify the size of the sourced video. For the syntax of this option, check the
  17489. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17490. The default value is @code{320x240}.
  17491. @item rate, r
  17492. Specify the frame rate of the sourced video, as the number of frames
  17493. generated per second. It has to be a string in the format
  17494. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17495. number or a valid video frame rate abbreviation. The default value is
  17496. "25".
  17497. @item sar
  17498. Set the sample aspect ratio of the sourced video.
  17499. @item duration, d
  17500. Set the duration of the sourced video. See
  17501. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17502. for the accepted syntax.
  17503. If not specified, or the expressed duration is negative, the video is
  17504. supposed to be generated forever.
  17505. @end table
  17506. Additionally, all options of the @ref{coreimage} video filter are accepted.
  17507. A complete filterchain can be used for further processing of the
  17508. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  17509. and examples for details.
  17510. @subsection Examples
  17511. @itemize
  17512. @item
  17513. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  17514. given as complete and escaped command-line for Apple's standard bash shell:
  17515. @example
  17516. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  17517. @end example
  17518. This example is equivalent to the QRCode example of @ref{coreimage} without the
  17519. need for a nullsrc video source.
  17520. @end itemize
  17521. @section gradients
  17522. Generate several gradients.
  17523. @table @option
  17524. @item size, s
  17525. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17526. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17527. @item rate, r
  17528. Set frame rate, expressed as number of frames per second. Default
  17529. value is "25".
  17530. @item c0, c1, c2, c3, c4, c5, c6, c7
  17531. Set 8 colors. Default values for colors is to pick random one.
  17532. @item x0, y0, y0, y1
  17533. Set gradient line source and destination points. If negative or out of range, random ones
  17534. are picked.
  17535. @item nb_colors, n
  17536. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  17537. @item seed
  17538. Set seed for picking gradient line points.
  17539. @item duration, d
  17540. Set the duration of the sourced video. See
  17541. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17542. for the accepted syntax.
  17543. If not specified, or the expressed duration is negative, the video is
  17544. supposed to be generated forever.
  17545. @item speed
  17546. Set speed of gradients rotation.
  17547. @end table
  17548. @section mandelbrot
  17549. Generate a Mandelbrot set fractal, and progressively zoom towards the
  17550. point specified with @var{start_x} and @var{start_y}.
  17551. This source accepts the following options:
  17552. @table @option
  17553. @item end_pts
  17554. Set the terminal pts value. Default value is 400.
  17555. @item end_scale
  17556. Set the terminal scale value.
  17557. Must be a floating point value. Default value is 0.3.
  17558. @item inner
  17559. Set the inner coloring mode, that is the algorithm used to draw the
  17560. Mandelbrot fractal internal region.
  17561. It shall assume one of the following values:
  17562. @table @option
  17563. @item black
  17564. Set black mode.
  17565. @item convergence
  17566. Show time until convergence.
  17567. @item mincol
  17568. Set color based on point closest to the origin of the iterations.
  17569. @item period
  17570. Set period mode.
  17571. @end table
  17572. Default value is @var{mincol}.
  17573. @item bailout
  17574. Set the bailout value. Default value is 10.0.
  17575. @item maxiter
  17576. Set the maximum of iterations performed by the rendering
  17577. algorithm. Default value is 7189.
  17578. @item outer
  17579. Set outer coloring mode.
  17580. It shall assume one of following values:
  17581. @table @option
  17582. @item iteration_count
  17583. Set iteration count mode.
  17584. @item normalized_iteration_count
  17585. set normalized iteration count mode.
  17586. @end table
  17587. Default value is @var{normalized_iteration_count}.
  17588. @item rate, r
  17589. Set frame rate, expressed as number of frames per second. Default
  17590. value is "25".
  17591. @item size, s
  17592. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17593. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17594. @item start_scale
  17595. Set the initial scale value. Default value is 3.0.
  17596. @item start_x
  17597. Set the initial x position. Must be a floating point value between
  17598. -100 and 100. Default value is -0.743643887037158704752191506114774.
  17599. @item start_y
  17600. Set the initial y position. Must be a floating point value between
  17601. -100 and 100. Default value is -0.131825904205311970493132056385139.
  17602. @end table
  17603. @section mptestsrc
  17604. Generate various test patterns, as generated by the MPlayer test filter.
  17605. The size of the generated video is fixed, and is 256x256.
  17606. This source is useful in particular for testing encoding features.
  17607. This source accepts the following options:
  17608. @table @option
  17609. @item rate, r
  17610. Specify the frame rate of the sourced video, as the number of frames
  17611. generated per second. It has to be a string in the format
  17612. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17613. number or a valid video frame rate abbreviation. The default value is
  17614. "25".
  17615. @item duration, d
  17616. Set the duration of the sourced video. See
  17617. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17618. for the accepted syntax.
  17619. If not specified, or the expressed duration is negative, the video is
  17620. supposed to be generated forever.
  17621. @item test, t
  17622. Set the number or the name of the test to perform. Supported tests are:
  17623. @table @option
  17624. @item dc_luma
  17625. @item dc_chroma
  17626. @item freq_luma
  17627. @item freq_chroma
  17628. @item amp_luma
  17629. @item amp_chroma
  17630. @item cbp
  17631. @item mv
  17632. @item ring1
  17633. @item ring2
  17634. @item all
  17635. @item max_frames, m
  17636. Set the maximum number of frames generated for each test, default value is 30.
  17637. @end table
  17638. Default value is "all", which will cycle through the list of all tests.
  17639. @end table
  17640. Some examples:
  17641. @example
  17642. mptestsrc=t=dc_luma
  17643. @end example
  17644. will generate a "dc_luma" test pattern.
  17645. @section frei0r_src
  17646. Provide a frei0r source.
  17647. To enable compilation of this filter you need to install the frei0r
  17648. header and configure FFmpeg with @code{--enable-frei0r}.
  17649. This source accepts the following parameters:
  17650. @table @option
  17651. @item size
  17652. The size of the video to generate. For the syntax of this option, check the
  17653. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17654. @item framerate
  17655. The framerate of the generated video. It may be a string of the form
  17656. @var{num}/@var{den} or a frame rate abbreviation.
  17657. @item filter_name
  17658. The name to the frei0r source to load. For more information regarding frei0r and
  17659. how to set the parameters, read the @ref{frei0r} section in the video filters
  17660. documentation.
  17661. @item filter_params
  17662. A '|'-separated list of parameters to pass to the frei0r source.
  17663. @end table
  17664. For example, to generate a frei0r partik0l source with size 200x200
  17665. and frame rate 10 which is overlaid on the overlay filter main input:
  17666. @example
  17667. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  17668. @end example
  17669. @section life
  17670. Generate a life pattern.
  17671. This source is based on a generalization of John Conway's life game.
  17672. The sourced input represents a life grid, each pixel represents a cell
  17673. which can be in one of two possible states, alive or dead. Every cell
  17674. interacts with its eight neighbours, which are the cells that are
  17675. horizontally, vertically, or diagonally adjacent.
  17676. At each interaction the grid evolves according to the adopted rule,
  17677. which specifies the number of neighbor alive cells which will make a
  17678. cell stay alive or born. The @option{rule} option allows one to specify
  17679. the rule to adopt.
  17680. This source accepts the following options:
  17681. @table @option
  17682. @item filename, f
  17683. Set the file from which to read the initial grid state. In the file,
  17684. each non-whitespace character is considered an alive cell, and newline
  17685. is used to delimit the end of each row.
  17686. If this option is not specified, the initial grid is generated
  17687. randomly.
  17688. @item rate, r
  17689. Set the video rate, that is the number of frames generated per second.
  17690. Default is 25.
  17691. @item random_fill_ratio, ratio
  17692. Set the random fill ratio for the initial random grid. It is a
  17693. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  17694. It is ignored when a file is specified.
  17695. @item random_seed, seed
  17696. Set the seed for filling the initial random grid, must be an integer
  17697. included between 0 and UINT32_MAX. If not specified, or if explicitly
  17698. set to -1, the filter will try to use a good random seed on a best
  17699. effort basis.
  17700. @item rule
  17701. Set the life rule.
  17702. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  17703. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  17704. @var{NS} specifies the number of alive neighbor cells which make a
  17705. live cell stay alive, and @var{NB} the number of alive neighbor cells
  17706. which make a dead cell to become alive (i.e. to "born").
  17707. "s" and "b" can be used in place of "S" and "B", respectively.
  17708. Alternatively a rule can be specified by an 18-bits integer. The 9
  17709. high order bits are used to encode the next cell state if it is alive
  17710. for each number of neighbor alive cells, the low order bits specify
  17711. the rule for "borning" new cells. Higher order bits encode for an
  17712. higher number of neighbor cells.
  17713. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  17714. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  17715. Default value is "S23/B3", which is the original Conway's game of life
  17716. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  17717. cells, and will born a new cell if there are three alive cells around
  17718. a dead cell.
  17719. @item size, s
  17720. Set the size of the output video. For the syntax of this option, check the
  17721. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17722. If @option{filename} is specified, the size is set by default to the
  17723. same size of the input file. If @option{size} is set, it must contain
  17724. the size specified in the input file, and the initial grid defined in
  17725. that file is centered in the larger resulting area.
  17726. If a filename is not specified, the size value defaults to "320x240"
  17727. (used for a randomly generated initial grid).
  17728. @item stitch
  17729. If set to 1, stitch the left and right grid edges together, and the
  17730. top and bottom edges also. Defaults to 1.
  17731. @item mold
  17732. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  17733. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  17734. value from 0 to 255.
  17735. @item life_color
  17736. Set the color of living (or new born) cells.
  17737. @item death_color
  17738. Set the color of dead cells. If @option{mold} is set, this is the first color
  17739. used to represent a dead cell.
  17740. @item mold_color
  17741. Set mold color, for definitely dead and moldy cells.
  17742. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  17743. ffmpeg-utils manual,ffmpeg-utils}.
  17744. @end table
  17745. @subsection Examples
  17746. @itemize
  17747. @item
  17748. Read a grid from @file{pattern}, and center it on a grid of size
  17749. 300x300 pixels:
  17750. @example
  17751. life=f=pattern:s=300x300
  17752. @end example
  17753. @item
  17754. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  17755. @example
  17756. life=ratio=2/3:s=200x200
  17757. @end example
  17758. @item
  17759. Specify a custom rule for evolving a randomly generated grid:
  17760. @example
  17761. life=rule=S14/B34
  17762. @end example
  17763. @item
  17764. Full example with slow death effect (mold) using @command{ffplay}:
  17765. @example
  17766. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  17767. @end example
  17768. @end itemize
  17769. @anchor{allrgb}
  17770. @anchor{allyuv}
  17771. @anchor{color}
  17772. @anchor{haldclutsrc}
  17773. @anchor{nullsrc}
  17774. @anchor{pal75bars}
  17775. @anchor{pal100bars}
  17776. @anchor{rgbtestsrc}
  17777. @anchor{smptebars}
  17778. @anchor{smptehdbars}
  17779. @anchor{testsrc}
  17780. @anchor{testsrc2}
  17781. @anchor{yuvtestsrc}
  17782. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  17783. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  17784. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  17785. The @code{color} source provides an uniformly colored input.
  17786. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  17787. @ref{haldclut} filter.
  17788. The @code{nullsrc} source returns unprocessed video frames. It is
  17789. mainly useful to be employed in analysis / debugging tools, or as the
  17790. source for filters which ignore the input data.
  17791. The @code{pal75bars} source generates a color bars pattern, based on
  17792. EBU PAL recommendations with 75% color levels.
  17793. The @code{pal100bars} source generates a color bars pattern, based on
  17794. EBU PAL recommendations with 100% color levels.
  17795. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  17796. detecting RGB vs BGR issues. You should see a red, green and blue
  17797. stripe from top to bottom.
  17798. The @code{smptebars} source generates a color bars pattern, based on
  17799. the SMPTE Engineering Guideline EG 1-1990.
  17800. The @code{smptehdbars} source generates a color bars pattern, based on
  17801. the SMPTE RP 219-2002.
  17802. The @code{testsrc} source generates a test video pattern, showing a
  17803. color pattern, a scrolling gradient and a timestamp. This is mainly
  17804. intended for testing purposes.
  17805. The @code{testsrc2} source is similar to testsrc, but supports more
  17806. pixel formats instead of just @code{rgb24}. This allows using it as an
  17807. input for other tests without requiring a format conversion.
  17808. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  17809. see a y, cb and cr stripe from top to bottom.
  17810. The sources accept the following parameters:
  17811. @table @option
  17812. @item level
  17813. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  17814. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  17815. pixels to be used as identity matrix for 3D lookup tables. Each component is
  17816. coded on a @code{1/(N*N)} scale.
  17817. @item color, c
  17818. Specify the color of the source, only available in the @code{color}
  17819. source. For the syntax of this option, check the
  17820. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17821. @item size, s
  17822. Specify the size of the sourced video. For the syntax of this option, check the
  17823. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17824. The default value is @code{320x240}.
  17825. This option is not available with the @code{allrgb}, @code{allyuv}, and
  17826. @code{haldclutsrc} filters.
  17827. @item rate, r
  17828. Specify the frame rate of the sourced video, as the number of frames
  17829. generated per second. It has to be a string in the format
  17830. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  17831. number or a valid video frame rate abbreviation. The default value is
  17832. "25".
  17833. @item duration, d
  17834. Set the duration of the sourced video. See
  17835. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  17836. for the accepted syntax.
  17837. If not specified, or the expressed duration is negative, the video is
  17838. supposed to be generated forever.
  17839. Since the frame rate is used as time base, all frames including the last one
  17840. will have their full duration. If the specified duration is not a multiple
  17841. of the frame duration, it will be rounded up.
  17842. @item sar
  17843. Set the sample aspect ratio of the sourced video.
  17844. @item alpha
  17845. Specify the alpha (opacity) of the background, only available in the
  17846. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  17847. 255 (fully opaque, the default).
  17848. @item decimals, n
  17849. Set the number of decimals to show in the timestamp, only available in the
  17850. @code{testsrc} source.
  17851. The displayed timestamp value will correspond to the original
  17852. timestamp value multiplied by the power of 10 of the specified
  17853. value. Default value is 0.
  17854. @end table
  17855. @subsection Examples
  17856. @itemize
  17857. @item
  17858. Generate a video with a duration of 5.3 seconds, with size
  17859. 176x144 and a frame rate of 10 frames per second:
  17860. @example
  17861. testsrc=duration=5.3:size=qcif:rate=10
  17862. @end example
  17863. @item
  17864. The following graph description will generate a red source
  17865. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  17866. frames per second:
  17867. @example
  17868. color=c=red@@0.2:s=qcif:r=10
  17869. @end example
  17870. @item
  17871. If the input content is to be ignored, @code{nullsrc} can be used. The
  17872. following command generates noise in the luminance plane by employing
  17873. the @code{geq} filter:
  17874. @example
  17875. nullsrc=s=256x256, geq=random(1)*255:128:128
  17876. @end example
  17877. @end itemize
  17878. @subsection Commands
  17879. The @code{color} source supports the following commands:
  17880. @table @option
  17881. @item c, color
  17882. Set the color of the created image. Accepts the same syntax of the
  17883. corresponding @option{color} option.
  17884. @end table
  17885. @section openclsrc
  17886. Generate video using an OpenCL program.
  17887. @table @option
  17888. @item source
  17889. OpenCL program source file.
  17890. @item kernel
  17891. Kernel name in program.
  17892. @item size, s
  17893. Size of frames to generate. This must be set.
  17894. @item format
  17895. Pixel format to use for the generated frames. This must be set.
  17896. @item rate, r
  17897. Number of frames generated every second. Default value is '25'.
  17898. @end table
  17899. For details of how the program loading works, see the @ref{program_opencl}
  17900. filter.
  17901. Example programs:
  17902. @itemize
  17903. @item
  17904. Generate a colour ramp by setting pixel values from the position of the pixel
  17905. in the output image. (Note that this will work with all pixel formats, but
  17906. the generated output will not be the same.)
  17907. @verbatim
  17908. __kernel void ramp(__write_only image2d_t dst,
  17909. unsigned int index)
  17910. {
  17911. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17912. float4 val;
  17913. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  17914. write_imagef(dst, loc, val);
  17915. }
  17916. @end verbatim
  17917. @item
  17918. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  17919. @verbatim
  17920. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  17921. unsigned int index)
  17922. {
  17923. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  17924. float4 value = 0.0f;
  17925. int x = loc.x + index;
  17926. int y = loc.y + index;
  17927. while (x > 0 || y > 0) {
  17928. if (x % 3 == 1 && y % 3 == 1) {
  17929. value = 1.0f;
  17930. break;
  17931. }
  17932. x /= 3;
  17933. y /= 3;
  17934. }
  17935. write_imagef(dst, loc, value);
  17936. }
  17937. @end verbatim
  17938. @end itemize
  17939. @section sierpinski
  17940. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  17941. This source accepts the following options:
  17942. @table @option
  17943. @item size, s
  17944. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  17945. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  17946. @item rate, r
  17947. Set frame rate, expressed as number of frames per second. Default
  17948. value is "25".
  17949. @item seed
  17950. Set seed which is used for random panning.
  17951. @item jump
  17952. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  17953. @item type
  17954. Set fractal type, can be default @code{carpet} or @code{triangle}.
  17955. @end table
  17956. @c man end VIDEO SOURCES
  17957. @chapter Video Sinks
  17958. @c man begin VIDEO SINKS
  17959. Below is a description of the currently available video sinks.
  17960. @section buffersink
  17961. Buffer video frames, and make them available to the end of the filter
  17962. graph.
  17963. This sink is mainly intended for programmatic use, in particular
  17964. through the interface defined in @file{libavfilter/buffersink.h}
  17965. or the options system.
  17966. It accepts a pointer to an AVBufferSinkContext structure, which
  17967. defines the incoming buffers' formats, to be passed as the opaque
  17968. parameter to @code{avfilter_init_filter} for initialization.
  17969. @section nullsink
  17970. Null video sink: do absolutely nothing with the input video. It is
  17971. mainly useful as a template and for use in analysis / debugging
  17972. tools.
  17973. @c man end VIDEO SINKS
  17974. @chapter Multimedia Filters
  17975. @c man begin MULTIMEDIA FILTERS
  17976. Below is a description of the currently available multimedia filters.
  17977. @section abitscope
  17978. Convert input audio to a video output, displaying the audio bit scope.
  17979. The filter accepts the following options:
  17980. @table @option
  17981. @item rate, r
  17982. Set frame rate, expressed as number of frames per second. Default
  17983. value is "25".
  17984. @item size, s
  17985. Specify the video size for the output. For the syntax of this option, check the
  17986. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17987. Default value is @code{1024x256}.
  17988. @item colors
  17989. Specify list of colors separated by space or by '|' which will be used to
  17990. draw channels. Unrecognized or missing colors will be replaced
  17991. by white color.
  17992. @end table
  17993. @section adrawgraph
  17994. Draw a graph using input audio metadata.
  17995. See @ref{drawgraph}
  17996. @section agraphmonitor
  17997. See @ref{graphmonitor}.
  17998. @section ahistogram
  17999. Convert input audio to a video output, displaying the volume histogram.
  18000. The filter accepts the following options:
  18001. @table @option
  18002. @item dmode
  18003. Specify how histogram is calculated.
  18004. It accepts the following values:
  18005. @table @samp
  18006. @item single
  18007. Use single histogram for all channels.
  18008. @item separate
  18009. Use separate histogram for each channel.
  18010. @end table
  18011. Default is @code{single}.
  18012. @item rate, r
  18013. Set frame rate, expressed as number of frames per second. Default
  18014. value is "25".
  18015. @item size, s
  18016. Specify the video size for the output. For the syntax of this option, check the
  18017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18018. Default value is @code{hd720}.
  18019. @item scale
  18020. Set display scale.
  18021. It accepts the following values:
  18022. @table @samp
  18023. @item log
  18024. logarithmic
  18025. @item sqrt
  18026. square root
  18027. @item cbrt
  18028. cubic root
  18029. @item lin
  18030. linear
  18031. @item rlog
  18032. reverse logarithmic
  18033. @end table
  18034. Default is @code{log}.
  18035. @item ascale
  18036. Set amplitude scale.
  18037. It accepts the following values:
  18038. @table @samp
  18039. @item log
  18040. logarithmic
  18041. @item lin
  18042. linear
  18043. @end table
  18044. Default is @code{log}.
  18045. @item acount
  18046. Set how much frames to accumulate in histogram.
  18047. Default is 1. Setting this to -1 accumulates all frames.
  18048. @item rheight
  18049. Set histogram ratio of window height.
  18050. @item slide
  18051. Set sonogram sliding.
  18052. It accepts the following values:
  18053. @table @samp
  18054. @item replace
  18055. replace old rows with new ones.
  18056. @item scroll
  18057. scroll from top to bottom.
  18058. @end table
  18059. Default is @code{replace}.
  18060. @end table
  18061. @section aphasemeter
  18062. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  18063. representing mean phase of current audio frame. A video output can also be produced and is
  18064. enabled by default. The audio is passed through as first output.
  18065. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  18066. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  18067. and @code{1} means channels are in phase.
  18068. The filter accepts the following options, all related to its video output:
  18069. @table @option
  18070. @item rate, r
  18071. Set the output frame rate. Default value is @code{25}.
  18072. @item size, s
  18073. Set the video size for the output. For the syntax of this option, check the
  18074. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18075. Default value is @code{800x400}.
  18076. @item rc
  18077. @item gc
  18078. @item bc
  18079. Specify the red, green, blue contrast. Default values are @code{2},
  18080. @code{7} and @code{1}.
  18081. Allowed range is @code{[0, 255]}.
  18082. @item mpc
  18083. Set color which will be used for drawing median phase. If color is
  18084. @code{none} which is default, no median phase value will be drawn.
  18085. @item video
  18086. Enable video output. Default is enabled.
  18087. @end table
  18088. @subsection phasing detection
  18089. The filter also detects out of phase and mono sequences in stereo streams.
  18090. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  18091. The filter accepts the following options for this detection:
  18092. @table @option
  18093. @item phasing
  18094. Enable mono and out of phase detection. Default is disabled.
  18095. @item tolerance, t
  18096. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  18097. Allowed range is @code{[0, 1]}.
  18098. @item angle, a
  18099. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  18100. Allowed range is @code{[90, 180]}.
  18101. @item duration, d
  18102. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  18103. @end table
  18104. @subsection Examples
  18105. @itemize
  18106. @item
  18107. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  18108. @example
  18109. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  18110. @end example
  18111. @end itemize
  18112. @section avectorscope
  18113. Convert input audio to a video output, representing the audio vector
  18114. scope.
  18115. The filter is used to measure the difference between channels of stereo
  18116. audio stream. A monaural signal, consisting of identical left and right
  18117. signal, results in straight vertical line. Any stereo separation is visible
  18118. as a deviation from this line, creating a Lissajous figure.
  18119. If the straight (or deviation from it) but horizontal line appears this
  18120. indicates that the left and right channels are out of phase.
  18121. The filter accepts the following options:
  18122. @table @option
  18123. @item mode, m
  18124. Set the vectorscope mode.
  18125. Available values are:
  18126. @table @samp
  18127. @item lissajous
  18128. Lissajous rotated by 45 degrees.
  18129. @item lissajous_xy
  18130. Same as above but not rotated.
  18131. @item polar
  18132. Shape resembling half of circle.
  18133. @end table
  18134. Default value is @samp{lissajous}.
  18135. @item size, s
  18136. Set the video size for the output. For the syntax of this option, check the
  18137. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18138. Default value is @code{400x400}.
  18139. @item rate, r
  18140. Set the output frame rate. Default value is @code{25}.
  18141. @item rc
  18142. @item gc
  18143. @item bc
  18144. @item ac
  18145. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  18146. @code{160}, @code{80} and @code{255}.
  18147. Allowed range is @code{[0, 255]}.
  18148. @item rf
  18149. @item gf
  18150. @item bf
  18151. @item af
  18152. Specify the red, green, blue and alpha fade. Default values are @code{15},
  18153. @code{10}, @code{5} and @code{5}.
  18154. Allowed range is @code{[0, 255]}.
  18155. @item zoom
  18156. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  18157. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  18158. @item draw
  18159. Set the vectorscope drawing mode.
  18160. Available values are:
  18161. @table @samp
  18162. @item dot
  18163. Draw dot for each sample.
  18164. @item line
  18165. Draw line between previous and current sample.
  18166. @end table
  18167. Default value is @samp{dot}.
  18168. @item scale
  18169. Specify amplitude scale of audio samples.
  18170. Available values are:
  18171. @table @samp
  18172. @item lin
  18173. Linear.
  18174. @item sqrt
  18175. Square root.
  18176. @item cbrt
  18177. Cubic root.
  18178. @item log
  18179. Logarithmic.
  18180. @end table
  18181. @item swap
  18182. Swap left channel axis with right channel axis.
  18183. @item mirror
  18184. Mirror axis.
  18185. @table @samp
  18186. @item none
  18187. No mirror.
  18188. @item x
  18189. Mirror only x axis.
  18190. @item y
  18191. Mirror only y axis.
  18192. @item xy
  18193. Mirror both axis.
  18194. @end table
  18195. @end table
  18196. @subsection Examples
  18197. @itemize
  18198. @item
  18199. Complete example using @command{ffplay}:
  18200. @example
  18201. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  18202. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  18203. @end example
  18204. @end itemize
  18205. @section bench, abench
  18206. Benchmark part of a filtergraph.
  18207. The filter accepts the following options:
  18208. @table @option
  18209. @item action
  18210. Start or stop a timer.
  18211. Available values are:
  18212. @table @samp
  18213. @item start
  18214. Get the current time, set it as frame metadata (using the key
  18215. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  18216. @item stop
  18217. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  18218. the input frame metadata to get the time difference. Time difference, average,
  18219. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  18220. @code{min}) are then printed. The timestamps are expressed in seconds.
  18221. @end table
  18222. @end table
  18223. @subsection Examples
  18224. @itemize
  18225. @item
  18226. Benchmark @ref{selectivecolor} filter:
  18227. @example
  18228. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  18229. @end example
  18230. @end itemize
  18231. @section concat
  18232. Concatenate audio and video streams, joining them together one after the
  18233. other.
  18234. The filter works on segments of synchronized video and audio streams. All
  18235. segments must have the same number of streams of each type, and that will
  18236. also be the number of streams at output.
  18237. The filter accepts the following options:
  18238. @table @option
  18239. @item n
  18240. Set the number of segments. Default is 2.
  18241. @item v
  18242. Set the number of output video streams, that is also the number of video
  18243. streams in each segment. Default is 1.
  18244. @item a
  18245. Set the number of output audio streams, that is also the number of audio
  18246. streams in each segment. Default is 0.
  18247. @item unsafe
  18248. Activate unsafe mode: do not fail if segments have a different format.
  18249. @end table
  18250. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  18251. @var{a} audio outputs.
  18252. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  18253. segment, in the same order as the outputs, then the inputs for the second
  18254. segment, etc.
  18255. Related streams do not always have exactly the same duration, for various
  18256. reasons including codec frame size or sloppy authoring. For that reason,
  18257. related synchronized streams (e.g. a video and its audio track) should be
  18258. concatenated at once. The concat filter will use the duration of the longest
  18259. stream in each segment (except the last one), and if necessary pad shorter
  18260. audio streams with silence.
  18261. For this filter to work correctly, all segments must start at timestamp 0.
  18262. All corresponding streams must have the same parameters in all segments; the
  18263. filtering system will automatically select a common pixel format for video
  18264. streams, and a common sample format, sample rate and channel layout for
  18265. audio streams, but other settings, such as resolution, must be converted
  18266. explicitly by the user.
  18267. Different frame rates are acceptable but will result in variable frame rate
  18268. at output; be sure to configure the output file to handle it.
  18269. @subsection Examples
  18270. @itemize
  18271. @item
  18272. Concatenate an opening, an episode and an ending, all in bilingual version
  18273. (video in stream 0, audio in streams 1 and 2):
  18274. @example
  18275. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  18276. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  18277. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  18278. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  18279. @end example
  18280. @item
  18281. Concatenate two parts, handling audio and video separately, using the
  18282. (a)movie sources, and adjusting the resolution:
  18283. @example
  18284. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  18285. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  18286. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  18287. @end example
  18288. Note that a desync will happen at the stitch if the audio and video streams
  18289. do not have exactly the same duration in the first file.
  18290. @end itemize
  18291. @subsection Commands
  18292. This filter supports the following commands:
  18293. @table @option
  18294. @item next
  18295. Close the current segment and step to the next one
  18296. @end table
  18297. @anchor{ebur128}
  18298. @section ebur128
  18299. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  18300. level. By default, it logs a message at a frequency of 10Hz with the
  18301. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  18302. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  18303. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  18304. sample format is double-precision floating point. The input stream will be converted to
  18305. this specification, if needed. Users may need to insert aformat and/or aresample filters
  18306. after this filter to obtain the original parameters.
  18307. The filter also has a video output (see the @var{video} option) with a real
  18308. time graph to observe the loudness evolution. The graphic contains the logged
  18309. message mentioned above, so it is not printed anymore when this option is set,
  18310. unless the verbose logging is set. The main graphing area contains the
  18311. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  18312. the momentary loudness (400 milliseconds), but can optionally be configured
  18313. to instead display short-term loudness (see @var{gauge}).
  18314. The green area marks a +/- 1LU target range around the target loudness
  18315. (-23LUFS by default, unless modified through @var{target}).
  18316. More information about the Loudness Recommendation EBU R128 on
  18317. @url{http://tech.ebu.ch/loudness}.
  18318. The filter accepts the following options:
  18319. @table @option
  18320. @item video
  18321. Activate the video output. The audio stream is passed unchanged whether this
  18322. option is set or no. The video stream will be the first output stream if
  18323. activated. Default is @code{0}.
  18324. @item size
  18325. Set the video size. This option is for video only. For the syntax of this
  18326. option, check the
  18327. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18328. Default and minimum resolution is @code{640x480}.
  18329. @item meter
  18330. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  18331. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  18332. other integer value between this range is allowed.
  18333. @item metadata
  18334. Set metadata injection. If set to @code{1}, the audio input will be segmented
  18335. into 100ms output frames, each of them containing various loudness information
  18336. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  18337. Default is @code{0}.
  18338. @item framelog
  18339. Force the frame logging level.
  18340. Available values are:
  18341. @table @samp
  18342. @item info
  18343. information logging level
  18344. @item verbose
  18345. verbose logging level
  18346. @end table
  18347. By default, the logging level is set to @var{info}. If the @option{video} or
  18348. the @option{metadata} options are set, it switches to @var{verbose}.
  18349. @item peak
  18350. Set peak mode(s).
  18351. Available modes can be cumulated (the option is a @code{flag} type). Possible
  18352. values are:
  18353. @table @samp
  18354. @item none
  18355. Disable any peak mode (default).
  18356. @item sample
  18357. Enable sample-peak mode.
  18358. Simple peak mode looking for the higher sample value. It logs a message
  18359. for sample-peak (identified by @code{SPK}).
  18360. @item true
  18361. Enable true-peak mode.
  18362. If enabled, the peak lookup is done on an over-sampled version of the input
  18363. stream for better peak accuracy. It logs a message for true-peak.
  18364. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  18365. This mode requires a build with @code{libswresample}.
  18366. @end table
  18367. @item dualmono
  18368. Treat mono input files as "dual mono". If a mono file is intended for playback
  18369. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  18370. If set to @code{true}, this option will compensate for this effect.
  18371. Multi-channel input files are not affected by this option.
  18372. @item panlaw
  18373. Set a specific pan law to be used for the measurement of dual mono files.
  18374. This parameter is optional, and has a default value of -3.01dB.
  18375. @item target
  18376. Set a specific target level (in LUFS) used as relative zero in the visualization.
  18377. This parameter is optional and has a default value of -23LUFS as specified
  18378. by EBU R128. However, material published online may prefer a level of -16LUFS
  18379. (e.g. for use with podcasts or video platforms).
  18380. @item gauge
  18381. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  18382. @code{shortterm}. By default the momentary value will be used, but in certain
  18383. scenarios it may be more useful to observe the short term value instead (e.g.
  18384. live mixing).
  18385. @item scale
  18386. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  18387. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  18388. video output, not the summary or continuous log output.
  18389. @end table
  18390. @subsection Examples
  18391. @itemize
  18392. @item
  18393. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  18394. @example
  18395. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  18396. @end example
  18397. @item
  18398. Run an analysis with @command{ffmpeg}:
  18399. @example
  18400. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  18401. @end example
  18402. @end itemize
  18403. @section interleave, ainterleave
  18404. Temporally interleave frames from several inputs.
  18405. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  18406. These filters read frames from several inputs and send the oldest
  18407. queued frame to the output.
  18408. Input streams must have well defined, monotonically increasing frame
  18409. timestamp values.
  18410. In order to submit one frame to output, these filters need to enqueue
  18411. at least one frame for each input, so they cannot work in case one
  18412. input is not yet terminated and will not receive incoming frames.
  18413. For example consider the case when one input is a @code{select} filter
  18414. which always drops input frames. The @code{interleave} filter will keep
  18415. reading from that input, but it will never be able to send new frames
  18416. to output until the input sends an end-of-stream signal.
  18417. Also, depending on inputs synchronization, the filters will drop
  18418. frames in case one input receives more frames than the other ones, and
  18419. the queue is already filled.
  18420. These filters accept the following options:
  18421. @table @option
  18422. @item nb_inputs, n
  18423. Set the number of different inputs, it is 2 by default.
  18424. @item duration
  18425. How to determine the end-of-stream.
  18426. @table @option
  18427. @item longest
  18428. The duration of the longest input. (default)
  18429. @item shortest
  18430. The duration of the shortest input.
  18431. @item first
  18432. The duration of the first input.
  18433. @end table
  18434. @end table
  18435. @subsection Examples
  18436. @itemize
  18437. @item
  18438. Interleave frames belonging to different streams using @command{ffmpeg}:
  18439. @example
  18440. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  18441. @end example
  18442. @item
  18443. Add flickering blur effect:
  18444. @example
  18445. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  18446. @end example
  18447. @end itemize
  18448. @section metadata, ametadata
  18449. Manipulate frame metadata.
  18450. This filter accepts the following options:
  18451. @table @option
  18452. @item mode
  18453. Set mode of operation of the filter.
  18454. Can be one of the following:
  18455. @table @samp
  18456. @item select
  18457. If both @code{value} and @code{key} is set, select frames
  18458. which have such metadata. If only @code{key} is set, select
  18459. every frame that has such key in metadata.
  18460. @item add
  18461. Add new metadata @code{key} and @code{value}. If key is already available
  18462. do nothing.
  18463. @item modify
  18464. Modify value of already present key.
  18465. @item delete
  18466. If @code{value} is set, delete only keys that have such value.
  18467. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  18468. the frame.
  18469. @item print
  18470. Print key and its value if metadata was found. If @code{key} is not set print all
  18471. metadata values available in frame.
  18472. @end table
  18473. @item key
  18474. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  18475. @item value
  18476. Set metadata value which will be used. This option is mandatory for
  18477. @code{modify} and @code{add} mode.
  18478. @item function
  18479. Which function to use when comparing metadata value and @code{value}.
  18480. Can be one of following:
  18481. @table @samp
  18482. @item same_str
  18483. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  18484. @item starts_with
  18485. Values are interpreted as strings, returns true if metadata value starts with
  18486. the @code{value} option string.
  18487. @item less
  18488. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  18489. @item equal
  18490. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  18491. @item greater
  18492. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  18493. @item expr
  18494. Values are interpreted as floats, returns true if expression from option @code{expr}
  18495. evaluates to true.
  18496. @item ends_with
  18497. Values are interpreted as strings, returns true if metadata value ends with
  18498. the @code{value} option string.
  18499. @end table
  18500. @item expr
  18501. Set expression which is used when @code{function} is set to @code{expr}.
  18502. The expression is evaluated through the eval API and can contain the following
  18503. constants:
  18504. @table @option
  18505. @item VALUE1
  18506. Float representation of @code{value} from metadata key.
  18507. @item VALUE2
  18508. Float representation of @code{value} as supplied by user in @code{value} option.
  18509. @end table
  18510. @item file
  18511. If specified in @code{print} mode, output is written to the named file. Instead of
  18512. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  18513. for standard output. If @code{file} option is not set, output is written to the log
  18514. with AV_LOG_INFO loglevel.
  18515. @item direct
  18516. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  18517. @end table
  18518. @subsection Examples
  18519. @itemize
  18520. @item
  18521. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  18522. between 0 and 1.
  18523. @example
  18524. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  18525. @end example
  18526. @item
  18527. Print silencedetect output to file @file{metadata.txt}.
  18528. @example
  18529. silencedetect,ametadata=mode=print:file=metadata.txt
  18530. @end example
  18531. @item
  18532. Direct all metadata to a pipe with file descriptor 4.
  18533. @example
  18534. metadata=mode=print:file='pipe\:4'
  18535. @end example
  18536. @end itemize
  18537. @section perms, aperms
  18538. Set read/write permissions for the output frames.
  18539. These filters are mainly aimed at developers to test direct path in the
  18540. following filter in the filtergraph.
  18541. The filters accept the following options:
  18542. @table @option
  18543. @item mode
  18544. Select the permissions mode.
  18545. It accepts the following values:
  18546. @table @samp
  18547. @item none
  18548. Do nothing. This is the default.
  18549. @item ro
  18550. Set all the output frames read-only.
  18551. @item rw
  18552. Set all the output frames directly writable.
  18553. @item toggle
  18554. Make the frame read-only if writable, and writable if read-only.
  18555. @item random
  18556. Set each output frame read-only or writable randomly.
  18557. @end table
  18558. @item seed
  18559. Set the seed for the @var{random} mode, must be an integer included between
  18560. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  18561. @code{-1}, the filter will try to use a good random seed on a best effort
  18562. basis.
  18563. @end table
  18564. Note: in case of auto-inserted filter between the permission filter and the
  18565. following one, the permission might not be received as expected in that
  18566. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  18567. perms/aperms filter can avoid this problem.
  18568. @section realtime, arealtime
  18569. Slow down filtering to match real time approximately.
  18570. These filters will pause the filtering for a variable amount of time to
  18571. match the output rate with the input timestamps.
  18572. They are similar to the @option{re} option to @code{ffmpeg}.
  18573. They accept the following options:
  18574. @table @option
  18575. @item limit
  18576. Time limit for the pauses. Any pause longer than that will be considered
  18577. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  18578. @item speed
  18579. Speed factor for processing. The value must be a float larger than zero.
  18580. Values larger than 1.0 will result in faster than realtime processing,
  18581. smaller will slow processing down. The @var{limit} is automatically adapted
  18582. accordingly. Default is 1.0.
  18583. A processing speed faster than what is possible without these filters cannot
  18584. be achieved.
  18585. @end table
  18586. @anchor{select}
  18587. @section select, aselect
  18588. Select frames to pass in output.
  18589. This filter accepts the following options:
  18590. @table @option
  18591. @item expr, e
  18592. Set expression, which is evaluated for each input frame.
  18593. If the expression is evaluated to zero, the frame is discarded.
  18594. If the evaluation result is negative or NaN, the frame is sent to the
  18595. first output; otherwise it is sent to the output with index
  18596. @code{ceil(val)-1}, assuming that the input index starts from 0.
  18597. For example a value of @code{1.2} corresponds to the output with index
  18598. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  18599. @item outputs, n
  18600. Set the number of outputs. The output to which to send the selected
  18601. frame is based on the result of the evaluation. Default value is 1.
  18602. @end table
  18603. The expression can contain the following constants:
  18604. @table @option
  18605. @item n
  18606. The (sequential) number of the filtered frame, starting from 0.
  18607. @item selected_n
  18608. The (sequential) number of the selected frame, starting from 0.
  18609. @item prev_selected_n
  18610. The sequential number of the last selected frame. It's NAN if undefined.
  18611. @item TB
  18612. The timebase of the input timestamps.
  18613. @item pts
  18614. The PTS (Presentation TimeStamp) of the filtered video frame,
  18615. expressed in @var{TB} units. It's NAN if undefined.
  18616. @item t
  18617. The PTS of the filtered video frame,
  18618. expressed in seconds. It's NAN if undefined.
  18619. @item prev_pts
  18620. The PTS of the previously filtered video frame. It's NAN if undefined.
  18621. @item prev_selected_pts
  18622. The PTS of the last previously filtered video frame. It's NAN if undefined.
  18623. @item prev_selected_t
  18624. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  18625. @item start_pts
  18626. The PTS of the first video frame in the video. It's NAN if undefined.
  18627. @item start_t
  18628. The time of the first video frame in the video. It's NAN if undefined.
  18629. @item pict_type @emph{(video only)}
  18630. The type of the filtered frame. It can assume one of the following
  18631. values:
  18632. @table @option
  18633. @item I
  18634. @item P
  18635. @item B
  18636. @item S
  18637. @item SI
  18638. @item SP
  18639. @item BI
  18640. @end table
  18641. @item interlace_type @emph{(video only)}
  18642. The frame interlace type. It can assume one of the following values:
  18643. @table @option
  18644. @item PROGRESSIVE
  18645. The frame is progressive (not interlaced).
  18646. @item TOPFIRST
  18647. The frame is top-field-first.
  18648. @item BOTTOMFIRST
  18649. The frame is bottom-field-first.
  18650. @end table
  18651. @item consumed_sample_n @emph{(audio only)}
  18652. the number of selected samples before the current frame
  18653. @item samples_n @emph{(audio only)}
  18654. the number of samples in the current frame
  18655. @item sample_rate @emph{(audio only)}
  18656. the input sample rate
  18657. @item key
  18658. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  18659. @item pos
  18660. the position in the file of the filtered frame, -1 if the information
  18661. is not available (e.g. for synthetic video)
  18662. @item scene @emph{(video only)}
  18663. value between 0 and 1 to indicate a new scene; a low value reflects a low
  18664. probability for the current frame to introduce a new scene, while a higher
  18665. value means the current frame is more likely to be one (see the example below)
  18666. @item concatdec_select
  18667. The concat demuxer can select only part of a concat input file by setting an
  18668. inpoint and an outpoint, but the output packets may not be entirely contained
  18669. in the selected interval. By using this variable, it is possible to skip frames
  18670. generated by the concat demuxer which are not exactly contained in the selected
  18671. interval.
  18672. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  18673. and the @var{lavf.concat.duration} packet metadata values which are also
  18674. present in the decoded frames.
  18675. The @var{concatdec_select} variable is -1 if the frame pts is at least
  18676. start_time and either the duration metadata is missing or the frame pts is less
  18677. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  18678. missing.
  18679. That basically means that an input frame is selected if its pts is within the
  18680. interval set by the concat demuxer.
  18681. @end table
  18682. The default value of the select expression is "1".
  18683. @subsection Examples
  18684. @itemize
  18685. @item
  18686. Select all frames in input:
  18687. @example
  18688. select
  18689. @end example
  18690. The example above is the same as:
  18691. @example
  18692. select=1
  18693. @end example
  18694. @item
  18695. Skip all frames:
  18696. @example
  18697. select=0
  18698. @end example
  18699. @item
  18700. Select only I-frames:
  18701. @example
  18702. select='eq(pict_type\,I)'
  18703. @end example
  18704. @item
  18705. Select one frame every 100:
  18706. @example
  18707. select='not(mod(n\,100))'
  18708. @end example
  18709. @item
  18710. Select only frames contained in the 10-20 time interval:
  18711. @example
  18712. select=between(t\,10\,20)
  18713. @end example
  18714. @item
  18715. Select only I-frames contained in the 10-20 time interval:
  18716. @example
  18717. select=between(t\,10\,20)*eq(pict_type\,I)
  18718. @end example
  18719. @item
  18720. Select frames with a minimum distance of 10 seconds:
  18721. @example
  18722. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  18723. @end example
  18724. @item
  18725. Use aselect to select only audio frames with samples number > 100:
  18726. @example
  18727. aselect='gt(samples_n\,100)'
  18728. @end example
  18729. @item
  18730. Create a mosaic of the first scenes:
  18731. @example
  18732. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  18733. @end example
  18734. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  18735. choice.
  18736. @item
  18737. Send even and odd frames to separate outputs, and compose them:
  18738. @example
  18739. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  18740. @end example
  18741. @item
  18742. Select useful frames from an ffconcat file which is using inpoints and
  18743. outpoints but where the source files are not intra frame only.
  18744. @example
  18745. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  18746. @end example
  18747. @end itemize
  18748. @section sendcmd, asendcmd
  18749. Send commands to filters in the filtergraph.
  18750. These filters read commands to be sent to other filters in the
  18751. filtergraph.
  18752. @code{sendcmd} must be inserted between two video filters,
  18753. @code{asendcmd} must be inserted between two audio filters, but apart
  18754. from that they act the same way.
  18755. The specification of commands can be provided in the filter arguments
  18756. with the @var{commands} option, or in a file specified by the
  18757. @var{filename} option.
  18758. These filters accept the following options:
  18759. @table @option
  18760. @item commands, c
  18761. Set the commands to be read and sent to the other filters.
  18762. @item filename, f
  18763. Set the filename of the commands to be read and sent to the other
  18764. filters.
  18765. @end table
  18766. @subsection Commands syntax
  18767. A commands description consists of a sequence of interval
  18768. specifications, comprising a list of commands to be executed when a
  18769. particular event related to that interval occurs. The occurring event
  18770. is typically the current frame time entering or leaving a given time
  18771. interval.
  18772. An interval is specified by the following syntax:
  18773. @example
  18774. @var{START}[-@var{END}] @var{COMMANDS};
  18775. @end example
  18776. The time interval is specified by the @var{START} and @var{END} times.
  18777. @var{END} is optional and defaults to the maximum time.
  18778. The current frame time is considered within the specified interval if
  18779. it is included in the interval [@var{START}, @var{END}), that is when
  18780. the time is greater or equal to @var{START} and is lesser than
  18781. @var{END}.
  18782. @var{COMMANDS} consists of a sequence of one or more command
  18783. specifications, separated by ",", relating to that interval. The
  18784. syntax of a command specification is given by:
  18785. @example
  18786. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  18787. @end example
  18788. @var{FLAGS} is optional and specifies the type of events relating to
  18789. the time interval which enable sending the specified command, and must
  18790. be a non-null sequence of identifier flags separated by "+" or "|" and
  18791. enclosed between "[" and "]".
  18792. The following flags are recognized:
  18793. @table @option
  18794. @item enter
  18795. The command is sent when the current frame timestamp enters the
  18796. specified interval. In other words, the command is sent when the
  18797. previous frame timestamp was not in the given interval, and the
  18798. current is.
  18799. @item leave
  18800. The command is sent when the current frame timestamp leaves the
  18801. specified interval. In other words, the command is sent when the
  18802. previous frame timestamp was in the given interval, and the
  18803. current is not.
  18804. @item expr
  18805. The command @var{ARG} is interpreted as expression and result of
  18806. expression is passed as @var{ARG}.
  18807. The expression is evaluated through the eval API and can contain the following
  18808. constants:
  18809. @table @option
  18810. @item POS
  18811. Original position in the file of the frame, or undefined if undefined
  18812. for the current frame.
  18813. @item PTS
  18814. The presentation timestamp in input.
  18815. @item N
  18816. The count of the input frame for video or audio, starting from 0.
  18817. @item T
  18818. The time in seconds of the current frame.
  18819. @item TS
  18820. The start time in seconds of the current command interval.
  18821. @item TE
  18822. The end time in seconds of the current command interval.
  18823. @item TI
  18824. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  18825. @end table
  18826. @end table
  18827. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  18828. assumed.
  18829. @var{TARGET} specifies the target of the command, usually the name of
  18830. the filter class or a specific filter instance name.
  18831. @var{COMMAND} specifies the name of the command for the target filter.
  18832. @var{ARG} is optional and specifies the optional list of argument for
  18833. the given @var{COMMAND}.
  18834. Between one interval specification and another, whitespaces, or
  18835. sequences of characters starting with @code{#} until the end of line,
  18836. are ignored and can be used to annotate comments.
  18837. A simplified BNF description of the commands specification syntax
  18838. follows:
  18839. @example
  18840. @var{COMMAND_FLAG} ::= "enter" | "leave"
  18841. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  18842. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  18843. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  18844. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  18845. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  18846. @end example
  18847. @subsection Examples
  18848. @itemize
  18849. @item
  18850. Specify audio tempo change at second 4:
  18851. @example
  18852. asendcmd=c='4.0 atempo tempo 1.5',atempo
  18853. @end example
  18854. @item
  18855. Target a specific filter instance:
  18856. @example
  18857. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  18858. @end example
  18859. @item
  18860. Specify a list of drawtext and hue commands in a file.
  18861. @example
  18862. # show text in the interval 5-10
  18863. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  18864. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  18865. # desaturate the image in the interval 15-20
  18866. 15.0-20.0 [enter] hue s 0,
  18867. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  18868. [leave] hue s 1,
  18869. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  18870. # apply an exponential saturation fade-out effect, starting from time 25
  18871. 25 [enter] hue s exp(25-t)
  18872. @end example
  18873. A filtergraph allowing to read and process the above command list
  18874. stored in a file @file{test.cmd}, can be specified with:
  18875. @example
  18876. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  18877. @end example
  18878. @end itemize
  18879. @anchor{setpts}
  18880. @section setpts, asetpts
  18881. Change the PTS (presentation timestamp) of the input frames.
  18882. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  18883. This filter accepts the following options:
  18884. @table @option
  18885. @item expr
  18886. The expression which is evaluated for each frame to construct its timestamp.
  18887. @end table
  18888. The expression is evaluated through the eval API and can contain the following
  18889. constants:
  18890. @table @option
  18891. @item FRAME_RATE, FR
  18892. frame rate, only defined for constant frame-rate video
  18893. @item PTS
  18894. The presentation timestamp in input
  18895. @item N
  18896. The count of the input frame for video or the number of consumed samples,
  18897. not including the current frame for audio, starting from 0.
  18898. @item NB_CONSUMED_SAMPLES
  18899. The number of consumed samples, not including the current frame (only
  18900. audio)
  18901. @item NB_SAMPLES, S
  18902. The number of samples in the current frame (only audio)
  18903. @item SAMPLE_RATE, SR
  18904. The audio sample rate.
  18905. @item STARTPTS
  18906. The PTS of the first frame.
  18907. @item STARTT
  18908. the time in seconds of the first frame
  18909. @item INTERLACED
  18910. State whether the current frame is interlaced.
  18911. @item T
  18912. the time in seconds of the current frame
  18913. @item POS
  18914. original position in the file of the frame, or undefined if undefined
  18915. for the current frame
  18916. @item PREV_INPTS
  18917. The previous input PTS.
  18918. @item PREV_INT
  18919. previous input time in seconds
  18920. @item PREV_OUTPTS
  18921. The previous output PTS.
  18922. @item PREV_OUTT
  18923. previous output time in seconds
  18924. @item RTCTIME
  18925. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  18926. instead.
  18927. @item RTCSTART
  18928. The wallclock (RTC) time at the start of the movie in microseconds.
  18929. @item TB
  18930. The timebase of the input timestamps.
  18931. @end table
  18932. @subsection Examples
  18933. @itemize
  18934. @item
  18935. Start counting PTS from zero
  18936. @example
  18937. setpts=PTS-STARTPTS
  18938. @end example
  18939. @item
  18940. Apply fast motion effect:
  18941. @example
  18942. setpts=0.5*PTS
  18943. @end example
  18944. @item
  18945. Apply slow motion effect:
  18946. @example
  18947. setpts=2.0*PTS
  18948. @end example
  18949. @item
  18950. Set fixed rate of 25 frames per second:
  18951. @example
  18952. setpts=N/(25*TB)
  18953. @end example
  18954. @item
  18955. Set fixed rate 25 fps with some jitter:
  18956. @example
  18957. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  18958. @end example
  18959. @item
  18960. Apply an offset of 10 seconds to the input PTS:
  18961. @example
  18962. setpts=PTS+10/TB
  18963. @end example
  18964. @item
  18965. Generate timestamps from a "live source" and rebase onto the current timebase:
  18966. @example
  18967. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  18968. @end example
  18969. @item
  18970. Generate timestamps by counting samples:
  18971. @example
  18972. asetpts=N/SR/TB
  18973. @end example
  18974. @end itemize
  18975. @section setrange
  18976. Force color range for the output video frame.
  18977. The @code{setrange} filter marks the color range property for the
  18978. output frames. It does not change the input frame, but only sets the
  18979. corresponding property, which affects how the frame is treated by
  18980. following filters.
  18981. The filter accepts the following options:
  18982. @table @option
  18983. @item range
  18984. Available values are:
  18985. @table @samp
  18986. @item auto
  18987. Keep the same color range property.
  18988. @item unspecified, unknown
  18989. Set the color range as unspecified.
  18990. @item limited, tv, mpeg
  18991. Set the color range as limited.
  18992. @item full, pc, jpeg
  18993. Set the color range as full.
  18994. @end table
  18995. @end table
  18996. @section settb, asettb
  18997. Set the timebase to use for the output frames timestamps.
  18998. It is mainly useful for testing timebase configuration.
  18999. It accepts the following parameters:
  19000. @table @option
  19001. @item expr, tb
  19002. The expression which is evaluated into the output timebase.
  19003. @end table
  19004. The value for @option{tb} is an arithmetic expression representing a
  19005. rational. The expression can contain the constants "AVTB" (the default
  19006. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  19007. audio only). Default value is "intb".
  19008. @subsection Examples
  19009. @itemize
  19010. @item
  19011. Set the timebase to 1/25:
  19012. @example
  19013. settb=expr=1/25
  19014. @end example
  19015. @item
  19016. Set the timebase to 1/10:
  19017. @example
  19018. settb=expr=0.1
  19019. @end example
  19020. @item
  19021. Set the timebase to 1001/1000:
  19022. @example
  19023. settb=1+0.001
  19024. @end example
  19025. @item
  19026. Set the timebase to 2*intb:
  19027. @example
  19028. settb=2*intb
  19029. @end example
  19030. @item
  19031. Set the default timebase value:
  19032. @example
  19033. settb=AVTB
  19034. @end example
  19035. @end itemize
  19036. @section showcqt
  19037. Convert input audio to a video output representing frequency spectrum
  19038. logarithmically using Brown-Puckette constant Q transform algorithm with
  19039. direct frequency domain coefficient calculation (but the transform itself
  19040. is not really constant Q, instead the Q factor is actually variable/clamped),
  19041. with musical tone scale, from E0 to D#10.
  19042. The filter accepts the following options:
  19043. @table @option
  19044. @item size, s
  19045. Specify the video size for the output. It must be even. For the syntax of this option,
  19046. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19047. Default value is @code{1920x1080}.
  19048. @item fps, rate, r
  19049. Set the output frame rate. Default value is @code{25}.
  19050. @item bar_h
  19051. Set the bargraph height. It must be even. Default value is @code{-1} which
  19052. computes the bargraph height automatically.
  19053. @item axis_h
  19054. Set the axis height. It must be even. Default value is @code{-1} which computes
  19055. the axis height automatically.
  19056. @item sono_h
  19057. Set the sonogram height. It must be even. Default value is @code{-1} which
  19058. computes the sonogram height automatically.
  19059. @item fullhd
  19060. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  19061. instead. Default value is @code{1}.
  19062. @item sono_v, volume
  19063. Specify the sonogram volume expression. It can contain variables:
  19064. @table @option
  19065. @item bar_v
  19066. the @var{bar_v} evaluated expression
  19067. @item frequency, freq, f
  19068. the frequency where it is evaluated
  19069. @item timeclamp, tc
  19070. the value of @var{timeclamp} option
  19071. @end table
  19072. and functions:
  19073. @table @option
  19074. @item a_weighting(f)
  19075. A-weighting of equal loudness
  19076. @item b_weighting(f)
  19077. B-weighting of equal loudness
  19078. @item c_weighting(f)
  19079. C-weighting of equal loudness.
  19080. @end table
  19081. Default value is @code{16}.
  19082. @item bar_v, volume2
  19083. Specify the bargraph volume expression. It can contain variables:
  19084. @table @option
  19085. @item sono_v
  19086. the @var{sono_v} evaluated expression
  19087. @item frequency, freq, f
  19088. the frequency where it is evaluated
  19089. @item timeclamp, tc
  19090. the value of @var{timeclamp} option
  19091. @end table
  19092. and functions:
  19093. @table @option
  19094. @item a_weighting(f)
  19095. A-weighting of equal loudness
  19096. @item b_weighting(f)
  19097. B-weighting of equal loudness
  19098. @item c_weighting(f)
  19099. C-weighting of equal loudness.
  19100. @end table
  19101. Default value is @code{sono_v}.
  19102. @item sono_g, gamma
  19103. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  19104. higher gamma makes the spectrum having more range. Default value is @code{3}.
  19105. Acceptable range is @code{[1, 7]}.
  19106. @item bar_g, gamma2
  19107. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  19108. @code{[1, 7]}.
  19109. @item bar_t
  19110. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  19111. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  19112. @item timeclamp, tc
  19113. Specify the transform timeclamp. At low frequency, there is trade-off between
  19114. accuracy in time domain and frequency domain. If timeclamp is lower,
  19115. event in time domain is represented more accurately (such as fast bass drum),
  19116. otherwise event in frequency domain is represented more accurately
  19117. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  19118. @item attack
  19119. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  19120. limits future samples by applying asymmetric windowing in time domain, useful
  19121. when low latency is required. Accepted range is @code{[0, 1]}.
  19122. @item basefreq
  19123. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  19124. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  19125. @item endfreq
  19126. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  19127. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  19128. @item coeffclamp
  19129. This option is deprecated and ignored.
  19130. @item tlength
  19131. Specify the transform length in time domain. Use this option to control accuracy
  19132. trade-off between time domain and frequency domain at every frequency sample.
  19133. It can contain variables:
  19134. @table @option
  19135. @item frequency, freq, f
  19136. the frequency where it is evaluated
  19137. @item timeclamp, tc
  19138. the value of @var{timeclamp} option.
  19139. @end table
  19140. Default value is @code{384*tc/(384+tc*f)}.
  19141. @item count
  19142. Specify the transform count for every video frame. Default value is @code{6}.
  19143. Acceptable range is @code{[1, 30]}.
  19144. @item fcount
  19145. Specify the transform count for every single pixel. Default value is @code{0},
  19146. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  19147. @item fontfile
  19148. Specify font file for use with freetype to draw the axis. If not specified,
  19149. use embedded font. Note that drawing with font file or embedded font is not
  19150. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  19151. option instead.
  19152. @item font
  19153. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  19154. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  19155. escaping.
  19156. @item fontcolor
  19157. Specify font color expression. This is arithmetic expression that should return
  19158. integer value 0xRRGGBB. It can contain variables:
  19159. @table @option
  19160. @item frequency, freq, f
  19161. the frequency where it is evaluated
  19162. @item timeclamp, tc
  19163. the value of @var{timeclamp} option
  19164. @end table
  19165. and functions:
  19166. @table @option
  19167. @item midi(f)
  19168. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  19169. @item r(x), g(x), b(x)
  19170. red, green, and blue value of intensity x.
  19171. @end table
  19172. Default value is @code{st(0, (midi(f)-59.5)/12);
  19173. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  19174. r(1-ld(1)) + b(ld(1))}.
  19175. @item axisfile
  19176. Specify image file to draw the axis. This option override @var{fontfile} and
  19177. @var{fontcolor} option.
  19178. @item axis, text
  19179. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  19180. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  19181. Default value is @code{1}.
  19182. @item csp
  19183. Set colorspace. The accepted values are:
  19184. @table @samp
  19185. @item unspecified
  19186. Unspecified (default)
  19187. @item bt709
  19188. BT.709
  19189. @item fcc
  19190. FCC
  19191. @item bt470bg
  19192. BT.470BG or BT.601-6 625
  19193. @item smpte170m
  19194. SMPTE-170M or BT.601-6 525
  19195. @item smpte240m
  19196. SMPTE-240M
  19197. @item bt2020ncl
  19198. BT.2020 with non-constant luminance
  19199. @end table
  19200. @item cscheme
  19201. Set spectrogram color scheme. This is list of floating point values with format
  19202. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  19203. The default is @code{1|0.5|0|0|0.5|1}.
  19204. @end table
  19205. @subsection Examples
  19206. @itemize
  19207. @item
  19208. Playing audio while showing the spectrum:
  19209. @example
  19210. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  19211. @end example
  19212. @item
  19213. Same as above, but with frame rate 30 fps:
  19214. @example
  19215. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  19216. @end example
  19217. @item
  19218. Playing at 1280x720:
  19219. @example
  19220. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  19221. @end example
  19222. @item
  19223. Disable sonogram display:
  19224. @example
  19225. sono_h=0
  19226. @end example
  19227. @item
  19228. A1 and its harmonics: A1, A2, (near)E3, A3:
  19229. @example
  19230. 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),
  19231. asplit[a][out1]; [a] showcqt [out0]'
  19232. @end example
  19233. @item
  19234. Same as above, but with more accuracy in frequency domain:
  19235. @example
  19236. 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),
  19237. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  19238. @end example
  19239. @item
  19240. Custom volume:
  19241. @example
  19242. bar_v=10:sono_v=bar_v*a_weighting(f)
  19243. @end example
  19244. @item
  19245. Custom gamma, now spectrum is linear to the amplitude.
  19246. @example
  19247. bar_g=2:sono_g=2
  19248. @end example
  19249. @item
  19250. Custom tlength equation:
  19251. @example
  19252. 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)))'
  19253. @end example
  19254. @item
  19255. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  19256. @example
  19257. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  19258. @end example
  19259. @item
  19260. Custom font using fontconfig:
  19261. @example
  19262. font='Courier New,Monospace,mono|bold'
  19263. @end example
  19264. @item
  19265. Custom frequency range with custom axis using image file:
  19266. @example
  19267. axisfile=myaxis.png:basefreq=40:endfreq=10000
  19268. @end example
  19269. @end itemize
  19270. @section showfreqs
  19271. Convert input audio to video output representing the audio power spectrum.
  19272. Audio amplitude is on Y-axis while frequency is on X-axis.
  19273. The filter accepts the following options:
  19274. @table @option
  19275. @item size, s
  19276. Specify size of video. For the syntax of this option, check the
  19277. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19278. Default is @code{1024x512}.
  19279. @item mode
  19280. Set display mode.
  19281. This set how each frequency bin will be represented.
  19282. It accepts the following values:
  19283. @table @samp
  19284. @item line
  19285. @item bar
  19286. @item dot
  19287. @end table
  19288. Default is @code{bar}.
  19289. @item ascale
  19290. Set amplitude scale.
  19291. It accepts the following values:
  19292. @table @samp
  19293. @item lin
  19294. Linear scale.
  19295. @item sqrt
  19296. Square root scale.
  19297. @item cbrt
  19298. Cubic root scale.
  19299. @item log
  19300. Logarithmic scale.
  19301. @end table
  19302. Default is @code{log}.
  19303. @item fscale
  19304. Set frequency scale.
  19305. It accepts the following values:
  19306. @table @samp
  19307. @item lin
  19308. Linear scale.
  19309. @item log
  19310. Logarithmic scale.
  19311. @item rlog
  19312. Reverse logarithmic scale.
  19313. @end table
  19314. Default is @code{lin}.
  19315. @item win_size
  19316. Set window size. Allowed range is from 16 to 65536.
  19317. Default is @code{2048}
  19318. @item win_func
  19319. Set windowing function.
  19320. It accepts the following values:
  19321. @table @samp
  19322. @item rect
  19323. @item bartlett
  19324. @item hanning
  19325. @item hamming
  19326. @item blackman
  19327. @item welch
  19328. @item flattop
  19329. @item bharris
  19330. @item bnuttall
  19331. @item bhann
  19332. @item sine
  19333. @item nuttall
  19334. @item lanczos
  19335. @item gauss
  19336. @item tukey
  19337. @item dolph
  19338. @item cauchy
  19339. @item parzen
  19340. @item poisson
  19341. @item bohman
  19342. @end table
  19343. Default is @code{hanning}.
  19344. @item overlap
  19345. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19346. which means optimal overlap for selected window function will be picked.
  19347. @item averaging
  19348. Set time averaging. Setting this to 0 will display current maximal peaks.
  19349. Default is @code{1}, which means time averaging is disabled.
  19350. @item colors
  19351. Specify list of colors separated by space or by '|' which will be used to
  19352. draw channel frequencies. Unrecognized or missing colors will be replaced
  19353. by white color.
  19354. @item cmode
  19355. Set channel display mode.
  19356. It accepts the following values:
  19357. @table @samp
  19358. @item combined
  19359. @item separate
  19360. @end table
  19361. Default is @code{combined}.
  19362. @item minamp
  19363. Set minimum amplitude used in @code{log} amplitude scaler.
  19364. @item data
  19365. Set data display mode.
  19366. It accepts the following values:
  19367. @table @samp
  19368. @item magnitude
  19369. @item phase
  19370. @item delay
  19371. @end table
  19372. Default is @code{magnitude}.
  19373. @end table
  19374. @section showspatial
  19375. Convert stereo input audio to a video output, representing the spatial relationship
  19376. between two channels.
  19377. The filter accepts the following options:
  19378. @table @option
  19379. @item size, s
  19380. Specify the video size for the output. For the syntax of this option, check the
  19381. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19382. Default value is @code{512x512}.
  19383. @item win_size
  19384. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  19385. @item win_func
  19386. Set window function.
  19387. It accepts the following values:
  19388. @table @samp
  19389. @item rect
  19390. @item bartlett
  19391. @item hann
  19392. @item hanning
  19393. @item hamming
  19394. @item blackman
  19395. @item welch
  19396. @item flattop
  19397. @item bharris
  19398. @item bnuttall
  19399. @item bhann
  19400. @item sine
  19401. @item nuttall
  19402. @item lanczos
  19403. @item gauss
  19404. @item tukey
  19405. @item dolph
  19406. @item cauchy
  19407. @item parzen
  19408. @item poisson
  19409. @item bohman
  19410. @end table
  19411. Default value is @code{hann}.
  19412. @item overlap
  19413. Set ratio of overlap window. Default value is @code{0.5}.
  19414. When value is @code{1} overlap is set to recommended size for specific
  19415. window function currently used.
  19416. @end table
  19417. @anchor{showspectrum}
  19418. @section showspectrum
  19419. Convert input audio to a video output, representing the audio frequency
  19420. spectrum.
  19421. The filter accepts the following options:
  19422. @table @option
  19423. @item size, s
  19424. Specify the video size for the output. For the syntax of this option, check the
  19425. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19426. Default value is @code{640x512}.
  19427. @item slide
  19428. Specify how the spectrum should slide along the window.
  19429. It accepts the following values:
  19430. @table @samp
  19431. @item replace
  19432. the samples start again on the left when they reach the right
  19433. @item scroll
  19434. the samples scroll from right to left
  19435. @item fullframe
  19436. frames are only produced when the samples reach the right
  19437. @item rscroll
  19438. the samples scroll from left to right
  19439. @end table
  19440. Default value is @code{replace}.
  19441. @item mode
  19442. Specify display mode.
  19443. It accepts the following values:
  19444. @table @samp
  19445. @item combined
  19446. all channels are displayed in the same row
  19447. @item separate
  19448. all channels are displayed in separate rows
  19449. @end table
  19450. Default value is @samp{combined}.
  19451. @item color
  19452. Specify display color mode.
  19453. It accepts the following values:
  19454. @table @samp
  19455. @item channel
  19456. each channel is displayed in a separate color
  19457. @item intensity
  19458. each channel is displayed using the same color scheme
  19459. @item rainbow
  19460. each channel is displayed using the rainbow color scheme
  19461. @item moreland
  19462. each channel is displayed using the moreland color scheme
  19463. @item nebulae
  19464. each channel is displayed using the nebulae color scheme
  19465. @item fire
  19466. each channel is displayed using the fire color scheme
  19467. @item fiery
  19468. each channel is displayed using the fiery color scheme
  19469. @item fruit
  19470. each channel is displayed using the fruit color scheme
  19471. @item cool
  19472. each channel is displayed using the cool color scheme
  19473. @item magma
  19474. each channel is displayed using the magma color scheme
  19475. @item green
  19476. each channel is displayed using the green color scheme
  19477. @item viridis
  19478. each channel is displayed using the viridis color scheme
  19479. @item plasma
  19480. each channel is displayed using the plasma color scheme
  19481. @item cividis
  19482. each channel is displayed using the cividis color scheme
  19483. @item terrain
  19484. each channel is displayed using the terrain color scheme
  19485. @end table
  19486. Default value is @samp{channel}.
  19487. @item scale
  19488. Specify scale used for calculating intensity color values.
  19489. It accepts the following values:
  19490. @table @samp
  19491. @item lin
  19492. linear
  19493. @item sqrt
  19494. square root, default
  19495. @item cbrt
  19496. cubic root
  19497. @item log
  19498. logarithmic
  19499. @item 4thrt
  19500. 4th root
  19501. @item 5thrt
  19502. 5th root
  19503. @end table
  19504. Default value is @samp{sqrt}.
  19505. @item fscale
  19506. Specify frequency scale.
  19507. It accepts the following values:
  19508. @table @samp
  19509. @item lin
  19510. linear
  19511. @item log
  19512. logarithmic
  19513. @end table
  19514. Default value is @samp{lin}.
  19515. @item saturation
  19516. Set saturation modifier for displayed colors. Negative values provide
  19517. alternative color scheme. @code{0} is no saturation at all.
  19518. Saturation must be in [-10.0, 10.0] range.
  19519. Default value is @code{1}.
  19520. @item win_func
  19521. Set window function.
  19522. It accepts the following values:
  19523. @table @samp
  19524. @item rect
  19525. @item bartlett
  19526. @item hann
  19527. @item hanning
  19528. @item hamming
  19529. @item blackman
  19530. @item welch
  19531. @item flattop
  19532. @item bharris
  19533. @item bnuttall
  19534. @item bhann
  19535. @item sine
  19536. @item nuttall
  19537. @item lanczos
  19538. @item gauss
  19539. @item tukey
  19540. @item dolph
  19541. @item cauchy
  19542. @item parzen
  19543. @item poisson
  19544. @item bohman
  19545. @end table
  19546. Default value is @code{hann}.
  19547. @item orientation
  19548. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19549. @code{horizontal}. Default is @code{vertical}.
  19550. @item overlap
  19551. Set ratio of overlap window. Default value is @code{0}.
  19552. When value is @code{1} overlap is set to recommended size for specific
  19553. window function currently used.
  19554. @item gain
  19555. Set scale gain for calculating intensity color values.
  19556. Default value is @code{1}.
  19557. @item data
  19558. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  19559. @item rotation
  19560. Set color rotation, must be in [-1.0, 1.0] range.
  19561. Default value is @code{0}.
  19562. @item start
  19563. Set start frequency from which to display spectrogram. Default is @code{0}.
  19564. @item stop
  19565. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19566. @item fps
  19567. Set upper frame rate limit. Default is @code{auto}, unlimited.
  19568. @item legend
  19569. Draw time and frequency axes and legends. Default is disabled.
  19570. @end table
  19571. The usage is very similar to the showwaves filter; see the examples in that
  19572. section.
  19573. @subsection Examples
  19574. @itemize
  19575. @item
  19576. Large window with logarithmic color scaling:
  19577. @example
  19578. showspectrum=s=1280x480:scale=log
  19579. @end example
  19580. @item
  19581. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  19582. @example
  19583. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19584. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  19585. @end example
  19586. @end itemize
  19587. @section showspectrumpic
  19588. Convert input audio to a single video frame, representing the audio frequency
  19589. spectrum.
  19590. The filter accepts the following options:
  19591. @table @option
  19592. @item size, s
  19593. Specify the video size for the output. For the syntax of this option, check the
  19594. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19595. Default value is @code{4096x2048}.
  19596. @item mode
  19597. Specify display mode.
  19598. It accepts the following values:
  19599. @table @samp
  19600. @item combined
  19601. all channels are displayed in the same row
  19602. @item separate
  19603. all channels are displayed in separate rows
  19604. @end table
  19605. Default value is @samp{combined}.
  19606. @item color
  19607. Specify display color mode.
  19608. It accepts the following values:
  19609. @table @samp
  19610. @item channel
  19611. each channel is displayed in a separate color
  19612. @item intensity
  19613. each channel is displayed using the same color scheme
  19614. @item rainbow
  19615. each channel is displayed using the rainbow color scheme
  19616. @item moreland
  19617. each channel is displayed using the moreland color scheme
  19618. @item nebulae
  19619. each channel is displayed using the nebulae color scheme
  19620. @item fire
  19621. each channel is displayed using the fire color scheme
  19622. @item fiery
  19623. each channel is displayed using the fiery color scheme
  19624. @item fruit
  19625. each channel is displayed using the fruit color scheme
  19626. @item cool
  19627. each channel is displayed using the cool color scheme
  19628. @item magma
  19629. each channel is displayed using the magma color scheme
  19630. @item green
  19631. each channel is displayed using the green color scheme
  19632. @item viridis
  19633. each channel is displayed using the viridis color scheme
  19634. @item plasma
  19635. each channel is displayed using the plasma color scheme
  19636. @item cividis
  19637. each channel is displayed using the cividis color scheme
  19638. @item terrain
  19639. each channel is displayed using the terrain color scheme
  19640. @end table
  19641. Default value is @samp{intensity}.
  19642. @item scale
  19643. Specify scale used for calculating intensity color values.
  19644. It accepts the following values:
  19645. @table @samp
  19646. @item lin
  19647. linear
  19648. @item sqrt
  19649. square root, default
  19650. @item cbrt
  19651. cubic root
  19652. @item log
  19653. logarithmic
  19654. @item 4thrt
  19655. 4th root
  19656. @item 5thrt
  19657. 5th root
  19658. @end table
  19659. Default value is @samp{log}.
  19660. @item fscale
  19661. Specify frequency scale.
  19662. It accepts the following values:
  19663. @table @samp
  19664. @item lin
  19665. linear
  19666. @item log
  19667. logarithmic
  19668. @end table
  19669. Default value is @samp{lin}.
  19670. @item saturation
  19671. Set saturation modifier for displayed colors. Negative values provide
  19672. alternative color scheme. @code{0} is no saturation at all.
  19673. Saturation must be in [-10.0, 10.0] range.
  19674. Default value is @code{1}.
  19675. @item win_func
  19676. Set window function.
  19677. It accepts the following values:
  19678. @table @samp
  19679. @item rect
  19680. @item bartlett
  19681. @item hann
  19682. @item hanning
  19683. @item hamming
  19684. @item blackman
  19685. @item welch
  19686. @item flattop
  19687. @item bharris
  19688. @item bnuttall
  19689. @item bhann
  19690. @item sine
  19691. @item nuttall
  19692. @item lanczos
  19693. @item gauss
  19694. @item tukey
  19695. @item dolph
  19696. @item cauchy
  19697. @item parzen
  19698. @item poisson
  19699. @item bohman
  19700. @end table
  19701. Default value is @code{hann}.
  19702. @item orientation
  19703. Set orientation of time vs frequency axis. Can be @code{vertical} or
  19704. @code{horizontal}. Default is @code{vertical}.
  19705. @item gain
  19706. Set scale gain for calculating intensity color values.
  19707. Default value is @code{1}.
  19708. @item legend
  19709. Draw time and frequency axes and legends. Default is enabled.
  19710. @item rotation
  19711. Set color rotation, must be in [-1.0, 1.0] range.
  19712. Default value is @code{0}.
  19713. @item start
  19714. Set start frequency from which to display spectrogram. Default is @code{0}.
  19715. @item stop
  19716. Set stop frequency to which to display spectrogram. Default is @code{0}.
  19717. @end table
  19718. @subsection Examples
  19719. @itemize
  19720. @item
  19721. Extract an audio spectrogram of a whole audio track
  19722. in a 1024x1024 picture using @command{ffmpeg}:
  19723. @example
  19724. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  19725. @end example
  19726. @end itemize
  19727. @section showvolume
  19728. Convert input audio volume to a video output.
  19729. The filter accepts the following options:
  19730. @table @option
  19731. @item rate, r
  19732. Set video rate.
  19733. @item b
  19734. Set border width, allowed range is [0, 5]. Default is 1.
  19735. @item w
  19736. Set channel width, allowed range is [80, 8192]. Default is 400.
  19737. @item h
  19738. Set channel height, allowed range is [1, 900]. Default is 20.
  19739. @item f
  19740. Set fade, allowed range is [0, 1]. Default is 0.95.
  19741. @item c
  19742. Set volume color expression.
  19743. The expression can use the following variables:
  19744. @table @option
  19745. @item VOLUME
  19746. Current max volume of channel in dB.
  19747. @item PEAK
  19748. Current peak.
  19749. @item CHANNEL
  19750. Current channel number, starting from 0.
  19751. @end table
  19752. @item t
  19753. If set, displays channel names. Default is enabled.
  19754. @item v
  19755. If set, displays volume values. Default is enabled.
  19756. @item o
  19757. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  19758. default is @code{h}.
  19759. @item s
  19760. Set step size, allowed range is [0, 5]. Default is 0, which means
  19761. step is disabled.
  19762. @item p
  19763. Set background opacity, allowed range is [0, 1]. Default is 0.
  19764. @item m
  19765. Set metering mode, can be peak: @code{p} or rms: @code{r},
  19766. default is @code{p}.
  19767. @item ds
  19768. Set display scale, can be linear: @code{lin} or log: @code{log},
  19769. default is @code{lin}.
  19770. @item dm
  19771. In second.
  19772. If set to > 0., display a line for the max level
  19773. in the previous seconds.
  19774. default is disabled: @code{0.}
  19775. @item dmc
  19776. The color of the max line. Use when @code{dm} option is set to > 0.
  19777. default is: @code{orange}
  19778. @end table
  19779. @section showwaves
  19780. Convert input audio to a video output, representing the samples waves.
  19781. The filter accepts the following options:
  19782. @table @option
  19783. @item size, s
  19784. Specify the video size for the output. For the syntax of this option, check the
  19785. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19786. Default value is @code{600x240}.
  19787. @item mode
  19788. Set display mode.
  19789. Available values are:
  19790. @table @samp
  19791. @item point
  19792. Draw a point for each sample.
  19793. @item line
  19794. Draw a vertical line for each sample.
  19795. @item p2p
  19796. Draw a point for each sample and a line between them.
  19797. @item cline
  19798. Draw a centered vertical line for each sample.
  19799. @end table
  19800. Default value is @code{point}.
  19801. @item n
  19802. Set the number of samples which are printed on the same column. A
  19803. larger value will decrease the frame rate. Must be a positive
  19804. integer. This option can be set only if the value for @var{rate}
  19805. is not explicitly specified.
  19806. @item rate, r
  19807. Set the (approximate) output frame rate. This is done by setting the
  19808. option @var{n}. Default value is "25".
  19809. @item split_channels
  19810. Set if channels should be drawn separately or overlap. Default value is 0.
  19811. @item colors
  19812. Set colors separated by '|' which are going to be used for drawing of each channel.
  19813. @item scale
  19814. Set amplitude scale.
  19815. Available values are:
  19816. @table @samp
  19817. @item lin
  19818. Linear.
  19819. @item log
  19820. Logarithmic.
  19821. @item sqrt
  19822. Square root.
  19823. @item cbrt
  19824. Cubic root.
  19825. @end table
  19826. Default is linear.
  19827. @item draw
  19828. Set the draw mode. This is mostly useful to set for high @var{n}.
  19829. Available values are:
  19830. @table @samp
  19831. @item scale
  19832. Scale pixel values for each drawn sample.
  19833. @item full
  19834. Draw every sample directly.
  19835. @end table
  19836. Default value is @code{scale}.
  19837. @end table
  19838. @subsection Examples
  19839. @itemize
  19840. @item
  19841. Output the input file audio and the corresponding video representation
  19842. at the same time:
  19843. @example
  19844. amovie=a.mp3,asplit[out0],showwaves[out1]
  19845. @end example
  19846. @item
  19847. Create a synthetic signal and show it with showwaves, forcing a
  19848. frame rate of 30 frames per second:
  19849. @example
  19850. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  19851. @end example
  19852. @end itemize
  19853. @section showwavespic
  19854. Convert input audio to a single video frame, representing the samples waves.
  19855. The filter accepts the following options:
  19856. @table @option
  19857. @item size, s
  19858. Specify the video size for the output. For the syntax of this option, check the
  19859. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19860. Default value is @code{600x240}.
  19861. @item split_channels
  19862. Set if channels should be drawn separately or overlap. Default value is 0.
  19863. @item colors
  19864. Set colors separated by '|' which are going to be used for drawing of each channel.
  19865. @item scale
  19866. Set amplitude scale.
  19867. Available values are:
  19868. @table @samp
  19869. @item lin
  19870. Linear.
  19871. @item log
  19872. Logarithmic.
  19873. @item sqrt
  19874. Square root.
  19875. @item cbrt
  19876. Cubic root.
  19877. @end table
  19878. Default is linear.
  19879. @item draw
  19880. Set the draw mode.
  19881. Available values are:
  19882. @table @samp
  19883. @item scale
  19884. Scale pixel values for each drawn sample.
  19885. @item full
  19886. Draw every sample directly.
  19887. @end table
  19888. Default value is @code{scale}.
  19889. @item filter
  19890. Set the filter mode.
  19891. Available values are:
  19892. @table @samp
  19893. @item average
  19894. Use average samples values for each drawn sample.
  19895. @item peak
  19896. Use peak samples values for each drawn sample.
  19897. @end table
  19898. Default value is @code{average}.
  19899. @end table
  19900. @subsection Examples
  19901. @itemize
  19902. @item
  19903. Extract a channel split representation of the wave form of a whole audio track
  19904. in a 1024x800 picture using @command{ffmpeg}:
  19905. @example
  19906. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  19907. @end example
  19908. @end itemize
  19909. @section sidedata, asidedata
  19910. Delete frame side data, or select frames based on it.
  19911. This filter accepts the following options:
  19912. @table @option
  19913. @item mode
  19914. Set mode of operation of the filter.
  19915. Can be one of the following:
  19916. @table @samp
  19917. @item select
  19918. Select every frame with side data of @code{type}.
  19919. @item delete
  19920. Delete side data of @code{type}. If @code{type} is not set, delete all side
  19921. data in the frame.
  19922. @end table
  19923. @item type
  19924. Set side data type used with all modes. Must be set for @code{select} mode. For
  19925. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  19926. in @file{libavutil/frame.h}. For example, to choose
  19927. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  19928. @end table
  19929. @section spectrumsynth
  19930. Synthesize audio from 2 input video spectrums, first input stream represents
  19931. magnitude across time and second represents phase across time.
  19932. The filter will transform from frequency domain as displayed in videos back
  19933. to time domain as presented in audio output.
  19934. This filter is primarily created for reversing processed @ref{showspectrum}
  19935. filter outputs, but can synthesize sound from other spectrograms too.
  19936. But in such case results are going to be poor if the phase data is not
  19937. available, because in such cases phase data need to be recreated, usually
  19938. it's just recreated from random noise.
  19939. For best results use gray only output (@code{channel} color mode in
  19940. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  19941. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  19942. @code{data} option. Inputs videos should generally use @code{fullframe}
  19943. slide mode as that saves resources needed for decoding video.
  19944. The filter accepts the following options:
  19945. @table @option
  19946. @item sample_rate
  19947. Specify sample rate of output audio, the sample rate of audio from which
  19948. spectrum was generated may differ.
  19949. @item channels
  19950. Set number of channels represented in input video spectrums.
  19951. @item scale
  19952. Set scale which was used when generating magnitude input spectrum.
  19953. Can be @code{lin} or @code{log}. Default is @code{log}.
  19954. @item slide
  19955. Set slide which was used when generating inputs spectrums.
  19956. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  19957. Default is @code{fullframe}.
  19958. @item win_func
  19959. Set window function used for resynthesis.
  19960. @item overlap
  19961. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  19962. which means optimal overlap for selected window function will be picked.
  19963. @item orientation
  19964. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  19965. Default is @code{vertical}.
  19966. @end table
  19967. @subsection Examples
  19968. @itemize
  19969. @item
  19970. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  19971. then resynthesize videos back to audio with spectrumsynth:
  19972. @example
  19973. 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
  19974. 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
  19975. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  19976. @end example
  19977. @end itemize
  19978. @section split, asplit
  19979. Split input into several identical outputs.
  19980. @code{asplit} works with audio input, @code{split} with video.
  19981. The filter accepts a single parameter which specifies the number of outputs. If
  19982. unspecified, it defaults to 2.
  19983. @subsection Examples
  19984. @itemize
  19985. @item
  19986. Create two separate outputs from the same input:
  19987. @example
  19988. [in] split [out0][out1]
  19989. @end example
  19990. @item
  19991. To create 3 or more outputs, you need to specify the number of
  19992. outputs, like in:
  19993. @example
  19994. [in] asplit=3 [out0][out1][out2]
  19995. @end example
  19996. @item
  19997. Create two separate outputs from the same input, one cropped and
  19998. one padded:
  19999. @example
  20000. [in] split [splitout1][splitout2];
  20001. [splitout1] crop=100:100:0:0 [cropout];
  20002. [splitout2] pad=200:200:100:100 [padout];
  20003. @end example
  20004. @item
  20005. Create 5 copies of the input audio with @command{ffmpeg}:
  20006. @example
  20007. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  20008. @end example
  20009. @end itemize
  20010. @section zmq, azmq
  20011. Receive commands sent through a libzmq client, and forward them to
  20012. filters in the filtergraph.
  20013. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  20014. must be inserted between two video filters, @code{azmq} between two
  20015. audio filters. Both are capable to send messages to any filter type.
  20016. To enable these filters you need to install the libzmq library and
  20017. headers and configure FFmpeg with @code{--enable-libzmq}.
  20018. For more information about libzmq see:
  20019. @url{http://www.zeromq.org/}
  20020. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  20021. receives messages sent through a network interface defined by the
  20022. @option{bind_address} (or the abbreviation "@option{b}") option.
  20023. Default value of this option is @file{tcp://localhost:5555}. You may
  20024. want to alter this value to your needs, but do not forget to escape any
  20025. ':' signs (see @ref{filtergraph escaping}).
  20026. The received message must be in the form:
  20027. @example
  20028. @var{TARGET} @var{COMMAND} [@var{ARG}]
  20029. @end example
  20030. @var{TARGET} specifies the target of the command, usually the name of
  20031. the filter class or a specific filter instance name. The default
  20032. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  20033. but you can override this by using the @samp{filter_name@@id} syntax
  20034. (see @ref{Filtergraph syntax}).
  20035. @var{COMMAND} specifies the name of the command for the target filter.
  20036. @var{ARG} is optional and specifies the optional argument list for the
  20037. given @var{COMMAND}.
  20038. Upon reception, the message is processed and the corresponding command
  20039. is injected into the filtergraph. Depending on the result, the filter
  20040. will send a reply to the client, adopting the format:
  20041. @example
  20042. @var{ERROR_CODE} @var{ERROR_REASON}
  20043. @var{MESSAGE}
  20044. @end example
  20045. @var{MESSAGE} is optional.
  20046. @subsection Examples
  20047. Look at @file{tools/zmqsend} for an example of a zmq client which can
  20048. be used to send commands processed by these filters.
  20049. Consider the following filtergraph generated by @command{ffplay}.
  20050. In this example the last overlay filter has an instance name. All other
  20051. filters will have default instance names.
  20052. @example
  20053. ffplay -dumpgraph 1 -f lavfi "
  20054. color=s=100x100:c=red [l];
  20055. color=s=100x100:c=blue [r];
  20056. nullsrc=s=200x100, zmq [bg];
  20057. [bg][l] overlay [bg+l];
  20058. [bg+l][r] overlay@@my=x=100 "
  20059. @end example
  20060. To change the color of the left side of the video, the following
  20061. command can be used:
  20062. @example
  20063. echo Parsed_color_0 c yellow | tools/zmqsend
  20064. @end example
  20065. To change the right side:
  20066. @example
  20067. echo Parsed_color_1 c pink | tools/zmqsend
  20068. @end example
  20069. To change the position of the right side:
  20070. @example
  20071. echo overlay@@my x 150 | tools/zmqsend
  20072. @end example
  20073. @c man end MULTIMEDIA FILTERS
  20074. @chapter Multimedia Sources
  20075. @c man begin MULTIMEDIA SOURCES
  20076. Below is a description of the currently available multimedia sources.
  20077. @section amovie
  20078. This is the same as @ref{movie} source, except it selects an audio
  20079. stream by default.
  20080. @anchor{movie}
  20081. @section movie
  20082. Read audio and/or video stream(s) from a movie container.
  20083. It accepts the following parameters:
  20084. @table @option
  20085. @item filename
  20086. The name of the resource to read (not necessarily a file; it can also be a
  20087. device or a stream accessed through some protocol).
  20088. @item format_name, f
  20089. Specifies the format assumed for the movie to read, and can be either
  20090. the name of a container or an input device. If not specified, the
  20091. format is guessed from @var{movie_name} or by probing.
  20092. @item seek_point, sp
  20093. Specifies the seek point in seconds. The frames will be output
  20094. starting from this seek point. The parameter is evaluated with
  20095. @code{av_strtod}, so the numerical value may be suffixed by an IS
  20096. postfix. The default value is "0".
  20097. @item streams, s
  20098. Specifies the streams to read. Several streams can be specified,
  20099. separated by "+". The source will then have as many outputs, in the
  20100. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  20101. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  20102. respectively the default (best suited) video and audio stream. Default
  20103. is "dv", or "da" if the filter is called as "amovie".
  20104. @item stream_index, si
  20105. Specifies the index of the video stream to read. If the value is -1,
  20106. the most suitable video stream will be automatically selected. The default
  20107. value is "-1". Deprecated. If the filter is called "amovie", it will select
  20108. audio instead of video.
  20109. @item loop
  20110. Specifies how many times to read the stream in sequence.
  20111. If the value is 0, the stream will be looped infinitely.
  20112. Default value is "1".
  20113. Note that when the movie is looped the source timestamps are not
  20114. changed, so it will generate non monotonically increasing timestamps.
  20115. @item discontinuity
  20116. Specifies the time difference between frames above which the point is
  20117. considered a timestamp discontinuity which is removed by adjusting the later
  20118. timestamps.
  20119. @end table
  20120. It allows overlaying a second video on top of the main input of
  20121. a filtergraph, as shown in this graph:
  20122. @example
  20123. input -----------> deltapts0 --> overlay --> output
  20124. ^
  20125. |
  20126. movie --> scale--> deltapts1 -------+
  20127. @end example
  20128. @subsection Examples
  20129. @itemize
  20130. @item
  20131. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  20132. on top of the input labelled "in":
  20133. @example
  20134. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20135. [in] setpts=PTS-STARTPTS [main];
  20136. [main][over] overlay=16:16 [out]
  20137. @end example
  20138. @item
  20139. Read from a video4linux2 device, and overlay it on top of the input
  20140. labelled "in":
  20141. @example
  20142. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  20143. [in] setpts=PTS-STARTPTS [main];
  20144. [main][over] overlay=16:16 [out]
  20145. @end example
  20146. @item
  20147. Read the first video stream and the audio stream with id 0x81 from
  20148. dvd.vob; the video is connected to the pad named "video" and the audio is
  20149. connected to the pad named "audio":
  20150. @example
  20151. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  20152. @end example
  20153. @end itemize
  20154. @subsection Commands
  20155. Both movie and amovie support the following commands:
  20156. @table @option
  20157. @item seek
  20158. Perform seek using "av_seek_frame".
  20159. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  20160. @itemize
  20161. @item
  20162. @var{stream_index}: If stream_index is -1, a default
  20163. stream is selected, and @var{timestamp} is automatically converted
  20164. from AV_TIME_BASE units to the stream specific time_base.
  20165. @item
  20166. @var{timestamp}: Timestamp in AVStream.time_base units
  20167. or, if no stream is specified, in AV_TIME_BASE units.
  20168. @item
  20169. @var{flags}: Flags which select direction and seeking mode.
  20170. @end itemize
  20171. @item get_duration
  20172. Get movie duration in AV_TIME_BASE units.
  20173. @end table
  20174. @c man end MULTIMEDIA SOURCES